import{e as K,s as q,t as J,T as Q,L as s,v as X,w as f,p as I,x as R,y as m,z as Y,A as Z,B as c,V as ee,C as te,D as le,E as ae,o as se,F as ne,G as oe,H as ie}from"./index-ChuS1rKu.js";import{f as ue,W as re,X as de,e as T,b as me,O as ce,Y as pe,U as C,K as u,n as e,M as t,y as g,Q as r,u as n,J as v,T as y,V,F as A,Z as fe,N as E,P as B}from"./vue-BhpnMDi9.js";import{V as P}from"./VPagination-CvZZP7Oy.js";import{b as ge}from"./vuetify-BI39WAG5.js";const ve={class:"pa-3"},ye={style:{"font-size":"1.6em !important"},class:"subtitle-1 ml-2"},Ve={class:"d-flex justify-end"},he={class:"d-flex mr-8 overflow-hidden"},ke={class:"d-flex"},be=ue({__name:"Logs",setup(Le){const U=re(),{t:O}=K(),{current:$}=ge(),h=q(),{filteredLogs:M,logTypeFilter:i,logMessageFilter:k,paginatedResults:j,currentPage:d,pageCount:p,reverseSort:L}=de(h),z=J(),D=T(()=>({light:{normal:"black",info:"blue",warning:"orange",critical:"red"},dark:{normal:"white",info:"deepskyblue",warning:"darkorange",critical:new Q("darkred").lighten(12).toString()}})),_=me([{title:s[s.NORMAL],value:s.NORMAL},{title:s[s.INFO],value:s.INFO},{title:s[s.WARNING],value:s.WARNING},{title:s[s.CRITICAL],value:s.CRITICAL}]),w=T(()=>i.value.length>0),b=T(()=>i.value.length===_.value.length);function x(){U.push({name:"dashboard"})}function N(a){return`color: ${D.value[$.value.dark?"dark":"light"][s[a.type].toLowerCase()]}`}function G(a){return s[a.type]}function W(a){return ie(a.timestamp*1e3).format(z.dateFormat)}function H(){b.value?i.value=[]:i.value=_.value.map(a=>a.value)}function S(a){a.key==="Escape"&&x()}return ce(async()=>{document.addEventListener("keydown",S),await h.cleanAndFetchLogs(),X(()=>void h.updateLogs(),15e3)}),pe(()=>{document.removeEventListener("keydown",S)}),(a,o)=>(u(),C("div",ve,[e(R,{"no-gutters":"",align:"center",justify:"center"},{default:t(()=>[e(f,null,{default:t(()=>[g("h1",ye,r(n(O)("logs.title")),1)]),_:1}),e(f,null,{default:t(()=>[g("div",Ve,[e(I,{icon:n(L)?"mdi-sort-descending":"mdi-sort-ascending",variant:"plain",onClick:o[0]||(o[0]=l=>L.value=!n(L))},null,8,["icon"]),e(I,{icon:"mdi-close",variant:"plain",onClick:x})])]),_:1})]),_:1}),e(oe,null,{default:t(()=>[e(m,null,{default:t(()=>[e(R,null,{default:t(()=>[e(f,{cols:"6"},{default:t(()=>[e(Y,{modelValue:n(i),"onUpdate:modelValue":o[1]||(o[1]=l=>V(i)?i.value=l:null),items:_.value,label:a.$t("logs.filters.type"),"hide-details":"",multiple:"",chips:""},{"prepend-item":t(()=>[e(m,{title:a.$t("common.selectAll"),onClick:H},{prepend:t(()=>[e(Z,{indeterminate:w.value&&!b.value,"model-value":w.value},null,8,["indeterminate","model-value"])]),_:1},8,["title"]),e(c)]),_:1},8,["modelValue","items","label"])]),_:1}),e(f,{cols:"6"},{default:t(()=>[e(ee,{modelValue:n(k),"onUpdate:modelValue":o[2]||(o[2]=l=>V(k)?k.value=l:null),label:a.$t("logs.filters.query"),"hide-details":"",clearable:""},null,8,["modelValue","label"])]),_:1})]),_:1})]),_:1}),e(c,{class:"my-3",thickness:"5"}),n(p)>1?(u(),v(m,{key:0},{default:t(()=>[e(P,{modelValue:n(d),"onUpdate:modelValue":o[3]||(o[3]=l=>V(d)?d.value=l:null),length:n(p),"prev-icon":"mdi-menu-left","next-icon":"mdi-menu-right"},null,8,["modelValue","length"])]),_:1})):y("",!0),e(c),(u(!0),C(A,null,fe(n(j),(l,F)=>(u(),C(A,{key:F},[F>0?(u(),v(c,{key:0})):y("",!0),e(m,{class:"pa-0"},{default:t(()=>[e(te,{class:"p-0"},{default:t(()=>[e(le,{class:"pa-0"},{default:t(()=>[e(ae,{class:"text-no-wrap",style:E(N(l))},{default:t(()=>[g("div",he,"["+r(l.id)+"] "+r(l.message),1),e(se),g("div",ke,r(W(l)),1)]),_:2},1032,["style"]),e(ne,{class:"wrap-word text-select",style:E(N(l))},{default:t(()=>[B(" ["+r(G(l))+"] "+r(l.message),1)]),_:2},1032,["style"])]),_:2},1024)]),_:2},1024)]),_:2},1024)],64))),128)),n(M).length===0?(u(),v(m,{key:1},{default:t(()=>[B(r(a.$t("logs.emptyLogList")),1)]),_:1})):y("",!0),e(c),n(p)>1?(u(),v(m,{key:2},{default:t(()=>[e(P,{modelValue:n(d),"onUpdate:modelValue":o[4]||(o[4]=l=>V(d)?d.value=l:null),length:n(p),"prev-icon":"mdi-menu-left","next-icon":"mdi-menu-right"},null,8,["modelValue","length"])]),_:1})):y("",!0)]),_:1})]))}});export{be as default};
