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