import{u as n,aZ as p,r as m,j as e,S as a,h as i}from"./vendor-ClLR6ncd.js";import{E as l,i as h,ar as f}from"./index-OtVJl4GC.js";import"./lodash-ZyeDnt0e.js";import{R as x}from"./RefreshDataButton-BMv_Vwgi.js";import{a as g,C as y}from"./ChartContainer-CyPIBhmi.js";import{n as j,L as C,a as F}from"./model-D9GUydYA.js";import{a as S}from"./ui-DEn7LX9m.js";import"./ResponsiveContainer-vqCYnvBi.js";import"./_commonjs-dynamic-modules-TDtrdbi3.js";import"./RadioButtons-DZChRzLE.js";import"./Messages-BRmQDxrZ.js";import"./WarningMessage-4TK5GdCH.js";import"./Warning-DsmyDRzF.js";import"./Box-Co2WcNPC.js";import"./Link-BLwKPJFF.js";function K(){const{pid:r}=n(),s=l(["admin",r,"name"],()=>h({url:`/processes/${r}/pidName`}));return s.data===null?"":s.data}const $={left:0};function c(r){return e.jsx(y,{...r,Chart:F,Figure:C,chartMargin:$,colorProp:"stroke"})}function w(r){const{pid:s}=n(),t=r.chartData[0][d];return e.jsxs(e.Fragment,{children:[e.jsxs(a,{children:[e.jsx(i,{children:"Minor and major pagefaults"}),e.jsx(m.Suspense,{fallback:e.jsx(e.Fragment,{children:"..."}),children:e.jsx(c,{...r,firstFigureDataKey:`pid${s}.majflt`,firstFigureName:"Major page faults",secondFigureDataKey:`pid${s}.minflt`,secondFigureName:"Minor page faults"})})]}),e.jsxs(a,{children:[e.jsxs(i,{children:["Memory (",t,") usage"]}),e.jsx(c,{...r,firstFigureDataKey:`pid${s}.rss`,firstFigureName:"RSS",secondFigureDataKey:`pid${s}.vsize`,secondFigureName:"Virtual memory"})]}),e.jsxs(a,{children:[e.jsx(i,{children:"CPU usage"}),e.jsx(c,{...r,firstFigureDataKey:`pid${s}.utime`,firstFigureName:"User",secondFigureDataKey:`pid${s}.stime`,secondFigureName:"System"})]})]})}function u(){const{pid:r}=n();return["admin",r,"charts"]}const d=Symbol("prefix"),N=r=>{const s=`pid${r}.rss`,t=`pid${r}.vsize`;return j([s,t],d)};function D(){const{pid:r}=n(),s=u(),t=new URL("/systemstat.json",window.location.origin);t.searchParams.append("requestTree",`sys.processes.pid${r}`);const o=m.useCallback(N(r),[r]);return e.jsx(g,{queryKey:s,queryUrl:t.toString(),Charts:w,transformChart:o})}function M(){const r=K(),s=u(),t=p(s)!==0,o=m.useCallback(()=>{f.invalidateQueries(s)},[s]);return e.jsxs(a,{spacing:4,sx:{flexGrow:1},children:[e.jsxs(a,{direction:"row",justifyContent:"space-between",children:[e.jsx(a,{direction:"row",spacing:4,children:e.jsxs(i,{variant:"h4",children:["Charts ",r?`for ${r}`:""]})}),e.jsx(a,{direction:"row",spacing:2,children:e.jsx(x,{disabled:t,onClick:o})})]}),e.jsx(D,{})]})}const H=S({Component:M});export{H as default};
