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