import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{B as t,Bt as n,D as r,Dt as i,F as a,G as o,Kt as s,L as c,M as l,Mt as ee,N as u,P as d,Q as te,R as f,Tt as p,Ut as m,bt as h,c as g,ct as _,it as v,j as y,ot as b,p as ne,qt as x}from"./vue-3bs2-dMU.js";import{Jt as S,K as C,Rt as w,d as re,en as T,h as ie}from"./stores-DmetsdTd.js";import{A as ae,G as oe,K as E,L as se,N as ce,O as le,Pt as ue,_t as D,et as de,gt as O,ht as k,j as A,k as j,rt as M,tt as N,v as P}from"./vuetify-gGrfRH2I.js";o(),p(),m();var F=e(w(),1),I={class:`pa-3`},L={class:`d-flex align-center`},R={class:`text-headline-medium ml-2`},z={class:`d-flex justify-end`},B={class:`d-flex mr-8 overflow-hidden`},V={class:`d-flex`},H=t({__name:`Logs`,setup(e){let t=g(),{t:o}=C(),{current:p}=ue(),m=re(),{filteredLogs:w,logTypeFilter:H,logMessageFilter:U,paginatedResults:fe,currentPage:W,pageCount:G,reverseSort:K}=ne(m),q=ie(),pe={light:{[T.NORMAL]:new S(`black`),[T.INFO]:new S(`blue`),[T.WARNING]:new S(`orange`),[T.CRITICAL]:new S(`red`)},dark:{[T.NORMAL]:new S(`white`),[T.INFO]:new S(`deepskyblue`),[T.WARNING]:new S(`darkorange`),[T.CRITICAL]:new S(`darkred`).lighten(12)}},J=ee([{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}]),Y=y(()=>H.value.length>0),X=y(()=>H.value.length===J.value.length);function Z(){t.push({name:`dashboard`})}function Q(e){return`color: #${pe[p.value.dark?`dark`:`light`][e.type].toHex()}`}function me(e){return T[e.type]}function he(e){return(0,F.default)(e.timestamp*1e3).format(q.dateFormat)}function ge(){X.value?H.value=[]:H.value=J.value.map(e=>e.value)}function $(e){e.key===`Escape`&&Z()}return te(async()=>{document.addEventListener(`keydown`,$),await m.cleanAndFetchLogs(),m.startLogSync()}),v(()=>{document.removeEventListener(`keydown`,$),m.pauseLogSync()}),(e,t)=>(b(),a(`div`,I,[l(`div`,L,[l(`div`,R,x(n(o)(`logs.title`)),1),f(k),l(`div`,z,[f(E,{icon:n(K)?`mdi-sort-descending`:`mdi-sort-ascending`,variant:`plain`,onClick:t[0]||=e=>K.value=!n(K)},null,8,[`icon`]),f(E,{icon:`mdi-close`,variant:`plain`,onClick:Z})])]),f(de,null,{default:h(()=>[f(M,null,{default:h(()=>[f(O,null,{default:h(()=>[f(D,{cols:`6`},{default:h(()=>[f(ce,{modelValue:n(H),"onUpdate:modelValue":t[1]||=e=>i(H)?H.value=e:null,items:J.value,label:n(o)(`logs.filters.type`),chips:``,"hide-details":``,multiple:``},{"prepend-item":h(()=>[f(M,{title:n(o)(`common.selectAll`),onClick:ge},{prepend:h(()=>[f(se,{indeterminate:Y.value&&!X.value,"model-value":Y.value},null,8,[`indeterminate`,`model-value`])]),_:1},8,[`title`]),f(N)]),_:1},8,[`modelValue`,`items`,`label`])]),_:1}),f(D,{cols:`6`},{default:h(()=>[f(oe,{modelValue:n(U),"onUpdate:modelValue":t[2]||=e=>i(U)?U.value=e:null,label:n(o)(`logs.filters.query`),clearable:``,"hide-details":``},null,8,[`modelValue`,`label`])]),_:1})]),_:1})]),_:1}),f(N,{class:`my-3`,thickness:`5`}),n(G)>1?(b(),u(M,{key:0},{default:h(()=>[f(P,{modelValue:n(W),"onUpdate:modelValue":t[3]||=e=>i(W)?W.value=e:null,length:n(G),"prev-icon":`mdi-menu-left`,"next-icon":`mdi-menu-right`},null,8,[`modelValue`,`length`])]),_:1})):d(``,!0),f(N),(b(!0),a(r,null,_(n(fe),(e,t)=>(b(),a(r,{key:e.id},[t>0?(b(),u(N,{key:0})):d(``,!0),f(M,{class:`pa-0`},{default:h(()=>[f(le,{class:`p-0`},{default:h(()=>[f(j,{class:`pa-0`},{default:h(()=>[f(ae,{class:`text-no-wrap`,style:s(Q(e))},{default:h(()=>[l(`div`,B,`[`+x(e.id)+`] `+x(e.message),1),f(k),l(`div`,V,x(he(e)),1)]),_:2},1032,[`style`]),f(A,{class:`wrap-word text-select`,style:s(Q(e))},{default:h(()=>[c(` [`+x(me(e))+`] `+x(e.message),1)]),_:2},1032,[`style`])]),_:2},1024)]),_:2},1024)]),_:2},1024)],64))),128)),n(w).length===0?(b(),u(M,{key:1},{default:h(()=>[c(x(n(o)(`logs.emptyLogList`)),1)]),_:1})):d(``,!0),f(N),n(G)>1?(b(),u(M,{key:2},{default:h(()=>[f(P,{modelValue:n(W),"onUpdate:modelValue":t[4]||=e=>i(W)?W.value=e:null,length:n(G),"prev-icon":`mdi-menu-left`,"next-icon":`mdi-menu-right`},null,8,[`modelValue`,`length`])]),_:1})):d(``,!0)]),_:1})]))}});export{H as default};