import{Cr as e,I as t,Kn as n,Lt as r,M as i,N as a,Nr as o,Qn as s,Xn as c,Y as l,Yn as u,dr as d,fr as f,jr as p,mr as m,rr as h,tr as g,yr as _}from"./index-jrCi0Lum.js";import{n as v,t as y}from"./VRow-DaZSlvuQ.js";import{t as b}from"./_plugin-vue_export-helper-BDNMzG2s.js";function x(){let t=e([]),n=e(!1),i=e(1),a=e(20),o=e(0),s=e(``);async function c(){n.value=!0;try{let e=await r.get(`/servers/`,{page:i.value,per_page:a.value,search:s.value||void 0});t.value=e.items||[],o.value=e.total||0}catch(e){throw t.value=[],o.value=0,e}finally{n.value=!1}}let l;d(()=>clearTimeout(l));function u(){clearTimeout(l),l=setTimeout(()=>{i.value=1,c()},300)}function f(e){i.value=e,c()}function p(e){a.value=e,i.value=1,c()}return{servers:t,loading:n,page:i,itemsPerPage:a,total:o,search:s,loadServers:c,onSearch:u,onPageChange:f,onItemsPerPageChange:p}}function S(e){switch(e){case`online`:return`success`;case`offline`:return`error`;default:return`warning`}}function C(e){switch(e){case`online`:return`在线`;case`offline`:return`离线`;default:return`未知`}}function w(e){if(!e)return`—`;let t=new Date(e);if(isNaN(t.getTime()))return`—`;let n=Date.now()-t.getTime();return n<6e4?`刚刚`:n<36e5?`${Math.floor(n/6e4)} 分钟前`:n<864e5?`${Math.floor(n/36e5)} 小时前`:`${Math.floor(n/864e5)} 天前`}var T={class:`text-caption text-medium-emphasis mb-1`,style:{"font-size":`14px`,"letter-spacing":`0.5px`,"text-transform":`uppercase`}},E=b(h({__name:`StatCardsRow`,props:{items:{}},setup(e){return(r,d)=>(f(),c(y,null,{default:_(()=>[(f(!0),s(n,null,m(e.items,(e,n)=>(f(),c(v,{key:n,cols:`6`,sm:`3`},{default:_(()=>[g(i,{elevation:`0`,rounded:`xl`,border:``,class:`stat-card`},{default:_(()=>[g(a,{class:`pa-4 d-flex align-center justify-space-between`},{default:_(()=>[u(`div`,null,[u(`div`,T,o(e.subtitle),1),u(`div`,{class:p([`font-weight-bold`,`text-`+e.color]),style:{"font-size":`36px`,"line-height":`1.1`}},o(e.title),3)]),g(t,{color:e.color,size:`48`,rounded:`lg`,class:`stat-icon`},{default:_(()=>[g(l,{icon:e.icon,size:`24`,color:`white`},null,8,[`icon`])]),_:2},1032,[`color`])]),_:2},1024)]),_:2},1024)]),_:2},1024))),128))]),_:1}))}}),[[`__scopeId`,`data-v-1847a1b4`]]);export{x as a,C as i,w as n,S as r,E as t};