import{u as z,__tla as __tla_0}from"./ArrayPagination-DuWOkPss.js";import{q as D,r as H,L as l,s as K,t as Q,v as R,w as J,x as f,i as X,y as m,z as Y,A as Z,B as c,f as ee,C as S,D as te,E as le,F as ae,h as se,G as oe,H as ne,I as ue,__tla as __tla_1}from"./index-bUuJUL5l.js";import{g as re,G as ie,d as T,c as g,H as de,V as me,I as r,W as C,m as e,K as a,T as ce,X as v,M as i,u as o,J as y,Q as w,O as V,F,Y as pe,Z as fe,L as b}from"./vue-BSryv7ps.js";import"./vuetify-i5Qjiq6M.js";let xe;let __tla=Promise.all([(()=>{try{return __tla_0}catch{}})(),(()=>{try{return __tla_1}catch{}})()]).then(async()=>{let ge,ve,ye,Ve,_e,Le;ge={class:"pa-3"};ve={style:{"font-size":"1.6em !important"},class:"subtitle-1 ml-2"};ye={class:"d-flex justify-end"};Ve={class:"d-flex mr-8 overflow-hidden"};_e={class:"d-flex"};Le=re({__name:"Logs",setup(he){const B=ce(),{t:E}=ie(),_=D(),O=H(),L=T([{title:l[l.NORMAL],value:l.NORMAL},{title:l[l.INFO],value:l.INFO},{title:l[l.WARNING],value:l.WARNING},{title:l[l.CRITICAL],value:l.CRITICAL}]),u=T([l.NORMAL,l.INFO,l.WARNING,l.CRITICAL]),h=T(""),P=g(()=>_.logs),G=g(()=>P.value.filter(t=>u.value.includes(t.type))),I=g(()=>u.value.length>0),N=g(()=>u.value.length===L.value.length),{results:x}=K(G,h,t=>t.message),{paginatedResults:M,currentPage:d,pageCount:p}=z(x,30),k=()=>{B.push({name:"dashboard"})},U=t=>`logtype-${l[t?.type]?.toLowerCase()}`,$=t=>l[t.type],W=t=>ne(t.timestamp*1e3).format(O.dateFormat),j=()=>{N.value?u.value=[]:u.value=L.value.map(t=>t.value)},A=t=>{t.key==="Escape"&&k()};return de(async()=>{document.addEventListener("keydown",A),await _.cleanAndFetchLogs(),Q(_.fetchLogs,15e3)}),me(()=>{document.removeEventListener("keydown",A)}),(t,n)=>(r(),C("div",ge,[e(R,{"no-gutters":"",align:"center",justify:"center"},{default:a(()=>[e(f,null,{default:a(()=>[v("h1",ve,i(o(E)("logs.title")),1)]),_:1}),e(f,null,{default:a(()=>[v("div",ye,[e(X,{icon:"mdi-close",variant:"plain",onClick:k})])]),_:1})]),_:1}),e(J,null,{default:a(()=>[e(m,null,{default:a(()=>[e(R,null,{default:a(()=>[e(f,{cols:"6"},{default:a(()=>[e(Y,{modelValue:u.value,"onUpdate:modelValue":n[0]||(n[0]=s=>u.value=s),items:L.value,label:t.$t("logs.filters.type"),"hide-details":"",multiple:"",chips:""},{"prepend-item":a(()=>[e(m,{title:t.$t("common.selectAll"),onClick:j},{prepend:a(()=>[e(Z,{indeterminate:I.value&&!N.value,"model-value":I.value},null,8,["indeterminate","model-value"])]),_:1},8,["title"]),e(c)]),_:1},8,["modelValue","items","label"])]),_:1}),e(f,{cols:"6"},{default:a(()=>[e(ee,{modelValue:h.value,"onUpdate:modelValue":n[1]||(n[1]=s=>h.value=s),label:t.$t("logs.filters.query"),"hide-details":""},null,8,["modelValue","label"])]),_:1})]),_:1})]),_:1}),e(c,{class:"my-3",thickness:"5"}),o(p)>1?(r(),y(m,{key:0},{default:a(()=>[e(S,{modelValue:o(d),"onUpdate:modelValue":n[2]||(n[2]=s=>w(d)?d.value=s:null),length:o(p),"prev-icon":"mdi-menu-left","next-icon":"mdi-menu-right"},null,8,["modelValue","length"])]),_:1})):V("",!0),e(c),(r(!0),C(F,null,pe(o(M),(s,q)=>(r(),C(F,null,[q>0?(r(),y(c,{key:0})):V("",!0),e(m,{class:"pa-0"},{default:a(()=>[e(te,{class:"p-0"},{default:a(()=>[e(le,{class:fe([U(s),"pa-0"])},{default:a(()=>[e(ae,{class:"text-no-wrap"},{default:a(()=>[v("div",Ve,"["+i(s.id)+"] "+i(s.message),1),e(se),v("div",_e,i(W(s)),1)]),_:2},1024),e(oe,{class:"wrap-word text-select"},{default:a(()=>[b(" ["+i($(s))+"] "+i(s.message),1)]),_:2},1024)]),_:2},1032,["class"])]),_:2},1024)]),_:2},1024)],64))),256)),o(x).length===0?(r(),y(m,{key:1},{default:a(()=>[b(i(t.$t("logs.emptyLogList")),1)]),_:1})):V("",!0),e(c),o(p)>1?(r(),y(m,{key:2},{default:a(()=>[e(S,{modelValue:o(d),"onUpdate:modelValue":n[3]||(n[3]=s=>w(d)?d.value=s:null),length:o(p),"prev-icon":"mdi-menu-left","next-icon":"mdi-menu-right"},null,8,["modelValue","length"])]),_:1})):V("",!0)]),_:1})]))}});xe=ue(Le,[["__scopeId","data-v-1115081b"]])});export{xe as default,__tla};