import{u as O,f as e,t as u,i as t,ad as I,ae as q,F as x,af as B,ag as H,ah as c,ai as X,aj as Z,h as C,ak as V,al as J,am as K,an as Q,T as U,b as Y,A as ee,C as z,ao as te,V as re,_ as F,G as ae,B as j,a2 as le,a0 as G,a3 as se,$ as A,a9 as ne,ab as ie,q as oe}from"./index-CtVw7BLk.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 me,j as pe,r as fe}from"./index-CPvx_C2g.js";import{D as be}from"./DocumentTitle-D9yyEXNP.js";var _e=u('<div class="flex flex-col gap-4"><div><select class=select></select></div><div><select class=select></select></div><div><select class=select>'),M=u("<option>");const $e=b=>{const[i]=O();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,m=_.firstChild,y=_.nextSibling,p=y.firstChild;return t(h,e(I,{withDivider:!0,get children(){return i("tableSize")}}),o),o.addEventListener("change",r=>q(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")}}),m),m.addEventListener("change",r=>H(r.target.value)),t(m,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(y,e(I,{withDivider:!0,get children(){return i("logMaxRows")}}),p),p.addEventListener("change",r=>X(parseInt(r.target.value))),t(p,e(x,{each:Z,children:r=>(()=>{var l=M();return l.value=r,t(l,r),l})()})),C(()=>o.value=V()),C(()=>m.value=J()),C(()=>p.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>"),ye=u('<th class=bg-base-200><div class="flex items-center"><div>'),we=u('<tr class="hover:!bg-primary hover:text-primary-content">'),Le=u("<td class=py-2>");const N=(b,i,s,h)=>{const o=fe(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]=O(),[h,o]=z(""),{logs:_,paused:m,setPaused:y}=te(),[p,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 f=n.original.type;let d="";switch(f){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 p()}},get data(){return _()},sortDescFirst:!0,columns:l,onGlobalFilterChange:o,onSortingChange:r,globalFilterFn:N,getFilteredRowModel:pe(),getSortedRowModel:me(),getCoreRowModel:ve()});return[e(be,{get children(){return s("logs")}}),(()=>{var n=xe(),f=n.firstChild,d=f.firstChild,$=f.nextSibling,R=$.firstChild,D=R.firstChild,W=D.nextSibling;return d.$$input=a=>o(a.target.value),t(f,e(j,{class:"join-item btn-sm btn-primary",onClick:()=>y(a=>!a),get icon(){return ae(()=>!!m())()?e(de,{}):e(ge,{})}}),null),t(f,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:w=>{const S=w();return(()=>{var E=ye(),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(W,e(x,{get each(){return k.getRowModel().rows},children:a=>(()=>{var v=we();return t(v,e(x,{get each(){return a.getVisibleCells()},children:g=>(()=>{var w=Le();return t(w,()=>P(g.column.columnDef.cell,g.getContext())),w})()})),v})()})),t(n,e($e,{ref:a=>i=a}),null),C(a=>{var v=s("search"),g=A(ne(V()),"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};
