@capagents/forgeqe 3.3.3 → 3.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/HOW_TO_USE.md +18 -10
- package/dist/docs-site/docs/area-operations/index.html +18 -10
- package/dist/docs-site/docs/search.js +1 -1
- package/dist/forgeqe.js +1899 -1899
- package/dist/web/assets/Agent-d4YX63iA.js +10 -0
- package/dist/web/assets/{AgentWork-CqMhsFBP.js → AgentWork-DmCMV4YL.js} +1 -1
- package/dist/web/assets/ApiTests-C_L2iJ8s.js +17 -0
- package/dist/web/assets/{Chat-DO-UvDWX.js → Chat-DNiUvy2O.js} +1 -1
- package/dist/web/assets/{Compare-BFuLcrBB.js → Compare-CVvpgS-7.js} +1 -1
- package/dist/web/assets/{Cost-DbKrBm9m.js → Cost-DJnZYyQP.js} +1 -1
- package/dist/web/assets/{Data-B6_6Rm7C.js → Data-DEWYrB9n.js} +1 -1
- package/dist/web/assets/{Desktop-CnBxMp68.js → Desktop-Bm6ObXhU.js} +1 -1
- package/dist/web/assets/{DesktopReview-DVITz4Jv.js → DesktopReview-Bcs7E_SB.js} +1 -1
- package/dist/web/assets/{Evidence-BZx9UF1t.js → Evidence-D5fORfDF.js} +1 -1
- package/dist/web/assets/{Explore-Kkl9koqy.js → Explore-Dhwu33Xf.js} +1 -1
- package/dist/web/assets/{Features-_WrrIGBz.js → Features-D-HIDQqF.js} +1 -1
- package/dist/web/assets/{Flags-BGqG09qD.js → Flags-DEitGv3r.js} +1 -1
- package/dist/web/assets/{Flaky-B7mr96H8.js → Flaky-F5NHbFgI.js} +1 -1
- package/dist/web/assets/{Impact-DzAtWie1.js → Impact-eg2nHsiv.js} +1 -1
- package/dist/web/assets/{Jobs-YSmfG7C9.js → Jobs-GBUaaYcw.js} +1 -1
- package/dist/web/assets/{KindPage-UqU2qh63.js → KindPage-CaXbIzyO.js} +1 -1
- package/dist/web/assets/{Migration-CfHZeobD.js → Migration-ZhSPJ6QL.js} +5 -5
- package/dist/web/assets/{Mobile-DTMPjWeO.js → Mobile-ClrjICJt.js} +1 -1
- package/dist/web/assets/{Observability-B-9cikxK.js → Observability-CQ7WAuBH.js} +1 -1
- package/dist/web/assets/{OwnItems-BC9M20At.js → OwnItems-CedxNuRy.js} +1 -1
- package/dist/web/assets/{PageAgent-CvV8gwuP.js → PageAgent-CDYs-i-n.js} +1 -1
- package/dist/web/assets/{Product-lDXsflpD.js → Product-DyhX2TYr.js} +1 -1
- package/dist/web/assets/{Production-BHXWX-ww.js → Production-DSDdBODO.js} +1 -1
- package/dist/web/assets/{Quality-Bsljiu_v.js → Quality-CdrPT4WV.js} +1 -1
- package/dist/web/assets/{Readiness-BZppEirK.js → Readiness-C9qM2rKO.js} +1 -1
- package/dist/web/assets/{Record-7h0EFEiJ.js → Record-C790-f2w.js} +1 -1
- package/dist/web/assets/{Regression-DdM66t2E.js → Regression-PDhRTDKs.js} +1 -1
- package/dist/web/assets/{Reports-u72R1XBV.js → Reports-BBRMV5V8.js} +1 -1
- package/dist/web/assets/{Requirements-BAcEi5Fl.js → Requirements-DRz1Yudy.js} +2 -2
- package/dist/web/assets/{Responsive-CCPzSbdd.js → Responsive-DZXESkT1.js} +2 -2
- package/dist/web/assets/{RunDiff-CGhLqPpP.js → RunDiff-CsND-A6h.js} +1 -1
- package/dist/web/assets/{Settings-DDCiQZ0T.js → Settings-VqVLvH-Z.js} +3 -3
- package/dist/web/assets/{Steps-sfVkdv7g.js → Steps-6x6JVBmk.js} +1 -1
- package/dist/web/assets/{TestData-B4-xVlvt.js → TestData-hIJO8oL4.js} +1 -1
- package/dist/web/assets/{TestManagement-BGBKGV1L.js → TestManagement-SBq56JNZ.js} +1 -1
- package/dist/web/assets/{WhatsNew-BMTuBbaX.js → WhatsNew-BwV-yle3.js} +1 -1
- package/dist/web/assets/{agentSettingsSheet-Cc2W6lyp.js → agentSettingsSheet-CUOx_y4s.js} +1 -1
- package/dist/web/assets/{dataParts-CkwgLllh.js → dataParts-_X5zGtE9.js} +1 -1
- package/dist/web/assets/frame-CgBYYtdw.js +13 -0
- package/dist/web/assets/{index-6SZomYE0.js → index-D10waU4_.js} +5 -5
- package/dist/web/assets/index-DVlmTifI.css +2 -0
- package/dist/web/assets/{markdown-1wY7hIbM.js → markdown-CwgDQU8m.js} +5 -5
- package/dist/web/assets/{productParts-D18glCBr.js → productParts-CUvTBJkC.js} +1 -1
- package/dist/web/assets/{qualityParts-1F1Ee4Ay.js → qualityParts-BFDaQh7A.js} +1 -1
- package/dist/web/assets/stepper-C6U4inhc.js +1 -0
- package/dist/web/assets/{wizardParts-C0cNmIK9.js → wizardParts-fa6KdWVg.js} +1 -1
- package/dist/web/index.html +4 -4
- package/docs/user-guide.html +18 -10
- package/package.json +1 -1
- package/dist/web/assets/Agent-Bd54dLhD.js +0 -10
- package/dist/web/assets/ApiTests-BO_sKAg8.js +0 -15
- package/dist/web/assets/frame-BMpSUo2-.js +0 -13
- package/dist/web/assets/index-CWqwtFKz.css +0 -2
- package/dist/web/assets/stepper-DdgwJtbU.js +0 -1
|
@@ -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{t}from"./react-BDur5s0O.js";import{a as n,n as r,r as i}from"./route-oDy8sV6H.js";import{F as a,H as o,L as s,R as c,a as l,c as u,l as d,p as f,s as p,t as m}from"./preload-helper-BupTYkQW.js";import{n as h,t as g}from"./utils-DJRAScIl.js";import{t as _}from"./jsx-runtime-LKYXHABd.js";import{A as v,C as y,D as b,E as x,I as S,K as C,L as w,M as T,O as E,P as D,S as O,T as k,U as A,_ as j,a as M,b as N,g as P,h as ee,i as F,k as I,m as te,s as ne,u as re,v as L,w as ie,y as ae}from"./palette-6YAAmgkD.js";import{O as oe,i as se,j as ce,k as le,m as R,n as ue,t as de,v as fe}from"./sectionList-B651VPon.js";import{A as pe,E as me,F as he,O as ge,U as _e,ct as ve,et as ye,f as be,ft as xe,it as Se,l as Ce,lt as we,st as Te,t as Ee,tt as De,u as Oe,x as ke}from"./api-BsiuHmJq.js";import{C as z,S as Ae,_ as je,b as Me,f as Ne,g as B,h as Pe,n as Fe,r as Ie,t as Le,w as Re,x as V,y as ze}from"./pageBack-CbyKfisx.js";import{Cr as Be,Ct as Ve,Dt as He,E as Ue,Et as We,Fn as Ge,Ft as Ke,H as qe,Hn as Je,Ht as Ye,In as Xe,Jn as Ze,Jt as Qe,Ln as H,Lr as $e,M as et,Mn as tt,Mt as nt,N as rt,O as it,Pn as at,Qn as ot,Rn as st,Rr as U,Sr as ct,Tn as lt,Tr as ut,U as dt,Vn as ft,Wn as pt,Wt as mt,X as ht,Xn as gt,Zn as _t,_t as vt,a as yt,dn as bt,dt as xt,er as St,et as Ct,f as wt,ft as Tt,in as Et,ir as Dt,jn as Ot,jt as kt,k as At,ln as jt,lr as Mt,m as Nt,mt as Pt,nn as Ft,nr as It,o as Lt,or as Rt,ot as zt,qn as Bt,r as Vt,rn as Ht,rt as Ut,s as Wt,st as Gt,un as Kt,vt as qt,w as Jt,wr as Yt,wt as Xt,xr as Zt,y as Qt,yn as $t,yr as en,yt as tn,z as nn,zn as rn,zt as an}from"./line-icons-CwCZidXs.js";import{$ as on,A as sn,At as cn,Bt as ln,Ct as un,F as dn,Ft as W,G,Gt as fn,It as pn,J as mn,K,Kt as hn,M as gn,Mt as q,N as _n,Nt as vn,O as yn,P as bn,Pt as xn,Q as Sn,U as Cn,V as wn,Vt as Tn,W as En,Wt as Dn,X as On,Y as J,Z as kn,at as An,bt as jn,ct as Mn,d as Nn,dt as Pn,et as Fn,f as In,ft as Ln,ht as Rn,it as zn,j as Bn,jt as Y,k as Vn,kt as Hn,m as Un,nt as Wn,ot as Gn,p as Kn,q as X,qt as Z,rt as qn,s as Jn,st as Yn,tt as Xn,vt as Zn,zt as Qn}from"./frame-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Features-D-HIDQqF.js","assets/rolldown-runtime-XKyaHtl9.js","assets/react-BDur5s0O.js","assets/route-oDy8sV6H.js","assets/preload-helper-BupTYkQW.js","assets/utils-DJRAScIl.js","assets/jsx-runtime-LKYXHABd.js","assets/palette-6YAAmgkD.js","assets/sectionList-B651VPon.js","assets/line-icons-CwCZidXs.js","assets/api-BsiuHmJq.js","assets/pageBack-CbyKfisx.js","assets/nav-B_68FVw_.js","assets/frame-CgBYYtdw.js","assets/markdown-CwgDQU8m.js","assets/code-Jek8uWUO.js","assets/default-DB4ZMZxa.js","assets/index-D10waU4_.js","assets/when-BuWCTaKm.js","assets/index-DVlmTifI.css","assets/WhatsNew-BwV-yle3.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{a as n,n as r,r as i}from"./route-oDy8sV6H.js";import{F as a,H as o,L as s,R as c,a as l,c as u,l as d,p as f,s as p,t as m}from"./preload-helper-BupTYkQW.js";import{n as h,t as g}from"./utils-DJRAScIl.js";import{t as _}from"./jsx-runtime-LKYXHABd.js";import{A as v,C as y,D as b,E as x,I as S,K as C,L as w,M as T,O as E,P as D,S as O,T as k,U as A,_ as j,a as M,b as N,g as P,h as ee,i as F,k as I,m as te,s as ne,u as re,v as L,w as ie,y as ae}from"./palette-6YAAmgkD.js";import{O as oe,i as se,j as ce,k as le,m as R,n as ue,t as de,v as fe}from"./sectionList-B651VPon.js";import{A as pe,E as me,F as he,O as ge,U as _e,ct as ve,et as ye,f as be,ft as xe,it as Se,l as Ce,lt as we,st as Te,t as Ee,tt as De,u as Oe,x as ke}from"./api-BsiuHmJq.js";import{C as z,S as Ae,_ as je,b as Me,f as Ne,g as B,h as Pe,n as Fe,r as Ie,t as Le,w as Re,x as V,y as ze}from"./pageBack-CbyKfisx.js";import{Cr as Be,Ct as Ve,Dt as He,E as Ue,Et as We,Fn as Ge,Ft as Ke,H as qe,Hn as Je,Ht as Ye,In as Xe,Jn as Ze,Jt as Qe,Ln as H,Lr as $e,M as et,Mn as tt,Mt as nt,N as rt,O as it,Pn as at,Qn as ot,Rn as st,Rr as U,Sr as ct,Tn as lt,Tr as ut,U as dt,Vn as ft,Wn as pt,Wt as mt,X as ht,Xn as gt,Zn as _t,_t as vt,a as yt,dn as bt,dt as xt,er as St,et as Ct,f as wt,ft as Tt,in as Et,ir as Dt,jn as Ot,jt as kt,k as At,ln as jt,lr as Mt,m as Nt,mt as Pt,nn as Ft,nr as It,o as Lt,or as Rt,ot as zt,qn as Bt,r as Vt,rn as Ht,rt as Ut,s as Wt,st as Gt,un as Kt,vt as qt,w as Jt,wr as Yt,wt as Xt,xr as Zt,y as Qt,yn as $t,yr as en,yt as tn,z as nn,zn as rn,zt as an}from"./line-icons-CwCZidXs.js";import{$ as on,A as sn,At as cn,Bt as ln,Ct as un,F as dn,Ft as W,G,Gt as fn,It as pn,J as mn,K,Kt as hn,M as gn,Mt as q,N as _n,Nt as vn,O as yn,P as bn,Pt as xn,Q as Sn,U as Cn,V as wn,Vt as Tn,W as En,Wt as Dn,X as On,Y as J,Z as kn,at as An,bt as jn,ct as Mn,d as Nn,dt as Pn,et as Fn,f as In,ft as Ln,ht as Rn,it as zn,j as Bn,jt as Y,k as Vn,kt as Hn,m as Un,nt as Wn,ot as Gn,p as Kn,q as X,qt as Z,rt as qn,s as Jn,st as Yn,tt as Xn,vt as Zn,zt as Qn}from"./frame-CgBYYtdw.js";import{t as $n}from"./when-BuWCTaKm.js";import{t as er}from"./nav-B_68FVw_.js";import{n as tr,r as nr,t as rr}from"./code-Jek8uWUO.js";import{r as ir}from"./markdown-CwgDQU8m.js";import{$ as ar,C as or,D as sr,E as cr,H as lr,T as ur,U as dr,_ as fr,et as pr,g as mr,h as hr,m as gr,nt as _r,p as vr,tt as yr,ut as br,v as xr,w as Sr,y as Cr}from"./index-D10waU4_.js";import{C as wr,S as Tr,_ as Er,a as Dr,b as Or,c as kr,d as Ar,f as jr,g as Mr,h as Nr,i as Pr,l as Fr,m as Ir,n as Lr,o as Rr,p as zr,r as Br,s as Vr,t as Hr,u as Ur,v as Wr,w as Gr,x as Kr,y as qr}from"./coverage-pqIlfEP0.js";import{t as Jr}from"./step-mark-CaKf4dAR.js";import{i as Yr,s as Xr}from"./OwnItems-CedxNuRy.js";import{t as Zr}from"./radio-BLI4Ubhk.js";var Q=e(t(),1),$=_();function Qr({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-body-sm text-ink-2`,"data-tip":R(e).name,children:[(0,$.jsx)(M,{agent:e,px:16,decorative:!0}),R(e).name]},e)),e.length>t&&(0,$.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[`+`,e.length-t,` more`]}),!e.length&&(0,$.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Not used by an agent`})]})}function $r({agent:e}){return(0,$.jsx)(`span`,{style:{color:ne(e)},children:R(e).name})}function ei({id:e,agent:t}){let n=ne(t);return(0,$.jsx)(`h3`,{id:e,className:`m-0 text-body-lg font-medium`,style:{color:n},children:R(t).name})}function ti({p:e}){return(0,$.jsx)(B,{tone:e.outdated?`warn`:e.edited?`running`:`neutral`,icon:!1,children:e.outdated?`Edited, older base`:e.edited?`Edited`:`ForgeQE's`})}function ni(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 ri=e=>e.replace(/\{\{>\s*([\w-]+)\s*\}\}/g,`the shared part $1`);function ii(e){return e.replace(/^[ \t]*\{\{>\s*([\w-]+)\s*\}\}[ \t]*$/gm,(e,t)=>`> Also includes ForgeQE's shared part: ${t}`)}function ai({label:e,rows:t}){return(0,$.jsx)(`div`,{className:`@container`,children:(0,$.jsx)(Rn,{label:e,search:!1,empty:`No prompt matches.`,head:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`th`,{scope:`col`,className:jn,children:`Prompt`}),(0,$.jsx)(`th`,{scope:`col`,className:g(jn,`hidden @2xl:table-cell`),children:`Used by`}),(0,$.jsx)(`th`,{scope:`col`,className:g(jn,`text-right`),children:`Status`})]}),children:t.map(e=>(0,$.jsxs)(`tr`,{onClick:e.onOpen,className:un,children:[(0,$.jsxs)(`td`,{className:g(Zn,`min-w-0`),children:[(0,$.jsxs)(V,{variant:`link`,size:`inline`,onClick:t=>(t.stopPropagation(),e.onOpen()),className:`justify-start text-left`,children:[e.mark,(0,$.jsx)(`span`,{className:`font-mono text-body-sm font-medium`,children:e.name})]}),(0,$.jsx)(`span`,{className:`mt-1 line-clamp-1 text-body-sm text-muted`,children:e.about})]}),(0,$.jsx)(`td`,{className:g(Zn,`hidden w-[34%] @2xl:table-cell`),children:(0,$.jsx)(Qr,{names:e.agents,max:2})}),(0,$.jsx)(`td`,{className:g(Zn,`w-[1%] text-right whitespace-nowrap`),children:e.state})]},e.key))})})}function oi({p:e,onOpen:t,agents:n=!0}){return(0,$.jsxs)(`button`,{type:`button`,onClick:t,"aria-label":`Open ${e.name}`,className:g(o,`grid grid-cols-[auto_minmax(0,1fr)_auto] gap-x-4`),children:[(0,$.jsx)(Me,{icon:qt,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-body-sm font-medium text-ink`,children:e.name}),(0,$.jsx)(`span`,{className:`truncate text-body-sm text-muted`,children:ri(e.description||e.usedBy)}),n?(0,$.jsx)(Qr,{names:e.agents}):e.agents.length>1&&(0,$.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[`Shared with `,h(e.agents.length-1,`other agent`),`: editing it changes them too`]})]}),(0,$.jsx)(ti,{p:e})]})}function si({t:e,onOpen:t}){return(0,$.jsxs)(`button`,{type:`button`,onClick:t,"aria-label":`Edit ${e.name}`,className:g(o,`grid grid-cols-[auto_minmax(0,1fr)_auto] gap-x-4`),children:[(0,$.jsx)(ut,{size:16,strokeWidth:1.8,"aria-hidden":`true`,className:`text-icon`}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`font-mono text-body-sm font-medium text-ink`,children:e.name}),(0,$.jsx)(`span`,{className:`truncate text-body-sm text-muted`,children:e.description||e.text.split(`
|
|
3
3
|
`)[0]}),(0,$.jsx)(Qr,{names:e.agents})]}),(0,$.jsx)(B,{tone:`pass`,icon:!1,children:`Yours`})]})}function ci({onChanged:e,only:t,title:n}){let{data:r,error:i,reload:o}=wn(Oe.prompts),[s,l]=(0,Q.useState)(`all`),[u,d]=Xr(`prompts`),[f,p]=(0,Q.useState)(``),[m,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(``),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(`read`),[w,T]=(0,Q.useState)(null),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(!1),[A,j]=(0,Q.useState)(``),N=f.toLowerCase().split(/\s+/).filter(Boolean),P=e=>N.every(t=>e.toLowerCase().includes(t)),ee=e=>!t||e.some(e=>t.includes(e)),F=(0,Q.useMemo)(()=>(r?.prompts||[]).filter(e=>ee(e.agents)&&P(`${e.name} ${e.description} ${e.usedBy} ${e.agents.map(e=>R(e).name).join(` `)}`)),[r,f,t]),I=(0,Q.useMemo)(()=>(r?.team||[]).filter(e=>ee(e.agents)&&P(`${e.name} ${e.description} ${e.text} ${e.agents.map(e=>R(e).name).join(` `)}`)),[r,f,t]),te=async t=>{j(``);try{let e=await Oe.prompt(t);_(e),y(e.text),x(!1),C(`read`)}catch(t){e(t.message)}},ne=async t=>{try{let e=await Oe.agentPrompt(t);D({agent:t,text:e.text})}catch(t){e(t.message)}},re=async(t,n,r)=>{k(!0),j(``);try{await t(),r(),o(),e(n)}catch(e){j(e.message)}finally{k(!1)}};if(!r)return n?(0,$.jsxs)(kn,{children:[(0,$.jsx)(K,{first:!0,children:n}),(0,$.jsx)(sn,{error:i,reload:o})]}):(0,$.jsx)(sn,{error:i,reload:o});let L=r.prompts.find(e=>e.name===m?.name),ie=r.agents,ae=[{id:`all`,label:`All prompts`,n:r.prompts.filter(e=>ee(e.agents)).length},{id:`agents`,label:`By agent`,n:ie.filter(e=>!t||t.includes(e.name)).length},{id:`team`,label:`Your prompts`,n:r.team.filter(e=>ee(e.agents)).length},{id:`teams`,label:`Teams`,n:u??0}];return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(kn,{children:[n&&(0,$.jsx)(K,{first:!0,children:n}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pb-4`,children:[(0,$.jsx)(Pn,{label:`Show`,value:s,onChange:l,options:ae.map(e=>({id:e.id,label:e.label,n:e.n}))}),(0,$.jsx)(Pe,{id:`find-a-prompt`,label:`Find a prompt`,value:f,onChange:p,placeholder:`Find a prompt or agent`}),s!==`teams`&&(0,$.jsxs)(V,{variant:`accent`,"data-tip":`Add a prompt`,onClick:()=>(j(``),T({name:``,description:``,agents:[],text:``})),children:[(0,$.jsx)(H,{"aria-hidden":`true`}),`Add`]})]}),s===`teams`&&(0,$.jsx)(Yr,{kind:`prompts`,query:f,onCount:d}),s===`agents`&&(0,$.jsx)(`div`,{className:`flex flex-col gap-4`,children:ie.filter(e=>F.some(t=>t.agents.includes(e.name))||I.some(t=>t.agents.includes(e.name))).map(e=>{let t=R(e.name),n=F.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=I.filter(t=>t.agents.includes(e.name));return(0,$.jsxs)(`section`,{"aria-labelledby":`agent-${e.name}`,className:`surface rounded-lg bg-bg p-6 shadow-sm`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 px-4 py-2`,children:[(0,$.jsx)(M,{agent:e.name,px:28,decorative:!0}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,$.jsx)(ei,{id:`agent-${e.name}`,agent:e.name}),(0,$.jsx)(`span`,{className:`truncate text-body-sm text-muted`,children:e.title})]}),(0,$.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[h(n.length,`prompt`),r.length?` · ${r.length} yours`:``]}),(0,$.jsx)(V,{variant:`icon`,size:`icon-sm`,"aria-label":`Full prompt of ${t.name}`,"data-tip":`Full prompt of ${t.name}`,onClick:()=>ne(e.name),children:(0,$.jsx)(Gt,{"aria-hidden":`true`})})]}),(0,$.jsxs)(`div`,{className:`flex flex-col border-t border-line-soft pt-1`,children:[n.map(e=>(0,$.jsx)(oi,{p:e,agents:!1,onOpen:()=>te(e.name)},e.name)),r.map(e=>(0,$.jsx)(si,{t:e,onOpen:()=>(j(``),T({name:e.name,description:e.description,agents:e.agents,text:e.text,existing:e.name}))},e.name))]})]},e.name)})}),s===`all`&&(0,$.jsx)(ai,{label:`All prompts`,rows:F.map(e=>({key:e.name,name:e.name,about:ri(e.description||e.usedBy),agents:e.agents,state:(0,$.jsx)(ti,{p:e}),onOpen:()=>te(e.name)}))}),s===`team`&&(r.team.length===0?(0,$.jsx)(je,{icon:Bt,title:`No prompts of your own yet`,action:(0,$.jsxs)(V,{size:`sm`,"data-tip":`Add a prompt`,onClick:()=>T({name:``,description:``,agents:[],text:``}),children:[(0,$.jsx)(H,{"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)(ai,{label:`Your prompts`,rows:I.map(e=>({key:e.name,name:e.name,about:e.description||e.text.split(`
|
|
4
4
|
`)[0]||``,agents:e.agents,mark:(0,$.jsx)(ut,{size:15,strokeWidth:1.8,"aria-hidden":`true`,className:`flex-none text-icon`}),state:(0,$.jsx)(B,{tone:`pass`,icon:!1,children:`Yours`}),onOpen:()=>(j(``),T({name:e.name,description:e.description,agents:e.agents,text:e.text,existing:e.name}))}))}))]}),(0,$.jsx)(Z,{wide:!0,open:!!m,onClose:()=>_(null),title:m?.name||``,description:ri(L?.description||L?.usedBy||``),footer:(0,$.jsxs)($.Fragment,{children:[A&&(0,$.jsx)(`span`,{role:`alert`,className:`mr-auto self-center text-body-sm text-fail`,children:A}),L?.edited&&L.source===`project`&&(0,$.jsxs)(V,{disabled:O,onClick:()=>m&&re(()=>Oe.resetPrompt(m.name),`${m.name} is ForgeQE's own prompt again.`,()=>_(null)),className:`mr-auto`,"data-tip":`Reset to ForgeQE's own prompt`,children:[(0,$.jsx)(Je,{"aria-hidden":`true`}),`Reset`]}),(0,$.jsxs)(V,{onClick:()=>_(null),children:[(0,$.jsx)(U,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsxs)(V,{busy:O,variant:`primary`,disabled:O||!m||v===m.text,onClick:()=>m&&re(()=>Oe.savePrompt(m.name,v),`Saved your copy of ${m.name}.`,()=>_(null)),children:[(0,$.jsx)(Jt,{"aria-hidden":`true`}),O?`Saving…`:`Save`]})]}),children:m&&(()=>{let{head:e,body:t}=ni(v);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-body-sm`,children:[(0,$.jsx)(`dt`,{className:`text-muted`,children:`Used by`}),(0,$.jsx)(`dd`,{className:`m-0`,children:L?(0,$.jsx)(Qr,{names:L.agents,max:8}):null}),(0,$.jsx)(`dt`,{className:`text-muted`,children:`Status`}),(0,$.jsx)(`dd`,{className:`m-0`,children:L?(0,$.jsx)(ti,{p:L}):null})]}),L?.edited&&L.source!==`project`&&(0,$.jsxs)(Re,{tone:`info`,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 pt-4`,children:[(0,$.jsx)(Pn,{label:`Show the prompt`,value:S,onChange:C,options:[{id:`read`,label:`Read`},{id:`edit`,label:`Edit`}]}),L?.edited&&(0,$.jsxs)(V,{variant:`link`,size:`inline`,"aria-expanded":b,onClick:()=>x(!b),"data-tip":b?`Hide ForgeQE's original`:`Compare with ForgeQE's original`,children:[b?(0,$.jsx)(At,{"aria-hidden":`true`}):(0,$.jsx)(Pt,{"aria-hidden":`true`}),b?`Hide`:`Compare`]})]}),(0,$.jsx)(Dn,{open:b,children:(0,$.jsx)(`div`,{className:g(`rounded-base bg-surface-muted p-4`,`max-h-[40vh] overflow-auto`),children:(0,$.jsx)(ir,{text:ii(ni(m.builtin).body),className:`text-body-sm`})})}),S===`read`?(0,$.jsx)(ir,{text:ii(t),className:`text-body-lg`}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{htmlFor:`prompt-text`,className:`sr-only`,children:`Prompt`}),(0,$.jsx)(vr,{id:`prompt-text`,value:t,lang:`markdown`,onChange:t=>y(e+t)}),(0,$.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[`Saved to `,(0,$.jsxs)(`span`,{className:`font-mono`,children:[`.forgeqe/prompts/`,m.name,`.md`]}),`; new chats and runs use it.`]})]})]})})()}),(0,$.jsx)(Z,{wide:!0,open:!!w,onClose:()=>T(null),title:w?.existing?`Edit ${w.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-body-sm`,children:[`.forgeqe/prompts/team/`,w?.name||`name`,`.md`]}),`, shared with the project.`]}),footer:(0,$.jsxs)($.Fragment,{children:[A&&(0,$.jsx)(`span`,{role:`alert`,className:`mr-auto self-center text-body-sm text-fail [overflow-wrap:anywhere]`,children:A}),w?.existing&&(0,$.jsxs)(V,{disabled:O,onClick:()=>w.existing&&re(()=>Oe.deleteTeamPrompt(w.existing),`Removed ${w.existing}.`,()=>T(null)),className:`mr-auto text-fail`,children:[(0,$.jsx)(en,{"aria-hidden":`true`}),`Delete`]}),(0,$.jsxs)(V,{onClick:()=>T(null),children:[(0,$.jsx)(U,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsxs)(V,{busy:O,variant:`primary`,disabled:O||!w?.name||!w.agents.length||!w.text.trim(),onClick:()=>w&&re(()=>w.existing?Oe.saveTeamPrompt(w.existing,w):Oe.addTeamPrompt(w),`${w.existing?`Saved`:`Added`} ${w.name}: ${w.agents.map(e=>R(e).name).join(`, `)} use it from their next start.`,()=>T(null)),children:[w?.existing?(0,$.jsx)(Jt,{"aria-hidden":`true`}):(0,$.jsx)(H,{"aria-hidden":`true`}),O?`Saving…`:w?.existing?`Save`:`Add`]})]}),children:w&&(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)(a,{value:w.name,disabled:!!w.existing,placeholder:`tag-tests-with-work-items`,onChange:e=>T({...w,name:e.target.value.toLowerCase().replace(/[^a-z0-9-]+/g,`-`).slice(0,48)}),className:`font-mono`}),(0,$.jsx)(`span`,{className:`text-body-sm 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)(a,{value:w.description,maxLength:200,placeholder:`Tests carry the work item they cover`,onChange:e=>T({...w,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:ie.map(e=>{let t=w.agents.includes(e.name);return(0,$.jsxs)(V,{size:`sm`,role:`checkbox`,"aria-checked":t,"data-tip":e.title,onClick:()=>T({...w,agents:t?w.agents.filter(t=>t!==e.name):[...w.agents,e.name]}),children:[(0,$.jsx)(M,{agent:e.name,px:18,decorative:!0}),R(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)(c,{rows:14,spellCheck:!0,value:w.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=>T({...w,text:e.target.value}),className:`leading-[1.6]`}),(0,$.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Plain words, as you would tell a colleague. Use MUST for a rule the agent may never break.`})]})]})}),(0,$.jsx)(Z,{wide:!0,open:!!E,onClose:()=>D(null),title:E?`${R(E.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)(V,{onClick:()=>D(null),children:[(0,$.jsx)(U,{"aria-hidden":`true`}),`Close`]}),children:E&&(0,$.jsx)(ir,{text:ii(ni(E.text).body),className:`mt-4 text-body-lg`})})]})}var li={prebuilt:`ForgeQE's`,project:`This project`,user:`Yours`,external:`Claude / agent skill`,extra:`Shared folder`};function ui({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":R(e).name,"data-tip":R(e).name,className:g(p,`rounded-sm p-1 ring-1 ring-line-soft`),children:(0,$.jsx)(M,{agent:e,px:18,decorative:!0})},e)),e.length>t&&(0,$.jsxs)(`span`,{className:`pl-2 text-body-sm text-muted`,children:[`+`,e.length-t]})]})}function di({edit:e,only:t,title:n}){let{data:r,error:i,reload:s}=wn(Oe.skills),c=Y(e.value,[`skills`,`disable`])||[],l=t=>e.set(W(e.value,[`skills`,`disable`],t.length?t:void 0)),[u,d]=(0,Q.useState)(`all`),[f,p]=Xr(`skills`),[m,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)([]),[w,T]=(0,Q.useState)(null),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(``),[A,j]=(0,Q.useState)(``),M=m.toLowerCase().split(/\s+/).filter(Boolean),N=(0,Q.useMemo)(()=>(r?.skills||[]).filter(e=>(!t||e.users.some(e=>t.includes(e)))&&M.every(t=>`${e.name} ${e.description} ${e.users.map(e=>R(e).name).join(` `)}`.toLowerCase().includes(t))),[r,m,t]),P=async(e,t,n)=>{D(!0),k(``);try{await e(),n(),s(),j(t)}catch(e){k(e.message)}finally{D(!1)}},ee=async e=>{try{let t=await Oe.skill(e.name);x({name:e.name,text:t.text,editable:t.editable})}catch(e){j(e.message)}},F=(e,t)=>(C(t?[...S,t]:[]),ee(e)),I=(e,t)=>{let n=t.replace(/^---\n[\s\S]*?\n---\n?/,``).trim();k(``),x(null),T({name:e.name,description:e.description,agents:e.agents,body:n,existing:e.name})},te=(e,t)=>{let n=t.replace(/^---\n[\s\S]*?\n---\n?/,``).trim();k(``),x(null),T({name:e.name,description:e.description,agents:e.agents,body:n,copyOf:e.name})},ne=e=>r?.audiences.filter(t=>e.agents.includes(t.id)).map(e=>e.label).join(`, `)||``,re=e=>(0,$.jsx)(B,{tone:e.source===`project`?`pass`:`neutral`,icon:!1,children:li[e.source]||e.source}),L=e=>{let t=!c.includes(e.name);return(0,$.jsx)(Hn,{checked:t,onChange:t=>l(t?c.filter(t=>t!==e.name):[...c,e.name]),label:`Use ${e.name}`})},ie=Y(e.value,[`skills`,`enabled`])!==!1,ae=(e,t)=>{let n=!c.includes(e.name);return(0,$.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-4 pr-4`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>F(e),"aria-label":`Read ${e.name}`,className:g(o,`min-w-0 flex-col items-start gap-1`),children:[(0,$.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:g(`font-mono text-body-sm font-medium`,n?`text-ink`:`text-muted line-through`),children:e.name}),(0,$.jsx)(B,{tone:e.source===`project`?`pass`:`neutral`,icon:!1,children:li[e.source]||e.source})]}),(0,$.jsx)(`span`,{className:`line-clamp-2 text-body-sm text-muted`,children:e.description}),t&&(0,$.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 pt-1`,children:[(0,$.jsx)(ui,{agents:e.users}),(0,$.jsx)(`span`,{className:`text-body-sm text-muted`,children:r?.audiences.filter(t=>e.agents.includes(t.id)).map(e=>e.label).join(`, `)})]})]}),(0,$.jsx)(Hn,{checked:n,onChange:t=>l(t?c.filter(t=>t!==e.name):[...c,e.name]),label:`Use ${e.name}`})]},e.name)},oe=(0,$.jsxs)(`section`,{className:g(On,`px-0 py-0 sm:px-0`),children:[(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":v,onClick:()=>y(!v),className:g(o,`min-h-12 px-6 sm:px-8`),children:[(0,$.jsx)(ot,{size:16,"aria-hidden":`true`,className:`text-muted`}),(0,$.jsx)(`span`,{className:`flex-1 text-body-sm font-medium`,children:`How skills are used`}),(0,$.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[ie?`On`:`Off`,` · `,h(c.length,`turned off`,`turned off`),` · `,String(Y(e.value,[`skills`,`browser_max_chars`])??6e3),` characters a browser run`]}),(0,$.jsx)(Ue,{size:16,"aria-hidden":`true`,className:g(`text-muted transition-transform`,!v&&`-rotate-90`)})]}),(0,$.jsx)(Dn,{open:v,children:(0,$.jsx)(`div`,{className:`border-t border-line-soft px-6 pb-2 sm:px-8`,children:(0,$.jsx)(G,{defs:_n.fields,edit:e,base:_n.base})})})]});return(0,$.jsxs)($.Fragment,{children:[!n&&oe,r?(0,$.jsxs)(kn,{children:[n&&(0,$.jsx)(K,{first:!0,children:n}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pb-4`,children:[(0,$.jsx)(Pn,{label:`Show`,value:u,onChange:d,options:[{id:`agents`,label:`By agent`,n:r.audiences.filter(e=>!t||e.agents.some(e=>t.includes(e))).length},{id:`all`,label:`All skills`,n:r.skills.filter(e=>!t||e.users.some(e=>t.includes(e))).length},{id:`teams`,label:`Teams`,...f===null?{}:{n:f}}]}),(0,$.jsx)(Pe,{id:`find-a-skill`,label:`Find a skill`,value:m,onChange:_,placeholder:`Find a skill or agent`}),u!==`teams`&&(0,$.jsxs)(V,{variant:`accent`,"data-tip":`Add a skill`,onClick:()=>(k(``),T({name:``,description:``,agents:[],body:``})),children:[(0,$.jsx)(H,{"aria-hidden":`true`}),`Add`]})]}),A&&(0,$.jsx)(Re,{tone:`info`,className:`mb-4`,children:A}),u===`teams`&&(0,$.jsx)(Yr,{kind:`skills`,query:m,onCount:p}),u!==`teams`&&r.skills.length===0&&(0,$.jsx)(je,{children:`No skills found. Add one for your framework, conventions or app.`}),u===`agents`&&r.audiences.map(e=>{let t=N.filter(t=>t.agents.includes(e.id)),n=e.agents.filter((e,t,n)=>n.findIndex(t=>R(t).name===R(e).name)===t),r=n.length===1&&R(n[0]).name===e.label;return!t.length&&M.length?null:(0,$.jsxs)(`section`,{"aria-labelledby":`aud-${e.id}`,className:g(`surface rounded-lg bg-bg p-6 shadow-sm`,`mb-4`),children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 px-4 py-2`,children:[(0,$.jsx)(ui,{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-body-lg font-medium`,children:r?(0,$.jsx)($r,{agent:n[0]}):e.label}),(0,$.jsx)(`span`,{className:`truncate text-body-sm text-muted`,children:n.map((e,t)=>(0,$.jsxs)(`span`,{children:[t>0&&`, `,(0,$.jsx)($r,{agent:e})]},e))})]}),(0,$.jsx)(`span`,{className:`text-body-sm text-muted`,children:h(t.length,`skill`)})]}),(0,$.jsx)(`div`,{className:`flex flex-col border-t border-line-soft pt-1`,children:t.length?t.map(e=>ae(e,!1)):(0,$.jsx)(`p`,{className:`m-0 px-4 py-2 text-body-sm text-muted`,children:`No skills for them yet.`})})]},e.id)}),u===`all`&&r.skills.length>0&&(0,$.jsx)(`div`,{className:`@container`,children:(0,$.jsx)(Rn,{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-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,children:`Skill`}),(0,$.jsx)(`th`,{scope:`col`,className:g(`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,`hidden @2xl:table-cell`),children:`Who uses it`}),(0,$.jsx)(`th`,{scope:`col`,className:g(`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,`hidden @xl:table-cell`),children:`From`}),(0,$.jsx)(`th`,{scope:`col`,className:g(`px-4 py-2 text-left text-label-md font-medium tracking-wide whitespace-nowrap text-muted uppercase`,`text-right`),children:`On`})]}),children:N.map(e=>{let t=!c.includes(e.name);return(0,$.jsxs)(`tr`,{onClick:()=>F(e),className:`h-12 cursor-pointer border-t border-line-soft align-middle transition-colors duration-150 hover:bg-tint data-[state=selected]:bg-tint-hover`,children:[(0,$.jsxs)(`td`,{className:`px-4 py-2`,children:[(0,$.jsx)(V,{variant:`link`,size:`inline`,onClick:t=>(t.stopPropagation(),F(e)),className:g(`justify-start text-left font-mono`,!t&&`text-muted line-through`),children:e.name}),(0,$.jsx)(`span`,{className:`mt-1 line-clamp-1 text-body-sm text-muted`,children:e.description})]}),(0,$.jsx)(`td`,{className:g(`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)(ui,{agents:e.users,max:4}),(0,$.jsx)(`span`,{className:`text-body-sm text-muted`,children:ne(e)})]})}),(0,$.jsx)(`td`,{className:g(`px-4 py-2`,`hidden w-[1%] @xl:table-cell`),children:re(e)}),(0,$.jsx)(`td`,{className:g(`px-4 py-2`,`w-[1%] text-right`),"data-sort":+!!t,onClick:e=>e.stopPropagation(),children:L(e)})]},e.name)})})}),r.problems.length?(0,$.jsx)(`div`,{role:`alert`,className:g(z.warn,`mt-4`),children:r.problems.map(e=>(0,$.jsx)(`p`,{className:`m-0`,children:e},e))}):null]}):n?(0,$.jsxs)(kn,{children:[(0,$.jsx)(K,{first:!0,children:n}),(0,$.jsx)(sn,{error:i,reload:s})]}):(0,$.jsx)(sn,{error:i,reload:s}),n&&oe,(0,$.jsx)(Z,{wide:!0,open:!!b,onClose:()=>x(null),title:b?.name||``,description:b?.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)(V,{onClick:()=>x(null),children:[(0,$.jsx)(U,{"aria-hidden":`true`}),`Close`]}),b?.editable&&(0,$.jsxs)(V,{variant:`primary`,onClick:()=>b&&r&&I(r.skills.find(e=>e.name===b.name),b.text),children:[(0,$.jsx)(tt,{"aria-hidden":`true`}),`Edit`]}),b&&!b.editable&&(0,$.jsxs)(V,{variant:`primary`,"data-tip":`Your copy replaces this skill in this project`,onClick:()=>b&&r&&te(r.skills.find(e=>e.name===b.name),b.text),children:[(0,$.jsx)(ht,{"aria-hidden":`true`}),`Copy to edit`]})]}),children:b&&r&&(()=>{let e=r.skills.find(e=>e.name===b.name),t=S[S.length-1],n=t?r.skills.find(e=>e.name===t):void 0;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[n&&(0,$.jsxs)(V,{variant:`link`,size:`inline`,onClick:()=>(C(S.slice(0,-1)),void ee(n)),"data-tip":`Back to ${n.name}`,className:`self-start`,children:[(0,$.jsx)(yt,{"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-body-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)(ui,{agents:e.users,max:8}),(0,$.jsx)(`span`,{className:`text-ink-2`,children:ne(e)})]}),(0,$.jsx)(`dt`,{className:`text-muted`,children:`From`}),(0,$.jsx)(`dd`,{className:`m-0`,children:re(e)}),(0,$.jsx)(`dt`,{className:`self-center text-muted`,children:`On`}),(0,$.jsx)(`dd`,{className:`m-0`,children:L(e)})]}),(0,$.jsx)(`div`,{className:`pt-4`,children:(0,$.jsx)(ir,{text:ii(ni(b.text).body),className:`text-body-lg`,refs:{names:r.skills.map(e=>e.name).filter(e=>e!==b.name),open:e=>{let t=r.skills.find(t=>t.name===e);t&&F(t,b.name)}}})})]})})()}),(0,$.jsx)(Z,{wide:!0,open:!!w,onClose:()=>T(null),title:w?.existing?`Edit ${w.existing}`:w?.copyOf?`Copy ${w.copyOf}`:`Add a skill`,description:(0,$.jsxs)($.Fragment,{children:[w?.copyOf&&w.name===w.copyOf&&(0,$.jsxs)($.Fragment,{children:[`Replaces ForgeQE's `,w.copyOf,` in this project. `]}),`Saved in `,(0,$.jsxs)(`span`,{className:`font-mono text-body-sm`,children:[`.forgeqe/skills/`,w?.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:[O&&(0,$.jsx)(`span`,{role:`alert`,className:`mr-auto self-center text-body-sm text-fail [overflow-wrap:anywhere]`,children:O}),w?.existing&&(0,$.jsxs)(V,{disabled:E,onClick:()=>w.existing&&P(()=>Oe.removeSkill(w.existing),`Removed ${w.existing}.`,()=>T(null)),className:`mr-auto text-fail`,children:[(0,$.jsx)(en,{"aria-hidden":`true`}),`Delete`]}),(0,$.jsxs)(V,{onClick:()=>T(null),children:[(0,$.jsx)(U,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsxs)(V,{busy:E,variant:`primary`,disabled:E||!w?.name||!w.description.trim()||!w.agents.length||!!w.existing&&!w.body.trim(),onClick:()=>w&&P(()=>w.existing?Oe.saveSkill(w.existing,w):Oe.addSkill(w),w.existing?`Saved ${w.name}.`:w.copyOf&&w.name===w.copyOf?`Copied ${w.name}: yours is used in this project.`:`Added ${w.name}.`,()=>T(null)),children:[w?.existing?(0,$.jsx)(Jt,{"aria-hidden":`true`}):(0,$.jsx)(H,{"aria-hidden":`true`}),E?`Saving…`:w?.existing?`Save`:w?.copyOf&&w.name===w.copyOf?`Save copy`:`Add`]})]}),children:w&&r&&(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)(a,{value:w.name,disabled:!!w.existing,placeholder:`sap-fiori`,onChange:e=>T({...w,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)(a,{value:w.description,placeholder:`Use when the site is SAP Fiori: tiles, smart tables, value help dialogs.`,onChange:e=>T({...w,description:e.target.value})}),(0,$.jsx)(`span`,{className:`text-body-sm 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:r.audiences.map(e=>{let t=w.agents.includes(e.id);return(0,$.jsxs)(V,{size:`sm`,role:`checkbox`,"aria-checked":t,onClick:()=>T({...w,agents:t?w.agents.filter(t=>t!==e.id):[...w.agents,e.id]}),children:[(0,$.jsx)(ui,{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)(vr,{id:`skill-text`,value:w.body,lang:`markdown`,onChange:e=>T({...w,body:e})}),(0,$.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[w.existing?``:`Leave it empty to start from ForgeQE's outline for that agent. `,`Markdown; short rules the agent can follow step by step.`]})]})]})})]})}function fi(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 pi=/^[A-Za-z_][A-Za-z0-9_]*$/,mi=/\.(csv|tsv|json|ya?ml|xlsx|xls|xml|sql|txt)$/i;function hi(e){for(let[t,n]of Object.entries(e)){if(!pi.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(!mi.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 gi=e=>{if(!(`data`in e))return`data`;for(let t=2;;t++)if(!(`data_${t}`in e))return`data_${t}`},_i=e=>(e.split(/[\\/]/).pop()||``).replace(/\.[^.]+$/,``).replace(/[^A-Za-z0-9_]+/g,`_`).replace(/^(?=\d)/,`_`)||`data`,vi={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`]}},yi={azure:[`subscription`,`Azure`,`subscription id`],aws:[`account`,`AWS`,`account id`],gcp:[`project`,`Google Cloud`,`project id`]};function bi(e){for(let[t,n]of Object.entries(e)){let e=vi[t];if(!e||!n||typeof n!=`object`)continue;let r=n,[i,a,o]=yi[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 xi=[[`web`,`Web`],[`api`,`API`],[`desktop`,`Windows desktop`],[`mobile`,`Mobile`]],Si={web:Ke,api:_t,desktop:$t,mobile:It};function Ci(e){let t=String(e.kind||`web`),n=[{key:`kind`,label:`Kind`,type:`select`,default:`web`,options:xi.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 wi({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-body-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)(a,{"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)(a,{"aria-label":`Value of ${n}`,value:String(r??``),onChange:r=>t({...e,[n]:r.target.value}),className:`flex-[2_1_200px]`}),(0,$.jsx)(V,{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)(en,{"aria-hidden":`true`})})]},i)),(0,$.jsx)(`div`,{children:(0,$.jsxs)(V,{size:`sm`,"data-tip":`Add a variable`,onClick:()=>t({...e,[cn(e,`name`)]:``}),children:[(0,$.jsx)(H,{"aria-hidden":`true`}),`Add`]})})]})}function Ti({value:e,onChange:t}){let n=Array.isArray(e)?e.map(String):[],[r,i]=(0,Q.useState)(``),o=/^[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-body-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-body-sm sm:w-[200px]`,children:e}),(0,$.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,$.jsx)(on,{name:e,field:e,compact:!0})}),(0,$.jsx)(Fn,{name:e}),(0,$.jsx)(V,{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)(en,{"aria-hidden":`true`})})]},e)),(0,$.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),o&&!n.includes(r.trim())&&t([...n,r.trim()]),i(``)},children:[(0,$.jsx)(a,{"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)(V,{size:`sm`,type:`submit`,disabled:!o,"data-tip":`Add a secret`,children:[(0,$.jsx)(H,{"aria-hidden":`true`}),`Add`]})]})]})}var Ei=(e,t)=>(t.startsWith(e)?t.slice(e.length).replace(/^[\\/]+/,``):t).replace(/\\/g,`/`);function Di({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`?Ei(r,t.dir):``,u=e=>{let t=n.find(t=>t.name===e);return t?Ei(r,t.path):`${l}/${e}.yaml`},d=q(e.value.environments),f=Object.keys(d),p=typeof e.value.default==`string`?e.value.default:f[0]||``,m=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}})};return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(kn,{children:[(0,$.jsx)(K,{first:!0,icon:xt,...t.layout===`dir`?{help:`Each environment is its own file. The active one is set in forgeqe.yaml.`}:{},children:`Where they are kept`}),o&&(t.layout===`dir`?(0,$.jsx)(En,{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)(En,{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,$.jsx)(J,{label:`One file per environment`,help:(0,$.jsxs)($.Fragment,{children:[`Easier to change and review: each goes into `,(0,$.jsx)(`span`,{className:`font-mono text-body-sm`,children:`environments/`}),`, and `,(0,$.jsx)(`span`,{className:`font-mono text-body-sm`,children:Ei(r,t.file)}),` is left as it is.`,a&&(0,$.jsx)(`span`,{className:`mt-1 block text-muted`,children:a})]}),children:(0,$.jsxs)(V,{size:`sm`,onClick:i,disabled:!!a,"data-tip":`Split into one file each`,children:[(0,$.jsx)(tt,{"aria-hidden":`true`}),`Split`]})}):(0,$.jsx)(J,{label:`Folder`,help:`Each environment's file, named after it.`,children:(0,$.jsxs)(`span`,{className:`font-mono text-body-sm text-ink-2`,children:[l,`/`]})})]}),(0,$.jsxs)(kn,{children:[(0,$.jsx)(K,{first:!0,icon:Ke,children:`Environments`}),(0,$.jsxs)(`div`,{className:`-mt-2 mb-4 flex flex-wrap items-center justify-between gap-4`,children:[(0,$.jsx)(`span`,{className:`text-body-sm leading-relaxed text-ink-2`,children:`Where the agents work and the apps in each. The active one is used when a run names none.`}),(0,$.jsxs)(V,{size:`sm`,"data-tip":`Add an environment`,onClick:()=>c({mode:`add`,from:``,name:cn(d,f.length?`new-environment`:`qa`),env:{description:``,apps:{}}}),children:[(0,$.jsx)(H,{"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-body-sm text-muted`,children:`No environments yet. Add one with the apps your tests use.`}),f.map(r=>{let i=q(d[r]),a=q(i.apps);return(0,$.jsx)(Cn,{expandable:!1,open:!1,onToggle:()=>{},lead:(0,$.jsx)(Zr,{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(q(i.data)).length?`${Object.keys(q(i.data)).length} test data file${Object.keys(q(i.data)).length===1?``:`s`}`:``].filter(Boolean).map(String).join(`, `),t.layout===`dir`&&(0,$.jsxs)(`span`,{className:`block font-mono text-body-sm`,children:[u(r),n.some(e=>e.name===r)?``:` (new)`]})]}),state:p===r?(0,$.jsx)(`span`,{className:`text-body-sm text-pass`,children:`Active`}):void 0,actions:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(V,{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)(tt,{"aria-hidden":`true`})}),(0,$.jsx)(V,{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)(en,{"aria-hidden":`true`})})]}),children:null},r)})]})]}),(0,$.jsx)(Oi,{panel:s,setPanel:c,taken:f,vars:e.vars,dirLayout:t.layout===`dir`,onApply:m})]})}function Oi({panel:e,setPanel:t,taken:n,vars:r,dirLayout:i,onApply:o}){let[s,c]=(0,Q.useState)(``),l=e?q(e.env):{},u=q(l.apps),d=n=>e&&t({...e,env:n}),f={value:l,set:d,vars:r},p=Object.entries(u).filter(([,e])=>(q(e).kind||`web`)===`web`),m=Object.entries(u).filter(([,e])=>q(e).kind===`api`),h=typeof l.file==`string`?String(l.file):``,g=q(l.data),_=e?fi(e.name,e.from,n):``,v=q(l.cloud),y=hi(g)||bi(v),[b,x]=(0,Q.useState)([]),S=()=>{t(null),c(``),x([])},C=(e,t)=>{d({...e,...e.data?{}:Object.keys(g).length?{data:g}:{},...e.cloud?{}:Object.keys(v).length?{cloud:v}:{},...!e.description&&l.description?{description:l.description}:{}}),c(``),x(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)(Z,{wide:!0,open:!!e,onClose:S,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:[(_||y)&&(0,$.jsx)(`span`,{className:`mr-auto self-center text-body-sm text-muted`,children:_?`Needs a valid name`:y}),(0,$.jsxs)(V,{onClick:S,children:[(0,$.jsx)(U,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsxs)(V,{variant:`primary`,disabled:!!_||!!y,onClick:()=>{o(e),S()},children:[e?.mode===`add`?(0,$.jsx)(H,{"aria-hidden":`true`}):(0,$.jsx)(Jt,{"aria-hidden":`true`}),e?.mode===`add`?`Add`:`Done`]})]}),children:e&&(0,$.jsxs)(X,{children:[(0,$.jsx)(J,{label:`Name`,help:_?(0,$.jsx)(`span`,{className:`text-fail`,children:_}):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)(a,{id:`env-name`,value:e.name,spellCheck:!1,placeholder:`qa`,"aria-invalid":!!_,onChange:n=>t({...e,name:n.target.value.trim()}),className:`font-mono`})}),(0,$.jsx)(G,{defs:[{key:`description`,label:`Description`,type:`text`}],edit:f,base:[],stacked:!0}),(0,$.jsx)(ki,{name:e.name,linked:h,onFill:C,onLink:e=>d({file:e,...l.description?{description:l.description}:{},...Object.keys(g).length?{data:g}:{},...Object.keys(v).length?{cloud:v}:{}})}),b.map(e=>(0,$.jsxs)(`p`,{role:`status`,className:`mt-4 mb-0 flex items-start gap-2 text-body-sm leading-relaxed text-warn`,children:[(0,$.jsx)(Me,{icon:ct,size:16,className:`mt-1 flex-none`}),e]},e)),h?(0,$.jsx)(Ai,{file:h,name:e.name,onCopy:C}):(0,$.jsxs)(X,{children:[p.length>1&&(0,$.jsx)(En,{def:{key:`start_app`,label:`Start app`,help:`Where browser runs start when no app or address is given.`,type:`select`,options:p.map(([e])=>({value:e,label:e}))},edit:f,base:[],stacked:!0}),m.length>1&&(0,$.jsx)(En,{def:{key:`api_app`,label:`API app`,help:`The API that API tests call.`,type:`select`,options:m.map(([e])=>({value:e,label:e}))},edit:f,base:[],stacked:!0}),(0,$.jsx)(K,{children:`Apps`}),Object.keys(u).length===0&&(0,$.jsx)(`p`,{className:`m-0 pb-2 text-body-sm text-muted`,children:`No apps yet: add the web pages, APIs and programs tests use here.`}),Object.entries(u).map(([e,t],n)=>{let i=q(t);return(0,$.jsxs)(Cn,{lead:(0,$.jsx)(pn,{icon:Si[String(i.kind||`web`)]||Ke,logo:i.kind===`mobile`?ar[String(i.platform)]:i.kind===`desktop`?ar.windows:void 0}),title:e,meta:[xi.find(([e])=>e===(i.kind||`web`))?.[1],i.url||i.path||i.app_id].filter(Boolean).map(String).join(`, `),open:s===String(n),onToggle:()=>c(s===String(n)?``:String(n)),actions:(0,$.jsx)(V,{variant:`icon`,size:`icon-sm`,"aria-label":`Remove ${e}`,"data-tip":`Remove ${e}`,onClick:()=>{let t={...u};delete t[e],d({...l,apps:t})},children:(0,$.jsx)(en,{"aria-hidden":`true`})}),children:[(0,$.jsx)(J,{label:`Name`,htmlFor:`app-${n}`,stacked:!0,children:(0,$.jsx)(a,{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 u)?d({...l,apps:vn(u,e,n)}):t.target.value=e},className:`font-mono`})}),(0,$.jsx)(G,{defs:Ci(i),edit:{value:i,set:t=>d({...l,apps:{...u,[e]:t}}),vars:r},base:[],stacked:!0})]},n)}),(0,$.jsx)(`div`,{className:`border-t border-line-soft py-4`,children:(0,$.jsxs)(V,{size:`sm`,"data-tip":`Add an app`,onClick:()=>{d({...l,apps:{...u,[cn(u,`app`)]:{kind:`web`}}}),c(String(Object.keys(u).length))},children:[(0,$.jsx)(H,{"aria-hidden":`true`}),`Add`]})}),(0,$.jsx)(wi,{value:q(l.variables),onChange:e=>d(W(l,[`variables`],Object.keys(e).length?e:void 0))}),(0,$.jsx)(Ti,{value:l.secrets,onChange:e=>d(W(l,[`secrets`],e.length?e:void 0))})]}),(0,$.jsx)(Ni,{value:g,onChange:e=>d(W(l,[`data`],Object.keys(e).length?e:void 0))}),(0,$.jsx)(Mi,{edit:f})]})})}function ki({name:e,linked:t,onFill:n,onLink:r}){let[i,a]=(0,Q.useState)(``),[o,u]=(0,Q.useState)(``),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(``),[h,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(``),[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(``),w=(0,Q.useRef)(null),T=(0,Q.useId)(),E=(0,Q.useId)();(0,Q.useEffect)(()=>{i===`link`&&b===null&&me.files(`yaml`).then(e=>x(e.files)).catch(e=>m(e.message))},[i,b]);let D=(e,t)=>{n(q(e.environments[t]),e.literalByEnv[t]||[]),_(null),a(``),u(``)},O=async t=>{f(!0),m(``);try{let n=await me.convert(t,e),r=Object.keys(n.environments);r.length===1?D(n,r[0]):r.includes(e)?D(n,e):(_(n),y(n.default&&r.includes(n.default)?n.default:r[0]))}catch(e){m(e.message)}finally{f(!1)}};return(0,$.jsxs)(`div`,{className:g(l,`mt-6 flex flex-col gap-4`),children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-2 text-body-sm font-medium text-ink`,children:[(0,$.jsx)(Me,{icon:xt,size:16,className:`text-muted`}),t?`Read from your team's YAML`:`Start from your team's YAML`]}),(0,$.jsx)(`span`,{className:`text-body-sm 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)(Ne,{items:[{id:`paste`,label:`Paste`,icon:qe},{id:`import`,label:`Import a file`,icon:tn},{id:`link`,label:`Link a project file`,icon:Ht}],value:i,onChange:e=>{a(i===e?``:e),m(``),_(null)}})}),i===`paste`&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`label`,{htmlFor:T,className:`text-body-sm text-ink-2`,children:`The environment's YAML, or a file of several`}),(0,$.jsx)(c,{id:T,rows:8,spellCheck:!1,value:o,placeholder:`base_url: https://qa.shop.example.com
|
|
@@ -18,4 +18,4 @@ TST* = servicenow
|
|
|
18
18
|
`):``,u=/installs (\d[\w.-]*)/.exec(l)?.[1];return(0,$.jsxs)(X,{children:[(t||i)&&(0,$.jsx)(`p`,{className:g(z.fail,`m-0 mb-4`),children:t||i}),(0,$.jsx)(J,{label:`Version`,help:u?`${u} is out.`:l&&/latest/.test(l)?`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-body-lg`,children:e?e.running||e.version:`…`}),(0,$.jsxs)(V,{size:`sm`,disabled:r,"data-tip":`Check for updates`,onClick:()=>void n(`update-check`),children:[(0,$.jsx)(Et,{"aria-hidden":`true`}),`Check`]}),(0,$.jsxs)(V,{size:`sm`,variant:u?`primary`:`outline`,disabled:r,"data-tip":u?`Update to ${u}`:`Update to the latest version`,onClick:()=>s(!0),children:[(0,$.jsx)(rn,{"aria-hidden":`true`}),`Update`]})]})}),o&&(0,$.jsx)(lo,{text:`Update ForgeQE${u?` to ${u}`:` 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:rn,onYes:()=>{s(!1),n(`update`,{confirmed:!0})},onNo:()=>s(!1)}),(0,$.jsx)(co,{job:c,kinds:[`update-check`,`update`],onStop:()=>void Ce.stop()}),e&&(0,$.jsx)(fo,{view:e,onError:a}),(0,$.jsx)(K,{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)(J,{label:e,help:t,children:n?(0,$.jsxs)(`a`,{href:n,target:`_blank`,rel:`noreferrer noopener`,className:Ae({size:`sm`}),children:[(0,$.jsx)(Nt,{"aria-hidden":`true`}),`Open`]}):(0,$.jsxs)(V,{size:`sm`,disabled:!0,children:[(0,$.jsx)(Nt,{"aria-hidden":`true`}),`Open`]})},e))]})}function ho(){let{view:e,error:t,run:n,running:r}=so(),[i,a]=(0,Q.useState)(``);return e?.channels.length?(0,$.jsxs)(X,{children:[(0,$.jsx)(K,{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)(s,{"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)(V,{size:`sm`,disabled:r,"data-tip":`Send a test`,onClick:()=>void n(`notify-test`,i?{channel:i}:{}),children:[(0,$.jsx)(gt,{"aria-hidden":`true`}),`Test`]})]}),t&&(0,$.jsx)(`p`,{className:`m-0 mt-2 text-body-sm text-fail`,children:t}),(0,$.jsx)(co,{job:e.job,kinds:[`notify-test`],onStop:()=>void Ce.stop()})]}):null}function go(){let{view:e,error:t,run:n,running:r}=so(),[i,a]=(0,Q.useState)(``),[o,c]=(0,Q.useState)(!1);return e?.evalCases.length?(0,$.jsxs)(X,{children:[(0,$.jsx)(K,{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)(s,{"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)(V,{size:`sm`,disabled:r,"data-tip":`Run the domain check`,onClick:()=>c(!0),children:[(0,$.jsx)(at,{"aria-hidden":`true`}),`Run`]})]}),o&&(0,$.jsx)(lo,{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:at,onYes:()=>{c(!1),n(`eval-domain`,{confirmed:!0,...i?{only:[i]}:{}})},onNo:()=>c(!1)}),t&&(0,$.jsx)(`p`,{className:`m-0 mt-2 text-body-sm text-fail`,children:t}),(0,$.jsx)(co,{job:e.job,kinds:[`eval-domain`],onStop:()=>void Ce.stop()})]}):null}function _o(){let[e,t]=(0,Q.useState)(null),[n,r]=(0,Q.useState)(``);if((0,Q.useEffect)(()=>{Ce.generated().then(t,e=>r(e.message))},[]),n)return(0,$.jsx)(`p`,{className:g(z.fail,`m-0`),children:n});if(!e)return(0,$.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Loading…`});let i=(e,t)=>t?`${Math.round(e/t*100)}%`:`–`;return e.runs?(0,$.jsxs)(X,{children:[(0,$.jsxs)(`p`,{className:`mt-0 mb-4 text-body-sm text-muted`,children:[`In `,(0,$.jsx)(`span`,{className:`font-mono text-body-sm`,children:e.repo}),`, from .forgeqe/generated.jsonl: every line ForgeQE added, checked against the files as they are now.`]}),(0,$.jsxs)(Gn,{label:`Generated code`,children:[(0,$.jsx)(An,{label:`Lines written`,value:e.written.toLocaleString(),note:`${h(e.files,`file`)}: ${e.created} created, ${e.edited} edited`}),(0,$.jsx)(An,{label:`Still in the code`,value:i(e.present,e.written),note:`${e.present.toLocaleString()} lines`}),(0,$.jsx)(An,{label:`Share of those files`,value:i(e.present,e.totalLines),note:`of ${e.totalLines.toLocaleString()} lines`}),(0,$.jsx)(An,{label:`Files it created`,value:String(e.headers.unchanged),note:`as written; ${e.headers.changed} changed, ${e.headers.removed} gone`})]}),(0,$.jsx)(K,{children:`By run, newest first`}),(0,$.jsx)(bn,{label:`Runs that wrote code`,head:[`Run`,`Files`,`Lines still there`],children:e.byRun.map(e=>(0,$.jsx)(Vn,{cells:[(0,$.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`font-mono text-body-sm`,children:e.fq}),(0,$.jsxs)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:[e.run,e.test?` · ${e.test}`:``]})]},`r`),e.files,`${e.present} of ${e.written}`],sort:[void 0,void 0,e.written?e.present/e.written:-1]},e.fq))}),e.missing.length>0&&(0,$.jsxs)(`p`,{className:`m-0 mt-4 text-body-sm 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-body-sm text-muted`,children:[(0,$.jsx)(Me,{icon:Tt,size:16}),`ForgeQE has not written code in `,!e.repo||e.repo===`.`?`this repository`:(0,$.jsx)(`span`,{className:`font-mono text-body-sm`,children:e.repo}),` yet.`]})}mn.add(go),mn.add(ho);var vo={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`},yo=3,bo={done:`finished`,failed:`failed`,stopped:`stopped`,running:`running`};function xo(e){let[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(``),a=(0,Q.useCallback)(()=>pe.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=hn(a,1e3);return()=>fn(e)},[o,a]),{view:t,error:r,setError:i,load:a,running:o}}function So({draft:e,areas:t,severities:n,onChange:r}){let i=(0,Q.useId)(),o=(t,n)=>r({...e,[t]:n});return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{label:`Title`,htmlFor:`${i}-title`,stacked:!0,className:`border-t-0 pt-0`,children:(0,$.jsx)(a,{id:`${i}-title`,value:e.title,maxLength:200,onChange:e=>o(`title`,e.target.value)})}),(0,$.jsx)(J,{label:`What happened`,htmlFor:`${i}-summary`,stacked:!0,children:(0,$.jsx)(c,{id:`${i}-summary`,rows:4,value:e.summary,maxLength:4e3,onChange:e=>o(`summary`,e.target.value)})}),(0,$.jsx)(J,{label:`Steps to reproduce`,help:`One step on each line.`,htmlFor:`${i}-steps`,stacked:!0,children:(0,$.jsx)(c,{id:`${i}-steps`,rows:4,value:e.steps.join(`
|
|
19
19
|
`),onChange:e=>o(`steps`,e.target.value.split(`
|
|
20
20
|
`))})}),(0,$.jsx)(J,{label:`Expected result`,htmlFor:`${i}-expected`,stacked:!0,children:(0,$.jsx)(c,{id:`${i}-expected`,rows:2,value:e.expected,maxLength:2e3,onChange:e=>o(`expected`,e.target.value)})}),(0,$.jsx)(J,{label:`Actual result`,help:`Copy an error message exactly.`,htmlFor:`${i}-actual`,stacked:!0,children:(0,$.jsx)(c,{id:`${i}-actual`,rows:2,value:e.actual,maxLength:2e3,onChange:e=>o(`actual`,e.target.value)})}),(0,$.jsx)(J,{label:`Severity`,htmlFor:`${i}-severity`,children:(0,$.jsx)(s,{id:`${i}-severity`,value:e.severity,onChange:e=>o(`severity`,e.target.value),children:n.map(e=>(0,$.jsx)(`option`,{value:e,children:vo[e]??e},e))})}),(0,$.jsx)(J,{label:`Area`,htmlFor:`${i}-area`,children:(0,$.jsx)(s,{id:`${i}-area`,value:e.area,onChange:e=>o(`area`,e.target.value),children:t.map(e=>(0,$.jsx)(`option`,{value:e,children:e[0].toUpperCase()+e.slice(1)},e))})})]})}var Co=e=>e<1024?`${e} bytes`:`${Math.round(e/1024)} KB`;function wo(){let[e,t]=(0,Q.useState)(null),{view:n,error:r,setError:i,load:o,running:s}=xo(e),l=(0,Q.useId)(),[u,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)([]),[_,v]=(0,Q.useState)({}),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)([]),[C,w]=(0,Q.useState)(``),[T,E]=(0,Q.useState)(!1),[D,O]=(0,Q.useState)(``),[k,A]=(0,Q.useState)(null),j=(0,Q.useRef)(null),M=(0,Q.useRef)(null),N=n?.job;(0,Q.useEffect)(()=>{N&&!N.running&&M.current!==N&&(M.current=N,N.error?i(N.error):N.kind===`draft`&&N.result?(p(N.result.draft),h(N.result.questions),v({})):N.kind===`send`&&N.result&&A(N.result))},[N,i]);let P=n?.attachments??[],ee=n?.session??void 0,F=y??new Set(P.filter(e=>e.picked).map(e=>e.id)),I=e=>{t(e),b(null)},te=(e,t)=>{let n=new Set(F);t?n.add(e):n.delete(e),b(n)},ne=async e=>{i(``);try{await pe.draft(e),o()}catch(e){i(e.message)}},re=()=>void ne({session:ee,description:u,current:f??void 0,answers:m.map(e=>({question:e,answer:_[e]??``}))}),L=async e=>{i(``);for(let t of Array.from(e??[]).slice(0,yo-x.length))try{let e=await br(t);if(e.type!==`image/png`&&e.type!==`image/jpeg`)throw Error(`${t.name}: use a PNG or JPEG picture.`);S(t=>[...t,{name:e.name,url:`data:${e.type};base64,${e.data}`}])}catch(e){i(e.message)}},ie=async()=>{if(f){E(!1),i(``);try{await pe.send({session:ee,draft:f,attach:[...F],images:x.map(e=>e.url),contact:C.trim()||void 0,confirmed:!0}),o()}catch(e){i(e.message)}}},ae=async()=>{if(f){i(``);try{let{text:e}=await pe.text(f);await navigator.clipboard.writeText(e),O(`Copied. Paste it into an email or a Teams message to the ForgeQE team.`)}catch(e){i(e.message)}}},oe=()=>{d(``),t(null),p(null),h([]),v({}),S([]),b(null),A(null),O(``)};if(!n)return r?(0,$.jsx)(`p`,{role:`alert`,className:g(z.fail,`m-0`),children:r}):(0,$.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Loading…`});let se=n.intake.url&&(n.intake.key||n.intake.entra),ce=k?.url&&/^https:\/\/dev\.azure\.com\/[^\s"<>]+$/.test(k.url)?k.url:null;return k?(0,$.jsxs)(`div`,{"aria-live":`polite`,className:`flex flex-col gap-4`,children:[(0,$.jsxs)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:[k.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:[`#`,k.id]}):(0,$.jsxs)(`span`,{className:`font-medium`,children:[`#`,k.id]}),` `,`in `,n.target,`.`]}),(0,$.jsx)(`div`,{children:(0,$.jsxs)(V,{size:`sm`,"data-tip":`Report another problem`,onClick:oe,children:[(0,$.jsx)(H,{"aria-hidden":`true`}),`New`]})})]}):(0,$.jsxs)(X,{children:[r&&(0,$.jsx)(`p`,{role:`alert`,className:g(z.fail,`m-0 mb-4`),children:r}),(0,$.jsx)(K,{first:!0,help:n.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`}),n.sessions.length>0&&(0,$.jsx)(`div`,{role:`radiogroup`,"aria-label":`Session to report`,children:n.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)(Zr,{checked:n.session===e.name,onSelect:()=>I(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-body-sm text-muted`,children:[`forgeqe ${e.command}`,$n(e.startedAt),bo[e.status]].join(` · `)}),e.error&&(0,$.jsx)(`span`,{className:`text-body-sm text-fail [overflow-wrap:anywhere]`,children:e.error})]}),e.problem&&(0,$.jsx)(B,{tone:`fail`,children:`Went wrong`})]},e.name))}),n.findings&&(0,$.jsxs)(X,{children:[(0,$.jsx)(K,{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-body-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-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:n.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:n.findings.errors.length?(0,$.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:n.findings.errors.map(e=>(0,$.jsx)(`li`,{className:`overflow-auto rounded-base bg-surface-muted p-4 font-mono text-body-sm leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:e},e))}):(0,$.jsx)(`span`,{className:`text-ink-2`,children:`None logged. Say below what went wrong.`})})]}),n.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:n.findings.facts.map(e=>(0,$.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},e))})})]})]})]}),(0,$.jsx)(J,{label:n.findings?`Anything to add`:`Describe the problem`,help:n.findings?`Optional: what you were trying to do, or what you expected.`:void 0,htmlFor:`${l}-description`,stacked:!0,className:n.findings?void 0:`border-t-0 pt-0`,children:(0,$.jsx)(c,{id:`${l}-description`,rows:n.findings?3:5,value:u,maxLength:8e3,placeholder:n.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)(V,{size:`sm`,variant:f?`outline`:`primary`,disabled:s||!ee&&u.trim().length<10,"data-tip":f?`Draft again`:`Draft the bug`,onClick:()=>void ne({session:ee,description:u}),children:[(0,$.jsx)(Mt,{"aria-hidden":`true`}),`Draft`]}),s&&N?.kind===`draft`&&(0,$.jsx)(B,{tone:`running`,orb:`thinking`,children:`Drafting`})]}),m.length>0&&(0,$.jsxs)(X,{children:[(0,$.jsx)(K,{help:`Answer what you can, then update the draft. You can leave a question empty.`,children:`Questions`}),m.map((e,t)=>(0,$.jsx)(J,{label:e,htmlFor:`${l}-q${t}`,stacked:!0,className:t===0?`border-t-0 pt-0`:void 0,children:(0,$.jsx)(c,{id:`${l}-q${t}`,rows:2,value:_[e]??``,maxLength:2e3,onChange:t=>v(n=>({...n,[e]:t.target.value}))})},e)),(0,$.jsx)(`div`,{className:`pt-2`,children:(0,$.jsxs)(V,{size:`sm`,disabled:s||!Object.values(_).some(e=>e.trim()),"data-tip":`Update the draft`,onClick:re,children:[(0,$.jsx)(rn,{"aria-hidden":`true`}),`Update`]})})]}),f&&(0,$.jsxs)(X,{children:[(0,$.jsx)(K,{help:`Check each field and change what is not right. This is what the ForgeQE team reads.`,children:`The bug`}),(0,$.jsx)(So,{draft:f,areas:n.areas,severities:n.severities,onChange:p}),(0,$.jsx)(K,{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:[P.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)(lr,{checked:F.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-body-sm [overflow-wrap:anywhere]`,children:e.name}),(0,$.jsxs)(`span`,{className:`text-body-sm text-muted [overflow-wrap:anywhere]`,children:[e.note,` · `,Co(e.bytes)]})]})]})},e.id)),x.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:g(`rounded-base bg-surface-muted object-cover`,`h-10 w-16 object-cover`)}),(0,$.jsx)(`span`,{className:`flex-1 font-mono text-body-sm [overflow-wrap:anywhere]`,children:e.name}),(0,$.jsx)(V,{variant:`icon`,size:`icon-sm`,"aria-label":`Remove ${e.name}`,"data-tip":`Remove ${e.name}`,onClick:()=>S(t=>t.filter(t=>t!==e)),children:(0,$.jsx)(en,{"aria-hidden":`true`})})]},e.url))]}),(0,$.jsxs)(`div`,{className:`pt-2`,children:[(0,$.jsx)(`input`,{ref:j,type:`file`,accept:`image/png,image/jpeg`,multiple:!0,hidden:!0,onChange:e=>void L(e.target.files).then(()=>e.target.value=``)}),(0,$.jsxs)(V,{size:`sm`,disabled:x.length>=yo,"data-tip":`Add a screenshot`,onClick:()=>j.current?.click(),children:[(0,$.jsx)(H,{"aria-hidden":`true`}),`Add`]})]}),(0,$.jsx)(K,{children:`Send`}),(0,$.jsx)(J,{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)(a,{id:`${l}-contact`,value:C,maxLength:200,onChange:e=>w(e.target.value)})}),n.intake.url?!se&&(0,$.jsx)(J,{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)(on,{id:`${l}-key`,name:n.keyEnv,field:`Intake key`})}):(0,$.jsx)(J,{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)(V,{size:`sm`,variant:`primary`,disabled:s||!se||!f.title.trim()||!f.summary.trim(),"data-tip":`Send to the ForgeQE team`,onClick:()=>E(!0),children:[(0,$.jsx)(gt,{"aria-hidden":`true`}),`Send`]}),(0,$.jsxs)(V,{size:`sm`,disabled:!f.title.trim()||!f.summary.trim(),"data-tip":`Copy as text`,onClick:()=>void ae(),children:[(0,$.jsx)(ht,{"aria-hidden":`true`}),`Copy`]}),s&&N?.kind===`send`&&(0,$.jsx)(B,{tone:`running`,children:`Sending`})]}),(0,$.jsx)(`div`,{"aria-live":`polite`,children:D&&(0,$.jsx)(`p`,{className:`m-0 mt-2 text-body-sm text-ink-2`,children:D})}),T&&(0,$.jsxs)(`div`,{role:`alertdialog`,"aria-label":`Send this bug?`,className:g(z.warn,`mt-4 flex flex-col gap-2`),children:[(0,$.jsx)(`span`,{className:`text-body-sm font-medium`,children:`Send this bug to the ForgeQE team?`}),(0,$.jsxs)(`span`,{className:`text-body-sm text-ink-2`,children:[`It is filed in `,n.target,` with the fields above`,F.size+x.length?`, and ${F.size+x.length} attached file${F.size+x.length===1?``:`s`}: ${[...P.filter(e=>F.has(e.id)).map(e=>e.name),...x.map(e=>e.name)].join(`, `)}`:`, with nothing attached`,`.`]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(V,{size:`sm`,variant:`primary`,onClick:()=>void ie(),children:[(0,$.jsx)(gt,{"aria-hidden":`true`}),`Send`]}),(0,$.jsxs)(V,{size:`sm`,"data-tip":`Not now`,onClick:()=>E(!1),children:[(0,$.jsx)(U,{"aria-hidden":`true`}),`Later`]})]})]})]})]})}function To({config:e}){let{saved:t,preview:n,reload:r}=re(),i=q(Y(e.value,[`agent`,`names`])),o=ce(i),s=Y(e.value,[`agent`,`app_name`]),c=typeof s==`string`?s:``,l=le(c),u=JSON.stringify([o,l]);return(0,Q.useEffect)(()=>n({...t,agentNames:o,appName:l}),[u,t]),(0,Q.useEffect)(()=>()=>{n(null),r()},[n,r]),(0,$.jsxs)(X,{children:[(0,$.jsx)(K,{icon:Vt,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)(J,{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)(a,{id:`agent-app-name`,"data-keep-name":!0,value:c,maxLength:40,placeholder:`ForgeQE`,onChange:t=>e.set(W(e.value,[`agent`,`app_name`],t.target.value.replace(/[\u0000-\u001f\u007f-\u009f\u2028\u2029]/g,``)||void 0)),className:`w-full`})}),(0,$.jsx)(K,{icon:ut,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`}),oe.map(t=>{let n=fe(t).name,r=`agent-name-${t}`,o=typeof i[t]==`string`?i[t]:``;return(0,$.jsx)(J,{label:(0,$.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(M,{agent:t,px:22,decorative:!0}),n]}),help:t,htmlFor:r,yamlKey:`agent.names.${t}`,children:(0,$.jsx)(a,{id:r,value:o,maxLength:40,placeholder:n,onChange:n=>e.set(W(e.value,[`agent`,`names`,t],n.target.value.replace(/[\u0000-\u001f\u007f-\u009f\u2028\u2029]/g,``)||void 0)),className:`w-full`})},t)})]})}var Eo=524288,Do=[`image/png`,`image/jpeg`,`image/webp`,`image/svg+xml`];async function Oo(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 ko({children:e,className:t}){return(0,$.jsx)(`div`,{className:g(`flex w-full flex-wrap items-center gap-2 sm:justify-end`,t),children:e})}function Ao({colour:e,label:t}){return(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-body-sm text-ink-2`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`size-4 flex-none rounded-sm ring-1 ring-line-strong ring-inset`,style:{background:e}}),t&&(0,$.jsx)(`span`,{className:`text-muted`,children:t}),(0,$.jsx)(`code`,{className:`font-mono text-body-sm`,children:e})]})}function jo({onUse:e}){let t=(0,Q.useId)(),[n,r]=(0,Q.useState)(``),[i,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(``),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!1);return(0,$.jsx)(J,{label:`From a website`,help:`Suggests its sidebar, button and page colours. Nothing changes until you use them.`,htmlFor:t,children:(0,$.jsxs)(ko,{children:[(0,$.jsxs)(`form`,{className:`flex w-full items-center gap-2`,onSubmit:async e=>{e.preventDefault(),o(!0),c(``),u(null),f(!1);try{u(await we.fromUrl(n.trim()))}catch(e){c(e.message)}finally{o(!1)}},children:[(0,$.jsx)(a,{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)(V,{busy:i,size:`sm`,type:`submit`,disabled:!n.trim()||i,"data-tip":`Read the site's colours`,children:[(0,$.jsx)(Yt,{"aria-hidden":`true`}),i?`Importing…`:`Import`]})]}),s&&(0,$.jsx)(`p`,{role:`alert`,className:`m-0 w-full text-body-sm text-fail sm:text-right`,children:s}),l&&(0,$.jsxs)(`div`,{role:`status`,className:`flex w-full flex-col gap-2 sm:items-end`,children:[(0,$.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[`From `,new URL(l.url).host]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 sm:justify-end`,children:[l.primary&&(0,$.jsx)(Ao,{colour:l.primary,label:`Sidebar`}),l.gradient&&(0,$.jsx)(Ao,{colour:l.gradient,label:`Gradient`}),l.secondary&&(0,$.jsx)(Ao,{colour:l.secondary,label:`Buttons`}),l.background&&(0,$.jsx)(Ao,{colour:l.background,label:`Page`})]}),(0,$.jsxs)(V,{size:`sm`,variant:`primary`,onClick:()=>{e(l),f(!0)},"data-tip":`Use these colours`,children:[(0,$.jsx)(Jt,{"aria-hidden":`true`}),d?`Used`:`Use`]}),l.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-body-sm text-muted`,children:`Others:`}),l.palette.map(e=>(0,$.jsx)(Ao,{colour:e},e))]})]})]})})}var Mo={deep:`Deep sidebar, white text`,light:`Pale sidebar, dark text`};function No({start:e,onUse:t}){let n=(0,Q.useId)(),[r,i]=(0,Q.useState)(e),[o,c]=(0,Q.useState)(`deep`),[l,u]=(0,Q.useState)(!1),d=x(r),f=D(d),p=k(d,o),m=r.trim()!==``&&!d?`Write a colour as #rrggbb, for example #0e7490.`:``,h=e=>(i(e),u(!1));return(0,$.jsx)(J,{label:`From one colour`,help:m?(0,$.jsx)(`span`,{className:`text-fail`,children:m}):`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)(ko,{children:[(0,$.jsxs)(`span`,{className:`flex w-full flex-nowrap items-center gap-2`,children:[(0,$.jsx)(a,{type:`color`,"aria-label":`From one colour: pick a colour`,value:d||ee,onChange:e=>h(e.target.value),className:`size-10 flex-none cursor-pointer p-1`}),(0,$.jsx)(a,{id:n,value:r,spellCheck:!1,placeholder:`#0e7490`,"aria-invalid":!!m,onChange:e=>h(e.target.value),className:`min-w-0 flex-1 font-mono`})]}),(0,$.jsx)(s,{"aria-label":`Where the sidebar sits in the family`,value:o,onChange:e=>(c(e.target.value),u(!1)),className:`w-full`,children:P.map(e=>(0,$.jsx)(`option`,{value:e,children:Mo[e]},e))}),f&&p&&(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 ${d}`,className:`flex w-full overflow-hidden rounded-sm`,children:O.map(e=>(0,$.jsx)(`span`,{"data-tip":`${e} ${f[e]}`,className:`h-6 min-w-0 flex-1`,style:{background:f[e]}},e))}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 sm:justify-end`,children:[(0,$.jsx)(Ao,{colour:p.primary,label:`Sidebar`}),(0,$.jsx)(Ao,{colour:p.gradient,label:`Gradient`}),(0,$.jsx)(Ao,{colour:p.secondary,label:`Buttons`}),(0,$.jsx)(Ao,{colour:p.background,label:`Page`})]}),(0,$.jsxs)(V,{size:`sm`,variant:`primary`,onClick:()=>{t(p),u(!0)},"data-tip":`Use these colours`,children:[(0,$.jsx)(Jt,{"aria-hidden":`true`}),l?`Used`:`Use`]})]})]})})}function Po({label:e,help:t,yamlKey:n,value:r,fallback:i,check:o,onChange:s}){let c=(0,Q.useId)(),[l,u]=(0,Q.useState)(r);(0,Q.useEffect)(()=>u(r),[r]);let d=x(l),f=l.trim()!==``&&!d?`Write a colour as #rrggbb, for example #0b1f3a.`:d&&o?o(d):``;return(0,$.jsx)(J,{label:e,help:f?(0,$.jsx)(`span`,{className:`text-fail`,children:f}):t,htmlFor:c,yamlKey:n,children:(0,$.jsxs)(ko,{className:`flex-nowrap`,children:[(0,$.jsx)(a,{type:`color`,"aria-label":`${e}: pick a colour`,value:x(r)||i||`#ffffff`,onChange:e=>s(o?.(e.target.value)?``:e.target.value),className:`size-10 flex-none cursor-pointer p-1`}),(0,$.jsx)(a,{id:c,value:l,spellCheck:!1,placeholder:i?`${i} (default)`:`None`,"aria-invalid":!!f,onChange:e=>{u(e.target.value);let t=x(e.target.value);(t&&!o?.(t)||!e.target.value.trim())&&s(t||``)},className:`min-w-0 flex-1 font-mono`})]})})}function Fo({which:e,label:t,yamlKey:n,value:r,url:i,savedError:a,onChange:o}){let[s,c]=(0,Q.useState)(``),[l,u]=(0,Q.useState)(!1),d=(0,Q.useRef)(null),f=e===`mark`?`small logo`:`logo`;return(0,$.jsx)(J,{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)(ko,{children:[i&&(0,$.jsx)(`span`,{className:zo,children:(0,$.jsx)(`span`,{className:g(`theme-side flex h-12 items-center justify-center rounded-sm ring-1 ring-line-strong ring-inset`,e===`mark`?`w-12`:`min-w-16 px-4`),children:(0,$.jsx)(`img`,{src:i,alt:`The ${f}`,className:g(`block object-contain`,e===`mark`?`max-h-9 max-w-9`:`max-h-8 max-w-[140px]`)})})}),(0,$.jsx)(`input`,{ref:d,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(``),!Do.includes(n.type))return c(`A ${f} is a PNG, JPEG, WebP or SVG image.`);if(n.type===`image/svg+xml`&&n.size>Eo)return c(`${n.name} is over 512 KB.`);if(n.size>20971520)return c(`${n.name} is over ${Kn/1024/1024} MB: save a smaller copy and upload that.`);u(!0);try{let t=await Un(n,Eo),r=await we.uploadLogo(await Oo(t),t.type,e);o(r.file,(e===`mark`?r.view.logoMark:r.view.logo)||``)}catch(e){c(e.message)}finally{u(!1)}}}}),(0,$.jsxs)(V,{busy:l,size:`sm`,disabled:l,"data-tip":i?`Change the ${f}`:`Upload a ${f}`,onClick:()=>d.current?.click(),children:[i?(0,$.jsx)(tt,{"aria-hidden":`true`}):(0,$.jsx)(Yt,{"aria-hidden":`true`}),l?`Uploading…`:i?`Change`:`Upload`]}),r&&(0,$.jsx)(V,{variant:`icon`,size:`icon-sm`,"aria-label":`Remove the ${f}`,"data-tip":`Remove the ${f}`,onClick:()=>o(``),children:(0,$.jsx)(en,{"aria-hidden":`true`})})]})})}var Io={auto:`Auto (recommended)`,plain:`Plain`,tiles:`On tiles`,outline:`Outlined`,mono:`One colour`};function Lo(e){for(let{item:t}of er)if(t.icon===e||w[t.id]===e)return t.label;for(let t of se)if(R(t.agent).icon===e)return R(t.agent).name;return e}function Ro({draft:e,value:t,onChange:n}){let{mode:r}=re(),i=I(e,void 0,r),a=v(e)!==`3d`,o=!a&&t!==`mono`&&t!==`outline`&&i.lowest<2,c=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=>Lo(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)(J,{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)(ko,{children:[(0,$.jsx)(s,{id:`theme-icons`,value:t,disabled:a,onChange:e=>n(e.target.value),className:`w-full`,children:L.map(e=>(0,$.jsx)(`option`,{value:e,children:Io[e]},e))}),!a&&(0,$.jsx)(Bo,{}),c&&(0,$.jsx)(`span`,{className:g(`w-full text-body-sm sm:text-right`,o?`text-warn`:`text-muted`),children:c})]})})}var zo=`inline-flex rounded-md bg-surface-strong p-2`;function Bo(){let e=[`record`,`data`,`jobs`,`guardrails`].map(e=>w[e]).concat([`orchestrator`,`healer`,`browser-agent`]);return(0,$.jsx)(`span`,{className:g(zo,`flex w-full`),children:(0,$.jsx)(`span`,{"data-preview":``,"aria-label":`How the sidebar's icons look`,className:`theme-side flex w-full items-center justify-between rounded-base px-4 py-2 ring-1 ring-line-strong ring-inset`,children:e.map(e=>(0,$.jsx)(f,{name:e,px:18},e))})})}var Vo={phosphor:`Phosphor Duotone (default)`,solar:`Solar Bold Duotone`,lucide:`Lucide (buttons and menus too)`,"3d":`3D (ForgeQE's pixel icons)`};function Ho({value:e,onChange:t}){return(0,$.jsx)(J,{label:`Icons`,help:`Flat icons take the Icon colour below, so they show on any sidebar.`,htmlFor:`theme-icon-set`,yamlKey:`theme.icon_set`,children:(0,$.jsxs)(ko,{children:[(0,$.jsx)(s,{id:`theme-icon-set`,value:e,onChange:e=>t(e.target.value),className:`w-full`,children:j.map(e=>(0,$.jsx)(`option`,{value:e,children:Vo[e]},e))}),(0,$.jsx)(Bo,{})]})})}function Uo(){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)(M,{agent:e,px:40,decorative:!0},e))})}var Wo={visor:`Robots (default)`,classic:`Characters`,icons:`Icons`},Go={soft:`Soft pastel (default)`,original:`Each agent's own`};function Ko({value:e,colours:t,onChange:n,onColours:r}){return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{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)(ko,{children:[(0,$.jsx)(s,{id:`theme-mascot`,value:e,onChange:e=>n(e.target.value),className:`w-full`,children:ae.map(e=>(0,$.jsx)(`option`,{value:e,children:Wo[e]},e))}),(0,$.jsx)(Uo,{})]})}),(0,$.jsx)(J,{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)(ko,{children:(0,$.jsx)(s,{id:`theme-mascot-colours`,value:t,disabled:e===`icons`,onChange:e=>r(e.target.value),className:`w-full`,children:N.map(e=>(0,$.jsx)(`option`,{value:e,children:Go[e]},e))})})})]})}var qo={text:`The app's icon colour: blue, light blue in dark mode (default)`,accent:`The buttons' colour`,custom:`A colour of their own`};function Jo({draft:e,value:t,onChange:n}){let{mode:r}=re(),i=b({iconColour:t}),o=v(e)!==`3d`,[c,l]=(0,Q.useState)(i===`custom`?t:``);(0,Q.useEffect)(()=>l(i===`custom`?t:``),[t,i]);let u=i===`custom`&&c.trim()!==``&&!x(c)?`Write a colour as #rrggbb, for example #7c3aed.`:``,d=o?E(e,r).moved:[],f=d.length?`Made ${r===`dark`?`lighter`:`darker`} on the ${d.join(` and the `)} so the icons show.`:``;return(0,$.jsx)(J,{label:`Icon colour`,help:u?(0,$.jsx)(`span`,{className:`text-fail`,children:u}):o?`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)(ko,{children:[(0,$.jsx)(s,{id:`theme-icon-colour`,value:i,disabled:!o,onChange:t=>{let r=t.target.value;n(r===`accent`?`accent`:r===`custom`?x(e.secondary)||ee:``)},className:`w-full`,children:Object.keys(qo).map(e=>(0,$.jsx)(`option`,{value:e,children:qo[e]},e))}),o&&i===`custom`&&(0,$.jsxs)(`span`,{className:`flex w-full flex-nowrap items-center gap-2`,children:[(0,$.jsx)(a,{type:`color`,"aria-label":`Icon colour: pick a colour`,value:x(t)||ee,onChange:e=>n(e.target.value),className:`size-10 flex-none cursor-pointer p-1`}),(0,$.jsx)(a,{id:`theme-icon-colour-hex`,"aria-label":`Icon colour`,value:c,spellCheck:!1,placeholder:`#7c3aed`,"aria-invalid":!!u,onChange:e=>{l(e.target.value);let t=x(e.target.value);(t||!e.target.value.trim())&&n(t||``)},className:`min-w-0 flex-1 font-mono`})]}),f&&(0,$.jsx)(`span`,{className:`w-full text-body-sm text-warn sm:text-right`,children:f})]})})}function Yo(){let{choice:e,setChoice:t}=re();return(0,$.jsx)(J,{label:`Colour mode`,help:`Only for you, in this browser.`,children:(0,$.jsx)(ko,{children:(0,$.jsx)(Pn,{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 Xo=[`primary`,`gradient`,`secondary`,`background`,`icon_style`,`icon_set`,`icon_colour`,`mascot`,`mascot_colours`];function Zo({theme:e,value:t,onReset:n}){let{choice:r,setChoice:i}=re(),a=Xo.some(t=>e[t]!==void 0)||r!==`system`;return(0,$.jsxs)(V,{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 Xo)e=W(e,[`theme`,t],void 0);n(e),i(`system`)},children:[(0,$.jsx)(Je,{"aria-hidden":`true`}),`Reset`]})}var Qo=e=>T(e)<.75?`Choose a light colour: dark mode gives the dark page.`:``;function $o({config:e}){let{saved:t,preview:n,reload:r}=re(),i=q(e.value.theme),o=e=>typeof i[e]==`string`?i[e]:``,c=(t,n)=>e.set(W(e.value,[`theme`,t],n||void 0)),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(!1),b=(0,Q.useRef)(null),C=l&&l.file===o(`logo`)?l.url:t.logoFile===o(`logo`)?t.logo:void 0,w=d&&d.file===o(`logo_mark`)?d.url:t.logoMarkFile===o(`logo_mark`)?t.logoMark:void 0,T=[`plain`,`rounded`,`circle`,`tile`].find(e=>e===o(`logo_frame`)),E=o(`logo_size`)===`large`||o(`logo_size`)===`standard`?o(`logo_size`):void 0,D=L.find(e=>e===o(`icon_style`)),O=j.find(e=>e===o(`icon_set`)),k=ae.find(e=>e===o(`mascot`)),A=N.find(e=>e===o(`mascot_colours`)),M=ce(Y(e.value,[`agent`,`names`])),P={...Object.keys(M).length?{agentNames:M}:{},logoSize:E,name:o(`name`)||void 0,primary:x(o(`primary`)),gradient:x(o(`gradient`)),secondary:x(o(`secondary`)),background:x(o(`background`)),logo:o(`logo`)?C:void 0,logoMark:o(`logo_mark`)?w:void 0,logoFrame:T,iconStyle:D,iconSet:O,mascot:k,mascotColours:A,iconColour:o(`icon_colour`)===`accent`?`accent`:x(o(`icon_colour`))},F=JSON.stringify(P);(0,Q.useEffect)(()=>n(P),[F]),(0,Q.useEffect)(()=>()=>{n(null),r()},[n,r]);let I=S(P).filter(e=>!e.ok);return(0,$.jsxs)(X,{children:[(0,$.jsx)(K,{icon:mt,first:!0,children:`Logo and name`}),(0,$.jsx)(Fo,{which:`logo`,label:`Logo`,yamlKey:`theme.logo`,value:o(`logo`),url:C,savedError:t.logoError,onChange:(e,t)=>(u(t?{file:e,url:t}:null),c(`logo`,e))}),(0,$.jsx)(Fo,{which:`mark`,label:`Small logo`,yamlKey:`theme.logo_mark`,value:o(`logo_mark`),url:w,savedError:t.logoMarkError,onChange:(e,t)=>(f(t?{file:e,url:t}:null),c(`logo_mark`,e))}),(0,$.jsx)(J,{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)(ko,{children:(0,$.jsxs)(s,{id:`theme-frame`,value:T||`plain`,onChange:e=>c(`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)(J,{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)(ko,{children:(0,$.jsxs)(s,{id:`theme-size`,value:E||`auto`,onChange:e=>c(`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)(J,{label:`Name`,help:`Beside a square logo, or instead of one. Screen readers say it.`,htmlFor:`theme-name`,yamlKey:`theme.name`,children:(0,$.jsx)(ko,{children:(0,$.jsx)(a,{id:`theme-name`,value:o(`name`),maxLength:40,placeholder:`ForgeQE`,onChange:e=>c(`name`,e.target.value),className:`w-full`})})}),(0,$.jsx)(J,{label:`Preview`,help:_?(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)(ko,{className:g(zo,`flex-nowrap`),children:[(0,$.jsx)(`span`,{"data-preview":``,"aria-label":`How the sidebar's top looks`,className:`theme-side flex min-h-14 min-w-0 flex-1 items-center rounded-base px-4 text-body-lg font-medium ring-1 ring-line-strong ring-inset`,children:(0,$.jsx)(Nn,{theme:P,onPlate:v})}),(0,$.jsx)(`span`,{"data-preview":``,"aria-label":`How the narrow sidebar's top looks`,className:`theme-side flex size-14 flex-none items-center justify-center rounded-base ring-1 ring-line-strong ring-inset`,children:(0,$.jsx)(In,{theme:P})})]})}),(0,$.jsx)(K,{icon:lt,help:`Leave a colour empty to keep ForgeQE's own.`,children:`Colours`}),(0,$.jsx)(Yo,{}),(0,$.jsx)(Po,{label:`Sidebar`,help:`Light mode. Its text turns white on a dark colour.`,yamlKey:`theme.primary`,value:o(`primary`),fallback:te,onChange:e=>c(`primary`,e)}),(0,$.jsx)(Po,{label:`Sidebar gradient`,help:`The sidebar fades into it, top to bottom.`,yamlKey:`theme.gradient`,value:o(`gradient`),onChange:e=>c(`gradient`,e)}),(0,$.jsx)(Po,{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:o(`secondary`),fallback:y({...P,secondary:void 0})||ee,onChange:e=>c(`secondary`,e)}),(0,$.jsx)(Po,{label:`Page background`,help:`Light mode, a light colour. Dark mode keeps its dark page.`,yamlKey:`theme.background`,value:o(`background`),fallback:`#ffffff`,check:Qo,onChange:e=>c(`background`,e)}),(0,$.jsx)(Ho,{value:O||`phosphor`,onChange:e=>c(`icon_set`,e===`phosphor`?``:e)}),(0,$.jsx)(Jo,{draft:P,value:o(`icon_colour`),onChange:e=>c(`icon_colour`,e)}),(0,$.jsx)(Ro,{draft:P,value:D||`auto`,onChange:e=>c(`icon_style`,e===`auto`?``:e)}),(0,$.jsx)(Ko,{value:k||`visor`,colours:A||`soft`,onChange:e=>c(`mascot`,e===`visor`?``:e),onColours:e=>c(`mascot_colours`,e===`soft`?``:e)}),(0,$.jsx)(J,{label:`Preview`,help:I.length?(0,$.jsx)(`span`,{className:`flex flex-col gap-1 text-warn`,children:I.map(e=>(0,$.jsxs)(`span`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(et,{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)(ko,{children:[(0,$.jsxs)(`span`,{className:g(p,`flex w-full items-center justify-end gap-4 rounded-base p-4`),children:[(0,$.jsx)(`a`,{href:`#appearance-preview`,onClick:e=>e.preventDefault(),className:`text-body-sm`,children:`A link`}),(0,$.jsx)(V,{variant:`primary`,size:`sm`,tabIndex:-1,"aria-hidden":`true`,className:`pointer-events-none`,children:`A button`})]}),(0,$.jsx)(Zo,{theme:i,onReset:t=>e.set(t),value:e.value})]})}),(0,$.jsx)(K,{icon:Ke,children:`Import colours`}),(0,$.jsx)(No,{start:x(o(`secondary`))||x(o(`primary`))||``,onUse:t=>{let n=e.value;for(let e of[`primary`,`gradient`,`secondary`,`background`])n=W(n,[`theme`,e],t[e]);e.set(n)}}),(0,$.jsx)(jo,{onUse:t=>{let n=e.value;for(let e of[`primary`,`gradient`,`secondary`,`background`])n=W(n,[`theme`,e],t[e]||void 0);e.set(n)}}),(0,$.jsx)(J,{label:`From a DESIGN.md`,help:m?(0,$.jsx)(`span`,{role:`status`,className:`text-ink-2`,children:m}):`Reads the lines that name primary, secondary, gradient and background.`,children:(0,$.jsxs)(ko,{children:[(0,$.jsx)(`input`,{ref:b,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 h(`${n.name} is over 256 KB.`);let r=ie(await n.text()),i=Object.entries(r).map(([e,t])=>`${e} ${t}`);if(!i.length)return h(`No primary, secondary, gradient or background colour in ${n.name}.`);let a=e.value;for(let[e,t]of Object.entries(r))a=W(a,[`theme`,e],t);e.set(a),h(`From ${n.name}: ${i.join(`, `)}.`)}}),(0,$.jsxs)(V,{size:`sm`,"data-tip":`Choose a DESIGN.md`,onClick:()=>b.current?.click(),children:[(0,$.jsx)(tn,{"aria-hidden":`true`}),`Choose`]})]})}),(0,$.jsx)(J,{label:`Reset all`,help:`The logo, name and colours back to ForgeQE's own.`,children:(0,$.jsx)(ko,{children:(0,$.jsxs)(V,{size:`sm`,disabled:!Object.keys(i).length,"data-tip":`The logo, name and colours back to ForgeQE's own`,onClick:()=>e.set(W(e.value,[`theme`],void 0)),children:[(0,$.jsx)(Je,{"aria-hidden":`true`}),`Reset all`]})})})]})}function es({ok:e,children:t}){return(0,$.jsxs)(`p`,{role:e?`status`:`alert`,className:g(`m-0 flex items-start gap-2 rounded-base px-4 py-2 text-body-sm leading-relaxed`,e?`bg-pass-soft text-pass`:`bg-fail-soft text-fail`),children:[e?(0,$.jsx)(rt,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none`}):(0,$.jsx)(et,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,$.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:t})]})}function ts({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)(Pn,{label:e,value:t,onChange:r,options:n.map(e=>({id:e.id,label:e.label}))})})}var ns=[{id:`eager`,label:`Briefly`},{id:`normal`,label:`A moment`},{id:`patient`,label:`Longer`}],rs=e=>e>=1e9?`${(e/1e9).toFixed(1)} GB`:`${Math.max(1,Math.round(e/1e6))} MB`;function is(){let[e,t]=(0,Q.useState)(null),[n,r]=(0,Q.useState)(``),[i,a]=(0,Q.useState)(ln()),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{let n=!0,i=()=>Tn(!0).then(e=>n&&t(e)).catch(e=>n&&r(e.message));i();let a=hn(()=>e?.setup.running&&void i(),1500);return()=>{n=!1,fn(a)}},[e?.setup.running]);let d=async()=>{r(``),s(!0),l(!0);try{t(await xe.setup())}catch(e){r(e.message)}finally{l(!1)}},f=e,p=!!f?.setup.running;return(0,$.jsxs)(X,{children:[(0,$.jsx)(K,{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)(J,{label:f?f.ready?`Set up`:p?`Setting up`:`Not set up yet`:`Speech`,help:f?.ready?g(u,`Talk, at the foot of the right 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${f?`, about ${rs(f.setup.bytes)}`:``}, into ForgeQE's folder.`,children:f?f.ready?(0,$.jsx)(B,{tone:`pass`,children:`Ready`}):p?(0,$.jsx)(B,{tone:`running`,children:`Setting up`}):(0,$.jsxs)(V,{busy:c,size:`sm`,variant:`primary`,disabled:c,onClick:()=>void d(),"data-tip":`Download the speech models once: nothing is sent anywhere`,children:[c?(0,$.jsx)(ze,{state:`handing`,px:16}):(0,$.jsx)(Ut,{"aria-hidden":`true`}),c?`Starting…`:`Install (${rs(f.setup.bytes)})`]}):(0,$.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Reading…`})}),(p||o&&f&&f.setup.lines.length>0)&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[!p&&f&&(0,$.jsx)(es,{ok:f.ready,children:f.ready?`Speech is set up.`:f.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:g(`overflow-auto rounded-base bg-surface-muted p-4 font-mono text-body-sm leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,`m-0 max-h-[280px]`),children:(0,$.jsx)(Ie,{text:f?.setup.lines.length?f.setup.lines.join(`
|
|
21
|
-
`):`Starting…`})})]}),n&&(0,$.jsx)(es,{ok:!1,children:n}),f?.ready&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{label:`Voice`,help:`An open voice that runs on this computer.`,children:(0,$.jsx)(`span`,{className:`text-body-sm text-ink-2`,children:`Ready`})}),(0,$.jsx)(J,{label:`Listening`,help:`Writes down what you say, on this computer.`,children:(0,$.jsx)(`span`,{className:`text-body-sm text-ink-2`,children:f.hearing?.model??`None`})})]}),(0,$.jsx)(K,{help:`How Talk takes turns with you. Yours alone: kept in this browser.`,children:`Conversation`}),(0,$.jsx)(J,{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)(ts,{label:`How long it waits for you`,value:i,options:ns,onPick:e=>(a(e),Qn(e))})})]})}function as({text:e}){return(0,$.jsx)(`p`,{role:`alert`,className:g(z.fail,`m-0`),children:e})}function os({text:e}){return(0,$.jsx)(`p`,{role:`status`,className:g(z.pass,`m-0`),children:e})}var ss=[{id:`metrics`,label:`Metrics`},{id:`traces`,label:`Spans too`},{id:`traces+errors`,label:`Errors too`}],cs={metrics:`Counts, durations, tokens and cost, every minute and at the end of a session. No spans.`,traces:`Also a trace for each session: its turns, runs, model calls and tool calls, with their durations.`,"traces+errors":`Also, on an error, its kind (such as timeout or not reachable), never its message.`},ls=e=>{let t=e.settings,n=t?.headers[0];return{endpoint:t?.endpoint??``,header:n?.name??`Authorization`,variable:n?.variable??``,level:t?.level??`traces`,service:t?.service??`forgeqe`,only:!!t&&t.projects!==`all`,protocol:t?.protocol??`json`,logs:t?.logs??!1}},us=e=>e?new Date(e).toLocaleString():``;function ds(){let[e,t]=(0,Q.useState)(null),[n,r]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(``),_=e=>{t(e),r(ls(e))};(0,Q.useEffect)(()=>{Te.view().then(_,e=>s(e.message))},[]);let v=async(e,t)=>{s(``),l(``),d(e);try{let e=await t();return typeof e==`string`?l(e):_(e),!0}catch(e){return s(e.message),!1}finally{d(``)}};if(!e||!n)return o?(0,$.jsx)(as,{text:o}):(0,$.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Loading…`});let y=e.settings,b=!!y?.approved&&y.approved.host===y.host,x=y?y.headers.slice(1):[],S=ls(e),C=JSON.stringify(n)!==JSON.stringify(S),w=e=>r({...n,...e}),T=y?y.enabled&&b?e.exports?(0,$.jsx)(B,{tone:`pass`,children:`On`}):(0,$.jsx)(B,{tone:`warn`,children:`Not sending`}):b?(0,$.jsx)(B,{tone:`neutral`,children:`Off`}):(0,$.jsx)(B,{tone:`warn`,children:`Not turned on`}):(0,$.jsx)(B,{tone:`neutral`,children:`Not set up`}),E=e.status,D=()=>v(`save`,async()=>{let t=await Te.save({endpoint:n.endpoint,headers:[...n.variable.trim()?[{name:n.header.trim(),variable:n.variable.trim()}]:[],...x.map(e=>({name:e.name,variable:e.variable}))],level:n.level,service:n.service,projects:n.only?[e.project]:`all`,protocol:n.protocol,logs:n.logs});return l(t.settings?.enabled?`Saved.`:`Saved. Nothing is sent until you turn it on.`),t}).then(()=>void 0);return(0,$.jsxs)(X,{children:[(0,$.jsx)(K,{first:!0,icon:an,help:`Kept on this computer, in ForgeQE's folder. A project cannot turn it on or change where it sends.`,children:`The export`}),e.problem&&(0,$.jsx)(as,{text:e.problem}),(0,$.jsx)(J,{label:`Status`,help:y?.enabled&&b?e.exports?`Sending to ${y.host}.`:e.why:y?b?`Turned off: nothing is sent.`:`Nothing is sent until you turn it on for ${y.host}.`:`Give a collector's address below and save, then turn it on.`,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 sm:justify-end`,children:[T,y&&e.exports&&(0,$.jsxs)(V,{busy:u===`test`,size:`sm`,disabled:!!u,onClick:()=>void v(`test`,async()=>{let e=await Te.test();if(!e.ok)throw Error(`Not sent: ${e.problem}.`);return`A test span reached ${y.host}.`}),"data-tip":`Send one span named forgeqe.telemetry.test now`,children:[(0,$.jsx)(gt,{"aria-hidden":`true`}),u===`test`?`Sending…`:`Send a test span`]}),y&&y.enabled&&b?(0,$.jsxs)(V,{size:`sm`,disabled:!!u,onClick:()=>void v(`off`,async()=>{let e=await Te.off();return l(`Turned off. Nothing is sent from now on.`),e}),"data-tip":`Stop sending; the settings stay`,children:[(0,$.jsx)(Ot,{"aria-hidden":`true`}),`Turn off`]}):y&&(0,$.jsxs)(V,{size:`sm`,variant:`primary`,disabled:!!u||C,onClick:()=>(h(``),p(`on`)),"data-tip":C?`Save your changes first`:`See what would be sent, then type the host to turn it on`,children:[(0,$.jsx)(st,{"aria-hidden":`true`}),`Turn on…`]})]})}),(0,$.jsx)(J,{label:`This project`,help:e.exports?`Its sessions are sent, grouped by this id: a salted fingerprint of its folder, never its name or path.`:`Its id in the export: a salted fingerprint of its folder, never its name or path.`,children:(0,$.jsx)(`code`,{className:`font-mono text-body-sm text-ink-2`,children:e.project})}),E&&(0,$.jsx)(J,{label:`Last result`,help:E.problem?`${E.problem}${E.failingSince?`, since ${us(E.failingSince)}`:``}.`:void 0,children:(0,$.jsxs)(`span`,{className:`text-body-sm text-ink-2`,children:[E.lastSent?`Sent ${us(E.lastSent)}`:`Nothing sent yet`,`: `,E.sent,` spans, `,E.points??0,` metric points, `,E.logs??0,` log records`,E.dropped+(E.pointsDropped??0)+(E.logsDropped??0)?`, ${E.dropped+(E.pointsDropped??0)+(E.logsDropped??0)} dropped`:``]})}),o&&(0,$.jsx)(as,{text:o}),c&&(0,$.jsx)(os,{text:c}),(0,$.jsx)(K,{icon:_t,help:`Your OpenTelemetry collector's OTLP/HTTP address: Grafana, Datadog, Honeycomb, Jaeger, Azure Monitor and others take it.`,children:`Collector`}),(0,$.jsx)(J,{label:`Address`,htmlFor:`otel-endpoint`,help:`https, or http only for a collector on this computer. A new host must be turned on again.`,children:(0,$.jsx)(a,{id:`otel-endpoint`,className:`w-full sm:w-[360px]`,value:n.endpoint,placeholder:`https://otel.example.com:4318`,spellCheck:!1,autoComplete:`off`,onChange:e=>w({endpoint:e.target.value})})}),(0,$.jsx)(J,{label:`Token header`,htmlFor:`otel-variable`,help:(0,$.jsxs)($.Fragment,{children:[`The header and the name of the secret it sends, such as OTEL_COLLECTOR_TOKEN. Save its value in `,(0,$.jsx)(`a`,{href:i(`settings`,`secrets`),children:`Secrets`}),`; it never comes to this page.`,y?.headers[0]&&!y.headers[0].set&&y.headers[0].variable===n.variable.trim()&&(0,$.jsxs)(`span`,{className:`text-warn`,children:[` `,y.headers[0].variable,` has no value saved yet.`]}),x.length>0&&` ${x.length} more ${x.length===1?`header`:`headers`} set with forgeqe telemetry set ${x.length===1?`is`:`are`} kept.`]}),children:(0,$.jsxs)(`div`,{className:`flex w-full flex-col gap-2 sm:items-end`,children:[(0,$.jsx)(a,{"aria-label":`Header name`,className:`w-full sm:w-[200px]`,value:n.header,spellCheck:!1,autoComplete:`off`,onChange:e=>w({header:e.target.value})}),(0,$.jsx)(a,{id:`otel-variable`,className:`w-full sm:w-[200px]`,value:n.variable,placeholder:`OTEL_COLLECTOR_TOKEN`,spellCheck:!1,autoComplete:`off`,onChange:e=>w({variable:e.target.value})})]})}),(0,$.jsx)(J,{label:`What to send`,help:cs[n.level],children:(0,$.jsx)(`div`,{className:`flex w-full flex-wrap items-center gap-2 sm:justify-end`,children:(0,$.jsx)(Pn,{label:`What to send`,value:n.level,onChange:e=>w({level:e}),options:ss})})}),(0,$.jsx)(J,{label:`Problems as log records`,help:n.logs?`Errors and warnings (a failed turn, a failed tool call, a failed run) go to /v1/logs: a severity and the event's kind, tied to the session's trace. Never their text.`:`Off: problems are counted in the metrics and marked on the spans only.`,children:(0,$.jsx)(Hn,{checked:n.logs,onChange:e=>w({logs:e}),label:`Send problems as log records`})}),(0,$.jsx)(J,{label:`Format`,help:n.protocol===`protobuf`?`OTLP protobuf (application/x-protobuf), for a collector that takes only that. The sample below shows it as JSON.`:`OTLP JSON, which every collector takes.`,children:(0,$.jsx)(`div`,{className:`flex w-full flex-wrap items-center gap-2 sm:justify-end`,children:(0,$.jsx)(Pn,{label:`Format`,value:n.protocol,onChange:e=>w({protocol:e}),options:[{id:`json`,label:`JSON`},{id:`protobuf`,label:`Protobuf`}]})})}),(0,$.jsx)(J,{label:`Service name`,htmlFor:`otel-service`,help:`How the collector names ForgeQE: letters, digits, dots, dashes or underscores.`,children:(0,$.jsx)(a,{id:`otel-service`,className:`w-full sm:w-[200px]`,value:n.service,spellCheck:!1,autoComplete:`off`,onChange:e=>w({service:e.target.value})})}),(0,$.jsx)(J,{label:`Projects`,help:n.only?`Only this project (${e.project}) is sent. A project whose forgeqe.yaml says telemetry: off is never sent.`:`Every project on this computer, except one whose forgeqe.yaml says telemetry: off.`,children:(0,$.jsx)(`div`,{className:`flex w-full flex-wrap items-center gap-2 sm:justify-end`,children:(0,$.jsx)(Pn,{label:`Projects`,value:n.only?`this`:`all`,onChange:e=>w({only:e===`this`}),options:[{id:`all`,label:`Every project`},{id:`this`,label:`Only this one`}]})})}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2 py-4`,children:[(0,$.jsxs)(V,{busy:u===`save`,size:`sm`,variant:`primary`,disabled:!!u||!C||!n.endpoint.trim(),onClick:()=>void D(),"data-tip":`Save to ForgeQE's folder on this computer; nothing is turned on`,children:[(0,$.jsx)(Jt,{"aria-hidden":`true`}),u===`save`?`Saving…`:`Save`]}),C&&y&&(0,$.jsxs)(V,{size:`sm`,onClick:()=>r(S),disabled:!!u,"data-tip":`Discard your changes`,children:[(0,$.jsx)(Be,{"aria-hidden":`true`}),`Discard`]})]}),(0,$.jsx)(K,{icon:gt,help:`Shapes, never content: each attribute is a name of ForgeQE's own list, a number or a yes or no.`,children:`What is sent`}),(0,$.jsx)(J,{label:`Attributes`,help:`The whole list. Anything else is left out before it leaves this computer.`,children:(0,$.jsx)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:e.attributes.join(`, `)})}),(0,$.jsx)(J,{label:`Metrics`,children:(0,$.jsx)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:e.metrics.join(`, `)})}),(0,$.jsx)(J,{label:`Never sent`,children:(0,$.jsxs)(`span`,{className:`text-body-sm text-ink-2`,children:[e.neverSent[0].toUpperCase()+e.neverSent.slice(1),`.`]})}),(0,$.jsx)(J,{label:`A sample`,help:`What would be sent for ${e.sample.from}.`,children:(0,$.jsxs)(V,{size:`sm`,onClick:()=>p(`sample`),"data-tip":`The real JSON, as the collector would get it`,children:[(0,$.jsx)(Gt,{"aria-hidden":`true`}),`Show the sample`]})}),(0,$.jsx)(Z,{wide:!0,open:!!f,onClose:()=>p(null),title:f===`on`&&y?`Turn on the export to ${y.host}`:`What would be sent`,description:`For ${e.sample.from}.`,footer:f===`on`&&y?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(V,{onClick:()=>p(null),children:[(0,$.jsx)(U,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsxs)(V,{busy:u===`on`,variant:`primary`,disabled:!!u||m.trim()!==y.host,onClick:()=>void v(`on`,async()=>{let e=await Te.on(m);return p(null),l(`On. ForgeQE sends to ${y.host} from its next command.`),e}),children:[(0,$.jsx)(st,{"aria-hidden":`true`}),u===`on`?`Turning on…`:`Turn on`]})]}):(0,$.jsxs)(V,{onClick:()=>p(null),children:[(0,$.jsx)(U,{"aria-hidden":`true`}),`Close`]}),children:(0,$.jsxs)(`div`,{className:`mt-4 flex flex-col gap-4`,children:[f===`on`&&y&&(0,$.jsxs)(`div`,{className:g(`rounded-base bg-surface-muted p-4`,`flex flex-col gap-2`),children:[(0,$.jsxs)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:[y.level===`metrics`?`Metrics`:`Each session's spans and its metrics`,y.logs?`, and problems as log records,`:``,` go to `,y.endpoint,` as `,y.protocol===`protobuf`?`protobuf (shown here as JSON)`:`JSON`,`, with only the attributes below. Never sent: `,e.neverSent,`. Turn it off here at any time.`]}),(0,$.jsxs)(`label`,{htmlFor:`otel-confirm`,className:`text-body-sm font-medium text-ink-2`,children:[`Type `,y.host,` to confirm`]}),(0,$.jsx)(a,{id:`otel-confirm`,value:m,placeholder:y.host,spellCheck:!1,autoComplete:`off`,onChange:e=>h(e.target.value)}),o&&(0,$.jsx)(as,{text:o})]}),e.sample.traces&&(0,$.jsx)(dr,{level:3,icon:pt,title:`Spans, to /v1/traces`,children:(0,$.jsx)(`pre`,{className:g(`overflow-auto rounded-base bg-surface-muted p-4 font-mono text-body-sm leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,`m-0 max-h-[40vh]`),children:e.sample.traces})}),e.sample.logs&&(0,$.jsx)(dr,{level:3,icon:Bt,title:`Log records, to /v1/logs`,children:(0,$.jsx)(`pre`,{className:g(`overflow-auto rounded-base bg-surface-muted p-4 font-mono text-body-sm leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,`m-0 max-h-[40vh]`),children:e.sample.logs})}),e.sample.metrics&&(0,$.jsx)(dr,{level:3,icon:Zt,title:`Metrics, to /v1/metrics`,children:(0,$.jsx)(`pre`,{className:g(`overflow-auto rounded-base bg-surface-muted p-4 font-mono text-body-sm leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,`m-0 max-h-[40vh]`),children:e.sample.metrics})})]})})]})}var fs=[{id:`github`,name:`GitHub`,note:`github.com, or GitHub Enterprise at your own address.`,logo:yr.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:yr.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:yr.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:yr.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:yr.bitbucket,tokenEnv:`BITBUCKET_TOKEN`,cloud:!1}],ps=e=>fs.find(t=>t.id===e),ms=/^[A-Za-z0-9][A-Za-z0-9_-]{0,62}$/;function hs(e,t){let n=!t.url||gs(e?.id,String(t.url)).cloud;return e?.id===`github`?n?`cli`:`gh-host`:e?.id===`azure-devops`&&n?`cli`:`git`}function gs(e,t){let n;try{n=new URL(t.trim())}catch{return{cloud:!1}}let i=n.hostname.toLowerCase(),a=r(n.pathname).split(`/`).filter(Boolean)[0],o=a&&/^[A-Za-z0-9][A-Za-z0-9 ._-]{0,99}$/.test(a)?a:void 0;if(e===`azure-devops`){if(i===`dev.azure.com`)return{cloud:!0,org:o};let e=/^([a-z0-9][a-z0-9-]{0,62})\.visualstudio\.com$/.exec(i);return e?{cloud:!0,org:e[1]}:{cloud:!1}}return e===`bitbucket-cloud`?i===`bitbucket.org`?{cloud:!0,org:o}:{cloud:!1}:e===`github`?{cloud:i===`github.com`}:e===`gitlab`?{cloud:i===`gitlab.com`}:{cloud:!1}}function _s({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)(pn,{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-body-sm text-muted [overflow-wrap:anywhere]`,children:r}),i]}),(0,$.jsx)(`span`,{className:`flex gap-2`,children:a})]})}function vs({ok:e,message:t}){return(0,$.jsxs)(`p`,{role:e?`status`:`alert`,className:g(`mt-2 mb-1 flex items-start gap-2`,z[e?`pass`:`fail`]),children:[e?(0,$.jsx)(rt,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none`}):(0,$.jsx)(nn,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,$.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:t})]})}function ys({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-body-sm font-medium text-ink`,children:e}),t&&(0,$.jsx)(`p`,{className:`m-0 text-body-sm leading-relaxed text-ink-2`,children:t})]})}var bs=({children:e})=>(0,$.jsx)(`p`,{role:`status`,className:`m-0 border-t border-line-soft py-6 text-body-sm text-muted`,children:e}),xs=e=>Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`string`));function Ss(e,t,n){let r=q(Y(e,[`product`,`repos`])),i=e;for(let[e,a]of Object.entries(r))q(a).account===t&&(i=W(i,[`product`,`repos`,e,`account`],n));return i}function Cs({edit:e}){let t=e.value,n=q(Y(t,[`product`,`accounts`])),r=q(Y(t,[`product`,`repos`])),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)({}),u=(0,Q.useCallback)(()=>{Se.get().then(e=>l(e.saved),()=>{})},[]);(0,Q.useEffect)(u,[u]);let d=zn(),f=e=>Object.values(r).filter(t=>q(t).account===e).length,p=(e,t)=>{let n=ps(t.host),r=f(e),i=`${r} ${r===1?`repository`:`repositories`} connected`;if(t.auth===`token`)return Wn(d,String(t.token_env||``))?(0,$.jsx)(`span`,{className:`text-body-sm text-pass`,children:`Connected with a token, ${i}`}):(0,$.jsx)(`span`,{className:`text-body-sm text-warn`,children:`Needs its token: Edit to add it`});let a=hs(n,t),o=c[n.cli.system];return a===`cli`?o&&(o.via!==`token`||o.browser)&&ra(o,n.name)?(0,$.jsx)(`span`,{className:`text-body-sm text-pass`,children:`Signed in, ${i}`}):(0,$.jsx)(`span`,{className:`text-body-sm text-warn`,children:`Needs a sign-in: Edit to sign in`}):(0,$.jsx)(`span`,{className:`text-body-sm text-muted`,children:`${a===`gh-host`?`The GitHub CLI's`:`Git Credential Manager's`} sign-in, ${i}`})};return(0,$.jsxs)(X,{children:[(0,$.jsx)(K,{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-body-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)(V,{size:`sm`,"data-tip":`Add an account`,onClick:()=>a({step:`catalog`}),children:[(0,$.jsx)(H,{"aria-hidden":`true`}),`Add`]})]}),Object.entries(n).map(([n,r])=>{let i=q(r),o=ps(i.host);return(0,$.jsx)(_s,{logo:o?.logo,icon:We,title:n,meta:[o?.name||`Unknown host`,i.org,i.url].filter(Boolean).map(String).join(`, `),state:p(n,i),actions:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(V,{variant:`icon`,size:`icon-sm`,"aria-label":`Repositories of ${n}`,"data-tip":`Repositories of ${n}`,disabled:!o,onClick:()=>s(n),children:(0,$.jsx)(He,{"aria-hidden":`true`})}),o&&(0,$.jsx)(V,{variant:`icon`,size:`icon-sm`,"aria-label":`Edit ${n}`,"data-tip":`Edit ${n}`,onClick:()=>a({step:`form`,host:o,mode:`edit`,name:n,from:n,value:i}),children:(0,$.jsx)(tt,{"aria-hidden":`true`})}),(0,$.jsx)(V,{variant:`icon`,size:`icon-sm`,"aria-label":`Disconnect ${n}`,"data-tip":`Disconnect ${n}`,onClick:()=>e.set(Ss(W(t,[`product`,`accounts`,n],void 0),n,void 0)),children:(0,$.jsx)(Xe,{"aria-hidden":`true`})})]})},n)}),(0,$.jsx)(ys,{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)(fr,{edit:e,base:[`product`,`repos`],defs:Tr,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)(ks,{edit:e}),(0,$.jsx)(Ms,{edit:e}),(0,$.jsx)(K,{help:Ir[0].help,children:`4. The product and its knowledge`}),(0,$.jsx)(G,{defs:Ir[0].fields,edit:e,base:Ir[0].base}),Ir.slice(1).map(t=>(0,$.jsxs)(`div`,{children:[(0,$.jsx)(ys,{title:t.title,help:t.help}),(0,$.jsx)(G,{defs:t.fields,edit:e,base:t.base})]},t.title)),(0,$.jsx)(K,{help:zr[0].help,children:`5. ${zr[0].title}`}),(0,$.jsx)(G,{defs:zr[0].fields,edit:e,base:zr[0].base}),(0,$.jsx)(ws,{sheet:i,setSheet:a,taken:e=>e in n,onSigned:u,onApply:n=>{let r=t;n.mode===`edit`&&n.from!==n.name&&(r=Ss(W(r,[`product`,`accounts`,n.from],void 0),n.from,n.name)),e.set(W(r,[`product`,`accounts`,n.name],n.value)),a(null),n.mode===`add`&&s(n.name)}}),(0,$.jsx)(Ts,{id:o,account:o?q(n[o]):{},repos:r,onClose:()=>s(null),onConnect:n=>e.set(W(t,[`product`,`repos`],{...r,...n}))})]})}function ws({sheet:e,setSheet:t,taken:n,onApply:r,onSigned:i}){let s=zn(),[c,l]=(0,Q.useState)({busy:!1}),u=e?.step===`form`?`${e.host.id}/${e.from}`:e?.step||``;(0,Q.useEffect)(()=>l({busy:!1}),[u]);let d=()=>t(null);if(e?.step===`form`){let o=e,u=o.value,f=e=>t({...o,value:e}),p=o.name?ms.test(o.name)?o.name!==o.from&&n(o.name)?`Another account has this name.`:``:`Letters, digits, - and _.`:``,m=!u.url||gs(o.host.id,String(u.url)).cloud,h=o.host.id===`azure-devops`&&m&&!(u.url&&gs(o.host.id,String(u.url)).org),g=(()=>{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.`}})(),_=!!o.name&&!p&&!g&&(o.host.cloud||!!String(u.url||``).trim())&&(!h||!!String(u.org||``).trim())&&(u.auth!==`token`||!!String(u.token_env||``).trim()),v=hs(o.host,u),y=async e=>{l({busy:!0});try{if(e===`signin`){let e=await ge.signIn(o.name||`account`,u);l({busy:!1,ok:e.ok,message:e.message})}else{let e=await ge.repos(o.name||`account`,u,xs(s.pending),[]);l({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){l({busy:!1,ok:!1,message:e.message})}};return(0,$.jsxs)(Z,{open:!0,onClose:d,title:o.mode===`add`?`Connect ${o.host.name}`:`Edit ${o.name}`,description:`Then pick its repositories. A token you type is kept in ${qn(s.store)}, never in the settings files.`,footer:(0,$.jsxs)($.Fragment,{children:[o.mode===`add`&&(0,$.jsxs)(V,{onClick:()=>t({step:`catalog`}),children:[(0,$.jsx)(yt,{"aria-hidden":`true`}),`Back`]}),(0,$.jsxs)(V,{busy:c.busy,onClick:()=>y(`list`),disabled:c.busy||!_,className:`mr-auto`,"data-tip":`Test the connection`,children:[(0,$.jsx)(Ge,{"aria-hidden":`true`}),c.busy?`Testing…`:`Test`]}),(0,$.jsxs)(V,{onClick:d,children:[(0,$.jsx)(U,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsxs)(V,{variant:`primary`,disabled:!_,onClick:()=>r(o),children:[o.mode===`add`?(0,$.jsx)(Ge,{"aria-hidden":`true`}):(0,$.jsx)(Jt,{"aria-hidden":`true`}),o.mode===`add`?`Connect`:`Done`]})]}),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-4 pt-6 pb-2`,children:[(0,$.jsx)(pn,{logo:o.host.logo,icon:We,size:`lg`}),(0,$.jsx)(`span`,{className:`text-body-sm text-muted`,children:o.host.note})]}),(0,$.jsx)(`div`,{"aria-live":`polite`,children:c.message&&(0,$.jsx)(vs,{ok:!!c.ok,message:c.message})}),(0,$.jsx)(J,{label:`Name`,help:p?(0,$.jsx)(`span`,{className:`text-fail`,children:p}):`A short name for the account, such as work.`,htmlFor:`acct-name`,stacked:!0,children:(0,$.jsx)(a,{id:`acct-name`,value:o.name,spellCheck:!1,"aria-invalid":!!p,placeholder:`work`,onChange:e=>t({...o,name:e.target.value.trim()})})}),(0,$.jsx)(J,{label:o.host.cloud?`Address of your own server`:`Address`,help:g?(0,$.jsx)(`span`,{className:`text-fail`,children:g}):o.host.cloud?`Empty: ${o.host.name}'s cloud.`:`https, the server's address.`,htmlFor:`acct-url`,stacked:!0,children:(0,$.jsx)(a,{id:`acct-url`,"aria-invalid":!!g,value:String(u.url||``),spellCheck:!1,placeholder:o.host.cloud?``:`https://bitbucket.acme.example`,onChange:e=>f(W(u,[`url`],e.target.value.trim()||void 0))})}),o.host.org&&(0,$.jsx)(J,{label:o.host.org,help:h?`Its name, as in dev.azure.com/<organization>.`:`Empty: every repository you can read.`,htmlFor:`acct-org`,stacked:!0,children:(0,$.jsx)(a,{id:`acct-org`,value:String(u.org||``),spellCheck:!1,placeholder:`acme`,onChange:e=>f(W(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`,v===`git`?`In the browser, with Git Credential Manager`:o.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-body-sm`,children:[(0,$.jsx)(Zr,{name:`acct-auth`,checked:u.auth===`token`==(e===`token`),onSelect:()=>f(e===`token`?{...u,auth:`token`,token_env:u.token_env||o.host.tokenEnv}:{...u,auth:`browser`,token_env:void 0,user:void 0})}),t]},e))]}),u.auth===`token`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{label:`Token`,help:`Read access to the repositories (code: read).`,htmlFor:`account-token`,stacked:!0,children:(0,$.jsx)(on,{id:`account-token`,name:String(u.token_env||o.host.tokenEnv),field:`token`,onRename:e=>f({...u,token_env:e})})}),(o.host.id===`bitbucket-cloud`||o.host.id===`bitbucket-server`)&&(0,$.jsx)(J,{label:`User name for the token`,help:`With a Bitbucket app password. Empty: an access token.`,htmlFor:`acct-user`,stacked:!0,children:(0,$.jsx)(a,{id:`acct-user`,value:String(u.user||``),spellCheck:!1,onChange:e=>f(W(u,[`user`],e.target.value.trim()||void 0))})})]}):v===`cli`?(0,$.jsx)(ia,{system:o.host.cli.system,label:o.host.cli.label,keyless:!0,onChanged:i}):v===`gh-host`?(0,$.jsx)(J,{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)(J,{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)(V,{busy:c.busy,onClick:()=>y(`signin`),disabled:c.busy||!_,"data-tip":`Sign in with the browser`,children:[(0,$.jsx)(Qe,{"aria-hidden":`true`}),c.busy?`Signing in…`:`Sign in`]})})]})}return(0,$.jsx)(Z,{open:e?.step===`catalog`,onClose:d,title:`Add an account`,description:`Pick where your code is.`,footer:(0,$.jsxs)(V,{onClick:d,children:[(0,$.jsx)(U,{"aria-hidden":`true`}),`Close`]}),children:(0,$.jsx)(`div`,{className:`pt-4`,children:fs.map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>t({step:`form`,host:e,mode:`add`,name:``,from:``,value:{host:e.id,auth:`browser`}}),className:g(o,`min-h-14`),children:[(0,$.jsx)(pn,{logo:e.logo,icon:We}),(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-body-sm text-muted`,children:e.note})]}),(0,$.jsx)(`span`,{className:`text-body-sm text-accent-fg`,children:`Add`})]},e.id))})})}function Ts({id:e,account:t,repos:n,onClose:r,onConnect:i}){let o=zn(),[s,c]=(0,Q.useState)({busy:!1}),[l,u]=(0,Q.useState)(new Set),[d,f]=(0,Q.useState)(``),p=(0,Q.useMemo)(()=>new Set(Object.values(n).map(e=>String(q(e).git||``))),[n]);(0,Q.useEffect)(()=>{e&&(u(new Set),f(``),c({busy:!0}),ge.repos(e,t,xs(o.pending),Object.keys(n)).then(e=>c(e.ok?{busy:!1,repos:e.repos,truncated:e.truncated,skipped:e.skipped}:{busy:!1,message:e.message}),e=>c({busy:!1,message:e.message})))},[e]);let m=(s.repos||[]).filter(e=>!d||e.fullName.toLowerCase().includes(d.toLowerCase()));return(0,$.jsxs)(Z,{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-body-sm text-muted`,children:l.size?`${l.size} picked`:``}),(0,$.jsxs)(V,{onClick:r,children:[(0,$.jsx)(U,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsxs)(V,{variant:`primary`,disabled:!l.size,onClick:()=>{let e={};for(let t of s.repos||[])l.has(t.git)&&(e[t.key]=t.entry);i(e),r()},"data-tip":l.size>1?`Connect ${l.size} repositories`:void 0,children:[(0,$.jsx)(Ge,{"aria-hidden":`true`}),l.size>1?`Connect (${l.size})`:`Connect`]})]}),children:[(0,$.jsxs)(`div`,{"aria-live":`polite`,children:[s.busy&&(0,$.jsx)(bs,{children:`Reading the account's repositories…`}),s.message&&(0,$.jsx)(vs,{ok:!1,message:s.message})]}),s.repos&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{label:`Find`,htmlFor:`repo-find`,stacked:!0,children:(0,$.jsx)(a,{id:`repo-find`,type:`search`,value:d,placeholder:`shop`,onChange:e=>f(e.target.value)})}),!m.length&&(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft py-6 text-body-sm text-muted`,children:s.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:m.map(e=>{let t=p.has(e.git);return(0,$.jsx)(`li`,{className:`border-t border-line-soft`,children:(0,$.jsxs)(`label`,{className:g(`flex min-h-12 items-center gap-4 py-2`,t?`cursor-default`:`cursor-pointer`),children:[(0,$.jsx)(lr,{disabled:t,checked:t||l.has(e.git),onCheckedChange:t=>u(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-body-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-body-sm text-pass`,children:`Connected`})]})},e.git)})}),(s.truncated||!!s.skipped)&&(0,$.jsx)(`p`,{className:`m-0 pt-4 text-body-sm text-muted`,children:[s.truncated?`The first 2,000 are listed: find narrows them.`:``,s.skipped?`${s.skipped} left out: their links are not of this host, or not https.`:``].filter(Boolean).join(` `)})]})]})}var Es=e=>e.url?`url`:e.mcp?`mcp`:e.command?`command`:e.documents?`documents`:`none`,Ds=Nr[0].fields,Os=e=>e.map(e=>Ds.find(t=>t.key===e));function ks({edit:e}){let t=zn(),n=q(e.value.rag),r=Es(n),[i,o]=(0,Q.useState)(r),[s,c]=(0,Q.useState)(``),[l,u]=(0,Q.useState)({busy:!1}),d=JSON.stringify(n),f=(0,Q.useRef)(null);(0,Q.useEffect)(()=>o(r===`none`&&f.current?.rag===d?f.current.kind:r),[r,d]);let p=t=>{o(t),u({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));f.current={kind:t,rag:JSON.stringify(Object.keys(i).length?i:{})},e.set(W(e.value,[`rag`],Object.keys(i).length?i:void 0))},m=Object.keys(q(e.value.mcp)),h=async()=>{u({busy:!0});try{let r=await ge.testSearch(n,q(e.value.mcp),s,xs(t.pending));u({busy:!1,...r})}catch(e){u({busy:!1,ok:!1,message:e.message})}};return(0,$.jsxs)(X,{children:[(0,$.jsx)(K,{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]`)&&p(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)(Zr,{checked:i===e,onSelect:()=>i!==e&&p(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-body-sm text-muted [overflow-wrap:anywhere]`,children:n})]})]},e))}),i===`url`&&(0,$.jsx)(G,{defs:Os([`url`,`token_env`,`top_k`,`timeout_seconds`]),edit:e,base:[`rag`]}),i===`mcp`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(G,{defs:Os([`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-body-sm text-muted`,children:m.length?`MCP servers set up: ${m.join(`, `)}.`:`No MCP server is set up yet: add one under MCP servers, then name it here.`})]}),i===`command`&&(0,$.jsx)(G,{defs:Os([`command`,`top_k`,`timeout_seconds`]),edit:e,base:[`rag`]}),i===`documents`&&(0,$.jsx)(G,{defs:Os([`documents.folders`,`documents.reasoning`,`top_k`]),edit:e,base:[`rag`]}),i!==`none`&&(0,$.jsx)(J,{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)(a,{id:`rag-query`,value:s,placeholder:`refunds over 500 EUR`,onChange:e=>c(e.target.value),onKeyDown:e=>F(e)&&s.trim()&&h(),className:`min-w-0 flex-1`}),(0,$.jsxs)(V,{busy:l.busy,size:`sm`,disabled:l.busy||!s.trim(),onClick:h,children:[(0,$.jsx)(Ze,{"aria-hidden":`true`}),l.busy?`Searching…`:`Search`]})]})}),(0,$.jsxs)(`div`,{"aria-live":`polite`,children:[l.message&&(0,$.jsx)(vs,{ok:!!l.ok,message:l.message}),!!l.passages?.length&&(0,$.jsx)(`ul`,{"aria-label":`Passages found`,className:`m-0 list-none p-0`,children:l.passages.map((e,t)=>(0,$.jsxs)(`li`,{className:`border-t border-line-soft py-2 text-body-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 As=/^[A-Za-z0-9][A-Za-z0-9 _.()-]{0,99}\.(md|markdown|txt)$/i,js=e=>e<1024?`${e} bytes`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1024/1024).toFixed(1)} MB`;function Ms({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)(()=>{ge.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(!As.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 ge.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 ge.removeDocument(e)).documents)}catch(e){i({ok:!1,message:e.message})}};return(0,$.jsxs)(X,{children:[(0,$.jsx)(K,{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-body-sm text-muted`,children:`Added here: kept in .forgeqe/documents, read as the source uploaded.`}),(0,$.jsxs)(V,{busy:a,size:`sm`,disabled:a,"data-tip":`Add Markdown files`,onClick:()=>s.current?.click(),children:[(0,$.jsx)(Yt,{"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)(vs,{ok:r.ok,message:r.message})}),!t&&!r&&(0,$.jsx)(bs,{children:`Reading the documents…`}),t&&!t.length&&(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft py-6 text-body-sm text-muted`,children:`None yet.`}),t?.map(e=>(0,$.jsx)(_s,{icon:qt,title:e.title,meta:`${e.name}, ${js(e.bytes)}`,actions:(0,$.jsx)(V,{variant:`icon`,size:`icon-sm`,"aria-label":`Remove ${e.name}`,"data-tip":`Remove ${e.name}`,onClick:()=>l(e.name),children:(0,$.jsx)(en,{"aria-hidden":`true`})})},e.name)),(0,$.jsx)(ys,{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)(fr,{edit:e,base:[`product`,`docs`],defs:jr,noun:`source`,placeholder:`help`,meta:e=>String(e.path||e.url||(e.confluence?`Confluence ${e.confluence}`:e.app?`app ${e.app}`:``))})]})}mn.add(Ms),mn.add(ks),mn.add(Cs);var Ns=/^[A-Z][A-Z0-9_]{1,63}$/,Ps=/^(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,Fs=/(TOKEN|PAT)$/,Is=(e,t=`SHOP_PASSWORD`)=>Ns.test(e)?Ps.test(e)?`${e} changes how programs start: pick another name.`:``:`Capital letters, digits and _, such as ${t}.`,Ls=[{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)`}],Rs={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)`},zs=e=>e?.length?`Used by ${e.slice(0,2).join(`, `)}${e.length>2?` and ${e.length-2} more`:``}`:``,Bs=()=>ye.list();function Vs({show:e}){let{data:t,error:n,reload:r}=wn(Bs),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(`sec-saved`),[c,l]=(0,Q.useState)(e||`all`);(0,Q.useEffect)(()=>{e&&s(`sec-saved`),l(e||`all`)},[e]);let[u,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(!1),C=(0,Q.useRef)(null),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(``),[O,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)({}),M=i??t,N=(M?.vaults||[]).filter(e=>e.auth===`cli`).map(e=>e.id).join(`,`),P=e=>{j(t=>({...t,[e]:`checking`})),ye.check(e).then(t=>j(n=>({...n,[e]:t})),t=>j(n=>({...n,[e]:{signedIn:!1,problem:t.message}})))};(0,Q.useEffect)(()=>{if(o===`sec-vaults`)for(let e of N.split(`,`).filter(Boolean))A[e]||P(e)},[o,N]),(0,Q.useEffect)(()=>{if(O?.state!==`running`)return;let e=setTimeout(()=>{ye.signinState().then(e=>{k(e.signin),e.signin&&e.signin.state!==`running`&&P(e.signin.vault)},()=>{})},1e3);return()=>clearTimeout(e)},[O]);let ee=async e=>{d(``),p(``);try{k(await ye.signIn(e))}catch(e){p(e.message)}},F=async(e,t,n)=>{S(!0),D(``);try{a(await e()),n(),d(t)}catch(e){D(e.message)}finally{S(!1)}},I=e=>{D(``),d(``),e()};if(!M)return(0,$.jsx)(sn,{error:n,reload:r});let te=M.secrets.filter(e=>e.from===`vault`&&!e.pending).length,ne=async()=>{d(``),p(``);try{let e=await ye.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),d(`Exported the vault connections: no value is in the file. A teammate imports it here and pulls with their own sign-in.`)}catch(e){p(e.message)}},re=async e=>{let t=e?.[0];if(t){if(d(``),p(``),t.size>262144)return p(`${t.name} is over 256 KB.`);S(!0),T(!0);try{let e=await ye.importVaults(await t.text());a(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.`:``];d(n.filter(Boolean).join(` `)),e.skipped.length&&p(`Not imported: ${e.skipped.map(e=>`${e.id} (${e.why})`).join(`; `)}`)}catch(e){p(e.message)}finally{S(!1),T(!1)}}},L=M.secrets.filter(e=>e.token),ie=c===`tokens`?L:M.secrets,ae=(e=M.suggestedTokens[0]||`REPO_TOKEN`)=>I(()=>h({mode:`add`,name:e,value:``,token:!0})),oe=async e=>{S(!0),d(``),p(``);try{let t=await ye.pullAgain(e);a(t.view),t.failed.length?p(`Not pulled: ${t.failed.map(e=>`${e.name} (${e.error})`).join(`; `)}`):d(`Pulled ${e}.`)}catch(e){p(e.message)}finally{S(!1)}},se=async()=>{S(!0),d(``),p(``);try{let e=await ye.pullAgain();a(e.view),d(`Pulled ${e.pulled.length} again from their vaults.`),p(e.failed.length?`Not pulled: ${e.failed.map(e=>`${e.name} (${e.error})`).join(`; `)}`:``)}catch(e){p(e.message)}finally{S(!1)}};return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ln,{label:`Secrets`,current:o,onPick:e=>{s(e),d(``),p(``)},tabs:[{id:`sec-saved`,label:`Saved (${M.secrets.length})`},{id:`sec-vaults`,label:`Vaults (${M.vaults.length})`}]}),u&&(0,$.jsx)(Re,{tone:`info`,className:`mb-4`,children:u}),f&&(0,$.jsx)(`p`,{role:`alert`,className:g(z.fail,`m-0 mb-4`),children:f}),o===`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)(Ne,{value:c,onChange:e=>{l(e),d(``)},items:[{id:`all`,label:`All`,n:M.secrets.length},{id:`tokens`,label:`Repository tokens`,n:L.length+M.neededTokens.length}]})}),(0,$.jsxs)(`span`,{className:`flex flex-wrap gap-2`,children:[te>0&&(0,$.jsxs)(V,{busy:x,size:`sm`,disabled:x,onClick:()=>void se(),children:[(0,$.jsx)(rn,{"aria-hidden":`true`}),x?`Pulling…`:`Pull all again`]}),c===`tokens`?(0,$.jsxs)(V,{size:`sm`,onClick:()=>ae(),children:[(0,$.jsx)(H,{"aria-hidden":`true`}),`Add a token`]}):(0,$.jsxs)(V,{size:`sm`,onClick:()=>I(()=>h({mode:`add`,name:``,value:``})),children:[(0,$.jsx)(H,{"aria-hidden":`true`}),`Add a secret`]})]})]}),(0,$.jsx)(`p`,{className:`m-0 mb-4 text-body-sm text-muted`,children:c===`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.`}),M.neededTokens.map(e=>(0,$.jsx)(Cn,{expandable:!1,open:!1,onToggle:()=>{},lead:(0,$.jsx)(pn,{icon:kt}),title:(0,$.jsx)(`span`,{className:`font-mono`,children:e.name}),meta:`${zs(e.usedBy)}. It has no value here yet.`,state:(0,$.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Not set`}),actions:(0,$.jsx)(V,{size:`sm`,"aria-label":`Add ${e.name}`,onClick:()=>ae(e.name),children:`Add`}),children:null},`needed-${e.name}`)),ie.length===0&&!M.neededTokens.length&&(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft py-6 text-body-sm text-muted`,children:c===`tokens`?`No repository tokens yet. Add one for each git host or account.`:`None yet. Add one, or pull one from a vault.`}),ie.map(e=>(0,$.jsx)(Cn,{expandable:!1,open:!1,onToggle:()=>{},lead:(0,$.jsx)(pn,{icon:e.from===`vault`?dt:e.from===`sign-in`?Qe:e.token?kt:jt}),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 ${$n(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?zs(e.usedBy)||`Not used yet`:``].filter(Boolean).join(` · `),state:e.from===`shell`?(0,$.jsx)(`span`,{className:`text-body-sm text-pass`,children:`Set in the environment`}):e.set?(0,$.jsx)(`span`,{className:`text-body-sm text-pass`,children:`Saved`}):(0,$.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Not set`}),actions:e.pending?(0,$.jsx)(V,{size:`sm`,"aria-label":`Pull ${e.name}`,disabled:x,onClick:()=>void oe(e.name),children:`Pull`}):e.from===`sign-in`||e.from===`shell`?void 0:(0,$.jsx)(V,{size:`sm`,"aria-label":`Edit ${e.name}`,onClick:()=>I(()=>h({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-body-sm text-muted`,children:[`Kept in `,qn(M.store),`. ForgeQE never shows a value again, and the agents see only names.`,c===`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:[M.vaults.length>0&&(0,$.jsxs)(V,{size:`sm`,onClick:()=>void ne(),"data-tip":`A file of the connections, without values, for a teammate to import`,children:[(0,$.jsx)(Ut,{"aria-hidden":`true`}),`Export`]}),(0,$.jsxs)(V,{busy:w,size:`sm`,disabled:x,onClick:()=>C.current?.click(),"data-tip":`Connections a teammate exported`,children:[(0,$.jsx)(Yt,{"aria-hidden":`true`}),w?`Importing…`:`Import`]}),(0,$.jsx)(`input`,{ref:C,type:`file`,accept:`.json,application/json`,hidden:!0,onChange:e=>(re(e.target.files),e.target.value=``)}),(0,$.jsxs)(V,{size:`sm`,onClick:()=>I(()=>v({mode:`add`,v:{id:``,provider:`azure`,where:``,auth:`cli`}})),children:[(0,$.jsx)(H,{"aria-hidden":`true`}),`Add a vault`]})]}),(0,$.jsx)(`p`,{className:`m-0 mb-4 text-body-sm text-muted`,children:`Where ForgeQE pulls secrets from. It reads a value only when you pull that secret.`}),O&&(0,$.jsx)(Gs,{s:O,onCancel:()=>void ye.cancelSignin().then(e=>k(e.signin),()=>{}),onClose:()=>k(null)}),M.vaults.length===0&&(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft py-6 text-body-sm text-muted`,children:`None yet. Add Azure Key Vault, Google Secret Manager or AWS Secrets Manager.`}),M.vaults.map(e=>(0,$.jsx)(Cn,{expandable:!1,open:!1,onToggle:()=>{},lead:(0,$.jsx)(pn,{icon:dt}),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`?A[e.id]===`checking`||!A[e.id]?(0,$.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Checking the sign-in…`}):A[e.id].signedIn?(0,$.jsx)(`span`,{className:`text-body-sm text-pass`,children:`Signed in`}):(0,$.jsx)(`span`,{className:`text-body-sm text-warn`,"data-tip":A[e.id].problem,children:`Not signed in`}):e.missing.length?(0,$.jsx)(`span`,{className:`text-body-sm 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-body-sm text-muted`,children:e.pulled===1?`1 secret pulled`:`${e.pulled} secrets pulled`}),actions:(0,$.jsxs)($.Fragment,{children:[e.auth===`cli`&&A[e.id]!==`checking`&&A[e.id]&&!A[e.id].signedIn?(0,$.jsxs)(V,{size:`sm`,variant:`primary`,"aria-label":`Sign in to ${e.id}`,disabled:O?.state===`running`,onClick:()=>void ee(e.id),children:[(0,$.jsx)(Qe,{"aria-hidden":`true`}),`Sign in`]}):(0,$.jsx)(V,{size:`sm`,"aria-label":`Browse ${e.id}`,disabled:e.missing.length>0||e.auth===`cli`&&A[e.id]===`checking`,onClick:()=>I(()=>b(e)),children:`Browse`}),(0,$.jsx)(V,{size:`sm`,"aria-label":`Edit ${e.id}`,onClick:()=>I(()=>v({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-body-sm 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)(Hs,{panel:m,setPanel:h,busy:x,error:E,onSave:e=>void F(()=>ye.save(e.name,e.value),`${e.mode===`add`?`Added`:`Saved`} ${e.name}.`,()=>h(null)),onRemove:e=>void F(()=>ye.remove(e),`Removed ${e}.`,()=>h(null)),onPull:e=>void F(async()=>{let t=await ye.pullAgain(e);if(t.failed.length)throw Error(t.failed[0].error);return t.view},`Pulled ${e} again.`,()=>h(null)),taken:new Set(M.secrets.map(e=>e.name))}),(0,$.jsx)(Us,{panel:_,setPanel:v,busy:x,error:E,roles:M.keyRoles,taken:new Set(M.vaults.map(e=>e.id)),missing:M.vaults.find(e=>e.id===_?.v.id)?.missing,onSave:e=>void F(()=>ye.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.`:``}`,()=>{v(null),j(t=>{let{[e.v.id]:n,...r}=t;return r})}),onRemove:e=>void F(()=>ye.removeVault(e),`Removed the vault ${e}. The secrets pulled from it stay saved.`,()=>v(null))}),(0,$.jsx)(Ws,{vault:y,onClose:()=>b(null),taken:new Set(M.secrets.map(e=>e.name)),onPulled:(e,t,n)=>{a(e),b(null),s(`sec-saved`),d(`Pulled ${n} as ${t}. Agents and tests can use it by that name.`)}})]})}function Hs({panel:e,setPanel:t,busy:n,error:r,onSave:i,onRemove:o,onPull:s,taken:l}){let u=e?.mode===`add`?Is(e.name,e.token?`GITHUB_TOKEN`:void 0)||(l.has(e.name)?`${e.name} is already in the list: edit it there.`:``)||(e.token&&!Fs.test(e.name)?`A token's name ends in TOKEN or PAT, such as GITHUB_TOKEN.`:``):``,d=e?.row?.from===`vault`,[f,p]=(0,Q.useState)(!1);return(0,Q.useEffect)(()=>p(!1),[!!e]),(0,$.jsx)(Z,{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-body-sm text-fail [overflow-wrap:anywhere]`,children:r}):u?(0,$.jsx)(`span`,{className:`mr-auto self-center text-body-sm text-muted`,children:`Needs a valid name`}):null,e?.mode===`edit`&&(0,$.jsx)(V,{disabled:n,onClick:()=>o(e.name),className:`mr-auto text-fail`,children:`Remove`}),(0,$.jsx)(V,{onClick:()=>t(null),children:`Cancel`}),(0,$.jsx)(V,{busy:n,variant:`primary`,disabled:n||!!u||!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)(J,{label:`Name`,help:u?(0,$.jsx)(`span`,{className:`text-fail`,children:u}):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)(a,{id:`sh-name`,value:e.name,spellCheck:!1,maxLength:64,placeholder:e.token?`GITHUB_TOKEN`:`SHOP_PASSWORD`,"aria-invalid":!!u,onChange:n=>t({...e,name:n.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,`_`)}),className:`font-mono`})}),d&&e.row?.vault&&(0,$.jsx)(J,{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 ${$n(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)(V,{size:`sm`,disabled:n,onClick:()=>s(e.name),children:[(0,$.jsx)(rn,{"aria-hidden":`true`}),`Pull again`]})}),(0,$.jsx)(J,{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)(V,{variant:`link`,size:`inline`,onClick:()=>p(!f),className:`whitespace-normal`,children:f?`One line, hidden`:`Several lines (shown as you type), such as a JSON key`})]}),htmlFor:`sh-value`,className:e.mode===`edit`&&!d?`mt-4`:void 0,stacked:!0,children:f&&!e.token?(0,$.jsx)(c,{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)(a,{id:`sh-value`,type:`password`,autoComplete:`off`,value:e.value,onChange:n=>t({...e,value:n.target.value})})})]})})}function Us({panel:e,setPanel:t,busy:n,error:r,roles:i,taken:o,missing:c,onSave:l,onRemove:u}){let d=e?.v,f=Ls.find(e=>e.id===d?.provider)??Ls[0],p=n=>e&&t({...e,v:{...e.v,...n}}),m=d?.auth===`keys`?Object.entries(i[d.provider]).map(([e,t])=>[e,Is(d.keys?.[e]??t)]).filter(([,e])=>e):[],h=e?.mode===`add`?/^[a-z][a-z0-9-]{0,39}$/.test(d?.id||``)?o.has(d.id)?`A vault is already named ${d.id}.`:``:`Lower case letters, digits and -, such as qa-kv.`:``;return(0,$.jsx)(Z,{open:!!e,onClose:()=>t(null),title:e?.mode===`edit`?`Edit ${d?.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-body-sm text-fail [overflow-wrap:anywhere]`,children:r}):h||m.length?(0,$.jsx)(`span`,{className:`mr-auto self-center text-body-sm text-muted`,children:`Needs a valid name`}):null,e?.mode===`edit`&&(0,$.jsx)(V,{disabled:n,onClick:()=>u(d.id),className:`mr-auto text-fail`,children:`Remove`}),(0,$.jsx)(V,{onClick:()=>t(null),children:`Cancel`}),(0,$.jsx)(V,{busy:n,variant:`primary`,disabled:n||!!h||m.length>0||!d?.where.trim(),onClick:()=>e&&l(e),children:n?`Saving…`:e?.mode===`add`?`Add vault`:`Save vault`})]}),children:e&&d&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{label:`Provider`,htmlFor:`vt-provider`,className:`mt-4`,stacked:!0,children:(0,$.jsx)(s,{id:`vt-provider`,value:d.provider,disabled:e.mode===`edit`,onChange:e=>p({provider:e.target.value,where:``,keys:void 0,profile:void 0}),children:Ls.map(e=>(0,$.jsx)(`option`,{value:e.id,children:e.label},e.id))})}),e.mode===`add`&&(0,$.jsx)(J,{label:`Name`,help:h?(0,$.jsx)(`span`,{className:`text-fail`,children:h}):`What this project calls it.`,htmlFor:`vt-id`,stacked:!0,children:(0,$.jsx)(a,{id:`vt-id`,value:d.id,spellCheck:!1,maxLength:40,placeholder:`qa-kv`,"aria-invalid":!!h,onChange:e=>p({id:e.target.value.toLowerCase().replace(/[^a-z0-9-]/g,`-`)}),className:`font-mono`})}),(0,$.jsx)(J,{label:f.where,help:f.whereHelp,htmlFor:`vt-where`,stacked:!0,children:(0,$.jsx)(a,{id:`vt-where`,value:d.where,spellCheck:!1,maxLength:64,placeholder:f.placeholder,onChange:e=>p({where:e.target.value.trim()}),className:`font-mono`})}),(0,$.jsx)(J,{label:`Sign in with`,help:d.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)(s,{id:`vt-auth`,value:d.auth,onChange:e=>p({auth:e.target.value,keys:e.target.value===`keys`?{...i[d.provider]}:void 0}),children:[(0,$.jsxs)(`option`,{value:`cli`,children:[f.cli,` (recommended)`]}),(0,$.jsx)(`option`,{value:`keys`,children:d.provider===`azure`?`A service principal's keys, saved as secrets (no browser)`:d.provider===`gcp`?`A service account's key, saved as a secret (no browser)`:`Access keys, saved as secrets (no browser)`})]})}),d.provider===`aws`&&d.auth===`cli`&&(0,$.jsx)(J,{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)(a,{id:`vt-profile`,value:d.profile||``,spellCheck:!1,maxLength:64,placeholder:`qa`,onChange:e=>p({profile:e.target.value.trim()||void 0}),className:`font-mono`})}),d.auth===`keys`&&Object.entries(i[d.provider]).map(([e,t])=>(0,$.jsx)(J,{label:Rs[e]||e,help:(()=>{let n=d.keys?.[e]??t,r=Is(n);return r?(0,$.jsx)(`span`,{className:`text-fail`,children:r}):c?.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)(a,{id:`vt-${e}`,"aria-invalid":!!Is(d.keys?.[e]??t),value:d.keys?.[e]??t,spellCheck:!1,maxLength:64,onChange:t=>p({keys:{...d.keys||i[d.provider],[e]:t.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,`_`)}}),className:`font-mono`})},e))]})})}function Ws({vault:e,onClose:t,taken:n,onPulled:r}){let[i,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(``),[l,u]=(0,Q.useState)(``),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(!1),[h,_]=(0,Q.useState)(``),v=()=>{e&&(o(null),c(``),ye.names(e.id).then(o,e=>c(e.message)))};(0,Q.useEffect)(()=>{f(null),u(``),_(``),v()},[e?.id]);let y=(i?.names||[]).filter(e=>e.toLowerCase().includes(l.trim().toLowerCase())),b=y.slice(0,200),x=d?Is(d.name):``,S=async()=>{if(e&&d){m(!0),_(``);try{r(await ye.pull({vault:e.id,secret:d.secret,name:d.name,...d.key.trim()?{key:d.key.trim()}:{}}),d.name,d.secret)}catch(e){_(e.message)}finally{m(!1)}}};return(0,$.jsxs)(Z,{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:[h?(0,$.jsx)(`span`,{role:`alert`,className:`mr-auto self-center text-body-sm text-fail [overflow-wrap:anywhere]`,children:h}):(0,$.jsx)(`span`,{className:`mr-auto self-center text-body-sm text-muted`,children:d?x?`Needs a valid name`:`${d.secret} as ${d.name}`:``}),(0,$.jsx)(V,{onClick:t,children:`Cancel`}),(0,$.jsx)(V,{busy:p,variant:`primary`,disabled:p||!d||!!x,onClick:()=>void S(),children:p?`Pulling…`:`Pull secret`})]}),children:[(0,$.jsxs)(`div`,{"aria-live":`polite`,children:[!i&&!s&&(0,$.jsx)(`p`,{role:`status`,className:`m-0 border-t border-line-soft py-6 text-body-sm text-muted`,children:`Reading the vault's names…`}),s&&(0,$.jsx)(`div`,{className:`mt-4`,children:(0,$.jsx)(sn,{error:s,reload:v})})]}),i&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{label:`Find`,htmlFor:`br-find`,className:`mt-4`,stacked:!0,children:(0,$.jsx)(a,{id:`br-find`,value:l,placeholder:`password`,onChange:e=>u(e.target.value)})}),!y.length&&(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft py-6 text-body-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:b.map(e=>{let t=d?.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)(Zr,{name:`br-secret`,checked:t,onSelect:()=>f({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-body-sm [overflow-wrap:anywhere]`,children:e})]}),t&&d&&(0,$.jsxs)(`div`,{className:g(`panel rounded-md bg-(--page-surface-strong) p-6`,`mb-4 ml-8 flex flex-col gap-4`),children:[(0,$.jsx)(J,{label:`Save as`,help:x?(0,$.jsx)(`span`,{className:`text-fail`,children:x}):n.has(d.name)?`${d.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)(a,{id:`br-name`,value:d.name,spellCheck:!1,maxLength:64,"aria-invalid":!!x,onChange:e=>f({...d,name:e.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,`_`)}),className:`font-mono`})}),(0,$.jsx)(J,{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)(a,{id:`br-key`,value:d.key,spellCheck:!1,maxLength:128,placeholder:`password`,onChange:e=>f({...d,key:e.target.value}),className:`font-mono`})})]})]},e)})}),(y.length>b.length||i.total>i.names.length)&&(0,$.jsx)(`p`,{className:`m-0 pt-4 text-body-sm text-muted`,children:[y.length>b.length?`The first ${b.length} of ${y.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 Gs({s:e,onCancel:t,onClose:n}){let[r,i]=(0,Q.useState)(!1),a=e.state===`running`,o=e.link&&/^https:\/\//.test(e.link)?e.link:void 0;return(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:g(d,`mb-4 flex flex-col gap-4`),children:[(0,$.jsxs)(`span`,{className:`text-body-sm font-medium`,children:[`Signing in to `,e.vault]}),(o||e.code)&&a&&(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-body-sm text-muted`,children:`Your code`}),(0,$.jsx)(`span`,{className:nr,children:e.code}),(0,$.jsxs)(V,{size:`sm`,"aria-label":`Copy the code`,onClick:()=>{navigator.clipboard?.writeText(e.code).then(()=>i(!0)),setTimeout(()=>i(!1),1500)},children:[(0,$.jsx)(ht,{"aria-hidden":`true`}),r?`Copied`:`Copy`]})]}),o&&(0,$.jsxs)(`a`,{href:o,target:`_blank`,rel:`noreferrer noopener`,className:Ae({variant:`primary`,size:`sm`}),children:[(0,$.jsx)(zt,{"aria-hidden":`true`}),`Open `,new URL(o).host]})]}),(0,$.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-body-sm`,children:[e.lines.slice(-6).map((t,n)=>(0,$.jsx)(`li`,{className:g(`[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)),a&&(0,$.jsx)(`li`,{className:`text-muted`,children:`Waiting for you to finish in the browser…`})]}),(0,$.jsx)(`div`,{children:a?(0,$.jsx)(V,{size:`sm`,onClick:t,children:`Cancel`}):(0,$.jsx)(V,{size:`sm`,onClick:n,children:`Close`})})]})}var Ks={testmu:`TestMu AI`,browserstack:`BrowserStack`},qs={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`}}},Js=(...e)=>e.map(([e,t])=>({value:e,label:t})),Ys={testmu:[{key:`type`,label:`Type`,type:`select`,default:`real`,options:Js([`real`,`Real device`],[`virtual`,`Emulator or simulator`])},{key:`platform`,label:`Platform`,type:`select`,default:`android`,options:Js([`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:Js([`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}]},Xs=`Kept in your credential store; the file has only the variable's name. The same sign-in as its browsers.`,Zs={testmu:[{key:`remote.username_env`,label:`TestMu AI user`,help:Xs,type:`var`,default:`LT_USERNAME`},{key:`remote.access_key_env`,label:`TestMu AI key`,help:Xs,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:Xs,type:`var`,default:`BROWSERSTACK_USERNAME`},{key:`remote.access_key_env`,label:`BrowserStack key`,help:Xs,type:`var`,default:`BROWSERSTACK_ACCESS_KEY`}]};function Qs(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 $s({grids:e,setGrids:t,paths:n,vars:r}){return(0,$.jsx)(X,{children:[`testmu`,`browserstack`].map(a=>{let o=Ks[a],s={value:e[a]??qs[a],set:n=>t({...e,[a]:n}),vars:r,file:n[a]};return(0,$.jsxs)(`div`,{children:[(0,$.jsx)(K,{help:(0,$.jsxs)($.Fragment,{children:[`Kept in `,(0,$.jsx)(`code`,{className:`font-mono text-body-sm`,children:n[a]}),`, `,o,`'s own file`,e[a]?``:`, made when you add a device`,`. Its browsers and their devices are in the same file:`,` `,(0,$.jsxs)(`a`,{href:i(`settings`,`integrations`),children:[`Integrations → `,o]}),`.`]}),children:`${o} devices`}),(0,$.jsx)(fr,{edit:s,base:[`mobile`,`devices`],defs:Ys[a],noun:`${o} device`,placeholder:a===`testmu`?`galaxy-s23`:`pixel7`,start:a===`testmu`?{type:`real`,platform:`android`}:{platform:`android`},meta:Qs}),(0,$.jsx)(G,{defs:Zs[a],edit:s,base:[]})]},a)})})}mn.add($s);var ec=(0,Q.lazy)(()=>m(()=>import(`./Features-_WrrIGBz.js`).then(e=>({default:()=>(0,$.jsx)(e.Features,{embedded:!0})})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]))),tc=(0,Q.lazy)(()=>m(()=>import(`./WhatsNew-BMTuBbaX.js`).then(e=>({default:()=>(0,$.jsx)(e.WhatsNew,{embedded:!0})})),__vite__mapDeps([20,1,2,4,5,6,7,8,9,10,11,12,3,13,17,18,15,14,16,19]))),nc=or,rc=[...new Set(nc.map(e=>e.group))],ic=[`setup`,`environments`,`signins`,`secrets`,`integrations`,`notifications`,`appearance`,`voice`,`models`,`databases`,`features`,`whats-new`,`report`,`about`],ac=`forgeqe-settings-more`,oc={config:`forgeqe.yaml`,models:`llms.json`,environments:`the environment files`,guardrails:`guardrails.md`,grids:`the browser grid files`,secrets:`keys and passwords`};function sc(e,t){let n=e.paths.base.replace(/(?<![\\/])[\\/]+$/,``);return t.startsWith(`${n}/`)||t.startsWith(`${n}\\`)?`./${t.slice(n.length+1).replace(/\\/g,`/`)}`:t}function cc(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 lc={local:`This computer`,browserstack:`BrowserStack`,testmu:`TestMu AI`};function uc(e){let t=lc[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 dc=[{id:`setup`,label:`Set up`},{id:`models`,label:`Models`},{id:`evidence`,label:`Product knowledge`},{id:`appearance`,label:`Appearance`}],fc=e=>dc.find(t=>t.id===e)?.id??`setup`;function pc(){let[e,t]=(0,Q.useState)(null),[n,r]=(0,Q.useState)(null),[i,a]=(0,Q.useState)(``),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(null),_=(0,Q.useCallback)(()=>{a(``),be.settings().then(e=>{t(e),r(cc(e))},e=>a(e.message))},[]),v=(0,Q.useCallback)(()=>{a(``),De.state().then(e=>{h(e),e.ready&&_()},e=>a(e.message))},[_]);(0,Q.useEffect)(v,[v]);let y=e=>{e.project===m?.project&&e.ready||(t(null),r(null)),h(e),e.ready&&_()},b=!!m?.ready,x=e?cc(e):null,S=e=>!!n&&!!x&&!xn(n[e],x[e]),C=Object.keys(oc).filter(S);(0,Q.useEffect)(()=>{if(!C.length)return;let e=e=>e.preventDefault();return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[C.length]);let w=t=>({value:n[t],set:e=>{l(``),r(n=>({...n,[t]:e}))},vars:e.variables,...t===`config`?{file:`forgeqe.yaml`}:{}}),T=(0,Q.useRef)(n);T.current=n;let E=(0,Q.useRef)(e);E.current=e;let[D,O]=(0,Q.useState)(``),k=(0,Q.useRef)({}),A=(0,Q.useCallback)((e,t)=>{let n=k.current,r=Object.keys(n).find(t=>n[t]===e)??e;r===t?delete n[r]:n[r]=t},[]),j=(0,Q.useCallback)(async()=>{let e=T.current,n=E.current;if(!e||!n)return!0;let i=cc(n),a=Object.keys(oc).filter(t=>!xn(e[t],i[t]));if(!a.length)return!0;d(!0),s(``),p(!1);let o=n,c=(t,n)=>r(r=>{if(!r)return r;let i=cc(t),a={...r};for(let t of Object.keys(oc))if(t===`secrets`){if(!n)continue;a.secrets=Object.fromEntries(Object.entries(r.secrets).filter(([t,n])=>e.secrets[t]!==n))}else(n?xn(r[t],e[t]):xn(r[t],i[t]))&&(a[t]=i[t]);return a});try{for(let t of a)if(t===`secrets`)o=await be.saveSecrets(e.secrets);else if(t===`grids`)for(let[t,r]of Object.entries(e.grids))r&&!xn(r,i.grids[t])&&(o=await be.saveGrid(t,r,n.versions[`grid:${t}`]));else if(t===`models`){let r=i.models.models,a=e.models.models,s=Object.fromEntries(Object.entries(k.current).filter(([e,t])=>r&&a&&e in r&&!(e in a)&&t in a));o=await be.save(t,e[t],n.versions[t],s),k.current={}}else o=t===`guardrails`?await be.saveGuardrails(e.guardrails,n.versions.guardrails):await be.save(t,e[t],n.versions[t]);return t(o),c(o,!0),O(``),l(`Saved`),!0}catch(r){return s(r.message),p(r instanceof Ee&&r.status===409),O(JSON.stringify(e)),o!==n&&(t(o),c(o,!1)),!1}finally{d(!1)}},[]);(0,Q.useEffect)(()=>{if(!c)return;let e=setTimeout(()=>l(``),4e3);return()=>clearTimeout(e)},[c]);let M=n?JSON.stringify(n):``;return(0,Q.useEffect)(()=>{if(!C.length||u||f||D&&D===M)return;let e=C.every(e=>e===`secrets`),t=setTimeout(j,e?2e3:1e3);return()=>clearTimeout(t)},[M,u,f,D]),{snap:e,setSnap:t,drafts:n,setDrafts:r,loadError:i,saveError:o,saved:c,setSaved:l,saving:u,conflict:f,setup:m,ready:b,load:v,loadSettings:_,onSetup:y,base:x,dirty:S,dirtyFiles:C,edit:w,onRename:A,split:async()=>{s(``);try{let e=await be.splitEnvironments();t(e),r(cc(e)),l(`Each environment is now its own file in environments/. The old file is left as it is; ForgeQE no longer reads it.`)}catch(e){s(e.message)}},saveText:async(n,i,a)=>{s(``);try{let o=await be.saveText(n,i,a,e?.versions[n]);return t(o),r(cc(o)),l(`Saved ${oc[n]}.`),!0}catch(e){return s(e.message),!1}},errorBox:o?(0,$.jsxs)(`div`,{role:`alert`,className:g(z.fail,`flex w-full flex-wrap items-center gap-4 leading-relaxed`),children:[(0,$.jsx)(`span`,{className:`flex-[1_1_260px] [overflow-wrap:anywhere]`,children:o}),f?(0,$.jsxs)(V,{size:`sm`,onClick:()=>{p(!1),s(``),O(``),v()},"data-tip":`Reload, and lose my unsaved changes`,children:[(0,$.jsx)(rn,{"aria-hidden":`true`}),`Reload`]}):(0,$.jsxs)(`span`,{className:`flex gap-2`,children:[C.length>0&&(0,$.jsxs)(V,{size:`sm`,onClick:()=>{r(x),k.current={},s(``),O(``)},"data-tip":`Undo my change`,children:[(0,$.jsx)(Be,{"aria-hidden":`true`}),`Undo`]}),(0,$.jsxs)(V,{size:`sm`,onClick:()=>{s(``),O(``),j()},children:[(0,$.jsx)(Je,{"aria-hidden":`true`}),`Retry`]})]})]}):null,secrets:{pending:n?.secrets||{},set:(e,t)=>{l(``),r(n=>{let r={...n.secrets};return t===void 0?delete r[e]:r[e]=t,{...n,secrets:r}})},saved:new Set(e?.saved||[]),vars:e?.variables||{},store:e?.store||`the credential store`},resetNotes:(0,Q.useCallback)(()=>{l(``),s(``),p(!1)},[]),save:j}}function mc({id:e,store:t,guide:n=!1,section:r}){let{snap:a,drafts:o,setDrafts:s,setSaved:c,setup:l,onSetup:u,edit:d,dirty:f,loadSettings:p,onRename:m,split:h,saveText:_}=t,v=t.setSnap,y={id:e},b=n?`setup`:void 0,x=null;if(y.id===`setup`)x=l&&(0,$.jsx)(eo,{state:l,onState:u,guide:b!==void 0});else if(a&&o){let e=(y.id===`models`||y.id===`routing`?[`models`,`config`]:y.id===`environments`?[`environments`,`config`]:[`files`,`guardrails`,`prompts`,`logs`,`audit`,`generated`,`about`,`report`,`features`,`whats-new`].includes(y.id)?[]:[`config`]).find(e=>a.errors[e]);switch(y.id){case`models`:x=(0,$.jsx)(Yi,{config:d(`config`),models:d(`models`),vars:a.variables,onReload:p,onRename:m});break;case`environments`:x=(0,$.jsx)(Di,{envs:d(`environments`),layout:a.paths.environments,files:a.raw.environments,base:a.paths.base,onSplit:h,config:d(`config`),splitBlocked:f(`environments`)||f(`config`)?`Save or discard your changes to the environments and forgeqe.yaml first.`:``});break;case`browser`:x=(0,$.jsx)(hr,{groups:Dr,edit:d(`config`)});break;case`appearance`:x=(0,$.jsx)($o,{config:d(`config`)});break;case`voice`:x=(0,$.jsx)(is,{});break;case`observability`:x=(0,$.jsx)(ds,{});break;case`routing`:x=(0,$.jsx)(na,{config:d(`config`),models:d(`models`)});break;case`generated`:x=(0,$.jsx)(_o,{});break;case`about`:x=(0,$.jsx)(mo,{});break;case`features`:case`whats-new`:x=(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Opening…`}),children:y.id===`features`?(0,$.jsx)(ec,{}):(0,$.jsx)(tc,{})});break;case`report`:x=(0,$.jsx)(wo,{});break;case`notifications`:case`mcp`:x=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ya,{view:y.id,edit:d(`config`),grids:o.grids,setGrids:e=>s(t=>({...t,grids:e})),gridPaths:{browserstack:sc(a,a.grids.browserstack.file),testmu:sc(a,a.grids.testmu.file)}}),y.id===`notifications`&&(0,$.jsx)(ho,{})]});break;case`parallel`:x=(0,$.jsx)(hr,{groups:Or,edit:d(`config`)});break;case`mobile`:x=(0,$.jsxs)(X,{children:[(0,$.jsx)(hr,{groups:Er,edit:d(`config`)}),(0,$.jsx)(K,{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)(fr,{edit:d(`config`),base:[`mobile`,`devices`],defs:Ar,noun:`device`,placeholder:`pixel8`,start:{type:`virtual`,platform:`android`},meta:uc}),(0,$.jsx)($s,{grids:o.grids,setGrids:e=>{c(``),s(t=>({...t,grids:e}))},paths:{browserstack:sc(a,a.grids.browserstack.file),testmu:sc(a,a.grids.testmu.file)},vars:a.variables}),(0,$.jsx)(hr,{groups:Wr,edit:d(`config`),continued:!0})]});break;case`desktop`:x=(0,$.jsx)(hr,{groups:Ur,edit:d(`config`)});break;case`containers`:x=(0,$.jsxs)(X,{children:[(0,$.jsx)(hr,{groups:kr.slice(0,1),edit:d(`config`)}),(0,$.jsx)(K,{help:`Each one ForgeQE may start, stop and read: a database, a queue, the API under test.`,children:`Services`}),(0,$.jsx)(fr,{edit:d(`config`),base:[`containers`,`services`],defs:Gr,noun:`service`,placeholder:`db`,meta:e=>[e.image,Array.isArray(e.ports)?`ports ${e.ports.join(`, `)}`:``].filter(Boolean).map(String).join(`, `)}),(0,$.jsx)(hr,{groups:kr.slice(1),edit:d(`config`),continued:!0})]});break;case`databases`:x=(0,$.jsxs)(kn,{children:[(0,$.jsx)(K,{first:!0,icon:Ct,help:`What the agents may query. Read only unless one is marked writable.`,children:`Databases`}),(0,$.jsx)(fr,{edit:d(`config`),base:[`databases`],defs:Fr,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`:x=(0,$.jsx)(xr,{edit:d(`config`)});break;case`secrets`:x=(0,$.jsx)(Vs,{show:r===`repo-tokens`?`tokens`:void 0});break;case`integrations`:x=(0,$.jsx)(ya,{edit:d(`config`),grids:o.grids,setGrids:e=>{c(``),s(t=>({...t,grids:e}))},gridPaths:{browserstack:sc(a,a.grids.browserstack.file),testmu:sc(a,a.grids.testmu.file)}});break;case`tests`:x=(0,$.jsx)(hr,{groups:Vr,edit:d(`config`)});break;case`runs`:x=(0,$.jsxs)(X,{children:[(0,$.jsx)(hr,{groups:wr,edit:d(`config`)}),(0,$.jsx)(hr,{groups:Br,edit:d(`config`),continued:!0}),(0,$.jsx)(K,{help:`Each one a table of the project report: forgeqe.<name>.`,children:`Report datasets`}),(0,$.jsx)(fr,{edit:d(`config`),base:[`bi`,`datasets`],defs:Pr,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`:x=(0,$.jsx)(hr,{groups:Kr,edit:d(`config`)});break;case`evidence`:x=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Cs,{edit:d(`config`)}),(0,$.jsx)(go,{})]});break;case`agents`:x=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(hr,{groups:Lr,edit:d(`config`)}),(0,$.jsx)(To,{config:d(`config`)})]});break;case`guardrails`:x=(0,$.jsx)(ka,{rules:o.guardrails,others:a.guardrails.filter(e=>!e.editable),onChange:e=>s({...o,guardrails:e}),onChanged:e=>(c(e),be.settings().then(v,()=>{}))});break;case`monitor`:x=(0,$.jsx)(Ea,{edit:d(`config`)});break;case`skills`:x=(0,$.jsx)(di,{edit:d(`config`)});break;case`prompts`:x=(0,$.jsx)(ci,{onChanged:c});break;case`registry`:x=(0,$.jsx)(gn,{edit:d(`config`)});break;case`logs`:x=(0,$.jsx)(Bn,{});break;case`audit`:x=(0,$.jsx)(yn,{});break;case`tokenomics`:x=(0,$.jsx)(dn,{edit:d(`config`)});break;case`files`:x=(0,$.jsx)(gr,{snap:a,dirty:{config:f(`config`),models:f(`models`),environments:f(`environments`)},onSave:_})}e&&(x=(0,$.jsxs)(`p`,{role:`alert`,className:g(z.fail,`m-0 leading-relaxed`),children:[e===`environments`?`An environment file`:oc[e],` does not parse, so the form cannot show it: `,a.errors[e],`. Fix it in `,(0,$.jsx)(`a`,{href:i(`settings`,`files`),children:`Settings as text`}),`.`]}))}return(0,$.jsx)($.Fragment,{children:x})}function hc({store:e,className:t}){let{errorBox:n,saveError:r,dirtyFiles:i,saving:a,saved:o}=e;return(0,$.jsxs)(`div`,{className:g(`sticky bottom-4 z-10 flex flex-col items-end gap-2`,t),children:[n,(0,$.jsx)(`div`,{"aria-live":`polite`,className:`contents`,children:!r&&(i.length>0||a||o)&&(0,$.jsx)(`span`,{className:g(`rounded-md border border-overlay-line bg-overlay p-2 text-ink shadow-menu backdrop-blur-[16px]`,`inline-flex items-center gap-2 text-body-sm`,i.length||a?`text-ink-2`:`text-pass`),children:i.length||a?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ze,{state:`working`,px:16}),`Saving…`]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Jt,{size:14,"aria-hidden":`true`}),o]})})})]})}function gc({section:e,only:t,guide:n}){let r=n===void 0?void 0:fc(n),a=r??t??e,{theme:o}=re(),c=pc(),{snap:l,drafts:u,loadError:d,setup:f,ready:p,load:m,secrets:h,resetNotes:_}=c,[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(``),D=(0,Q.useCallback)(async()=>{if(!(await De.state()).ready)return!1;let e=await De.machine();return e.engine&&e.runtime},[]);(0,Q.useEffect)(()=>{r!==void 0&&_e.status().then(e=>{y(e.state),x(!0)},()=>x(!0))},[r]),(0,Q.useEffect)(()=>{r!==void 0&&D().then(C,()=>C(!1))},[r,f,D]),(0,Q.useEffect)(()=>E(``),[r]),(0,Q.useEffect)(()=>{if(r!==`setup`||S)return;let e=hn(()=>void D().then(C,()=>{}),2500);return()=>fn(e)},[r,S,D]);let O=async(e,t)=>{E(``);try{if(e===`done`){await _e.save({done:!0,step:`done`,...t?{skip:t}:{}}),location.hash=i();return}let n=await _e.save({step:e,...t?{skip:t}:{}});y(n.state),location.hash=i(`welcome`,e)}catch(e){E(e.message)}},k=async()=>{if(await D().catch(()=>!1))return O(`done`);r!==`setup`&&(location.hash=i(`welcome`,`setup`)),E(`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?f&&!p&&a!==`setup`?location.replace(i(`settings`,`setup`)):!t&&a&&ue.includes(a)?location.replace(i(a)):!t&&a&&Sr(a)&&sr(a,!0):r!==`setup`&&f&&!p&&location.replace(i(`welcome`,`setup`))},[f,p,a]);let A=(f&&!p?de[0]:de.find(e=>e.id===(a===`repo-tokens`?`secrets`:a)))||de.find(e=>e.id===`models`),[j,M]=(0,Q.useState)(()=>{try{return localStorage.getItem(ac)===`open`}catch{return!1}}),N=e=>{M(e);try{localStorage.setItem(ac,e?`open`:`closed`)}catch{}};(0,Q.useEffect)(_,[A.id,_]);let P=f&&(A.id===`setup`||l&&u)?(0,$.jsx)(mc,{id:A.id,store:c,guide:r!==void 0,section:a}):null;return(0,$.jsx)(Xn.Provider,{value:h,children:(0,$.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col bg-canvas`,children:[(0,$.jsx)(Jn,{}),(0,$.jsxs)(`main`,{className:g(`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:g(`theme-side theme-side--wide w-full flex-col gap-4 px-4 pt-6 pb-4 sm:sticky sm:top-0 sm:h-(--screen) sm:w-[248px] sm:flex-none sm:overflow-y-auto`,t?`hidden`:`flex`),children:r===void 0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Le,{href:i(),label:o.name||`ForgeQE`,className:`px-2`}),(0,$.jsx)(`p`,{className:`m-0 px-2 pt-1 text-body-lg font-medium`,children:`Settings`}),(0,$.jsx)(xc,{ready:p}),(0,$.jsx)(`label`,{htmlFor:`section-pick`,className:`sr-only`,children:`Section`}),(0,$.jsx)(s,{id:`section-pick`,value:A.id,onChange:e=>location.hash=i(`settings`,e.target.value),className:`sm:hidden`,children:rc.map(e=>(0,$.jsx)(`optgroup`,{label:e,children:nc.filter(t=>t.group===e).map(e=>(0,$.jsx)(`option`,{value:e.id,disabled:!p&&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)(yc,{sections:nc.filter(e=>ic.includes(e.id)),current:A.id,locked:!!f&&!p}),(0,$.jsx)(bc,{open:j||!ic.includes(A.id),onToggle:()=>N(!j),children:(0,$.jsx)(yc,{sections:nc.filter(e=>!ic.includes(e.id)),current:A.id,locked:!!f&&!p})})]})]}):(0,$.jsx)(vc,{step:r,skipped:v?.skipped??[],open:S,onSkip:()=>void k()})}),(0,$.jsxs)(`section`,{"aria-labelledby":`sec-h`,className:g(`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)($.Fragment,{children:[(0,$.jsx)(Fe,{className:`mb-4`}),(0,$.jsxs)(`div`,{className:`mb-1 flex items-center gap-4`,children:[(0,$.jsx)(pn,{icon:A.icon,pixel:w[A.id],size:`lg`}),(0,$.jsx)(`h1`,{id:`sec-h`,className:`m-0 font-home text-headline-lg`,children:A.label})]})]}):(0,$.jsxs)(`h1`,{id:`sec-h`,className:`m-0 mb-2 flex items-center gap-4 font-home text-headline-lg`,children:[(0,$.jsx)(Me,{icon:A.icon,size:22,className:`flex-none text-icon`}),A.label]}),(0,$.jsxs)(`p`,{className:`mt-0 mb-8 text-body-sm leading-relaxed text-ink-2`,children:[A.intro,A.file&&l&&(0,$.jsxs)($.Fragment,{children:[` `,`Saved in `,(0,$.jsx)(`span`,{className:`font-mono text-body-sm`,children:A.file}),`.`]})]}),d&&(0,$.jsxs)(`div`,{role:`alert`,className:g(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex flex-col items-start gap-4 p-6`),children:[(0,$.jsx)(`p`,{className:`m-0 leading-relaxed text-ink-2`,children:d}),(0,$.jsxs)(V,{size:`sm`,onClick:m,children:[(0,$.jsx)(Je,{"aria-hidden":`true`}),`Retry`]})]}),f&&!p&&(0,$.jsxs)(`p`,{className:g(z.info,`mt-0 mb-6 flex items-start gap-2 leading-relaxed`),children:[(0,$.jsx)(jt,{size:16,"aria-hidden":`true`,className:`mt-1 flex-none text-icon`}),`The other sections open once ForgeQE is set up in a project folder: choose the folder, then Set up.`]}),!d&&(!f||A.id!==`setup`&&!l)&&(0,$.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading settings…`}),(0,$.jsx)(`div`,{"data-tour":`section`,className:`settings-body flex flex-col gap-6`,children:P}),r!==void 0&&f&&b&&(0,$.jsx)(Ka,{welcome:v===null||Ua(),onStart:_c,step:r,ready:p,coreReady:S,onGo:(e,t)=>void O(e,t),onSkipAll:()=>void k(),onFinish:()=>void O(`done`),note:T},r),(0,$.jsx)(hc,{store:c,className:`mt-8`})]})]})]})})}var _c=()=>{Wa(),_e.save({step:`setup`}).catch(()=>{})};function vc({step:e,skipped:t,open:n,onSkip:r}){let a=dc.findIndex(t=>t.id===e);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`m-0 px-2 pt-1 text-body-lg font-medium`,children:`Getting started`}),(0,$.jsx)(`p`,{className:`m-0 px-2 text-body-sm 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:dc.map((r,s)=>{let c=de.find(e=>e.id===r.id),l=s>0&&!n,u=r.id===e,d=s<a&&!t.includes(r.id);return(0,$.jsx)(`li`,{children:l?(0,$.jsxs)(`span`,{"aria-disabled":`true`,"data-tip":`After Set up`,className:`flex min-h-8 cursor-not-allowed items-center gap-2 rounded-sm px-2 text-body-sm text-muted opacity-60`,children:[(0,$.jsx)(Me,{icon:c.icon,size:16,className:`flex-none`}),(0,$.jsx)(`span`,{className:`flex-1`,children:r.label}),(0,$.jsx)(jt,{size:13,"aria-label":`Locked`,className:`flex-none`})]}):(0,$.jsxs)(`a`,{href:i(`welcome`,r.id),"aria-current":u?`step`:void 0,className:g(o,`group min-h-8 gap-2 px-2 py-0`,u?`font-medium`:`text-ink-2`),children:[(0,$.jsx)(Me,{icon:c.icon,size:16,className:g(`flex-none`,u?`text-ink`:`text-muted group-hover:text-ink`)}),(0,$.jsx)(`span`,{className:`flex-1`,children:r.label}),d&&(0,$.jsx)(Jt,{size:13,"aria-label":`Done`,className:`flex-none text-pass`}),t.includes(r.id)&&!u&&(0,$.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Skipped`})]})},r.id)})})}),(0,$.jsxs)(V,{variant:`ghost`,size:`sm`,className:`self-start`,type:`button`,onClick:r,children:[(0,$.jsx)(U,{size:14,"aria-hidden":`true`}),`Skip onboarding`]})]})}function yc({sections:e,current:t,locked:n}){let r=[...new Set(e.map(e=>e.group))];return(0,$.jsx)($.Fragment,{children:r.map(r=>{let a=`group-${r}-${e[0]?.id}`;return(0,$.jsxs)(`div`,{role:`group`,"aria-labelledby":a,className:`flex flex-col gap-px`,children:[(0,$.jsx)(`span`,{id:a,className:`px-2 pt-1 pb-1 text-body-sm 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:g(Yn,`cursor-not-allowed text-muted opacity-60`),children:[(0,$.jsx)(Me,{icon:e.icon,size:16,className:`flex-none`}),(0,$.jsx)(`span`,{className:`flex-1`,children:e.label}),(0,$.jsx)(jt,{size:13,"aria-label":`Locked`,className:`flex-none`})]},e.id):(0,$.jsxs)(`a`,{href:i(`settings`,e.id),"aria-current":t===e.id?`page`:void 0,className:g(Yn,Mn(t===e.id)),children:[(0,$.jsx)(Me,{icon:e.icon,size:16,className:`flex-none text-icon`}),e.label]},e.id))]},r)})})}function bc({open:e,onToggle:t,children:n}){return(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 pt-2`,children:[(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":e,"aria-controls":`settings-more`,onClick:t,className:g(o,`min-h-7 gap-1 px-2 py-0 font-medium text-muted`),children:[(0,$.jsx)(`span`,{className:`flex-1`,children:`More settings`}),(0,$.jsx)(it,{size:14,strokeWidth:2,"aria-hidden":`true`,className:g(`flex-none transition-transform duration-200`,e&&`rotate-90`)})]}),(0,$.jsx)(Dn,{open:e,id:`settings-more`,children:(0,$.jsx)(`div`,{className:`flex flex-col gap-4`,children:n})})]})}function xc({ready:e}){let[t,n]=(0,Q.useState)(``),r=t.toLowerCase().split(/\s+/).filter(Boolean),o=e=>de.find(t=>t.id===e)?.label||e,s=r.length?Hr.filter(e=>r.every(t=>`${e.label} ${e.key} ${o(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)(a,{size:`sm`,id:`find-setting`,type:`search`,value:t,disabled:!e,placeholder:`Search settings`,"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:[s.length===0&&(0,$.jsx)(`li`,{className:`px-2 py-2 text-body-sm text-muted`,children:`Nothing called that. Every key can also be edited in Settings as text.`}),s.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`a`,{href:Sr(e.section)?ur(e.section):i(`settings`,e.section),onClick:t=>{n(``),Sr(e.section)&&(t.preventDefault(),sr(e.section))},className:g(`flex w-full min-h-11 cursor-pointer items-center gap-4 rounded-base border-0 bg-transparent px-4 py-2 text-left text-body-sm text-ink no-underline transition-colors duration-150 hover:bg-tint hover:text-ink aria-[current]:bg-tint-hover aria-selected:bg-tint-hover aria-pressed:bg-tint-hover aria-checked:bg-tint-hover has-[:checked]:bg-tint-hover disabled:cursor-not-allowed disabled:opacity-50`,`min-h-0 flex-col items-start gap-0 px-2`),children:[(0,$.jsx)(`span`,{className:`text-body-sm`,children:e.label}),(0,$.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[o(e.section),Sr(e.section)?`, on ${cr(e.section)}`:``,` · `,(0,$.jsx)(`code`,{className:`font-mono text-body-sm`,children:e.key})]})]})},`${e.section}:${e.key}`))]})]})}export{ic as COMMON_SECTIONS,dc as GUIDE_STEPS,de as SECTIONS,ue as SIDEBAR_SECTIONS,hc as SaveNotes,mc as SectionBody,gc as Settings,ci as i,ta as n,di as r,ka as t,pc as useSettingsStore};
|
|
21
|
+
`):`Starting…`})})]}),n&&(0,$.jsx)(es,{ok:!1,children:n}),f?.ready&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{label:`Voice`,help:`An open voice that runs on this computer.`,children:(0,$.jsx)(`span`,{className:`text-body-sm text-ink-2`,children:`Ready`})}),(0,$.jsx)(J,{label:`Listening`,help:`Writes down what you say, on this computer.`,children:(0,$.jsx)(`span`,{className:`text-body-sm text-ink-2`,children:f.hearing?.model??`None`})})]}),(0,$.jsx)(K,{help:`How Talk takes turns with you. Yours alone: kept in this browser.`,children:`Conversation`}),(0,$.jsx)(J,{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)(ts,{label:`How long it waits for you`,value:i,options:ns,onPick:e=>(a(e),Qn(e))})})]})}function as({text:e}){return(0,$.jsx)(`p`,{role:`alert`,className:g(z.fail,`m-0`),children:e})}function os({text:e}){return(0,$.jsx)(`p`,{role:`status`,className:g(z.pass,`m-0`),children:e})}var ss=[{id:`metrics`,label:`Metrics`},{id:`traces`,label:`Spans too`},{id:`traces+errors`,label:`Errors too`}],cs={metrics:`Counts, durations, tokens and cost, every minute and at the end of a session. No spans.`,traces:`Also a trace for each session: its turns, runs, model calls and tool calls, with their durations.`,"traces+errors":`Also, on an error, its kind (such as timeout or not reachable), never its message.`},ls=e=>{let t=e.settings,n=t?.headers[0];return{endpoint:t?.endpoint??``,header:n?.name??`Authorization`,variable:n?.variable??``,level:t?.level??`traces`,service:t?.service??`forgeqe`,only:!!t&&t.projects!==`all`,protocol:t?.protocol??`json`,logs:t?.logs??!1}},us=e=>e?new Date(e).toLocaleString():``;function ds(){let[e,t]=(0,Q.useState)(null),[n,r]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(``),_=e=>{t(e),r(ls(e))};(0,Q.useEffect)(()=>{Te.view().then(_,e=>s(e.message))},[]);let v=async(e,t)=>{s(``),l(``),d(e);try{let e=await t();return typeof e==`string`?l(e):_(e),!0}catch(e){return s(e.message),!1}finally{d(``)}};if(!e||!n)return o?(0,$.jsx)(as,{text:o}):(0,$.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Loading…`});let y=e.settings,b=!!y?.approved&&y.approved.host===y.host,x=y?y.headers.slice(1):[],S=ls(e),C=JSON.stringify(n)!==JSON.stringify(S),w=e=>r({...n,...e}),T=y?y.enabled&&b?e.exports?(0,$.jsx)(B,{tone:`pass`,children:`On`}):(0,$.jsx)(B,{tone:`warn`,children:`Not sending`}):b?(0,$.jsx)(B,{tone:`neutral`,children:`Off`}):(0,$.jsx)(B,{tone:`warn`,children:`Not turned on`}):(0,$.jsx)(B,{tone:`neutral`,children:`Not set up`}),E=e.status,D=()=>v(`save`,async()=>{let t=await Te.save({endpoint:n.endpoint,headers:[...n.variable.trim()?[{name:n.header.trim(),variable:n.variable.trim()}]:[],...x.map(e=>({name:e.name,variable:e.variable}))],level:n.level,service:n.service,projects:n.only?[e.project]:`all`,protocol:n.protocol,logs:n.logs});return l(t.settings?.enabled?`Saved.`:`Saved. Nothing is sent until you turn it on.`),t}).then(()=>void 0);return(0,$.jsxs)(X,{children:[(0,$.jsx)(K,{first:!0,icon:an,help:`Kept on this computer, in ForgeQE's folder. A project cannot turn it on or change where it sends.`,children:`The export`}),e.problem&&(0,$.jsx)(as,{text:e.problem}),(0,$.jsx)(J,{label:`Status`,help:y?.enabled&&b?e.exports?`Sending to ${y.host}.`:e.why:y?b?`Turned off: nothing is sent.`:`Nothing is sent until you turn it on for ${y.host}.`:`Give a collector's address below and save, then turn it on.`,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 sm:justify-end`,children:[T,y&&e.exports&&(0,$.jsxs)(V,{busy:u===`test`,size:`sm`,disabled:!!u,onClick:()=>void v(`test`,async()=>{let e=await Te.test();if(!e.ok)throw Error(`Not sent: ${e.problem}.`);return`A test span reached ${y.host}.`}),"data-tip":`Send one span named forgeqe.telemetry.test now`,children:[(0,$.jsx)(gt,{"aria-hidden":`true`}),u===`test`?`Sending…`:`Send a test span`]}),y&&y.enabled&&b?(0,$.jsxs)(V,{size:`sm`,disabled:!!u,onClick:()=>void v(`off`,async()=>{let e=await Te.off();return l(`Turned off. Nothing is sent from now on.`),e}),"data-tip":`Stop sending; the settings stay`,children:[(0,$.jsx)(Ot,{"aria-hidden":`true`}),`Turn off`]}):y&&(0,$.jsxs)(V,{size:`sm`,variant:`primary`,disabled:!!u||C,onClick:()=>(h(``),p(`on`)),"data-tip":C?`Save your changes first`:`See what would be sent, then type the host to turn it on`,children:[(0,$.jsx)(st,{"aria-hidden":`true`}),`Turn on…`]})]})}),(0,$.jsx)(J,{label:`This project`,help:e.exports?`Its sessions are sent, grouped by this id: a salted fingerprint of its folder, never its name or path.`:`Its id in the export: a salted fingerprint of its folder, never its name or path.`,children:(0,$.jsx)(`code`,{className:`font-mono text-body-sm text-ink-2`,children:e.project})}),E&&(0,$.jsx)(J,{label:`Last result`,help:E.problem?`${E.problem}${E.failingSince?`, since ${us(E.failingSince)}`:``}.`:void 0,children:(0,$.jsxs)(`span`,{className:`text-body-sm text-ink-2`,children:[E.lastSent?`Sent ${us(E.lastSent)}`:`Nothing sent yet`,`: `,E.sent,` spans, `,E.points??0,` metric points, `,E.logs??0,` log records`,E.dropped+(E.pointsDropped??0)+(E.logsDropped??0)?`, ${E.dropped+(E.pointsDropped??0)+(E.logsDropped??0)} dropped`:``]})}),o&&(0,$.jsx)(as,{text:o}),c&&(0,$.jsx)(os,{text:c}),(0,$.jsx)(K,{icon:_t,help:`Your OpenTelemetry collector's OTLP/HTTP address: Grafana, Datadog, Honeycomb, Jaeger, Azure Monitor and others take it.`,children:`Collector`}),(0,$.jsx)(J,{label:`Address`,htmlFor:`otel-endpoint`,help:`https, or http only for a collector on this computer. A new host must be turned on again.`,children:(0,$.jsx)(a,{id:`otel-endpoint`,className:`w-full sm:w-[360px]`,value:n.endpoint,placeholder:`https://otel.example.com:4318`,spellCheck:!1,autoComplete:`off`,onChange:e=>w({endpoint:e.target.value})})}),(0,$.jsx)(J,{label:`Token header`,htmlFor:`otel-variable`,help:(0,$.jsxs)($.Fragment,{children:[`The header and the name of the secret it sends, such as OTEL_COLLECTOR_TOKEN. Save its value in `,(0,$.jsx)(`a`,{href:i(`settings`,`secrets`),children:`Secrets`}),`; it never comes to this page.`,y?.headers[0]&&!y.headers[0].set&&y.headers[0].variable===n.variable.trim()&&(0,$.jsxs)(`span`,{className:`text-warn`,children:[` `,y.headers[0].variable,` has no value saved yet.`]}),x.length>0&&` ${x.length} more ${x.length===1?`header`:`headers`} set with forgeqe telemetry set ${x.length===1?`is`:`are`} kept.`]}),children:(0,$.jsxs)(`div`,{className:`flex w-full flex-col gap-2 sm:items-end`,children:[(0,$.jsx)(a,{"aria-label":`Header name`,className:`w-full sm:w-[200px]`,value:n.header,spellCheck:!1,autoComplete:`off`,onChange:e=>w({header:e.target.value})}),(0,$.jsx)(a,{id:`otel-variable`,className:`w-full sm:w-[200px]`,value:n.variable,placeholder:`OTEL_COLLECTOR_TOKEN`,spellCheck:!1,autoComplete:`off`,onChange:e=>w({variable:e.target.value})})]})}),(0,$.jsx)(J,{label:`What to send`,help:cs[n.level],children:(0,$.jsx)(`div`,{className:`flex w-full flex-wrap items-center gap-2 sm:justify-end`,children:(0,$.jsx)(Pn,{label:`What to send`,value:n.level,onChange:e=>w({level:e}),options:ss})})}),(0,$.jsx)(J,{label:`Problems as log records`,help:n.logs?`Errors and warnings (a failed turn, a failed tool call, a failed run) go to /v1/logs: a severity and the event's kind, tied to the session's trace. Never their text.`:`Off: problems are counted in the metrics and marked on the spans only.`,children:(0,$.jsx)(Hn,{checked:n.logs,onChange:e=>w({logs:e}),label:`Send problems as log records`})}),(0,$.jsx)(J,{label:`Format`,help:n.protocol===`protobuf`?`OTLP protobuf (application/x-protobuf), for a collector that takes only that. The sample below shows it as JSON.`:`OTLP JSON, which every collector takes.`,children:(0,$.jsx)(`div`,{className:`flex w-full flex-wrap items-center gap-2 sm:justify-end`,children:(0,$.jsx)(Pn,{label:`Format`,value:n.protocol,onChange:e=>w({protocol:e}),options:[{id:`json`,label:`JSON`},{id:`protobuf`,label:`Protobuf`}]})})}),(0,$.jsx)(J,{label:`Service name`,htmlFor:`otel-service`,help:`How the collector names ForgeQE: letters, digits, dots, dashes or underscores.`,children:(0,$.jsx)(a,{id:`otel-service`,className:`w-full sm:w-[200px]`,value:n.service,spellCheck:!1,autoComplete:`off`,onChange:e=>w({service:e.target.value})})}),(0,$.jsx)(J,{label:`Projects`,help:n.only?`Only this project (${e.project}) is sent. A project whose forgeqe.yaml says telemetry: off is never sent.`:`Every project on this computer, except one whose forgeqe.yaml says telemetry: off.`,children:(0,$.jsx)(`div`,{className:`flex w-full flex-wrap items-center gap-2 sm:justify-end`,children:(0,$.jsx)(Pn,{label:`Projects`,value:n.only?`this`:`all`,onChange:e=>w({only:e===`this`}),options:[{id:`all`,label:`Every project`},{id:`this`,label:`Only this one`}]})})}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2 py-4`,children:[(0,$.jsxs)(V,{busy:u===`save`,size:`sm`,variant:`primary`,disabled:!!u||!C||!n.endpoint.trim(),onClick:()=>void D(),"data-tip":`Save to ForgeQE's folder on this computer; nothing is turned on`,children:[(0,$.jsx)(Jt,{"aria-hidden":`true`}),u===`save`?`Saving…`:`Save`]}),C&&y&&(0,$.jsxs)(V,{size:`sm`,onClick:()=>r(S),disabled:!!u,"data-tip":`Discard your changes`,children:[(0,$.jsx)(Be,{"aria-hidden":`true`}),`Discard`]})]}),(0,$.jsx)(K,{icon:gt,help:`Shapes, never content: each attribute is a name of ForgeQE's own list, a number or a yes or no.`,children:`What is sent`}),(0,$.jsx)(J,{label:`Attributes`,help:`The whole list. Anything else is left out before it leaves this computer.`,children:(0,$.jsx)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:e.attributes.join(`, `)})}),(0,$.jsx)(J,{label:`Metrics`,children:(0,$.jsx)(`span`,{className:`text-body-sm text-ink-2 [overflow-wrap:anywhere]`,children:e.metrics.join(`, `)})}),(0,$.jsx)(J,{label:`Never sent`,children:(0,$.jsxs)(`span`,{className:`text-body-sm text-ink-2`,children:[e.neverSent[0].toUpperCase()+e.neverSent.slice(1),`.`]})}),(0,$.jsx)(J,{label:`A sample`,help:`What would be sent for ${e.sample.from}.`,children:(0,$.jsxs)(V,{size:`sm`,onClick:()=>p(`sample`),"data-tip":`The real JSON, as the collector would get it`,children:[(0,$.jsx)(Gt,{"aria-hidden":`true`}),`Show the sample`]})}),(0,$.jsx)(Z,{wide:!0,open:!!f,onClose:()=>p(null),title:f===`on`&&y?`Turn on the export to ${y.host}`:`What would be sent`,description:`For ${e.sample.from}.`,footer:f===`on`&&y?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(V,{onClick:()=>p(null),children:[(0,$.jsx)(U,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsxs)(V,{busy:u===`on`,variant:`primary`,disabled:!!u||m.trim()!==y.host,onClick:()=>void v(`on`,async()=>{let e=await Te.on(m);return p(null),l(`On. ForgeQE sends to ${y.host} from its next command.`),e}),children:[(0,$.jsx)(st,{"aria-hidden":`true`}),u===`on`?`Turning on…`:`Turn on`]})]}):(0,$.jsxs)(V,{onClick:()=>p(null),children:[(0,$.jsx)(U,{"aria-hidden":`true`}),`Close`]}),children:(0,$.jsxs)(`div`,{className:`mt-4 flex flex-col gap-4`,children:[f===`on`&&y&&(0,$.jsxs)(`div`,{className:g(`rounded-base bg-surface-muted p-4`,`flex flex-col gap-2`),children:[(0,$.jsxs)(`p`,{className:`m-0 text-body-sm text-ink-2`,children:[y.level===`metrics`?`Metrics`:`Each session's spans and its metrics`,y.logs?`, and problems as log records,`:``,` go to `,y.endpoint,` as `,y.protocol===`protobuf`?`protobuf (shown here as JSON)`:`JSON`,`, with only the attributes below. Never sent: `,e.neverSent,`. Turn it off here at any time.`]}),(0,$.jsxs)(`label`,{htmlFor:`otel-confirm`,className:`text-body-sm font-medium text-ink-2`,children:[`Type `,y.host,` to confirm`]}),(0,$.jsx)(a,{id:`otel-confirm`,value:m,placeholder:y.host,spellCheck:!1,autoComplete:`off`,onChange:e=>h(e.target.value)}),o&&(0,$.jsx)(as,{text:o})]}),e.sample.traces&&(0,$.jsx)(dr,{level:3,icon:pt,title:`Spans, to /v1/traces`,children:(0,$.jsx)(`pre`,{className:g(`overflow-auto rounded-base bg-surface-muted p-4 font-mono text-body-sm leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,`m-0 max-h-[40vh]`),children:e.sample.traces})}),e.sample.logs&&(0,$.jsx)(dr,{level:3,icon:Bt,title:`Log records, to /v1/logs`,children:(0,$.jsx)(`pre`,{className:g(`overflow-auto rounded-base bg-surface-muted p-4 font-mono text-body-sm leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,`m-0 max-h-[40vh]`),children:e.sample.logs})}),e.sample.metrics&&(0,$.jsx)(dr,{level:3,icon:Zt,title:`Metrics, to /v1/metrics`,children:(0,$.jsx)(`pre`,{className:g(`overflow-auto rounded-base bg-surface-muted p-4 font-mono text-body-sm leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,`m-0 max-h-[40vh]`),children:e.sample.metrics})})]})})]})}var fs=[{id:`github`,name:`GitHub`,note:`github.com, or GitHub Enterprise at your own address.`,logo:yr.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:yr.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:yr.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:yr.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:yr.bitbucket,tokenEnv:`BITBUCKET_TOKEN`,cloud:!1}],ps=e=>fs.find(t=>t.id===e),ms=/^[A-Za-z0-9][A-Za-z0-9_-]{0,62}$/;function hs(e,t){let n=!t.url||gs(e?.id,String(t.url)).cloud;return e?.id===`github`?n?`cli`:`gh-host`:e?.id===`azure-devops`&&n?`cli`:`git`}function gs(e,t){let n;try{n=new URL(t.trim())}catch{return{cloud:!1}}let i=n.hostname.toLowerCase(),a=r(n.pathname).split(`/`).filter(Boolean)[0],o=a&&/^[A-Za-z0-9][A-Za-z0-9 ._-]{0,99}$/.test(a)?a:void 0;if(e===`azure-devops`){if(i===`dev.azure.com`)return{cloud:!0,org:o};let e=/^([a-z0-9][a-z0-9-]{0,62})\.visualstudio\.com$/.exec(i);return e?{cloud:!0,org:e[1]}:{cloud:!1}}return e===`bitbucket-cloud`?i===`bitbucket.org`?{cloud:!0,org:o}:{cloud:!1}:e===`github`?{cloud:i===`github.com`}:e===`gitlab`?{cloud:i===`gitlab.com`}:{cloud:!1}}function _s({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)(pn,{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-body-sm text-muted [overflow-wrap:anywhere]`,children:r}),i]}),(0,$.jsx)(`span`,{className:`flex gap-2`,children:a})]})}function vs({ok:e,message:t}){return(0,$.jsxs)(`p`,{role:e?`status`:`alert`,className:g(`mt-2 mb-1 flex items-start gap-2`,z[e?`pass`:`fail`]),children:[e?(0,$.jsx)(rt,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none`}):(0,$.jsx)(nn,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none`}),(0,$.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:t})]})}function ys({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-body-sm font-medium text-ink`,children:e}),t&&(0,$.jsx)(`p`,{className:`m-0 text-body-sm leading-relaxed text-ink-2`,children:t})]})}var bs=({children:e})=>(0,$.jsx)(`p`,{role:`status`,className:`m-0 border-t border-line-soft py-6 text-body-sm text-muted`,children:e}),xs=e=>Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`string`));function Ss(e,t,n){let r=q(Y(e,[`product`,`repos`])),i=e;for(let[e,a]of Object.entries(r))q(a).account===t&&(i=W(i,[`product`,`repos`,e,`account`],n));return i}function Cs({edit:e}){let t=e.value,n=q(Y(t,[`product`,`accounts`])),r=q(Y(t,[`product`,`repos`])),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)({}),u=(0,Q.useCallback)(()=>{Se.get().then(e=>l(e.saved),()=>{})},[]);(0,Q.useEffect)(u,[u]);let d=zn(),f=e=>Object.values(r).filter(t=>q(t).account===e).length,p=(e,t)=>{let n=ps(t.host),r=f(e),i=`${r} ${r===1?`repository`:`repositories`} connected`;if(t.auth===`token`)return Wn(d,String(t.token_env||``))?(0,$.jsx)(`span`,{className:`text-body-sm text-pass`,children:`Connected with a token, ${i}`}):(0,$.jsx)(`span`,{className:`text-body-sm text-warn`,children:`Needs its token: Edit to add it`});let a=hs(n,t),o=c[n.cli.system];return a===`cli`?o&&(o.via!==`token`||o.browser)&&ra(o,n.name)?(0,$.jsx)(`span`,{className:`text-body-sm text-pass`,children:`Signed in, ${i}`}):(0,$.jsx)(`span`,{className:`text-body-sm text-warn`,children:`Needs a sign-in: Edit to sign in`}):(0,$.jsx)(`span`,{className:`text-body-sm text-muted`,children:`${a===`gh-host`?`The GitHub CLI's`:`Git Credential Manager's`} sign-in, ${i}`})};return(0,$.jsxs)(X,{children:[(0,$.jsx)(K,{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-body-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)(V,{size:`sm`,"data-tip":`Add an account`,onClick:()=>a({step:`catalog`}),children:[(0,$.jsx)(H,{"aria-hidden":`true`}),`Add`]})]}),Object.entries(n).map(([n,r])=>{let i=q(r),o=ps(i.host);return(0,$.jsx)(_s,{logo:o?.logo,icon:We,title:n,meta:[o?.name||`Unknown host`,i.org,i.url].filter(Boolean).map(String).join(`, `),state:p(n,i),actions:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(V,{variant:`icon`,size:`icon-sm`,"aria-label":`Repositories of ${n}`,"data-tip":`Repositories of ${n}`,disabled:!o,onClick:()=>s(n),children:(0,$.jsx)(He,{"aria-hidden":`true`})}),o&&(0,$.jsx)(V,{variant:`icon`,size:`icon-sm`,"aria-label":`Edit ${n}`,"data-tip":`Edit ${n}`,onClick:()=>a({step:`form`,host:o,mode:`edit`,name:n,from:n,value:i}),children:(0,$.jsx)(tt,{"aria-hidden":`true`})}),(0,$.jsx)(V,{variant:`icon`,size:`icon-sm`,"aria-label":`Disconnect ${n}`,"data-tip":`Disconnect ${n}`,onClick:()=>e.set(Ss(W(t,[`product`,`accounts`,n],void 0),n,void 0)),children:(0,$.jsx)(Xe,{"aria-hidden":`true`})})]})},n)}),(0,$.jsx)(ys,{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)(fr,{edit:e,base:[`product`,`repos`],defs:Tr,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)(ks,{edit:e}),(0,$.jsx)(Ms,{edit:e}),(0,$.jsx)(K,{help:Ir[0].help,children:`4. The product and its knowledge`}),(0,$.jsx)(G,{defs:Ir[0].fields,edit:e,base:Ir[0].base}),Ir.slice(1).map(t=>(0,$.jsxs)(`div`,{children:[(0,$.jsx)(ys,{title:t.title,help:t.help}),(0,$.jsx)(G,{defs:t.fields,edit:e,base:t.base})]},t.title)),(0,$.jsx)(K,{help:zr[0].help,children:`5. ${zr[0].title}`}),(0,$.jsx)(G,{defs:zr[0].fields,edit:e,base:zr[0].base}),(0,$.jsx)(ws,{sheet:i,setSheet:a,taken:e=>e in n,onSigned:u,onApply:n=>{let r=t;n.mode===`edit`&&n.from!==n.name&&(r=Ss(W(r,[`product`,`accounts`,n.from],void 0),n.from,n.name)),e.set(W(r,[`product`,`accounts`,n.name],n.value)),a(null),n.mode===`add`&&s(n.name)}}),(0,$.jsx)(Ts,{id:o,account:o?q(n[o]):{},repos:r,onClose:()=>s(null),onConnect:n=>e.set(W(t,[`product`,`repos`],{...r,...n}))})]})}function ws({sheet:e,setSheet:t,taken:n,onApply:r,onSigned:i}){let s=zn(),[c,l]=(0,Q.useState)({busy:!1}),u=e?.step===`form`?`${e.host.id}/${e.from}`:e?.step||``;(0,Q.useEffect)(()=>l({busy:!1}),[u]);let d=()=>t(null);if(e?.step===`form`){let o=e,u=o.value,f=e=>t({...o,value:e}),p=o.name?ms.test(o.name)?o.name!==o.from&&n(o.name)?`Another account has this name.`:``:`Letters, digits, - and _.`:``,m=!u.url||gs(o.host.id,String(u.url)).cloud,h=o.host.id===`azure-devops`&&m&&!(u.url&&gs(o.host.id,String(u.url)).org),g=(()=>{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.`}})(),_=!!o.name&&!p&&!g&&(o.host.cloud||!!String(u.url||``).trim())&&(!h||!!String(u.org||``).trim())&&(u.auth!==`token`||!!String(u.token_env||``).trim()),v=hs(o.host,u),y=async e=>{l({busy:!0});try{if(e===`signin`){let e=await ge.signIn(o.name||`account`,u);l({busy:!1,ok:e.ok,message:e.message})}else{let e=await ge.repos(o.name||`account`,u,xs(s.pending),[]);l({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){l({busy:!1,ok:!1,message:e.message})}};return(0,$.jsxs)(Z,{open:!0,onClose:d,title:o.mode===`add`?`Connect ${o.host.name}`:`Edit ${o.name}`,description:`Then pick its repositories. A token you type is kept in ${qn(s.store)}, never in the settings files.`,footer:(0,$.jsxs)($.Fragment,{children:[o.mode===`add`&&(0,$.jsxs)(V,{onClick:()=>t({step:`catalog`}),children:[(0,$.jsx)(yt,{"aria-hidden":`true`}),`Back`]}),(0,$.jsxs)(V,{busy:c.busy,onClick:()=>y(`list`),disabled:c.busy||!_,className:`mr-auto`,"data-tip":`Test the connection`,children:[(0,$.jsx)(Ge,{"aria-hidden":`true`}),c.busy?`Testing…`:`Test`]}),(0,$.jsxs)(V,{onClick:d,children:[(0,$.jsx)(U,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsxs)(V,{variant:`primary`,disabled:!_,onClick:()=>r(o),children:[o.mode===`add`?(0,$.jsx)(Ge,{"aria-hidden":`true`}):(0,$.jsx)(Jt,{"aria-hidden":`true`}),o.mode===`add`?`Connect`:`Done`]})]}),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-4 pt-6 pb-2`,children:[(0,$.jsx)(pn,{logo:o.host.logo,icon:We,size:`lg`}),(0,$.jsx)(`span`,{className:`text-body-sm text-muted`,children:o.host.note})]}),(0,$.jsx)(`div`,{"aria-live":`polite`,children:c.message&&(0,$.jsx)(vs,{ok:!!c.ok,message:c.message})}),(0,$.jsx)(J,{label:`Name`,help:p?(0,$.jsx)(`span`,{className:`text-fail`,children:p}):`A short name for the account, such as work.`,htmlFor:`acct-name`,stacked:!0,children:(0,$.jsx)(a,{id:`acct-name`,value:o.name,spellCheck:!1,"aria-invalid":!!p,placeholder:`work`,onChange:e=>t({...o,name:e.target.value.trim()})})}),(0,$.jsx)(J,{label:o.host.cloud?`Address of your own server`:`Address`,help:g?(0,$.jsx)(`span`,{className:`text-fail`,children:g}):o.host.cloud?`Empty: ${o.host.name}'s cloud.`:`https, the server's address.`,htmlFor:`acct-url`,stacked:!0,children:(0,$.jsx)(a,{id:`acct-url`,"aria-invalid":!!g,value:String(u.url||``),spellCheck:!1,placeholder:o.host.cloud?``:`https://bitbucket.acme.example`,onChange:e=>f(W(u,[`url`],e.target.value.trim()||void 0))})}),o.host.org&&(0,$.jsx)(J,{label:o.host.org,help:h?`Its name, as in dev.azure.com/<organization>.`:`Empty: every repository you can read.`,htmlFor:`acct-org`,stacked:!0,children:(0,$.jsx)(a,{id:`acct-org`,value:String(u.org||``),spellCheck:!1,placeholder:`acme`,onChange:e=>f(W(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`,v===`git`?`In the browser, with Git Credential Manager`:o.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-body-sm`,children:[(0,$.jsx)(Zr,{name:`acct-auth`,checked:u.auth===`token`==(e===`token`),onSelect:()=>f(e===`token`?{...u,auth:`token`,token_env:u.token_env||o.host.tokenEnv}:{...u,auth:`browser`,token_env:void 0,user:void 0})}),t]},e))]}),u.auth===`token`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{label:`Token`,help:`Read access to the repositories (code: read).`,htmlFor:`account-token`,stacked:!0,children:(0,$.jsx)(on,{id:`account-token`,name:String(u.token_env||o.host.tokenEnv),field:`token`,onRename:e=>f({...u,token_env:e})})}),(o.host.id===`bitbucket-cloud`||o.host.id===`bitbucket-server`)&&(0,$.jsx)(J,{label:`User name for the token`,help:`With a Bitbucket app password. Empty: an access token.`,htmlFor:`acct-user`,stacked:!0,children:(0,$.jsx)(a,{id:`acct-user`,value:String(u.user||``),spellCheck:!1,onChange:e=>f(W(u,[`user`],e.target.value.trim()||void 0))})})]}):v===`cli`?(0,$.jsx)(ia,{system:o.host.cli.system,label:o.host.cli.label,keyless:!0,onChanged:i}):v===`gh-host`?(0,$.jsx)(J,{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)(J,{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)(V,{busy:c.busy,onClick:()=>y(`signin`),disabled:c.busy||!_,"data-tip":`Sign in with the browser`,children:[(0,$.jsx)(Qe,{"aria-hidden":`true`}),c.busy?`Signing in…`:`Sign in`]})})]})}return(0,$.jsx)(Z,{open:e?.step===`catalog`,onClose:d,title:`Add an account`,description:`Pick where your code is.`,footer:(0,$.jsxs)(V,{onClick:d,children:[(0,$.jsx)(U,{"aria-hidden":`true`}),`Close`]}),children:(0,$.jsx)(`div`,{className:`pt-4`,children:fs.map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>t({step:`form`,host:e,mode:`add`,name:``,from:``,value:{host:e.id,auth:`browser`}}),className:g(o,`min-h-14`),children:[(0,$.jsx)(pn,{logo:e.logo,icon:We}),(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-body-sm text-muted`,children:e.note})]}),(0,$.jsx)(`span`,{className:`text-body-sm text-accent-fg`,children:`Add`})]},e.id))})})}function Ts({id:e,account:t,repos:n,onClose:r,onConnect:i}){let o=zn(),[s,c]=(0,Q.useState)({busy:!1}),[l,u]=(0,Q.useState)(new Set),[d,f]=(0,Q.useState)(``),p=(0,Q.useMemo)(()=>new Set(Object.values(n).map(e=>String(q(e).git||``))),[n]);(0,Q.useEffect)(()=>{e&&(u(new Set),f(``),c({busy:!0}),ge.repos(e,t,xs(o.pending),Object.keys(n)).then(e=>c(e.ok?{busy:!1,repos:e.repos,truncated:e.truncated,skipped:e.skipped}:{busy:!1,message:e.message}),e=>c({busy:!1,message:e.message})))},[e]);let m=(s.repos||[]).filter(e=>!d||e.fullName.toLowerCase().includes(d.toLowerCase()));return(0,$.jsxs)(Z,{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-body-sm text-muted`,children:l.size?`${l.size} picked`:``}),(0,$.jsxs)(V,{onClick:r,children:[(0,$.jsx)(U,{"aria-hidden":`true`}),`Cancel`]}),(0,$.jsxs)(V,{variant:`primary`,disabled:!l.size,onClick:()=>{let e={};for(let t of s.repos||[])l.has(t.git)&&(e[t.key]=t.entry);i(e),r()},"data-tip":l.size>1?`Connect ${l.size} repositories`:void 0,children:[(0,$.jsx)(Ge,{"aria-hidden":`true`}),l.size>1?`Connect (${l.size})`:`Connect`]})]}),children:[(0,$.jsxs)(`div`,{"aria-live":`polite`,children:[s.busy&&(0,$.jsx)(bs,{children:`Reading the account's repositories…`}),s.message&&(0,$.jsx)(vs,{ok:!1,message:s.message})]}),s.repos&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{label:`Find`,htmlFor:`repo-find`,stacked:!0,children:(0,$.jsx)(a,{id:`repo-find`,type:`search`,value:d,placeholder:`shop`,onChange:e=>f(e.target.value)})}),!m.length&&(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft py-6 text-body-sm text-muted`,children:s.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:m.map(e=>{let t=p.has(e.git);return(0,$.jsx)(`li`,{className:`border-t border-line-soft`,children:(0,$.jsxs)(`label`,{className:g(`flex min-h-12 items-center gap-4 py-2`,t?`cursor-default`:`cursor-pointer`),children:[(0,$.jsx)(lr,{disabled:t,checked:t||l.has(e.git),onCheckedChange:t=>u(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-body-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-body-sm text-pass`,children:`Connected`})]})},e.git)})}),(s.truncated||!!s.skipped)&&(0,$.jsx)(`p`,{className:`m-0 pt-4 text-body-sm text-muted`,children:[s.truncated?`The first 2,000 are listed: find narrows them.`:``,s.skipped?`${s.skipped} left out: their links are not of this host, or not https.`:``].filter(Boolean).join(` `)})]})]})}var Es=e=>e.url?`url`:e.mcp?`mcp`:e.command?`command`:e.documents?`documents`:`none`,Ds=Nr[0].fields,Os=e=>e.map(e=>Ds.find(t=>t.key===e));function ks({edit:e}){let t=zn(),n=q(e.value.rag),r=Es(n),[i,o]=(0,Q.useState)(r),[s,c]=(0,Q.useState)(``),[l,u]=(0,Q.useState)({busy:!1}),d=JSON.stringify(n),f=(0,Q.useRef)(null);(0,Q.useEffect)(()=>o(r===`none`&&f.current?.rag===d?f.current.kind:r),[r,d]);let p=t=>{o(t),u({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));f.current={kind:t,rag:JSON.stringify(Object.keys(i).length?i:{})},e.set(W(e.value,[`rag`],Object.keys(i).length?i:void 0))},m=Object.keys(q(e.value.mcp)),h=async()=>{u({busy:!0});try{let r=await ge.testSearch(n,q(e.value.mcp),s,xs(t.pending));u({busy:!1,...r})}catch(e){u({busy:!1,ok:!1,message:e.message})}};return(0,$.jsxs)(X,{children:[(0,$.jsx)(K,{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]`)&&p(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)(Zr,{checked:i===e,onSelect:()=>i!==e&&p(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-body-sm text-muted [overflow-wrap:anywhere]`,children:n})]})]},e))}),i===`url`&&(0,$.jsx)(G,{defs:Os([`url`,`token_env`,`top_k`,`timeout_seconds`]),edit:e,base:[`rag`]}),i===`mcp`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(G,{defs:Os([`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-body-sm text-muted`,children:m.length?`MCP servers set up: ${m.join(`, `)}.`:`No MCP server is set up yet: add one under MCP servers, then name it here.`})]}),i===`command`&&(0,$.jsx)(G,{defs:Os([`command`,`top_k`,`timeout_seconds`]),edit:e,base:[`rag`]}),i===`documents`&&(0,$.jsx)(G,{defs:Os([`documents.folders`,`documents.reasoning`,`top_k`]),edit:e,base:[`rag`]}),i!==`none`&&(0,$.jsx)(J,{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)(a,{id:`rag-query`,value:s,placeholder:`refunds over 500 EUR`,onChange:e=>c(e.target.value),onKeyDown:e=>F(e)&&s.trim()&&h(),className:`min-w-0 flex-1`}),(0,$.jsxs)(V,{busy:l.busy,size:`sm`,disabled:l.busy||!s.trim(),onClick:h,children:[(0,$.jsx)(Ze,{"aria-hidden":`true`}),l.busy?`Searching…`:`Search`]})]})}),(0,$.jsxs)(`div`,{"aria-live":`polite`,children:[l.message&&(0,$.jsx)(vs,{ok:!!l.ok,message:l.message}),!!l.passages?.length&&(0,$.jsx)(`ul`,{"aria-label":`Passages found`,className:`m-0 list-none p-0`,children:l.passages.map((e,t)=>(0,$.jsxs)(`li`,{className:`border-t border-line-soft py-2 text-body-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 As=/^[A-Za-z0-9][A-Za-z0-9 _.()-]{0,99}\.(md|markdown|txt)$/i,js=e=>e<1024?`${e} bytes`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1024/1024).toFixed(1)} MB`;function Ms({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)(()=>{ge.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(!As.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 ge.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 ge.removeDocument(e)).documents)}catch(e){i({ok:!1,message:e.message})}};return(0,$.jsxs)(X,{children:[(0,$.jsx)(K,{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-body-sm text-muted`,children:`Added here: kept in .forgeqe/documents, read as the source uploaded.`}),(0,$.jsxs)(V,{busy:a,size:`sm`,disabled:a,"data-tip":`Add Markdown files`,onClick:()=>s.current?.click(),children:[(0,$.jsx)(Yt,{"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)(vs,{ok:r.ok,message:r.message})}),!t&&!r&&(0,$.jsx)(bs,{children:`Reading the documents…`}),t&&!t.length&&(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft py-6 text-body-sm text-muted`,children:`None yet.`}),t?.map(e=>(0,$.jsx)(_s,{icon:qt,title:e.title,meta:`${e.name}, ${js(e.bytes)}`,actions:(0,$.jsx)(V,{variant:`icon`,size:`icon-sm`,"aria-label":`Remove ${e.name}`,"data-tip":`Remove ${e.name}`,onClick:()=>l(e.name),children:(0,$.jsx)(en,{"aria-hidden":`true`})})},e.name)),(0,$.jsx)(ys,{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)(fr,{edit:e,base:[`product`,`docs`],defs:jr,noun:`source`,placeholder:`help`,meta:e=>String(e.path||e.url||(e.confluence?`Confluence ${e.confluence}`:e.app?`app ${e.app}`:``))})]})}mn.add(Ms),mn.add(ks),mn.add(Cs);var Ns=/^[A-Z][A-Z0-9_]{1,63}$/,Ps=/^(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,Fs=/(TOKEN|PAT)$/,Is=(e,t=`SHOP_PASSWORD`)=>Ns.test(e)?Ps.test(e)?`${e} changes how programs start: pick another name.`:``:`Capital letters, digits and _, such as ${t}.`,Ls=[{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)`}],Rs={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)`},zs=e=>e?.length?`Used by ${e.slice(0,2).join(`, `)}${e.length>2?` and ${e.length-2} more`:``}`:``,Bs=()=>ye.list();function Vs({show:e}){let{data:t,error:n,reload:r}=wn(Bs),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(`sec-saved`),[c,l]=(0,Q.useState)(e||`all`);(0,Q.useEffect)(()=>{e&&s(`sec-saved`),l(e||`all`)},[e]);let[u,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(!1),C=(0,Q.useRef)(null),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(``),[O,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)({}),M=i??t,N=(M?.vaults||[]).filter(e=>e.auth===`cli`).map(e=>e.id).join(`,`),P=e=>{j(t=>({...t,[e]:`checking`})),ye.check(e).then(t=>j(n=>({...n,[e]:t})),t=>j(n=>({...n,[e]:{signedIn:!1,problem:t.message}})))};(0,Q.useEffect)(()=>{if(o===`sec-vaults`)for(let e of N.split(`,`).filter(Boolean))A[e]||P(e)},[o,N]),(0,Q.useEffect)(()=>{if(O?.state!==`running`)return;let e=setTimeout(()=>{ye.signinState().then(e=>{k(e.signin),e.signin&&e.signin.state!==`running`&&P(e.signin.vault)},()=>{})},1e3);return()=>clearTimeout(e)},[O]);let ee=async e=>{d(``),p(``);try{k(await ye.signIn(e))}catch(e){p(e.message)}},F=async(e,t,n)=>{S(!0),D(``);try{a(await e()),n(),d(t)}catch(e){D(e.message)}finally{S(!1)}},I=e=>{D(``),d(``),e()};if(!M)return(0,$.jsx)(sn,{error:n,reload:r});let te=M.secrets.filter(e=>e.from===`vault`&&!e.pending).length,ne=async()=>{d(``),p(``);try{let e=await ye.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),d(`Exported the vault connections: no value is in the file. A teammate imports it here and pulls with their own sign-in.`)}catch(e){p(e.message)}},re=async e=>{let t=e?.[0];if(t){if(d(``),p(``),t.size>262144)return p(`${t.name} is over 256 KB.`);S(!0),T(!0);try{let e=await ye.importVaults(await t.text());a(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.`:``];d(n.filter(Boolean).join(` `)),e.skipped.length&&p(`Not imported: ${e.skipped.map(e=>`${e.id} (${e.why})`).join(`; `)}`)}catch(e){p(e.message)}finally{S(!1),T(!1)}}},L=M.secrets.filter(e=>e.token),ie=c===`tokens`?L:M.secrets,ae=(e=M.suggestedTokens[0]||`REPO_TOKEN`)=>I(()=>h({mode:`add`,name:e,value:``,token:!0})),oe=async e=>{S(!0),d(``),p(``);try{let t=await ye.pullAgain(e);a(t.view),t.failed.length?p(`Not pulled: ${t.failed.map(e=>`${e.name} (${e.error})`).join(`; `)}`):d(`Pulled ${e}.`)}catch(e){p(e.message)}finally{S(!1)}},se=async()=>{S(!0),d(``),p(``);try{let e=await ye.pullAgain();a(e.view),d(`Pulled ${e.pulled.length} again from their vaults.`),p(e.failed.length?`Not pulled: ${e.failed.map(e=>`${e.name} (${e.error})`).join(`; `)}`:``)}catch(e){p(e.message)}finally{S(!1)}};return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ln,{label:`Secrets`,current:o,onPick:e=>{s(e),d(``),p(``)},tabs:[{id:`sec-saved`,label:`Saved (${M.secrets.length})`},{id:`sec-vaults`,label:`Vaults (${M.vaults.length})`}]}),u&&(0,$.jsx)(Re,{tone:`info`,className:`mb-4`,children:u}),f&&(0,$.jsx)(`p`,{role:`alert`,className:g(z.fail,`m-0 mb-4`),children:f}),o===`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)(Ne,{value:c,onChange:e=>{l(e),d(``)},items:[{id:`all`,label:`All`,n:M.secrets.length},{id:`tokens`,label:`Repository tokens`,n:L.length+M.neededTokens.length}]})}),(0,$.jsxs)(`span`,{className:`flex flex-wrap gap-2`,children:[te>0&&(0,$.jsxs)(V,{busy:x,size:`sm`,disabled:x,onClick:()=>void se(),children:[(0,$.jsx)(rn,{"aria-hidden":`true`}),x?`Pulling…`:`Pull all again`]}),c===`tokens`?(0,$.jsxs)(V,{size:`sm`,onClick:()=>ae(),children:[(0,$.jsx)(H,{"aria-hidden":`true`}),`Add a token`]}):(0,$.jsxs)(V,{size:`sm`,onClick:()=>I(()=>h({mode:`add`,name:``,value:``})),children:[(0,$.jsx)(H,{"aria-hidden":`true`}),`Add a secret`]})]})]}),(0,$.jsx)(`p`,{className:`m-0 mb-4 text-body-sm text-muted`,children:c===`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.`}),M.neededTokens.map(e=>(0,$.jsx)(Cn,{expandable:!1,open:!1,onToggle:()=>{},lead:(0,$.jsx)(pn,{icon:kt}),title:(0,$.jsx)(`span`,{className:`font-mono`,children:e.name}),meta:`${zs(e.usedBy)}. It has no value here yet.`,state:(0,$.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Not set`}),actions:(0,$.jsx)(V,{size:`sm`,"aria-label":`Add ${e.name}`,onClick:()=>ae(e.name),children:`Add`}),children:null},`needed-${e.name}`)),ie.length===0&&!M.neededTokens.length&&(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft py-6 text-body-sm text-muted`,children:c===`tokens`?`No repository tokens yet. Add one for each git host or account.`:`None yet. Add one, or pull one from a vault.`}),ie.map(e=>(0,$.jsx)(Cn,{expandable:!1,open:!1,onToggle:()=>{},lead:(0,$.jsx)(pn,{icon:e.from===`vault`?dt:e.from===`sign-in`?Qe:e.token?kt:jt}),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 ${$n(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?zs(e.usedBy)||`Not used yet`:``].filter(Boolean).join(` · `),state:e.from===`shell`?(0,$.jsx)(`span`,{className:`text-body-sm text-pass`,children:`Set in the environment`}):e.set?(0,$.jsx)(`span`,{className:`text-body-sm text-pass`,children:`Saved`}):(0,$.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Not set`}),actions:e.pending?(0,$.jsx)(V,{size:`sm`,"aria-label":`Pull ${e.name}`,disabled:x,onClick:()=>void oe(e.name),children:`Pull`}):e.from===`sign-in`||e.from===`shell`?void 0:(0,$.jsx)(V,{size:`sm`,"aria-label":`Edit ${e.name}`,onClick:()=>I(()=>h({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-body-sm text-muted`,children:[`Kept in `,qn(M.store),`. ForgeQE never shows a value again, and the agents see only names.`,c===`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:[M.vaults.length>0&&(0,$.jsxs)(V,{size:`sm`,onClick:()=>void ne(),"data-tip":`A file of the connections, without values, for a teammate to import`,children:[(0,$.jsx)(Ut,{"aria-hidden":`true`}),`Export`]}),(0,$.jsxs)(V,{busy:w,size:`sm`,disabled:x,onClick:()=>C.current?.click(),"data-tip":`Connections a teammate exported`,children:[(0,$.jsx)(Yt,{"aria-hidden":`true`}),w?`Importing…`:`Import`]}),(0,$.jsx)(`input`,{ref:C,type:`file`,accept:`.json,application/json`,hidden:!0,onChange:e=>(re(e.target.files),e.target.value=``)}),(0,$.jsxs)(V,{size:`sm`,onClick:()=>I(()=>v({mode:`add`,v:{id:``,provider:`azure`,where:``,auth:`cli`}})),children:[(0,$.jsx)(H,{"aria-hidden":`true`}),`Add a vault`]})]}),(0,$.jsx)(`p`,{className:`m-0 mb-4 text-body-sm text-muted`,children:`Where ForgeQE pulls secrets from. It reads a value only when you pull that secret.`}),O&&(0,$.jsx)(Gs,{s:O,onCancel:()=>void ye.cancelSignin().then(e=>k(e.signin),()=>{}),onClose:()=>k(null)}),M.vaults.length===0&&(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft py-6 text-body-sm text-muted`,children:`None yet. Add Azure Key Vault, Google Secret Manager or AWS Secrets Manager.`}),M.vaults.map(e=>(0,$.jsx)(Cn,{expandable:!1,open:!1,onToggle:()=>{},lead:(0,$.jsx)(pn,{icon:dt}),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`?A[e.id]===`checking`||!A[e.id]?(0,$.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Checking the sign-in…`}):A[e.id].signedIn?(0,$.jsx)(`span`,{className:`text-body-sm text-pass`,children:`Signed in`}):(0,$.jsx)(`span`,{className:`text-body-sm text-warn`,"data-tip":A[e.id].problem,children:`Not signed in`}):e.missing.length?(0,$.jsx)(`span`,{className:`text-body-sm 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-body-sm text-muted`,children:e.pulled===1?`1 secret pulled`:`${e.pulled} secrets pulled`}),actions:(0,$.jsxs)($.Fragment,{children:[e.auth===`cli`&&A[e.id]!==`checking`&&A[e.id]&&!A[e.id].signedIn?(0,$.jsxs)(V,{size:`sm`,variant:`primary`,"aria-label":`Sign in to ${e.id}`,disabled:O?.state===`running`,onClick:()=>void ee(e.id),children:[(0,$.jsx)(Qe,{"aria-hidden":`true`}),`Sign in`]}):(0,$.jsx)(V,{size:`sm`,"aria-label":`Browse ${e.id}`,disabled:e.missing.length>0||e.auth===`cli`&&A[e.id]===`checking`,onClick:()=>I(()=>b(e)),children:`Browse`}),(0,$.jsx)(V,{size:`sm`,"aria-label":`Edit ${e.id}`,onClick:()=>I(()=>v({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-body-sm 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)(Hs,{panel:m,setPanel:h,busy:x,error:E,onSave:e=>void F(()=>ye.save(e.name,e.value),`${e.mode===`add`?`Added`:`Saved`} ${e.name}.`,()=>h(null)),onRemove:e=>void F(()=>ye.remove(e),`Removed ${e}.`,()=>h(null)),onPull:e=>void F(async()=>{let t=await ye.pullAgain(e);if(t.failed.length)throw Error(t.failed[0].error);return t.view},`Pulled ${e} again.`,()=>h(null)),taken:new Set(M.secrets.map(e=>e.name))}),(0,$.jsx)(Us,{panel:_,setPanel:v,busy:x,error:E,roles:M.keyRoles,taken:new Set(M.vaults.map(e=>e.id)),missing:M.vaults.find(e=>e.id===_?.v.id)?.missing,onSave:e=>void F(()=>ye.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.`:``}`,()=>{v(null),j(t=>{let{[e.v.id]:n,...r}=t;return r})}),onRemove:e=>void F(()=>ye.removeVault(e),`Removed the vault ${e}. The secrets pulled from it stay saved.`,()=>v(null))}),(0,$.jsx)(Ws,{vault:y,onClose:()=>b(null),taken:new Set(M.secrets.map(e=>e.name)),onPulled:(e,t,n)=>{a(e),b(null),s(`sec-saved`),d(`Pulled ${n} as ${t}. Agents and tests can use it by that name.`)}})]})}function Hs({panel:e,setPanel:t,busy:n,error:r,onSave:i,onRemove:o,onPull:s,taken:l}){let u=e?.mode===`add`?Is(e.name,e.token?`GITHUB_TOKEN`:void 0)||(l.has(e.name)?`${e.name} is already in the list: edit it there.`:``)||(e.token&&!Fs.test(e.name)?`A token's name ends in TOKEN or PAT, such as GITHUB_TOKEN.`:``):``,d=e?.row?.from===`vault`,[f,p]=(0,Q.useState)(!1);return(0,Q.useEffect)(()=>p(!1),[!!e]),(0,$.jsx)(Z,{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-body-sm text-fail [overflow-wrap:anywhere]`,children:r}):u?(0,$.jsx)(`span`,{className:`mr-auto self-center text-body-sm text-muted`,children:`Needs a valid name`}):null,e?.mode===`edit`&&(0,$.jsx)(V,{disabled:n,onClick:()=>o(e.name),className:`mr-auto text-fail`,children:`Remove`}),(0,$.jsx)(V,{onClick:()=>t(null),children:`Cancel`}),(0,$.jsx)(V,{busy:n,variant:`primary`,disabled:n||!!u||!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)(J,{label:`Name`,help:u?(0,$.jsx)(`span`,{className:`text-fail`,children:u}):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)(a,{id:`sh-name`,value:e.name,spellCheck:!1,maxLength:64,placeholder:e.token?`GITHUB_TOKEN`:`SHOP_PASSWORD`,"aria-invalid":!!u,onChange:n=>t({...e,name:n.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,`_`)}),className:`font-mono`})}),d&&e.row?.vault&&(0,$.jsx)(J,{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 ${$n(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)(V,{size:`sm`,disabled:n,onClick:()=>s(e.name),children:[(0,$.jsx)(rn,{"aria-hidden":`true`}),`Pull again`]})}),(0,$.jsx)(J,{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)(V,{variant:`link`,size:`inline`,onClick:()=>p(!f),className:`whitespace-normal`,children:f?`One line, hidden`:`Several lines (shown as you type), such as a JSON key`})]}),htmlFor:`sh-value`,className:e.mode===`edit`&&!d?`mt-4`:void 0,stacked:!0,children:f&&!e.token?(0,$.jsx)(c,{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)(a,{id:`sh-value`,type:`password`,autoComplete:`off`,value:e.value,onChange:n=>t({...e,value:n.target.value})})})]})})}function Us({panel:e,setPanel:t,busy:n,error:r,roles:i,taken:o,missing:c,onSave:l,onRemove:u}){let d=e?.v,f=Ls.find(e=>e.id===d?.provider)??Ls[0],p=n=>e&&t({...e,v:{...e.v,...n}}),m=d?.auth===`keys`?Object.entries(i[d.provider]).map(([e,t])=>[e,Is(d.keys?.[e]??t)]).filter(([,e])=>e):[],h=e?.mode===`add`?/^[a-z][a-z0-9-]{0,39}$/.test(d?.id||``)?o.has(d.id)?`A vault is already named ${d.id}.`:``:`Lower case letters, digits and -, such as qa-kv.`:``;return(0,$.jsx)(Z,{open:!!e,onClose:()=>t(null),title:e?.mode===`edit`?`Edit ${d?.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-body-sm text-fail [overflow-wrap:anywhere]`,children:r}):h||m.length?(0,$.jsx)(`span`,{className:`mr-auto self-center text-body-sm text-muted`,children:`Needs a valid name`}):null,e?.mode===`edit`&&(0,$.jsx)(V,{disabled:n,onClick:()=>u(d.id),className:`mr-auto text-fail`,children:`Remove`}),(0,$.jsx)(V,{onClick:()=>t(null),children:`Cancel`}),(0,$.jsx)(V,{busy:n,variant:`primary`,disabled:n||!!h||m.length>0||!d?.where.trim(),onClick:()=>e&&l(e),children:n?`Saving…`:e?.mode===`add`?`Add vault`:`Save vault`})]}),children:e&&d&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{label:`Provider`,htmlFor:`vt-provider`,className:`mt-4`,stacked:!0,children:(0,$.jsx)(s,{id:`vt-provider`,value:d.provider,disabled:e.mode===`edit`,onChange:e=>p({provider:e.target.value,where:``,keys:void 0,profile:void 0}),children:Ls.map(e=>(0,$.jsx)(`option`,{value:e.id,children:e.label},e.id))})}),e.mode===`add`&&(0,$.jsx)(J,{label:`Name`,help:h?(0,$.jsx)(`span`,{className:`text-fail`,children:h}):`What this project calls it.`,htmlFor:`vt-id`,stacked:!0,children:(0,$.jsx)(a,{id:`vt-id`,value:d.id,spellCheck:!1,maxLength:40,placeholder:`qa-kv`,"aria-invalid":!!h,onChange:e=>p({id:e.target.value.toLowerCase().replace(/[^a-z0-9-]/g,`-`)}),className:`font-mono`})}),(0,$.jsx)(J,{label:f.where,help:f.whereHelp,htmlFor:`vt-where`,stacked:!0,children:(0,$.jsx)(a,{id:`vt-where`,value:d.where,spellCheck:!1,maxLength:64,placeholder:f.placeholder,onChange:e=>p({where:e.target.value.trim()}),className:`font-mono`})}),(0,$.jsx)(J,{label:`Sign in with`,help:d.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)(s,{id:`vt-auth`,value:d.auth,onChange:e=>p({auth:e.target.value,keys:e.target.value===`keys`?{...i[d.provider]}:void 0}),children:[(0,$.jsxs)(`option`,{value:`cli`,children:[f.cli,` (recommended)`]}),(0,$.jsx)(`option`,{value:`keys`,children:d.provider===`azure`?`A service principal's keys, saved as secrets (no browser)`:d.provider===`gcp`?`A service account's key, saved as a secret (no browser)`:`Access keys, saved as secrets (no browser)`})]})}),d.provider===`aws`&&d.auth===`cli`&&(0,$.jsx)(J,{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)(a,{id:`vt-profile`,value:d.profile||``,spellCheck:!1,maxLength:64,placeholder:`qa`,onChange:e=>p({profile:e.target.value.trim()||void 0}),className:`font-mono`})}),d.auth===`keys`&&Object.entries(i[d.provider]).map(([e,t])=>(0,$.jsx)(J,{label:Rs[e]||e,help:(()=>{let n=d.keys?.[e]??t,r=Is(n);return r?(0,$.jsx)(`span`,{className:`text-fail`,children:r}):c?.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)(a,{id:`vt-${e}`,"aria-invalid":!!Is(d.keys?.[e]??t),value:d.keys?.[e]??t,spellCheck:!1,maxLength:64,onChange:t=>p({keys:{...d.keys||i[d.provider],[e]:t.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,`_`)}}),className:`font-mono`})},e))]})})}function Ws({vault:e,onClose:t,taken:n,onPulled:r}){let[i,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(``),[l,u]=(0,Q.useState)(``),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(!1),[h,_]=(0,Q.useState)(``),v=()=>{e&&(o(null),c(``),ye.names(e.id).then(o,e=>c(e.message)))};(0,Q.useEffect)(()=>{f(null),u(``),_(``),v()},[e?.id]);let y=(i?.names||[]).filter(e=>e.toLowerCase().includes(l.trim().toLowerCase())),b=y.slice(0,200),x=d?Is(d.name):``,S=async()=>{if(e&&d){m(!0),_(``);try{r(await ye.pull({vault:e.id,secret:d.secret,name:d.name,...d.key.trim()?{key:d.key.trim()}:{}}),d.name,d.secret)}catch(e){_(e.message)}finally{m(!1)}}};return(0,$.jsxs)(Z,{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:[h?(0,$.jsx)(`span`,{role:`alert`,className:`mr-auto self-center text-body-sm text-fail [overflow-wrap:anywhere]`,children:h}):(0,$.jsx)(`span`,{className:`mr-auto self-center text-body-sm text-muted`,children:d?x?`Needs a valid name`:`${d.secret} as ${d.name}`:``}),(0,$.jsx)(V,{onClick:t,children:`Cancel`}),(0,$.jsx)(V,{busy:p,variant:`primary`,disabled:p||!d||!!x,onClick:()=>void S(),children:p?`Pulling…`:`Pull secret`})]}),children:[(0,$.jsxs)(`div`,{"aria-live":`polite`,children:[!i&&!s&&(0,$.jsx)(`p`,{role:`status`,className:`m-0 border-t border-line-soft py-6 text-body-sm text-muted`,children:`Reading the vault's names…`}),s&&(0,$.jsx)(`div`,{className:`mt-4`,children:(0,$.jsx)(sn,{error:s,reload:v})})]}),i&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{label:`Find`,htmlFor:`br-find`,className:`mt-4`,stacked:!0,children:(0,$.jsx)(a,{id:`br-find`,value:l,placeholder:`password`,onChange:e=>u(e.target.value)})}),!y.length&&(0,$.jsx)(`p`,{className:`m-0 border-t border-line-soft py-6 text-body-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:b.map(e=>{let t=d?.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)(Zr,{name:`br-secret`,checked:t,onSelect:()=>f({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-body-sm [overflow-wrap:anywhere]`,children:e})]}),t&&d&&(0,$.jsxs)(`div`,{className:g(`panel rounded-md bg-(--page-surface-strong) p-6`,`mb-4 ml-8 flex flex-col gap-4`),children:[(0,$.jsx)(J,{label:`Save as`,help:x?(0,$.jsx)(`span`,{className:`text-fail`,children:x}):n.has(d.name)?`${d.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)(a,{id:`br-name`,value:d.name,spellCheck:!1,maxLength:64,"aria-invalid":!!x,onChange:e=>f({...d,name:e.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,`_`)}),className:`font-mono`})}),(0,$.jsx)(J,{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)(a,{id:`br-key`,value:d.key,spellCheck:!1,maxLength:128,placeholder:`password`,onChange:e=>f({...d,key:e.target.value}),className:`font-mono`})})]})]},e)})}),(y.length>b.length||i.total>i.names.length)&&(0,$.jsx)(`p`,{className:`m-0 pt-4 text-body-sm text-muted`,children:[y.length>b.length?`The first ${b.length} of ${y.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 Gs({s:e,onCancel:t,onClose:n}){let[r,i]=(0,Q.useState)(!1),a=e.state===`running`,o=e.link&&/^https:\/\//.test(e.link)?e.link:void 0;return(0,$.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:g(d,`mb-4 flex flex-col gap-4`),children:[(0,$.jsxs)(`span`,{className:`text-body-sm font-medium`,children:[`Signing in to `,e.vault]}),(o||e.code)&&a&&(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-body-sm text-muted`,children:`Your code`}),(0,$.jsx)(`span`,{className:nr,children:e.code}),(0,$.jsxs)(V,{size:`sm`,"aria-label":`Copy the code`,onClick:()=>{navigator.clipboard?.writeText(e.code).then(()=>i(!0)),setTimeout(()=>i(!1),1500)},children:[(0,$.jsx)(ht,{"aria-hidden":`true`}),r?`Copied`:`Copy`]})]}),o&&(0,$.jsxs)(`a`,{href:o,target:`_blank`,rel:`noreferrer noopener`,className:Ae({variant:`primary`,size:`sm`}),children:[(0,$.jsx)(zt,{"aria-hidden":`true`}),`Open `,new URL(o).host]})]}),(0,$.jsxs)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-body-sm`,children:[e.lines.slice(-6).map((t,n)=>(0,$.jsx)(`li`,{className:g(`[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)),a&&(0,$.jsx)(`li`,{className:`text-muted`,children:`Waiting for you to finish in the browser…`})]}),(0,$.jsx)(`div`,{children:a?(0,$.jsx)(V,{size:`sm`,onClick:t,children:`Cancel`}):(0,$.jsx)(V,{size:`sm`,onClick:n,children:`Close`})})]})}var Ks={testmu:`TestMu AI`,browserstack:`BrowserStack`},qs={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`}}},Js=(...e)=>e.map(([e,t])=>({value:e,label:t})),Ys={testmu:[{key:`type`,label:`Type`,type:`select`,default:`real`,options:Js([`real`,`Real device`],[`virtual`,`Emulator or simulator`])},{key:`platform`,label:`Platform`,type:`select`,default:`android`,options:Js([`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:Js([`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}]},Xs=`Kept in your credential store; the file has only the variable's name. The same sign-in as its browsers.`,Zs={testmu:[{key:`remote.username_env`,label:`TestMu AI user`,help:Xs,type:`var`,default:`LT_USERNAME`},{key:`remote.access_key_env`,label:`TestMu AI key`,help:Xs,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:Xs,type:`var`,default:`BROWSERSTACK_USERNAME`},{key:`remote.access_key_env`,label:`BrowserStack key`,help:Xs,type:`var`,default:`BROWSERSTACK_ACCESS_KEY`}]};function Qs(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 $s({grids:e,setGrids:t,paths:n,vars:r}){return(0,$.jsx)(X,{children:[`testmu`,`browserstack`].map(a=>{let o=Ks[a],s={value:e[a]??qs[a],set:n=>t({...e,[a]:n}),vars:r,file:n[a]};return(0,$.jsxs)(`div`,{children:[(0,$.jsx)(K,{help:(0,$.jsxs)($.Fragment,{children:[`Kept in `,(0,$.jsx)(`code`,{className:`font-mono text-body-sm`,children:n[a]}),`, `,o,`'s own file`,e[a]?``:`, made when you add a device`,`. Its browsers and their devices are in the same file:`,` `,(0,$.jsxs)(`a`,{href:i(`settings`,`integrations`),children:[`Integrations → `,o]}),`.`]}),children:`${o} devices`}),(0,$.jsx)(fr,{edit:s,base:[`mobile`,`devices`],defs:Ys[a],noun:`${o} device`,placeholder:a===`testmu`?`galaxy-s23`:`pixel7`,start:a===`testmu`?{type:`real`,platform:`android`}:{platform:`android`},meta:Qs}),(0,$.jsx)(G,{defs:Zs[a],edit:s,base:[]})]},a)})})}mn.add($s);var ec=(0,Q.lazy)(()=>m(()=>import(`./Features-D-HIDQqF.js`).then(e=>({default:()=>(0,$.jsx)(e.Features,{embedded:!0})})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]))),tc=(0,Q.lazy)(()=>m(()=>import(`./WhatsNew-BwV-yle3.js`).then(e=>({default:()=>(0,$.jsx)(e.WhatsNew,{embedded:!0})})),__vite__mapDeps([20,1,2,4,5,6,7,8,9,10,11,12,3,13,17,18,15,14,16,19]))),nc=or,rc=[...new Set(nc.map(e=>e.group))],ic=[`setup`,`environments`,`signins`,`secrets`,`integrations`,`notifications`,`appearance`,`voice`,`models`,`databases`,`features`,`whats-new`,`report`,`about`],ac=`forgeqe-settings-more`,oc={config:`forgeqe.yaml`,models:`llms.json`,environments:`the environment files`,guardrails:`guardrails.md`,grids:`the browser grid files`,secrets:`keys and passwords`};function sc(e,t){let n=e.paths.base.replace(/(?<![\\/])[\\/]+$/,``);return t.startsWith(`${n}/`)||t.startsWith(`${n}\\`)?`./${t.slice(n.length+1).replace(/\\/g,`/`)}`:t}function cc(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 lc={local:`This computer`,browserstack:`BrowserStack`,testmu:`TestMu AI`};function uc(e){let t=lc[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 dc=[{id:`setup`,label:`Set up`},{id:`models`,label:`Models`},{id:`evidence`,label:`Product knowledge`},{id:`appearance`,label:`Appearance`}],fc=e=>dc.find(t=>t.id===e)?.id??`setup`;function pc(){let[e,t]=(0,Q.useState)(null),[n,r]=(0,Q.useState)(null),[i,a]=(0,Q.useState)(``),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(null),_=(0,Q.useCallback)(()=>{a(``),be.settings().then(e=>{t(e),r(cc(e))},e=>a(e.message))},[]),v=(0,Q.useCallback)(()=>{a(``),De.state().then(e=>{h(e),e.ready&&_()},e=>a(e.message))},[_]);(0,Q.useEffect)(v,[v]);let y=e=>{e.project===m?.project&&e.ready||(t(null),r(null)),h(e),e.ready&&_()},b=!!m?.ready,x=e?cc(e):null,S=e=>!!n&&!!x&&!xn(n[e],x[e]),C=Object.keys(oc).filter(S);(0,Q.useEffect)(()=>{if(!C.length)return;let e=e=>e.preventDefault();return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[C.length]);let w=t=>({value:n[t],set:e=>{l(``),r(n=>({...n,[t]:e}))},vars:e.variables,...t===`config`?{file:`forgeqe.yaml`}:{}}),T=(0,Q.useRef)(n);T.current=n;let E=(0,Q.useRef)(e);E.current=e;let[D,O]=(0,Q.useState)(``),k=(0,Q.useRef)({}),A=(0,Q.useCallback)((e,t)=>{let n=k.current,r=Object.keys(n).find(t=>n[t]===e)??e;r===t?delete n[r]:n[r]=t},[]),j=(0,Q.useCallback)(async()=>{let e=T.current,n=E.current;if(!e||!n)return!0;let i=cc(n),a=Object.keys(oc).filter(t=>!xn(e[t],i[t]));if(!a.length)return!0;d(!0),s(``),p(!1);let o=n,c=(t,n)=>r(r=>{if(!r)return r;let i=cc(t),a={...r};for(let t of Object.keys(oc))if(t===`secrets`){if(!n)continue;a.secrets=Object.fromEntries(Object.entries(r.secrets).filter(([t,n])=>e.secrets[t]!==n))}else(n?xn(r[t],e[t]):xn(r[t],i[t]))&&(a[t]=i[t]);return a});try{for(let t of a)if(t===`secrets`)o=await be.saveSecrets(e.secrets);else if(t===`grids`)for(let[t,r]of Object.entries(e.grids))r&&!xn(r,i.grids[t])&&(o=await be.saveGrid(t,r,n.versions[`grid:${t}`]));else if(t===`models`){let r=i.models.models,a=e.models.models,s=Object.fromEntries(Object.entries(k.current).filter(([e,t])=>r&&a&&e in r&&!(e in a)&&t in a));o=await be.save(t,e[t],n.versions[t],s),k.current={}}else o=t===`guardrails`?await be.saveGuardrails(e.guardrails,n.versions.guardrails):await be.save(t,e[t],n.versions[t]);return t(o),c(o,!0),O(``),l(`Saved`),!0}catch(r){return s(r.message),p(r instanceof Ee&&r.status===409),O(JSON.stringify(e)),o!==n&&(t(o),c(o,!1)),!1}finally{d(!1)}},[]);(0,Q.useEffect)(()=>{if(!c)return;let e=setTimeout(()=>l(``),4e3);return()=>clearTimeout(e)},[c]);let M=n?JSON.stringify(n):``;return(0,Q.useEffect)(()=>{if(!C.length||u||f||D&&D===M)return;let e=C.every(e=>e===`secrets`),t=setTimeout(j,e?2e3:1e3);return()=>clearTimeout(t)},[M,u,f,D]),{snap:e,setSnap:t,drafts:n,setDrafts:r,loadError:i,saveError:o,saved:c,setSaved:l,saving:u,conflict:f,setup:m,ready:b,load:v,loadSettings:_,onSetup:y,base:x,dirty:S,dirtyFiles:C,edit:w,onRename:A,split:async()=>{s(``);try{let e=await be.splitEnvironments();t(e),r(cc(e)),l(`Each environment is now its own file in environments/. The old file is left as it is; ForgeQE no longer reads it.`)}catch(e){s(e.message)}},saveText:async(n,i,a)=>{s(``);try{let o=await be.saveText(n,i,a,e?.versions[n]);return t(o),r(cc(o)),l(`Saved ${oc[n]}.`),!0}catch(e){return s(e.message),!1}},errorBox:o?(0,$.jsxs)(`div`,{role:`alert`,className:g(z.fail,`flex w-full flex-wrap items-center gap-4 leading-relaxed`),children:[(0,$.jsx)(`span`,{className:`flex-[1_1_260px] [overflow-wrap:anywhere]`,children:o}),f?(0,$.jsxs)(V,{size:`sm`,onClick:()=>{p(!1),s(``),O(``),v()},"data-tip":`Reload, and lose my unsaved changes`,children:[(0,$.jsx)(rn,{"aria-hidden":`true`}),`Reload`]}):(0,$.jsxs)(`span`,{className:`flex gap-2`,children:[C.length>0&&(0,$.jsxs)(V,{size:`sm`,onClick:()=>{r(x),k.current={},s(``),O(``)},"data-tip":`Undo my change`,children:[(0,$.jsx)(Be,{"aria-hidden":`true`}),`Undo`]}),(0,$.jsxs)(V,{size:`sm`,onClick:()=>{s(``),O(``),j()},children:[(0,$.jsx)(Je,{"aria-hidden":`true`}),`Retry`]})]})]}):null,secrets:{pending:n?.secrets||{},set:(e,t)=>{l(``),r(n=>{let r={...n.secrets};return t===void 0?delete r[e]:r[e]=t,{...n,secrets:r}})},saved:new Set(e?.saved||[]),vars:e?.variables||{},store:e?.store||`the credential store`},resetNotes:(0,Q.useCallback)(()=>{l(``),s(``),p(!1)},[]),save:j}}function mc({id:e,store:t,guide:n=!1,section:r}){let{snap:a,drafts:o,setDrafts:s,setSaved:c,setup:l,onSetup:u,edit:d,dirty:f,loadSettings:p,onRename:m,split:h,saveText:_}=t,v=t.setSnap,y={id:e},b=n?`setup`:void 0,x=null;if(y.id===`setup`)x=l&&(0,$.jsx)(eo,{state:l,onState:u,guide:b!==void 0});else if(a&&o){let e=(y.id===`models`||y.id===`routing`?[`models`,`config`]:y.id===`environments`?[`environments`,`config`]:[`files`,`guardrails`,`prompts`,`logs`,`audit`,`generated`,`about`,`report`,`features`,`whats-new`].includes(y.id)?[]:[`config`]).find(e=>a.errors[e]);switch(y.id){case`models`:x=(0,$.jsx)(Yi,{config:d(`config`),models:d(`models`),vars:a.variables,onReload:p,onRename:m});break;case`environments`:x=(0,$.jsx)(Di,{envs:d(`environments`),layout:a.paths.environments,files:a.raw.environments,base:a.paths.base,onSplit:h,config:d(`config`),splitBlocked:f(`environments`)||f(`config`)?`Save or discard your changes to the environments and forgeqe.yaml first.`:``});break;case`browser`:x=(0,$.jsx)(hr,{groups:Dr,edit:d(`config`)});break;case`appearance`:x=(0,$.jsx)($o,{config:d(`config`)});break;case`voice`:x=(0,$.jsx)(is,{});break;case`observability`:x=(0,$.jsx)(ds,{});break;case`routing`:x=(0,$.jsx)(na,{config:d(`config`),models:d(`models`)});break;case`generated`:x=(0,$.jsx)(_o,{});break;case`about`:x=(0,$.jsx)(mo,{});break;case`features`:case`whats-new`:x=(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(`p`,{className:`m-0 text-body-sm text-muted`,children:`Opening…`}),children:y.id===`features`?(0,$.jsx)(ec,{}):(0,$.jsx)(tc,{})});break;case`report`:x=(0,$.jsx)(wo,{});break;case`notifications`:case`mcp`:x=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ya,{view:y.id,edit:d(`config`),grids:o.grids,setGrids:e=>s(t=>({...t,grids:e})),gridPaths:{browserstack:sc(a,a.grids.browserstack.file),testmu:sc(a,a.grids.testmu.file)}}),y.id===`notifications`&&(0,$.jsx)(ho,{})]});break;case`parallel`:x=(0,$.jsx)(hr,{groups:Or,edit:d(`config`)});break;case`mobile`:x=(0,$.jsxs)(X,{children:[(0,$.jsx)(hr,{groups:Er,edit:d(`config`)}),(0,$.jsx)(K,{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)(fr,{edit:d(`config`),base:[`mobile`,`devices`],defs:Ar,noun:`device`,placeholder:`pixel8`,start:{type:`virtual`,platform:`android`},meta:uc}),(0,$.jsx)($s,{grids:o.grids,setGrids:e=>{c(``),s(t=>({...t,grids:e}))},paths:{browserstack:sc(a,a.grids.browserstack.file),testmu:sc(a,a.grids.testmu.file)},vars:a.variables}),(0,$.jsx)(hr,{groups:Wr,edit:d(`config`),continued:!0})]});break;case`desktop`:x=(0,$.jsx)(hr,{groups:Ur,edit:d(`config`)});break;case`containers`:x=(0,$.jsxs)(X,{children:[(0,$.jsx)(hr,{groups:kr.slice(0,1),edit:d(`config`)}),(0,$.jsx)(K,{help:`Each one ForgeQE may start, stop and read: a database, a queue, the API under test.`,children:`Services`}),(0,$.jsx)(fr,{edit:d(`config`),base:[`containers`,`services`],defs:Gr,noun:`service`,placeholder:`db`,meta:e=>[e.image,Array.isArray(e.ports)?`ports ${e.ports.join(`, `)}`:``].filter(Boolean).map(String).join(`, `)}),(0,$.jsx)(hr,{groups:kr.slice(1),edit:d(`config`),continued:!0})]});break;case`databases`:x=(0,$.jsxs)(kn,{children:[(0,$.jsx)(K,{first:!0,icon:Ct,help:`What the agents may query. Read only unless one is marked writable.`,children:`Databases`}),(0,$.jsx)(fr,{edit:d(`config`),base:[`databases`],defs:Fr,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`:x=(0,$.jsx)(xr,{edit:d(`config`)});break;case`secrets`:x=(0,$.jsx)(Vs,{show:r===`repo-tokens`?`tokens`:void 0});break;case`integrations`:x=(0,$.jsx)(ya,{edit:d(`config`),grids:o.grids,setGrids:e=>{c(``),s(t=>({...t,grids:e}))},gridPaths:{browserstack:sc(a,a.grids.browserstack.file),testmu:sc(a,a.grids.testmu.file)}});break;case`tests`:x=(0,$.jsx)(hr,{groups:Vr,edit:d(`config`)});break;case`runs`:x=(0,$.jsxs)(X,{children:[(0,$.jsx)(hr,{groups:wr,edit:d(`config`)}),(0,$.jsx)(hr,{groups:Br,edit:d(`config`),continued:!0}),(0,$.jsx)(K,{help:`Each one a table of the project report: forgeqe.<name>.`,children:`Report datasets`}),(0,$.jsx)(fr,{edit:d(`config`),base:[`bi`,`datasets`],defs:Pr,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`:x=(0,$.jsx)(hr,{groups:Kr,edit:d(`config`)});break;case`evidence`:x=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Cs,{edit:d(`config`)}),(0,$.jsx)(go,{})]});break;case`agents`:x=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(hr,{groups:Lr,edit:d(`config`)}),(0,$.jsx)(To,{config:d(`config`)})]});break;case`guardrails`:x=(0,$.jsx)(ka,{rules:o.guardrails,others:a.guardrails.filter(e=>!e.editable),onChange:e=>s({...o,guardrails:e}),onChanged:e=>(c(e),be.settings().then(v,()=>{}))});break;case`monitor`:x=(0,$.jsx)(Ea,{edit:d(`config`)});break;case`skills`:x=(0,$.jsx)(di,{edit:d(`config`)});break;case`prompts`:x=(0,$.jsx)(ci,{onChanged:c});break;case`registry`:x=(0,$.jsx)(gn,{edit:d(`config`)});break;case`logs`:x=(0,$.jsx)(Bn,{});break;case`audit`:x=(0,$.jsx)(yn,{});break;case`tokenomics`:x=(0,$.jsx)(dn,{edit:d(`config`)});break;case`files`:x=(0,$.jsx)(gr,{snap:a,dirty:{config:f(`config`),models:f(`models`),environments:f(`environments`)},onSave:_})}e&&(x=(0,$.jsxs)(`p`,{role:`alert`,className:g(z.fail,`m-0 leading-relaxed`),children:[e===`environments`?`An environment file`:oc[e],` does not parse, so the form cannot show it: `,a.errors[e],`. Fix it in `,(0,$.jsx)(`a`,{href:i(`settings`,`files`),children:`Settings as text`}),`.`]}))}return(0,$.jsx)($.Fragment,{children:x})}function hc({store:e,className:t}){let{errorBox:n,saveError:r,dirtyFiles:i,saving:a,saved:o}=e;return(0,$.jsxs)(`div`,{className:g(`sticky bottom-4 z-10 flex flex-col items-end gap-2`,t),children:[n,(0,$.jsx)(`div`,{"aria-live":`polite`,className:`contents`,children:!r&&(i.length>0||a||o)&&(0,$.jsx)(`span`,{className:g(`rounded-md border border-overlay-line bg-overlay p-2 text-ink shadow-menu backdrop-blur-[16px]`,`inline-flex items-center gap-2 text-body-sm`,i.length||a?`text-ink-2`:`text-pass`),children:i.length||a?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ze,{state:`working`,px:16}),`Saving…`]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Jt,{size:14,"aria-hidden":`true`}),o]})})})]})}function gc({section:e,only:t,guide:n}){let r=n===void 0?void 0:fc(n),a=r??t??e,{theme:o}=re(),c=pc(),{snap:l,drafts:u,loadError:d,setup:f,ready:p,load:m,secrets:h,resetNotes:_}=c,[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(``),D=(0,Q.useCallback)(async()=>{if(!(await De.state()).ready)return!1;let e=await De.machine();return e.engine&&e.runtime},[]);(0,Q.useEffect)(()=>{r!==void 0&&_e.status().then(e=>{y(e.state),x(!0)},()=>x(!0))},[r]),(0,Q.useEffect)(()=>{r!==void 0&&D().then(C,()=>C(!1))},[r,f,D]),(0,Q.useEffect)(()=>E(``),[r]),(0,Q.useEffect)(()=>{if(r!==`setup`||S)return;let e=hn(()=>void D().then(C,()=>{}),2500);return()=>fn(e)},[r,S,D]);let O=async(e,t)=>{E(``);try{if(e===`done`){await _e.save({done:!0,step:`done`,...t?{skip:t}:{}}),location.hash=i();return}let n=await _e.save({step:e,...t?{skip:t}:{}});y(n.state),location.hash=i(`welcome`,e)}catch(e){E(e.message)}},k=async()=>{if(await D().catch(()=>!1))return O(`done`);r!==`setup`&&(location.hash=i(`welcome`,`setup`)),E(`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?f&&!p&&a!==`setup`?location.replace(i(`settings`,`setup`)):!t&&a&&ue.includes(a)?location.replace(i(a)):!t&&a&&Sr(a)&&sr(a,!0):r!==`setup`&&f&&!p&&location.replace(i(`welcome`,`setup`))},[f,p,a]);let A=(f&&!p?de[0]:de.find(e=>e.id===(a===`repo-tokens`?`secrets`:a)))||de.find(e=>e.id===`models`),[j,M]=(0,Q.useState)(()=>{try{return localStorage.getItem(ac)===`open`}catch{return!1}}),N=e=>{M(e);try{localStorage.setItem(ac,e?`open`:`closed`)}catch{}};(0,Q.useEffect)(_,[A.id,_]);let P=f&&(A.id===`setup`||l&&u)?(0,$.jsx)(mc,{id:A.id,store:c,guide:r!==void 0,section:a}):null;return(0,$.jsx)(Xn.Provider,{value:h,children:(0,$.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col bg-canvas`,children:[(0,$.jsx)(Jn,{}),(0,$.jsxs)(`main`,{className:g(`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:g(`theme-side theme-side--wide w-full flex-col gap-4 px-4 pt-6 pb-4 sm:sticky sm:top-0 sm:h-(--screen) sm:w-[248px] sm:flex-none sm:overflow-y-auto`,t?`hidden`:`flex`),children:r===void 0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Le,{href:i(),label:o.name||`ForgeQE`,className:`px-2`}),(0,$.jsx)(`p`,{className:`m-0 px-2 pt-1 text-body-lg font-medium`,children:`Settings`}),(0,$.jsx)(xc,{ready:p}),(0,$.jsx)(`label`,{htmlFor:`section-pick`,className:`sr-only`,children:`Section`}),(0,$.jsx)(s,{id:`section-pick`,value:A.id,onChange:e=>location.hash=i(`settings`,e.target.value),className:`sm:hidden`,children:rc.map(e=>(0,$.jsx)(`optgroup`,{label:e,children:nc.filter(t=>t.group===e).map(e=>(0,$.jsx)(`option`,{value:e.id,disabled:!p&&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)(yc,{sections:nc.filter(e=>ic.includes(e.id)),current:A.id,locked:!!f&&!p}),(0,$.jsx)(bc,{open:j||!ic.includes(A.id),onToggle:()=>N(!j),children:(0,$.jsx)(yc,{sections:nc.filter(e=>!ic.includes(e.id)),current:A.id,locked:!!f&&!p})})]})]}):(0,$.jsx)(vc,{step:r,skipped:v?.skipped??[],open:S,onSkip:()=>void k()})}),(0,$.jsxs)(`section`,{"aria-labelledby":`sec-h`,className:g(`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)($.Fragment,{children:[(0,$.jsx)(Fe,{className:`mb-4`}),(0,$.jsxs)(`div`,{className:`mb-1 flex items-center gap-4`,children:[(0,$.jsx)(pn,{icon:A.icon,pixel:w[A.id],size:`lg`}),(0,$.jsx)(`h1`,{id:`sec-h`,className:`m-0 font-home text-headline-lg`,children:A.label})]})]}):(0,$.jsxs)(`h1`,{id:`sec-h`,className:`m-0 mb-2 flex items-center gap-4 font-home text-headline-lg`,children:[(0,$.jsx)(Me,{icon:A.icon,size:22,className:`flex-none text-icon`}),A.label]}),(0,$.jsxs)(`p`,{className:`mt-0 mb-8 text-body-sm leading-relaxed text-ink-2`,children:[A.intro,A.file&&l&&(0,$.jsxs)($.Fragment,{children:[` `,`Saved in `,(0,$.jsx)(`span`,{className:`font-mono text-body-sm`,children:A.file}),`.`]})]}),d&&(0,$.jsxs)(`div`,{role:`alert`,className:g(`surface rounded-lg bg-bg p-6 shadow-sm`,`flex flex-col items-start gap-4 p-6`),children:[(0,$.jsx)(`p`,{className:`m-0 leading-relaxed text-ink-2`,children:d}),(0,$.jsxs)(V,{size:`sm`,onClick:m,children:[(0,$.jsx)(Je,{"aria-hidden":`true`}),`Retry`]})]}),f&&!p&&(0,$.jsxs)(`p`,{className:g(z.info,`mt-0 mb-6 flex items-start gap-2 leading-relaxed`),children:[(0,$.jsx)(jt,{size:16,"aria-hidden":`true`,className:`mt-1 flex-none text-icon`}),`The other sections open once ForgeQE is set up in a project folder: choose the folder, then Set up.`]}),!d&&(!f||A.id!==`setup`&&!l)&&(0,$.jsx)(`p`,{role:`status`,className:`m-0 text-body-sm text-muted`,children:`Loading settings…`}),(0,$.jsx)(`div`,{"data-tour":`section`,className:`settings-body flex flex-col gap-6`,children:P}),r!==void 0&&f&&b&&(0,$.jsx)(Ka,{welcome:v===null||Ua(),onStart:_c,step:r,ready:p,coreReady:S,onGo:(e,t)=>void O(e,t),onSkipAll:()=>void k(),onFinish:()=>void O(`done`),note:T},r),(0,$.jsx)(hc,{store:c,className:`mt-8`})]})]})]})})}var _c=()=>{Wa(),_e.save({step:`setup`}).catch(()=>{})};function vc({step:e,skipped:t,open:n,onSkip:r}){let a=dc.findIndex(t=>t.id===e);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`m-0 px-2 pt-1 text-body-lg font-medium`,children:`Getting started`}),(0,$.jsx)(`p`,{className:`m-0 px-2 text-body-sm 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:dc.map((r,s)=>{let c=de.find(e=>e.id===r.id),l=s>0&&!n,u=r.id===e,d=s<a&&!t.includes(r.id);return(0,$.jsx)(`li`,{children:l?(0,$.jsxs)(`span`,{"aria-disabled":`true`,"data-tip":`After Set up`,className:`flex min-h-8 cursor-not-allowed items-center gap-2 rounded-sm px-2 text-body-sm text-muted opacity-60`,children:[(0,$.jsx)(Me,{icon:c.icon,size:16,className:`flex-none`}),(0,$.jsx)(`span`,{className:`flex-1`,children:r.label}),(0,$.jsx)(jt,{size:13,"aria-label":`Locked`,className:`flex-none`})]}):(0,$.jsxs)(`a`,{href:i(`welcome`,r.id),"aria-current":u?`step`:void 0,className:g(o,`group min-h-8 gap-2 px-2 py-0`,u?`font-medium`:`text-ink-2`),children:[(0,$.jsx)(Me,{icon:c.icon,size:16,className:g(`flex-none`,u?`text-ink`:`text-muted group-hover:text-ink`)}),(0,$.jsx)(`span`,{className:`flex-1`,children:r.label}),d&&(0,$.jsx)(Jt,{size:13,"aria-label":`Done`,className:`flex-none text-pass`}),t.includes(r.id)&&!u&&(0,$.jsx)(`span`,{className:`text-body-sm text-muted`,children:`Skipped`})]})},r.id)})})}),(0,$.jsxs)(V,{variant:`ghost`,size:`sm`,className:`self-start`,type:`button`,onClick:r,children:[(0,$.jsx)(U,{size:14,"aria-hidden":`true`}),`Skip onboarding`]})]})}function yc({sections:e,current:t,locked:n}){let r=[...new Set(e.map(e=>e.group))];return(0,$.jsx)($.Fragment,{children:r.map(r=>{let a=`group-${r}-${e[0]?.id}`;return(0,$.jsxs)(`div`,{role:`group`,"aria-labelledby":a,className:`flex flex-col gap-px`,children:[(0,$.jsx)(`span`,{id:a,className:`px-2 pt-1 pb-1 text-body-sm 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:g(Yn,`cursor-not-allowed text-muted opacity-60`),children:[(0,$.jsx)(Me,{icon:e.icon,size:16,className:`flex-none`}),(0,$.jsx)(`span`,{className:`flex-1`,children:e.label}),(0,$.jsx)(jt,{size:13,"aria-label":`Locked`,className:`flex-none`})]},e.id):(0,$.jsxs)(`a`,{href:i(`settings`,e.id),"aria-current":t===e.id?`page`:void 0,className:g(Yn,Mn(t===e.id)),children:[(0,$.jsx)(Me,{icon:e.icon,size:16,className:`flex-none text-icon`}),e.label]},e.id))]},r)})})}function bc({open:e,onToggle:t,children:n}){return(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 pt-2`,children:[(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":e,"aria-controls":`settings-more`,onClick:t,className:g(o,`min-h-7 gap-1 px-2 py-0 font-medium text-muted`),children:[(0,$.jsx)(`span`,{className:`flex-1`,children:`More settings`}),(0,$.jsx)(it,{size:14,strokeWidth:2,"aria-hidden":`true`,className:g(`flex-none transition-transform duration-200`,e&&`rotate-90`)})]}),(0,$.jsx)(Dn,{open:e,id:`settings-more`,children:(0,$.jsx)(`div`,{className:`flex flex-col gap-4`,children:n})})]})}function xc({ready:e}){let[t,n]=(0,Q.useState)(``),r=t.toLowerCase().split(/\s+/).filter(Boolean),o=e=>de.find(t=>t.id===e)?.label||e,s=r.length?Hr.filter(e=>r.every(t=>`${e.label} ${e.key} ${o(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)(a,{size:`sm`,id:`find-setting`,type:`search`,value:t,disabled:!e,placeholder:`Search settings`,"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:[s.length===0&&(0,$.jsx)(`li`,{className:`px-2 py-2 text-body-sm text-muted`,children:`Nothing called that. Every key can also be edited in Settings as text.`}),s.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`a`,{href:Sr(e.section)?ur(e.section):i(`settings`,e.section),onClick:t=>{n(``),Sr(e.section)&&(t.preventDefault(),sr(e.section))},className:g(`flex w-full min-h-11 cursor-pointer items-center gap-4 rounded-base border-0 bg-transparent px-4 py-2 text-left text-body-sm text-ink no-underline transition-colors duration-150 hover:bg-tint hover:text-ink aria-[current]:bg-tint-hover aria-selected:bg-tint-hover aria-pressed:bg-tint-hover aria-checked:bg-tint-hover has-[:checked]:bg-tint-hover disabled:cursor-not-allowed disabled:opacity-50`,`min-h-0 flex-col items-start gap-0 px-2`),children:[(0,$.jsx)(`span`,{className:`text-body-sm`,children:e.label}),(0,$.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[o(e.section),Sr(e.section)?`, on ${cr(e.section)}`:``,` · `,(0,$.jsx)(`code`,{className:`font-mono text-body-sm`,children:e.key})]})]})},`${e.section}:${e.key}`))]})]})}export{ic as COMMON_SECTIONS,dc as GUIDE_STEPS,de as SECTIONS,ue as SIDEBAR_SECTIONS,hc as SaveNotes,mc as SectionBody,gc as Settings,ci as i,ta as n,di as r,ka as t,pc as useSettingsStore};
|