import{Fr as e,I as t,Kn as n,Lt as r,M as i,N as a,Nr as o,Qn as s,Tr as c,Xn as l,Y as u,Yn as d,br as f,dr as p,fr as m,mr as h,rr as g,tr as _}from"./index-D0zhrQxI.js";import{n as v,t as y}from"./VRow-C-dlpG_f.js";import{t as b}from"./_plugin-vue_export-helper-BDNMzG2s.js";function x(){let e=c([]),t=c(!1),n=c(1),i=c(20),a=c(0),o=c(``);async function s(){t.value=!0;try{let t=await r.get(`/servers/`,{page:n.value,per_page:i.value,search:o.value||void 0});e.value=t.items||[],a.value=t.total||0}catch(t){throw e.value=[],a.value=0,t}finally{t.value=!1}}let l;p(()=>clearTimeout(l));function u(){clearTimeout(l),l=setTimeout(()=>{n.value=1,s()},300)}function d(e){n.value=e,s()}function f(e){i.value=e,n.value=1,s()}return{servers:e,loading:t,page:n,itemsPerPage:i,total:a,search:o,loadServers:s,onSearch:u,onPageChange:d,onItemsPerPageChange:f}}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(g({__name:`StatCardsRow`,props:{items:{}},setup(r){return(c,p)=>(m(),l(y,null,{default:f(()=>[(m(!0),s(n,null,h(r.items,(n,r)=>(m(),l(v,{key:r,cols:`6`,sm:`3`},{default:f(()=>[_(i,{elevation:`0`,rounded:`xl`,border:``,class:`stat-card`},{default:f(()=>[_(a,{class:`pa-4 d-flex align-center justify-space-between`},{default:f(()=>[d(`div`,null,[d(`div`,T,e(n.subtitle),1),d(`div`,{class:o([`font-weight-bold`,`text-`+n.color]),style:{"font-size":`36px`,"line-height":`1.1`}},e(n.title),3)]),_(t,{color:n.color,size:`48`,rounded:`lg`,class:`stat-icon`},{default:f(()=>[_(u,{icon:n.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};