import{n as H,D as J,d as Q,T as q,L as n,E as X,F as f,A as I,G as F,H as m,I as Y,J as Z,K as c,s as ee,M as te,N as le,O as ae,z as ne,P as se,Q as oe,R as ie}from"./index-Ct76C36l.js";import{f as ue,X as re,Y as de,e as T,b as me,Q as ce,Z as pe,V as C,L as u,n as e,O as t,y as g,P as r,u as s,K as v,U as y,W as V,F as A,_ as fe,J as E,R as P}from"./vue-CbNcDebW.js";import{V as B}from"./VPagination-DNJvr3pV.js";import{b as ge}from"./vuetify-CnSZir_0.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"},we=ue({__name:"Logs",setup(Le){const O=re(),{t:U}=H(),{current:$}=ge(),h=J(),{filteredLogs:M,logTypeFilter:i,logMessageFilter:k,paginatedResults:j,currentPage:d,pageCount:p,reverseSort:L}=de(h),z=Q(),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:n[n.NORMAL],value:n.NORMAL},{title:n[n.INFO],value:n.INFO},{title:n[n.WARNING],value:n.WARNING},{title:n[n.CRITICAL],value:n.CRITICAL}]),b=T(()=>i.value.length>0),w=T(()=>i.value.length===_.value.length);function N(){O.push({name:"dashboard"})}function S(a){return`color: ${D.value[$.value.dark?"dark":"light"][n[a.type].toLowerCase()]}`}function G(a){return n[a.type]}function K(a){return ie(a.timestamp*1e3).format(z.dateFormat)}function W(){w.value?i.value=[]:i.value=_.value.map(a=>a.value)}function x(a){a.key==="Escape"&&N()}return ce(async()=>{document.addEventListener("keydown",x),await h.cleanAndFetchLogs(),X(()=>void h.updateLogs(),15e3)}),pe(()=>{document.removeEventListener("keydown",x)}),(a,o)=>(u(),C("div",ve,[e(F,{"no-gutters":"",align:"center",justify:"center"},{default:t(()=>[e(f,null,{default:t(()=>[g("h1",ye,r(s(U)("logs.title")),1)]),_:1}),e(f,null,{default:t(()=>[g("div",Ve,[e(I,{icon:s(L)?"mdi-sort-descending":"mdi-sort-ascending",variant:"plain",onClick:o[0]||(o[0]=l=>L.value=!s(L))},null,8,["icon"]),e(I,{icon:"mdi-close",variant:"plain",onClick:N})])]),_:1})]),_:1}),e(oe,null,{default:t(()=>[e(m,null,{default:t(()=>[e(F,null,{default:t(()=>[e(f,{cols:"6"},{default:t(()=>[e(Y,{modelValue:s(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:W},{prepend:t(()=>[e(Z,{indeterminate:b.value&&!w.value,"model-value":b.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:s(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"}),s(p)>1?(u(),v(m,{key:0},{default:t(()=>[e(B,{modelValue:s(d),"onUpdate:modelValue":o[3]||(o[3]=l=>V(d)?d.value=l:null),length:s(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(s(j),(l,R)=>(u(),C(A,{key:R},[R>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(S(l))},{default:t(()=>[g("div",he,"["+r(l.id)+"] "+r(l.message),1),e(ne),g("div",ke,r(K(l)),1)]),_:2},1032,["style"]),e(se,{class:"wrap-word text-select",style:E(S(l))},{default:t(()=>[P(" ["+r(G(l))+"] "+r(l.message),1)]),_:2},1032,["style"])]),_:2},1024)]),_:2},1024)]),_:2},1024)],64))),128)),s(M).length===0?(u(),v(m,{key:1},{default:t(()=>[P(r(a.$t("logs.emptyLogList")),1)]),_:1})):y("",!0),e(c),s(p)>1?(u(),v(m,{key:2},{default:t(()=>[e(B,{modelValue:s(d),"onUpdate:modelValue":o[4]||(o[4]=l=>V(d)?d.value=l:null),length:s(p),"prev-icon":"mdi-menu-left","next-icon":"mdi-menu-right"},null,8,["modelValue","length"])]),_:1})):y("",!0)]),_:1})]))}});export{we as default};
