import{s as i,T as d,cW as g,a as x,r as u,j as t,J as y,hS as c,hT as m,hU as f,hV as j}from"./index-DxWYYOj0.js";import{u as b,a as h}from"./unknownify-BC8oAPjr.js";const v=i("div")(({theme:e})=>({marginBottom:e.spacing(18),display:"flex",justifyContent:"center"})),S=i("div")(({theme:e})=>({display:"flex",justifyContent:"center",gap:e.spacing(4),flexWrap:"wrap"})),p=i("div")(({theme:e})=>({borderRadius:e.shape.borderRadiusMedium,border:"1px solid",borderColor:e.palette.secondary.border,backgroundColor:e.palette.secondary.light,display:"flex",flexDirection:"column",alignItems:"center",padding:e.spacing(1.5),zIndex:1,"& > svg":{width:e.spacing(9),height:e.spacing(9)}})),w=i(d)(({theme:e})=>({fontWeight:e.fontWeight.bold})),k=i(d)(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary})),A=i(d)(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.text.secondary})),T=e=>e[0]*1e3>new Date().getTime()-6e5,q=e=>{var a,s;const r=(e.values||[]).filter(l=>T(l)),o=r.length?Number.parseFloat(r[r.length-1][1]):0;return{label:e.label,reqs:o,type:h((s=(a=e.metric)==null?void 0:a.endpoint)==null?void 0:s.split("/")[2])}},C=(e,n)=>{var o;const r=n.label+n.type;return e[r]={...n,reqs:n.reqs+(((o=e[r])==null?void 0:o.reqs)??0)},e},E=e=>{var o,a;const r=(((a=(o=e==null?void 0:e.data)==null?void 0:o.result)==null?void 0:a.map(s=>{var l;return{...s,label:h((l=s.metric)==null?void 0:l.appName)}}).filter(s=>s.label!=="unknown"))||[]).map(q).reduce(C,{});return Object.values(r).map(s=>({...s,reqs:s.reqs.toFixed(2)})).filter(s=>s.reqs!=="0.00")??[]},R=()=>{g("Network - Overview");const e=x(),{metrics:n}=b(),r=u.useMemo(()=>E(n),[n]);return r.length===0?t.jsx(y,{severity:"warning",children:"No data available."}):t.jsxs(c.ArcherContainer,{strokeColor:e.palette.text.primary,endShape:{arrow:{arrowLength:4,arrowThickness:4}},children:[t.jsx(v,{children:t.jsx(c.ArcherElement,{id:"unleash",children:t.jsxs(p,{children:[t.jsx(m,{darkmode:t.jsx(f,{}),lightmode:t.jsx(j,{})}),t.jsx(d,{sx:{marginTop:e.spacing(1)},children:"Unleash"})]})})}),t.jsx(S,{children:r.map(({label:o,reqs:a,type:s},l)=>t.jsx(c.ArcherElement,{id:`${l}`,relations:[{targetId:"unleash",targetAnchor:"bottom",sourceAnchor:"top",style:{strokeColor:e.palette.secondary.border}}],children:t.jsxs(p,{children:[t.jsx(w,{children:o}),t.jsxs(k,{children:[a," req/s"]}),t.jsxs(A,{children:[s," app"]})]})}))})]})};export{R as NetworkOverview,R as default};
