1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./slider-BzcBqFLV.js","./index-CZQtfejN.js","./index-BAfeMlrs.css","./system-DXM3m_Rc.js","./square-terminal-Cy7bKv2Y.js","./sheet-C7vFsPqD.js","./loader-circle-DIh8wJL5.js","./ellipsis-DwBunvzU.js","./index-DnvMxqwc.js","./badge-BN_e9_a7.js","./activity-G3Gf-zrt.js","./clock-DzlC9sEq.js","./alert--lmW__Pt.js","./table-DsiOw2Ju.js","./containers-table-CUaw4bEs.js","./refresh-cw-DfTn2aeQ.js"])))=>i.map(i=>d[i]); 2import{c as D,r as d,u as _,s as G,v as re,j as e,l as Oe,m as Re,T as m,w as He,f as E,n as O,$ as R,x as Be,y as We,z as pe,S as ke,A as ie,B as le,C as H,E as Ge,F as oe,G as V,H as ge,J as te,p as B,a as f,K as ze,I as ae,t as qe,i as w,_ as _e,N as Xe,O as Ke,P as Ze,Q as Je,R as Qe,U as Ye,V as es,W as ss,X as je,Y as ts,Z as p,a0 as as,a1 as X,a2 as M,a3 as $,a4 as ns,a5 as rs,a6 as is,a7 as ls,a8 as os,a9 as cs,aa as fe,ab as ds,ac as ms,ad as us,ae as xs,af as W,ag as K,ah as ve,ai as ye,aj as q,D as hs,ak as ps,b as gs,al as js,am as fs,an as vs,ao as ys,ap as bs,aq as Ns,ar as ws,as as se,at as Me,au as Cs,av as Ss,aw as ks,ax as Z,ay as be,az as U,aA as zs,aB as Te,aC as _s,aD as Ms}from"./index-CZQtfejN.js";import{u as Ts,f as ce,g as As,a as Is,b as Ds}from"./index-DnvMxqwc.js";import{S as Ls,a as Fs,b as Vs,u as Es}from"./sheet-C7vFsPqD.js";import{T as $s,a as Ae,b as Ie,c as Ps,d as Us}from"./table-DsiOw2Ju.js";import{C as Os,A as Rs,a as Hs,b as Bs,c as Ws,d as Gs,e as qs,f as Xs,g as Ks}from"./alert-dialog-Bkqra3nY.js";import{S as Zs}from"./switch-BSeMKz56.js";import{G as Js,S as Qs,C as Ys,a as et,A as De,b as st}from"./square-terminal-Cy7bKv2Y.js";import{E as tt}from"./ellipsis-DwBunvzU.js";import{S as at}from"./square-pen-dBI6QtTF.js";import{T as nt}from"./trash-2-DHaPWKL9.js";import{A as rt,F as it}from"./footer-repo-link-Cpf3qtto.js";import"./alert--lmW__Pt.js";const lt=D("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);const ot=D("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);const ct=D("CirclePause",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]);const dt=D("CirclePlay",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);const Le=D("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const mt=D("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);const Ne=D("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);const ut=D("LayoutList",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}],["path",{d:"M14 4h7",key:"3xa0d5"}],["path",{d:"M14 9h7",key:"1icrd9"}],["path",{d:"M14 15h7",key:"1mj8o2"}],["path",{d:"M14 20h7",key:"11slyb"}]]);const xt=D("Wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]),we=d.lazy(()=>_e(()=>import("./slider-BzcBqFLV.js"),__vite__mapDeps([0,1,2]),import.meta.url)),Q="/api/beszel/user-alerts",Fe=400,Ce=Object.keys(te),de=r=>{console.error(r),qe({title:w._({id:"MN5GEP"}),description:w._({id:"31UfkH"}),variant:"destructive"})},ht=ze(async({name:r,value:s,min:t,systems:a})=>{try{await B.send(Q,{method:"POST",body:{name:r,value:s,min:t,systems:a,overwrite:!0}})}catch(n){de(n)}},Fe),pt=ze(async({name:r,systems:s})=>{try{await B.send(Q,{method:"DELETE",body:{name:r,systems:s}})}catch(t){de(t)}},Fe),gt=d.memo(function({system:s}
2){const t=_(G),a=_(re),[n,l]=d.useState(!1),[o,i]=d.useState("system"),[h,x]=d.useState(0),N=t[s.id]??new Map,j=d.useMemo(()=>a.filter(c=>c.id!==s.id&&t[c.id]?.size),[a,t,s.id]);async function S(c){const T=G.get()[c];if(T?.size)try{const k=G.get()[s.id]??new Map,P=Array.from(k.keys()).filter(b=>!T.has(b));await Promise.all([...Array.from(T.values()).map(({name:b,value:A,min:y})=>B.send(Q,{method:"POST",body:{name:b,value:A,min:y,systems:[s.id],overwrite:!0},requestKey:b})),...P.map(b=>B.send(Q,{method:"DELETE",body:{name:b,systems:[s.id]},requestKey:b}))]);const L=new Map;for(const b of T.values())L.set(b.name,{...b,system:s.id,triggered:!1});G.setKey(s.id,L),x(b=>b+1)}catch(k){de(k)}}const v=d.useMemo(()=>o==="global"?structuredClone(t):t,[o]);return e.jsxs(e.Fragment,{children:[e.jsxs(Oe,{children:[e.jsx(Re,{className:"text-xl",children:e.jsx(m,{id:"s4BX3A"})}),e.jsx(He,{children:e.jsx(m,{id:"L0g2h9",components:{0:e.jsx(E,{href:O(R,"settings",{name:"notifications"}),className:"link"})}})})]}),e.jsxs(Be,{defaultValue:"system",onValueChange:i,children:[e.jsxs("div",{className:"flex items-center justify-between mb-1 -mt-0.5",children:[e.jsxs(We,{children:[e.jsxs(pe,{value:"system",children:[e.jsx(ke,{className:"me-2 h-3.5 w-3.5"}),e.jsx("span",{className:"truncate max-w-60",children:s.name})]}),e.jsxs(pe,{value:"global",children:[e.jsx(Js,{className:"me-1.5 h-3.5 w-3.5"}),e.jsx(m,{id:"sifuwH"})]})]}),j.length>0&&o==="system"&&e.jsxs(ie,{children:[e.jsx(le,{asChild:!0,children:e.jsxs(H,{variant:"ghost",size:"sm",className:"text-muted-foreground text-xs gap-1.5",children:[e.jsx(m,{id:"dRPt1l"}),e.jsx(Ge,{className:"h-3.5 w-3.5"})]})}),e.jsx(oe,{align:"end",className:"max-h-100 overflow-auto",children:j.map(c=>e.jsx(V,{className:"min-w-44",onSelect:()=>S(c.id),children:c.name},c.id))})]})]}),e.jsx(ge,{value:"system",children:e.jsx("div",{className:"grid gap-3",children:Ce.map(c=>e.jsx(Se,{alertKey:c,data:te[c],alert:N.get(c),system:s},c))},h)}),e.jsxs(ge,{value:"global",children:[e.jsxs("label",{htmlFor:"ovw",className:"mb-3 flex gap-2 items-center justify-center cursor-pointer border rounded-sm py-3 px-4 border-destructive text-destructive font-semibold text-sm",children:[e.jsx(Os,{id:"ovw",className:"text-destructive border-destructive data-[state=checked]:bg-destructive",checked:n,onCheckedChange:l}),e.jsx(m,{id:"pZFbw+"})]}),e.jsx("div",{className:"grid gap-3",children:Ce.map(c=>e.jsx(Se,{alertKey:c,system:s,alert:N.get(c),data:te[c],global:!0,overwriteExisting:!!n,initialAlertsState:v},c))})]})]})]})});function Se({alertKey:r,data:s,system:t,alert:a,global:n=!1,overwriteExisting:l=!1,initialAlertsState:o={}}){const{name:i}=s,h=s.singleDesc?.(),x=s.noDuration===!0,N=!!h||x,j=!(N&&x),[S,v]=d.useState(n?!1:!!a),[c,T]=d.useState(a?.min||(x?0:10)),[k,P]=d.useState(a?.value||(N?0:s.start??80)),L=s.icon;function b(){if(!n)return[t.id];const y=re.get(),g=[];for(const I of y)(l||!o[I.id]?.has(r))&&g.push(I.id);return g}function A(y,g){const I=b();I.length&&ht({name:r,value:g,min:y,systems:I})}return e.jsxs("div",{className:"rounded-lg border border-muted-foreground/15 hover:border-muted-foreground/20 transition-colors duration-100 group",children:[e.jsxs("label",{htmlFor:`s${i}`,className:f("flex flex-row items-center justify-between gap-4 cursor-pointer p-4",{"pb-0":S&&j}),children:[e.jsxs("div",{className:"grid gap-1 select-none",children:[e.jsxs("p",{className:"font-semibold flex gap-3 items-center",children:[e.jsx(L,{className:"h-4 w-4 opacity-85"})," ",s.name()]}),(!S||!j)&&e.jsx("span",{className:"block text-sm text-muted-foreground",children:s.desc()})]}),e.jsx(Zs,{id:`s${i}`,checked:S,onCheckedChange:y=>{if(v(y),y)A(c,k);else if(pt({name:r,systems:b()}),l)for(const g of Object.values(o))g.delete(r)}})]}),S&&j&&e.jsxs("div",{className:"grid sm:grid-cols-2 mt-1.5 gap-5 px-4 pb-5 tabular-nums text-muted-foreground",children:[e.jsxs(d.Suspense,{fallback:e.jsx("div",{className:"h-10"}),children:[!N&&e.jsxs("div",{children:[e.jsx("p",{id:`v${i}`,className:"text-sm block h-6",children:s.invert?e.jsx(m,{id:"rXfyEl",values:{value:k,0:s.unit},components:{0:e.jsx("strong",{className:"text-foreground"})}}):e.jsx(m,{id:"rOqZKh",values:{value:k,0:s.unit},components:{0:e.jsx("strong",{className:"text-foreground"})}})}),e.jsxs("div",{className:"flex gap-3 items-center",children:[e.jsx(we,{"aria-labelledby":`v${i}`,value:[k],onValueCommit:y=>A(c,y[0]),onValueChange:y=>P(y[0]),step:s.step??1,min:s.min??1,max:s.max??99}),e.jsx(ae,{type:"number",value:k,onChange:y=>{let g=parseFloat(y.target.value);Number.isNaN(g)||(s.max!=null&&(g=Math.min(g,s.max)),s.min!=null&&(g=Math.max(g,s.min)),P(g),A(c,g))},step:s.step??1,min:s.min??1,max:s.max??99,className:"w-16 h-8 text-center px-1"})]})]}),!x&&e.jsxs("div",{className:f(h&&"col-span-full lowercase"),children:[e.jsxs("p",{id:`t${i}`,className:"text-sm block h-6 first-letter:uppercase",children:[h&&e.jsxs(e.Fragment,{children:[h," "]}),e.jsx(m,{id:"bBRdOW",values:{min:c},components:{0:e.jsx("strong",{className:"text-foreground"})}})]}),e.jsxs("div",{className:"flex gap-3 items-center",children:[e.jsx(we,{"aria-labelledby":`t${i}`,value:[c],onValueCommit:y=>A(y[0],k),onValueChange:y=>T(y[0]),min:1,max:60}),e.jsx(ae,{type:"number",value:c,onChange:y=>{let g=parseInt(y.target.value,10);Number.isNaN(g)||(g=Math.max(1,Math.min(g,60)),T(g),A(g,k))},min:1,max:60,className:"w-16 h-8 text-center px-1"})]})]})]}),S&&s.note&&e.jsx("span",{className:"block col-span-full text-sm text-muted-foreground -mt-3",children:s.note()})]})]})}const Ve=d.memo(function({system:s}){const[t,a]=d.useState(!1),l=_(G)[s.id]?.size>0;return d.useMemo(()=>e.jsxs(Ls,{children:[e.jsx(Fs,{asChild:!0,children:e.jsx(H,{variant:"ghost",size:"icon","aria-label":w._({id:"s4BX3A"}),"data-nolink":!0,onClick:()=>a(!0),children:e.jsx(Xe,{className:f("size-[1.2em] pointer-events-none",{"fill-primary":l})})})}),e.jsx(Vs,{className:"max-h-full overflow-auto w-160 !max-w-full p-4 sm:p-6",children:t&&e.jsx(gt,{system:s})})]}),[t,l])}),C={[p.Up]:"bg-green-500",[p.Down]:"bg-red-500",[p.Paused]:"bg-primary/40",[p.Pending]:"bg-yellow-500"};function Y(r,s=65,t=90){return r>=t?M.Crit:r>=s?M.Warn:M.Good}function jt(r){return[{size:100,minSize:0,accessorKey:"name",id:"system",name:()=>w._({id:"D+NlUC"}),sortingFn:(s,t)=>
2s.original.name.localeCompare(t.original.name),filterFn:(()=>{let s="",t="";const a=new Map,n={[p.Up]:w._({id:"n+PHuv"}).toLowerCase(),[p.Down]:w._({id:"gUjkl/"}).toLowerCase(),[p.Paused]:w._({id:"URAE3q"}).toLowerCase()};return(l,o,i)=>{const h=l.original;if(h.host.includes(i)||h.info.v?.includes(i))return!0;i!==s&&(s=i,t=i.toLowerCase());let x=a.get(h.name);return x===void 0&&(x=h.name.toLowerCase(),a.set(h.name,x)),x.includes(t)?!0:n[h.status]?.includes(t)||!1}})(),enableHiding:!1,invertSorting:!1,Icon:ke,cell:s=>{const{name:t,id:a}=s.row.original,n=_(ts),l=O(R,"system",{id:a});return e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"flex gap-2 items-center font-medium text-sm text-nowrap md:ps-1",children:[e.jsx(ne,{system:s.row.original}),e.jsx(E,{href:l,tabIndex:-1,className:"truncate z-10 relative",style:{width:`${n/1.05}ch`},onMouseEnter:o=>{const i=o.currentTarget;i.scrollWidth>i.clientWidth?i.title=t:i.removeAttribute("title")},children:t})]}),e.jsx(E,{href:l,className:"inset-0 absolute size-full","aria-label":t})]})},header:z},{accessorFn:({info:s})=>s.cpu||void 0,id:"cpu",name:()=>w._({id:"FSbpS7"}),cell:J,Icon:Ke,header:z},{accessorFn:({info:s})=>s.mp||void 0,id:"memory",name:()=>w._({id:"v8o+Rn"}),cell:J,Icon:Ze,header:z},{accessorFn:({info:s})=>s.dp||void 0,id:"disk",name:()=>w._({id:"sPFHpI"}),cell:s=>s.row.original.info.efs?ft(s):J(s),Icon:Je,header:z},{accessorFn:({info:s})=>s.g||void 0,id:"gpu",name:()=>"GPU",cell:s=>s.getValue()===void 0?null:J(s),Icon:Qe,header:z},{id:"loadAverage",accessorFn:({info:s})=>s.la?.reduce((t,a)=>t+a,0),name:()=>w._({id:"/PX77/"}),size:0,Icon:Ye,header:z,cell(s){const{info:t,status:a}=s.row.original,{major:n,minor:l}=as(t.v),{colorWarn:o=65,colorCrit:i=90}=_(X,{keys:["colorWarn","colorCrit"]}),h=t.la||[],x=Math.max(...h);if(x===0&&(a===p.Paused||n<1&&l<13))return null;const N=x/(t.t??1),j=Y(N*100,o,i);return e.jsxs("div",{className:"flex items-center gap-[.35em] w-full tabular-nums tracking-tight",children:[e.jsx("span",{className:f("inline-block size-2 rounded-full me-0.5",{[C[p.Up]]:j===M.Good,[C[p.Pending]]:j===M.Warn,[C[p.Down]]:j===M.Crit,[C[p.Paused]]:a!==p.Up})}),h?.map((S,v)=>e.jsx("span",{children:$(S,S>=10?1:2)},v))]})}},{accessorFn:({info:s,status:t})=>t!==p.Up?void 0:s.bb,id:"net",name:()=>w._({id:"EcdbXQ"}),size:0,Icon:es,header:z,sortUndefined:"last",cell(s){const t=s.getValue();if(t===void 0)return null;const a=_(X,{keys:["unitNet"]}),{value:n,unit:l}=ns(t,!0,a.unitNet,!1);return e.jsxs("span",{className:"tabular-nums whitespace-nowrap",children:[$(n,n>=100?1:2)," ",l]})}},{accessorFn:({info:s})=>s.dt,id:"temp",name:()=>w._({id:"Tr7LUu"}),size:50,hideSort:!0,Icon:ss,header:z,cell(s){const t=s.getValue(),a=_(X,{keys:["unitTemp"]});if(!t)return null;const{value:n,unit:l}=rs(t,a.unitTemp);return e.jsxs("span",{className:f("tabular-nums whitespace-nowrap",r==="table"&&"ps-0.5"),children:[$(n,n>=100?1:2)," ",l]})}},{accessorFn:({info:s})=>s.bat?.[0],id:"battery",name:()=>w._({id:"CzpmM+"}),size:70,Icon:je,header:z,hideSort:!0,cell(s){const[t,a]=s.row.original.info.bat??[];if(t===void 0)return null;let n=ls,l="text-muted-foreground";a!==js.Charging&&(t<25?(l=t<11?"text-red-500":"text-yellow-500",n=fs):t<75?n=je:t<95?n=vs:n=ys);const o=a!==void 0?is[a]?.()??void 0:void 0;return e.jsxs(E,{tabIndex:-1,href:O(R,"system",{id:s.row.original.id}),className:"flex items-center gap-1 tabular-nums tracking-tight relative z-10",title:o,children:[e.jsx(n,{className:f("size-3.5",l)}),e.jsxs("span",{className:"min-w-10",children:[t,"%"]})]})}},{accessorFn:({info:s})=>s.sv?.[0],id:"services",name:()=>w._({id:"MILoeL"}),size:50,Icon:Qs,header:z,hideSort:!0,sortingFn:(s,t)=>{const[a,n]=s.original.info.sv??[0,0],[l,o]=t.original.info.sv??[0,0];return n!==o?n-o:a-l},cell(s){const t=s.row.original,[a,n]=t.info.sv??[0,0];return t.status!==p.Up||a===0?null:e.jsxs("span",{className:"tabular-nums whitespace-nowrap flex gap-1.5 items-center",children:[e.jsx("span",{className:f("block size-2 rounded-full",{[C[p.Down]]:n>0,[C[p.Up]]:n===0})}),a," ",e.jsxs("span",{className:"text-muted-foreground text-sm -ms-0.5",children:["(",w._({id:"7Bj3x9"}).toLowerCase(),": ",n,")"]})]})}},{accessorFn:({info:s})=>s.u||void 0,id:"uptime",name:()=>w._({id:"TjrbDj"}),size:50,Icon:Ys,header:z,hideSort:!0,cell(s){const t=s.getValue();return t?e.jsx("span",{className:"tabular-nums whitespace-nowrap",children:os(t)}):null}},{accessorFn:({info:s})=>s.v,id:"agent",name:()=>w._({id:"iEQQyu"}),size:50,Icon:xt,hideSort:!0,header:z,cell(s){const t=s.getValue();if(!t)return null;const a=s.row.original,n={"text-green-500":t===globalThis.BESZEL.HUB_VERSION,"text-yellow-500":t!==globalThis.BESZEL.HUB_VERSION,"text-red-500":a.status!==p.Up};return e.jsxs(E,{href:O(R,"system",{id:a.id}),className:f("flex gap-1.5 items-center md:pe-5 tabular-nums relative z-10",r==="table"&&"ps-0.5"),tabIndex:-1,title:cs[a.info.ct],role:"none",children:[a.info.ct===fe.WebSocket&&e.jsx(ds,{className:f("size-3 pointer-events-none",n)}),a.info.ct===fe.SSH&&e.jsx(et,{className:f("size-3 pointer-events-none",n)}),!a.info.ct&&e.jsx(ne,{system:a,className:f(n,"bg-current mx-0.5")}),e.jsx("span",{className:"truncate max-w-14",children:s.getValue()})]})}},{id:"actions",name:()=>w._({id:"7L01XJ"}),size:50,cell:({row:s})=>e.jsxs("div",{className:"relative z-10 flex justify-end items-center gap-1 -ms-3",children:[e.jsx(Ve,{system:s.original}),e.jsx(Ee,{system:s.original})]})}]}function z(r){const{column:s}=r,{Icon:t,hideSort:a,name:n}=s.columnDef,l=s.getIsSorted();return e.jsxs(H,{variant:"ghost",className:f("h-9 px-3 flex duration-50",l&&"bg-accent/70 light:bg-accent text-accent-foreground
2/90"),onClick:()=>s.toggleSorting(s.getIsSorted()==="asc"),children:[t&&e.jsx(t,{className:"me-2 size-4"}),n(),a||e.jsx(De,{className:"ms-2 size-4"})]})}function J(r){const{colorWarn:s=65,colorCrit:t=90}=_(X,{keys:["colorWarn","colorCrit"]}),a=Number(r.getValue())||0,n=Y(a,s,t),l=f("h-full",r.row.original.status!==p.Up&&C.paused||n===M.Good&&C.up||n===M.Warn&&C.pending||C.down);return e.jsxs("div",{className:"flex gap-2 items-center tabular-nums tracking-tight w-full min-w-0",children:[e.jsxs("span",{className:"min-w-8 shrink-0",children:[$(a,a>=10?1:2),"%"]}),e.jsx("span",{className:"flex-1 min-w-8 grid bg-muted h-[1em] rounded-sm overflow-hidden",children:e.jsx("span",{className:l,style:{width:`${a}%`}})})]})}function ft(r){const{colorWarn:s=65,colorCrit:t=90}=_(X,{keys:["colorWarn","colorCrit"]}),{info:a,status:n,id:l}=r.row.original,o=Object.entries(a.efs??{}),i=a.dp,h=a.rdn;o.sort((v,c)=>v[0].localeCompare(c[0]));function x(v){const c=Y(v,s,t);return n!==p.Up&&C.paused||c===M.Good&&C.up||c===M.Warn&&C.pending||
2C.down}function N(v){return f("h-full",x(v))}const j=[C.up,C.pending,C.down],S=n!==p.Up?[]:[...new Set(o.map(([,v])=>Y(v,s,t)))].sort().map(v=>j[v]);return e.jsxs(ms,{children:[e.jsx(us,{asChild:!0,children:e.jsx(E,{href:O(R,"system",{id:l}),tabIndex:-1,className:"flex flex-col gap-0.5 w-full relative z-10",children:e.jsxs("div",{className:"flex gap-2 items-center tabular-nums tracking-tight",children:[e.jsxs("span",{className:"min-w-8 shrink-0",children:[$(i,i>=10?1:2),"%"]}),e.jsxs("span",{className:"flex-1 min-w-8 flex items-center gap-0.5 px-1 justify-end bg-muted h-[1em] rounded-sm overflow-hidden relative",children:[e.jsx("span",{className:f("absolute inset-0",N(i)),style:{width:`${i}%`}}),S.map(v=>e.jsx("span",{className:f("size-1.5 rounded-full shrink-0 outline-[0.5px] outline-muted",v)},v))]})]})})}),e.jsx(xs,{side:"right",className:"max-w-xs pb-2",children:e.jsxs("div",{className:"grid gap-1",children:[e.jsxs("div",{className:"grid gap-0.5",children:[e.jsx("div",{className:"text-[0.65rem] max-w-40 text-muted-foreground uppercase tracking-wide truncate tabular-nums",children:h??e.jsx(m,{id:"zgvjVP"})}),e.jsxs("div",{className:"flex gap-2 items-center tabular-nums text-xs",children:[e.jsxs("span",{className:"min-w-7",children:[$(i,i>=10?1:2),"%"]}),e.jsx("span",{className:"flex-1 min-w-12 grid bg-muted h-2.5 rounded-sm overflow-hidden",children:e.jsx("span",{className:N(i),style:{width:`${i}%`}})})]})]}),o.map(([v,c])=>e.jsxs("div",{className:"grid gap-0.5",children:[e.jsx("div",{className:"text-[0.65rem] max-w-40 text-muted-foreground uppercase tracking-wide truncate",children:v}),e.jsxs("div",{className:"flex gap-2 items-center tabular-nums text-xs",children:[e.jsxs("span",{className:"min-w-7",children:[$(c,c>=10?1:2),"%"]}),e.jsx("span",{className:"flex-1 min-w-12 grid bg-muted h-2.5 rounded-sm overflow-hidden",children:e.jsx("span",{className:N(c),style:{width:`${c}%`}})})]})]},v))]})})]})}function ne({system:r,className:s}){return s||=C[r.status]||"",e.jsx("span",{className:f("shrink-0 size-2 rounded-full",s)})}const Ee=d.memo(({system:r})=>{const[s,t]=d.useState(!1),[a,n]=d.useState(!1),l=d.useRef(!1),{i18n:o,_:i}=W(),{id:h,status:x,host:N,name:j}=r;return d.useMemo(()=>e.jsxs(e.Fragment,{children:[e.jsxs(ie,{children:[e.jsx(le,{asChild:!0,children:e.jsxs(H,{variant:"ghost",size:"icon",children:[e.jsx("span",{className:"sr-only",children:e.jsx(m,{id:"GSr0rF"})}),e.jsx(tt,{className:"w-5"})]})}),e.jsxs(oe,{align:"end",children:[!K()&&e.jsxs(V,{onSelect:()=>{l.current=!0,n(!0)},children:[e.jsx(at,{className:"me-2.5 size-4"}),e.jsx(m,{id:"ePK91l"})]}),e.jsx(V,{className:f(K()&&"hidden"),onClick:()=>{B.collection("systems").update(h,{status:x===p.Paused?p.Pending:p.Paused})},children:x===p.Paused?e.jsxs(e.Fragment,{children:[e.jsx(dt,{className:"me-2.5 size-4"}),e.jsx(m,{id:"v39wLo"})]}):e.jsxs(e.Fragment,{children:[e.jsx(ct,{className:"me-2.5 size-4"}),e.jsx(m,{id:"IgrLD/"})]})}),e.jsxs(V,{onClick:()=>ve(j),children:[e.jsx(ye,{className:"me-2.5 size-4"}),e.jsx(m,{id:"RGpZyz"})]}),e.jsxs(V,{onClick:()=>ve(N),children:[e.jsx(ye,{className:"me-2.5 size-4"}),e.jsx(m,{id:"YYVxgQ"})]}),e.jsx(q,{className:f(K()&&"hidden")}),e.jsxs(V,{className:f(K()&&"hidden"),onSelect:()=>t(!0),children:[e.jsx(nt,{className:"me-2.5 size-4"}),e.jsx(m,{id:"cnGeoo"})]})]})]}),e.jsx(hs,{open:a,onOpenChange:n,children:l.current&&e.jsx(ps,{system:r,setOpen:n})}),e.jsx(Rs,{open:s,onOpenChange:S=>t(S),children:e.jsxs(Hs,{children:[e.jsxs(Bs,{children:[e.jsx(Ws,{children:e.jsx(m,{id:"kXr5Rz",values:{name:j}})}),e.jsx(Gs,{children:e.jsx(m,{id:"Iy90xV",values:{name:j}})})]}),e.jsxs(qs,{children:[e.jsx(Xs,{children:e.jsx(m,{id:"dEgA5A"})}),e.jsx(Ks,{className:f(gs({variant:"destructive"})),onClick:()=>B.collection("systems").delete(h),children:e.jsx(m,{id:"xGVfLh"})})]})]})})]}),[h,x,N,j,r,i,s,a])}),$e=_s(()=>_e(()=>import("./system-DXM3m_Rc.js"),__vite__mapDeps([3,1,2,4,5,6,7,8,9,10,11,12,13,14,15]),import.meta.url));function vt(){const r=_(re),s=bs.get(),t=Ns.get(),a=ws.get(),{i18n:n,i18n:l,_:o}=W(),[i,h]=d.useState(""),[x,N]=d.useState("all"),[j,S]=se("sortMode",[{id:"system",desc:!1}
2],sessionStorage),[v,c]=d.useState([]),[T,k]=se("cols",{}),P=n.locale,L=d.useMemo(()=>x==="all"?r:x===p.Up?Object.values(t)??[]:x===p.Down?Object.values(s)??[]:Object.values(a)??[],[r,x]),[b,A]=se("viewMode",window.innerWidth<1024&&L.length<200?"grid":"table");d.useEffect(()=>{i!==void 0&&g.getColumn("system")?.setFilterValue(i)},[i]);const y=d.useMemo(()=>jt(b),[b]),g=Ts({data:L,columns:y,getCoreRowModel:Ds(),onSortingChange:S,getSortedRowModel:Is(),onColumnFiltersChange:c,getFilteredRowModel:As(),onColumnVisibilityChange:k,state:{sorting:j,columnFilters:v,columnVisibility:T},defaultColumn:{invertSorting:!0,sortUndefined:"last",minSize:0,size:900,maxSize:900}}),I=g.getRowModel().rows,me=g.getAllColumns(),ee=g.getVisibleLeafColumns(),[ue,xe,he]=d.useMemo(()=>[Object.values(t).length,Object.values(s).length,Object.values(a).length],[t,s,a]),Pe=d.useMemo(()=>e.jsx(Me,{className:"p-0 mb-3 sm:mb-4",children:e.jsxs("div",{className:"grid md:flex gap-x-5 gap-y-3 w-full items-end",children:[e.jsxs("div",{className:"px-2 sm:px-1",children:[e.jsx(Cs,{className:"mb-2",children:e.jsx(m,{id:"sifuwH"})}),e.jsx(Ss,{className:"flex",children:e.jsx(m,{id:"x7W7bj"})})]}),e.jsxs("div",{className:"flex gap-2 ms-auto w-full md:w-80",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(ae,{placeholder:l._({id:"6HLTEb"}),onChange:u=>h(u.target.value),value:i,className:"ps-4 pe-10 w-full"}),i&&e.jsx(H,{type:"button",variant:"ghost",size:"icon","aria-label":l._({id:"xCJdfg"}),className:"absolute right-1 top-1/2 -translate-y-1/2 h-7 w-7 text-muted-foreground",onClick:()=>h(""),children:e.jsx(ks,{className:"h-4 w-4"})})]}),e.jsxs(ie,{children:[e.jsx(le,{asChild:!0,children:e.jsxs(H,{variant:"outline",children:[e.jsx(st,{className:"me-1.5 size-4 opacity-80"}),e.jsx(m,{id:"jpctdh"})]})}),e.jsx(oe,{align:"end",className:"h-72 md:h-auto min-w-48 md:min-w-auto overflow-y-auto",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 divide-y md:divide-s md:divide-y-0",children:[e.jsxs("div",{className:"border-r",children:[e.jsxs(Z,{className:"pt-2 px-3.5 flex items-center gap-2",children:[e.jsx(Ne,{className:"size-4"}),e.jsx(m,{id:"rdU729"})]}),e.jsx(q,{}),e.jsxs(be,{className:"px-1 pb-1",value:b,onValueChange:u=>A(u),children:[e.jsxs(U,{value:"table",onSelect:u=>u.preventDefault(),className:"gap-2",children:[e.jsx(ut,{className:"size-4"}),e.jsx(m,{id:"4hJhzz"})]}),e.jsxs(U,{value:"grid",onSelect:u=>u.preventDefault(),className:"gap-2",children:[e.jsx(Ne,{className:"size-4"}),e.jsx(m,{id:"CXDHcv"})]})]})]}),e.jsxs("div",{className:"border-r",children:[e.jsxs(Z,{className:"pt-2 px-3.5 flex items-center gap-2",children:[e.jsx(mt,{className:"size-4"}),e.jsx(m,{id:"uAQUqI"})]}),e.jsx(q,{}),e.jsxs(be,{className:"px-1 pb-1",value:x,onValueChange:u=>N(u),children:[e.jsx(U,{value:"all",onSelect:u=>u.preventDefault(),children:e.jsx(m,{id:"sifuwH"})}),e.jsx(U,{value:"up",onSelect:u=>u.preventDefault(),children:e.jsx(m,{id:"yRx0a1",values:{upSystemsLength:ue}})}),e.jsx(U,{value:"down",onSelect:u=>u.preventDefault(),children:e.jsx(m,{id:"jvM9n2",values:{downSystemsLength:xe}})}),e.jsx(U,{value:"paused",onSelect:u=>u.preventDefault(),children:e.jsx(m,{id:"VL1Aa2",values:{pausedSystemsLength:he}})})]})]}),e.jsxs("div",{className:"border-r",children:[e.jsxs(Z,{className:"pt-2 px-3.5 flex items-center gap-2",children:[e.jsx(De,{className:"size-4"}),e.jsx(m,{id:"m1SiNS"})]}),e.jsx(q,{}),e.jsx("div",{className:"px-1 pb-1",children:me.map(u=>{if(!u.getCanSort())return null;let F=e.jsx("span",{className:"w-6"});return j[0]?.id===u.id&&(j[0]?.desc?F=e.jsx(ot,{className:"me-2 size-4"}):F=e.jsx(lt,{className:"me-2 size-4"})),e.jsxs(V,{onSelect:Ue=>{Ue.preventDefault(),S([{id:u.id,desc:j[0]?.id===u.id&&!j[0]?.desc}])},children:[F,u.columnDef.name()]},u.id)})})]}),e.jsxs("div",{children:[e.jsxs(Z,{className:"pt-2 px-3.5 flex items-center gap-2",children:[e.jsx(Le,{className:"size-4"}),e.jsx(m,{id:"Zd0qde"})]}),e.jsx(q,{}),e.jsx("div",{className:"px-1.5 pb-1",children:me.filter(u=>u.getCanHide()).map(u=>e.jsx(zs,{onSelect:F=>F.preventDefault(),checked:u.getIsVisible(),onCheckedChange:F=>u.toggleVisibility(!!F),children:u.columnDef.name()},u.id))})]})]})})]})]})]})}),[ee.length,j,b,P,x,ue,xe,he,i]);return e.jsxs(Te,{className:"w-full px-3 py-5 sm:py-6 sm:px-6",children:[Pe,b==="table"?e.jsx("div",{className:"rounded-md",children:e.jsx(yt,{table:g,rows:I,colLength:ee.length})}):e.jsx("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",children:I?.length?I.map(u=>e.jsx(wt,{row:u,table:g,colLength:ee.length},u.original.id)):e.jsx("div",{className:"col-span-full text-center py-8",children:e.jsx(m,{id:"OpAFHJ"})})})]})}const yt=d.memo(({table:r,rows:s,colLength:t})=>{const a=d.useRef(null),n=Es({count:s.length,estimateSize:()=>s.length>
210?56:60,getScrollElement:()=>a.current,overscan:5}),l=n.getVirtualItems(),o=Math.max(0,l[0]?.start??0-n.options.scrollMargin),i=Math.max(0,n.getTotalSize()-(l[l.length-1]?.end??0));return e.jsx("div",{className:f("h-min max-h-[calc(100dvh-17rem)] max-w-full relative overflow-auto border rounded-md",(!s.length||s.length>2)&&"min-h-50"),ref:a,children:e.jsx("div",{style:{height:`${n.getTotalSize()+50}px`,paddingTop:o,paddingBottom:i},children:e.jsxs("table",{className:"text-sm w-full h-full",children:[e.jsx(bt,{table:r}),e.jsx($s,{onMouseEnter:$e,children:s.length?l.map(h=>{const x=s[h.index];return e.jsx(Nt,{row:x,virtualRow:h,length:s.length,colLength:t},x.id)}):e.jsx(Ae,{children:e.jsx(Ie,{colSpan:t,className:"h-37 text-center pointer-events-none",children:e.jsx(m,{id:"OpAFHJ"})})})})]})})})});function bt({table:r}){const{i18n:s,_:t}=W();return e.jsx(Ps,{className:"sticky top-0 z-50 w-full border-b-2",children:r.getHeaderGroups().map(a=>e.jsx("tr",{children:a.headers.map(n=>e.jsx(Us,{className:"px-1.5",children:ce(n.column.columnDef.header,n.getContext())},n.id))},a.id))})}const Nt=d.memo(({row:r,virtualRow:s,colLength:t})=>{const a=r.original,{i18n:n,_:l}=W();return d.useMemo(()=>e.jsx(Ae,{className:f("cursor-pointer transition-opacity relative safari:transform-3d",{"opacity-50":a.status===p.Paused}),children:r.getVisibleCells().map(o=>e.jsx(Ie,{style:{width:o.column.getSize(),height:s.size},className:"py-0 ps-4.5",children:ce(o.column.columnDef.cell,o.getContext())},o.id))}),[a,a.status,t,l])}),wt=d.memo(({row:r,table:s,colLength:t})=>{const a=r.original,{i18n:n,_:l}=W();return d.useMemo(()=>e.jsxs(Te,{onMouseEnter:$e,className:f("cursor-pointer hover:shadow-md transition-all bg-transparent w-full dark:border-border duration-200 relative",{"opacity-50":a.status===p.Paused}),children:[e.jsx(Me,{className:"py-1 ps-4 pe-2 bg-muted/30 border-b border-border/60",children:e.jsxs("div",{className:"flex items-center gap-1 w-full overflow-hidden",children:[e.jsx("h3",{className:"text-primary/90 min-w-0 flex-1 gap-2.5 font-semibold",children:e.jsxs("div",{className:"flex items-center gap-2.5 min-w-0 flex-1",children:[e.jsx(ne,{system:a}),e.jsx("span",{className:"text-[.95em]/normal tracking-normal text-primary/90 truncate",children:a.name})]})}),s.getColumn("actions")?.getIsVisible()&&e.jsxs("div",{className:"flex gap-1 shrink-0 relative z-10",children:[e.jsx(Ve,{system:a}),e.jsx(Ee,{system:a})]})]})}),e.jsx(Ms,{className:"text-sm px-5 pt-3.5 pb-4",children:e.jsx("div",{className:"grid gap-2.5",style:{gridTemplateColumns:"24px minmax(80px, max-content) minmax(0, 1fr)"},children:s.getAllColumns().map(o=>{if(!o.getIsVisible()||o.id==="system"||o.id==="actions")return null;const i=r.getAllCells().find(N=>N.column.id===o.id);if(!i)return null;const{Icon:h,name:x}=o.columnDef;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex items-center",children:o.id==="lastSeen"?e.jsx(Le,{className:"size-4 text-muted-foreground"}):h&&e.jsx(h,{className:"size-4 text-muted-foreground"})},`${o.id}-icon`),e.jsxs("div",{className:"flex items-center text-muted-foreground pr-3",children:[x(),":"]},`${o.id}-label`),e.jsx("div",{className:"flex items-center min-w-0",children:ce(i.column.columnDef.cell,i.getContext())},`${o.id}-value`)]})})})}),e.jsx(E,{href:O(R,"system",{id:r.original.id}),className:"inset-0 absolute w-full h-full",children:e.jsx("span",{className:"sr-only",children:r.original.name})})]},a.id),[a,t,l])}),Vt=d.memo(()=>{const{i18n:r,_:s}=W();return d.useEffect(()=>{document.title=`${r._({id:"sifuwH"})} / Beszel`},[s]),d.useMemo(()=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(rt,{}),e.jsx(d.Suspense,{children:e.jsx(vt,{})})]}),e.jsx(it,{})]}),[])});export{Vt as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.