@capagents/forgeqe 2.6.5 → 2.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/HOW_TO_USE.md +6 -3
  2. package/dist/docs-site/docs/architecture/index.html +1 -1
  3. package/dist/docs-site/docs/index.html +6 -3
  4. package/dist/docs-site/docs/search.js +1 -1
  5. package/dist/docs-site/docs/web-app/index.html +4 -1
  6. package/dist/forgeqe.js +1470 -1468
  7. package/dist/template.html +68 -68
  8. package/dist/web/assets/{Agent-DnSnk8A8.js → Agent-DEt3EWA_.js} +3 -3
  9. package/dist/web/assets/ApiTests-DYdaFLNz.js +10 -0
  10. package/dist/web/assets/Chat-CKxzWgEC.js +3 -0
  11. package/dist/web/assets/{Data-zWPzpJpS.js → Data-DityccKX.js} +1 -1
  12. package/dist/web/assets/{Evidence-LEqF3nUt.js → Evidence-B-LwSbo6.js} +1 -1
  13. package/dist/web/assets/{Features-Bgo9qp1-.js → Features-DCT-cbJc.js} +1 -1
  14. package/dist/web/assets/Jobs-DeTQrrks.js +5 -0
  15. package/dist/web/assets/KindPage-_X13FTTE.js +6 -0
  16. package/dist/web/assets/Migration-fmIj_G3z.js +2 -0
  17. package/dist/web/assets/{Product-FEoKmnjo.js → Product-D-WBRE7V.js} +1 -1
  18. package/dist/web/assets/{Quality-DCZXDZOe.js → Quality-CGVs0dP9.js} +1 -1
  19. package/dist/web/assets/{Record-B2wCMjZD.js → Record-BxvtM3w6.js} +2 -2
  20. package/dist/web/assets/Regression-DMzaMaHl.js +5 -0
  21. package/dist/web/assets/{Reports-DccvSnM0.js → Reports-DcOPRMjx.js} +1 -1
  22. package/dist/web/assets/{Response-1L54PHOc.js → Response-C6MFROng.js} +1 -1
  23. package/dist/web/assets/{Runs-CxBqtEcI.js → Runs-Bzt7oS2o.js} +1 -1
  24. package/dist/web/assets/Shell-C-_iUijV.js +3 -0
  25. package/dist/web/assets/{TestCases-Cnoe8tSS.js → TestCases-COdZhCPY.js} +1 -1
  26. package/dist/web/assets/{TestData-BeYAygIt.js → TestData-BorHzvQT.js} +1 -1
  27. package/dist/web/assets/{WhatsNew-CI0LQ45V.js → WhatsNew-Bc9JhLJC.js} +1 -1
  28. package/dist/web/assets/{arrow-down-DSu4Dagx.js → arrow-down-OOnlMKAE.js} +1 -1
  29. package/dist/web/assets/{arrow-right-Ts-WXM9E.js → arrow-right-B3tcUlkA.js} +1 -1
  30. package/dist/web/assets/circle-8GDOF-jD.js +1 -0
  31. package/dist/web/assets/{circle-dashed-DrntJOQb.js → circle-dashed-kZh6s667.js} +1 -1
  32. package/dist/web/assets/{circle-dot-DnHcdiDL.js → circle-dot-B5NyEMK3.js} +1 -1
  33. package/dist/web/assets/{dataParts-3r2pCk9l.js → dataParts-C9gI1SAK.js} +1 -1
  34. package/dist/web/assets/{index-CUL4L1Mc.js → index-BxNs3KZC.js} +25 -25
  35. package/dist/web/assets/index-o-gUBlx9.css +2 -0
  36. package/dist/web/assets/{keyboard-DasQ_iKX.js → keyboard-Chpodklu.js} +1 -1
  37. package/dist/web/assets/{pencil-DGS0VPko.js → pencil-BKPpdCqf.js} +1 -1
  38. package/dist/web/assets/{productParts-CZORYXa1.js → productParts-RYNeN2sM.js} +1 -1
  39. package/dist/web/assets/{qualityParts-BL7Mmsao.js → qualityParts-BtCR-0Bc.js} +1 -1
  40. package/dist/web/assets/{thread-BuTNjR0M.js → thread-BVeiwKSf.js} +2 -2
  41. package/dist/web/assets/{upload-Dp3RevwG.js → upload-A3zIIPtY.js} +1 -1
  42. package/dist/web/assets/{usePageChat-iWpW3cZo.js → usePageChat-D-iqArIy.js} +1 -1
  43. package/dist/web/index.html +3 -3
  44. package/docs/ARCHITECTURE.md +1 -1
  45. package/docs/WEB_APP.md +4 -1
  46. package/docs/user-guide.html +6 -3
  47. package/forgeqe.example.yaml +1 -1
  48. package/package.json +1 -1
  49. package/dist/web/assets/ApiTests-r6c8xggS.js +0 -10
  50. package/dist/web/assets/Chat-MqHZCQeC.js +0 -3
  51. package/dist/web/assets/Jobs-Bcwb8HMh.js +0 -5
  52. package/dist/web/assets/KindPage-lAkUjTIP.js +0 -6
  53. package/dist/web/assets/Migration-BjGJA-Bs.js +0 -2
  54. package/dist/web/assets/Regression-D01mVc1q.js +0 -5
  55. package/dist/web/assets/Shell--wVGpLnJ.js +0 -3
  56. package/dist/web/assets/circle-DCKdGe8K.js +0 -1
  57. package/dist/web/assets/index-DchZ3sW9.css +0 -2
@@ -1 +1 @@
1
- import{Bn as e,Bt as t,Cn as n,Di as r,Dr as i,En as a,Ht as o,In as s,Lr as c,Mn as l,Mr as u,Pn as d,Si as f,Un as p,Wt as m,Yt as h,Zr as g,Zt as _,an as v,at as y,cn as b,cr as x,ct as S,et as C,kn as w,kr as T,ln as E,mn as D,n as ee,nn as O,oi as te,ot as ne,pn as k,ri as A,st as j,ui as re,vn as M,vr as N,vt as P,w as F,wi as ie,xt as ae,yt as I}from"./Shell--wVGpLnJ.js";import{t as L}from"./arrow-right-Ts-WXM9E.js";import{t as oe}from"./circle-dashed-DrntJOQb.js";import{t as R}from"./circle-dot-DnHcdiDL.js";import{G as z,H as B,t as V,z as H}from"./index-CUL4L1Mc.js";import{t as se}from"./when-CHnpLdYw.js";import{a as U,i as W,n as ce,o as le,r as G,t as ue}from"./productParts-CZORYXa1.js";var de={name:`corner-down-right`,size:24,node:[[`path`,{d:`m15 10 5 5-5 5`,key:`qqa56n`}],[`path`,{d:`M4 4v7a4 4 0 0 0 4 4h12`,key:`z08zvw`}]]};de.node;var fe=c(de),K=r(ie(),1),q={w:196,h:60},J=56,pe=24,me=36,Y=18,he=30,X=8,Z=12,ge=14,_e=6;function ve(e,t=8){let n=e=>Math.round(e*10)/10,r=`M${n(e[0][0])} ${n(e[0][1])}`;for(let i=1;i<e.length-1;i++){let[a,o]=e[i-1],[s,c]=e[i],[l,u]=e[i+1],d=Math.min(t,Math.hypot(s-a,c-o)/2),f=Math.min(t,Math.hypot(l-s,u-c)/2),p=s-Math.sign(s-a)*d,m=c-Math.sign(c-o)*d,h=s+Math.sign(l-s)*f,g=c+Math.sign(u-c)*f;r+=` L${n(p)} ${n(m)} Q${n(s)} ${n(c)} ${n(h)} ${n(g)}`}let[i,a]=e[e.length-1];return`${r} L${n(i)} ${n(a)}`}function ye(e){let t=[];for(let n of e){let e=t[t.length-1];e&&Math.abs(e[0]-n[0])<.01&&Math.abs(e[1]-n[1])<.01||t.push(n)}return t.filter((e,n)=>{if(n===0||n===t.length-1)return!0;let[r,i]=[t[n-1],t[n+1]];return!(Math.abs(r[0]-e[0])<.01&&Math.abs(i[0]-e[0])<.01||Math.abs(r[1]-e[1])<.01&&Math.abs(i[1]-e[1])<.01)})}function be(e,t,n,r){let i=r?e.filter(e=>e.band===r):[],a=n.filter(t=>e.some(e=>e.band===t)),o=new Set([...e.filter(e=>a.includes(e.band)).map(e=>e.id),...i.map(e=>e.id)]),s=t.filter(e=>o.has(e.from)&&o.has(e.to)&&e.from!==e.to),c=new Set(i.map(e=>e.id)),l=new Map;for(let e of s)l.set(e.from,[...l.get(e.from)||[],e.to]),l.set(e.to,[...l.get(e.to)||[],e.from]);let u=new Map(a.map(t=>[t,e.filter(e=>e.band===t).map(e=>e.id)])),d=new Map,f=e=>u.get(e).forEach((e,t,n)=>d.set(e,n.length>1?t/(n.length-1):.5)),p=(e,t)=>{let n=u.get(e),r=(e,r)=>{let i=(l.get(e)||[]).filter(e=>t(e)&&d.has(e)).map(e=>d.get(e));return i.length?i.reduce((e,t)=>e+t,0)/i.length:n.length>1?r/(n.length-1):.5},i=n.map((e,t)=>({id:e,k:r(e,t),i:t}));i.sort((e,t)=>e.k-t.k||e.i-t.i),u.set(e,i.map(e=>e.id)),f(e)};a.forEach(f);let m=new Map(e.map(e=>[e.id,e.band])),h=e=>t=>a.indexOf(m.get(t))<a.indexOf(e),g=e=>t=>a.indexOf(m.get(t))>a.indexOf(e);a.slice(1).forEach(e=>p(e,h(e))),a.slice(0,-1).reverse().forEach(e=>p(e,g(e)));let _=Math.max(1,...a.map(e=>u.get(e).length)),v=Math.min(_,_e),y=[];for(let e of a){let t=u.get(e);for(let n=0;n<t.length;n+=v)y.push({band:e,ids:t.slice(n,n+v)})}let b=new Map;y.forEach((e,t)=>e.ids.forEach(e=>b.set(e,t)));let x=v*q.w+(v-1)*J,S=new Map,C=y.map(e=>{let t=e.ids.length*q.w+(e.ids.length-1)*J,n=(x-t)/2;return e.ids.forEach((e,t)=>S.set(e,n+t*(q.w+J))),{left:n,right:n+t}}),w=e=>S.get(e)+q.w/2,T=[],E=(e,t,n)=>{for(let r=t;r<=n;r++)for(let t of y[r].ids)if(e>S.get(t)-6&&e<S.get(t)+q.w+6)return!1;return!0};s.forEach((e,t)=>{let n=c.has(e.to)&&!c.has(e.from),r=c.has(e.from)&&!c.has(e.to);if(c.has(e.from)&&c.has(e.to))return;let i=r?{from:e.to,to:e.from}:e,a=b.get(i.from);if(n||r){T.push({e,i:t,reverse:r,out:{side:`bottom`,node:i.from,edge:t},inn:{side:`left`,node:i.to,edge:t},c1:a+1,c2:a+1,toSide:!0});return}let o=b.get(i.to),s=a<=o,l={side:a<o||a===o?`bottom`:`top`,node:i.from,edge:t},u={side:a<o?`top`:`bottom`,node:i.to,edge:t},d=s?a+1:a,f=a<o?o:o+1,p;if(d!==f){let[e,t]=d<f?[d,f-1]:[f,d-1],n=(w(i.from)+w(i.to))/2,r=new Set;for(let n=e;n<=t;n++)y[n].ids.forEach((e,t)=>t>0&&r.add(S.get(e)-J/2)),r.add(C[n].left-J/2),r.add(C[n].right+J/2);let a=[...r].filter(n=>n>-29&&n<x+J/2+1&&E(n,e,t)).sort((e,t)=>Math.abs(e-n)-Math.abs(t-n));p=a.length?a[0]:`gutter`}T.push({e,i:t,reverse:!1,out:l,inn:u,c1:d,c2:f,corridor:p,toSide:!1})});let D=e=>{let t=new Map;for(let n of T)for(let r of e(n))t.set(r,[...t.get(r)||[],n]);return t},ee=e=>w(e.toSide&&e.reverse?e.e.to:e.e.from),O=D(e=>e.c1===e.c2?[e.c1]:[e.c1,e.c2]);for(let[,e]of O)e.sort((e,t)=>ee(e)-ee(t));let te=D(e=>typeof e.corridor==`number`?[e.corridor]:[]),ne=T.filter(e=>e.corridor===`gutter`),k=T.filter(e=>e.toSide),A=(e,t)=>{if(!e)return 0;let n=e.length;return(e.indexOf(t)-(n-1)/2)*X},j=y.length,re=e=>{let t=16+(O.get(e)?.length||0)*X;return e===j?Math.max(28,t):y[e-1].band===y[e].band?Math.max(he,t):Math.max(72,t+24)},M=[],N=[],P=48;for(let e=0;e<j;e++){M.push(P),P+=q.h;let t=re(e+1);e+1<j&&y[e].band!==y[e+1].band?N[e+1]=P+Y+(t-Y-me)/2:N[e+1]=P+t/2,P+=t}let F=M[j-1]+q.h+re(j),ie=ne.length?16+ne.length*X:0,ae=Z+ie+pe,I=Z+ie,L=x+48,oe=k.length?20+k.length*X:0,R=I+L+Math.max(oe,24),z=new Map;y.forEach((e,t)=>e.ids.forEach(n=>z.set(n,{id:n,band:e.band,x:ae+S.get(n),y:M[t],w:q.w,h:q.h})));let B=[];for(let e of a){let t=y.map((e,t)=>({r:e,i:t})).filter(t=>t.r.band===e),n=M[t[0].i]-me,r=M[t[t.length-1].i]+q.h+Y;B.push({id:e,x:I,y:n,w:L,h:r-n})}let V=0;if(r&&i.length){let e=e=>{let t=(l.get(e)||[]).filter(e=>z.has(e)).map(e=>z.get(e).y);return t.length?t.reduce((e,t)=>e+t,0)/t.length:1/0},t=i.map((t,n)=>({id:t.id,k:e(t.id),i:n})).sort((e,t)=>e.k-t.k||e.i-t.i),n=Z,a=48;for(let e of t){let t=Math.max(a,Number.isFinite(e.k)?e.k:a);z.set(e.id,{id:e.id,band:r,x:R+pe,y:t,w:q.w,h:q.h}),a=t+q.h+ge}V=a-ge+Y;let o=Math.max(V,F-10)-n;B.push({id:r,x:R,y:n,w:q.w+48,h:o}),V=n+o}let H=new Map;for(let e of T)for(let t of[e.out,e.inn])H.set(`${t.node}|${t.side}`,[...H.get(`${t.node}|${t.side}`)||[],t]);let se=e=>{let t=T.find(t=>t.i===e.edge),n=t.reverse?{from:t.e.to,to:t.e.from}:t.e,r=e.node===n.from?n.to:n.from,i=z.get(r);return e.side===`left`?i.y:i.x};for(let[,e]of H)e.sort((e,t)=>se(e)-se(t));let U=e=>{let t=z.get(e.node),n=H.get(`${e.node}|${e.side}`),r=n.indexOf(e),i=n.length;if(e.side===`left`)return[t.x,t.y+t.h*(r+1)/(i+1)];let a=Math.min(t.w*.7,i*22);return[t.x+t.w/2-a/2+(i===1?a/2:a*r/(i-1)),e.side===`top`?t.y:t.y+t.h]},W=[];for(let e of T){let t=U(e.out),n=U(e.inn),r=N[e.c1]+A(O.get(e.c1),e),i;if(e.toSide){let a=I+L+12+k.indexOf(e)*X;i=[t,[t[0],r],[a,r],[a,n[1]],n]}else if(e.c1===e.c2)i=[t,[t[0],r],[n[0],r],n];else{let a=N[e.c2]+A(O.get(e.c2),e),o=e.corridor===`gutter`?20+ne.indexOf(e)*X:ae+e.corridor+A(te.get(e.corridor),e);i=[t,[t[0],r],[o,r],[o,a],[n[0],a],n]}i=ye(i),e.reverse&&i.reverse(),W.push({index:e.i,from:e.e.from,to:e.e.to,points:i,d:ve(i)})}return{w:r&&i.length?R+q.w+48+Z:I+L+Math.max(oe,0)+Z,h:Math.max(F,V)+Z,boxes:z,bands:B,wires:W}}var Q=f(),xe=[{id:`front`,label:`Front ends`,icon:p,hue:`#0B6E4F`},{id:`gateway`,label:`Gateways`,icon:D,hue:`#C86A0A`},{id:`service`,label:`Services`,icon:E,hue:`#2563EB`},{id:`data`,label:`Data and messages`,icon:x,hue:`#0B8A8A`},{id:`outside`,label:`Outside`,icon:i,hue:`#5B4BC9`}],Se=e=>e.repo&&e.column!==`data`?`select it to see it from the inside`:e.part?`select it for how it is known`:``,Ce=.72;function we(e){return e.known===`seen`?`stroke-pass`:e.known===`differs`?`stroke-warn`:`stroke-muted`}var Te=[`seen`,`differs`,`read`,`inferred`];function Ee(e){let t=new Map;for(let n of e){let e=`${n.from}\u0000${n.to}`,r=t.get(e);(!r||Te.indexOf(n.known)<Te.indexOf(r.known))&&t.set(e,{from:n.from,to:n.to,known:n.known})}return t}function De({view:e,onOpen:t,words:n={}}){let r=e=>({...xe.find(t=>t.id===e),...n.bands?.[e]}),i=(0,K.useMemo)(()=>Ee(e.links),[e]),a=(0,K.useMemo)(()=>be(e.nodes.map(e=>({id:e.id,band:e.column})),[...i.values()].map(e=>({from:e.from,to:e.to})),[`front`,`gateway`,`service`,`data`],`outside`),[e,i]),s=(0,K.useRef)(null),[c,l]=(0,K.useState)(1),[u,d]=(0,K.useState)(null),[f,p]=(0,K.useState)(null),h=u||f;(0,K.useLayoutEffect)(()=>{let e=()=>{let e=s.current;if(!e)return;let t=window.innerHeight-e.getBoundingClientRect().top-24,n=Math.min(e.clientWidth/a.w,Math.max(t,360)/a.h,1);l(Math.max(Ce,n))};e();let t=typeof ResizeObserver>`u`?null:new ResizeObserver(e);return s.current&&t?.observe(s.current),window.addEventListener(`resize`,e),()=>{t?.disconnect(),window.removeEventListener(`resize`,e)}},[a]);let g=new Map(e.nodes.map(e=>[e.id,e])),_=e=>!h||e.from===h||e.to===h,v=new Set(h?e.links.filter(e=>e.from===h||e.to===h).flatMap(e=>[e.from,e.to]):[]),y=c<=Ce&&(s.current?.clientWidth||1/0)<a.w*c,b=(e,t)=>i.get(`${e}\u0000${t}`);return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Q.jsx)(`div`,{ref:s,className:`w-full overflow-x-auto`,onMouseLeave:()=>d(null),children:(0,Q.jsx)(`div`,{className:`relative mx-auto`,style:{width:a.w*c,height:a.h*c},children:(0,Q.jsxs)(`div`,{className:`absolute top-0 left-0`,style:{width:a.w,height:a.h,transform:`scale(${c})`,transformOrigin:`0 0`},children:[(0,Q.jsxs)(`svg`,{"aria-hidden":`true`,width:a.w,height:a.h,viewBox:`0 0 ${a.w} ${a.h}`,className:`absolute inset-0 overflow-visible`,children:[(0,Q.jsx)(`defs`,{children:[`pass`,`warn`,`muted`].map(e=>(0,Q.jsx)(`marker`,{id:`map-${e}`,viewBox:`0 0 8 8`,refX:7,refY:4,markerWidth:8,markerHeight:8,markerUnits:`userSpaceOnUse`,orient:`auto`,children:(0,Q.jsx)(`path`,{d:`M0 0 L8 4 L0 8 Z`,className:e===`pass`?`fill-pass`:e===`warn`?`fill-warn`:`fill-muted`})},e))}),a.bands.map(e=>(0,Q.jsx)(`rect`,{x:e.x,y:e.y,width:e.w,height:e.h,rx:16,fill:r(e.id).hue,fillOpacity:.055,stroke:r(e.id).hue,strokeOpacity:.24},e.id)),a.wires.map(e=>(0,Q.jsx)(`path`,{d:e.d,fill:`none`,strokeWidth:5,className:`stroke-bg`,opacity:_(e)?1:.15},`h${e.index}`)),a.wires.map(e=>{let t=b(e.from,e.to),n=g.get(e.from)?.column===`outside`||g.get(e.to)?.column===`outside`,r=t.known===`seen`?`pass`:t.known===`differs`?`warn`:`muted`;return(0,Q.jsx)(`path`,{d:e.d,fill:`none`,strokeWidth:h&&_(e)?2.25:t.known===`seen`?1.75:1.4,strokeDasharray:n?`5 4`:t.known===`differs`?`2 3`:void 0,markerEnd:`url(#map-${r})`,className:m(we(t),`transition-opacity duration-150`),opacity:_(e)?1:.15},e.index)})]}),a.bands.map(e=>(0,Q.jsxs)(`span`,{className:`absolute z-[1] flex items-center gap-1.5 rounded-[6px] bg-bg/90 px-1.5 py-0.5 text-[12px] font-semibold text-ink-2`,style:{left:e.x+10,top:e.y+7},children:[(0,Q.jsx)(`span`,{className:`size-2 rounded-full`,style:{background:r(e.id).hue},"aria-hidden":`true`}),r(e.id).label]},e.id)),[...a.boxes.values()].map(n=>{let i=g.get(n.id),a=h&&h!==i.id&&!v.has(i.id),s=e.links.filter(e=>e.from===i.id).length,c=e.links.filter(e=>e.to===i.id).length;return(0,Q.jsxs)(`button`,{type:`button`,onMouseEnter:()=>d(i.id),onFocus:()=>p(i.id),onBlur:()=>p(e=>e===i.id?null:e),onClick:()=>t(i),"aria-label":`${i.name}, ${r(i.column).label.toLowerCase()}: ${i.detail}. ${ce[i.known].label}. Sends to ${s}, receives from ${c}.`,className:m(`absolute flex cursor-pointer flex-col justify-center gap-0.5 rounded-[10px] border bg-bg px-3 text-left transition-opacity duration-150 hover:bg-surface-muted`,i.column===`outside`&&`border-dashed`,a&&`opacity-40`,h===i.id&&`shadow-md`),style:{left:n.x,top:n.y,width:n.w,height:n.h,borderColor:`color-mix(in srgb, ${r(i.column).hue} 55%, transparent)`},children:[(0,Q.jsxs)(`span`,{className:`flex w-full min-w-0 items-center gap-1.5 text-[13.5px] font-semibold text-ink`,children:[(0,Q.jsx)(o,{icon:r(i.column).icon,size:14,className:`flex-none`}),(0,Q.jsx)(`span`,{className:`truncate`,children:i.name}),i.known===`seen`&&(0,Q.jsx)(B,{size:13,"aria-hidden":`true`,className:`ml-auto flex-none text-pass`})]}),(0,Q.jsx)(`span`,{className:`truncate font-mono text-[11px] text-muted`,children:i.detail})]},i.id)})]})})}),y&&(0,Q.jsx)(`p`,{className:`m-0 text-[12px] text-muted`,children:`Scroll sideways to see the whole map.`}),(0,Q.jsx)(Oe,{}),(0,Q.jsx)(ke,{view:e,id:h,words:n,band:r})]})}function Oe(){let e=(e,t,n)=>(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Q.jsx)(`svg`,{width:`28`,height:`8`,"aria-hidden":`true`,children:(0,Q.jsx)(`path`,{d:`M1 4 H27`,fill:`none`,strokeWidth:1.75,strokeDasharray:e,className:t})}),n]});return(0,Q.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-x-5 gap-y-1 text-[12px] text-muted`,children:[e(void 0,`stroke-muted`,`Inside the product, read in the code`),e(`5 4`,`stroke-muted`,`To or from an outside system`),e(void 0,`stroke-pass`,`Seen in a run`),e(`2 3`,`stroke-warn`,`A run called it differently`)]})}function ke({view:e,id:t,words:n,band:r}){let i=t?e.nodes.find(e=>e.id===t):void 0,a=i?(n.hint||Se)(i):``,o=t=>e.nodes.find(e=>e.id===t)?.name||t,s=(e,t)=>{let n=new Map;for(let r of e){let e=r[t],i=n.get(e);i?n.set(e,{other:e,label:i.label.split(`, `).includes(r.label)?i.label:`${i.label}, ${r.label}`,known:i.known===`seen`||r.known===`seen`?`seen`:i.known}):n.set(e,{other:e,label:r.label,known:r.known})}return[...n.values()]},c=(e,t)=>e.length?(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0 text-[13px]`,children:e.map((e,t)=>(0,Q.jsxs)(`li`,{className:`flex justify-between gap-3 border-t border-line-soft py-1.5 first:border-t-0 first:pt-0`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate font-medium text-ink`,children:o(e.other)}),(0,Q.jsxs)(`span`,{className:`flex-none text-muted`,children:[e.label,e.known===`seen`?` · seen in a run`:``]})]},t))}):(0,Q.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:t});return(0,Q.jsx)(`div`,{"aria-live":`polite`,className:`grid min-h-[120px] gap-x-10 gap-y-4 rounded-[14px] card border px-5 py-4 @3xl:[grid-template-columns:minmax(220px,1.1fr)_1fr_1fr]`,children:i?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Q.jsxs)(`h3`,{className:`m-0 flex items-center gap-2 text-base font-semibold`,children:[(0,Q.jsx)(`span`,{className:`size-2.5 flex-none rounded-full`,style:{background:r(i.column).hue},"aria-hidden":`true`}),i.name]}),(0,Q.jsx)(`p`,{className:`m-0 text-[13px] text-muted [overflow-wrap:anywhere]`,children:i.detail}),(0,Q.jsxs)(`p`,{className:`m-0 text-[12px] text-muted`,children:[r(i.column).label,` · `,ce[i.known].label,a?` · ${a}`:``]})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,Q.jsx)(`h4`,{className:`m-0 text-[13px] font-semibold`,children:n.sends||`Sends to`}),c(s(e.links.filter(e=>e.from===i.id),`to`),`Nothing.`)]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,Q.jsx)(`h4`,{className:`m-0 text-[13px] font-semibold`,children:n.receives||`Receives from`}),c(s(e.links.filter(e=>e.to===i.id),`from`),`Nothing.`)]})]}):(0,Q.jsx)(`p`,{className:`m-0 self-center text-[13px] text-muted @3xl:col-span-3`,children:n.idle||`Hover over or tab to a part to trace what it sends and receives. Select a service to see it from the inside; the How they talk tab lists every link in words.`})})}var Ae={bands:{front:{label:`Channels`,icon:p},gateway:{label:`Edge`,icon:D},service:{label:`Business systems`,icon:E},data:{label:`Data`,icon:x},outside:{label:`Outside and SaaS`,icon:i}},hint:e=>e.column===`outside`?`select it for how it is known`:`select it to see its services`,idle:`Hover over or tab to a system to trace what it sends and receives, and how. Select one to see its services.`},je=e=>e.modes.map(e=>`${e.mode} (${e.count})`).join(`, `);function Me(e){return{nodes:e.nodes.map(e=>({id:e.id,name:e.name,column:e.column,detail:e.detail,known:e.known,...e.column===`outside`?{part:e.id}:{}})),links:e.links.map(e=>({from:e.from,to:e.to,label:je(e),count:e.count,known:e.known,example:e.examples[0]||``}))}}function Ne({onPart:e}){let[t,n]=(0,K.useState)(null),[r,i]=(0,K.useState)(``);(0,K.useEffect)(()=>{te.view().then(n,e=>i(e.message))},[]);let a=(0,K.useMemo)(()=>t?Me(t):null,[t]);if(r)return(0,Q.jsx)(W,{text:r});if(!t||!a)return(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`});let o=e=>t.nodes.find(t=>t.id===e)?.name||e;return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[t.grouping===`names`&&(0,Q.jsxs)(`p`,{className:`m-0 flex max-w-[74ch] items-start gap-2 text-sm text-ink-2`,children:[(0,Q.jsx)(s,{size:16,"aria-hidden":`true`,className:`mt-0.5 flex-none text-muted`}),(0,Q.jsxs)(`span`,{children:[`Repositories without a system are grouped by the first word of their names, or stand alone (`,t.guessed.slice(0,6).join(`, `),t.guessed.length>6?`, and ${t.guessed.length-6} more`:``,`). Give each repository its system, as your teams name them, in `,(0,Q.jsx)(`a`,{href:S(`settings`,`agents`),children:`Settings, Agents, Repositories`}),t.proposal?`.`:(0,Q.jsxs)(Q.Fragment,{children:[`, or let the model propose them: `,(0,Q.jsx)(`code`,{children:`forgeqe knowledge systems --propose`}),`.`]})]})]}),(0,Q.jsxs)(`section`,{"aria-labelledby":`landscape-h`,className:`flex flex-col gap-3`,children:[(0,Q.jsx)(`h2`,{id:`landscape-h`,className:`sr-only`,children:`Systems map`}),(0,Q.jsx)(De,{view:a,onOpen:t=>{t.column===`outside`?e(t.id):location.hash=S(`product`,`systems`,encodeURIComponent(t.name))},words:Ae})]}),t.proposal&&(0,Q.jsx)(Pe,{view:t,onView:n}),(0,Q.jsx)(U,{id:`systems-talk`,title:`How the systems talk`,icon:M,n:t.links.length,children:t.links.length?(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[...t.links].sort((e,t)=>t.count-e.count).map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 border-b border-line-soft py-2.5 last:border-b-0`,children:[(0,Q.jsxs)(`span`,{className:`min-w-0 flex-[1_1_320px] text-[14px] [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:o(e.from)}),` `,(0,Q.jsx)(`span`,{className:`text-muted`,children:`to`}),` `,(0,Q.jsx)(`span`,{className:`font-medium`,children:o(e.to)}),(0,Q.jsxs)(`span`,{className:`text-muted`,children:[` · `,je(e)]}),e.via.length>0&&(0,Q.jsxs)(`span`,{className:`text-muted`,children:[` · on `,e.via.slice(0,4).join(`, `)]}),e.examples.slice(0,3).map((e,t)=>(0,Q.jsx)(`span`,{className:`block text-[12px] text-muted`,children:e},t))]}),(0,Q.jsx)(G,{known:e.known})]},`${e.from}>${e.to}`))}):(0,Q.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No link between systems was found: each system's code talks only to itself, or calls no route read.`})}),t.loose.length>0&&(0,Q.jsxs)(U,{id:`loose`,title:`Messages with one end here`,icon:u,n:t.loose.length,children:[(0,Q.jsx)(`p`,{className:`m-0 max-w-[74ch] text-sm text-muted`,children:`A topic or queue a system here publishes that nothing here consumes, or the other way round: the other end is in a repository not read yet, or nobody.`}),(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:t.loose.map(e=>(0,Q.jsxs)(`li`,{className:`border-b border-line-soft py-2 text-[14px] last:border-b-0 [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.topic}),(0,Q.jsxs)(`span`,{className:`text-muted`,children:[e.publishers.length?` · published by ${e.publishers.join(`, `)}`:``,e.consumers.length?` · consumed by ${e.consumers.join(`, `)}`:``]})]},e.topic))})]})]})}function Pe({view:e,onView:n}){let[r,i]=(0,K.useState)(null),[a,o]=(0,K.useState)(``),[s,c]=(0,K.useState)(``),[l,u]=(0,K.useState)(!1),d=e.assigned.filter(e=>e.by!==`settings`&&(e.why||e.by===`person`||e.rejected)),f=d.filter(e=>e.by===`model`),p=async t=>{u(!0),c(``);try{let r=e;for(let[e,n,i]of t)r=await te.decide(e,n,i);n(r),i(null)}catch(e){c(e.message)}finally{u(!1)}};if(!d.length)return null;let m=e.proposal;return(0,Q.jsxs)(U,{id:`proposal`,title:`Systems proposed by the model`,icon:v,n:f.length||void 0,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`p`,{className:`m-0 max-w-[74ch] text-sm text-muted`,children:[`Proposed by `,m?.model||`the model`,m?.at?` on ${m.at.slice(0,10)}`:``,`, from what the graph knows of each repository. Accept each, rename it, or reject it; a system set in Settings always wins. `,f.length?`${f.length} wait for a person.`:`All are decided.`]}),f.length>1&&(0,Q.jsxs)(t,{size:`sm`,variant:`ghost`,disabled:l,onClick:()=>void p(f.map(e=>[e.repo,`accepted`])),children:[(0,Q.jsx)(B,{size:15,"aria-hidden":`true`}),`Accept all `,f.length]})]}),s&&(0,Q.jsx)(W,{text:s}),(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:d.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2 border-b border-line-soft py-2.5 last:border-b-0`,children:[(0,Q.jsxs)(`span`,{className:`min-w-0 flex-[1_1_320px] text-[14px] [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:e.repo}),` `,(0,Q.jsx)(`span`,{className:`text-muted`,children:`in`}),` `,(0,Q.jsx)(`span`,{className:`font-medium`,children:e.rejected?`its own name`:e.system}),(0,Q.jsxs)(`span`,{className:`text-muted`,children:[` · `,e.rejected?`rejected`:e.by===`person`?`accepted`:`proposed`]}),e.why&&(0,Q.jsx)(`span`,{className:`block text-[12px] text-muted`,children:e.why})]}),r===e.repo?(0,Q.jsxs)(`form`,{className:`flex w-full max-w-[420px] gap-1.5`,onSubmit:t=>{t.preventDefault(),a.trim()&&p([[e.repo,`accepted`,a.trim()]])},children:[(0,Q.jsx)(C,{"aria-label":`System for ${e.repo}`,placeholder:`CRM`,value:a,maxLength:60,onChange:e=>o(e.target.value),className:`flex-1`}),(0,Q.jsx)(t,{type:`submit`,size:`sm`,disabled:l||!a.trim(),children:`Save`}),(0,Q.jsx)(t,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>i(null),children:`Cancel`})]}):(0,Q.jsx)(`div`,{role:`group`,"aria-label":`The system for ${e.repo}`,className:`flex gap-1.5`,children:e.by===`model`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,disabled:l,onClick:()=>void p([[e.repo,`accepted`]]),className:Fe,children:[(0,Q.jsx)(B,{size:14,"aria-hidden":`true`}),`Accept`]}),(0,Q.jsx)(`button`,{type:`button`,disabled:l,onClick:()=>{o(e.system),i(e.repo)},className:Fe,children:`Rename`}),(0,Q.jsxs)(`button`,{type:`button`,disabled:l,onClick:()=>void p([[e.repo,`rejected`]]),className:Fe,children:[(0,Q.jsx)(N,{size:14,"aria-hidden":`true`}),`Reject`]})]}):(0,Q.jsx)(`button`,{type:`button`,disabled:l,onClick:()=>void p([[e.repo,null]]),className:Fe,children:`Undo`})})]},e.repo))})]})}var Fe=m(`inline-flex min-h-8 cursor-pointer items-center gap-1 rounded-[8px] border border-transparent bg-surface-strong px-3 text-[13px] font-medium text-ink-2 hover:bg-line hover:text-ink disabled:cursor-not-allowed`);function Ie({eng:e,name:t,onOpen:n}){let[r,i]=(0,K.useState)(null),[a,o]=(0,K.useState)(``);(0,K.useEffect)(()=>{te.view().then(i,e=>o(e.message))},[]);let s=(0,K.useMemo)(()=>{let n=r?.nodes.find(e=>e.name===t&&e.column!==`outside`);if(!r||!n)return null;let i=new Set(n.parts),a=e.links.filter(e=>i.has(e.from)||i.has(e.to)),o=new Set(a.flatMap(e=>[e.from,e.to])),s=e=>r.nodes.find(t=>t.parts.includes(e))?.name,c=e.nodes.filter(e=>i.has(e.id)||o.has(e.id)).map(e=>i.has(e.id)||e.column===`outside`||!s(e.id)?e:{...e,detail:`in ${s(e.id)} · ${e.detail}`});return{nodes:c,links:a,other:c.filter(e=>!i.has(e.id)).length}},[r,e,t]),c=r?.nodes.find(e=>e.name===t&&e.column!==`outside`);return(0,Q.jsxs)(`section`,{"aria-labelledby":`system-h`,className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsxs)(`a`,{href:S(`product`),className:`inline-flex items-center gap-1.5 self-start text-sm`,children:[(0,Q.jsx)(z,{size:16,"aria-hidden":`true`}),`All systems`]}),(0,Q.jsx)(`h2`,{id:`system-h`,className:`m-0 text-[22px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:t}),c&&(0,Q.jsxs)(`p`,{className:`m-0 text-sm text-ink-2`,children:[c.detail,c.repos.length?` · repositories: ${c.repos.join(`, `)}`:``,c.inside?` · ${c.inside} links among its own parts`:``,s?.other?` · ${s.other} parts of other systems it talks to, named with their system`:``]})]}),a&&(0,Q.jsx)(W,{text:a}),!r&&!a&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),r&&!c&&(0,Q.jsxs)(`p`,{className:`m-0 text-sm text-muted`,children:[`No system is named `,t,`; it may have been renamed in Settings. See `,(0,Q.jsx)(`a`,{href:S(`product`),children:`all systems`}),`.`]}),s&&(0,Q.jsx)(De,{view:s,onOpen:n,words:{idle:`Hover over or tab to a part to trace what it sends and receives. Select a service to see it from the inside.`}}),c&&(0,Q.jsx)(`p`,{className:`m-0 text-[12px] text-muted`,children:`The system's services and the parts of other systems they reach, from the same graph as the services map.`})]})}function Le({id:e,verdict:n,note:r,onChanged:i}){let[a,o]=(0,K.useState)(r||``),[s,c]=(0,K.useState)(``),[l,u]=(0,K.useState)(!1),d=async(t,n)=>{u(!0),c(``);try{await re.feedback(e,t,n),i()}catch(e){c(e.message)}finally{u(!1)}};return(0,Q.jsxs)(`div`,{className:`flex flex-col items-start gap-1.5`,children:[(0,Q.jsx)(`div`,{role:`group`,"aria-label":`Is this right?`,className:`flex gap-1.5`,children:[`right`,`wrong`].map(e=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":n===e,disabled:l,onClick:()=>void d(n===e?null:e,e===`wrong`&&a.trim()||void 0),className:m(`inline-flex min-h-8 cursor-pointer items-center gap-1 rounded-[8px] border px-3 text-[13px] font-medium disabled:cursor-not-allowed`,n===e?`border-accent bg-accent-soft text-ink`:`border-transparent bg-surface-strong text-ink-2 hover:bg-line hover:text-ink`),children:[e===`right`?(0,Q.jsx)(B,{size:14,"aria-hidden":`true`}):(0,Q.jsx)(N,{size:14,"aria-hidden":`true`}),e===`right`?`Right`:`Wrong`]},e))}),n===`wrong`&&(0,Q.jsxs)(`form`,{className:`flex w-full max-w-[420px] gap-1.5`,onSubmit:e=>{e.preventDefault(),d(`wrong`,a.trim()||void 0)},children:[(0,Q.jsx)(C,{"aria-label":`What is right instead`,placeholder:`What is right instead`,value:a,maxLength:500,onChange:e=>o(e.target.value),className:`flex-1`}),(0,Q.jsx)(t,{type:`submit`,size:`sm`,disabled:l,children:`Save`})]}),s&&(0,Q.jsx)(W,{text:s})]})}function $({icon:e,children:t}){return(0,Q.jsxs)(`div`,{className:`flex flex-col items-start gap-3 rounded-[18px] border border-line p-6`,children:[(0,Q.jsx)(o,{icon:e,size:22,className:`text-muted`}),(0,Q.jsx)(`p`,{className:`m-0 max-w-[62ch] leading-relaxed text-ink-2`,children:t})]})}var Re=190,ze=46,Be=64,Ve=(e,t)=>{let n=Math.max(6,Math.floor(t/6.6));return e.length<=n?e:`${e.slice(0,n-1)}…`};function He({j:e}){let t=[{id:`browser`,label:`Browser`,kind:`browser`}],n=(e,n,r)=>(t.some(t=>t.id===e)||t.push({id:e,label:n,kind:r}),t.findIndex(t=>t.id===e)),r=[];e.steps.forEach((e,t)=>{let i=n(`s:${e.service||`?`}`,e.service||`service`,`service`);r.push({from:0,to:i,label:e.endpoint||e.name,solid:e.known===`seen`,n:t+1});for(let t of e.effects)r.push({from:i,to:n(`${t.lane}:${t.target}`,t.target,t.lane===`service`?`service`:t.lane),label:t.kind,solid:t.known===`seen`})});let i=t.length*Re,a=Be+r.length*ze+24,o=e=>e*Re+Re/2,s=`${e.name}: ${e.steps.length} ${e.steps.length===1?`step`:`steps`} across ${t.slice(1).map(e=>e.label).join(`, `)}.`;return(0,Q.jsxs)(`div`,{className:`overflow-x-auto`,children:[(0,Q.jsxs)(`svg`,{role:`img`,"aria-label":s,width:i,height:a,viewBox:`0 0 ${i} ${a}`,className:`block`,children:[t.map((t,n)=>(0,Q.jsxs)(`g`,{children:[(0,Q.jsx)(`line`,{x1:o(n),y1:56,x2:o(n),y2:a-8,strokeDasharray:`3 4`,className:`stroke-line-strong`}),(0,Q.jsx)(`rect`,{x:o(n)-Re/2+8,y:6,width:174,height:40,rx:10,className:m(`stroke-line`,t.kind===`outside`?`fill-surface-muted`:`fill-bg`)}),(0,Q.jsx)(`text`,{x:o(n),y:24,textAnchor:`middle`,className:`fill-ink text-[13px] font-medium`,children:Ve(t.label,162)}),(0,Q.jsx)(`text`,{x:o(n),y:39,textAnchor:`middle`,className:`fill-muted text-[11px]`,children:t.kind===`browser`?Ve(e.steps[0]?.page||``,162):t.kind===`data`?`table`:t.kind===`message`?`message`:t.kind===`outside`?`outside`:`service`})]},t.id)),r.map((e,t)=>{let n=Be+t*ze+ze/2,r=Math.min(o(e.from),o(e.to)),i=Math.max(o(e.from),o(e.to)),a=o(e.to)>o(e.from)?1:-1,s=o(e.to)-a*4;return(0,Q.jsxs)(`g`,{children:[(0,Q.jsx)(`line`,{x1:o(e.from),y1:n,x2:s,y2:n,strokeWidth:e.solid?2:1.5,strokeDasharray:e.solid?void 0:`5 4`,className:e.solid?`stroke-pass`:`stroke-ink-2`}),(0,Q.jsx)(`path`,{d:`M ${s} ${n} l ${-a*7} -4 l 0 8 z`,className:e.solid?`fill-pass`:`fill-ink-2`}),(0,Q.jsxs)(`text`,{x:r+8,y:n-7,className:m(`text-[12px]`,e.n?`fill-ink`:`fill-muted`),children:[e.n?`${e.n} `:``,Ve(e.label,i-r-16)]})]},t)})]}),(0,Q.jsx)(`ol`,{className:`sr-only`,children:e.steps.map((e,t)=>(0,Q.jsxs)(`li`,{children:[e.endpoint||e.name,` on `,e.service||`a service`,e.effects.length?`, which ${e.effects.map(e=>`${e.kind} ${e.target}`).join(`, `)}`:``,`. `,Ue(e.known),`.`]},t))})]})}var Ue=e=>({seen:`Seen in a run`,read:`From the code`,inferred:`Worked out`,differs:`A run differs`,confirmed:`Confirmed by a person`,rejected:`Marked wrong`})[e];function We({d:e}){let t=[...e.writtenBy.map(e=>({id:`w:${e}`,column:`writes`,title:e,known:`read`})),{id:e.id,column:`table`,title:e.name,detail:e.columns.length?e.columns.join(`, `):e.where,known:`read`,personal:e.personal.length>0},...e.readBy.map(e=>({id:`r:${e}`,column:`reads`,title:e,known:`read`})),...e.sentOn.map(e=>({id:`s:${e}`,column:`onward`,title:e,detail:`message`,known:`inferred`})),...e.leavesTo.map(e=>({id:`o:${e}`,column:`onward`,title:e,detail:`outside service`,known:`inferred`}))],n=[...e.writtenBy.map(t=>({from:`w:${t}`,to:e.id,known:`read`})),...e.readBy.map(t=>({from:e.id,to:`r:${t}`,known:`read`})),...e.sentOn.map(t=>({from:e.id,to:`s:${t}`,known:`inferred`})),...e.leavesTo.map(t=>({from:e.id,to:`o:${t}`,known:`inferred`}))];return(0,Q.jsx)(ue,{label:`What happens to the data of ${e.name}`,columns:[{id:`writes`,label:`Written by`,icon:h},{id:`table`,label:`Kept in`,icon:x},{id:`reads`,label:`Read by`,icon:h},{id:`onward`,label:`Sent on, and leaves to`,icon:u}],nodes:t,links:n})}var Ge=({known:e})=>e===`seen`?(0,Q.jsx)(B,{size:15,role:`img`,"aria-label":`Seen in a run`,className:`mt-0.5 flex-none text-pass`}):(0,Q.jsx)(R,{size:15,"aria-hidden":`true`,className:`mt-0.5 flex-none text-muted`});function Ke({items:e}){let t=e.filter(e=>e.value);return t.length?(0,Q.jsx)(`span`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-[13px] text-muted`,children:t.map(e=>(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Q.jsx)(o,{icon:e.icon,size:14}),(0,Q.jsxs)(`span`,{children:[e.label,`: `,(0,Q.jsx)(`span`,{className:`text-ink-2`,children:e.value})]})]},e.label))}):null}function qe({d:e}){let t=e.states.filter(e=>e.first),n=e.states.filter(e=>!e.first&&e.setBy.length),r=e.states.filter(e=>!e.first&&!e.setBy.length);if(!e.states.length)return(0,Q.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`The code names no state for it (a status the record moves through).`});let i=({s:e,dashed:t})=>(0,Q.jsx)(`span`,{className:m(`inline-flex min-h-9 items-center rounded-[10px] border px-3 text-[14px] font-medium`,t?`border-dashed border-muted text-ink-2`:`border-line bg-bg text-ink`),children:e});return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Q.jsxs)(`ol`,{"aria-label":`The life of ${e.record.toLowerCase()}`,className:`m-0 flex list-none flex-wrap items-center gap-2 p-0`,children:[t.map(e=>(0,Q.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-[12px] text-muted`,children:`Starts`}),(0,Q.jsx)(i,{s:e.state})]},e.state)),n.map(e=>(0,Q.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[12px] text-ink-2`,children:[(0,Q.jsx)(L,{size:14,"aria-hidden":`true`,className:`text-muted`}),e.setBy.join(`, `),(0,Q.jsx)(L,{size:14,"aria-hidden":`true`,className:`text-muted`})]}),(0,Q.jsx)(i,{s:e.state})]},e.state))]}),r.length>0&&(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-[13px] text-muted`,children:[`Also checked:`,r.map(e=>(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Q.jsx)(i,{s:e.state,dashed:!0}),e.checkedBy.length>0&&(0,Q.jsxs)(`span`,{className:`text-ink-2`,children:[`(`,e.checkedBy.join(`; `),`)`]})]},e.state))]})]})}function Je({label:e,rows:t,current:n,name:r,icon:i,to:a}){return(0,Q.jsx)(`nav`,{"aria-label":e,className:`flex min-w-0 flex-col gap-1 @2xl:sticky @2xl:top-6 @2xl:w-[260px] @2xl:flex-none`,children:(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:t.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`a`,{href:S(`product`,`business`,a,encodeURIComponent(e.id)),"aria-current":n===e.id?`page`:void 0,className:m(`flex min-h-11 items-center gap-2.5 rounded-[10px] px-3 py-1.5 text-ink no-underline`,n===e.id?`bg-surface-strong hover:text-ink`:`hover:bg-surface-muted hover:text-ink`),children:[i(e),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[14px] font-medium`,"data-tip":r(e),children:r(e)})]})},e.id))})})}function Ye({view:e,tab:t,item:n,onChanged:r}){let[i,a]=(0,K.useState)(!1),[s,c]=(0,K.useState)(null),f=[{id:`capabilities`,label:`What it does`},{id:`journeys`,label:`Journeys (${e.journeys.length})`},{id:`rules`,label:`Rules (${e.rules.length})`},{id:`data`,label:`Records (${e.data.length})`},...e.terms.length?[{id:`glossary`,label:`Glossary (${e.terms.length})`}]:[],{id:`team`,label:e.team?`Team questions (${e.team.passed} of ${e.team.questions})`:`Team questions`}],m=e.journeys.find(e=>e.id===n)||e.journeys[0],g=e.data.find(e=>e.id===n)||e.data[0],v=(...e)=>location.hash=S(`product`,`business`,...e),C=new Map;for(let t of e.rules)C.set(t.capability||`Other`,[...C.get(t.capability||`Other`)||[],t]);return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[!e.modelRead&&(0,Q.jsx)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-muted`,children:`These words come from the code itself: the action from each request, the rule from the message the product answers with, the record from each table. Build the graph with the model to have capabilities, journeys and rules named and phrased by it, each citing what shows it.`}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-x-6 @3xl:flex-row @3xl:items-end`,children:[(0,Q.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Q.jsx)(F,{label:`Product view`,current:t,onPick:e=>v(e),tabs:f})}),(0,Q.jsxs)(`span`,{className:`mb-5 flex items-center gap-2 text-sm text-ink-2`,children:[(0,Q.jsx)(j,{checked:i,onChange:a,label:`Show how it is built`}),`Show how it is built`]})]}),t===`capabilities`&&(0,Q.jsxs)(`div`,{role:`tabpanel`,id:`panel-capabilities`,"aria-labelledby":`tab-capabilities`,className:`flex flex-col gap-6`,children:[!e.capabilities.length&&(0,Q.jsx)($,{icon:d,children:`Nothing the product does was found yet: the product serves no request the patterns read. Build the graph with the model to find what it does from the code and documents.`}),(0,Q.jsx)(`ul`,{className:`m-0 grid list-none gap-4 p-0 @2xl:grid-cols-2`,children:e.capabilities.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-col gap-3 rounded-[14px] card border p-5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,Q.jsxs)(`h3`,{className:`m-0 flex items-center gap-2 text-lg font-semibold`,children:[(0,Q.jsx)(o,{icon:d,size:18}),e.name]}),e.by===`model`&&(0,Q.jsx)(G,{known:e.known})]}),e.by===`model`&&(0,Q.jsx)(`p`,{className:`m-0 text-sm leading-relaxed text-ink-2 [overflow-wrap:anywhere]`,children:e.summary}),(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1.5 p-0`,children:e.actions.map(e=>(0,Q.jsxs)(`li`,{className:`flex items-start gap-2 text-[15px] text-ink`,children:[(0,Q.jsx)(Ge,{known:e.known}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[e.action,i&&(0,Q.jsx)(`span`,{className:`font-mono text-[12px] text-muted [overflow-wrap:anywhere]`,children:e.endpoint})]})]},e.endpoint))}),(0,Q.jsx)(Ke,{items:[{icon:x,label:`Keeps`,value:e.records.join(`, `)},{icon:p,label:`Shares with`,value:e.outside.join(`, `)},{icon:b,label:`Rules`,value:e.rules?String(e.rules):``},{icon:w,label:`Personal data`,value:e.personal?`yes`:``}]}),e.by===`model`&&(0,Q.jsx)(Le,{id:e.id,verdict:e.verdict,note:e.note,onChanged:r})]},e.id))}),(0,Q.jsxs)(`p`,{className:`m-0 text-[12px] text-muted`,children:[(0,Q.jsx)(B,{size:12,"aria-hidden":`true`,className:`mr-1 inline align-[-1px] text-pass`}),`Seen in a run: ForgeQE's runs did it. The rest is read in the code.`]}),i&&e.map.nodes.length>0&&(0,Q.jsx)(U,{id:`capability-map`,title:`How it is built`,icon:h,children:(0,Q.jsx)(ue,{label:`Capability map`,columns:[{id:`capability`,label:`Capabilities`,icon:d},{id:`endpoint`,label:`Requests`,icon:h},{id:`rule`,label:`Rules it checks`,icon:b},{id:`data`,label:`Tables`,icon:x}],nodes:e.map.nodes,links:e.map.links,opens:e=>e.column===`data`||e.column===`rule`,onOpen:e=>e.column===`data`?v(`data`,encodeURIComponent(e.id)):v(`rules`)})})]}),t===`journeys`&&(0,Q.jsx)(`div`,{role:`tabpanel`,id:`panel-journeys`,"aria-labelledby":`tab-journeys`,children:m?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6 @2xl:flex-row @2xl:items-start @2xl:gap-8`,children:[(0,Q.jsx)(Je,{label:`Journeys`,rows:e.journeys,current:m.id,name:e=>e.name,to:`journeys`,icon:e=>e.known===`seen`?(0,Q.jsx)(B,{size:16,role:`img`,"aria-label":`Seen in a run`,className:`flex-none text-pass`}):(0,Q.jsx)(o,{icon:D,size:16,className:`flex-none`})}),(0,Q.jsxs)(`section`,{"aria-labelledby":`journey-h`,className:`flex min-w-0 flex-1 flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h2`,{id:`journey-h`,className:`m-0 text-[22px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:m.name}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(y,{tone:`neutral`,icon:!1,children:m.by===`run`?`Walked by a run`:`Named by the model`}),(0,Q.jsx)(G,{known:m.known})]})]}),(0,Q.jsxs)(`ol`,{"aria-label":`Steps`,className:`m-0 flex list-none flex-col gap-2 p-0 @3xl:flex-row @3xl:flex-wrap @3xl:items-stretch`,children:[m.steps[0]?.page&&(0,Q.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Q.jsxs)(`span`,{className:`flex flex-col justify-center rounded-[14px] bg-surface-muted px-4 py-3 text-[13px] text-ink-2`,children:[`Starts on`,(0,Q.jsx)(`span`,{className:`font-mono text-[12px] text-muted`,children:m.steps[0].page})]}),(0,Q.jsx)(L,{size:18,"aria-hidden":`true`,className:`hidden flex-none text-muted @3xl:block`})]}),m.steps.map((e,t)=>(0,Q.jsxs)(`li`,{className:`flex items-stretch gap-2 @3xl:items-center`,children:[(0,Q.jsxs)(`div`,{className:`flex w-full flex-col gap-2 self-stretch rounded-[14px] card border p-4 @3xl:w-[220px]`,children:[(0,Q.jsxs)(`span`,{className:`flex items-start gap-2 text-[15px] font-semibold text-ink`,children:[(0,Q.jsx)(`span`,{className:`flex size-6 flex-none items-center justify-center rounded-full bg-surface-strong text-[12px] tabular-nums`,children:t+1}),e.action]}),e.outcomes.map(e=>(0,Q.jsxs)(`span`,{className:`flex items-start gap-1.5 text-[13px] text-ink-2`,children:[(0,Q.jsx)(fe,{size:13,"aria-hidden":`true`,className:`mt-0.5 flex-none text-muted`}),e]},e)),e.guards.length>0&&(0,Q.jsxs)(`span`,{className:`flex items-start gap-1.5 rounded-[10px] bg-surface-muted px-2.5 py-1.5 text-[12px] text-ink-2`,children:[(0,Q.jsx)(o,{icon:b,size:13,className:`mt-0.5 flex-none`}),`Not allowed when: `,e.guards.join(`; `)]}),(0,Q.jsxs)(`span`,{className:`mt-auto flex items-center gap-1.5 text-[12px] text-muted`,children:[(0,Q.jsx)(Ge,{known:e.known}),e.known===`seen`?`Seen in a run`:Ue(e.known)]}),i&&e.endpoint&&(0,Q.jsxs)(`span`,{className:`font-mono text-[12px] text-muted [overflow-wrap:anywhere]`,children:[e.endpoint,` · `,e.service]})]}),t<m.steps.length-1&&(0,Q.jsx)(L,{size:18,"aria-hidden":`true`,className:`hidden flex-none text-muted @3xl:block`})]},t))]}),(0,Q.jsx)(Le,{id:m.id,verdict:m.verdict,note:m.note,onChanged:r}),i&&(0,Q.jsxs)(U,{id:`journey-built`,title:`How it is built`,icon:h,children:[(0,Q.jsx)(He,{j:m}),(0,Q.jsx)(`p`,{className:`m-0 text-[12px] text-muted`,children:`Numbered arrows: the requests the browser made, in order; under each, what that request's code does. Solid green: seen in a run; dashed: from the code. A call made through a helper in another file is not drawn.`})]})]})]}):(0,Q.jsx)($,{icon:D,children:`No journey yet. Each browser run of ForgeQE becomes one here once the graph is built again; the model names more from the code.`})}),t===`rules`&&(0,Q.jsxs)(`div`,{role:`tabpanel`,id:`panel-rules`,"aria-labelledby":`tab-rules`,className:`flex flex-col gap-6`,children:[!e.rules.length&&(0,Q.jsx)($,{icon:b,children:`No rule was found yet: nothing in the code refuses a request with a reason. Rules show here once one is read.`}),[...C].map(([e,t],n)=>(0,Q.jsx)(U,{id:`rules-${n}`,title:e,icon:d,n:t.length,children:(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:t.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-col gap-2 border-b border-line-soft py-3 last:border-b-0`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-4 gap-y-2`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_380px] items-start gap-2 text-[15px] font-medium text-ink [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(o,{icon:b,size:16,className:`mt-0.5 flex-none`}),e.plain]}),(0,Q.jsx)(G,{known:e.known})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col items-start gap-1 pl-6`,children:[!i&&(0,Q.jsx)(`button`,{type:`button`,"aria-expanded":s===e.id,onClick:()=>c(s===e.id?null:e.id),className:`inline-flex min-h-11 cursor-pointer items-center border-0 bg-transparent p-0 text-[12px] text-accent-fg hover:text-accent-fg-hover`,children:s===e.id?`Hide how it is checked`:`Show how it is checked`}),(0,Q.jsx)(Le,{id:e.id,verdict:e.verdict,note:e.note,onChanged:r})]}),(0,Q.jsx)(I,{open:i||s===e.id,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 pb-1 pl-6`,children:[e.quote&&(0,Q.jsx)(`code`,{className:`font-mono text-[12px] text-ink-2 [overflow-wrap:anywhere]`,children:e.quote}),(0,Q.jsxs)(`span`,{className:`font-mono text-[12px] text-muted [overflow-wrap:anywhere]`,children:[e.endpoint?`${e.endpoint} · `:``,e.where]})]})})]},e.id))})},e))]}),t===`data`&&(0,Q.jsx)(`div`,{role:`tabpanel`,id:`panel-data`,"aria-labelledby":`tab-data`,children:g?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6 @2xl:flex-row @2xl:items-start @2xl:gap-8`,children:[(0,Q.jsx)(Je,{label:`Records`,rows:e.data,current:g.id,name:e=>e.record,to:`data`,icon:e=>e.personal.length?(0,Q.jsx)(o,{icon:w,size:16,label:`Holds personal data`,className:`flex-none`}):(0,Q.jsx)(O,{size:16,"aria-hidden":`true`,className:`flex-none text-muted`})}),(0,Q.jsxs)(`section`,{"aria-labelledby":`table-h`,className:`flex min-w-0 flex-1 flex-col gap-4`,children:[(0,Q.jsx)(`h2`,{id:`table-h`,className:`m-0 text-[22px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:g.record}),(0,Q.jsx)(U,{id:`life`,title:`Its life`,icon:D,children:(0,Q.jsx)(qe,{d:g})}),(0,Q.jsx)(Ke,{items:[{icon:h,label:`Changed by`,value:g.keptBy.join(`, `)},{icon:u,label:`Announced as`,value:g.sentOn.map(e=>e.replace(/^Announces /,``)).join(`, `)},{icon:p,label:`Shared with`,value:g.leavesTo.join(`, `)},{icon:w,label:`Personal data`,value:g.personal.join(`, `)}]}),i&&(0,Q.jsxs)(U,{id:`record-built`,title:`How it is built`,icon:h,children:[(0,Q.jsxs)(`span`,{className:`font-mono text-[12px] text-muted`,children:[`table `,g.name,` · `,g.where,g.columns.length?` · ${g.columns.join(`, `)}`:``]}),(0,Q.jsx)(We,{d:g})]})]})]}):(0,Q.jsx)($,{icon:x,children:`No record yet: no migration or model of the repositories defines a table. Records show here once a schema is read.`})}),t===`glossary`&&(0,Q.jsx)(`div`,{role:`tabpanel`,id:`panel-glossary`,"aria-labelledby":`tab-glossary`,children:(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.terms.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-start gap-x-4 gap-y-2 border-b border-line-soft py-3 last:border-b-0`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_380px] flex-col gap-1`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-2 text-[14px] font-medium`,children:[(0,Q.jsx)(o,{icon:T,size:15}),e.term]}),(0,Q.jsx)(`span`,{className:`text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:e.meaning})]}),(0,Q.jsx)(Le,{id:e.id,verdict:e.verdict,note:e.note,onChanged:r})]},e.id))})}),t===`team`&&(0,Q.jsx)(`div`,{role:`tabpanel`,id:`panel-team`,"aria-labelledby":`tab-team`,className:`flex flex-col gap-3`,children:e.team?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`m-0 text-sm text-ink-2`,children:[e.team.passed,` of `,e.team.questions,` answered right, `,e.team.grounded,` with every quote found in its file`,e.team.model?`, by ${e.team.model}`:``,`, `,se(e.team.at),`.`]}),(0,Q.jsx)(U,{id:`team-scores`,title:`Questions`,icon:l,n:e.team.scores.length,children:(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.team.scores.map(e=>(0,Q.jsxs)(`li`,{className:`flex items-start gap-2 border-b border-line-soft py-3 last:border-b-0`,children:[e.pass?(0,Q.jsx)(B,{size:16,role:`img`,"aria-label":`Answered right`,className:`mt-0.5 flex-none text-pass`}):(0,Q.jsx)(_,{size:16,role:`img`,"aria-label":`Not answered right`,className:`mt-0.5 flex-none text-warn`}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Q.jsx)(`span`,{className:`text-[14px] font-medium [overflow-wrap:anywhere]`,children:e.question}),!e.pass&&(0,Q.jsx)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:e.why.join(`; `)})]})]},e.id))})})]}):(0,Q.jsx)($,{icon:l,children:`No team questions yet. Write questions whose answers your team knows (evals/knowledge/shop/questions.yaml shows how), then run forgeqe knowledge eval with the file: each answer is scored, and the last result shows here.`})})]})}var Xe=e=>/^https:\/\/[^/\s]/i.test(e)&&!/[\u0000-\u0020\u007f-\u009f]/.test(e);function Ze({id:e,onClose:n}){let[r,i]=(0,K.useState)(null),[a,o]=(0,K.useState)(``);return(0,K.useEffect)(()=>{if(!e)return;let t=!1;return i(null),o(``),A.part(e).then(e=>!t&&i(e),e=>!t&&o(e.message)),()=>{t=!0}},[e]),(0,Q.jsxs)(ae,{open:!!e,onClose:n,title:r?.part.name||`Part`,description:r?.part.where,footer:(0,Q.jsx)(t,{onClick:n,children:`Close`}),wide:!0,children:[a&&(0,Q.jsx)(W,{text:a}),!r&&!a&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),r&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[r.part.summary&&(0,Q.jsx)(`p`,{className:`m-0 text-sm leading-relaxed text-ink-2 [overflow-wrap:anywhere]`,children:r.part.summary}),(0,Q.jsxs)(`section`,{"aria-labelledby":`evidence-h`,className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h3`,{id:`evidence-h`,className:`m-0 text-base font-semibold`,children:`How it is known`}),r.part.evidence?.length?(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:r.part.evidence.map((e,t)=>(0,Q.jsx)(`li`,{className:`border-b border-line-soft py-2 font-mono text-[12.5px] leading-relaxed text-ink-2 [overflow-wrap:anywhere] last:border-b-0`,children:e},t))}):(0,Q.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No evidence kept for it: build the graph again.`}),r.links?.some(e=>Xe(e.url))&&(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:r.links.filter(e=>Xe(e.url)).map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 text-[13px] [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(H,{size:13,"aria-hidden":`true`,className:`flex-none`}),e.label]})},e.url))})]}),r.groups.map(e=>(0,Q.jsxs)(`section`,{"aria-label":e.label,className:`flex flex-col gap-1`,children:[(0,Q.jsxs)(`h3`,{className:`m-0 text-sm font-semibold`,children:[e.label,` (`,e.rows.length+e.more,`)`]}),(0,Q.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[e.rows.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-col py-1.5`,children:[(0,Q.jsx)(`span`,{className:`text-[14px] font-medium [overflow-wrap:anywhere]`,children:e.name}),(0,Q.jsx)(`span`,{className:`font-mono text-[12px] text-muted [overflow-wrap:anywhere]`,children:e.where})]},e.id)),e.more>0&&(0,Q.jsxs)(`li`,{className:`py-1 text-[12px] text-muted`,children:[`… and `,e.more,` more`]})]})]},e.label))]})]})}function Qe({view:e}){let t=t=>e.nodes.find(e=>e.id===t)?.name||t;if(!e.links.length)return(0,Q.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No link between the parts was found.`});let n=[`differs`,`seen`,`read`,`inferred`];return(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[...e.links].sort((e,t)=>n.indexOf(e.known)-n.indexOf(t.known)).map((e,n)=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 border-b border-line-soft py-2.5 last:border-b-0`,children:[(0,Q.jsxs)(`span`,{className:`min-w-0 flex-[1_1_320px] text-[14px] [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:t(e.from)}),` `,(0,Q.jsx)(`span`,{className:`text-muted`,children:e.label}),` `,(0,Q.jsx)(`span`,{className:`font-medium`,children:t(e.to)}),e.count>1&&(0,Q.jsxs)(`span`,{className:`text-muted`,children:[` · `,e.count,` places in the code`]}),e.example&&(0,Q.jsx)(`span`,{className:`block text-[12px] text-muted`,children:e.example})]}),(0,Q.jsx)(G,{known:e.known})]},n))})}function $e({id:e}){let[t,n]=(0,K.useState)(null),[r,i]=(0,K.useState)(``);return(0,K.useEffect)(()=>{let t=!1;return g.impact(e).then(e=>!t&&n(e),e=>!t&&i(e.message)),()=>{t=!0}},[e]),r?(0,Q.jsx)(W,{text:r}):t?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 py-2 pl-3 text-[13px]`,children:[(0,Q.jsxs)(`span`,{className:`text-muted`,children:[t.reached.length?`A change here reaches ${t.reached.length} ${t.reached.length===1?`part`:`parts`}`:`Nothing else depends on it in the graph`,t.tests.length?`; ${t.tests.length} ${t.tests.length===1?`test covers`:`tests cover`} them.`:`; no test covers it.`]}),t.reached.length>0&&(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:t.reached.slice(0,15).map(e=>(0,Q.jsxs)(`li`,{className:`py-0.5 [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:e.name}),` `,(0,Q.jsxs)(`span`,{className:`text-muted`,children:[`(`,e.type,`, `,(0,Q.jsx)(`span`,{className:`font-mono`,children:e.where}),`)`]})]},e.id))}),t.tests.length>0&&(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:t.tests.slice(0,10).map(e=>(0,Q.jsxs)(`li`,{className:`py-0.5 text-muted [overflow-wrap:anywhere]`,children:[`Test: `,e.name,` (`,(0,Q.jsx)(`span`,{className:`font-mono`,children:e.where}),`)`]},e.id))})]}):(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`})}function et({p:e,extra:n,onEvidence:r,children:i}){return(0,Q.jsxs)(`li`,{className:`border-b border-line-soft py-2.5 last:border-b-0`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_320px] flex-col`,children:[(0,Q.jsxs)(`span`,{className:`text-[14px] font-medium [overflow-wrap:anywhere]`,children:[e.name,n]}),(0,Q.jsxs)(`span`,{className:`text-[12px] text-muted [overflow-wrap:anywhere]`,children:[e.note,e.note&&e.where?` · `:``,e.where&&(0,Q.jsx)(`span`,{className:`font-mono`,children:e.where})]})]}),(0,Q.jsx)(G,{known:e.known}),(0,Q.jsxs)(t,{size:`sm`,variant:`ghost`,onClick:()=>r(e.id),children:[(0,Q.jsx)(o,{icon:k,size:15}),`Evidence`]})]}),i]})}function tt({gaps:e,onError:n}){return(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.map((e,r)=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 border-b border-line-soft py-2.5 last:border-b-0`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_360px] flex-col`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[14px] font-medium [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(_,{size:14,"aria-hidden":`true`,className:`flex-none text-warn`}),e.what]}),(0,Q.jsxs)(`span`,{className:`text-[12px] text-muted [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(`span`,{className:`font-mono`,children:e.where}),e.quote?` · ${e.quote}`:``]}),(0,Q.jsx)(`span`,{className:`text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:e.next})]}),(0,Q.jsxs)(t,{size:`sm`,variant:`ghost`,onClick:()=>void le(e.what,`${e.where}. ${e.next}`,n),children:[(0,Q.jsx)(o,{icon:v,size:15}),`Investigate`]})]},r))})}function nt({repo:e,onEvidence:r}){let[s,c]=(0,K.useState)(null),[l,d]=(0,K.useState)(``),[f,p]=(0,K.useState)(null),[m,h]=(0,K.useState)(``);return(0,K.useEffect)(()=>{let t=!1;return c(null),d(``),g.service(e).then(e=>!t&&c(e),e=>!t&&d(e.message)),()=>{t=!0}},[e]),l?(0,Q.jsx)(W,{text:l}):s?(0,Q.jsxs)(`section`,{"aria-labelledby":`service-h`,className:`flex min-w-0 flex-col gap-6`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsxs)(`a`,{href:S(`product`,`services`),className:`inline-flex items-center gap-1.5 self-start text-sm`,children:[(0,Q.jsx)(z,{size:16,"aria-hidden":`true`}),`All services`]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,Q.jsx)(`h2`,{id:`service-h`,className:`m-0 flex-[1_1_260px] text-[22px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:s.repo}),(0,Q.jsxs)(t,{size:`sm`,variant:`ghost`,onClick:()=>void le(`How does ${s.repo} work, and what does it depend on?`,s.summary,h),children:[(0,Q.jsx)(o,{icon:a,size:15}),`Ask in a chat`]})]}),(0,Q.jsx)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-ink-2 [overflow-wrap:anywhere]`,children:s.summary}),(0,Q.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[s.counts.files,` files, `,s.counts.classes,` classes, `,s.counts.tests,` test files`,s.deployedAs.length?` · deployed as ${s.deployedAs.join(`; `)}`:``]}),m&&(0,Q.jsx)(W,{text:m})]}),(0,Q.jsx)(U,{id:`endpoints`,title:`Endpoints`,icon:n,n:s.endpoints.length,children:s.endpoints.length?(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:s.endpoints.map(e=>(0,Q.jsxs)(et,{p:e,onEvidence:r,extra:e.auth?(0,Q.jsxs)(`span`,{className:`font-normal text-muted`,children:[` · requires `,e.auth]}):null,children:[e.differs&&(0,Q.jsxs)(`span`,{className:`flex items-center gap-1 text-[12px] text-warn`,children:[(0,Q.jsx)(_,{size:12,"aria-hidden":`true`}),`A run called a route near it: Runs against the code.`]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 text-[12px] text-muted`,children:[(0,Q.jsx)(`span`,{children:e.callers.length?`Called by ${e.callers.join(`, `)}`:`No caller found in the other repositories`}),(0,Q.jsx)(`button`,{type:`button`,"aria-expanded":f===e.id,onClick:()=>p(f===e.id?null:e.id),className:`inline-flex min-h-11 cursor-pointer items-center border-0 bg-transparent p-0 text-[12px] text-accent-fg hover:text-accent-fg-hover`,children:f===e.id?`Hide what a change reaches`:`What a change reaches`})]}),(0,Q.jsx)(I,{open:f===e.id,children:f===e.id&&(0,Q.jsx)($e,{id:e.id})})]},e.id))}):(0,Q.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`It serves no endpoint the patterns read.`})}),[{id:`calls`,title:`Calls out`,icon:M,rows:s.calls.map(e=>({p:e,extra:(0,Q.jsxs)(`span`,{className:`font-normal text-muted`,children:[` · `,e.to]})}))},{id:`data`,title:`Data`,icon:x,rows:s.data.map(e=>({p:e,extra:(0,Q.jsxs)(`span`,{className:`font-normal text-muted`,children:[` · `,e.use]})}))},{id:`messages`,title:`Messages`,icon:u,rows:s.messages.map(e=>({p:e,extra:(0,Q.jsxs)(`span`,{className:`font-normal text-muted`,children:[` · `,e.use]})}))},{id:`outside`,title:`Outside services`,icon:i,rows:s.outside.map(e=>({p:e,extra:null}))},{id:`cloud`,title:`Cloud resources`,icon:E,rows:s.cloud.map(e=>({p:e,extra:null}))}].filter(e=>e.rows.length).map(e=>(0,Q.jsx)(U,{id:e.id,title:e.title,icon:e.icon,n:e.rows.length,children:(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.rows.map((e,t)=>(0,Q.jsx)(et,{p:e.p,extra:e.extra,onEvidence:r},`${e.p.id}-${t}`))})},e.id)),s.gaps.length>0&&(0,Q.jsx)(U,{id:`service-gaps`,title:`Open questions`,icon:_,n:s.gaps.length,children:(0,Q.jsx)(tt,{gaps:s.gaps,onError:h})})]}):(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`})}function rt({view:t,onEvidence:n,onError:r}){let i=t.runtime;return i?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Q.jsxs)(`p`,{className:`m-0 text-sm text-ink-2`,children:[i.runs,` runs made `,i.calls,` API calls; `,i.matched,` reached a route the code declares. `,i.seen,` of `,i.endpoints,` endpoints were seen in a run.`]}),(0,Q.jsx)(U,{id:`differs`,title:`Differ from the code`,icon:_,n:i.differs.length,children:i.differs.length?(0,Q.jsx)(tt,{gaps:i.differs,onError:r}):(0,Q.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No call differs from the code.`})}),(0,Q.jsx)(U,{id:`only`,title:`Only the runs show`,icon:k,n:i.only.length,children:i.only.length?(0,Q.jsx)(tt,{gaps:i.only,onError:r}):(0,Q.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Every call reached a route the code declares.`})}),(0,Q.jsx)(U,{id:`unseen`,title:`Never seen in a run`,icon:oe,n:i.endpoints-i.seen,children:(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:i.notSeen.map(e=>(0,Q.jsx)(et,{p:{...e,known:`read`,note:``},onEvidence:n},e.id))})})]}):(0,Q.jsxs)(`div`,{className:`flex flex-col items-start gap-3 rounded-[18px] border border-line p-6`,children:[(0,Q.jsx)(o,{icon:e,size:22,className:`text-muted`}),(0,Q.jsx)(`p`,{className:`m-0 max-w-[62ch] leading-relaxed text-ink-2`,children:`No run of ForgeQE has recorded API calls yet. Every browser run records them; after a run, build the product graph again and what the runs did shows here against the code.`})]})}function it({sub:e}){let[t,r]=(0,K.useState)(null),[i,a]=(0,K.useState)(``),[s,c]=(0,K.useState)(``),[l,u]=(0,K.useState)(null),d=(e||``).split(`/`),f=d[0]===`business`,[p,h]=(0,K.useState)(null),_=(0,K.useCallback)(()=>{re.view().then(h,e=>a(e.message))},[]);(0,K.useEffect)(()=>{f&&!p&&_()},[f,p,_]);let v=[`capabilities`,`journeys`,`rules`,`data`,`glossary`,`team`].find(e=>e===d[1]&&(e!==`glossary`||!!p?.terms.length))||`capabilities`,y=[`links`,`runtime`,`questions`].find(e=>e===d[0])||(d[0]===`services`?`services`:`landscape`),b=d[0]===`services`&&d[1]?decodeURIComponent(d[1]):``,x=d[0]===`systems`&&d[1]?decodeURIComponent(d[1]):``,C=!f&&(y===`landscape`||y===`services`&&!b);(0,K.useEffect)(()=>{g.view().then(e=>{r(e),a(``)},e=>a(e.message))},[]);let w=e=>{e.repo&&e.column!==`data`?location.hash=S(`product`,`services`,encodeURIComponent(e.repo)):e.part&&u(e.part)};return(0,Q.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,Q.jsx)(ee,{}),(0,Q.jsxs)(`main`,{className:m(V,`@container flex-auto gap-4`,C&&t?.built&&`max-w-none`),children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,Q.jsx)(P,{pixel:ne.product,size:`lg`}),(0,Q.jsx)(`h1`,{className:`m-0 flex-1 text-[26px] font-semibold tracking-[-0.01em]`,children:`Product`})]}),(0,Q.jsxs)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-muted`,children:[`How `,t?.product||`the product`,` is built and how it works for the business, read from its repositories, documents and ForgeQE's runs. Each part says how it is known, and you can mark what the business view says right or wrong.`]}),i&&(0,Q.jsx)(W,{text:i}),s&&(0,Q.jsx)(W,{text:s}),!t&&!i&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),t&&!t.built&&(0,Q.jsxs)(`div`,{className:`flex flex-col items-start gap-3 rounded-[18px] border border-line p-6`,children:[(0,Q.jsx)(o,{icon:n,size:22,className:`text-muted`}),(0,Q.jsx)(`p`,{className:`m-0 max-w-[62ch] leading-relaxed text-ink-2`,children:`The product graph is not built yet. Add the product's repositories under Settings, Agents, then run forgeqe knowledge build, or ask in a chat to build it.`})]}),t?.built&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{role:`radiogroup`,"aria-label":`View`,className:`flex gap-1 self-start rounded-[10px] bg-surface-strong p-1`,children:[[`engineering`,`Engineering`,S(`product`)],[`business`,`Product`,S(`product`,`business`)]].map(([e,t,n])=>(0,Q.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e===`business`===f,onClick:()=>location.hash=n,className:m(`inline-flex min-h-8 cursor-pointer items-center gap-1.5 rounded-[7px] border-0 px-3 text-sm font-medium`,e===`business`===f?`bg-bg text-ink shadow-sm`:`bg-transparent text-muted hover:text-ink`),children:t},e))}),f&&!p&&!i&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),f&&p&&(0,Q.jsx)(Ye,{view:p,tab:v,item:d[2]?decodeURIComponent(d[2]):void 0,onChanged:_}),!f&&t.summary.length>0&&(0,Q.jsx)(`p`,{className:`m-0 text-sm text-ink-2`,children:t.summary.join(` `)}),!f&&(0,Q.jsx)(F,{label:`Product`,current:y,onPick:e=>location.hash=e===`landscape`?S(`product`):S(`product`,e),tabs:[{id:`landscape`,label:`Landscape`},{id:`services`,label:`Services`},{id:`links`,label:`How they talk (${t.links.length})`},{id:`runtime`,label:`Runs against the code`},{id:`questions`,label:`Open questions (${t.gapsTotal})`}]}),!f&&y===`services`&&(0,Q.jsx)(`div`,{role:`tabpanel`,id:`panel-services`,"aria-labelledby":`tab-services`,className:`flex flex-col gap-8`,children:b?(0,Q.jsx)(nt,{repo:b,onEvidence:u}):(0,Q.jsxs)(`section`,{"aria-labelledby":`map-h`,className:`flex flex-col gap-3`,children:[(0,Q.jsx)(`h2`,{id:`map-h`,className:`sr-only`,children:`Services map`}),(0,Q.jsx)(De,{view:t,onOpen:w})]})}),!f&&y===`landscape`&&(0,Q.jsx)(`div`,{role:`tabpanel`,id:`panel-landscape`,"aria-labelledby":`tab-landscape`,children:x?(0,Q.jsx)(Ie,{eng:t,name:x,onOpen:w}):(0,Q.jsx)(Ne,{onPart:u})}),!f&&y===`links`&&(0,Q.jsxs)(`div`,{role:`tabpanel`,id:`panel-links`,"aria-labelledby":`tab-links`,className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`p`,{className:`m-0 max-w-[74ch] text-sm text-muted`,children:`Every link between the parts, how often it is in the code, and how it is known: the map's wires in words.`}),(0,Q.jsx)(Qe,{view:t})]}),!f&&y===`runtime`&&(0,Q.jsx)(`div`,{role:`tabpanel`,id:`panel-runtime`,"aria-labelledby":`tab-runtime`,children:(0,Q.jsx)(rt,{view:t,onEvidence:u,onError:c})}),!f&&y===`questions`&&(0,Q.jsxs)(`div`,{role:`tabpanel`,id:`panel-questions`,"aria-labelledby":`tab-questions`,className:`flex flex-col gap-3`,children:[(0,Q.jsx)(`p`,{className:`m-0 max-w-[74ch] text-sm text-muted`,children:`What the build could not settle. Investigate one: ForgeQE's agent asks the investigator in a chat, which reads the code, documents and runs and answers with the lines it rests on.`}),t.gaps.length?(0,Q.jsx)(tt,{gaps:t.gaps,onError:c}):(0,Q.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No open question.`}),t.gapsTotal>t.gaps.length&&(0,Q.jsxs)(`p`,{className:`m-0 text-[12px] text-muted`,children:[`… and `,t.gapsTotal-t.gaps.length,` more: forgeqe knowledge gaps.`]})]})]})]}),(0,Q.jsx)(Ze,{id:l,onClose:()=>u(null)})]})}export{it as Product};
1
+ import{Bn as e,Bt as t,Cn as n,Di as r,Dr as i,En as a,Ht as o,In as s,Lr as c,Mn as l,Mr as u,Pn as d,Si as f,Un as p,Wt as m,Yt as h,Zr as g,Zt as _,an as v,at as y,cn as b,cr as x,ct as S,et as C,kn as w,kr as T,ln as E,mn as D,n as ee,nn as O,oi as te,ot as ne,pn as k,ri as A,st as j,ui as re,vn as M,vr as N,vt as P,w as F,wi as ie,xt as ae,yt as I}from"./Shell-C-_iUijV.js";import{t as L}from"./arrow-right-B3tcUlkA.js";import{t as oe}from"./circle-dashed-kZh6s667.js";import{t as R}from"./circle-dot-B5NyEMK3.js";import{G as z,H as B,t as V,z as H}from"./index-BxNs3KZC.js";import{t as se}from"./when-CHnpLdYw.js";import{a as U,i as W,n as ce,o as le,r as G,t as ue}from"./productParts-RYNeN2sM.js";var de={name:`corner-down-right`,size:24,node:[[`path`,{d:`m15 10 5 5-5 5`,key:`qqa56n`}],[`path`,{d:`M4 4v7a4 4 0 0 0 4 4h12`,key:`z08zvw`}]]};de.node;var fe=c(de),K=r(ie(),1),q={w:196,h:60},J=56,pe=24,me=36,Y=18,he=30,X=8,Z=12,ge=14,_e=6;function ve(e,t=8){let n=e=>Math.round(e*10)/10,r=`M${n(e[0][0])} ${n(e[0][1])}`;for(let i=1;i<e.length-1;i++){let[a,o]=e[i-1],[s,c]=e[i],[l,u]=e[i+1],d=Math.min(t,Math.hypot(s-a,c-o)/2),f=Math.min(t,Math.hypot(l-s,u-c)/2),p=s-Math.sign(s-a)*d,m=c-Math.sign(c-o)*d,h=s+Math.sign(l-s)*f,g=c+Math.sign(u-c)*f;r+=` L${n(p)} ${n(m)} Q${n(s)} ${n(c)} ${n(h)} ${n(g)}`}let[i,a]=e[e.length-1];return`${r} L${n(i)} ${n(a)}`}function ye(e){let t=[];for(let n of e){let e=t[t.length-1];e&&Math.abs(e[0]-n[0])<.01&&Math.abs(e[1]-n[1])<.01||t.push(n)}return t.filter((e,n)=>{if(n===0||n===t.length-1)return!0;let[r,i]=[t[n-1],t[n+1]];return!(Math.abs(r[0]-e[0])<.01&&Math.abs(i[0]-e[0])<.01||Math.abs(r[1]-e[1])<.01&&Math.abs(i[1]-e[1])<.01)})}function be(e,t,n,r){let i=r?e.filter(e=>e.band===r):[],a=n.filter(t=>e.some(e=>e.band===t)),o=new Set([...e.filter(e=>a.includes(e.band)).map(e=>e.id),...i.map(e=>e.id)]),s=t.filter(e=>o.has(e.from)&&o.has(e.to)&&e.from!==e.to),c=new Set(i.map(e=>e.id)),l=new Map;for(let e of s)l.set(e.from,[...l.get(e.from)||[],e.to]),l.set(e.to,[...l.get(e.to)||[],e.from]);let u=new Map(a.map(t=>[t,e.filter(e=>e.band===t).map(e=>e.id)])),d=new Map,f=e=>u.get(e).forEach((e,t,n)=>d.set(e,n.length>1?t/(n.length-1):.5)),p=(e,t)=>{let n=u.get(e),r=(e,r)=>{let i=(l.get(e)||[]).filter(e=>t(e)&&d.has(e)).map(e=>d.get(e));return i.length?i.reduce((e,t)=>e+t,0)/i.length:n.length>1?r/(n.length-1):.5},i=n.map((e,t)=>({id:e,k:r(e,t),i:t}));i.sort((e,t)=>e.k-t.k||e.i-t.i),u.set(e,i.map(e=>e.id)),f(e)};a.forEach(f);let m=new Map(e.map(e=>[e.id,e.band])),h=e=>t=>a.indexOf(m.get(t))<a.indexOf(e),g=e=>t=>a.indexOf(m.get(t))>a.indexOf(e);a.slice(1).forEach(e=>p(e,h(e))),a.slice(0,-1).reverse().forEach(e=>p(e,g(e)));let _=Math.max(1,...a.map(e=>u.get(e).length)),v=Math.min(_,_e),y=[];for(let e of a){let t=u.get(e);for(let n=0;n<t.length;n+=v)y.push({band:e,ids:t.slice(n,n+v)})}let b=new Map;y.forEach((e,t)=>e.ids.forEach(e=>b.set(e,t)));let x=v*q.w+(v-1)*J,S=new Map,C=y.map(e=>{let t=e.ids.length*q.w+(e.ids.length-1)*J,n=(x-t)/2;return e.ids.forEach((e,t)=>S.set(e,n+t*(q.w+J))),{left:n,right:n+t}}),w=e=>S.get(e)+q.w/2,T=[],E=(e,t,n)=>{for(let r=t;r<=n;r++)for(let t of y[r].ids)if(e>S.get(t)-6&&e<S.get(t)+q.w+6)return!1;return!0};s.forEach((e,t)=>{let n=c.has(e.to)&&!c.has(e.from),r=c.has(e.from)&&!c.has(e.to);if(c.has(e.from)&&c.has(e.to))return;let i=r?{from:e.to,to:e.from}:e,a=b.get(i.from);if(n||r){T.push({e,i:t,reverse:r,out:{side:`bottom`,node:i.from,edge:t},inn:{side:`left`,node:i.to,edge:t},c1:a+1,c2:a+1,toSide:!0});return}let o=b.get(i.to),s=a<=o,l={side:a<o||a===o?`bottom`:`top`,node:i.from,edge:t},u={side:a<o?`top`:`bottom`,node:i.to,edge:t},d=s?a+1:a,f=a<o?o:o+1,p;if(d!==f){let[e,t]=d<f?[d,f-1]:[f,d-1],n=(w(i.from)+w(i.to))/2,r=new Set;for(let n=e;n<=t;n++)y[n].ids.forEach((e,t)=>t>0&&r.add(S.get(e)-J/2)),r.add(C[n].left-J/2),r.add(C[n].right+J/2);let a=[...r].filter(n=>n>-29&&n<x+J/2+1&&E(n,e,t)).sort((e,t)=>Math.abs(e-n)-Math.abs(t-n));p=a.length?a[0]:`gutter`}T.push({e,i:t,reverse:!1,out:l,inn:u,c1:d,c2:f,corridor:p,toSide:!1})});let D=e=>{let t=new Map;for(let n of T)for(let r of e(n))t.set(r,[...t.get(r)||[],n]);return t},ee=e=>w(e.toSide&&e.reverse?e.e.to:e.e.from),O=D(e=>e.c1===e.c2?[e.c1]:[e.c1,e.c2]);for(let[,e]of O)e.sort((e,t)=>ee(e)-ee(t));let te=D(e=>typeof e.corridor==`number`?[e.corridor]:[]),ne=T.filter(e=>e.corridor===`gutter`),k=T.filter(e=>e.toSide),A=(e,t)=>{if(!e)return 0;let n=e.length;return(e.indexOf(t)-(n-1)/2)*X},j=y.length,re=e=>{let t=16+(O.get(e)?.length||0)*X;return e===j?Math.max(28,t):y[e-1].band===y[e].band?Math.max(he,t):Math.max(72,t+24)},M=[],N=[],P=48;for(let e=0;e<j;e++){M.push(P),P+=q.h;let t=re(e+1);e+1<j&&y[e].band!==y[e+1].band?N[e+1]=P+Y+(t-Y-me)/2:N[e+1]=P+t/2,P+=t}let F=M[j-1]+q.h+re(j),ie=ne.length?16+ne.length*X:0,ae=Z+ie+pe,I=Z+ie,L=x+48,oe=k.length?20+k.length*X:0,R=I+L+Math.max(oe,24),z=new Map;y.forEach((e,t)=>e.ids.forEach(n=>z.set(n,{id:n,band:e.band,x:ae+S.get(n),y:M[t],w:q.w,h:q.h})));let B=[];for(let e of a){let t=y.map((e,t)=>({r:e,i:t})).filter(t=>t.r.band===e),n=M[t[0].i]-me,r=M[t[t.length-1].i]+q.h+Y;B.push({id:e,x:I,y:n,w:L,h:r-n})}let V=0;if(r&&i.length){let e=e=>{let t=(l.get(e)||[]).filter(e=>z.has(e)).map(e=>z.get(e).y);return t.length?t.reduce((e,t)=>e+t,0)/t.length:1/0},t=i.map((t,n)=>({id:t.id,k:e(t.id),i:n})).sort((e,t)=>e.k-t.k||e.i-t.i),n=Z,a=48;for(let e of t){let t=Math.max(a,Number.isFinite(e.k)?e.k:a);z.set(e.id,{id:e.id,band:r,x:R+pe,y:t,w:q.w,h:q.h}),a=t+q.h+ge}V=a-ge+Y;let o=Math.max(V,F-10)-n;B.push({id:r,x:R,y:n,w:q.w+48,h:o}),V=n+o}let H=new Map;for(let e of T)for(let t of[e.out,e.inn])H.set(`${t.node}|${t.side}`,[...H.get(`${t.node}|${t.side}`)||[],t]);let se=e=>{let t=T.find(t=>t.i===e.edge),n=t.reverse?{from:t.e.to,to:t.e.from}:t.e,r=e.node===n.from?n.to:n.from,i=z.get(r);return e.side===`left`?i.y:i.x};for(let[,e]of H)e.sort((e,t)=>se(e)-se(t));let U=e=>{let t=z.get(e.node),n=H.get(`${e.node}|${e.side}`),r=n.indexOf(e),i=n.length;if(e.side===`left`)return[t.x,t.y+t.h*(r+1)/(i+1)];let a=Math.min(t.w*.7,i*22);return[t.x+t.w/2-a/2+(i===1?a/2:a*r/(i-1)),e.side===`top`?t.y:t.y+t.h]},W=[];for(let e of T){let t=U(e.out),n=U(e.inn),r=N[e.c1]+A(O.get(e.c1),e),i;if(e.toSide){let a=I+L+12+k.indexOf(e)*X;i=[t,[t[0],r],[a,r],[a,n[1]],n]}else if(e.c1===e.c2)i=[t,[t[0],r],[n[0],r],n];else{let a=N[e.c2]+A(O.get(e.c2),e),o=e.corridor===`gutter`?20+ne.indexOf(e)*X:ae+e.corridor+A(te.get(e.corridor),e);i=[t,[t[0],r],[o,r],[o,a],[n[0],a],n]}i=ye(i),e.reverse&&i.reverse(),W.push({index:e.i,from:e.e.from,to:e.e.to,points:i,d:ve(i)})}return{w:r&&i.length?R+q.w+48+Z:I+L+Math.max(oe,0)+Z,h:Math.max(F,V)+Z,boxes:z,bands:B,wires:W}}var Q=f(),xe=[{id:`front`,label:`Front ends`,icon:p,hue:`#0B6E4F`},{id:`gateway`,label:`Gateways`,icon:D,hue:`#C86A0A`},{id:`service`,label:`Services`,icon:E,hue:`#2563EB`},{id:`data`,label:`Data and messages`,icon:x,hue:`#0B8A8A`},{id:`outside`,label:`Outside`,icon:i,hue:`#5B4BC9`}],Se=e=>e.repo&&e.column!==`data`?`select it to see it from the inside`:e.part?`select it for how it is known`:``,Ce=.72;function we(e){return e.known===`seen`?`stroke-pass`:e.known===`differs`?`stroke-warn`:`stroke-muted`}var Te=[`seen`,`differs`,`read`,`inferred`];function Ee(e){let t=new Map;for(let n of e){let e=`${n.from}\u0000${n.to}`,r=t.get(e);(!r||Te.indexOf(n.known)<Te.indexOf(r.known))&&t.set(e,{from:n.from,to:n.to,known:n.known})}return t}function De({view:e,onOpen:t,words:n={}}){let r=e=>({...xe.find(t=>t.id===e),...n.bands?.[e]}),i=(0,K.useMemo)(()=>Ee(e.links),[e]),a=(0,K.useMemo)(()=>be(e.nodes.map(e=>({id:e.id,band:e.column})),[...i.values()].map(e=>({from:e.from,to:e.to})),[`front`,`gateway`,`service`,`data`],`outside`),[e,i]),s=(0,K.useRef)(null),[c,l]=(0,K.useState)(1),[u,d]=(0,K.useState)(null),[f,p]=(0,K.useState)(null),h=u||f;(0,K.useLayoutEffect)(()=>{let e=()=>{let e=s.current;if(!e)return;let t=window.innerHeight-e.getBoundingClientRect().top-24,n=Math.min(e.clientWidth/a.w,Math.max(t,360)/a.h,1);l(Math.max(Ce,n))};e();let t=typeof ResizeObserver>`u`?null:new ResizeObserver(e);return s.current&&t?.observe(s.current),window.addEventListener(`resize`,e),()=>{t?.disconnect(),window.removeEventListener(`resize`,e)}},[a]);let g=new Map(e.nodes.map(e=>[e.id,e])),_=e=>!h||e.from===h||e.to===h,v=new Set(h?e.links.filter(e=>e.from===h||e.to===h).flatMap(e=>[e.from,e.to]):[]),y=c<=Ce&&(s.current?.clientWidth||1/0)<a.w*c,b=(e,t)=>i.get(`${e}\u0000${t}`);return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Q.jsx)(`div`,{ref:s,className:`w-full overflow-x-auto`,onMouseLeave:()=>d(null),children:(0,Q.jsx)(`div`,{className:`relative mx-auto`,style:{width:a.w*c,height:a.h*c},children:(0,Q.jsxs)(`div`,{className:`absolute top-0 left-0`,style:{width:a.w,height:a.h,transform:`scale(${c})`,transformOrigin:`0 0`},children:[(0,Q.jsxs)(`svg`,{"aria-hidden":`true`,width:a.w,height:a.h,viewBox:`0 0 ${a.w} ${a.h}`,className:`absolute inset-0 overflow-visible`,children:[(0,Q.jsx)(`defs`,{children:[`pass`,`warn`,`muted`].map(e=>(0,Q.jsx)(`marker`,{id:`map-${e}`,viewBox:`0 0 8 8`,refX:7,refY:4,markerWidth:8,markerHeight:8,markerUnits:`userSpaceOnUse`,orient:`auto`,children:(0,Q.jsx)(`path`,{d:`M0 0 L8 4 L0 8 Z`,className:e===`pass`?`fill-pass`:e===`warn`?`fill-warn`:`fill-muted`})},e))}),a.bands.map(e=>(0,Q.jsx)(`rect`,{x:e.x,y:e.y,width:e.w,height:e.h,rx:16,fill:r(e.id).hue,fillOpacity:.055,stroke:r(e.id).hue,strokeOpacity:.24},e.id)),a.wires.map(e=>(0,Q.jsx)(`path`,{d:e.d,fill:`none`,strokeWidth:5,className:`stroke-bg`,opacity:_(e)?1:.15},`h${e.index}`)),a.wires.map(e=>{let t=b(e.from,e.to),n=g.get(e.from)?.column===`outside`||g.get(e.to)?.column===`outside`,r=t.known===`seen`?`pass`:t.known===`differs`?`warn`:`muted`;return(0,Q.jsx)(`path`,{d:e.d,fill:`none`,strokeWidth:h&&_(e)?2.25:t.known===`seen`?1.75:1.4,strokeDasharray:n?`5 4`:t.known===`differs`?`2 3`:void 0,markerEnd:`url(#map-${r})`,className:m(we(t),`transition-opacity duration-150`),opacity:_(e)?1:.15},e.index)})]}),a.bands.map(e=>(0,Q.jsxs)(`span`,{className:`absolute z-[1] flex items-center gap-1.5 rounded-[6px] bg-bg/90 px-1.5 py-0.5 text-[12px] font-semibold text-ink-2`,style:{left:e.x+10,top:e.y+7},children:[(0,Q.jsx)(`span`,{className:`size-2 rounded-full`,style:{background:r(e.id).hue},"aria-hidden":`true`}),r(e.id).label]},e.id)),[...a.boxes.values()].map(n=>{let i=g.get(n.id),a=h&&h!==i.id&&!v.has(i.id),s=e.links.filter(e=>e.from===i.id).length,c=e.links.filter(e=>e.to===i.id).length;return(0,Q.jsxs)(`button`,{type:`button`,onMouseEnter:()=>d(i.id),onFocus:()=>p(i.id),onBlur:()=>p(e=>e===i.id?null:e),onClick:()=>t(i),"aria-label":`${i.name}, ${r(i.column).label.toLowerCase()}: ${i.detail}. ${ce[i.known].label}. Sends to ${s}, receives from ${c}.`,className:m(`absolute flex cursor-pointer flex-col justify-center gap-0.5 rounded-[10px] border bg-bg px-3 text-left transition-opacity duration-150 hover:bg-surface-muted`,i.column===`outside`&&`border-dashed`,a&&`opacity-40`,h===i.id&&`shadow-md`),style:{left:n.x,top:n.y,width:n.w,height:n.h,borderColor:`color-mix(in srgb, ${r(i.column).hue} 55%, transparent)`},children:[(0,Q.jsxs)(`span`,{className:`flex w-full min-w-0 items-center gap-1.5 text-[13.5px] font-semibold text-ink`,children:[(0,Q.jsx)(o,{icon:r(i.column).icon,size:14,className:`flex-none`}),(0,Q.jsx)(`span`,{className:`truncate`,children:i.name}),i.known===`seen`&&(0,Q.jsx)(B,{size:13,"aria-hidden":`true`,className:`ml-auto flex-none text-pass`})]}),(0,Q.jsx)(`span`,{className:`truncate font-mono text-[11px] text-muted`,children:i.detail})]},i.id)})]})})}),y&&(0,Q.jsx)(`p`,{className:`m-0 text-[12px] text-muted`,children:`Scroll sideways to see the whole map.`}),(0,Q.jsx)(Oe,{}),(0,Q.jsx)(ke,{view:e,id:h,words:n,band:r})]})}function Oe(){let e=(e,t,n)=>(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Q.jsx)(`svg`,{width:`28`,height:`8`,"aria-hidden":`true`,children:(0,Q.jsx)(`path`,{d:`M1 4 H27`,fill:`none`,strokeWidth:1.75,strokeDasharray:e,className:t})}),n]});return(0,Q.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-x-5 gap-y-1 text-[12px] text-muted`,children:[e(void 0,`stroke-muted`,`Inside the product, read in the code`),e(`5 4`,`stroke-muted`,`To or from an outside system`),e(void 0,`stroke-pass`,`Seen in a run`),e(`2 3`,`stroke-warn`,`A run called it differently`)]})}function ke({view:e,id:t,words:n,band:r}){let i=t?e.nodes.find(e=>e.id===t):void 0,a=i?(n.hint||Se)(i):``,o=t=>e.nodes.find(e=>e.id===t)?.name||t,s=(e,t)=>{let n=new Map;for(let r of e){let e=r[t],i=n.get(e);i?n.set(e,{other:e,label:i.label.split(`, `).includes(r.label)?i.label:`${i.label}, ${r.label}`,known:i.known===`seen`||r.known===`seen`?`seen`:i.known}):n.set(e,{other:e,label:r.label,known:r.known})}return[...n.values()]},c=(e,t)=>e.length?(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0 text-[13px]`,children:e.map((e,t)=>(0,Q.jsxs)(`li`,{className:`flex justify-between gap-3 border-t border-line-soft py-1.5 first:border-t-0 first:pt-0`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate font-medium text-ink`,children:o(e.other)}),(0,Q.jsxs)(`span`,{className:`flex-none text-muted`,children:[e.label,e.known===`seen`?` · seen in a run`:``]})]},t))}):(0,Q.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:t});return(0,Q.jsx)(`div`,{"aria-live":`polite`,className:`grid min-h-[120px] gap-x-10 gap-y-4 rounded-[14px] card border px-5 py-4 @3xl:[grid-template-columns:minmax(220px,1.1fr)_1fr_1fr]`,children:i?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Q.jsxs)(`h3`,{className:`m-0 flex items-center gap-2 text-base font-semibold`,children:[(0,Q.jsx)(`span`,{className:`size-2.5 flex-none rounded-full`,style:{background:r(i.column).hue},"aria-hidden":`true`}),i.name]}),(0,Q.jsx)(`p`,{className:`m-0 text-[13px] text-muted [overflow-wrap:anywhere]`,children:i.detail}),(0,Q.jsxs)(`p`,{className:`m-0 text-[12px] text-muted`,children:[r(i.column).label,` · `,ce[i.known].label,a?` · ${a}`:``]})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,Q.jsx)(`h4`,{className:`m-0 text-[13px] font-semibold`,children:n.sends||`Sends to`}),c(s(e.links.filter(e=>e.from===i.id),`to`),`Nothing.`)]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,Q.jsx)(`h4`,{className:`m-0 text-[13px] font-semibold`,children:n.receives||`Receives from`}),c(s(e.links.filter(e=>e.to===i.id),`from`),`Nothing.`)]})]}):(0,Q.jsx)(`p`,{className:`m-0 self-center text-[13px] text-muted @3xl:col-span-3`,children:n.idle||`Hover over or tab to a part to trace what it sends and receives. Select a service to see it from the inside; the How they talk tab lists every link in words.`})})}var Ae={bands:{front:{label:`Channels`,icon:p},gateway:{label:`Edge`,icon:D},service:{label:`Business systems`,icon:E},data:{label:`Data`,icon:x},outside:{label:`Outside and SaaS`,icon:i}},hint:e=>e.column===`outside`?`select it for how it is known`:`select it to see its services`,idle:`Hover over or tab to a system to trace what it sends and receives, and how. Select one to see its services.`},je=e=>e.modes.map(e=>`${e.mode} (${e.count})`).join(`, `);function Me(e){return{nodes:e.nodes.map(e=>({id:e.id,name:e.name,column:e.column,detail:e.detail,known:e.known,...e.column===`outside`?{part:e.id}:{}})),links:e.links.map(e=>({from:e.from,to:e.to,label:je(e),count:e.count,known:e.known,example:e.examples[0]||``}))}}function Ne({onPart:e}){let[t,n]=(0,K.useState)(null),[r,i]=(0,K.useState)(``);(0,K.useEffect)(()=>{te.view().then(n,e=>i(e.message))},[]);let a=(0,K.useMemo)(()=>t?Me(t):null,[t]);if(r)return(0,Q.jsx)(W,{text:r});if(!t||!a)return(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`});let o=e=>t.nodes.find(t=>t.id===e)?.name||e;return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[t.grouping===`names`&&(0,Q.jsxs)(`p`,{className:`m-0 flex max-w-[74ch] items-start gap-2 text-sm text-ink-2`,children:[(0,Q.jsx)(s,{size:16,"aria-hidden":`true`,className:`mt-0.5 flex-none text-muted`}),(0,Q.jsxs)(`span`,{children:[`Repositories without a system are grouped by the first word of their names, or stand alone (`,t.guessed.slice(0,6).join(`, `),t.guessed.length>6?`, and ${t.guessed.length-6} more`:``,`). Give each repository its system, as your teams name them, in `,(0,Q.jsx)(`a`,{href:S(`settings`,`agents`),children:`Settings, Agents, Repositories`}),t.proposal?`.`:(0,Q.jsxs)(Q.Fragment,{children:[`, or let the model propose them: `,(0,Q.jsx)(`code`,{children:`forgeqe knowledge systems --propose`}),`.`]})]})]}),(0,Q.jsxs)(`section`,{"aria-labelledby":`landscape-h`,className:`flex flex-col gap-3`,children:[(0,Q.jsx)(`h2`,{id:`landscape-h`,className:`sr-only`,children:`Systems map`}),(0,Q.jsx)(De,{view:a,onOpen:t=>{t.column===`outside`?e(t.id):location.hash=S(`product`,`systems`,encodeURIComponent(t.name))},words:Ae})]}),t.proposal&&(0,Q.jsx)(Pe,{view:t,onView:n}),(0,Q.jsx)(U,{id:`systems-talk`,title:`How the systems talk`,icon:M,n:t.links.length,children:t.links.length?(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[...t.links].sort((e,t)=>t.count-e.count).map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 border-b border-line-soft py-2.5 last:border-b-0`,children:[(0,Q.jsxs)(`span`,{className:`min-w-0 flex-[1_1_320px] text-[14px] [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:o(e.from)}),` `,(0,Q.jsx)(`span`,{className:`text-muted`,children:`to`}),` `,(0,Q.jsx)(`span`,{className:`font-medium`,children:o(e.to)}),(0,Q.jsxs)(`span`,{className:`text-muted`,children:[` · `,je(e)]}),e.via.length>0&&(0,Q.jsxs)(`span`,{className:`text-muted`,children:[` · on `,e.via.slice(0,4).join(`, `)]}),e.examples.slice(0,3).map((e,t)=>(0,Q.jsx)(`span`,{className:`block text-[12px] text-muted`,children:e},t))]}),(0,Q.jsx)(G,{known:e.known})]},`${e.from}>${e.to}`))}):(0,Q.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No link between systems was found: each system's code talks only to itself, or calls no route read.`})}),t.loose.length>0&&(0,Q.jsxs)(U,{id:`loose`,title:`Messages with one end here`,icon:u,n:t.loose.length,children:[(0,Q.jsx)(`p`,{className:`m-0 max-w-[74ch] text-sm text-muted`,children:`A topic or queue a system here publishes that nothing here consumes, or the other way round: the other end is in a repository not read yet, or nobody.`}),(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:t.loose.map(e=>(0,Q.jsxs)(`li`,{className:`border-b border-line-soft py-2 text-[14px] last:border-b-0 [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.topic}),(0,Q.jsxs)(`span`,{className:`text-muted`,children:[e.publishers.length?` · published by ${e.publishers.join(`, `)}`:``,e.consumers.length?` · consumed by ${e.consumers.join(`, `)}`:``]})]},e.topic))})]})]})}function Pe({view:e,onView:n}){let[r,i]=(0,K.useState)(null),[a,o]=(0,K.useState)(``),[s,c]=(0,K.useState)(``),[l,u]=(0,K.useState)(!1),d=e.assigned.filter(e=>e.by!==`settings`&&(e.why||e.by===`person`||e.rejected)),f=d.filter(e=>e.by===`model`),p=async t=>{u(!0),c(``);try{let r=e;for(let[e,n,i]of t)r=await te.decide(e,n,i);n(r),i(null)}catch(e){c(e.message)}finally{u(!1)}};if(!d.length)return null;let m=e.proposal;return(0,Q.jsxs)(U,{id:`proposal`,title:`Systems proposed by the model`,icon:v,n:f.length||void 0,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`p`,{className:`m-0 max-w-[74ch] text-sm text-muted`,children:[`Proposed by `,m?.model||`the model`,m?.at?` on ${m.at.slice(0,10)}`:``,`, from what the graph knows of each repository. Accept each, rename it, or reject it; a system set in Settings always wins. `,f.length?`${f.length} wait for a person.`:`All are decided.`]}),f.length>1&&(0,Q.jsxs)(t,{size:`sm`,variant:`ghost`,disabled:l,onClick:()=>void p(f.map(e=>[e.repo,`accepted`])),children:[(0,Q.jsx)(B,{size:15,"aria-hidden":`true`}),`Accept all `,f.length]})]}),s&&(0,Q.jsx)(W,{text:s}),(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:d.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2 border-b border-line-soft py-2.5 last:border-b-0`,children:[(0,Q.jsxs)(`span`,{className:`min-w-0 flex-[1_1_320px] text-[14px] [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:e.repo}),` `,(0,Q.jsx)(`span`,{className:`text-muted`,children:`in`}),` `,(0,Q.jsx)(`span`,{className:`font-medium`,children:e.rejected?`its own name`:e.system}),(0,Q.jsxs)(`span`,{className:`text-muted`,children:[` · `,e.rejected?`rejected`:e.by===`person`?`accepted`:`proposed`]}),e.why&&(0,Q.jsx)(`span`,{className:`block text-[12px] text-muted`,children:e.why})]}),r===e.repo?(0,Q.jsxs)(`form`,{className:`flex w-full max-w-[420px] gap-1.5`,onSubmit:t=>{t.preventDefault(),a.trim()&&p([[e.repo,`accepted`,a.trim()]])},children:[(0,Q.jsx)(C,{"aria-label":`System for ${e.repo}`,placeholder:`CRM`,value:a,maxLength:60,onChange:e=>o(e.target.value),className:`flex-1`}),(0,Q.jsx)(t,{type:`submit`,size:`sm`,disabled:l||!a.trim(),children:`Save`}),(0,Q.jsx)(t,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>i(null),children:`Cancel`})]}):(0,Q.jsx)(`div`,{role:`group`,"aria-label":`The system for ${e.repo}`,className:`flex gap-1.5`,children:e.by===`model`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,disabled:l,onClick:()=>void p([[e.repo,`accepted`]]),className:Fe,children:[(0,Q.jsx)(B,{size:14,"aria-hidden":`true`}),`Accept`]}),(0,Q.jsx)(`button`,{type:`button`,disabled:l,onClick:()=>{o(e.system),i(e.repo)},className:Fe,children:`Rename`}),(0,Q.jsxs)(`button`,{type:`button`,disabled:l,onClick:()=>void p([[e.repo,`rejected`]]),className:Fe,children:[(0,Q.jsx)(N,{size:14,"aria-hidden":`true`}),`Reject`]})]}):(0,Q.jsx)(`button`,{type:`button`,disabled:l,onClick:()=>void p([[e.repo,null]]),className:Fe,children:`Undo`})})]},e.repo))})]})}var Fe=m(`inline-flex min-h-8 cursor-pointer items-center gap-1 rounded-[8px] border border-transparent bg-surface-strong px-3 text-[13px] font-medium text-ink-2 hover:bg-line hover:text-ink disabled:cursor-not-allowed`);function Ie({eng:e,name:t,onOpen:n}){let[r,i]=(0,K.useState)(null),[a,o]=(0,K.useState)(``);(0,K.useEffect)(()=>{te.view().then(i,e=>o(e.message))},[]);let s=(0,K.useMemo)(()=>{let n=r?.nodes.find(e=>e.name===t&&e.column!==`outside`);if(!r||!n)return null;let i=new Set(n.parts),a=e.links.filter(e=>i.has(e.from)||i.has(e.to)),o=new Set(a.flatMap(e=>[e.from,e.to])),s=e=>r.nodes.find(t=>t.parts.includes(e))?.name,c=e.nodes.filter(e=>i.has(e.id)||o.has(e.id)).map(e=>i.has(e.id)||e.column===`outside`||!s(e.id)?e:{...e,detail:`in ${s(e.id)} · ${e.detail}`});return{nodes:c,links:a,other:c.filter(e=>!i.has(e.id)).length}},[r,e,t]),c=r?.nodes.find(e=>e.name===t&&e.column!==`outside`);return(0,Q.jsxs)(`section`,{"aria-labelledby":`system-h`,className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsxs)(`a`,{href:S(`product`),className:`inline-flex items-center gap-1.5 self-start text-sm`,children:[(0,Q.jsx)(z,{size:16,"aria-hidden":`true`}),`All systems`]}),(0,Q.jsx)(`h2`,{id:`system-h`,className:`m-0 text-[22px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:t}),c&&(0,Q.jsxs)(`p`,{className:`m-0 text-sm text-ink-2`,children:[c.detail,c.repos.length?` · repositories: ${c.repos.join(`, `)}`:``,c.inside?` · ${c.inside} links among its own parts`:``,s?.other?` · ${s.other} parts of other systems it talks to, named with their system`:``]})]}),a&&(0,Q.jsx)(W,{text:a}),!r&&!a&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),r&&!c&&(0,Q.jsxs)(`p`,{className:`m-0 text-sm text-muted`,children:[`No system is named `,t,`; it may have been renamed in Settings. See `,(0,Q.jsx)(`a`,{href:S(`product`),children:`all systems`}),`.`]}),s&&(0,Q.jsx)(De,{view:s,onOpen:n,words:{idle:`Hover over or tab to a part to trace what it sends and receives. Select a service to see it from the inside.`}}),c&&(0,Q.jsx)(`p`,{className:`m-0 text-[12px] text-muted`,children:`The system's services and the parts of other systems they reach, from the same graph as the services map.`})]})}function Le({id:e,verdict:n,note:r,onChanged:i}){let[a,o]=(0,K.useState)(r||``),[s,c]=(0,K.useState)(``),[l,u]=(0,K.useState)(!1),d=async(t,n)=>{u(!0),c(``);try{await re.feedback(e,t,n),i()}catch(e){c(e.message)}finally{u(!1)}};return(0,Q.jsxs)(`div`,{className:`flex flex-col items-start gap-1.5`,children:[(0,Q.jsx)(`div`,{role:`group`,"aria-label":`Is this right?`,className:`flex gap-1.5`,children:[`right`,`wrong`].map(e=>(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":n===e,disabled:l,onClick:()=>void d(n===e?null:e,e===`wrong`&&a.trim()||void 0),className:m(`inline-flex min-h-8 cursor-pointer items-center gap-1 rounded-[8px] border px-3 text-[13px] font-medium disabled:cursor-not-allowed`,n===e?`border-accent bg-accent-soft text-ink`:`border-transparent bg-surface-strong text-ink-2 hover:bg-line hover:text-ink`),children:[e===`right`?(0,Q.jsx)(B,{size:14,"aria-hidden":`true`}):(0,Q.jsx)(N,{size:14,"aria-hidden":`true`}),e===`right`?`Right`:`Wrong`]},e))}),n===`wrong`&&(0,Q.jsxs)(`form`,{className:`flex w-full max-w-[420px] gap-1.5`,onSubmit:e=>{e.preventDefault(),d(`wrong`,a.trim()||void 0)},children:[(0,Q.jsx)(C,{"aria-label":`What is right instead`,placeholder:`What is right instead`,value:a,maxLength:500,onChange:e=>o(e.target.value),className:`flex-1`}),(0,Q.jsx)(t,{type:`submit`,size:`sm`,disabled:l,children:`Save`})]}),s&&(0,Q.jsx)(W,{text:s})]})}function $({icon:e,children:t}){return(0,Q.jsxs)(`div`,{className:`flex flex-col items-start gap-3 rounded-[18px] border border-line p-6`,children:[(0,Q.jsx)(o,{icon:e,size:22,className:`text-muted`}),(0,Q.jsx)(`p`,{className:`m-0 max-w-[62ch] leading-relaxed text-ink-2`,children:t})]})}var Re=190,ze=46,Be=64,Ve=(e,t)=>{let n=Math.max(6,Math.floor(t/6.6));return e.length<=n?e:`${e.slice(0,n-1)}…`};function He({j:e}){let t=[{id:`browser`,label:`Browser`,kind:`browser`}],n=(e,n,r)=>(t.some(t=>t.id===e)||t.push({id:e,label:n,kind:r}),t.findIndex(t=>t.id===e)),r=[];e.steps.forEach((e,t)=>{let i=n(`s:${e.service||`?`}`,e.service||`service`,`service`);r.push({from:0,to:i,label:e.endpoint||e.name,solid:e.known===`seen`,n:t+1});for(let t of e.effects)r.push({from:i,to:n(`${t.lane}:${t.target}`,t.target,t.lane===`service`?`service`:t.lane),label:t.kind,solid:t.known===`seen`})});let i=t.length*Re,a=Be+r.length*ze+24,o=e=>e*Re+Re/2,s=`${e.name}: ${e.steps.length} ${e.steps.length===1?`step`:`steps`} across ${t.slice(1).map(e=>e.label).join(`, `)}.`;return(0,Q.jsxs)(`div`,{className:`overflow-x-auto`,children:[(0,Q.jsxs)(`svg`,{role:`img`,"aria-label":s,width:i,height:a,viewBox:`0 0 ${i} ${a}`,className:`block`,children:[t.map((t,n)=>(0,Q.jsxs)(`g`,{children:[(0,Q.jsx)(`line`,{x1:o(n),y1:56,x2:o(n),y2:a-8,strokeDasharray:`3 4`,className:`stroke-line-strong`}),(0,Q.jsx)(`rect`,{x:o(n)-Re/2+8,y:6,width:174,height:40,rx:10,className:m(`stroke-line`,t.kind===`outside`?`fill-surface-muted`:`fill-bg`)}),(0,Q.jsx)(`text`,{x:o(n),y:24,textAnchor:`middle`,className:`fill-ink text-[13px] font-medium`,children:Ve(t.label,162)}),(0,Q.jsx)(`text`,{x:o(n),y:39,textAnchor:`middle`,className:`fill-muted text-[11px]`,children:t.kind===`browser`?Ve(e.steps[0]?.page||``,162):t.kind===`data`?`table`:t.kind===`message`?`message`:t.kind===`outside`?`outside`:`service`})]},t.id)),r.map((e,t)=>{let n=Be+t*ze+ze/2,r=Math.min(o(e.from),o(e.to)),i=Math.max(o(e.from),o(e.to)),a=o(e.to)>o(e.from)?1:-1,s=o(e.to)-a*4;return(0,Q.jsxs)(`g`,{children:[(0,Q.jsx)(`line`,{x1:o(e.from),y1:n,x2:s,y2:n,strokeWidth:e.solid?2:1.5,strokeDasharray:e.solid?void 0:`5 4`,className:e.solid?`stroke-pass`:`stroke-ink-2`}),(0,Q.jsx)(`path`,{d:`M ${s} ${n} l ${-a*7} -4 l 0 8 z`,className:e.solid?`fill-pass`:`fill-ink-2`}),(0,Q.jsxs)(`text`,{x:r+8,y:n-7,className:m(`text-[12px]`,e.n?`fill-ink`:`fill-muted`),children:[e.n?`${e.n} `:``,Ve(e.label,i-r-16)]})]},t)})]}),(0,Q.jsx)(`ol`,{className:`sr-only`,children:e.steps.map((e,t)=>(0,Q.jsxs)(`li`,{children:[e.endpoint||e.name,` on `,e.service||`a service`,e.effects.length?`, which ${e.effects.map(e=>`${e.kind} ${e.target}`).join(`, `)}`:``,`. `,Ue(e.known),`.`]},t))})]})}var Ue=e=>({seen:`Seen in a run`,read:`From the code`,inferred:`Worked out`,differs:`A run differs`,confirmed:`Confirmed by a person`,rejected:`Marked wrong`})[e];function We({d:e}){let t=[...e.writtenBy.map(e=>({id:`w:${e}`,column:`writes`,title:e,known:`read`})),{id:e.id,column:`table`,title:e.name,detail:e.columns.length?e.columns.join(`, `):e.where,known:`read`,personal:e.personal.length>0},...e.readBy.map(e=>({id:`r:${e}`,column:`reads`,title:e,known:`read`})),...e.sentOn.map(e=>({id:`s:${e}`,column:`onward`,title:e,detail:`message`,known:`inferred`})),...e.leavesTo.map(e=>({id:`o:${e}`,column:`onward`,title:e,detail:`outside service`,known:`inferred`}))],n=[...e.writtenBy.map(t=>({from:`w:${t}`,to:e.id,known:`read`})),...e.readBy.map(t=>({from:e.id,to:`r:${t}`,known:`read`})),...e.sentOn.map(t=>({from:e.id,to:`s:${t}`,known:`inferred`})),...e.leavesTo.map(t=>({from:e.id,to:`o:${t}`,known:`inferred`}))];return(0,Q.jsx)(ue,{label:`What happens to the data of ${e.name}`,columns:[{id:`writes`,label:`Written by`,icon:h},{id:`table`,label:`Kept in`,icon:x},{id:`reads`,label:`Read by`,icon:h},{id:`onward`,label:`Sent on, and leaves to`,icon:u}],nodes:t,links:n})}var Ge=({known:e})=>e===`seen`?(0,Q.jsx)(B,{size:15,role:`img`,"aria-label":`Seen in a run`,className:`mt-0.5 flex-none text-pass`}):(0,Q.jsx)(R,{size:15,"aria-hidden":`true`,className:`mt-0.5 flex-none text-muted`});function Ke({items:e}){let t=e.filter(e=>e.value);return t.length?(0,Q.jsx)(`span`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-[13px] text-muted`,children:t.map(e=>(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Q.jsx)(o,{icon:e.icon,size:14}),(0,Q.jsxs)(`span`,{children:[e.label,`: `,(0,Q.jsx)(`span`,{className:`text-ink-2`,children:e.value})]})]},e.label))}):null}function qe({d:e}){let t=e.states.filter(e=>e.first),n=e.states.filter(e=>!e.first&&e.setBy.length),r=e.states.filter(e=>!e.first&&!e.setBy.length);if(!e.states.length)return(0,Q.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`The code names no state for it (a status the record moves through).`});let i=({s:e,dashed:t})=>(0,Q.jsx)(`span`,{className:m(`inline-flex min-h-9 items-center rounded-[10px] border px-3 text-[14px] font-medium`,t?`border-dashed border-muted text-ink-2`:`border-line bg-bg text-ink`),children:e});return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Q.jsxs)(`ol`,{"aria-label":`The life of ${e.record.toLowerCase()}`,className:`m-0 flex list-none flex-wrap items-center gap-2 p-0`,children:[t.map(e=>(0,Q.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-[12px] text-muted`,children:`Starts`}),(0,Q.jsx)(i,{s:e.state})]},e.state)),n.map(e=>(0,Q.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[12px] text-ink-2`,children:[(0,Q.jsx)(L,{size:14,"aria-hidden":`true`,className:`text-muted`}),e.setBy.join(`, `),(0,Q.jsx)(L,{size:14,"aria-hidden":`true`,className:`text-muted`})]}),(0,Q.jsx)(i,{s:e.state})]},e.state))]}),r.length>0&&(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-[13px] text-muted`,children:[`Also checked:`,r.map(e=>(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Q.jsx)(i,{s:e.state,dashed:!0}),e.checkedBy.length>0&&(0,Q.jsxs)(`span`,{className:`text-ink-2`,children:[`(`,e.checkedBy.join(`; `),`)`]})]},e.state))]})]})}function Je({label:e,rows:t,current:n,name:r,icon:i,to:a}){return(0,Q.jsx)(`nav`,{"aria-label":e,className:`flex min-w-0 flex-col gap-1 @2xl:sticky @2xl:top-6 @2xl:w-[260px] @2xl:flex-none`,children:(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:t.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`a`,{href:S(`product`,`business`,a,encodeURIComponent(e.id)),"aria-current":n===e.id?`page`:void 0,className:m(`flex min-h-11 items-center gap-2.5 rounded-[10px] px-3 py-1.5 text-ink no-underline`,n===e.id?`bg-surface-strong hover:text-ink`:`hover:bg-surface-muted hover:text-ink`),children:[i(e),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[14px] font-medium`,"data-tip":r(e),children:r(e)})]})},e.id))})})}function Ye({view:e,tab:t,item:n,onChanged:r}){let[i,a]=(0,K.useState)(!1),[s,c]=(0,K.useState)(null),f=[{id:`capabilities`,label:`What it does`},{id:`journeys`,label:`Journeys (${e.journeys.length})`},{id:`rules`,label:`Rules (${e.rules.length})`},{id:`data`,label:`Records (${e.data.length})`},...e.terms.length?[{id:`glossary`,label:`Glossary (${e.terms.length})`}]:[],{id:`team`,label:e.team?`Team questions (${e.team.passed} of ${e.team.questions})`:`Team questions`}],m=e.journeys.find(e=>e.id===n)||e.journeys[0],g=e.data.find(e=>e.id===n)||e.data[0],v=(...e)=>location.hash=S(`product`,`business`,...e),C=new Map;for(let t of e.rules)C.set(t.capability||`Other`,[...C.get(t.capability||`Other`)||[],t]);return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[!e.modelRead&&(0,Q.jsx)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-muted`,children:`These words come from the code itself: the action from each request, the rule from the message the product answers with, the record from each table. Build the graph with the model to have capabilities, journeys and rules named and phrased by it, each citing what shows it.`}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-x-6 @3xl:flex-row @3xl:items-end`,children:[(0,Q.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Q.jsx)(F,{label:`Product view`,current:t,onPick:e=>v(e),tabs:f})}),(0,Q.jsxs)(`span`,{className:`mb-5 flex items-center gap-2 text-sm text-ink-2`,children:[(0,Q.jsx)(j,{checked:i,onChange:a,label:`Show how it is built`}),`Show how it is built`]})]}),t===`capabilities`&&(0,Q.jsxs)(`div`,{role:`tabpanel`,id:`panel-capabilities`,"aria-labelledby":`tab-capabilities`,className:`flex flex-col gap-6`,children:[!e.capabilities.length&&(0,Q.jsx)($,{icon:d,children:`Nothing the product does was found yet: the product serves no request the patterns read. Build the graph with the model to find what it does from the code and documents.`}),(0,Q.jsx)(`ul`,{className:`m-0 grid list-none gap-4 p-0 @2xl:grid-cols-2`,children:e.capabilities.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-col gap-3 rounded-[14px] card border p-5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,Q.jsxs)(`h3`,{className:`m-0 flex items-center gap-2 text-lg font-semibold`,children:[(0,Q.jsx)(o,{icon:d,size:18}),e.name]}),e.by===`model`&&(0,Q.jsx)(G,{known:e.known})]}),e.by===`model`&&(0,Q.jsx)(`p`,{className:`m-0 text-sm leading-relaxed text-ink-2 [overflow-wrap:anywhere]`,children:e.summary}),(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1.5 p-0`,children:e.actions.map(e=>(0,Q.jsxs)(`li`,{className:`flex items-start gap-2 text-[15px] text-ink`,children:[(0,Q.jsx)(Ge,{known:e.known}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[e.action,i&&(0,Q.jsx)(`span`,{className:`font-mono text-[12px] text-muted [overflow-wrap:anywhere]`,children:e.endpoint})]})]},e.endpoint))}),(0,Q.jsx)(Ke,{items:[{icon:x,label:`Keeps`,value:e.records.join(`, `)},{icon:p,label:`Shares with`,value:e.outside.join(`, `)},{icon:b,label:`Rules`,value:e.rules?String(e.rules):``},{icon:w,label:`Personal data`,value:e.personal?`yes`:``}]}),e.by===`model`&&(0,Q.jsx)(Le,{id:e.id,verdict:e.verdict,note:e.note,onChanged:r})]},e.id))}),(0,Q.jsxs)(`p`,{className:`m-0 text-[12px] text-muted`,children:[(0,Q.jsx)(B,{size:12,"aria-hidden":`true`,className:`mr-1 inline align-[-1px] text-pass`}),`Seen in a run: ForgeQE's runs did it. The rest is read in the code.`]}),i&&e.map.nodes.length>0&&(0,Q.jsx)(U,{id:`capability-map`,title:`How it is built`,icon:h,children:(0,Q.jsx)(ue,{label:`Capability map`,columns:[{id:`capability`,label:`Capabilities`,icon:d},{id:`endpoint`,label:`Requests`,icon:h},{id:`rule`,label:`Rules it checks`,icon:b},{id:`data`,label:`Tables`,icon:x}],nodes:e.map.nodes,links:e.map.links,opens:e=>e.column===`data`||e.column===`rule`,onOpen:e=>e.column===`data`?v(`data`,encodeURIComponent(e.id)):v(`rules`)})})]}),t===`journeys`&&(0,Q.jsx)(`div`,{role:`tabpanel`,id:`panel-journeys`,"aria-labelledby":`tab-journeys`,children:m?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6 @2xl:flex-row @2xl:items-start @2xl:gap-8`,children:[(0,Q.jsx)(Je,{label:`Journeys`,rows:e.journeys,current:m.id,name:e=>e.name,to:`journeys`,icon:e=>e.known===`seen`?(0,Q.jsx)(B,{size:16,role:`img`,"aria-label":`Seen in a run`,className:`flex-none text-pass`}):(0,Q.jsx)(o,{icon:D,size:16,className:`flex-none`})}),(0,Q.jsxs)(`section`,{"aria-labelledby":`journey-h`,className:`flex min-w-0 flex-1 flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h2`,{id:`journey-h`,className:`m-0 text-[22px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:m.name}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(y,{tone:`neutral`,icon:!1,children:m.by===`run`?`Walked by a run`:`Named by the model`}),(0,Q.jsx)(G,{known:m.known})]})]}),(0,Q.jsxs)(`ol`,{"aria-label":`Steps`,className:`m-0 flex list-none flex-col gap-2 p-0 @3xl:flex-row @3xl:flex-wrap @3xl:items-stretch`,children:[m.steps[0]?.page&&(0,Q.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Q.jsxs)(`span`,{className:`flex flex-col justify-center rounded-[14px] bg-surface-muted px-4 py-3 text-[13px] text-ink-2`,children:[`Starts on`,(0,Q.jsx)(`span`,{className:`font-mono text-[12px] text-muted`,children:m.steps[0].page})]}),(0,Q.jsx)(L,{size:18,"aria-hidden":`true`,className:`hidden flex-none text-muted @3xl:block`})]}),m.steps.map((e,t)=>(0,Q.jsxs)(`li`,{className:`flex items-stretch gap-2 @3xl:items-center`,children:[(0,Q.jsxs)(`div`,{className:`flex w-full flex-col gap-2 self-stretch rounded-[14px] card border p-4 @3xl:w-[220px]`,children:[(0,Q.jsxs)(`span`,{className:`flex items-start gap-2 text-[15px] font-semibold text-ink`,children:[(0,Q.jsx)(`span`,{className:`flex size-6 flex-none items-center justify-center rounded-full bg-surface-strong text-[12px] tabular-nums`,children:t+1}),e.action]}),e.outcomes.map(e=>(0,Q.jsxs)(`span`,{className:`flex items-start gap-1.5 text-[13px] text-ink-2`,children:[(0,Q.jsx)(fe,{size:13,"aria-hidden":`true`,className:`mt-0.5 flex-none text-muted`}),e]},e)),e.guards.length>0&&(0,Q.jsxs)(`span`,{className:`flex items-start gap-1.5 rounded-[10px] bg-surface-muted px-2.5 py-1.5 text-[12px] text-ink-2`,children:[(0,Q.jsx)(o,{icon:b,size:13,className:`mt-0.5 flex-none`}),`Not allowed when: `,e.guards.join(`; `)]}),(0,Q.jsxs)(`span`,{className:`mt-auto flex items-center gap-1.5 text-[12px] text-muted`,children:[(0,Q.jsx)(Ge,{known:e.known}),e.known===`seen`?`Seen in a run`:Ue(e.known)]}),i&&e.endpoint&&(0,Q.jsxs)(`span`,{className:`font-mono text-[12px] text-muted [overflow-wrap:anywhere]`,children:[e.endpoint,` · `,e.service]})]}),t<m.steps.length-1&&(0,Q.jsx)(L,{size:18,"aria-hidden":`true`,className:`hidden flex-none text-muted @3xl:block`})]},t))]}),(0,Q.jsx)(Le,{id:m.id,verdict:m.verdict,note:m.note,onChanged:r}),i&&(0,Q.jsxs)(U,{id:`journey-built`,title:`How it is built`,icon:h,children:[(0,Q.jsx)(He,{j:m}),(0,Q.jsx)(`p`,{className:`m-0 text-[12px] text-muted`,children:`Numbered arrows: the requests the browser made, in order; under each, what that request's code does. Solid green: seen in a run; dashed: from the code. A call made through a helper in another file is not drawn.`})]})]})]}):(0,Q.jsx)($,{icon:D,children:`No journey yet. Each browser run of ForgeQE becomes one here once the graph is built again; the model names more from the code.`})}),t===`rules`&&(0,Q.jsxs)(`div`,{role:`tabpanel`,id:`panel-rules`,"aria-labelledby":`tab-rules`,className:`flex flex-col gap-6`,children:[!e.rules.length&&(0,Q.jsx)($,{icon:b,children:`No rule was found yet: nothing in the code refuses a request with a reason. Rules show here once one is read.`}),[...C].map(([e,t],n)=>(0,Q.jsx)(U,{id:`rules-${n}`,title:e,icon:d,n:t.length,children:(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:t.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-col gap-2 border-b border-line-soft py-3 last:border-b-0`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-4 gap-y-2`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_380px] items-start gap-2 text-[15px] font-medium text-ink [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(o,{icon:b,size:16,className:`mt-0.5 flex-none`}),e.plain]}),(0,Q.jsx)(G,{known:e.known})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col items-start gap-1 pl-6`,children:[!i&&(0,Q.jsx)(`button`,{type:`button`,"aria-expanded":s===e.id,onClick:()=>c(s===e.id?null:e.id),className:`inline-flex min-h-11 cursor-pointer items-center border-0 bg-transparent p-0 text-[12px] text-accent-fg hover:text-accent-fg-hover`,children:s===e.id?`Hide how it is checked`:`Show how it is checked`}),(0,Q.jsx)(Le,{id:e.id,verdict:e.verdict,note:e.note,onChanged:r})]}),(0,Q.jsx)(I,{open:i||s===e.id,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 pb-1 pl-6`,children:[e.quote&&(0,Q.jsx)(`code`,{className:`font-mono text-[12px] text-ink-2 [overflow-wrap:anywhere]`,children:e.quote}),(0,Q.jsxs)(`span`,{className:`font-mono text-[12px] text-muted [overflow-wrap:anywhere]`,children:[e.endpoint?`${e.endpoint} · `:``,e.where]})]})})]},e.id))})},e))]}),t===`data`&&(0,Q.jsx)(`div`,{role:`tabpanel`,id:`panel-data`,"aria-labelledby":`tab-data`,children:g?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6 @2xl:flex-row @2xl:items-start @2xl:gap-8`,children:[(0,Q.jsx)(Je,{label:`Records`,rows:e.data,current:g.id,name:e=>e.record,to:`data`,icon:e=>e.personal.length?(0,Q.jsx)(o,{icon:w,size:16,label:`Holds personal data`,className:`flex-none`}):(0,Q.jsx)(O,{size:16,"aria-hidden":`true`,className:`flex-none text-muted`})}),(0,Q.jsxs)(`section`,{"aria-labelledby":`table-h`,className:`flex min-w-0 flex-1 flex-col gap-4`,children:[(0,Q.jsx)(`h2`,{id:`table-h`,className:`m-0 text-[22px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:g.record}),(0,Q.jsx)(U,{id:`life`,title:`Its life`,icon:D,children:(0,Q.jsx)(qe,{d:g})}),(0,Q.jsx)(Ke,{items:[{icon:h,label:`Changed by`,value:g.keptBy.join(`, `)},{icon:u,label:`Announced as`,value:g.sentOn.map(e=>e.replace(/^Announces /,``)).join(`, `)},{icon:p,label:`Shared with`,value:g.leavesTo.join(`, `)},{icon:w,label:`Personal data`,value:g.personal.join(`, `)}]}),i&&(0,Q.jsxs)(U,{id:`record-built`,title:`How it is built`,icon:h,children:[(0,Q.jsxs)(`span`,{className:`font-mono text-[12px] text-muted`,children:[`table `,g.name,` · `,g.where,g.columns.length?` · ${g.columns.join(`, `)}`:``]}),(0,Q.jsx)(We,{d:g})]})]})]}):(0,Q.jsx)($,{icon:x,children:`No record yet: no migration or model of the repositories defines a table. Records show here once a schema is read.`})}),t===`glossary`&&(0,Q.jsx)(`div`,{role:`tabpanel`,id:`panel-glossary`,"aria-labelledby":`tab-glossary`,children:(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.terms.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-start gap-x-4 gap-y-2 border-b border-line-soft py-3 last:border-b-0`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_380px] flex-col gap-1`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-2 text-[14px] font-medium`,children:[(0,Q.jsx)(o,{icon:T,size:15}),e.term]}),(0,Q.jsx)(`span`,{className:`text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:e.meaning})]}),(0,Q.jsx)(Le,{id:e.id,verdict:e.verdict,note:e.note,onChanged:r})]},e.id))})}),t===`team`&&(0,Q.jsx)(`div`,{role:`tabpanel`,id:`panel-team`,"aria-labelledby":`tab-team`,className:`flex flex-col gap-3`,children:e.team?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`m-0 text-sm text-ink-2`,children:[e.team.passed,` of `,e.team.questions,` answered right, `,e.team.grounded,` with every quote found in its file`,e.team.model?`, by ${e.team.model}`:``,`, `,se(e.team.at),`.`]}),(0,Q.jsx)(U,{id:`team-scores`,title:`Questions`,icon:l,n:e.team.scores.length,children:(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.team.scores.map(e=>(0,Q.jsxs)(`li`,{className:`flex items-start gap-2 border-b border-line-soft py-3 last:border-b-0`,children:[e.pass?(0,Q.jsx)(B,{size:16,role:`img`,"aria-label":`Answered right`,className:`mt-0.5 flex-none text-pass`}):(0,Q.jsx)(_,{size:16,role:`img`,"aria-label":`Not answered right`,className:`mt-0.5 flex-none text-warn`}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Q.jsx)(`span`,{className:`text-[14px] font-medium [overflow-wrap:anywhere]`,children:e.question}),!e.pass&&(0,Q.jsx)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:e.why.join(`; `)})]})]},e.id))})})]}):(0,Q.jsx)($,{icon:l,children:`No team questions yet. Write questions whose answers your team knows (evals/knowledge/shop/questions.yaml shows how), then run forgeqe knowledge eval with the file: each answer is scored, and the last result shows here.`})})]})}var Xe=e=>/^https:\/\/[^/\s]/i.test(e)&&!/[\u0000-\u0020\u007f-\u009f]/.test(e);function Ze({id:e,onClose:n}){let[r,i]=(0,K.useState)(null),[a,o]=(0,K.useState)(``);return(0,K.useEffect)(()=>{if(!e)return;let t=!1;return i(null),o(``),A.part(e).then(e=>!t&&i(e),e=>!t&&o(e.message)),()=>{t=!0}},[e]),(0,Q.jsxs)(ae,{open:!!e,onClose:n,title:r?.part.name||`Part`,description:r?.part.where,footer:(0,Q.jsx)(t,{onClick:n,children:`Close`}),wide:!0,children:[a&&(0,Q.jsx)(W,{text:a}),!r&&!a&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),r&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[r.part.summary&&(0,Q.jsx)(`p`,{className:`m-0 text-sm leading-relaxed text-ink-2 [overflow-wrap:anywhere]`,children:r.part.summary}),(0,Q.jsxs)(`section`,{"aria-labelledby":`evidence-h`,className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h3`,{id:`evidence-h`,className:`m-0 text-base font-semibold`,children:`How it is known`}),r.part.evidence?.length?(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:r.part.evidence.map((e,t)=>(0,Q.jsx)(`li`,{className:`border-b border-line-soft py-2 font-mono text-[12.5px] leading-relaxed text-ink-2 [overflow-wrap:anywhere] last:border-b-0`,children:e},t))}):(0,Q.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No evidence kept for it: build the graph again.`}),r.links?.some(e=>Xe(e.url))&&(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:r.links.filter(e=>Xe(e.url)).map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 text-[13px] [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(H,{size:13,"aria-hidden":`true`,className:`flex-none`}),e.label]})},e.url))})]}),r.groups.map(e=>(0,Q.jsxs)(`section`,{"aria-label":e.label,className:`flex flex-col gap-1`,children:[(0,Q.jsxs)(`h3`,{className:`m-0 text-sm font-semibold`,children:[e.label,` (`,e.rows.length+e.more,`)`]}),(0,Q.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[e.rows.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-col py-1.5`,children:[(0,Q.jsx)(`span`,{className:`text-[14px] font-medium [overflow-wrap:anywhere]`,children:e.name}),(0,Q.jsx)(`span`,{className:`font-mono text-[12px] text-muted [overflow-wrap:anywhere]`,children:e.where})]},e.id)),e.more>0&&(0,Q.jsxs)(`li`,{className:`py-1 text-[12px] text-muted`,children:[`… and `,e.more,` more`]})]})]},e.label))]})]})}function Qe({view:e}){let t=t=>e.nodes.find(e=>e.id===t)?.name||t;if(!e.links.length)return(0,Q.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No link between the parts was found.`});let n=[`differs`,`seen`,`read`,`inferred`];return(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[...e.links].sort((e,t)=>n.indexOf(e.known)-n.indexOf(t.known)).map((e,n)=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 border-b border-line-soft py-2.5 last:border-b-0`,children:[(0,Q.jsxs)(`span`,{className:`min-w-0 flex-[1_1_320px] text-[14px] [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:t(e.from)}),` `,(0,Q.jsx)(`span`,{className:`text-muted`,children:e.label}),` `,(0,Q.jsx)(`span`,{className:`font-medium`,children:t(e.to)}),e.count>1&&(0,Q.jsxs)(`span`,{className:`text-muted`,children:[` · `,e.count,` places in the code`]}),e.example&&(0,Q.jsx)(`span`,{className:`block text-[12px] text-muted`,children:e.example})]}),(0,Q.jsx)(G,{known:e.known})]},n))})}function $e({id:e}){let[t,n]=(0,K.useState)(null),[r,i]=(0,K.useState)(``);return(0,K.useEffect)(()=>{let t=!1;return g.impact(e).then(e=>!t&&n(e),e=>!t&&i(e.message)),()=>{t=!0}},[e]),r?(0,Q.jsx)(W,{text:r}):t?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 py-2 pl-3 text-[13px]`,children:[(0,Q.jsxs)(`span`,{className:`text-muted`,children:[t.reached.length?`A change here reaches ${t.reached.length} ${t.reached.length===1?`part`:`parts`}`:`Nothing else depends on it in the graph`,t.tests.length?`; ${t.tests.length} ${t.tests.length===1?`test covers`:`tests cover`} them.`:`; no test covers it.`]}),t.reached.length>0&&(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:t.reached.slice(0,15).map(e=>(0,Q.jsxs)(`li`,{className:`py-0.5 [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:e.name}),` `,(0,Q.jsxs)(`span`,{className:`text-muted`,children:[`(`,e.type,`, `,(0,Q.jsx)(`span`,{className:`font-mono`,children:e.where}),`)`]})]},e.id))}),t.tests.length>0&&(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:t.tests.slice(0,10).map(e=>(0,Q.jsxs)(`li`,{className:`py-0.5 text-muted [overflow-wrap:anywhere]`,children:[`Test: `,e.name,` (`,(0,Q.jsx)(`span`,{className:`font-mono`,children:e.where}),`)`]},e.id))})]}):(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`})}function et({p:e,extra:n,onEvidence:r,children:i}){return(0,Q.jsxs)(`li`,{className:`border-b border-line-soft py-2.5 last:border-b-0`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_320px] flex-col`,children:[(0,Q.jsxs)(`span`,{className:`text-[14px] font-medium [overflow-wrap:anywhere]`,children:[e.name,n]}),(0,Q.jsxs)(`span`,{className:`text-[12px] text-muted [overflow-wrap:anywhere]`,children:[e.note,e.note&&e.where?` · `:``,e.where&&(0,Q.jsx)(`span`,{className:`font-mono`,children:e.where})]})]}),(0,Q.jsx)(G,{known:e.known}),(0,Q.jsxs)(t,{size:`sm`,variant:`ghost`,onClick:()=>r(e.id),children:[(0,Q.jsx)(o,{icon:k,size:15}),`Evidence`]})]}),i]})}function tt({gaps:e,onError:n}){return(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.map((e,r)=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 border-b border-line-soft py-2.5 last:border-b-0`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_360px] flex-col`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[14px] font-medium [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(_,{size:14,"aria-hidden":`true`,className:`flex-none text-warn`}),e.what]}),(0,Q.jsxs)(`span`,{className:`text-[12px] text-muted [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(`span`,{className:`font-mono`,children:e.where}),e.quote?` · ${e.quote}`:``]}),(0,Q.jsx)(`span`,{className:`text-[13px] text-ink-2 [overflow-wrap:anywhere]`,children:e.next})]}),(0,Q.jsxs)(t,{size:`sm`,variant:`ghost`,onClick:()=>void le(e.what,`${e.where}. ${e.next}`,n),children:[(0,Q.jsx)(o,{icon:v,size:15}),`Investigate`]})]},r))})}function nt({repo:e,onEvidence:r}){let[s,c]=(0,K.useState)(null),[l,d]=(0,K.useState)(``),[f,p]=(0,K.useState)(null),[m,h]=(0,K.useState)(``);return(0,K.useEffect)(()=>{let t=!1;return c(null),d(``),g.service(e).then(e=>!t&&c(e),e=>!t&&d(e.message)),()=>{t=!0}},[e]),l?(0,Q.jsx)(W,{text:l}):s?(0,Q.jsxs)(`section`,{"aria-labelledby":`service-h`,className:`flex min-w-0 flex-col gap-6`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsxs)(`a`,{href:S(`product`,`services`),className:`inline-flex items-center gap-1.5 self-start text-sm`,children:[(0,Q.jsx)(z,{size:16,"aria-hidden":`true`}),`All services`]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,Q.jsx)(`h2`,{id:`service-h`,className:`m-0 flex-[1_1_260px] text-[22px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:s.repo}),(0,Q.jsxs)(t,{size:`sm`,variant:`ghost`,onClick:()=>void le(`How does ${s.repo} work, and what does it depend on?`,s.summary,h),children:[(0,Q.jsx)(o,{icon:a,size:15}),`Ask in a chat`]})]}),(0,Q.jsx)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-ink-2 [overflow-wrap:anywhere]`,children:s.summary}),(0,Q.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[s.counts.files,` files, `,s.counts.classes,` classes, `,s.counts.tests,` test files`,s.deployedAs.length?` · deployed as ${s.deployedAs.join(`; `)}`:``]}),m&&(0,Q.jsx)(W,{text:m})]}),(0,Q.jsx)(U,{id:`endpoints`,title:`Endpoints`,icon:n,n:s.endpoints.length,children:s.endpoints.length?(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:s.endpoints.map(e=>(0,Q.jsxs)(et,{p:e,onEvidence:r,extra:e.auth?(0,Q.jsxs)(`span`,{className:`font-normal text-muted`,children:[` · requires `,e.auth]}):null,children:[e.differs&&(0,Q.jsxs)(`span`,{className:`flex items-center gap-1 text-[12px] text-warn`,children:[(0,Q.jsx)(_,{size:12,"aria-hidden":`true`}),`A run called a route near it: Runs against the code.`]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 text-[12px] text-muted`,children:[(0,Q.jsx)(`span`,{children:e.callers.length?`Called by ${e.callers.join(`, `)}`:`No caller found in the other repositories`}),(0,Q.jsx)(`button`,{type:`button`,"aria-expanded":f===e.id,onClick:()=>p(f===e.id?null:e.id),className:`inline-flex min-h-11 cursor-pointer items-center border-0 bg-transparent p-0 text-[12px] text-accent-fg hover:text-accent-fg-hover`,children:f===e.id?`Hide what a change reaches`:`What a change reaches`})]}),(0,Q.jsx)(I,{open:f===e.id,children:f===e.id&&(0,Q.jsx)($e,{id:e.id})})]},e.id))}):(0,Q.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`It serves no endpoint the patterns read.`})}),[{id:`calls`,title:`Calls out`,icon:M,rows:s.calls.map(e=>({p:e,extra:(0,Q.jsxs)(`span`,{className:`font-normal text-muted`,children:[` · `,e.to]})}))},{id:`data`,title:`Data`,icon:x,rows:s.data.map(e=>({p:e,extra:(0,Q.jsxs)(`span`,{className:`font-normal text-muted`,children:[` · `,e.use]})}))},{id:`messages`,title:`Messages`,icon:u,rows:s.messages.map(e=>({p:e,extra:(0,Q.jsxs)(`span`,{className:`font-normal text-muted`,children:[` · `,e.use]})}))},{id:`outside`,title:`Outside services`,icon:i,rows:s.outside.map(e=>({p:e,extra:null}))},{id:`cloud`,title:`Cloud resources`,icon:E,rows:s.cloud.map(e=>({p:e,extra:null}))}].filter(e=>e.rows.length).map(e=>(0,Q.jsx)(U,{id:e.id,title:e.title,icon:e.icon,n:e.rows.length,children:(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.rows.map((e,t)=>(0,Q.jsx)(et,{p:e.p,extra:e.extra,onEvidence:r},`${e.p.id}-${t}`))})},e.id)),s.gaps.length>0&&(0,Q.jsx)(U,{id:`service-gaps`,title:`Open questions`,icon:_,n:s.gaps.length,children:(0,Q.jsx)(tt,{gaps:s.gaps,onError:h})})]}):(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`})}function rt({view:t,onEvidence:n,onError:r}){let i=t.runtime;return i?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Q.jsxs)(`p`,{className:`m-0 text-sm text-ink-2`,children:[i.runs,` runs made `,i.calls,` API calls; `,i.matched,` reached a route the code declares. `,i.seen,` of `,i.endpoints,` endpoints were seen in a run.`]}),(0,Q.jsx)(U,{id:`differs`,title:`Differ from the code`,icon:_,n:i.differs.length,children:i.differs.length?(0,Q.jsx)(tt,{gaps:i.differs,onError:r}):(0,Q.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No call differs from the code.`})}),(0,Q.jsx)(U,{id:`only`,title:`Only the runs show`,icon:k,n:i.only.length,children:i.only.length?(0,Q.jsx)(tt,{gaps:i.only,onError:r}):(0,Q.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Every call reached a route the code declares.`})}),(0,Q.jsx)(U,{id:`unseen`,title:`Never seen in a run`,icon:oe,n:i.endpoints-i.seen,children:(0,Q.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:i.notSeen.map(e=>(0,Q.jsx)(et,{p:{...e,known:`read`,note:``},onEvidence:n},e.id))})})]}):(0,Q.jsxs)(`div`,{className:`flex flex-col items-start gap-3 rounded-[18px] border border-line p-6`,children:[(0,Q.jsx)(o,{icon:e,size:22,className:`text-muted`}),(0,Q.jsx)(`p`,{className:`m-0 max-w-[62ch] leading-relaxed text-ink-2`,children:`No run of ForgeQE has recorded API calls yet. Every browser run records them; after a run, build the product graph again and what the runs did shows here against the code.`})]})}function it({sub:e}){let[t,r]=(0,K.useState)(null),[i,a]=(0,K.useState)(``),[s,c]=(0,K.useState)(``),[l,u]=(0,K.useState)(null),d=(e||``).split(`/`),f=d[0]===`business`,[p,h]=(0,K.useState)(null),_=(0,K.useCallback)(()=>{re.view().then(h,e=>a(e.message))},[]);(0,K.useEffect)(()=>{f&&!p&&_()},[f,p,_]);let v=[`capabilities`,`journeys`,`rules`,`data`,`glossary`,`team`].find(e=>e===d[1]&&(e!==`glossary`||!!p?.terms.length))||`capabilities`,y=[`links`,`runtime`,`questions`].find(e=>e===d[0])||(d[0]===`services`?`services`:`landscape`),b=d[0]===`services`&&d[1]?decodeURIComponent(d[1]):``,x=d[0]===`systems`&&d[1]?decodeURIComponent(d[1]):``,C=!f&&(y===`landscape`||y===`services`&&!b);(0,K.useEffect)(()=>{g.view().then(e=>{r(e),a(``)},e=>a(e.message))},[]);let w=e=>{e.repo&&e.column!==`data`?location.hash=S(`product`,`services`,encodeURIComponent(e.repo)):e.part&&u(e.part)};return(0,Q.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,Q.jsx)(ee,{}),(0,Q.jsxs)(`main`,{className:m(V,`@container flex-auto gap-4`,C&&t?.built&&`max-w-none`),children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,Q.jsx)(P,{pixel:ne.product,size:`lg`}),(0,Q.jsx)(`h1`,{className:`m-0 flex-1 text-[26px] font-semibold tracking-[-0.01em]`,children:`Product`})]}),(0,Q.jsxs)(`p`,{className:`m-0 max-w-[74ch] text-sm leading-relaxed text-muted`,children:[`How `,t?.product||`the product`,` is built and how it works for the business, read from its repositories, documents and ForgeQE's runs. Each part says how it is known, and you can mark what the business view says right or wrong.`]}),i&&(0,Q.jsx)(W,{text:i}),s&&(0,Q.jsx)(W,{text:s}),!t&&!i&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),t&&!t.built&&(0,Q.jsxs)(`div`,{className:`flex flex-col items-start gap-3 rounded-[18px] border border-line p-6`,children:[(0,Q.jsx)(o,{icon:n,size:22,className:`text-muted`}),(0,Q.jsx)(`p`,{className:`m-0 max-w-[62ch] leading-relaxed text-ink-2`,children:`The product graph is not built yet. Add the product's repositories under Settings, Agents, then run forgeqe knowledge build, or ask in a chat to build it.`})]}),t?.built&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{role:`radiogroup`,"aria-label":`View`,className:`flex gap-1 self-start rounded-[10px] bg-surface-strong p-1`,children:[[`engineering`,`Engineering`,S(`product`)],[`business`,`Product`,S(`product`,`business`)]].map(([e,t,n])=>(0,Q.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e===`business`===f,onClick:()=>location.hash=n,className:m(`inline-flex min-h-8 cursor-pointer items-center gap-1.5 rounded-[7px] border-0 px-3 text-sm font-medium`,e===`business`===f?`bg-bg text-ink shadow-sm`:`bg-transparent text-muted hover:text-ink`),children:t},e))}),f&&!p&&!i&&(0,Q.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),f&&p&&(0,Q.jsx)(Ye,{view:p,tab:v,item:d[2]?decodeURIComponent(d[2]):void 0,onChanged:_}),!f&&t.summary.length>0&&(0,Q.jsx)(`p`,{className:`m-0 text-sm text-ink-2`,children:t.summary.join(` `)}),!f&&(0,Q.jsx)(F,{label:`Product`,current:y,onPick:e=>location.hash=e===`landscape`?S(`product`):S(`product`,e),tabs:[{id:`landscape`,label:`Landscape`},{id:`services`,label:`Services`},{id:`links`,label:`How they talk (${t.links.length})`},{id:`runtime`,label:`Runs against the code`},{id:`questions`,label:`Open questions (${t.gapsTotal})`}]}),!f&&y===`services`&&(0,Q.jsx)(`div`,{role:`tabpanel`,id:`panel-services`,"aria-labelledby":`tab-services`,className:`flex flex-col gap-8`,children:b?(0,Q.jsx)(nt,{repo:b,onEvidence:u}):(0,Q.jsxs)(`section`,{"aria-labelledby":`map-h`,className:`flex flex-col gap-3`,children:[(0,Q.jsx)(`h2`,{id:`map-h`,className:`sr-only`,children:`Services map`}),(0,Q.jsx)(De,{view:t,onOpen:w})]})}),!f&&y===`landscape`&&(0,Q.jsx)(`div`,{role:`tabpanel`,id:`panel-landscape`,"aria-labelledby":`tab-landscape`,children:x?(0,Q.jsx)(Ie,{eng:t,name:x,onOpen:w}):(0,Q.jsx)(Ne,{onPart:u})}),!f&&y===`links`&&(0,Q.jsxs)(`div`,{role:`tabpanel`,id:`panel-links`,"aria-labelledby":`tab-links`,className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`p`,{className:`m-0 max-w-[74ch] text-sm text-muted`,children:`Every link between the parts, how often it is in the code, and how it is known: the map's wires in words.`}),(0,Q.jsx)(Qe,{view:t})]}),!f&&y===`runtime`&&(0,Q.jsx)(`div`,{role:`tabpanel`,id:`panel-runtime`,"aria-labelledby":`tab-runtime`,children:(0,Q.jsx)(rt,{view:t,onEvidence:u,onError:c})}),!f&&y===`questions`&&(0,Q.jsxs)(`div`,{role:`tabpanel`,id:`panel-questions`,"aria-labelledby":`tab-questions`,className:`flex flex-col gap-3`,children:[(0,Q.jsx)(`p`,{className:`m-0 max-w-[74ch] text-sm text-muted`,children:`What the build could not settle. Investigate one: ForgeQE's agent asks the investigator in a chat, which reads the code, documents and runs and answers with the lines it rests on.`}),t.gaps.length?(0,Q.jsx)(tt,{gaps:t.gaps,onError:c}):(0,Q.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No open question.`}),t.gapsTotal>t.gaps.length&&(0,Q.jsxs)(`p`,{className:`m-0 text-[12px] text-muted`,children:[`… and `,t.gapsTotal-t.gaps.length,` more: forgeqe knowledge gaps.`]})]})]})]}),(0,Q.jsx)(Ze,{id:l,onClose:()=>u(null)})]})}export{it as Product};
@@ -1 +1 @@
1
- import{Bt as e,Di as t,En as n,Ht as r,Ir as i,Kn as a,Ln as o,Si as s,U as c,Wt as l,X as u,Zt as d,ct as f,di as p,n as m,ot as h,qr as g,vr as _,vt as v,wi as y,xr as b}from"./Shell--wVGpLnJ.js";import{H as x,r as S,t as C}from"./index-CUL4L1Mc.js";import{t as w}from"./when-CHnpLdYw.js";import{d as T,f as E,g as D,l as O,o as k,p as A,s as j,t as M}from"./qualityParts-BL7Mmsao.js";var N=t(y(),1),P=s();function F({id:t,view:s,onChanged:c}){let[u,d]=(0,N.useState)(null),[m,h]=(0,N.useState)(``),[_,v]=(0,N.useState)(`accessibility`),[y,x]=(0,N.useState)(``);(0,N.useEffect)(()=>{let e=!1;return d(null),p.run(t).then(t=>{if(e)return;d(t),h(``);let n=t.visual?.pages.some(e=>e.status===`changed`)||!t.visual&&t.captured;v(t.report?.accessibility.failed.length?`accessibility`:t.report?.breaches.some(e=>e.kind===`performance`)?`performance`:n?`visual`:t.report?.accessibility.pages?`accessibility`:t.report?.performance.pages.length?`performance`:`visual`)},t=>!e&&h(t.message)),()=>{e=!0}},[t]);let C=(0,P.jsxs)(`a`,{href:f(`quality`),className:`inline-flex items-center gap-1 self-start text-[13px] no-underline`,children:[(0,P.jsx)(b,{size:14,"aria-hidden":`true`,className:`rotate-90`}),`All runs`]});if(m)return(0,P.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[C,(0,P.jsx)(`p`,{className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail`,children:m})]});if(!u)return(0,P.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[C,(0,P.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Loading…`})]});let w=async()=>{try{let{id:e}=await g.start(`Explain the accessibility, performance and visual results of the run in ${u.dir}: call quality_report and visual_compare with run_dir ${u.dir}. Say what matters most to fix first, and why.`,{});location.hash=f(`chats`,e)}catch(e){x(e.message)}},O=u.report,A=O?.accessibility,F=O?.performance.pages??[],I=F.filter(e=>e.over.length).length,L=F.map(e=>e.lcp).filter(e=>typeof e==`number`),R=L.length?Math.max(...L):void 0,z=u.visual?.pages.filter(e=>e.status===`changed`).length??0,B=O?.breaches.length??0,V=[{id:`accessibility`,label:`Accessibility`,icon:i,n:A?.pages?`${A.failed.length} failed`:`not measured`,tone:A?.failed.length?`text-fail`:void 0},{id:`performance`,label:`Performance`,icon:a,n:F.length?I?`${I} over budget`:`${F.length} pages`:`not measured`,tone:I?`text-fail`:void 0},{id:`visual`,label:`Visual`,icon:o,n:u.visual?`${z} changed`:u.captured?`not compared`:`not captured`,tone:z?`text-warn`:void 0}];return(0,P.jsxs)(`section`,{"aria-labelledby":`run-h`,className:`flex min-w-0 flex-col gap-3`,children:[C,(0,P.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_300px] flex-col gap-0.5`,children:[(0,P.jsx)(`h2`,{id:`run-h`,"data-tip":u.goal,className:`m-0 truncate text-[16px] leading-snug font-semibold`,children:u.goal}),(0,P.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 text-[12.5px] text-muted`,children:[D(u.at),` · `,s.standard,` · `,(0,P.jsx)(S,{path:u.dir})]})]}),(0,P.jsxs)(e,{size:`sm`,variant:`ghost`,onClick:()=>void w(),children:[(0,P.jsx)(r,{icon:n,size:14}),`Ask in a chat`]})]}),y&&(0,P.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:y}),(0,P.jsxs)(`div`,{className:`grid grid-cols-2 overflow-hidden rounded-[10px] border border-line-soft @xl:grid-cols-4 @4xl:grid-cols-8 @4xl:divide-x @4xl:divide-line-soft`,children:[(0,P.jsx)(k,{label:`Budgets exceeded`,value:B,tone:B?`text-fail`:`text-pass`,sub:B?`fails the run`:`within budgets`}),(0,P.jsx)(k,{label:`Rules failed`,value:A?.pages?A.failed.length:`–`,tone:A?.failed.length?`text-fail`:void 0,sub:A?.pages?`${A.passed.length} passed`:`not measured`}),(0,P.jsx)(k,{label:`Critical · serious`,value:A?.pages?`${A.byImpact.critical} · ${A.byImpact.serious}`:`–`,tone:A&&A.byImpact.critical+A.byImpact.serious?`text-fail`:void 0,sub:`violations`}),(0,P.jsx)(k,{label:`Moderate · minor`,value:A?.pages?`${A.byImpact.moderate} · ${A.byImpact.minor}`:`–`,sub:`violations`}),(0,P.jsx)(k,{label:`Pages timed`,value:F.length||`–`,sub:I?`${I} over budget`:`none over budget`,tone:I?`text-fail`:void 0}),(0,P.jsx)(k,{label:`Slowest LCP`,value:R===void 0?`–`:E(R,`ms`),tone:R===void 0?void 0:R>4e3?`text-fail`:R>2500?`text-warn`:`text-pass`,sub:`good up to 2.5s`}),(0,P.jsx)(k,{label:`Pages compared`,value:u.visual?u.visual.pages.length:u.captured?`${u.captured} captured`:`–`,sub:u.visual?`against baselines`:`not compared`}),(0,P.jsx)(k,{label:`Visual changes`,value:u.visual?z:`–`,tone:z?`text-warn`:void 0,sub:u.visual?.pages.some(e=>e.over)?`over budget`:`pages changed`})]}),(0,P.jsx)(`div`,{role:`tablist`,"aria-label":`Results`,className:`flex gap-1 overflow-x-auto border-b border-line-soft whitespace-nowrap`,children:V.map(e=>(0,P.jsxs)(`button`,{type:`button`,role:`tab`,id:`tab-${e.id}`,"aria-selected":_===e.id,"aria-controls":`panel-${e.id}`,onClick:()=>v(e.id),className:l(`-mb-px inline-flex min-h-9 flex-none cursor-pointer items-center gap-1.5 border-0 border-b-2 bg-transparent px-3 text-[13px] font-medium`,_===e.id?`border-accent text-ink`:`border-transparent text-muted hover:text-ink`),children:[(0,P.jsx)(r,{icon:e.icon,size:14}),e.label,(0,P.jsx)(`span`,{className:l(`font-normal`,e.tone||`text-muted`),children:e.n})]},e.id))}),(0,P.jsxs)(`div`,{role:`tabpanel`,id:`panel-${_}`,"aria-labelledby":`tab-${_}`,className:`flex min-w-0 flex-col`,children:[_===`accessibility`&&(0,P.jsx)(M,{run:u,standard:s.standard,disclaimer:s.disclaimer}),_===`performance`&&(0,P.jsx)(j,{run:u}),_===`visual`&&(0,P.jsx)(T,{run:u,budget:s.budgets.visual,onChange:e=>{d(e),c()}})]})]})}function I({runs:e}){let[t,n]=(0,N.useState)(`all`),r=e,i=t===`attention`?r.filter(A):r,a=e=>location.hash=f(`quality`,encodeURIComponent(e)),o=`py-2 pr-3 text-right tabular-nums`;return(0,P.jsx)(`div`,{className:`flex flex-col gap-2`,children:(0,P.jsx)(c,{label:`Runs`,placeholder:`Find a run by what it did`,resetKey:t,empty:`Nothing matches.`,tools:(0,P.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,P.jsx)(u,{items:[{id:`all`,label:`All`,n:r.length},{id:`attention`,label:`Needs a look`,n:r.filter(A).length,alert:!0}],value:t,onChange:n})}),head:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`th`,{className:`w-[46%] py-1.5 pr-3 pl-3 font-medium`,children:`Run`}),(0,P.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Rules failed`}),(0,P.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @2xl:table-cell`,children:`Critical · serious`}),(0,P.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @xl:table-cell`,children:`Slow pages`}),(0,P.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Visual`}),(0,P.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @3xl:table-cell`,children:`Budgets`}),(0,P.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`When`})]}),children:i.map(e=>{let t=e.breaches?_:A(e)?d:x,n=e.a11y?e.a11y.critical+e.a11y.serious:void 0;return(0,P.jsxs)(`tr`,{onClick:()=>a(e.id),className:`cursor-pointer border-t border-line-soft hover:bg-surface-muted`,children:[(0,P.jsx)(`td`,{className:`max-w-0 py-2 pr-3 pl-3`,children:(0,P.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(t,{size:15,"aria-label":e.breaches?`Over a budget`:A(e)?`Needs a look`:`Within budgets`,className:l(`flex-none`,e.breaches?`text-fail`:A(e)?`text-warn`:`text-pass`)}),(0,P.jsx)(`a`,{href:f(`quality`,encodeURIComponent(e.id)),onClick:e=>e.stopPropagation(),"data-tip":e.goal,className:`truncate text-ink no-underline hover:underline`,children:e.goal})]})}),(0,P.jsx)(`td`,{className:l(o,e.a11y?.failed?`text-fail`:`text-muted`),children:e.a11y?e.a11y.failed:`–`}),(0,P.jsx)(`td`,{className:l(o,`hidden @2xl:table-cell`,n?`text-fail`:`text-muted`),children:e.a11y?`${e.a11y.critical} · ${e.a11y.serious}`:`–`}),(0,P.jsx)(`td`,{className:l(o,`hidden @xl:table-cell`,e.perf.over?`text-fail`:`text-muted`),children:e.perf.pages?`${e.perf.over} / ${e.perf.pages}`:`–`}),(0,P.jsx)(`td`,{className:l(o,e.visual?.changed?`text-warn`:`text-muted`),children:e.visual?`${e.visual.changed} changed`:e.captured?`not compared`:`–`}),(0,P.jsx)(`td`,{className:l(o,`hidden @3xl:table-cell`,e.breaches?`text-fail`:`text-muted`),children:e.breaches?`${e.breaches} over`:`ok`}),(0,P.jsx)(`td`,{className:`hidden py-2 pr-3 whitespace-nowrap text-[12.5px] text-muted @xl:table-cell`,"data-tip":D(e.at),children:w(e.at)})]},e.id)})})})}function L({sub:e}){let[t,n]=(0,N.useState)(null),[a,o]=(0,N.useState)(``),s=(0,N.useCallback)(()=>{p.view().then(e=>{n(e),o(``)},e=>o(e.message))},[]);(0,N.useEffect)(s,[s]);let c=e===`trends`,u=e&&!c?decodeURIComponent(e):``,d=t?.trends.filter(e=>e.perf.worse.length||e.a11y.newRules.length).length??0;return(0,P.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,P.jsx)(m,{}),(0,P.jsxs)(`main`,{className:l(C,`@container max-w-[1320px] flex-auto gap-4`),children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,P.jsx)(v,{pixel:h.quality,size:`lg`}),(0,P.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Quality`}),!u&&(0,P.jsx)(`div`,{role:`tablist`,"aria-label":`Show`,className:`flex gap-1 rounded-[10px] bg-surface-strong p-1`,children:[[`runs`,t?`Runs (${t.runs.length})`:`Runs`],[`trends`,`Trends${d?` (${d} worse)`:``}`]].map(([e,t])=>{let n=e===`trends`?c:!c;return(0,P.jsx)(`a`,{role:`tab`,"aria-selected":n,href:e===`runs`?f(`quality`):f(`quality`,e),className:l(`inline-flex min-h-8 items-center gap-1.5 rounded-[7px] px-3 text-sm font-medium no-underline`,n?`bg-bg text-ink shadow-sm hover:text-ink`:`text-muted hover:text-ink`),children:t},e)})})]}),!u&&(0,P.jsxs)(`p`,{className:`m-0 max-w-[80ch] text-[13px] leading-relaxed text-muted`,children:[`What each browser run measured on the pages it visited: accessibility (`,t?.standard||`WCAG`,`), Core Web Vitals, and visual changes against approved baselines. Budgets (quality.budgets) decide what fails a run. Open a run for all its details, or one kind with its agent: `,(0,P.jsx)(`a`,{href:f(`accessibility`),children:`Accessibility`}),`, `,(0,P.jsx)(`a`,{href:f(`performance`),children:`Performance`}),` or `,(0,P.jsx)(`a`,{href:f(`visual`),children:`Visual`}),`.`]}),a&&(0,P.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:a}),!t&&!a&&(0,P.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),t&&u&&(0,P.jsx)(F,{id:u,view:t,onChanged:s}),t&&!u&&c&&(0,P.jsx)(`div`,{role:`tabpanel`,"aria-label":`Trends`,children:(0,P.jsx)(O,{trends:t.trends})}),t&&!u&&!c&&(t.runs.length?(0,P.jsx)(I,{runs:t.runs}):(0,P.jsxs)(`div`,{className:`flex flex-col items-start gap-3 rounded-[14px] border border-dashed border-line p-5`,children:[(0,P.jsx)(r,{icon:i,size:22,className:`text-muted`}),(0,P.jsx)(`p`,{className:`m-0 max-w-[62ch] text-[13.5px] leading-relaxed text-ink-2`,children:`No run has measured anything yet. Every browser run checks accessibility, timings and visual changes of the pages it visits; run a flow from a chat or the Record page, and its results show here.`})]}))]})]})}export{L as Quality};
1
+ import{Bt as e,Di as t,En as n,Ht as r,Ir as i,Kn as a,Ln as o,Si as s,U as c,Wt as l,X as u,Zt as d,ct as f,di as p,n as m,ot as h,qr as g,vr as _,vt as v,wi as y,xr as b}from"./Shell-C-_iUijV.js";import{H as x,r as S,t as C}from"./index-BxNs3KZC.js";import{t as w}from"./when-CHnpLdYw.js";import{d as T,f as E,g as D,l as O,o as k,p as A,s as j,t as M}from"./qualityParts-BtCR-0Bc.js";var N=t(y(),1),P=s();function F({id:t,view:s,onChanged:c}){let[u,d]=(0,N.useState)(null),[m,h]=(0,N.useState)(``),[_,v]=(0,N.useState)(`accessibility`),[y,x]=(0,N.useState)(``);(0,N.useEffect)(()=>{let e=!1;return d(null),p.run(t).then(t=>{if(e)return;d(t),h(``);let n=t.visual?.pages.some(e=>e.status===`changed`)||!t.visual&&t.captured;v(t.report?.accessibility.failed.length?`accessibility`:t.report?.breaches.some(e=>e.kind===`performance`)?`performance`:n?`visual`:t.report?.accessibility.pages?`accessibility`:t.report?.performance.pages.length?`performance`:`visual`)},t=>!e&&h(t.message)),()=>{e=!0}},[t]);let C=(0,P.jsxs)(`a`,{href:f(`quality`),className:`inline-flex items-center gap-1 self-start text-[13px] no-underline`,children:[(0,P.jsx)(b,{size:14,"aria-hidden":`true`,className:`rotate-90`}),`All runs`]});if(m)return(0,P.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[C,(0,P.jsx)(`p`,{className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail`,children:m})]});if(!u)return(0,P.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[C,(0,P.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Loading…`})]});let w=async()=>{try{let{id:e}=await g.start(`Explain the accessibility, performance and visual results of the run in ${u.dir}: call quality_report and visual_compare with run_dir ${u.dir}. Say what matters most to fix first, and why.`,{});location.hash=f(`chats`,e)}catch(e){x(e.message)}},O=u.report,A=O?.accessibility,F=O?.performance.pages??[],I=F.filter(e=>e.over.length).length,L=F.map(e=>e.lcp).filter(e=>typeof e==`number`),R=L.length?Math.max(...L):void 0,z=u.visual?.pages.filter(e=>e.status===`changed`).length??0,B=O?.breaches.length??0,V=[{id:`accessibility`,label:`Accessibility`,icon:i,n:A?.pages?`${A.failed.length} failed`:`not measured`,tone:A?.failed.length?`text-fail`:void 0},{id:`performance`,label:`Performance`,icon:a,n:F.length?I?`${I} over budget`:`${F.length} pages`:`not measured`,tone:I?`text-fail`:void 0},{id:`visual`,label:`Visual`,icon:o,n:u.visual?`${z} changed`:u.captured?`not compared`:`not captured`,tone:z?`text-warn`:void 0}];return(0,P.jsxs)(`section`,{"aria-labelledby":`run-h`,className:`flex min-w-0 flex-col gap-3`,children:[C,(0,P.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_300px] flex-col gap-0.5`,children:[(0,P.jsx)(`h2`,{id:`run-h`,"data-tip":u.goal,className:`m-0 truncate text-[16px] leading-snug font-semibold`,children:u.goal}),(0,P.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 text-[12.5px] text-muted`,children:[D(u.at),` · `,s.standard,` · `,(0,P.jsx)(S,{path:u.dir})]})]}),(0,P.jsxs)(e,{size:`sm`,variant:`ghost`,onClick:()=>void w(),children:[(0,P.jsx)(r,{icon:n,size:14}),`Ask in a chat`]})]}),y&&(0,P.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:y}),(0,P.jsxs)(`div`,{className:`grid grid-cols-2 overflow-hidden rounded-[10px] border border-line-soft @xl:grid-cols-4 @4xl:grid-cols-8 @4xl:divide-x @4xl:divide-line-soft`,children:[(0,P.jsx)(k,{label:`Budgets exceeded`,value:B,tone:B?`text-fail`:`text-pass`,sub:B?`fails the run`:`within budgets`}),(0,P.jsx)(k,{label:`Rules failed`,value:A?.pages?A.failed.length:`–`,tone:A?.failed.length?`text-fail`:void 0,sub:A?.pages?`${A.passed.length} passed`:`not measured`}),(0,P.jsx)(k,{label:`Critical · serious`,value:A?.pages?`${A.byImpact.critical} · ${A.byImpact.serious}`:`–`,tone:A&&A.byImpact.critical+A.byImpact.serious?`text-fail`:void 0,sub:`violations`}),(0,P.jsx)(k,{label:`Moderate · minor`,value:A?.pages?`${A.byImpact.moderate} · ${A.byImpact.minor}`:`–`,sub:`violations`}),(0,P.jsx)(k,{label:`Pages timed`,value:F.length||`–`,sub:I?`${I} over budget`:`none over budget`,tone:I?`text-fail`:void 0}),(0,P.jsx)(k,{label:`Slowest LCP`,value:R===void 0?`–`:E(R,`ms`),tone:R===void 0?void 0:R>4e3?`text-fail`:R>2500?`text-warn`:`text-pass`,sub:`good up to 2.5s`}),(0,P.jsx)(k,{label:`Pages compared`,value:u.visual?u.visual.pages.length:u.captured?`${u.captured} captured`:`–`,sub:u.visual?`against baselines`:`not compared`}),(0,P.jsx)(k,{label:`Visual changes`,value:u.visual?z:`–`,tone:z?`text-warn`:void 0,sub:u.visual?.pages.some(e=>e.over)?`over budget`:`pages changed`})]}),(0,P.jsx)(`div`,{role:`tablist`,"aria-label":`Results`,className:`flex gap-1 overflow-x-auto border-b border-line-soft whitespace-nowrap`,children:V.map(e=>(0,P.jsxs)(`button`,{type:`button`,role:`tab`,id:`tab-${e.id}`,"aria-selected":_===e.id,"aria-controls":`panel-${e.id}`,onClick:()=>v(e.id),className:l(`-mb-px inline-flex min-h-9 flex-none cursor-pointer items-center gap-1.5 border-0 border-b-2 bg-transparent px-3 text-[13px] font-medium`,_===e.id?`border-accent text-ink`:`border-transparent text-muted hover:text-ink`),children:[(0,P.jsx)(r,{icon:e.icon,size:14}),e.label,(0,P.jsx)(`span`,{className:l(`font-normal`,e.tone||`text-muted`),children:e.n})]},e.id))}),(0,P.jsxs)(`div`,{role:`tabpanel`,id:`panel-${_}`,"aria-labelledby":`tab-${_}`,className:`flex min-w-0 flex-col`,children:[_===`accessibility`&&(0,P.jsx)(M,{run:u,standard:s.standard,disclaimer:s.disclaimer}),_===`performance`&&(0,P.jsx)(j,{run:u}),_===`visual`&&(0,P.jsx)(T,{run:u,budget:s.budgets.visual,onChange:e=>{d(e),c()}})]})]})}function I({runs:e}){let[t,n]=(0,N.useState)(`all`),r=e,i=t===`attention`?r.filter(A):r,a=e=>location.hash=f(`quality`,encodeURIComponent(e)),o=`py-2 pr-3 text-right tabular-nums`;return(0,P.jsx)(`div`,{className:`flex flex-col gap-2`,children:(0,P.jsx)(c,{label:`Runs`,placeholder:`Find a run by what it did`,resetKey:t,empty:`Nothing matches.`,tools:(0,P.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,P.jsx)(u,{items:[{id:`all`,label:`All`,n:r.length},{id:`attention`,label:`Needs a look`,n:r.filter(A).length,alert:!0}],value:t,onChange:n})}),head:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`th`,{className:`w-[46%] py-1.5 pr-3 pl-3 font-medium`,children:`Run`}),(0,P.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Rules failed`}),(0,P.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @2xl:table-cell`,children:`Critical · serious`}),(0,P.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @xl:table-cell`,children:`Slow pages`}),(0,P.jsx)(`th`,{className:`py-1.5 pr-3 text-right font-medium`,children:`Visual`}),(0,P.jsx)(`th`,{className:`hidden py-1.5 pr-3 text-right font-medium @3xl:table-cell`,children:`Budgets`}),(0,P.jsx)(`th`,{className:`hidden py-1.5 pr-3 font-medium @xl:table-cell`,children:`When`})]}),children:i.map(e=>{let t=e.breaches?_:A(e)?d:x,n=e.a11y?e.a11y.critical+e.a11y.serious:void 0;return(0,P.jsxs)(`tr`,{onClick:()=>a(e.id),className:`cursor-pointer border-t border-line-soft hover:bg-surface-muted`,children:[(0,P.jsx)(`td`,{className:`max-w-0 py-2 pr-3 pl-3`,children:(0,P.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(t,{size:15,"aria-label":e.breaches?`Over a budget`:A(e)?`Needs a look`:`Within budgets`,className:l(`flex-none`,e.breaches?`text-fail`:A(e)?`text-warn`:`text-pass`)}),(0,P.jsx)(`a`,{href:f(`quality`,encodeURIComponent(e.id)),onClick:e=>e.stopPropagation(),"data-tip":e.goal,className:`truncate text-ink no-underline hover:underline`,children:e.goal})]})}),(0,P.jsx)(`td`,{className:l(o,e.a11y?.failed?`text-fail`:`text-muted`),children:e.a11y?e.a11y.failed:`–`}),(0,P.jsx)(`td`,{className:l(o,`hidden @2xl:table-cell`,n?`text-fail`:`text-muted`),children:e.a11y?`${e.a11y.critical} · ${e.a11y.serious}`:`–`}),(0,P.jsx)(`td`,{className:l(o,`hidden @xl:table-cell`,e.perf.over?`text-fail`:`text-muted`),children:e.perf.pages?`${e.perf.over} / ${e.perf.pages}`:`–`}),(0,P.jsx)(`td`,{className:l(o,e.visual?.changed?`text-warn`:`text-muted`),children:e.visual?`${e.visual.changed} changed`:e.captured?`not compared`:`–`}),(0,P.jsx)(`td`,{className:l(o,`hidden @3xl:table-cell`,e.breaches?`text-fail`:`text-muted`),children:e.breaches?`${e.breaches} over`:`ok`}),(0,P.jsx)(`td`,{className:`hidden py-2 pr-3 whitespace-nowrap text-[12.5px] text-muted @xl:table-cell`,"data-tip":D(e.at),children:w(e.at)})]},e.id)})})})}function L({sub:e}){let[t,n]=(0,N.useState)(null),[a,o]=(0,N.useState)(``),s=(0,N.useCallback)(()=>{p.view().then(e=>{n(e),o(``)},e=>o(e.message))},[]);(0,N.useEffect)(s,[s]);let c=e===`trends`,u=e&&!c?decodeURIComponent(e):``,d=t?.trends.filter(e=>e.perf.worse.length||e.a11y.newRules.length).length??0;return(0,P.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,P.jsx)(m,{}),(0,P.jsxs)(`main`,{className:l(C,`@container max-w-[1320px] flex-auto gap-4`),children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,P.jsx)(v,{pixel:h.quality,size:`lg`}),(0,P.jsx)(`h1`,{className:`m-0 text-[26px] font-semibold tracking-[-0.01em]`,children:`Quality`}),!u&&(0,P.jsx)(`div`,{role:`tablist`,"aria-label":`Show`,className:`flex gap-1 rounded-[10px] bg-surface-strong p-1`,children:[[`runs`,t?`Runs (${t.runs.length})`:`Runs`],[`trends`,`Trends${d?` (${d} worse)`:``}`]].map(([e,t])=>{let n=e===`trends`?c:!c;return(0,P.jsx)(`a`,{role:`tab`,"aria-selected":n,href:e===`runs`?f(`quality`):f(`quality`,e),className:l(`inline-flex min-h-8 items-center gap-1.5 rounded-[7px] px-3 text-sm font-medium no-underline`,n?`bg-bg text-ink shadow-sm hover:text-ink`:`text-muted hover:text-ink`),children:t},e)})})]}),!u&&(0,P.jsxs)(`p`,{className:`m-0 max-w-[80ch] text-[13px] leading-relaxed text-muted`,children:[`What each browser run measured on the pages it visited: accessibility (`,t?.standard||`WCAG`,`), Core Web Vitals, and visual changes against approved baselines. Budgets (quality.budgets) decide what fails a run. Open a run for all its details, or one kind with its agent: `,(0,P.jsx)(`a`,{href:f(`accessibility`),children:`Accessibility`}),`, `,(0,P.jsx)(`a`,{href:f(`performance`),children:`Performance`}),` or `,(0,P.jsx)(`a`,{href:f(`visual`),children:`Visual`}),`.`]}),a&&(0,P.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-3 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:a}),!t&&!a&&(0,P.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),t&&u&&(0,P.jsx)(F,{id:u,view:t,onChanged:s}),t&&!u&&c&&(0,P.jsx)(`div`,{role:`tabpanel`,"aria-label":`Trends`,children:(0,P.jsx)(O,{trends:t.trends})}),t&&!u&&!c&&(t.runs.length?(0,P.jsx)(I,{runs:t.runs}):(0,P.jsxs)(`div`,{className:`flex flex-col items-start gap-3 rounded-[14px] border border-dashed border-line p-5`,children:[(0,P.jsx)(r,{icon:i,size:22,className:`text-muted`}),(0,P.jsx)(`p`,{className:`m-0 max-w-[62ch] text-[13.5px] leading-relaxed text-ink-2`,children:`No run has measured anything yet. Every browser run checks accessibility, timings and visual changes of the pages it visits; run a flow from a chat or the Record page, and its results show here.`})]}))]})]})}export{L as Quality};