import{u as q,f as e,t as u,i as t,af as I,ag as W,F as x,ah as B,ai as H,aj as c,ak as X,al as Z,h as C,am as O,an as J,ao as K,ap as Q,T as U,b as Y,A as ee,C as z,aq as te,V as re,a0 as F,G as ae,B as j,a4 as le,a2 as G,a5 as se,a1 as A,ab as ne,ad as ie,q as oe}from"./index-BPVK8l7-.js";import{c as ce,I as de,a as ge,f as P,b as ue,d as he,g as ve,i as fe,j as me,r as pe}from"./index-5HsANjQH.js";import{D as be}from"./DocumentTitle-Dh4EzHth.js";var _e=u('<div class="flex flex-col gap-4"><div><select class="select w-full"></select></div><div><select class="select w-full"></select></div><div><select class="select w-full">'),M=u("<option>");const $e=b=>{const[i]=q();return e(U,{ref:s=>b.ref?.(s),get icon(){return e(Q,{size:24})},get title(){return i("logsSettings")},get children(){var s=_e(),h=s.firstChild,o=h.firstChild,_=h.nextSibling,f=_.firstChild,w=_.nextSibling,m=w.firstChild;return t(h,e(I,{withDivider:!0,get children(){return i("tableSize")}}),o),o.addEventListener("change",r=>W(r.target.value)),t(o,e(x,{get each(){return Object.values(B)},children:r=>(()=>{var l=M();return l.value=r,t(l,()=>i(r)),l})()})),t(_,e(I,{withDivider:!0,get children(){return i("logLevel")}}),f),f.addEventListener("change",r=>H(r.target.value)),t(f,e(x,{get each(){return[c.Info,c.Error,c.Warning,c.Debug,c.Silent]},children:r=>(()=>{var l=M();return l.value=r,t(l,()=>i(r)),l})()})),t(w,e(I,{withDivider:!0,get children(){return i("logMaxRows")}}),m),m.addEventListener("change",r=>X(parseInt(r.target.value))),t(m,e(x,{each:Z,children:r=>(()=>{var l=M();return l.value=r,t(l,r),l})()})),C(()=>o.value=O()),C(()=>f.value=J()),C(()=>m.value=K()),s}})};var Se=u("<span>"),xe=u('<div class="flex h-full flex-col gap-2"><div class="join w-full"><input type=search class="input input-sm join-item flex-1 flex-shrink-0 input-primary"></div><div class="overflow-x-auto rounded-md bg-base-300 whitespace-nowrap"><table><thead class="sticky top-0 z-10"></thead><tbody>'),Ce=u("<tr>"),we=u('<th class=bg-base-200><div class="flex items-center"><div>'),ye=u('<tr class="hover:!bg-primary hover:text-primary-content">'),Le=u("<td class=py-2>");const N=(b,i,s,h)=>{const o=pe(b.getValue(i),s);return h({itemRank:o}),o.passed},ke=()=>{const b=Y();if(!ee())return b("/setup",{replace:!0}),null;let i;const[s]=q(),[h,o]=z(""),{logs:_,paused:f,setPaused:w}=te(),[m,r]=re(z([]),{name:"logsTableSorting",storage:localStorage}),l=[{header:s("sequence"),accessorFn:n=>n.seq},{header:s("type"),accessorFn:n=>n.type,cell:({row:n})=>{const p=n.original.type;let d="";switch(p){case c.Error:d="text-error";break;case c.Warning:d="text-warning";break;case c.Info:d="text-info";break;case c.Debug:d="text-success";break}return(()=>{var $=Se();return F($,d),t($,()=>`[${n.original.type}]`),$})()}},{header:s("payload"),accessorFn:n=>n.payload}],k=ce({filterFns:{fuzzy:N},state:{get globalFilter(){return h()},get sorting(){return m()}},get data(){return _()},sortDescFirst:!0,columns:l,onGlobalFilterChange:o,onSortingChange:r,globalFilterFn:N,getFilteredRowModel:me(),getSortedRowModel:fe(),getCoreRowModel:ve()});return[e(be,{get children(){return s("logs")}}),(()=>{var n=xe(),p=n.firstChild,d=p.firstChild,$=p.nextSibling,R=$.firstChild,D=R.firstChild,V=D.nextSibling;return d.$$input=a=>o(a.target.value),t(p,e(j,{class:"join-item btn-sm btn-primary",onClick:()=>w(a=>!a),get icon(){return ae(()=>!!f())()?e(de,{}):e(ge,{})}}),null),t(p,e(j,{class:"join-item btn-sm btn-primary",onClick:()=>i?.showModal(),get icon(){return e(le,{})}}),null),t(D,e(G,{get each(){return k.getHeaderGroups()},children:a=>{const v=a();return(()=>{var g=Ce();return t(g,e(G,{get each(){return v.headers},children:y=>{const S=y();return(()=>{var E=we(),T=E.firstChild,L=T.firstChild;return se(L,"click",S.column.getToggleSortingHandler(),!0),t(L,()=>P(S.column.columnDef.header,S.getContext())),t(T,()=>({asc:e(he,{}),desc:e(ue,{})})[S.column.getIsSorted()]??null,null),C(()=>F(L,A(S.column.getCanSort()&&"cursor-pointer select-none","flex-1"))),E})()}})),g})()}})),t(V,e(x,{get each(){return k.getRowModel().rows},children:a=>(()=>{var v=ye();return t(v,e(x,{get each(){return a.getVisibleCells()},children:g=>(()=>{var y=Le();return t(y,()=>P(g.column.columnDef.cell,g.getContext())),y})()})),v})()})),t(n,e($e,{ref:a=>i=a}),null),C(a=>{var v=s("search"),g=A(ne(O()),"table relative rounded-none");return v!==a.e&&ie(d,"placeholder",a.e=v),g!==a.t&&F(R,a.t=g),a},{e:void 0,t:void 0}),n})()]};oe(["input","click"]);export{ke as default};
