import{c as me,g as Xr,q as Qr,s as Zr,r as l,j as e,B as ce,k as $,O as eo,Q as to,U as ro,V as oo,a as nt,W as Fe,X as at,Y as _t,Z as Mt,e as $e,_ as Pt,$ as Q,d as C,P as H,a0 as Tt,a1 as no,a2 as Rt,a3 as Et,a4 as Dt,a5 as It,a6 as kt,a7 as Ot,a8 as At,a9 as Lt,u as Xe,b as Pe,f as se,aa as ao,y as ke,ab as so,ac as Ft,ad as pe,ae as $t,af as lo,M as Vt,ag as io,ah as co,ai as uo,J as po,K as mo,aj as ho,ak as fo,al as go,am as xo,an as vo,ao as bo,S as yo,ap as wo,t as ue,F as So,aq as jo}from"./index-zgZmtGWP.js";import{C as Bt,e as Kt,u as Co,a as No,P as _o,b as Mo,c as Po,d as To,Q as Ro}from"./QuickAccessCards-Di9HhdMM.js";import{F as st,D as Eo,T as Do,a as Io,b as Ge,c as ko,f as ft,d as Oo,e as gt,m as xt,C as Ao,S as Lo,g as vt,u as Fo,h as $o,i as Vo,j as Bo,k as Ko,l as Uo}from"./scroll-area-BJr-369G.js";import{a as Ho,b as zo,C as xe,d as Se,e as Go}from"./card-DPbDbxNS.js";import{I as Ne,L as Ie}from"./label-CMBNwj5B.js";import{a as Ut,c as Ht,I as Wo,R as qo}from"./index-Bkf8Y2ot.js";import{u as zt,C as Jo}from"./index-HlQ3xtPA.js";import{S as Gt}from"./search-BLT648Bh.js";import{R as Yo,u as Xo}from"./switch-DMndCyaK.js";import{D as Qo,a as Zo,b as en,c as tn,e as rn,P as on,C as bt}from"./ConfirmDialog-BXch8StB.js";import{C as nn}from"./chart-column-DyyXmOMh.js";/**
 * @license lucide-react v0.479.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const an=[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h4",key:"6d7r33"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h10",key:"1438ji"}]],sn=me("ArrowDownNarrowWide",an);/**
 * @license lucide-react v0.479.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ln=[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M11 12h4",key:"q8tih4"}],["path",{d:"M11 16h7",key:"uosisv"}],["path",{d:"M11 20h10",key:"jvxblo"}]],cn=me("ArrowUpNarrowWide",ln);/**
 * @license lucide-react v0.479.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const dn=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],un=me("ChevronUp",dn);/**
 * @license lucide-react v0.479.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const pn=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],mn=me("ChevronsLeft",pn);/**
 * @license lucide-react v0.479.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const hn=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],fn=me("ChevronsRight",hn);/**
 * @license lucide-react v0.479.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const gn=[["path",{d:"M22 12A10 10 0 1 1 12 2",key:"1fm58d"}],["path",{d:"M22 2 12 12",key:"yg2myt"}],["path",{d:"M16 2h6v6",key:"zan5cs"}]],xn=me("CircleArrowOutUpRight",gn);/**
 * @license lucide-react v0.479.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vn=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],bn=me("LoaderCircle",vn);/**
 * @license lucide-react v0.479.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const yn=[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]],wn=me("Maximize2",yn);function Sn(t,o){var n;const r=Xr({queryKey:Qr.logs.byProjectWithOptions(t,o),queryFn:()=>Zr.projects.getLogs(t,o),enabled:!!t});return{...r,hasNextCursor:((n=r.data)==null?void 0:n.hasNextPage)||!1}}function jn(t={}){const{initialFilters:o={},initialSearchQuery:r="",debounceTimeout:n=500}=t,[a,s]=l.useState(r),[c,u]=l.useState(r),[i,p]=l.useState(!1),[h,d]=l.useState({levels:o.levels||[],fromDate:o.fromDate||"",toDate:o.toDate||"",metadata:o.metadata||[]}),[f,g]=l.useState(()=>!!(o.levels&&o.levels.length>0||o.fromDate||o.toDate||o.metadata&&o.metadata.length>0));return l.useEffect(()=>{const v=setTimeout(()=>{u(a)},n);return()=>{clearTimeout(v)}},[a,n]),{searchQuery:c,setSearchQuery:s,inputValue:a,filterModalOpen:i,openFilterModal:()=>p(!0),closeFilterModal:()=>p(!1),setFilterModalOpen:p,filters:h,handleApplyFilters:v=>{d(v),g(v.levels.length>0||!!v.fromDate||!!v.toDate||v.metadata.length>0),p(!1)},handleResetFilters:()=>{d({levels:[],fromDate:"",toDate:"",metadata:[]}),g(!1),s(""),p(!1)},filtersActive:f}}function Cn(t=[]){const[o,r]=l.useState({}),[n,a]=l.useState(0);l.useEffect(()=>{const i=Object.values(o).filter(Boolean).length;a(i)},[o]);const s=l.useCallback(()=>{r({})},[]);l.useEffect(()=>{s()},[t,s]);const c=l.useCallback(i=>{const p={};i&&t.forEach(h=>{p[h.id]=!0}),r(p)},[t]),u=l.useCallback((i,p)=>{r(h=>{const d={...h};return p?d[i]=!0:delete d[i],d})},[]);return{selectedLogs:o,selectedCount:n,handleSelectAll:c,handleSelectRow:u,resetSelection:s}}function Nn(t="desc"){const[o,r]=l.useState(t),[n,a]=l.useState([{id:"timestamp",desc:t==="desc"}]),s=l.useCallback(()=>{r(u=>{const i=u==="desc"?"asc":"desc";return a([{id:"timestamp",desc:i==="desc"}]),i})},[]),c=l.useCallback(()=>{r(t),a([{id:"timestamp",desc:t==="desc"}])},[t]);return{sortDirection:o,sorting:n,handleToggleSortDirection:s,setSorting:a,resetSort:c}}function _n(){const[t,o]=l.useState(!1),[r,n]=l.useState(null),a=l.useCallback(c=>{n(c),o(!0)},[]),s=l.useCallback(()=>{o(!1)},[]);return{isDetailSheetOpen:t,currentLogDetail:r,openDetailSheet:a,closeDetailSheet:s,setIsDetailSheetOpen:o}}function Mn({filters:t,sortDirection:o,onOpenFilterModal:r,onToggleSortDirection:n,displayedLogCount:a,isLoading:s}){return e.jsx(Ho,{className:"px-6 py-4 border-b bg-gradient-to-r from-gray-50/80 to-blue-50/80 backdrop-blur-sm",children:e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[e.jsxs("div",{children:[e.jsx(zo,{className:"text-xl font-bold",children:"Project Logs"}),e.jsxs("div",{className:"flex flex-wrap gap-2 mt-2",children:[t.levels.length>0&&e.jsxs(ce,{variant:"outline",children:["Levels: ",t.levels.join(", ")]}),t.fromDate&&e.jsxs(ce,{variant:"outline",children:["From: ",new Date(t.fromDate).toLocaleDateString()]}),t.toDate&&e.jsxs(ce,{variant:"outline",children:["To: ",new Date(t.toDate).toLocaleDateString()]}),t.metadata.map((c,u)=>e.jsxs(ce,{variant:"outline",className:"truncate max-w-xs",children:[c.key,": ",c.value]},u))]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx($,{variant:"outline",size:"icon",className:"h-9 w-9",onClick:r,"aria-label":"Open filters",disabled:s,children:e.jsx(st,{className:"h-5 w-5"})}),e.jsx(eo,{children:e.jsxs(to,{children:[e.jsx(ro,{asChild:!0,children:e.jsxs($,{variant:"outline",size:"sm",onClick:n,className:"h-9 min-w-[140px] justify-between tabular-nums",disabled:s,children:[e.jsx("span",{children:o==="desc"?"Newest First":"Oldest First"}),o==="desc"?e.jsx(sn,{className:"h-4 w-4 ml-2"}):e.jsx(cn,{className:"h-4 w-4 ml-2"})]})}),e.jsx(oo,{children:e.jsx("p",{children:"Change sort order"})})]})}),a!==void 0&&!s&&e.jsxs("div",{className:"text-sm text-muted-foreground whitespace-nowrap",children:[a," log",a===1?"":"s"]})]})]})})}var Qe=["Enter"," "],Pn=["ArrowDown","PageUp","Home"],Wt=["ArrowUp","PageDown","End"],Tn=[...Pn,...Wt],Rn={ltr:[...Qe,"ArrowRight"],rtl:[...Qe,"ArrowLeft"]},En={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Ee="Menu",[Te,Dn,In]=Ut(Ee),[ye,qt]=nt(Ee,[In,Fe,Ht]),Ve=Fe(),Jt=Ht(),[kn,we]=ye(Ee),[On,De]=ye(Ee),Yt=t=>{const{__scopeMenu:o,open:r=!1,children:n,dir:a,onOpenChange:s,modal:c=!0}=t,u=Ve(o),[i,p]=l.useState(null),h=l.useRef(!1),d=at(s),f=zt(a);return l.useEffect(()=>{const g=()=>{h.current=!0,document.addEventListener("pointerdown",x,{capture:!0,once:!0}),document.addEventListener("pointermove",x,{capture:!0,once:!0})},x=()=>h.current=!1;return document.addEventListener("keydown",g,{capture:!0}),()=>{document.removeEventListener("keydown",g,{capture:!0}),document.removeEventListener("pointerdown",x,{capture:!0}),document.removeEventListener("pointermove",x,{capture:!0})}},[]),e.jsx(_t,{...u,children:e.jsx(kn,{scope:o,open:r,onOpenChange:d,content:i,onContentChange:p,children:e.jsx(On,{scope:o,onClose:l.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:h,dir:f,modal:c,children:n})})})};Yt.displayName=Ee;var An="MenuAnchor",lt=l.forwardRef((t,o)=>{const{__scopeMenu:r,...n}=t,a=Ve(r);return e.jsx(Mt,{...a,...n,ref:o})});lt.displayName=An;var it="MenuPortal",[Ln,Xt]=ye(it,{forceMount:void 0}),Qt=t=>{const{__scopeMenu:o,forceMount:r,children:n,container:a}=t,s=we(it,o);return e.jsx(Ln,{scope:o,forceMount:r,children:e.jsx($e,{present:r||s.open,children:e.jsx(Pt,{asChild:!0,container:a,children:n})})})};Qt.displayName=it;var te="MenuContent",[Fn,ct]=ye(te),Zt=l.forwardRef((t,o)=>{const r=Xt(te,t.__scopeMenu),{forceMount:n=r.forceMount,...a}=t,s=we(te,t.__scopeMenu),c=De(te,t.__scopeMenu);return e.jsx(Te.Provider,{scope:t.__scopeMenu,children:e.jsx($e,{present:n||s.open,children:e.jsx(Te.Slot,{scope:t.__scopeMenu,children:c.modal?e.jsx($n,{...a,ref:o}):e.jsx(Vn,{...a,ref:o})})})})}),$n=l.forwardRef((t,o)=>{const r=we(te,t.__scopeMenu),n=l.useRef(null),a=Q(o,n);return l.useEffect(()=>{const s=n.current;if(s)return Tt(s)},[]),e.jsx(dt,{...t,ref:a,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:C(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),Vn=l.forwardRef((t,o)=>{const r=we(te,t.__scopeMenu);return e.jsx(dt,{...t,ref:o,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),Bn=Dt("MenuContent.ScrollLock"),dt=l.forwardRef((t,o)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:a,onOpenAutoFocus:s,onCloseAutoFocus:c,disableOutsidePointerEvents:u,onEntryFocus:i,onEscapeKeyDown:p,onPointerDownOutside:h,onFocusOutside:d,onInteractOutside:f,onDismiss:g,disableOutsideScroll:x,...m}=t,b=we(te,r),j=De(te,r),v=Ve(r),y=Jt(r),N=Dn(r),[A,q]=l.useState(null),_=l.useRef(null),V=Q(o,_,b.onContentChange),P=l.useRef(0),J=l.useRef(""),Y=l.useRef(0),I=l.useRef(null),B=l.useRef("right"),K=l.useRef(0),U=x?Et:l.Fragment,T=x?{as:Bn,allowPinchZoom:!0}:void 0,F=w=>{var S,R;const k=J.current+w,W=N().filter(O=>!O.disabled),X=document.activeElement,ne=(S=W.find(O=>O.ref.current===X))==null?void 0:S.textValue,G=W.map(O=>O.textValue),le=Zn(G,k,ne),ee=(R=W.find(O=>O.textValue===le))==null?void 0:R.ref.current;(function O(M){J.current=M,window.clearTimeout(P.current),M!==""&&(P.current=window.setTimeout(()=>O(""),1e3))})(k),ee&&setTimeout(()=>ee.focus())};l.useEffect(()=>()=>window.clearTimeout(P.current),[]),Rt();const z=l.useCallback(w=>{var W,X;return B.current===((W=I.current)==null?void 0:W.side)&&ta(w,(X=I.current)==null?void 0:X.area)},[]);return e.jsx(Fn,{scope:r,searchRef:J,onItemEnter:l.useCallback(w=>{z(w)&&w.preventDefault()},[z]),onItemLeave:l.useCallback(w=>{var k;z(w)||((k=_.current)==null||k.focus(),q(null))},[z]),onTriggerLeave:l.useCallback(w=>{z(w)&&w.preventDefault()},[z]),pointerGraceTimerRef:Y,onPointerGraceIntentChange:l.useCallback(w=>{I.current=w},[]),children:e.jsx(U,{...T,children:e.jsx(It,{asChild:!0,trapped:a,onMountAutoFocus:C(s,w=>{var k;w.preventDefault(),(k=_.current)==null||k.focus({preventScroll:!0})}),onUnmountAutoFocus:c,children:e.jsx(kt,{asChild:!0,disableOutsidePointerEvents:u,onEscapeKeyDown:p,onPointerDownOutside:h,onFocusOutside:d,onInteractOutside:f,onDismiss:g,children:e.jsx(qo,{asChild:!0,...y,dir:j.dir,orientation:"vertical",loop:n,currentTabStopId:A,onCurrentTabStopIdChange:q,onEntryFocus:C(i,w=>{j.isUsingKeyboardRef.current||w.preventDefault()}),preventScrollOnEntryFocus:!0,children:e.jsx(Ot,{role:"menu","aria-orientation":"vertical","data-state":fr(b.open),"data-radix-menu-content":"",dir:j.dir,...v,...m,ref:V,style:{outline:"none",...m.style},onKeyDown:C(m.onKeyDown,w=>{const W=w.target.closest("[data-radix-menu-content]")===w.currentTarget,X=w.ctrlKey||w.altKey||w.metaKey,ne=w.key.length===1;W&&(w.key==="Tab"&&w.preventDefault(),!X&&ne&&F(w.key));const G=_.current;if(w.target!==G||!Tn.includes(w.key))return;w.preventDefault();const ee=N().filter(S=>!S.disabled).map(S=>S.ref.current);Wt.includes(w.key)&&ee.reverse(),Xn(ee)}),onBlur:C(t.onBlur,w=>{w.currentTarget.contains(w.target)||(window.clearTimeout(P.current),J.current="")}),onPointerMove:C(t.onPointerMove,Re(w=>{const k=w.target,W=K.current!==w.clientX;if(w.currentTarget.contains(k)&&W){const X=w.clientX>K.current?"right":"left";B.current=X,K.current=w.clientX}}))})})})})})})});Zt.displayName=te;var Kn="MenuGroup",ut=l.forwardRef((t,o)=>{const{__scopeMenu:r,...n}=t;return e.jsx(H.div,{role:"group",...n,ref:o})});ut.displayName=Kn;var Un="MenuLabel",er=l.forwardRef((t,o)=>{const{__scopeMenu:r,...n}=t;return e.jsx(H.div,{...n,ref:o})});er.displayName=Un;var Oe="MenuItem",yt="menu.itemSelect",Be=l.forwardRef((t,o)=>{const{disabled:r=!1,onSelect:n,...a}=t,s=l.useRef(null),c=De(Oe,t.__scopeMenu),u=ct(Oe,t.__scopeMenu),i=Q(o,s),p=l.useRef(!1),h=()=>{const d=s.current;if(!r&&d){const f=new CustomEvent(yt,{bubbles:!0,cancelable:!0});d.addEventListener(yt,g=>n==null?void 0:n(g),{once:!0}),no(d,f),f.defaultPrevented?p.current=!1:c.onClose()}};return e.jsx(tr,{...a,ref:i,disabled:r,onClick:C(t.onClick,h),onPointerDown:d=>{var f;(f=t.onPointerDown)==null||f.call(t,d),p.current=!0},onPointerUp:C(t.onPointerUp,d=>{var f;p.current||(f=d.currentTarget)==null||f.click()}),onKeyDown:C(t.onKeyDown,d=>{const f=u.searchRef.current!=="";r||f&&d.key===" "||Qe.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});Be.displayName=Oe;var tr=l.forwardRef((t,o)=>{const{__scopeMenu:r,disabled:n=!1,textValue:a,...s}=t,c=ct(Oe,r),u=Jt(r),i=l.useRef(null),p=Q(o,i),[h,d]=l.useState(!1),[f,g]=l.useState("");return l.useEffect(()=>{const x=i.current;x&&g((x.textContent??"").trim())},[s.children]),e.jsx(Te.ItemSlot,{scope:r,disabled:n,textValue:a??f,children:e.jsx(Wo,{asChild:!0,...u,focusable:!n,children:e.jsx(H.div,{role:"menuitem","data-highlighted":h?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...s,ref:p,onPointerMove:C(t.onPointerMove,Re(x=>{n?c.onItemLeave(x):(c.onItemEnter(x),x.defaultPrevented||x.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:C(t.onPointerLeave,Re(x=>c.onItemLeave(x))),onFocus:C(t.onFocus,()=>d(!0)),onBlur:C(t.onBlur,()=>d(!1))})})})}),Hn="MenuCheckboxItem",rr=l.forwardRef((t,o)=>{const{checked:r=!1,onCheckedChange:n,...a}=t;return e.jsx(lr,{scope:t.__scopeMenu,checked:r,children:e.jsx(Be,{role:"menuitemcheckbox","aria-checked":Ae(r)?"mixed":r,...a,ref:o,"data-state":mt(r),onSelect:C(a.onSelect,()=>n==null?void 0:n(Ae(r)?!0:!r),{checkForDefaultPrevented:!1})})})});rr.displayName=Hn;var or="MenuRadioGroup",[zn,Gn]=ye(or,{value:void 0,onValueChange:()=>{}}),nr=l.forwardRef((t,o)=>{const{value:r,onValueChange:n,...a}=t,s=at(n);return e.jsx(zn,{scope:t.__scopeMenu,value:r,onValueChange:s,children:e.jsx(ut,{...a,ref:o})})});nr.displayName=or;var ar="MenuRadioItem",sr=l.forwardRef((t,o)=>{const{value:r,...n}=t,a=Gn(ar,t.__scopeMenu),s=r===a.value;return e.jsx(lr,{scope:t.__scopeMenu,checked:s,children:e.jsx(Be,{role:"menuitemradio","aria-checked":s,...n,ref:o,"data-state":mt(s),onSelect:C(n.onSelect,()=>{var c;return(c=a.onValueChange)==null?void 0:c.call(a,r)},{checkForDefaultPrevented:!1})})})});sr.displayName=ar;var pt="MenuItemIndicator",[lr,Wn]=ye(pt,{checked:!1}),ir=l.forwardRef((t,o)=>{const{__scopeMenu:r,forceMount:n,...a}=t,s=Wn(pt,r);return e.jsx($e,{present:n||Ae(s.checked)||s.checked===!0,children:e.jsx(H.span,{...a,ref:o,"data-state":mt(s.checked)})})});ir.displayName=pt;var qn="MenuSeparator",cr=l.forwardRef((t,o)=>{const{__scopeMenu:r,...n}=t;return e.jsx(H.div,{role:"separator","aria-orientation":"horizontal",...n,ref:o})});cr.displayName=qn;var Jn="MenuArrow",dr=l.forwardRef((t,o)=>{const{__scopeMenu:r,...n}=t,a=Ve(r);return e.jsx(At,{...a,...n,ref:o})});dr.displayName=Jn;var Yn="MenuSub",[bl,ur]=ye(Yn),_e="MenuSubTrigger",pr=l.forwardRef((t,o)=>{const r=we(_e,t.__scopeMenu),n=De(_e,t.__scopeMenu),a=ur(_e,t.__scopeMenu),s=ct(_e,t.__scopeMenu),c=l.useRef(null),{pointerGraceTimerRef:u,onPointerGraceIntentChange:i}=s,p={__scopeMenu:t.__scopeMenu},h=l.useCallback(()=>{c.current&&window.clearTimeout(c.current),c.current=null},[]);return l.useEffect(()=>h,[h]),l.useEffect(()=>{const d=u.current;return()=>{window.clearTimeout(d),i(null)}},[u,i]),e.jsx(lt,{asChild:!0,...p,children:e.jsx(tr,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":a.contentId,"data-state":fr(r.open),...t,ref:Lt(o,a.onTriggerChange),onClick:d=>{var f;(f=t.onClick)==null||f.call(t,d),!(t.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:C(t.onPointerMove,Re(d=>{s.onItemEnter(d),!d.defaultPrevented&&!t.disabled&&!r.open&&!c.current&&(s.onPointerGraceIntentChange(null),c.current=window.setTimeout(()=>{r.onOpenChange(!0),h()},100))})),onPointerLeave:C(t.onPointerLeave,Re(d=>{var g,x;h();const f=(g=r.content)==null?void 0:g.getBoundingClientRect();if(f){const m=(x=r.content)==null?void 0:x.dataset.side,b=m==="right",j=b?-5:5,v=f[b?"left":"right"],y=f[b?"right":"left"];s.onPointerGraceIntentChange({area:[{x:d.clientX+j,y:d.clientY},{x:v,y:f.top},{x:y,y:f.top},{x:y,y:f.bottom},{x:v,y:f.bottom}],side:m}),window.clearTimeout(u.current),u.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(d),d.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:C(t.onKeyDown,d=>{var g;const f=s.searchRef.current!=="";t.disabled||f&&d.key===" "||Rn[n.dir].includes(d.key)&&(r.onOpenChange(!0),(g=r.content)==null||g.focus(),d.preventDefault())})})})});pr.displayName=_e;var mr="MenuSubContent",hr=l.forwardRef((t,o)=>{const r=Xt(te,t.__scopeMenu),{forceMount:n=r.forceMount,...a}=t,s=we(te,t.__scopeMenu),c=De(te,t.__scopeMenu),u=ur(mr,t.__scopeMenu),i=l.useRef(null),p=Q(o,i);return e.jsx(Te.Provider,{scope:t.__scopeMenu,children:e.jsx($e,{present:n||s.open,children:e.jsx(Te.Slot,{scope:t.__scopeMenu,children:e.jsx(dt,{id:u.contentId,"aria-labelledby":u.triggerId,...a,ref:p,align:"start",side:c.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:h=>{var d;c.isUsingKeyboardRef.current&&((d=i.current)==null||d.focus()),h.preventDefault()},onCloseAutoFocus:h=>h.preventDefault(),onFocusOutside:C(t.onFocusOutside,h=>{h.target!==u.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:C(t.onEscapeKeyDown,h=>{c.onClose(),h.preventDefault()}),onKeyDown:C(t.onKeyDown,h=>{var g;const d=h.currentTarget.contains(h.target),f=En[c.dir].includes(h.key);d&&f&&(s.onOpenChange(!1),(g=u.trigger)==null||g.focus(),h.preventDefault())})})})})})});hr.displayName=mr;function fr(t){return t?"open":"closed"}function Ae(t){return t==="indeterminate"}function mt(t){return Ae(t)?"indeterminate":t?"checked":"unchecked"}function Xn(t){const o=document.activeElement;for(const r of t)if(r===o||(r.focus(),document.activeElement!==o))return}function Qn(t,o){return t.map((r,n)=>t[(o+n)%t.length])}function Zn(t,o,r){const a=o.length>1&&Array.from(o).every(p=>p===o[0])?o[0]:o,s=r?t.indexOf(r):-1;let c=Qn(t,Math.max(s,0));a.length===1&&(c=c.filter(p=>p!==r));const i=c.find(p=>p.toLowerCase().startsWith(a.toLowerCase()));return i!==r?i:void 0}function ea(t,o){const{x:r,y:n}=t;let a=!1;for(let s=0,c=o.length-1;s<o.length;c=s++){const u=o[s],i=o[c],p=u.x,h=u.y,d=i.x,f=i.y;h>n!=f>n&&r<(d-p)*(n-h)/(f-h)+p&&(a=!a)}return a}function ta(t,o){if(!o)return!1;const r={x:t.clientX,y:t.clientY};return ea(r,o)}function Re(t){return o=>o.pointerType==="mouse"?t(o):void 0}var ra=Yt,oa=lt,na=Qt,aa=Zt,sa=ut,la=er,ia=Be,ca=rr,da=nr,ua=sr,pa=ir,ma=cr,ha=dr,fa=pr,ga=hr,Ke="DropdownMenu",[xa,yl]=nt(Ke,[qt]),Z=qt(),[va,gr]=xa(Ke),xr=t=>{const{__scopeDropdownMenu:o,children:r,dir:n,open:a,defaultOpen:s,onOpenChange:c,modal:u=!0}=t,i=Z(o),p=l.useRef(null),[h,d]=Xe({prop:a,defaultProp:s??!1,onChange:c,caller:Ke});return e.jsx(va,{scope:o,triggerId:Pe(),triggerRef:p,contentId:Pe(),open:h,onOpenChange:d,onOpenToggle:l.useCallback(()=>d(f=>!f),[d]),modal:u,children:e.jsx(ra,{...i,open:h,onOpenChange:d,dir:n,modal:u,children:r})})};xr.displayName=Ke;var vr="DropdownMenuTrigger",br=l.forwardRef((t,o)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...a}=t,s=gr(vr,r),c=Z(r);return e.jsx(oa,{asChild:!0,...c,children:e.jsx(H.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...a,ref:Lt(o,s.triggerRef),onPointerDown:C(t.onPointerDown,u=>{!n&&u.button===0&&u.ctrlKey===!1&&(s.onOpenToggle(),s.open||u.preventDefault())}),onKeyDown:C(t.onKeyDown,u=>{n||(["Enter"," "].includes(u.key)&&s.onOpenToggle(),u.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(u.key)&&u.preventDefault())})})})});br.displayName=vr;var ba="DropdownMenuPortal",yr=t=>{const{__scopeDropdownMenu:o,...r}=t,n=Z(o);return e.jsx(na,{...n,...r})};yr.displayName=ba;var wr="DropdownMenuContent",Sr=l.forwardRef((t,o)=>{const{__scopeDropdownMenu:r,...n}=t,a=gr(wr,r),s=Z(r),c=l.useRef(!1);return e.jsx(aa,{id:a.contentId,"aria-labelledby":a.triggerId,...s,...n,ref:o,onCloseAutoFocus:C(t.onCloseAutoFocus,u=>{var i;c.current||(i=a.triggerRef.current)==null||i.focus(),c.current=!1,u.preventDefault()}),onInteractOutside:C(t.onInteractOutside,u=>{const i=u.detail.originalEvent,p=i.button===0&&i.ctrlKey===!0,h=i.button===2||p;(!a.modal||h)&&(c.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Sr.displayName=wr;var ya="DropdownMenuGroup",wa=l.forwardRef((t,o)=>{const{__scopeDropdownMenu:r,...n}=t,a=Z(r);return e.jsx(sa,{...a,...n,ref:o})});wa.displayName=ya;var Sa="DropdownMenuLabel",ja=l.forwardRef((t,o)=>{const{__scopeDropdownMenu:r,...n}=t,a=Z(r);return e.jsx(la,{...a,...n,ref:o})});ja.displayName=Sa;var Ca="DropdownMenuItem",jr=l.forwardRef((t,o)=>{const{__scopeDropdownMenu:r,...n}=t,a=Z(r);return e.jsx(ia,{...a,...n,ref:o})});jr.displayName=Ca;var Na="DropdownMenuCheckboxItem",_a=l.forwardRef((t,o)=>{const{__scopeDropdownMenu:r,...n}=t,a=Z(r);return e.jsx(ca,{...a,...n,ref:o})});_a.displayName=Na;var Ma="DropdownMenuRadioGroup",Pa=l.forwardRef((t,o)=>{const{__scopeDropdownMenu:r,...n}=t,a=Z(r);return e.jsx(da,{...a,...n,ref:o})});Pa.displayName=Ma;var Ta="DropdownMenuRadioItem",Ra=l.forwardRef((t,o)=>{const{__scopeDropdownMenu:r,...n}=t,a=Z(r);return e.jsx(ua,{...a,...n,ref:o})});Ra.displayName=Ta;var Ea="DropdownMenuItemIndicator",Da=l.forwardRef((t,o)=>{const{__scopeDropdownMenu:r,...n}=t,a=Z(r);return e.jsx(pa,{...a,...n,ref:o})});Da.displayName=Ea;var Ia="DropdownMenuSeparator",Cr=l.forwardRef((t,o)=>{const{__scopeDropdownMenu:r,...n}=t,a=Z(r);return e.jsx(ma,{...a,...n,ref:o})});Cr.displayName=Ia;var ka="DropdownMenuArrow",Oa=l.forwardRef((t,o)=>{const{__scopeDropdownMenu:r,...n}=t,a=Z(r);return e.jsx(ha,{...a,...n,ref:o})});Oa.displayName=ka;var Aa="DropdownMenuSubTrigger",La=l.forwardRef((t,o)=>{const{__scopeDropdownMenu:r,...n}=t,a=Z(r);return e.jsx(fa,{...a,...n,ref:o})});La.displayName=Aa;var Fa="DropdownMenuSubContent",$a=l.forwardRef((t,o)=>{const{__scopeDropdownMenu:r,...n}=t,a=Z(r);return e.jsx(ga,{...a,...n,ref:o,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});$a.displayName=Fa;var Va=xr,Ba=br,Ka=yr,Ua=Sr,Ha=jr,za=Cr;function Ga({...t}){return e.jsx(Va,{"data-slot":"dropdown-menu",...t})}function Wa({...t}){return e.jsx(Ba,{"data-slot":"dropdown-menu-trigger",...t})}function qa({className:t,sideOffset:o=4,...r}){return e.jsx(Ka,{children:e.jsx(Ua,{"data-slot":"dropdown-menu-content",sideOffset:o,className:se("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",t),...r})})}function We({className:t,inset:o,variant:r="default",...n}){return e.jsx(Ha,{"data-slot":"dropdown-menu-item","data-inset":o,"data-variant":r,className:se("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...n})}function Ja({className:t,...o}){return e.jsx(za,{"data-slot":"dropdown-menu-separator",className:se("bg-border -mx-1 my-1 h-px",t),...o})}function Ya({searchQuery:t,onSearchQueryChange:o,onOpenFilterModal:r,selectedCount:n,onDeleteSelected:a,onExportSelected:s,onCopySelected:c,isLoading:u}){const i=()=>{a()},p=()=>{s()},h=()=>{c()};return e.jsx("div",{className:"p-4 space-y-4 border-t border-gray-200/50 bg-gradient-to-r from-gray-50/50 to-blue-50/50 backdrop-blur-sm",children:e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(Gt,{className:"absolute left-2.5 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Ne,{placeholder:"Search log messages (press Enter to apply)...",value:t,onChange:d=>o(d.target.value),className:"h-10 pl-8 pr-4 md:pr-14 bg-white/80 backdrop-blur-sm border-gray-200 focus:border-blue-300 focus:ring-blue-200",disabled:u})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs($,{className:"h-10",onClick:r,variant:"outline",disabled:u,children:[e.jsx(st,{className:"h-4 w-4 mr-2"}),"Filters"]}),n>0&&e.jsxs(Ga,{children:[e.jsx(Wa,{asChild:!0,children:e.jsxs($,{variant:"outline",className:"h-10",children:[e.jsx(ao,{className:"h-4 w-4 mr-2"}),"Actions (",n,")"]})}),e.jsxs(qa,{align:"end",children:[e.jsxs(We,{onClick:h,children:[e.jsx(ke,{className:"mr-2 h-4 w-4"}),"Copy Selected"]}),e.jsxs(We,{onClick:p,children:[e.jsx(Eo,{className:"mr-2 h-4 w-4"}),"Export Selected"]}),e.jsx(Ja,{}),e.jsxs(We,{onClick:i,className:"text-red-600 focus:text-red-700 focus:bg-red-50",children:[e.jsx(so,{className:"mr-2 h-4 w-4"}),"Delete Selected"]})]})]})]})]})})}const Xa=()=>e.jsx(xe,{className:"bg-white/80 backdrop-blur-sm border-gray-200 shadow-lg rounded-xl",children:e.jsx(Se,{className:"flex items-center justify-center min-h-[300px] md:min-h-[400px]",children:e.jsxs("div",{className:"flex flex-col items-center text-center gap-4",children:[e.jsx("div",{className:"p-4 bg-gradient-to-r from-blue-100 to-purple-100 rounded-full",children:e.jsx(bn,{className:"h-8 w-8 animate-spin text-blue-600"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-gray-900 mb-1",children:"Loading logs..."}),e.jsx("p",{className:"text-sm text-gray-600",children:"Please wait while we fetch your data"})]})]})})}),Qa=({onRetry:t})=>e.jsx(xe,{className:"bg-white/80 backdrop-blur-sm border-red-200 shadow-lg rounded-xl",children:e.jsx(Se,{className:"flex items-center justify-center min-h-[300px] md:min-h-[400px]",children:e.jsxs("div",{className:"flex flex-col items-center text-center gap-4",children:[e.jsx("div",{className:"p-4 bg-gradient-to-r from-red-100 to-orange-100 rounded-full",children:e.jsx(Bt,{className:"h-8 w-8 text-red-600"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-gray-900 mb-1",children:"Error loading logs"}),e.jsx("p",{className:"text-sm text-gray-600 mb-4",children:"Something went wrong while fetching your data"}),e.jsxs($,{variant:"outline",size:"sm",onClick:t,className:"bg-white/80 hover:bg-red-50 border-red-200 hover:border-red-300 text-red-700 hover:text-red-800",children:[e.jsx(Yo,{className:"h-4 w-4 mr-2"}),"Try Again"]})]})]})})}),Za=({isFiltered:t,onClearFilters:o})=>e.jsx(xe,{className:"bg-white/80 backdrop-blur-sm border-gray-200 shadow-lg rounded-xl",children:e.jsx(Se,{className:"flex items-center justify-center min-h-[300px] md:min-h-[400px]",children:e.jsxs("div",{className:"flex flex-col items-center text-center gap-4",children:[e.jsx("div",{className:"p-6 bg-gradient-to-r from-gray-100 to-blue-100 rounded-full",children:e.jsx(Gt,{className:"h-12 w-12 text-gray-500"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-xl text-gray-900 mb-2",children:"No logs found"}),e.jsx("p",{className:"text-gray-600 max-w-md mb-4",children:t?"Try adjusting your filters or search criteria to see more results.":"There are no logs recorded for this project yet. Start logging to see data here."}),t&&e.jsxs($,{variant:"outline",size:"sm",onClick:o,className:"bg-white/80 hover:bg-blue-50 border-blue-200 hover:border-blue-300 text-blue-700 hover:text-blue-800",children:[e.jsx(Ft,{className:"h-4 w-4 mr-2"}),"Clear Filters"]})]})]})})});function es({table:t,columns:o,isLoading:r,isError:n,logs:a,selectedLogs:s,isFiltered:c,onRetry:u,onClearFilters:i}){return r?e.jsx(Xa,{}):n?e.jsx(Qa,{onRetry:u}):a.length===0?e.jsx(Za,{isFiltered:c,onClearFilters:i}):e.jsx("div",{className:"rounded-xl border border-gray-200/50 m-0 md:m-4 overflow-hidden bg-white/60 backdrop-blur-sm shadow-lg",children:e.jsxs(Do,{children:[e.jsx(Io,{className:"bg-gradient-to-r from-gray-50/80 to-blue-50/80 backdrop-blur-sm",children:t.getHeaderGroups().map(p=>e.jsx(Ge,{className:"border-b border-gray-200/50",children:p.headers.map(h=>e.jsx(ko,{className:"font-bold whitespace-nowrap text-gray-800 py-5 px-6 bg-gradient-to-r from-gray-50 to-blue-50 border-b-2 border-blue-200",style:{width:h.getSize()!==150?h.getSize():void 0},children:h.isPlaceholder?null:ft(h.column.columnDef.header,h.getContext())},h.id))},p.id))}),e.jsx(Oo,{children:t.getRowModel().rows.length?t.getRowModel().rows.map((p,h)=>e.jsx(Ge,{"data-state":s[p.original.id]?"selected":void 0,className:`
                  ${h%2===0?"bg-white/60":"bg-gray-50/60"} 
                  ${s[p.original.id]?"bg-gradient-to-r from-blue-50/80 to-blue-100/60 border-l-4 border-blue-500 shadow-sm":""}
                  hover:bg-gradient-to-r hover:from-blue-50/70 hover:to-blue-100/50 hover:shadow-md hover:scale-[1.01] transition-all duration-300 border-b border-gray-200/60
                  data-[state=selected]:bg-gradient-to-r data-[state=selected]:from-blue-50/80 data-[state=selected]:to-blue-100/60
                  cursor-pointer
                `,children:p.getVisibleCells().map(d=>e.jsx(gt,{className:"py-5 px-6 text-gray-900",style:{width:d.column.getSize()!==150?d.column.getSize():void 0},children:ft(d.column.columnDef.cell,d.getContext())},d.id))},p.id)):e.jsx(Ge,{children:e.jsx(gt,{colSpan:o.length,className:"h-24 text-center text-gray-600",children:"No results found for the current filter criteria."})})})]})})}var ts=[" ","Enter","ArrowUp","ArrowDown"],rs=[" ","Enter"],ve="Select",[Ue,He,os]=Ut(ve),[je,wl]=nt(ve,[os,Fe]),ze=Fe(),[ns,he]=je(ve),[as,ss]=je(ve),Nr=t=>{const{__scopeSelect:o,children:r,open:n,defaultOpen:a,onOpenChange:s,value:c,defaultValue:u,onValueChange:i,dir:p,name:h,autoComplete:d,disabled:f,required:g,form:x}=t,m=ze(o),[b,j]=l.useState(null),[v,y]=l.useState(null),[N,A]=l.useState(!1),q=zt(p),[_,V]=Xe({prop:n,defaultProp:a??!1,onChange:s,caller:ve}),[P,J]=Xe({prop:c,defaultProp:u,onChange:i,caller:ve}),Y=l.useRef(null),I=b?x||!!b.closest("form"):!0,[B,K]=l.useState(new Set),U=Array.from(B).map(T=>T.props.value).join(";");return e.jsx(_t,{...m,children:e.jsxs(ns,{required:g,scope:o,trigger:b,onTriggerChange:j,valueNode:v,onValueNodeChange:y,valueNodeHasChildren:N,onValueNodeHasChildrenChange:A,contentId:Pe(),value:P,onValueChange:J,open:_,onOpenChange:V,dir:q,triggerPointerDownPosRef:Y,disabled:f,children:[e.jsx(Ue.Provider,{scope:o,children:e.jsx(as,{scope:t.__scopeSelect,onNativeOptionAdd:l.useCallback(T=>{K(F=>new Set(F).add(T))},[]),onNativeOptionRemove:l.useCallback(T=>{K(F=>{const z=new Set(F);return z.delete(T),z})},[]),children:r})}),I?e.jsxs(Wr,{"aria-hidden":!0,required:g,tabIndex:-1,name:h,autoComplete:d,value:P,onChange:T=>J(T.target.value),disabled:f,form:x,children:[P===void 0?e.jsx("option",{value:""}):null,Array.from(B)]},U):null]})})};Nr.displayName=ve;var _r="SelectTrigger",Mr=l.forwardRef((t,o)=>{const{__scopeSelect:r,disabled:n=!1,...a}=t,s=ze(r),c=he(_r,r),u=c.disabled||n,i=Q(o,c.onTriggerChange),p=He(r),h=l.useRef("touch"),[d,f,g]=Jr(m=>{const b=p().filter(y=>!y.disabled),j=b.find(y=>y.value===c.value),v=Yr(b,m,j);v!==void 0&&c.onValueChange(v.value)}),x=m=>{u||(c.onOpenChange(!0),g()),m&&(c.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return e.jsx(Mt,{asChild:!0,...s,children:e.jsx(H.button,{type:"button",role:"combobox","aria-controls":c.contentId,"aria-expanded":c.open,"aria-required":c.required,"aria-autocomplete":"none",dir:c.dir,"data-state":c.open?"open":"closed",disabled:u,"data-disabled":u?"":void 0,"data-placeholder":qr(c.value)?"":void 0,...a,ref:i,onClick:C(a.onClick,m=>{m.currentTarget.focus(),h.current!=="mouse"&&x(m)}),onPointerDown:C(a.onPointerDown,m=>{h.current=m.pointerType;const b=m.target;b.hasPointerCapture(m.pointerId)&&b.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(x(m),m.preventDefault())}),onKeyDown:C(a.onKeyDown,m=>{const b=d.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&f(m.key),!(b&&m.key===" ")&&ts.includes(m.key)&&(x(),m.preventDefault())})})})});Mr.displayName=_r;var Pr="SelectValue",Tr=l.forwardRef((t,o)=>{const{__scopeSelect:r,className:n,style:a,children:s,placeholder:c="",...u}=t,i=he(Pr,r),{onValueNodeHasChildrenChange:p}=i,h=s!==void 0,d=Q(o,i.onValueNodeChange);return pe(()=>{p(h)},[p,h]),e.jsx(H.span,{...u,ref:d,style:{pointerEvents:"none"},children:qr(i.value)?e.jsx(e.Fragment,{children:c}):s})});Tr.displayName=Pr;var ls="SelectIcon",Rr=l.forwardRef((t,o)=>{const{__scopeSelect:r,children:n,...a}=t;return e.jsx(H.span,{"aria-hidden":!0,...a,ref:o,children:n||"▼"})});Rr.displayName=ls;var is="SelectPortal",Er=t=>e.jsx(Pt,{asChild:!0,...t});Er.displayName=is;var be="SelectContent",Dr=l.forwardRef((t,o)=>{const r=he(be,t.__scopeSelect),[n,a]=l.useState();if(pe(()=>{a(new DocumentFragment)},[]),!r.open){const s=n;return s?$t.createPortal(e.jsx(Ir,{scope:t.__scopeSelect,children:e.jsx(Ue.Slot,{scope:t.__scopeSelect,children:e.jsx("div",{children:t.children})})}),s):null}return e.jsx(kr,{...t,ref:o})});Dr.displayName=be;var oe=10,[Ir,fe]=je(be),cs="SelectContentImpl",ds=Dt("SelectContent.RemoveScroll"),kr=l.forwardRef((t,o)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:s,onPointerDownOutside:c,side:u,sideOffset:i,align:p,alignOffset:h,arrowPadding:d,collisionBoundary:f,collisionPadding:g,sticky:x,hideWhenDetached:m,avoidCollisions:b,...j}=t,v=he(be,r),[y,N]=l.useState(null),[A,q]=l.useState(null),_=Q(o,S=>N(S)),[V,P]=l.useState(null),[J,Y]=l.useState(null),I=He(r),[B,K]=l.useState(!1),U=l.useRef(!1);l.useEffect(()=>{if(y)return Tt(y)},[y]),Rt();const T=l.useCallback(S=>{const[R,...O]=I().map(D=>D.ref.current),[M]=O.slice(-1),E=document.activeElement;for(const D of S)if(D===E||(D==null||D.scrollIntoView({block:"nearest"}),D===R&&A&&(A.scrollTop=0),D===M&&A&&(A.scrollTop=A.scrollHeight),D==null||D.focus(),document.activeElement!==E))return},[I,A]),F=l.useCallback(()=>T([V,y]),[T,V,y]);l.useEffect(()=>{B&&F()},[B,F]);const{onOpenChange:z,triggerPointerDownPosRef:w}=v;l.useEffect(()=>{if(y){let S={x:0,y:0};const R=M=>{var E,D;S={x:Math.abs(Math.round(M.pageX)-(((E=w.current)==null?void 0:E.x)??0)),y:Math.abs(Math.round(M.pageY)-(((D=w.current)==null?void 0:D.y)??0))}},O=M=>{S.x<=10&&S.y<=10?M.preventDefault():y.contains(M.target)||z(!1),document.removeEventListener("pointermove",R),w.current=null};return w.current!==null&&(document.addEventListener("pointermove",R),document.addEventListener("pointerup",O,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",R),document.removeEventListener("pointerup",O,{capture:!0})}}},[y,z,w]),l.useEffect(()=>{const S=()=>z(!1);return window.addEventListener("blur",S),window.addEventListener("resize",S),()=>{window.removeEventListener("blur",S),window.removeEventListener("resize",S)}},[z]);const[k,W]=Jr(S=>{const R=I().filter(E=>!E.disabled),O=R.find(E=>E.ref.current===document.activeElement),M=Yr(R,S,O);M&&setTimeout(()=>M.ref.current.focus())}),X=l.useCallback((S,R,O)=>{const M=!U.current&&!O;(v.value!==void 0&&v.value===R||M)&&(P(S),M&&(U.current=!0))},[v.value]),ne=l.useCallback(()=>y==null?void 0:y.focus(),[y]),G=l.useCallback((S,R,O)=>{const M=!U.current&&!O;(v.value!==void 0&&v.value===R||M)&&Y(S)},[v.value]),le=n==="popper"?Ze:Or,ee=le===Ze?{side:u,sideOffset:i,align:p,alignOffset:h,arrowPadding:d,collisionBoundary:f,collisionPadding:g,sticky:x,hideWhenDetached:m,avoidCollisions:b}:{};return e.jsx(Ir,{scope:r,content:y,viewport:A,onViewportChange:q,itemRefCallback:X,selectedItem:V,onItemLeave:ne,itemTextRefCallback:G,focusSelectedItem:F,selectedItemText:J,position:n,isPositioned:B,searchRef:k,children:e.jsx(Et,{as:ds,allowPinchZoom:!0,children:e.jsx(It,{asChild:!0,trapped:v.open,onMountAutoFocus:S=>{S.preventDefault()},onUnmountAutoFocus:C(a,S=>{var R;(R=v.trigger)==null||R.focus({preventScroll:!0}),S.preventDefault()}),children:e.jsx(kt,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:S=>S.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:e.jsx(le,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:S=>S.preventDefault(),...j,...ee,onPlaced:()=>K(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...j.style},onKeyDown:C(j.onKeyDown,S=>{const R=S.ctrlKey||S.altKey||S.metaKey;if(S.key==="Tab"&&S.preventDefault(),!R&&S.key.length===1&&W(S.key),["ArrowUp","ArrowDown","Home","End"].includes(S.key)){let M=I().filter(E=>!E.disabled).map(E=>E.ref.current);if(["ArrowUp","End"].includes(S.key)&&(M=M.slice().reverse()),["ArrowUp","ArrowDown"].includes(S.key)){const E=S.target,D=M.indexOf(E);M=M.slice(D+1)}setTimeout(()=>T(M)),S.preventDefault()}})})})})})})});kr.displayName=cs;var us="SelectItemAlignedPosition",Or=l.forwardRef((t,o)=>{const{__scopeSelect:r,onPlaced:n,...a}=t,s=he(be,r),c=fe(be,r),[u,i]=l.useState(null),[p,h]=l.useState(null),d=Q(o,_=>h(_)),f=He(r),g=l.useRef(!1),x=l.useRef(!0),{viewport:m,selectedItem:b,selectedItemText:j,focusSelectedItem:v}=c,y=l.useCallback(()=>{if(s.trigger&&s.valueNode&&u&&p&&m&&b&&j){const _=s.trigger.getBoundingClientRect(),V=p.getBoundingClientRect(),P=s.valueNode.getBoundingClientRect(),J=j.getBoundingClientRect();if(s.dir!=="rtl"){const E=J.left-V.left,D=P.left-E,ae=_.left-D,ie=_.width+ae,L=Math.max(ie,V.width),de=window.innerWidth-oe,Ce=xt(D,[oe,Math.max(oe,de-L)]);u.style.minWidth=ie+"px",u.style.left=Ce+"px"}else{const E=V.right-J.right,D=window.innerWidth-P.right-E,ae=window.innerWidth-_.right-D,ie=_.width+ae,L=Math.max(ie,V.width),de=window.innerWidth-oe,Ce=xt(D,[oe,Math.max(oe,de-L)]);u.style.minWidth=ie+"px",u.style.right=Ce+"px"}const Y=f(),I=window.innerHeight-oe*2,B=m.scrollHeight,K=window.getComputedStyle(p),U=parseInt(K.borderTopWidth,10),T=parseInt(K.paddingTop,10),F=parseInt(K.borderBottomWidth,10),z=parseInt(K.paddingBottom,10),w=U+T+B+z+F,k=Math.min(b.offsetHeight*5,w),W=window.getComputedStyle(m),X=parseInt(W.paddingTop,10),ne=parseInt(W.paddingBottom,10),G=_.top+_.height/2-oe,le=I-G,ee=b.offsetHeight/2,S=b.offsetTop+ee,R=U+T+S,O=w-R;if(R<=G){const E=Y.length>0&&b===Y[Y.length-1].ref.current;u.style.bottom="0px";const D=p.clientHeight-m.offsetTop-m.offsetHeight,ae=Math.max(le,ee+(E?ne:0)+D+F),ie=R+ae;u.style.height=ie+"px"}else{const E=Y.length>0&&b===Y[0].ref.current;u.style.top="0px";const ae=Math.max(G,U+m.offsetTop+(E?X:0)+ee)+O;u.style.height=ae+"px",m.scrollTop=R-G+m.offsetTop}u.style.margin=`${oe}px 0`,u.style.minHeight=k+"px",u.style.maxHeight=I+"px",n==null||n(),requestAnimationFrame(()=>g.current=!0)}},[f,s.trigger,s.valueNode,u,p,m,b,j,s.dir,n]);pe(()=>y(),[y]);const[N,A]=l.useState();pe(()=>{p&&A(window.getComputedStyle(p).zIndex)},[p]);const q=l.useCallback(_=>{_&&x.current===!0&&(y(),v==null||v(),x.current=!1)},[y,v]);return e.jsx(ms,{scope:r,contentWrapper:u,shouldExpandOnScrollRef:g,onScrollButtonChange:q,children:e.jsx("div",{ref:i,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:N},children:e.jsx(H.div,{...a,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});Or.displayName=us;var ps="SelectPopperPosition",Ze=l.forwardRef((t,o)=>{const{__scopeSelect:r,align:n="start",collisionPadding:a=oe,...s}=t,c=ze(r);return e.jsx(Ot,{...c,...s,ref:o,align:n,collisionPadding:a,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Ze.displayName=ps;var[ms,ht]=je(be,{}),et="SelectViewport",Ar=l.forwardRef((t,o)=>{const{__scopeSelect:r,nonce:n,...a}=t,s=fe(et,r),c=ht(et,r),u=Q(o,s.onViewportChange),i=l.useRef(0);return e.jsxs(e.Fragment,{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),e.jsx(Ue.Slot,{scope:r,children:e.jsx(H.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:C(a.onScroll,p=>{const h=p.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:f}=c;if(f!=null&&f.current&&d){const g=Math.abs(i.current-h.scrollTop);if(g>0){const x=window.innerHeight-oe*2,m=parseFloat(d.style.minHeight),b=parseFloat(d.style.height),j=Math.max(m,b);if(j<x){const v=j+g,y=Math.min(x,v),N=v-y;d.style.height=y+"px",d.style.bottom==="0px"&&(h.scrollTop=N>0?N:0,d.style.justifyContent="flex-end")}}}i.current=h.scrollTop})})})]})});Ar.displayName=et;var Lr="SelectGroup",[hs,fs]=je(Lr),gs=l.forwardRef((t,o)=>{const{__scopeSelect:r,...n}=t,a=Pe();return e.jsx(hs,{scope:r,id:a,children:e.jsx(H.div,{role:"group","aria-labelledby":a,...n,ref:o})})});gs.displayName=Lr;var Fr="SelectLabel",xs=l.forwardRef((t,o)=>{const{__scopeSelect:r,...n}=t,a=fs(Fr,r);return e.jsx(H.div,{id:a.id,...n,ref:o})});xs.displayName=Fr;var Le="SelectItem",[vs,$r]=je(Le),Vr=l.forwardRef((t,o)=>{const{__scopeSelect:r,value:n,disabled:a=!1,textValue:s,...c}=t,u=he(Le,r),i=fe(Le,r),p=u.value===n,[h,d]=l.useState(s??""),[f,g]=l.useState(!1),x=Q(o,v=>{var y;return(y=i.itemRefCallback)==null?void 0:y.call(i,v,n,a)}),m=Pe(),b=l.useRef("touch"),j=()=>{a||(u.onValueChange(n),u.onOpenChange(!1))};if(n==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return e.jsx(vs,{scope:r,value:n,disabled:a,textId:m,isSelected:p,onItemTextChange:l.useCallback(v=>{d(y=>y||((v==null?void 0:v.textContent)??"").trim())},[]),children:e.jsx(Ue.ItemSlot,{scope:r,value:n,disabled:a,textValue:h,children:e.jsx(H.div,{role:"option","aria-labelledby":m,"data-highlighted":f?"":void 0,"aria-selected":p&&f,"data-state":p?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...c,ref:x,onFocus:C(c.onFocus,()=>g(!0)),onBlur:C(c.onBlur,()=>g(!1)),onClick:C(c.onClick,()=>{b.current!=="mouse"&&j()}),onPointerUp:C(c.onPointerUp,()=>{b.current==="mouse"&&j()}),onPointerDown:C(c.onPointerDown,v=>{b.current=v.pointerType}),onPointerMove:C(c.onPointerMove,v=>{var y;b.current=v.pointerType,a?(y=i.onItemLeave)==null||y.call(i):b.current==="mouse"&&v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:C(c.onPointerLeave,v=>{var y;v.currentTarget===document.activeElement&&((y=i.onItemLeave)==null||y.call(i))}),onKeyDown:C(c.onKeyDown,v=>{var N;((N=i.searchRef)==null?void 0:N.current)!==""&&v.key===" "||(rs.includes(v.key)&&j(),v.key===" "&&v.preventDefault())})})})})});Vr.displayName=Le;var Me="SelectItemText",Br=l.forwardRef((t,o)=>{const{__scopeSelect:r,className:n,style:a,...s}=t,c=he(Me,r),u=fe(Me,r),i=$r(Me,r),p=ss(Me,r),[h,d]=l.useState(null),f=Q(o,j=>d(j),i.onItemTextChange,j=>{var v;return(v=u.itemTextRefCallback)==null?void 0:v.call(u,j,i.value,i.disabled)}),g=h==null?void 0:h.textContent,x=l.useMemo(()=>e.jsx("option",{value:i.value,disabled:i.disabled,children:g},i.value),[i.disabled,i.value,g]),{onNativeOptionAdd:m,onNativeOptionRemove:b}=p;return pe(()=>(m(x),()=>b(x)),[m,b,x]),e.jsxs(e.Fragment,{children:[e.jsx(H.span,{id:i.textId,...s,ref:f}),i.isSelected&&c.valueNode&&!c.valueNodeHasChildren?$t.createPortal(s.children,c.valueNode):null]})});Br.displayName=Me;var Kr="SelectItemIndicator",Ur=l.forwardRef((t,o)=>{const{__scopeSelect:r,...n}=t;return $r(Kr,r).isSelected?e.jsx(H.span,{"aria-hidden":!0,...n,ref:o}):null});Ur.displayName=Kr;var tt="SelectScrollUpButton",Hr=l.forwardRef((t,o)=>{const r=fe(tt,t.__scopeSelect),n=ht(tt,t.__scopeSelect),[a,s]=l.useState(!1),c=Q(o,n.onScrollButtonChange);return pe(()=>{if(r.viewport&&r.isPositioned){let u=function(){const p=i.scrollTop>0;s(p)};const i=r.viewport;return u(),i.addEventListener("scroll",u),()=>i.removeEventListener("scroll",u)}},[r.viewport,r.isPositioned]),a?e.jsx(Gr,{...t,ref:c,onAutoScroll:()=>{const{viewport:u,selectedItem:i}=r;u&&i&&(u.scrollTop=u.scrollTop-i.offsetHeight)}}):null});Hr.displayName=tt;var rt="SelectScrollDownButton",zr=l.forwardRef((t,o)=>{const r=fe(rt,t.__scopeSelect),n=ht(rt,t.__scopeSelect),[a,s]=l.useState(!1),c=Q(o,n.onScrollButtonChange);return pe(()=>{if(r.viewport&&r.isPositioned){let u=function(){const p=i.scrollHeight-i.clientHeight,h=Math.ceil(i.scrollTop)<p;s(h)};const i=r.viewport;return u(),i.addEventListener("scroll",u),()=>i.removeEventListener("scroll",u)}},[r.viewport,r.isPositioned]),a?e.jsx(Gr,{...t,ref:c,onAutoScroll:()=>{const{viewport:u,selectedItem:i}=r;u&&i&&(u.scrollTop=u.scrollTop+i.offsetHeight)}}):null});zr.displayName=rt;var Gr=l.forwardRef((t,o)=>{const{__scopeSelect:r,onAutoScroll:n,...a}=t,s=fe("SelectScrollButton",r),c=l.useRef(null),u=He(r),i=l.useCallback(()=>{c.current!==null&&(window.clearInterval(c.current),c.current=null)},[]);return l.useEffect(()=>()=>i(),[i]),pe(()=>{var h;const p=u().find(d=>d.ref.current===document.activeElement);(h=p==null?void 0:p.ref.current)==null||h.scrollIntoView({block:"nearest"})},[u]),e.jsx(H.div,{"aria-hidden":!0,...a,ref:o,style:{flexShrink:0,...a.style},onPointerDown:C(a.onPointerDown,()=>{c.current===null&&(c.current=window.setInterval(n,50))}),onPointerMove:C(a.onPointerMove,()=>{var p;(p=s.onItemLeave)==null||p.call(s),c.current===null&&(c.current=window.setInterval(n,50))}),onPointerLeave:C(a.onPointerLeave,()=>{i()})})}),bs="SelectSeparator",ys=l.forwardRef((t,o)=>{const{__scopeSelect:r,...n}=t;return e.jsx(H.div,{"aria-hidden":!0,...n,ref:o})});ys.displayName=bs;var ot="SelectArrow",ws=l.forwardRef((t,o)=>{const{__scopeSelect:r,...n}=t,a=ze(r),s=he(ot,r),c=fe(ot,r);return s.open&&c.position==="popper"?e.jsx(At,{...a,...n,ref:o}):null});ws.displayName=ot;var Ss="SelectBubbleInput",Wr=l.forwardRef(({__scopeSelect:t,value:o,...r},n)=>{const a=l.useRef(null),s=Q(n,a),c=Xo(o);return l.useEffect(()=>{const u=a.current;if(!u)return;const i=window.HTMLSelectElement.prototype,h=Object.getOwnPropertyDescriptor(i,"value").set;if(c!==o&&h){const d=new Event("change",{bubbles:!0});h.call(u,o),u.dispatchEvent(d)}},[c,o]),e.jsx(H.select,{...r,style:{...lo,...r.style},ref:s,defaultValue:o})});Wr.displayName=Ss;function qr(t){return t===""||t===void 0}function Jr(t){const o=at(t),r=l.useRef(""),n=l.useRef(0),a=l.useCallback(c=>{const u=r.current+c;o(u),function i(p){r.current=p,window.clearTimeout(n.current),p!==""&&(n.current=window.setTimeout(()=>i(""),1e3))}(u)},[o]),s=l.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return l.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,a,s]}function Yr(t,o,r){const a=o.length>1&&Array.from(o).every(p=>p===o[0])?o[0]:o,s=r?t.indexOf(r):-1;let c=js(t,Math.max(s,0));a.length===1&&(c=c.filter(p=>p!==r));const i=c.find(p=>p.textValue.toLowerCase().startsWith(a.toLowerCase()));return i!==r?i:void 0}function js(t,o){return t.map((r,n)=>t[(o+n)%t.length])}var Cs=Nr,Ns=Mr,_s=Tr,Ms=Rr,Ps=Er,Ts=Dr,Rs=Ar,Es=Vr,Ds=Br,Is=Ur,ks=Hr,Os=zr;function As({...t}){return e.jsx(Cs,{"data-slot":"select",...t})}function Ls({...t}){return e.jsx(_s,{"data-slot":"select-value",...t})}function Fs({className:t,size:o="default",children:r,...n}){return e.jsxs(Ns,{"data-slot":"select-trigger","data-size":o,className:se("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...n,children:[r,e.jsx(Ms,{asChild:!0,children:e.jsx(Vt,{className:"size-4 opacity-50"})})]})}function $s({className:t,children:o,position:r="popper",...n}){return e.jsx(Ps,{children:e.jsxs(Ts,{"data-slot":"select-content",className:se("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:r,...n,children:[e.jsx(Bs,{}),e.jsx(Rs,{className:se("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:o}),e.jsx(Ks,{})]})})}function Vs({className:t,children:o,...r}){return e.jsxs(Es,{"data-slot":"select-item",className:se("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...r,children:[e.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:e.jsx(Is,{children:e.jsx(Jo,{className:"size-4"})})}),e.jsx(Ds,{children:o})]})}function Bs({className:t,...o}){return e.jsx(ks,{"data-slot":"select-scroll-up-button",className:se("flex cursor-default items-center justify-center py-1",t),...o,children:e.jsx(un,{className:"size-4"})})}function Ks({className:t,...o}){return e.jsx(Os,{"data-slot":"select-scroll-down-button",className:se("flex cursor-default items-center justify-center py-1",t),...o,children:e.jsx(Vt,{className:"size-4"})})}const Us=[10,20,50,100];function Hs({currentPage:t,hasNextPage:o,onPrevPage:r,onNextPage:n,isLoading:a,currentLogCount:s,pageSize:c=20,onPageSizeChange:u,totalPages:i,onGoToFirstPage:p,onGoToLastPage:h}){const d=p&&h,f=u;return e.jsxs(Go,{className:"border-t border-gray-200/50 bg-gradient-to-r from-gray-50/50 to-blue-50/50 backdrop-blur-sm p-6 flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-3 order-2 lg:order-1",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:s>0?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{children:["Page ",t+1]}),i&&e.jsxs("span",{className:"text-muted-foreground/60",children:["of ",i]}),o&&!i&&e.jsx(ce,{variant:"secondary",className:"text-xs",children:"More available"})]}):e.jsx(e.Fragment,{children:!a&&e.jsx(e.Fragment,{children:"No logs to display"})})}),f&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Rows per page:"}),e.jsxs(As,{value:c.toString(),onValueChange:g=>u(parseInt(g)),disabled:a,children:[e.jsx(Fs,{className:"h-8 w-16",children:e.jsx(Ls,{})}),e.jsx($s,{children:Us.map(g=>e.jsx(Vs,{value:g.toString(),children:g},g))})]})]}),e.jsxs("div",{className:"text-sm text-gray-600 font-medium",children:["Showing ",s," ",s===1?"log":"logs"]})]}),e.jsxs("div",{className:"flex items-center justify-center sm:justify-end gap-1 order-1 lg:order-2",children:[d&&e.jsx($,{variant:"outline",size:"sm",onClick:p,disabled:t===0||a,className:"h-9 w-9 p-0 bg-white/80 hover:bg-blue-50 border-gray-200 hover:border-blue-300 disabled:opacity-50 disabled:cursor-not-allowed transition-all duration-200",title:"Go to first page",children:e.jsx(mn,{className:"h-4 w-4"})}),e.jsxs($,{variant:"outline",size:"sm",onClick:r,disabled:t===0||a,className:"h-9 px-3 bg-white/80 hover:bg-blue-50 border-gray-200 hover:border-blue-300 disabled:opacity-50 disabled:cursor-not-allowed transition-all duration-200",children:[e.jsx(Ao,{className:"h-4 w-4 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"Previous"}),e.jsx("span",{className:"sm:hidden",children:"Prev"})]}),e.jsx("div",{className:"flex items-center justify-center min-w-[60px] h-9 px-3 text-sm font-semibold bg-gradient-to-r from-blue-50 to-purple-50 border border-blue-200 rounded-md text-blue-700",children:t+1}),e.jsxs($,{variant:"outline",size:"sm",onClick:n,disabled:!o||a,className:"h-9 px-3 bg-white/80 hover:bg-blue-50 border-gray-200 hover:border-blue-300 disabled:opacity-50 disabled:cursor-not-allowed transition-all duration-200",children:[e.jsx("span",{className:"hidden sm:inline",children:"Next"}),e.jsx("span",{className:"sm:hidden",children:"Next"}),e.jsx(Kt,{className:"h-4 w-4 ml-1"})]}),d&&i&&e.jsx($,{variant:"outline",size:"sm",onClick:h,disabled:!o||a,className:"h-9 w-9 p-0 bg-white/80 hover:bg-blue-50 border-gray-200 hover:border-blue-300 disabled:opacity-50 disabled:cursor-not-allowed transition-all duration-200",title:"Go to last page",children:e.jsx(fn,{className:"h-4 w-4"})})]})]})}const zs=["error","warn","info","debug","trace"];function Gs({open:t,onOpenChange:o,filters:r,onApply:n,onReset:a,projectId:s}){const[c,u]=l.useState(r),[i,p]=l.useState(""),[h,d]=l.useState("");io.useEffect(()=>{u(r)},[r,t]);const f=(m,b)=>{u(j=>({...j,levels:b?[...j.levels,m]:j.levels.filter(v=>v!==m)}))},g=()=>{i&&h&&(u(m=>({...m,metadata:[...m.metadata,{key:i,value:h}]})),p(""),d(""))},x=m=>{u(b=>({...b,metadata:b.metadata.filter((j,v)=>v!==m)}))};return e.jsx(Qo,{open:t,onOpenChange:o,children:e.jsxs(Zo,{className:"max-w-lg",children:[e.jsx(en,{children:e.jsxs(tn,{className:"flex items-center gap-2",children:[e.jsx(st,{className:"h-5 w-5"}),"Filter Logs"]})}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx(Ie,{className:"mb-2 block",children:"Log Levels"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:zs.map(m=>e.jsx($,{variant:c.levels.includes(m)?"default":"outline",size:"sm",className:"capitalize",onClick:()=>f(m,!c.levels.includes(m)),children:m},m))})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx(Ie,{htmlFor:"from-date",children:"From"}),e.jsx(Ne,{id:"from-date",type:"date",value:c.fromDate,onChange:m=>u(b=>({...b,fromDate:m.target.value}))})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx(Ie,{htmlFor:"to-date",children:"To"}),e.jsx(Ne,{id:"to-date",type:"date",value:c.toDate,onChange:m=>u(b=>({...b,toDate:m.target.value}))})]})]}),e.jsxs("div",{children:[e.jsx(Ie,{className:"mb-2 block",children:"Metadata Filters"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(Ne,{placeholder:"Key",value:i,onChange:m=>p(m.target.value),className:"flex-1"}),e.jsx(Ne,{placeholder:"Value",value:h,onChange:m=>d(m.target.value),className:"flex-1"}),e.jsx($,{onClick:g,disabled:!i||!h,children:"Add"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:c.metadata.map((m,b)=>e.jsxs(ce,{variant:"secondary",className:"pl-2 flex items-center gap-1",children:[e.jsxs("span",{className:"font-semibold",children:[m.key,":"]})," ",m.value,e.jsx($,{variant:"ghost",size:"sm",onClick:()=>x(b),className:"h-4 w-4 p-0 ml-1 text-muted-foreground hover:text-foreground",children:e.jsx(Ft,{className:"h-3 w-3"})})]},b))})]})]}),e.jsxs(rn,{className:"mt-6 flex gap-2",children:[e.jsx($,{variant:"outline",onClick:a,children:"Reset"}),e.jsx($,{onClick:()=>n(c),variant:"default",children:"Apply"})]})]})})}var qe={exports:{}},Je,wt;function Ws(){if(wt)return Je;wt=1;var t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Je=t,Je}var Ye,St;function qs(){if(St)return Ye;St=1;var t=Ws();function o(){}function r(){}return r.resetWarningCache=o,Ye=function(){function n(c,u,i,p,h,d){if(d!==t){var f=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw f.name="Invariant Violation",f}}n.isRequired=n;function a(){return n}var s={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:a,element:n,elementType:n,instanceOf:a,node:n,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:r,resetWarningCache:o};return s.PropTypes=s,s},Ye}var jt;function Js(){return jt||(jt=1,qe.exports=qs()()),qe.exports}var re,Ct;function Ys(){if(Ct)return re;Ct=1;var t=re&&re.__extends||function(){var d=function(f,g){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(x,m){x.__proto__=m}||function(x,m){for(var b in m)m.hasOwnProperty(b)&&(x[b]=m[b])},d(f,g)};return function(f,g){d(f,g);function x(){this.constructor=f}f.prototype=g===null?Object.create(g):(x.prototype=g.prototype,new x)}}(),o=re&&re.__assign||function(){return o=Object.assign||function(d){for(var f,g=1,x=arguments.length;g<x;g++){f=arguments[g];for(var m in f)Object.prototype.hasOwnProperty.call(f,m)&&(d[m]=f[m])}return d},o.apply(this,arguments)},r=re&&re.__rest||function(d,f){var g={};for(var x in d)Object.prototype.hasOwnProperty.call(d,x)&&f.indexOf(x)<0&&(g[x]=d[x]);if(d!=null&&typeof Object.getOwnPropertySymbols=="function")for(var m=0,x=Object.getOwnPropertySymbols(d);m<x.length;m++)f.indexOf(x[m])<0&&(g[x[m]]=d[x[m]]);return g},n=re&&re.__importStar||function(d){if(d&&d.__esModule)return d;var f={};if(d!=null)for(var g in d)Object.hasOwnProperty.call(d,g)&&(f[g]=d[g]);return f.default=d,f},a=n(Js()),s=n(co());function c(d,f,g){var x=g[d+"Style"]||"",m=f&&f[d]||"";return x?x+";"+m:m}function u(d,f,g){var x=c(d,f,g);return x?' style="'+x+'"':""}var i={'"':"&quot;","'":"&apos;","&":"&amp;",">":"&gt;","<":"&lt"};function p(d){return d&&d.replace(/<|>|&|"|'/g,function(f){return i[f]})}var h=function(d){t(f,d);function f(){return d!==null&&d.apply(this,arguments)||this}return f.prototype.render=function(){var g=this.props,x=g.json,m=g.data,b=g.replacer,j=g.space,v=g.themeClassName,y=g.theme,N=g.onJSONPrettyError,A=g.onError,q=g.silent,_=g.mainStyle,V=g.keyStyle,P=g.valueStyle,J=g.stringStyle,Y=g.booleanStyle,I=g.errorStyle,B=r(g,["json","data","replacer","space","themeClassName","theme","onJSONPrettyError","onError","silent","mainStyle","keyStyle","valueStyle","stringStyle","booleanStyle","errorStyle"]),K={mainStyle:_,keyStyle:V,valueStyle:P,stringStyle:J,booleanStyle:Y,errorStyle:I},U=m||x;if(typeof U=="string")try{U=JSON.parse(U)}catch(T){return q||console.warn("[react-json-pretty]: "+T.message),N&&N(T),!N&&A&&(A(T),console.warn("JSONPretty#onError is deprecated, please use JSONPretty#onJSONPrettyError instead")),s.createElement("div",o({},B,{dangerouslySetInnerHTML:{__html:'<pre class="__json-pretty-error__"'+u("error",y,K)+">"+p(U)+"</pre>"}}))}return s.createElement("div",o({},B,{dangerouslySetInnerHTML:{__html:'<pre class="'+v+'"'+u("main",y,K)+">"+this._pretty(y,U,b,+j,K)+"</pre>"}}))},f.prototype._pretty=function(g,x,m,b,j){var v=/^( *)("[^"]+": )?("[^"]*"|[\w.+-]*)?([,[{]|\[\s*\],?|\{\s*\},?)?$/mg,y=JSON.stringify(x,typeof m=="function"?m:null,isNaN(b)?2:b);return y&&y.replace(/&/g,"&amp;").replace(/\\"([^,])/g,"\\&quot;$1").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(v,this._replace.bind(null,g,j))},f.prototype._replace=function(g,x,m,b,j,v,y){var N="</span>",A='<span class="__json-key__"'+u("key",g,x)+">",q='<span class="__json-value__"'+u("value",g,x)+">",_='<span class="__json-string__"'+u("string",g,x)+">",V='<span class="__json-boolean__"'+u("boolean",g,x)+">",P=b||"";return j&&(P=P+'"'+A+j.replace(/^"|":\s$/g,"")+N+'": '),v&&(v==="true"||v==="false"?P=P+V+v+N:P=P+(v[0]==='"'?_:q)+v+N),P+(y||"")},f.propTypes={data:a.any,json:a.any,replacer:a.func,silent:a.bool,space:a.oneOfType([a.number,a.string]),theme:a.object,themeClassName:a.string,onJSONPrettyError:a.func},f.defaultProps={data:"",json:"",silent:!0,space:2,themeClassName:"__json-pretty__"},f}(s.Component);return re=h,re}var Xs=Ys();const Qs=uo(Xs),Zs=t=>{try{const o=JSON.parse(t);if(o&&typeof o=="object")return o}catch{}return!1};function el({open:t,onOpenChange:o,log:r}){if(!r)return null;const n=i=>{switch(i.toLowerCase()){case"error":return"bg-gradient-to-r from-red-500 to-red-600 hover:from-red-600 hover:to-red-700 text-white shadow-sm";case"warn":return"bg-gradient-to-r from-amber-500 to-orange-500 hover:from-amber-600 hover:to-orange-600 text-white shadow-sm";case"info":return"bg-gradient-to-r from-blue-500 to-blue-600 hover:from-blue-600 hover:to-blue-700 text-white shadow-sm";case"debug":return"bg-gradient-to-r from-green-500 to-emerald-500 hover:from-green-600 hover:to-emerald-600 text-white shadow-sm";case"trace":return"bg-gradient-to-r from-gray-500 to-slate-500 hover:from-gray-600 hover:to-slate-600 text-white shadow-sm";default:return"bg-gradient-to-r from-gray-500 to-slate-500 hover:from-gray-600 hover:to-slate-600 text-white shadow-sm"}},a=()=>{const i=`[${new Date(r.timestamp).toLocaleString()}] [${r.level.toUpperCase()}] ${r.message}`;navigator.clipboard.writeText(i).then(()=>ue.success("Log copied to clipboard")).catch(()=>ue.error("Failed to copy to clipboard"))},s=()=>{if(!r.metadata||r.metadata.length===0)return;const i=r.metadata.map(p=>`${p.key}: ${p.value}`).join("\\n");navigator.clipboard.writeText(i).then(()=>ue.success("Metadata copied to clipboard")).catch(()=>ue.error("Failed to copy to clipboard"))},c=i=>typeof i=="string"&&i.includes("\\n")&&(i.includes("at ")||i.includes("Error:"))&&(i.includes(".js:")||i.includes(".ts:")),u=(i,p)=>c(p)||typeof p=="string"&&p.length<100||i.toLowerCase().includes("message");return e.jsx(po,{open:t,onOpenChange:o,children:e.jsxs(mo,{className:"w-full sm:max-w-xl md:max-w-2xl lg:max-w-3xl xl:max-w-4xl p-0 flex flex-col h-full max-h-screen bg-gradient-to-br from-white/95 to-blue-50/90 backdrop-blur-md border-l border-gray-200/60",children:[e.jsxs(ho,{className:"px-6 py-5 border-b border-gray-200/60 bg-gradient-to-r from-gray-50/80 to-blue-50/80 backdrop-blur-sm",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ce,{className:`${n(r.level)} px-3 py-1.5 rounded-full font-semibold transition-all duration-200`,children:r.level.toUpperCase()}),e.jsx(fo,{className:"text-gray-900 font-bold",children:"Log Details"})]}),e.jsx(go,{className:"text-gray-700 font-medium",children:new Date(r.timestamp).toLocaleString()})]}),e.jsx(Lo,{className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"text-sm font-bold text-gray-900",children:"Message"}),e.jsxs($,{variant:"ghost",size:"sm",onClick:a,className:"h-8 px-3 hover:bg-blue-50 hover:border-blue-200 border border-transparent transition-all duration-200 rounded-lg",children:[e.jsx(ke,{className:"h-3.5 w-3.5 mr-1.5 text-gray-600"}),e.jsx("span",{className:"text-xs font-medium",children:"Copy"})]})]}),e.jsx("div",{className:"bg-gradient-to-r from-gray-50 to-blue-50 border border-gray-200 p-5 rounded-xl font-mono text-sm whitespace-pre-wrap overflow-x-auto shadow-sm text-gray-800 leading-relaxed",children:r.message})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-sm font-bold text-gray-900",children:"Metadata"}),r.metadata&&r.metadata.length>0&&e.jsxs($,{variant:"ghost",size:"sm",onClick:s,className:"h-8 px-3 hover:bg-blue-50 hover:border-blue-200 border border-transparent transition-all duration-200 rounded-lg",children:[e.jsx(ke,{className:"h-3.5 w-3.5 mr-1.5 text-gray-600"}),e.jsx("span",{className:"text-xs font-medium",children:"Copy All"})]})]}),r.metadata&&r.metadata.length>0?e.jsx("div",{className:"space-y-3",children:r.metadata.map((i,p)=>{const h=typeof i.value=="string"?Zs(i.value):!1,d=typeof i.value=="string"?c(i.value):!1;return e.jsxs(xo,{defaultOpen:typeof i.value=="string"?u(i.key,i.value):!0,className:"border border-gray-200 rounded-xl overflow-hidden shadow-sm bg-white/60 backdrop-blur-sm",children:[e.jsxs(vo,{className:"flex w-full items-center justify-between p-4 hover:bg-gradient-to-r hover:from-blue-50/70 hover:to-blue-100/50 cursor-pointer transition-all duration-200",children:[e.jsx("div",{className:"font-semibold text-sm text-blue-700",children:i.key}),!(h&&Object.keys(h).length<5)&&e.jsx(wn,{className:"h-4 w-4 text-gray-500"})]}),e.jsxs(bo,{children:[e.jsx(yo,{}),e.jsxs("div",{className:se("p-4 font-mono text-sm whitespace-pre-wrap break-words overflow-x-auto text-gray-800 leading-relaxed",d?"bg-gradient-to-r from-red-50 to-orange-50":"bg-gradient-to-r from-gray-50 to-blue-50",h?"json-pretty-container":""),children:[h?e.jsx(Qs,{data:h,themeClassName:"__json-pretty__"}):i.value,d&&e.jsxs($,{variant:"outline",size:"sm",className:"mt-4 hover:bg-blue-50 hover:border-blue-300 transition-all duration-200",onClick:()=>{const f=window.open("","_blank");f&&f.document.write(`
                                      <html>
                                        <head>
                                          <title>Stack Trace: ${i.key}</title>
                                          <style>
                                            body { font-family: monospace; white-space: pre-wrap; line-height: 1.5; padding: 20px; }
                                          </style>
                                        </head>
                                        <body>${i.value}</body>
                                      </html>
                                    `)},children:[e.jsx(xn,{className:"h-3.5 w-3.5 mr-1.5"}),"View in Separate Window"]})]})]})]},`${i.key}-${p}`)})}):e.jsx("div",{className:"text-gray-500 text-sm italic bg-gray-50 p-4 rounded-xl border border-gray-200",children:"No metadata available"})]})]})}),e.jsxs(wo,{className:"p-5 border-t border-gray-200/60 bg-gradient-to-r from-gray-50/80 to-blue-50/80 backdrop-blur-sm",children:[e.jsxs($,{variant:"outline",onClick:a,className:"mr-auto hover:bg-blue-50 hover:border-blue-300 transition-all duration-200",children:[e.jsx(ke,{className:"h-4 w-4 mr-2"}),"Copy Log"]}),e.jsx($,{onClick:()=>o(!1),className:"bg-gradient-to-r from-blue-500 to-blue-600 hover:from-blue-600 hover:to-blue-700 text-white shadow-sm transition-all duration-200",children:"Close"})]})]})})}function tl(t){const[o,r]=l.useState(void 0),[n,a]=l.useState([]),[s,c]=l.useState(0),u=l.useCallback(h=>{h&&(a(d=>{const f=[...d.slice(0,s+1)];return o?f.push(o):s===0&&d.length===0&&f.push({id:"initial",timestamp:new Date().toISOString()}),f}),r(h),c(d=>d+1))},[s,o]),i=l.useCallback(()=>{if(s>0){const h=s>1?n[s-1]:void 0;r(h),c(d=>d-1),a(d=>d.slice(0,s))}},[s,n]),p=l.useCallback(()=>{r(void 0),a([]),c(0)},[]);return{cursor:o,currentPage:s,paginationHistory:n,handleNextPage:u,handlePrevPage:i,resetPagination:p,setCurrentPage:c,setCursor:r}}const rl=t=>{switch(t.toLowerCase()){case"error":return"bg-gradient-to-r from-red-500 to-red-600 hover:from-red-600 hover:to-red-700 text-white shadow-sm";case"warn":return"bg-gradient-to-r from-amber-500 to-orange-500 hover:from-amber-600 hover:to-orange-600 text-white shadow-sm";case"info":return"bg-gradient-to-r from-blue-500 to-blue-600 hover:from-blue-600 hover:to-blue-700 text-white shadow-sm";case"debug":return"bg-gradient-to-r from-green-500 to-emerald-500 hover:from-green-600 hover:to-emerald-600 text-white shadow-sm";case"trace":return"bg-gradient-to-r from-gray-500 to-slate-500 hover:from-gray-600 hover:to-slate-600 text-white shadow-sm";default:return"bg-gradient-to-r from-gray-500 to-slate-500 hover:from-gray-600 hover:to-slate-600 text-white shadow-sm"}},ol=({selectedLogs:t,onSelectAll:o,onSelectRow:r,onOpenDetailSheet:n,currentLogs:a})=>[{id:"select",header:()=>e.jsx(vt,{checked:a&&a.length>0&&a.every(s=>t[s.id]),onCheckedChange:s=>o(!!s),"aria-label":"Select all rows on current page"}),cell:({row:s})=>e.jsx(vt,{checked:!!t[s.original.id],onCheckedChange:c=>r(s.original.id,!!c),"aria-label":"Select row"}),enableSorting:!1,enableHiding:!1,size:40},{accessorKey:"timestamp",header:"Timestamp",cell:s=>{const c=new Date(s.getValue());return e.jsxs("div",{className:"text-sm",children:[e.jsx("div",{className:"font-semibold text-gray-900",children:c.toLocaleDateString()}),e.jsx("div",{className:"text-gray-600 text-xs",children:c.toLocaleTimeString()})]})}},{accessorKey:"level",header:"Level",cell:s=>{const c=s.getValue(),u=rl(c);return e.jsx(ce,{className:`${u} font-semibold px-3 py-1 rounded-full border-0 transition-all duration-200`,children:c.toUpperCase()})}},{accessorKey:"message",header:"Message",cell:s=>e.jsx("div",{className:"font-mono text-sm whitespace-pre-wrap max-w-xl py-2 text-gray-800 leading-relaxed",children:s.getValue()})},{accessorKey:"metadata",header:"Metadata",cell:s=>{const c=s.getValue();if(!c||c.length===0)return e.jsx("div",{className:"text-xs text-gray-500 italic",children:"No metadata"});const u=c.slice(0,2),i=c.length>2;return e.jsx("div",{className:"max-w-xs",children:e.jsxs("div",{className:"font-mono text-xs bg-gradient-to-r from-gray-50 to-blue-50 border border-gray-200 rounded-lg p-3 whitespace-pre-wrap overflow-auto max-h-24 shadow-sm",children:[u.map(p=>e.jsxs("div",{className:"mb-1 truncate",children:[e.jsxs("span",{className:"text-blue-600 font-semibold",children:[p.key,":"]})," ",e.jsx("span",{className:"text-gray-800",title:String(p.value),children:String(p.value)})]},p.key)),i&&e.jsxs("div",{className:"text-blue-500 text-xs mt-2 font-medium",children:["+",c.length-2," more..."]})]})})}},{id:"actions",cell:({row:s})=>{const c=s.original;return e.jsx($,{variant:"ghost",size:"icon",onClick:()=>n(c),className:"rounded-full hover:bg-blue-50 hover:border-blue-200 border border-transparent transition-all duration-200 group","aria-label":"View log details",children:e.jsx(Kt,{className:"h-4 w-4 text-gray-600 group-hover:text-blue-600 transition-colors"})})},size:50}],nl=500,Nt=20;function al({projectId:t}){const{searchQuery:o,inputValue:r,setSearchQuery:n,filterModalOpen:a,openFilterModal:s,setFilterModalOpen:c,filters:u,handleApplyFilters:i,handleResetFilters:p,filtersActive:h}=jn({debounceTimeout:nl}),{sortDirection:d,sorting:f,handleToggleSortDirection:g,setSorting:x,resetSort:m}=Nn("desc"),{cursor:b,currentPage:j,handleNextPage:v,handlePrevPage:y,resetPagination:N}=tl(),{isDetailSheetOpen:A,currentLogDetail:q,openDetailSheet:_,setIsDetailSheetOpen:V}=_n(),[P,J]=l.useState([]),Y={limit:Nt,sortDirection:d,...u.levels.length>0?{level:u.levels}:{},...u.fromDate?{fromDate:u.fromDate}:{},...u.toDate?{toDate:u.toDate}:{},...u.metadata.length>0?{metadata:u.metadata}:{},...o?{messageContains:o}:{},...b?{cursor:b}:{}},{data:I,isLoading:B,isError:K,refetch:U,hasNextCursor:T}=Sn(t,Y),F=l.useMemo(()=>(I==null?void 0:I.logs)||[],[I]),z=T,w=l.useCallback(()=>{if(console.log("getting the next cursor",{hasNextCursor:T,data:I}),T){const L=I==null?void 0:I.logs[I.logs.length-1];if(L)return{id:L.id,timestamp:L.timestamp}}return null},[T,I]),{selectedLogs:k,selectedCount:W,handleSelectAll:X,handleSelectRow:ne,resetSelection:G}=Cn(F),le=l.useCallback(L=>{i(L),N(),G()},[i,N,G]),ee=l.useCallback(()=>{p(),N(),m(),G()},[p,N,m,G]),S=l.useCallback(()=>{g(),N(),G()},[g,N,G]),R=l.useCallback(()=>{const L=w();L&&v(L),console.log({nextCursor:L,cursor:b,hasNextCursor:T})},[v,w,b,T]),O=l.useCallback(()=>{y()},[y]),M=()=>{const L=Object.keys(k).filter(de=>k[de]);ue.info(`Mock Deleting ${L.length} logs...`,{description:"This is a placeholder. Actual deletion would be implemented here."}),G()},E=()=>{const L=Object.keys(k).filter(de=>k[de]);ue.info(`Mock Exporting ${L.length} logs...`,{description:"This is a placeholder. Actual export would be implemented here."})},D=()=>{const L=Object.keys(k).filter(ge=>k[ge]),Ce=F.filter(ge=>L.includes(ge.id)).map(ge=>`[${new Date(ge.timestamp).toLocaleString()}] [${ge.level.toUpperCase()}] ${ge.message}`).join(`
`);navigator.clipboard.writeText(Ce).then(()=>{ue.success(`Copied ${L.length} logs to clipboard`)}).catch(()=>{ue.error("Failed to copy logs to clipboard")})},ae=l.useMemo(()=>ol({selectedLogs:k,onSelectAll:L=>X(L),onSelectRow:ne,onOpenDetailSheet:_,currentLogs:F}),[k,X,ne,_,F]),ie=Fo({data:F,columns:ae,getCoreRowModel:Bo(),getSortedRowModel:Vo(),getFilteredRowModel:$o(),onSortingChange:x,onColumnFiltersChange:J,state:{sorting:f,columnFilters:P},manualPagination:!0,manualSorting:!0,manualFiltering:!0,enableRowSelection:!0,onRowSelectionChange:()=>{},debugTable:!1});return e.jsxs(e.Fragment,{children:[e.jsx(Gs,{open:a,onOpenChange:c,filters:u,onApply:le,onReset:ee,projectId:t}),e.jsxs(xe,{className:"bg-white/60 backdrop-blur-sm border-gray-200/50 shadow-lg w-full",children:[e.jsx(Mn,{filters:u,sortDirection:d,onOpenFilterModal:s,onToggleSortDirection:S,displayedLogCount:B?void 0:F.length,isLoading:B}),e.jsx(Ya,{searchQuery:r,onSearchQueryChange:n,onOpenFilterModal:s,selectedCount:W,onDeleteSelected:M,onExportSelected:E,onCopySelected:D,isLoading:B}),e.jsx(es,{table:ie,columns:ae,isLoading:B,isError:K,logs:F,selectedLogs:k,isFiltered:h||!!o,onRetry:()=>{N(),U()},onClearFilters:ee}),e.jsx(Hs,{currentPage:j,hasNextPage:z,onPrevPage:O,onNextPage:R,isLoading:B,currentLogCount:F.length,pageSize:Nt})]}),e.jsx(el,{open:A,onOpenChange:V,log:q})]})}function sl({metrics:t,isLoadingMetrics:o}){return e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs(xe,{className:"bg-white/60 backdrop-blur-sm border-gray-200/50 shadow-lg overflow-hidden hover:shadow-xl transition-all hover:border-primary/20",children:[e.jsx("div",{className:"bg-gradient-to-r from-blue-500/10 to-purple-500/10 p-4 border-b border-gray-200/50",children:e.jsxs("h3",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx("div",{className:"p-1 bg-gradient-to-r from-blue-500 to-purple-600 rounded text-white",children:e.jsx(So,{className:"h-3 w-3"})}),"Log Statistics"]})}),e.jsx(Se,{className:"p-6",children:e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"flex flex-col items-center justify-center p-4 rounded-lg border bg-background hover:border-primary/30 transition-colors",children:[e.jsx("div",{className:"text-3xl font-bold",children:o?e.jsx("span",{className:"text-muted-foreground",children:"..."}):(t==null?void 0:t.totalLogs)||0}),e.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"Total Logs"})]}),e.jsxs("div",{className:"flex flex-col items-center justify-center p-4 rounded-lg border bg-background hover:border-primary/30 transition-colors",children:[e.jsx("div",{className:"text-3xl font-bold",children:o?e.jsx("span",{className:"text-muted-foreground",children:"..."}):(t==null?void 0:t.todaysLogs)||0}),e.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"Today's Logs"})]})]})})]}),e.jsxs(xe,{className:"bg-white/60 backdrop-blur-sm border-gray-200/50 shadow-lg overflow-hidden hover:shadow-xl transition-all hover:border-primary/20",children:[e.jsx("div",{className:"bg-gradient-to-r from-red-500/10 to-orange-500/10 p-4 border-b border-gray-200/50",children:e.jsxs("h3",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx("div",{className:"p-1 bg-gradient-to-r from-red-500 to-orange-500 rounded text-white",children:e.jsx(Bt,{className:"h-3 w-3"})}),"Error Summary"]})}),e.jsx(Se,{className:"p-6",children:e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"flex flex-col items-center justify-center p-4 rounded-lg border bg-background hover:border-primary/30 transition-colors",children:[e.jsx("div",{className:"text-3xl font-bold",children:o?e.jsx("span",{className:"text-muted-foreground",children:"..."}):(t==null?void 0:t.totalErrors)||0}),e.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"All Errors"})]}),e.jsxs("div",{className:"flex flex-col items-center justify-center p-4 rounded-lg border bg-background hover:border-primary/30 transition-colors",children:[e.jsx("div",{className:"text-3xl font-bold",children:o?e.jsx("span",{className:"text-muted-foreground",children:"..."}):(t==null?void 0:t.todaysErrors)||0}),e.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"Today's Errors"})]})]})})]}),e.jsxs(xe,{className:"bg-white/60 backdrop-blur-sm border-gray-200/50 shadow-lg overflow-hidden hover:shadow-xl transition-all hover:border-primary/20",children:[e.jsx("div",{className:"bg-gradient-to-r from-green-500/10 to-teal-500/10 p-4 border-b border-gray-200/50",children:e.jsxs("h3",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx("div",{className:"p-1 bg-gradient-to-r from-green-500 to-teal-500 rounded text-white",children:e.jsx(nn,{className:"h-3 w-3"})}),"Activity"]})}),e.jsx(Se,{className:"p-6 flex items-center justify-center",children:o?e.jsx("div",{className:"text-center",children:e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading activity..."})}):t!=null&&t.lastActivity?e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"Last activity:"}),e.jsx("div",{className:"font-medium mt-1",children:new Date(t.lastActivity.timestamp).toLocaleString()}),e.jsx(ce,{className:`mt-2 ${t.lastActivity.level==="error"?"bg-red-500 hover:bg-red-600":t.lastActivity.level==="warn"?"bg-amber-500 hover:bg-amber-600":"bg-blue-500 hover:bg-blue-600"}`,children:t.lastActivity.level.toUpperCase()})]}):e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"Last activity:"}),e.jsx("div",{className:"font-medium mt-1",children:"No recent activity"})]})})]})]})}function ll({projectId:t}){const{data:o,isLoading:r,isError:n}=Co(t),{data:a,isLoading:s}=Ko(t),c=Uo(),[u,i]=l.useState(!1),{editModalOpen:p,setEditModalOpen:h,deleteDialogOpen:d,setDeleteDialogOpen:f,autoRefresh:g,setAutoRefresh:x,handleRefresh:m,handleDeleteProject:b,handleConfirmDelete:j,handleEditProject:v,handleEditSubmit:y,updateProject:N,deleteProject:A}=No(t),q=()=>{i(!0)},_=()=>{c.mutate(t,{onSuccess:()=>{i(!1)}})},V=r||s;return l.useEffect(()=>{if(!g)return;const P=setInterval(()=>{m()},5e3);return()=>clearInterval(P)},[g,t,m]),t?r?e.jsx(Mo,{}):n||!o?e.jsx(Po,{projectId:t,project:o}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"min-h-full bg-gradient-to-br from-slate-50 via-blue-50 to-indigo-50 p-6",children:e.jsxs("div",{className:"max-w-6xl mx-auto space-y-8",children:[e.jsx(To,{project:o,isRefreshing:V,autoRefresh:g,onAutoRefreshChange:x,onEdit:v,onDelete:b,onClearLogs:q,onRefresh:m}),e.jsx(sl,{metrics:a,isLoadingMetrics:s}),e.jsx(Ro,{projectId:o.id,currentPage:"logs"}),e.jsxs("div",{className:"bg-white/60 backdrop-blur-sm border border-gray-200/50 shadow-lg rounded-lg p-6",children:[e.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-6",children:"Project Logs"}),e.jsx(al,{projectId:o.id})]})]})}),e.jsx(on,{open:p,onOpenChange:h,initialData:o?{name:o.name,description:o.description}:void 0,onSubmit:y,loading:N.isPending,mode:"edit"}),e.jsx(bt,{open:d,onOpenChange:f,title:"Delete Project?",description:"This will permanently delete the project and all its logs. This action cannot be undone.",onConfirm:j,loading:A.isPending,confirmLabel:"Delete"}),e.jsx(bt,{open:u,onOpenChange:i,title:"Clear All Logs?",description:"This will permanently delete all logs for this project. The project itself will remain, but all log data will be lost. This action cannot be undone.",onConfirm:_,loading:c.isPending,confirmLabel:"Clear Logs"})]}):e.jsx(_o,{})}const Sl=()=>{const{projectId:t}=jo.useParams();return e.jsx(ll,{projectId:t})};export{Sl as component};
