import{c as me,g as Zr,q as ke,s as Mt,h as eo,i as to,t as ae,r as l,j as e,B as de,k as F,V as ro,N as oo,O as no,Q as so,a as st,W as $e,X as at,Y as Pt,Z as Tt,e as Ve,_ as Rt,$ as X,d as C,P as H,a0 as Et,a1 as ao,a2 as Dt,a3 as It,a4 as kt,a5 as Ot,a6 as At,a7 as Lt,a8 as Ft,a9 as $t,u as Xe,b as Pe,f as le,aa as lo,y as Oe,ab as io,ac as Vt,ad as pe,ae as Bt,af as co,M as Kt,ag as uo,ah as po,ai as mo,J as ho,K as fo,aj as go,ak as xo,al as vo,am as bo,an as yo,ao as wo,S as jo,ap as So,F as Co,T as No,aq as _o}from"./index-DszW2bOJ.js";import{C as Ut,e as Ht,u as Mo,a as Po,P as To,b as Ro,c as Eo,d as Do,Q as Io}from"./QuickAccessCards-CrUYLHb-.js";import{F as lt,D as ko,T as Oo,a as Ao,b as We,c as Lo,f as gt,d as Fo,e as xt,l as vt,C as $o,S as Vo,g as bt,u as Bo,h as Ko,i as Uo,j as Ho,k as zo}from"./scroll-area-BmGhP1SC.js";import{a as Go,b as Wo,C as xe,d as je,e as qo}from"./card-Bxc0HrZ8.js";import{I as Ne,L as Ie}from"./label-DLEWKwVs.js";import{a as zt,c as Gt,I as Jo,R as Yo}from"./index-CTEXMohc.js";import{u as Wt,C as Qo}from"./index-CdIMhveG.js";import{S as qt}from"./search-BTc9gkmb.js";import{R as Xo,u as Zo}from"./switch-CgfzYKbb.js";import{D as en,a as tn,b as rn,c as on,e as nn,P as sn,C as yt}from"./ConfirmDialog-CYD3yS9a.js";import{C as an}from"./chart-column-CXYwyjyg.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 ln=[["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"}]],cn=me("ArrowDownNarrowWide",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:"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"}]],un=me("ArrowUpNarrowWide",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:"m18 15-6-6-6 6",key:"153udz"}]],mn=me("ChevronUp",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:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],fn=me("ChevronsLeft",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:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],xn=me("ChevronsRight",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:"M22 12A10 10 0 1 1 12 2",key:"1fm58d"}],["path",{d:"M22 2 12 12",key:"yg2myt"}],["path",{d:"M16 2h6v6",key:"zan5cs"}]],bn=me("CircleArrowOutUpRight",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=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],wn=me("LoaderCircle",yn);/**
 * @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 jn=[["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"}]],Sn=me("Maximize2",jn);function Cn(t,o){var n;const r=Zr({queryKey:ke.logs.byProjectWithOptions(t,o),queryFn:()=>Mt.projects.getLogs(t,o),enabled:!!t,refetchInterval:5e3});return{...r,hasNextCursor:((n=r.data)==null?void 0:n.hasNextPage)||!1}}function Nn(){const t=eo();return to({mutationFn:o=>Mt.projects.clearLogs(o),onSuccess:(o,r)=>{t.invalidateQueries({queryKey:ke.logs.byProject(r)}),t.invalidateQueries({queryKey:ke.projects.metrics(r)}),t.invalidateQueries({queryKey:ke.logs.historicalCounts(r,7)}),ae.success("Project logs cleared",{description:"All logs for this project have been successfully cleared"})},onError:o=>{console.error("Failed to clear project logs:",o),ae.error("Error clearing project logs",{description:"Could not clear the project logs"})}})}function _n(t={}){const{initialFilters:o={},initialSearchQuery:r="",debounceTimeout:n=500}=t,[s,a]=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(s)},n);return()=>{clearTimeout(v)}},[s,n]),{searchQuery:c,setSearchQuery:a,inputValue:s,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),a(""),p(!1)},filtersActive:f}}function Mn(t=[]){const[o,r]=l.useState({}),[n,s]=l.useState(0);l.useEffect(()=>{const i=Object.values(o).filter(Boolean).length;s(i)},[o]);const a=l.useCallback(()=>{r({})},[]);l.useEffect(()=>{a()},[t,a]);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:a}}function Pn(t="desc"){const[o,r]=l.useState(t),[n,s]=l.useState([{id:"timestamp",desc:t==="desc"}]),a=l.useCallback(()=>{r(u=>{const i=u==="desc"?"asc":"desc";return s([{id:"timestamp",desc:i==="desc"}]),i})},[]),c=l.useCallback(()=>{r(t),s([{id:"timestamp",desc:t==="desc"}])},[t]);return{sortDirection:o,sorting:n,handleToggleSortDirection:a,setSorting:s,resetSort:c}}function Tn(){const[t,o]=l.useState(!1),[r,n]=l.useState(null),s=l.useCallback(c=>{n(c),o(!0)},[]),a=l.useCallback(()=>{o(!1)},[]);return{isDetailSheetOpen:t,currentLogDetail:r,openDetailSheet:s,closeDetailSheet:a,setIsDetailSheetOpen:o}}function Rn({filters:t,sortDirection:o,onOpenFilterModal:r,onToggleSortDirection:n,displayedLogCount:s,isLoading:a}){return e.jsx(Go,{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(Wo,{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(de,{variant:"outline",children:["Levels: ",t.levels.join(", ")]}),t.fromDate&&e.jsxs(de,{variant:"outline",children:["From: ",new Date(t.fromDate).toLocaleDateString()]}),t.toDate&&e.jsxs(de,{variant:"outline",children:["To: ",new Date(t.toDate).toLocaleDateString()]}),t.metadata.map((c,u)=>e.jsxs(de,{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(F,{variant:"outline",size:"icon",className:"h-9 w-9",onClick:r,"aria-label":"Open filters",disabled:a,children:e.jsx(lt,{className:"h-5 w-5"})}),e.jsx(ro,{children:e.jsxs(oo,{children:[e.jsx(no,{asChild:!0,children:e.jsxs(F,{variant:"outline",size:"sm",onClick:n,className:"h-9 min-w-[140px] justify-between tabular-nums",disabled:a,children:[e.jsx("span",{children:o==="desc"?"Newest First":"Oldest First"}),o==="desc"?e.jsx(cn,{className:"h-4 w-4 ml-2"}):e.jsx(un,{className:"h-4 w-4 ml-2"})]})}),e.jsx(so,{children:e.jsx("p",{children:"Change sort order"})})]})}),s!==void 0&&!a&&e.jsxs("div",{className:"text-sm text-muted-foreground whitespace-nowrap",children:[s," log",s===1?"":"s"]})]})]})})}var Ze=["Enter"," "],En=["ArrowDown","PageUp","Home"],Jt=["ArrowUp","PageDown","End"],Dn=[...En,...Jt],In={ltr:[...Ze,"ArrowRight"],rtl:[...Ze,"ArrowLeft"]},kn={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Ee="Menu",[Te,On,An]=zt(Ee),[ye,Yt]=st(Ee,[An,$e,Gt]),Be=$e(),Qt=Gt(),[Ln,we]=ye(Ee),[Fn,De]=ye(Ee),Xt=t=>{const{__scopeMenu:o,open:r=!1,children:n,dir:s,onOpenChange:a,modal:c=!0}=t,u=Be(o),[i,p]=l.useState(null),h=l.useRef(!1),d=at(a),f=Wt(s);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(Pt,{...u,children:e.jsx(Ln,{scope:o,open:r,onOpenChange:d,content:i,onContentChange:p,children:e.jsx(Fn,{scope:o,onClose:l.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:h,dir:f,modal:c,children:n})})})};Xt.displayName=Ee;var $n="MenuAnchor",it=l.forwardRef((t,o)=>{const{__scopeMenu:r,...n}=t,s=Be(r);return e.jsx(Tt,{...s,...n,ref:o})});it.displayName=$n;var ct="MenuPortal",[Vn,Zt]=ye(ct,{forceMount:void 0}),er=t=>{const{__scopeMenu:o,forceMount:r,children:n,container:s}=t,a=we(ct,o);return e.jsx(Vn,{scope:o,forceMount:r,children:e.jsx(Ve,{present:r||a.open,children:e.jsx(Rt,{asChild:!0,container:s,children:n})})})};er.displayName=ct;var te="MenuContent",[Bn,dt]=ye(te),tr=l.forwardRef((t,o)=>{const r=Zt(te,t.__scopeMenu),{forceMount:n=r.forceMount,...s}=t,a=we(te,t.__scopeMenu),c=De(te,t.__scopeMenu);return e.jsx(Te.Provider,{scope:t.__scopeMenu,children:e.jsx(Ve,{present:n||a.open,children:e.jsx(Te.Slot,{scope:t.__scopeMenu,children:c.modal?e.jsx(Kn,{...s,ref:o}):e.jsx(Un,{...s,ref:o})})})})}),Kn=l.forwardRef((t,o)=>{const r=we(te,t.__scopeMenu),n=l.useRef(null),s=X(o,n);return l.useEffect(()=>{const a=n.current;if(a)return Et(a)},[]),e.jsx(ut,{...t,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:C(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),Un=l.forwardRef((t,o)=>{const r=we(te,t.__scopeMenu);return e.jsx(ut,{...t,ref:o,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),Hn=kt("MenuContent.ScrollLock"),ut=l.forwardRef((t,o)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:c,disableOutsidePointerEvents:u,onEntryFocus:i,onEscapeKeyDown:p,onPointerDownOutside:h,onFocusOutside:d,onInteractOutside:f,onDismiss:g,disableOutsideScroll:x,...m}=t,b=we(te,r),S=De(te,r),v=Be(r),y=Qt(r),N=On(r),[A,q]=l.useState(null),_=l.useRef(null),V=X(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?It:l.Fragment,T=x?{as:Hn,allowPinchZoom:!0}:void 0,$=w=>{var j,R;const k=J.current+w,W=N().filter(O=>!O.disabled),Q=document.activeElement,ne=(j=W.find(O=>O.ref.current===Q))==null?void 0:j.textValue,G=W.map(O=>O.textValue),ie=rs(G,k,ne),ee=(R=W.find(O=>O.textValue===ie))==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),[]),Dt();const z=l.useCallback(w=>{var W,Q;return B.current===((W=I.current)==null?void 0:W.side)&&ns(w,(Q=I.current)==null?void 0:Q.area)},[]);return e.jsx(Bn,{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(Ot,{asChild:!0,trapped:s,onMountAutoFocus:C(a,w=>{var k;w.preventDefault(),(k=_.current)==null||k.focus({preventScroll:!0})}),onUnmountAutoFocus:c,children:e.jsx(At,{asChild:!0,disableOutsidePointerEvents:u,onEscapeKeyDown:p,onPointerDownOutside:h,onFocusOutside:d,onInteractOutside:f,onDismiss:g,children:e.jsx(Yo,{asChild:!0,...y,dir:S.dir,orientation:"vertical",loop:n,currentTabStopId:A,onCurrentTabStopIdChange:q,onEntryFocus:C(i,w=>{S.isUsingKeyboardRef.current||w.preventDefault()}),preventScrollOnEntryFocus:!0,children:e.jsx(Lt,{role:"menu","aria-orientation":"vertical","data-state":xr(b.open),"data-radix-menu-content":"",dir:S.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,Q=w.ctrlKey||w.altKey||w.metaKey,ne=w.key.length===1;W&&(w.key==="Tab"&&w.preventDefault(),!Q&&ne&&$(w.key));const G=_.current;if(w.target!==G||!Dn.includes(w.key))return;w.preventDefault();const ee=N().filter(j=>!j.disabled).map(j=>j.ref.current);Jt.includes(w.key)&&ee.reverse(),es(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 Q=w.clientX>K.current?"right":"left";B.current=Q,K.current=w.clientX}}))})})})})})})});tr.displayName=te;var zn="MenuGroup",pt=l.forwardRef((t,o)=>{const{__scopeMenu:r,...n}=t;return e.jsx(H.div,{role:"group",...n,ref:o})});pt.displayName=zn;var Gn="MenuLabel",rr=l.forwardRef((t,o)=>{const{__scopeMenu:r,...n}=t;return e.jsx(H.div,{...n,ref:o})});rr.displayName=Gn;var Ae="MenuItem",wt="menu.itemSelect",Ke=l.forwardRef((t,o)=>{const{disabled:r=!1,onSelect:n,...s}=t,a=l.useRef(null),c=De(Ae,t.__scopeMenu),u=dt(Ae,t.__scopeMenu),i=X(o,a),p=l.useRef(!1),h=()=>{const d=a.current;if(!r&&d){const f=new CustomEvent(wt,{bubbles:!0,cancelable:!0});d.addEventListener(wt,g=>n==null?void 0:n(g),{once:!0}),ao(d,f),f.defaultPrevented?p.current=!1:c.onClose()}};return e.jsx(or,{...s,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===" "||Ze.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});Ke.displayName=Ae;var or=l.forwardRef((t,o)=>{const{__scopeMenu:r,disabled:n=!1,textValue:s,...a}=t,c=dt(Ae,r),u=Qt(r),i=l.useRef(null),p=X(o,i),[h,d]=l.useState(!1),[f,g]=l.useState("");return l.useEffect(()=>{const x=i.current;x&&g((x.textContent??"").trim())},[a.children]),e.jsx(Te.ItemSlot,{scope:r,disabled:n,textValue:s??f,children:e.jsx(Jo,{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,...a,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))})})})}),Wn="MenuCheckboxItem",nr=l.forwardRef((t,o)=>{const{checked:r=!1,onCheckedChange:n,...s}=t;return e.jsx(cr,{scope:t.__scopeMenu,checked:r,children:e.jsx(Ke,{role:"menuitemcheckbox","aria-checked":Le(r)?"mixed":r,...s,ref:o,"data-state":ht(r),onSelect:C(s.onSelect,()=>n==null?void 0:n(Le(r)?!0:!r),{checkForDefaultPrevented:!1})})})});nr.displayName=Wn;var sr="MenuRadioGroup",[qn,Jn]=ye(sr,{value:void 0,onValueChange:()=>{}}),ar=l.forwardRef((t,o)=>{const{value:r,onValueChange:n,...s}=t,a=at(n);return e.jsx(qn,{scope:t.__scopeMenu,value:r,onValueChange:a,children:e.jsx(pt,{...s,ref:o})})});ar.displayName=sr;var lr="MenuRadioItem",ir=l.forwardRef((t,o)=>{const{value:r,...n}=t,s=Jn(lr,t.__scopeMenu),a=r===s.value;return e.jsx(cr,{scope:t.__scopeMenu,checked:a,children:e.jsx(Ke,{role:"menuitemradio","aria-checked":a,...n,ref:o,"data-state":ht(a),onSelect:C(n.onSelect,()=>{var c;return(c=s.onValueChange)==null?void 0:c.call(s,r)},{checkForDefaultPrevented:!1})})})});ir.displayName=lr;var mt="MenuItemIndicator",[cr,Yn]=ye(mt,{checked:!1}),dr=l.forwardRef((t,o)=>{const{__scopeMenu:r,forceMount:n,...s}=t,a=Yn(mt,r);return e.jsx(Ve,{present:n||Le(a.checked)||a.checked===!0,children:e.jsx(H.span,{...s,ref:o,"data-state":ht(a.checked)})})});dr.displayName=mt;var Qn="MenuSeparator",ur=l.forwardRef((t,o)=>{const{__scopeMenu:r,...n}=t;return e.jsx(H.div,{role:"separator","aria-orientation":"horizontal",...n,ref:o})});ur.displayName=Qn;var Xn="MenuArrow",pr=l.forwardRef((t,o)=>{const{__scopeMenu:r,...n}=t,s=Be(r);return e.jsx(Ft,{...s,...n,ref:o})});pr.displayName=Xn;var Zn="MenuSub",[jl,mr]=ye(Zn),_e="MenuSubTrigger",hr=l.forwardRef((t,o)=>{const r=we(_e,t.__scopeMenu),n=De(_e,t.__scopeMenu),s=mr(_e,t.__scopeMenu),a=dt(_e,t.__scopeMenu),c=l.useRef(null),{pointerGraceTimerRef:u,onPointerGraceIntentChange:i}=a,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(it,{asChild:!0,...p,children:e.jsx(or,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":s.contentId,"data-state":xr(r.open),...t,ref:$t(o,s.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=>{a.onItemEnter(d),!d.defaultPrevented&&!t.disabled&&!r.open&&!c.current&&(a.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",S=b?-5:5,v=f[b?"left":"right"],y=f[b?"right":"left"];a.onPointerGraceIntentChange({area:[{x:d.clientX+S,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(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(d),d.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:C(t.onKeyDown,d=>{var g;const f=a.searchRef.current!=="";t.disabled||f&&d.key===" "||In[n.dir].includes(d.key)&&(r.onOpenChange(!0),(g=r.content)==null||g.focus(),d.preventDefault())})})})});hr.displayName=_e;var fr="MenuSubContent",gr=l.forwardRef((t,o)=>{const r=Zt(te,t.__scopeMenu),{forceMount:n=r.forceMount,...s}=t,a=we(te,t.__scopeMenu),c=De(te,t.__scopeMenu),u=mr(fr,t.__scopeMenu),i=l.useRef(null),p=X(o,i);return e.jsx(Te.Provider,{scope:t.__scopeMenu,children:e.jsx(Ve,{present:n||a.open,children:e.jsx(Te.Slot,{scope:t.__scopeMenu,children:e.jsx(ut,{id:u.contentId,"aria-labelledby":u.triggerId,...s,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&&a.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=kn[c.dir].includes(h.key);d&&f&&(a.onOpenChange(!1),(g=u.trigger)==null||g.focus(),h.preventDefault())})})})})})});gr.displayName=fr;function xr(t){return t?"open":"closed"}function Le(t){return t==="indeterminate"}function ht(t){return Le(t)?"indeterminate":t?"checked":"unchecked"}function es(t){const o=document.activeElement;for(const r of t)if(r===o||(r.focus(),document.activeElement!==o))return}function ts(t,o){return t.map((r,n)=>t[(o+n)%t.length])}function rs(t,o,r){const s=o.length>1&&Array.from(o).every(p=>p===o[0])?o[0]:o,a=r?t.indexOf(r):-1;let c=ts(t,Math.max(a,0));s.length===1&&(c=c.filter(p=>p!==r));const i=c.find(p=>p.toLowerCase().startsWith(s.toLowerCase()));return i!==r?i:void 0}function os(t,o){const{x:r,y:n}=t;let s=!1;for(let a=0,c=o.length-1;a<o.length;c=a++){const u=o[a],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&&(s=!s)}return s}function ns(t,o){if(!o)return!1;const r={x:t.clientX,y:t.clientY};return os(r,o)}function Re(t){return o=>o.pointerType==="mouse"?t(o):void 0}var ss=Xt,as=it,ls=er,is=tr,cs=pt,ds=rr,us=Ke,ps=nr,ms=ar,hs=ir,fs=dr,gs=ur,xs=pr,vs=hr,bs=gr,Ue="DropdownMenu",[ys,Sl]=st(Ue,[Yt]),Z=Yt(),[ws,vr]=ys(Ue),br=t=>{const{__scopeDropdownMenu:o,children:r,dir:n,open:s,defaultOpen:a,onOpenChange:c,modal:u=!0}=t,i=Z(o),p=l.useRef(null),[h,d]=Xe({prop:s,defaultProp:a??!1,onChange:c,caller:Ue});return e.jsx(ws,{scope:o,triggerId:Pe(),triggerRef:p,contentId:Pe(),open:h,onOpenChange:d,onOpenToggle:l.useCallback(()=>d(f=>!f),[d]),modal:u,children:e.jsx(ss,{...i,open:h,onOpenChange:d,dir:n,modal:u,children:r})})};br.displayName=Ue;var yr="DropdownMenuTrigger",wr=l.forwardRef((t,o)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...s}=t,a=vr(yr,r),c=Z(r);return e.jsx(as,{asChild:!0,...c,children:e.jsx(H.button,{type:"button",id:a.triggerId,"aria-haspopup":"menu","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...s,ref:$t(o,a.triggerRef),onPointerDown:C(t.onPointerDown,u=>{!n&&u.button===0&&u.ctrlKey===!1&&(a.onOpenToggle(),a.open||u.preventDefault())}),onKeyDown:C(t.onKeyDown,u=>{n||(["Enter"," "].includes(u.key)&&a.onOpenToggle(),u.key==="ArrowDown"&&a.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(u.key)&&u.preventDefault())})})})});wr.displayName=yr;var js="DropdownMenuPortal",jr=t=>{const{__scopeDropdownMenu:o,...r}=t,n=Z(o);return e.jsx(ls,{...n,...r})};jr.displayName=js;var Sr="DropdownMenuContent",Cr=l.forwardRef((t,o)=>{const{__scopeDropdownMenu:r,...n}=t,s=vr(Sr,r),a=Z(r),c=l.useRef(!1);return e.jsx(is,{id:s.contentId,"aria-labelledby":s.triggerId,...a,...n,ref:o,onCloseAutoFocus:C(t.onCloseAutoFocus,u=>{var i;c.current||(i=s.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;(!s.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)"}})});Cr.displayName=Sr;var Ss="DropdownMenuGroup",Cs=l.forwardRef((t,o)=>{const{__scopeDropdownMenu:r,...n}=t,s=Z(r);return e.jsx(cs,{...s,...n,ref:o})});Cs.displayName=Ss;var Ns="DropdownMenuLabel",_s=l.forwardRef((t,o)=>{const{__scopeDropdownMenu:r,...n}=t,s=Z(r);return e.jsx(ds,{...s,...n,ref:o})});_s.displayName=Ns;var Ms="DropdownMenuItem",Nr=l.forwardRef((t,o)=>{const{__scopeDropdownMenu:r,...n}=t,s=Z(r);return e.jsx(us,{...s,...n,ref:o})});Nr.displayName=Ms;var Ps="DropdownMenuCheckboxItem",Ts=l.forwardRef((t,o)=>{const{__scopeDropdownMenu:r,...n}=t,s=Z(r);return e.jsx(ps,{...s,...n,ref:o})});Ts.displayName=Ps;var Rs="DropdownMenuRadioGroup",Es=l.forwardRef((t,o)=>{const{__scopeDropdownMenu:r,...n}=t,s=Z(r);return e.jsx(ms,{...s,...n,ref:o})});Es.displayName=Rs;var Ds="DropdownMenuRadioItem",Is=l.forwardRef((t,o)=>{const{__scopeDropdownMenu:r,...n}=t,s=Z(r);return e.jsx(hs,{...s,...n,ref:o})});Is.displayName=Ds;var ks="DropdownMenuItemIndicator",Os=l.forwardRef((t,o)=>{const{__scopeDropdownMenu:r,...n}=t,s=Z(r);return e.jsx(fs,{...s,...n,ref:o})});Os.displayName=ks;var As="DropdownMenuSeparator",_r=l.forwardRef((t,o)=>{const{__scopeDropdownMenu:r,...n}=t,s=Z(r);return e.jsx(gs,{...s,...n,ref:o})});_r.displayName=As;var Ls="DropdownMenuArrow",Fs=l.forwardRef((t,o)=>{const{__scopeDropdownMenu:r,...n}=t,s=Z(r);return e.jsx(xs,{...s,...n,ref:o})});Fs.displayName=Ls;var $s="DropdownMenuSubTrigger",Vs=l.forwardRef((t,o)=>{const{__scopeDropdownMenu:r,...n}=t,s=Z(r);return e.jsx(vs,{...s,...n,ref:o})});Vs.displayName=$s;var Bs="DropdownMenuSubContent",Ks=l.forwardRef((t,o)=>{const{__scopeDropdownMenu:r,...n}=t,s=Z(r);return e.jsx(bs,{...s,...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)"}})});Ks.displayName=Bs;var Us=br,Hs=wr,zs=jr,Gs=Cr,Ws=Nr,qs=_r;function Js({...t}){return e.jsx(Us,{"data-slot":"dropdown-menu",...t})}function Ys({...t}){return e.jsx(Hs,{"data-slot":"dropdown-menu-trigger",...t})}function Qs({className:t,sideOffset:o=4,...r}){return e.jsx(zs,{children:e.jsx(Gs,{"data-slot":"dropdown-menu-content",sideOffset:o,className:le("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 qe({className:t,inset:o,variant:r="default",...n}){return e.jsx(Ws,{"data-slot":"dropdown-menu-item","data-inset":o,"data-variant":r,className:le("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 Xs({className:t,...o}){return e.jsx(qs,{"data-slot":"dropdown-menu-separator",className:le("bg-border -mx-1 my-1 h-px",t),...o})}function Zs({searchQuery:t,onSearchQueryChange:o,onOpenFilterModal:r,selectedCount:n,onDeleteSelected:s,onExportSelected:a,onCopySelected:c,isLoading:u}){const i=()=>{s()},p=()=>{a()},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(qt,{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(F,{className:"h-10",onClick:r,variant:"outline",disabled:u,children:[e.jsx(lt,{className:"h-4 w-4 mr-2"}),"Filters"]}),n>0&&e.jsxs(Js,{children:[e.jsx(Ys,{asChild:!0,children:e.jsxs(F,{variant:"outline",className:"h-10",children:[e.jsx(lo,{className:"h-4 w-4 mr-2"}),"Actions (",n,")"]})}),e.jsxs(Qs,{align:"end",children:[e.jsxs(qe,{onClick:h,children:[e.jsx(Oe,{className:"mr-2 h-4 w-4"}),"Copy Selected"]}),e.jsxs(qe,{onClick:p,children:[e.jsx(ko,{className:"mr-2 h-4 w-4"}),"Export Selected"]}),e.jsx(Xs,{}),e.jsxs(qe,{onClick:i,className:"text-red-600 focus:text-red-700 focus:bg-red-50",children:[e.jsx(io,{className:"mr-2 h-4 w-4"}),"Delete Selected"]})]})]})]})]})})}const ea=()=>e.jsx(xe,{className:"bg-white/80 backdrop-blur-sm border-gray-200 shadow-lg rounded-xl",children:e.jsx(je,{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(wn,{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"})]})]})})}),ta=({onRetry:t})=>e.jsx(xe,{className:"bg-white/80 backdrop-blur-sm border-red-200 shadow-lg rounded-xl",children:e.jsx(je,{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(Ut,{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(F,{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(Xo,{className:"h-4 w-4 mr-2"}),"Try Again"]})]})]})})}),ra=({isFiltered:t,onClearFilters:o})=>e.jsx(xe,{className:"bg-white/80 backdrop-blur-sm border-gray-200 shadow-lg rounded-xl",children:e.jsx(je,{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(qt,{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(F,{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(Vt,{className:"h-4 w-4 mr-2"}),"Clear Filters"]})]})]})})});function oa({table:t,columns:o,isLoading:r,isError:n,logs:s,selectedLogs:a,isFiltered:c,onRetry:u,onClearFilters:i}){return r?e.jsx(ea,{}):n?e.jsx(ta,{onRetry:u}):s.length===0?e.jsx(ra,{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(Oo,{children:[e.jsx(Ao,{className:"bg-gradient-to-r from-gray-50/80 to-blue-50/80 backdrop-blur-sm",children:t.getHeaderGroups().map(p=>e.jsx(We,{className:"border-b border-gray-200/50",children:p.headers.map(h=>e.jsx(Lo,{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:gt(h.column.columnDef.header,h.getContext())},h.id))},p.id))}),e.jsx(Fo,{children:t.getRowModel().rows.length?t.getRowModel().rows.map((p,h)=>e.jsx(We,{"data-state":a[p.original.id]?"selected":void 0,className:`
                  ${h%2===0?"bg-white/60":"bg-gray-50/60"} 
                  ${a[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(xt,{className:"py-5 px-6 text-gray-900",style:{width:d.column.getSize()!==150?d.column.getSize():void 0},children:gt(d.column.columnDef.cell,d.getContext())},d.id))},p.id)):e.jsx(We,{children:e.jsx(xt,{colSpan:o.length,className:"h-24 text-center text-gray-600",children:"No results found for the current filter criteria."})})})]})})}var na=[" ","Enter","ArrowUp","ArrowDown"],sa=[" ","Enter"],ve="Select",[He,ze,aa]=zt(ve),[Se,Cl]=st(ve,[aa,$e]),Ge=$e(),[la,he]=Se(ve),[ia,ca]=Se(ve),Mr=t=>{const{__scopeSelect:o,children:r,open:n,defaultOpen:s,onOpenChange:a,value:c,defaultValue:u,onValueChange:i,dir:p,name:h,autoComplete:d,disabled:f,required:g,form:x}=t,m=Ge(o),[b,S]=l.useState(null),[v,y]=l.useState(null),[N,A]=l.useState(!1),q=Wt(p),[_,V]=Xe({prop:n,defaultProp:s??!1,onChange:a,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(Pt,{...m,children:e.jsxs(la,{required:g,scope:o,trigger:b,onTriggerChange:S,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(He.Provider,{scope:o,children:e.jsx(ia,{scope:t.__scopeSelect,onNativeOptionAdd:l.useCallback(T=>{K($=>new Set($).add(T))},[]),onNativeOptionRemove:l.useCallback(T=>{K($=>{const z=new Set($);return z.delete(T),z})},[]),children:r})}),I?e.jsxs(Jr,{"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]})})};Mr.displayName=ve;var Pr="SelectTrigger",Tr=l.forwardRef((t,o)=>{const{__scopeSelect:r,disabled:n=!1,...s}=t,a=Ge(r),c=he(Pr,r),u=c.disabled||n,i=X(o,c.onTriggerChange),p=ze(r),h=l.useRef("touch"),[d,f,g]=Qr(m=>{const b=p().filter(y=>!y.disabled),S=b.find(y=>y.value===c.value),v=Xr(b,m,S);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(Tt,{asChild:!0,...a,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":Yr(c.value)?"":void 0,...s,ref:i,onClick:C(s.onClick,m=>{m.currentTarget.focus(),h.current!=="mouse"&&x(m)}),onPointerDown:C(s.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(s.onKeyDown,m=>{const b=d.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&f(m.key),!(b&&m.key===" ")&&na.includes(m.key)&&(x(),m.preventDefault())})})})});Tr.displayName=Pr;var Rr="SelectValue",Er=l.forwardRef((t,o)=>{const{__scopeSelect:r,className:n,style:s,children:a,placeholder:c="",...u}=t,i=he(Rr,r),{onValueNodeHasChildrenChange:p}=i,h=a!==void 0,d=X(o,i.onValueNodeChange);return pe(()=>{p(h)},[p,h]),e.jsx(H.span,{...u,ref:d,style:{pointerEvents:"none"},children:Yr(i.value)?e.jsx(e.Fragment,{children:c}):a})});Er.displayName=Rr;var da="SelectIcon",Dr=l.forwardRef((t,o)=>{const{__scopeSelect:r,children:n,...s}=t;return e.jsx(H.span,{"aria-hidden":!0,...s,ref:o,children:n||"▼"})});Dr.displayName=da;var ua="SelectPortal",Ir=t=>e.jsx(Rt,{asChild:!0,...t});Ir.displayName=ua;var be="SelectContent",kr=l.forwardRef((t,o)=>{const r=he(be,t.__scopeSelect),[n,s]=l.useState();if(pe(()=>{s(new DocumentFragment)},[]),!r.open){const a=n;return a?Bt.createPortal(e.jsx(Or,{scope:t.__scopeSelect,children:e.jsx(He.Slot,{scope:t.__scopeSelect,children:e.jsx("div",{children:t.children})})}),a):null}return e.jsx(Ar,{...t,ref:o})});kr.displayName=be;var oe=10,[Or,fe]=Se(be),pa="SelectContentImpl",ma=kt("SelectContent.RemoveScroll"),Ar=l.forwardRef((t,o)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:a,onPointerDownOutside:c,side:u,sideOffset:i,align:p,alignOffset:h,arrowPadding:d,collisionBoundary:f,collisionPadding:g,sticky:x,hideWhenDetached:m,avoidCollisions:b,...S}=t,v=he(be,r),[y,N]=l.useState(null),[A,q]=l.useState(null),_=X(o,j=>N(j)),[V,P]=l.useState(null),[J,Y]=l.useState(null),I=ze(r),[B,K]=l.useState(!1),U=l.useRef(!1);l.useEffect(()=>{if(y)return Et(y)},[y]),Dt();const T=l.useCallback(j=>{const[R,...O]=I().map(D=>D.ref.current),[M]=O.slice(-1),E=document.activeElement;for(const D of j)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]),$=l.useCallback(()=>T([V,y]),[T,V,y]);l.useEffect(()=>{B&&$()},[B,$]);const{onOpenChange:z,triggerPointerDownPosRef:w}=v;l.useEffect(()=>{if(y){let j={x:0,y:0};const R=M=>{var E,D;j={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=>{j.x<=10&&j.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 j=()=>z(!1);return window.addEventListener("blur",j),window.addEventListener("resize",j),()=>{window.removeEventListener("blur",j),window.removeEventListener("resize",j)}},[z]);const[k,W]=Qr(j=>{const R=I().filter(E=>!E.disabled),O=R.find(E=>E.ref.current===document.activeElement),M=Xr(R,j,O);M&&setTimeout(()=>M.ref.current.focus())}),Q=l.useCallback((j,R,O)=>{const M=!U.current&&!O;(v.value!==void 0&&v.value===R||M)&&(P(j),M&&(U.current=!0))},[v.value]),ne=l.useCallback(()=>y==null?void 0:y.focus(),[y]),G=l.useCallback((j,R,O)=>{const M=!U.current&&!O;(v.value!==void 0&&v.value===R||M)&&Y(j)},[v.value]),ie=n==="popper"?et:Lr,ee=ie===et?{side:u,sideOffset:i,align:p,alignOffset:h,arrowPadding:d,collisionBoundary:f,collisionPadding:g,sticky:x,hideWhenDetached:m,avoidCollisions:b}:{};return e.jsx(Or,{scope:r,content:y,viewport:A,onViewportChange:q,itemRefCallback:Q,selectedItem:V,onItemLeave:ne,itemTextRefCallback:G,focusSelectedItem:$,selectedItemText:J,position:n,isPositioned:B,searchRef:k,children:e.jsx(It,{as:ma,allowPinchZoom:!0,children:e.jsx(Ot,{asChild:!0,trapped:v.open,onMountAutoFocus:j=>{j.preventDefault()},onUnmountAutoFocus:C(s,j=>{var R;(R=v.trigger)==null||R.focus({preventScroll:!0}),j.preventDefault()}),children:e.jsx(At,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:c,onFocusOutside:j=>j.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:e.jsx(ie,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:j=>j.preventDefault(),...S,...ee,onPlaced:()=>K(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...S.style},onKeyDown:C(S.onKeyDown,j=>{const R=j.ctrlKey||j.altKey||j.metaKey;if(j.key==="Tab"&&j.preventDefault(),!R&&j.key.length===1&&W(j.key),["ArrowUp","ArrowDown","Home","End"].includes(j.key)){let M=I().filter(E=>!E.disabled).map(E=>E.ref.current);if(["ArrowUp","End"].includes(j.key)&&(M=M.slice().reverse()),["ArrowUp","ArrowDown"].includes(j.key)){const E=j.target,D=M.indexOf(E);M=M.slice(D+1)}setTimeout(()=>T(M)),j.preventDefault()}})})})})})})});Ar.displayName=pa;var ha="SelectItemAlignedPosition",Lr=l.forwardRef((t,o)=>{const{__scopeSelect:r,onPlaced:n,...s}=t,a=he(be,r),c=fe(be,r),[u,i]=l.useState(null),[p,h]=l.useState(null),d=X(o,_=>h(_)),f=ze(r),g=l.useRef(!1),x=l.useRef(!0),{viewport:m,selectedItem:b,selectedItemText:S,focusSelectedItem:v}=c,y=l.useCallback(()=>{if(a.trigger&&a.valueNode&&u&&p&&m&&b&&S){const _=a.trigger.getBoundingClientRect(),V=p.getBoundingClientRect(),P=a.valueNode.getBoundingClientRect(),J=S.getBoundingClientRect();if(a.dir!=="rtl"){const E=J.left-V.left,D=P.left-E,se=_.left-D,ce=_.width+se,L=Math.max(ce,V.width),ue=window.innerWidth-oe,Ce=vt(D,[oe,Math.max(oe,ue-L)]);u.style.minWidth=ce+"px",u.style.left=Ce+"px"}else{const E=V.right-J.right,D=window.innerWidth-P.right-E,se=window.innerWidth-_.right-D,ce=_.width+se,L=Math.max(ce,V.width),ue=window.innerWidth-oe,Ce=vt(D,[oe,Math.max(oe,ue-L)]);u.style.minWidth=ce+"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),$=parseInt(K.borderBottomWidth,10),z=parseInt(K.paddingBottom,10),w=U+T+B+z+$,k=Math.min(b.offsetHeight*5,w),W=window.getComputedStyle(m),Q=parseInt(W.paddingTop,10),ne=parseInt(W.paddingBottom,10),G=_.top+_.height/2-oe,ie=I-G,ee=b.offsetHeight/2,j=b.offsetTop+ee,R=U+T+j,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,se=Math.max(ie,ee+(E?ne:0)+D+$),ce=R+se;u.style.height=ce+"px"}else{const E=Y.length>0&&b===Y[0].ref.current;u.style.top="0px";const se=Math.max(G,U+m.offsetTop+(E?Q:0)+ee)+O;u.style.height=se+"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,a.trigger,a.valueNode,u,p,m,b,S,a.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(ga,{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,{...s,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});Lr.displayName=ha;var fa="SelectPopperPosition",et=l.forwardRef((t,o)=>{const{__scopeSelect:r,align:n="start",collisionPadding:s=oe,...a}=t,c=Ge(r);return e.jsx(Lt,{...c,...a,ref:o,align:n,collisionPadding:s,style:{boxSizing:"border-box",...a.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)"}})});et.displayName=fa;var[ga,ft]=Se(be,{}),tt="SelectViewport",Fr=l.forwardRef((t,o)=>{const{__scopeSelect:r,nonce:n,...s}=t,a=fe(tt,r),c=ft(tt,r),u=X(o,a.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(He.Slot,{scope:r,children:e.jsx(H.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:C(s.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),S=Math.max(m,b);if(S<x){const v=S+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})})})]})});Fr.displayName=tt;var $r="SelectGroup",[xa,va]=Se($r),ba=l.forwardRef((t,o)=>{const{__scopeSelect:r,...n}=t,s=Pe();return e.jsx(xa,{scope:r,id:s,children:e.jsx(H.div,{role:"group","aria-labelledby":s,...n,ref:o})})});ba.displayName=$r;var Vr="SelectLabel",ya=l.forwardRef((t,o)=>{const{__scopeSelect:r,...n}=t,s=va(Vr,r);return e.jsx(H.div,{id:s.id,...n,ref:o})});ya.displayName=Vr;var Fe="SelectItem",[wa,Br]=Se(Fe),Kr=l.forwardRef((t,o)=>{const{__scopeSelect:r,value:n,disabled:s=!1,textValue:a,...c}=t,u=he(Fe,r),i=fe(Fe,r),p=u.value===n,[h,d]=l.useState(a??""),[f,g]=l.useState(!1),x=X(o,v=>{var y;return(y=i.itemRefCallback)==null?void 0:y.call(i,v,n,s)}),m=Pe(),b=l.useRef("touch"),S=()=>{s||(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(wa,{scope:r,value:n,disabled:s,textId:m,isSelected:p,onItemTextChange:l.useCallback(v=>{d(y=>y||((v==null?void 0:v.textContent)??"").trim())},[]),children:e.jsx(He.ItemSlot,{scope:r,value:n,disabled:s,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":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?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"&&S()}),onPointerUp:C(c.onPointerUp,()=>{b.current==="mouse"&&S()}),onPointerDown:C(c.onPointerDown,v=>{b.current=v.pointerType}),onPointerMove:C(c.onPointerMove,v=>{var y;b.current=v.pointerType,s?(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===" "||(sa.includes(v.key)&&S(),v.key===" "&&v.preventDefault())})})})})});Kr.displayName=Fe;var Me="SelectItemText",Ur=l.forwardRef((t,o)=>{const{__scopeSelect:r,className:n,style:s,...a}=t,c=he(Me,r),u=fe(Me,r),i=Br(Me,r),p=ca(Me,r),[h,d]=l.useState(null),f=X(o,S=>d(S),i.onItemTextChange,S=>{var v;return(v=u.itemTextRefCallback)==null?void 0:v.call(u,S,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,...a,ref:f}),i.isSelected&&c.valueNode&&!c.valueNodeHasChildren?Bt.createPortal(a.children,c.valueNode):null]})});Ur.displayName=Me;var Hr="SelectItemIndicator",zr=l.forwardRef((t,o)=>{const{__scopeSelect:r,...n}=t;return Br(Hr,r).isSelected?e.jsx(H.span,{"aria-hidden":!0,...n,ref:o}):null});zr.displayName=Hr;var rt="SelectScrollUpButton",Gr=l.forwardRef((t,o)=>{const r=fe(rt,t.__scopeSelect),n=ft(rt,t.__scopeSelect),[s,a]=l.useState(!1),c=X(o,n.onScrollButtonChange);return pe(()=>{if(r.viewport&&r.isPositioned){let u=function(){const p=i.scrollTop>0;a(p)};const i=r.viewport;return u(),i.addEventListener("scroll",u),()=>i.removeEventListener("scroll",u)}},[r.viewport,r.isPositioned]),s?e.jsx(qr,{...t,ref:c,onAutoScroll:()=>{const{viewport:u,selectedItem:i}=r;u&&i&&(u.scrollTop=u.scrollTop-i.offsetHeight)}}):null});Gr.displayName=rt;var ot="SelectScrollDownButton",Wr=l.forwardRef((t,o)=>{const r=fe(ot,t.__scopeSelect),n=ft(ot,t.__scopeSelect),[s,a]=l.useState(!1),c=X(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;a(h)};const i=r.viewport;return u(),i.addEventListener("scroll",u),()=>i.removeEventListener("scroll",u)}},[r.viewport,r.isPositioned]),s?e.jsx(qr,{...t,ref:c,onAutoScroll:()=>{const{viewport:u,selectedItem:i}=r;u&&i&&(u.scrollTop=u.scrollTop+i.offsetHeight)}}):null});Wr.displayName=ot;var qr=l.forwardRef((t,o)=>{const{__scopeSelect:r,onAutoScroll:n,...s}=t,a=fe("SelectScrollButton",r),c=l.useRef(null),u=ze(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,...s,ref:o,style:{flexShrink:0,...s.style},onPointerDown:C(s.onPointerDown,()=>{c.current===null&&(c.current=window.setInterval(n,50))}),onPointerMove:C(s.onPointerMove,()=>{var p;(p=a.onItemLeave)==null||p.call(a),c.current===null&&(c.current=window.setInterval(n,50))}),onPointerLeave:C(s.onPointerLeave,()=>{i()})})}),ja="SelectSeparator",Sa=l.forwardRef((t,o)=>{const{__scopeSelect:r,...n}=t;return e.jsx(H.div,{"aria-hidden":!0,...n,ref:o})});Sa.displayName=ja;var nt="SelectArrow",Ca=l.forwardRef((t,o)=>{const{__scopeSelect:r,...n}=t,s=Ge(r),a=he(nt,r),c=fe(nt,r);return a.open&&c.position==="popper"?e.jsx(Ft,{...s,...n,ref:o}):null});Ca.displayName=nt;var Na="SelectBubbleInput",Jr=l.forwardRef(({__scopeSelect:t,value:o,...r},n)=>{const s=l.useRef(null),a=X(n,s),c=Zo(o);return l.useEffect(()=>{const u=s.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:{...co,...r.style},ref:a,defaultValue:o})});Jr.displayName=Na;function Yr(t){return t===""||t===void 0}function Qr(t){const o=at(t),r=l.useRef(""),n=l.useRef(0),s=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]),a=l.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return l.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,s,a]}function Xr(t,o,r){const s=o.length>1&&Array.from(o).every(p=>p===o[0])?o[0]:o,a=r?t.indexOf(r):-1;let c=_a(t,Math.max(a,0));s.length===1&&(c=c.filter(p=>p!==r));const i=c.find(p=>p.textValue.toLowerCase().startsWith(s.toLowerCase()));return i!==r?i:void 0}function _a(t,o){return t.map((r,n)=>t[(o+n)%t.length])}var Ma=Mr,Pa=Tr,Ta=Er,Ra=Dr,Ea=Ir,Da=kr,Ia=Fr,ka=Kr,Oa=Ur,Aa=zr,La=Gr,Fa=Wr;function $a({...t}){return e.jsx(Ma,{"data-slot":"select",...t})}function Va({...t}){return e.jsx(Ta,{"data-slot":"select-value",...t})}function Ba({className:t,size:o="default",children:r,...n}){return e.jsxs(Pa,{"data-slot":"select-trigger","data-size":o,className:le("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(Ra,{asChild:!0,children:e.jsx(Kt,{className:"size-4 opacity-50"})})]})}function Ka({className:t,children:o,position:r="popper",...n}){return e.jsx(Ea,{children:e.jsxs(Da,{"data-slot":"select-content",className:le("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(Ha,{}),e.jsx(Ia,{className:le("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(za,{})]})})}function Ua({className:t,children:o,...r}){return e.jsxs(ka,{"data-slot":"select-item",className:le("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(Aa,{children:e.jsx(Qo,{className:"size-4"})})}),e.jsx(Oa,{children:o})]})}function Ha({className:t,...o}){return e.jsx(La,{"data-slot":"select-scroll-up-button",className:le("flex cursor-default items-center justify-center py-1",t),...o,children:e.jsx(mn,{className:"size-4"})})}function za({className:t,...o}){return e.jsx(Fa,{"data-slot":"select-scroll-down-button",className:le("flex cursor-default items-center justify-center py-1",t),...o,children:e.jsx(Kt,{className:"size-4"})})}const Ga=[10,20,50,100];function Wa({currentPage:t,hasNextPage:o,onPrevPage:r,onNextPage:n,isLoading:s,currentLogCount:a,pageSize:c=20,onPageSizeChange:u,totalPages:i,onGoToFirstPage:p,onGoToLastPage:h}){const d=p&&h,f=u;return e.jsxs(qo,{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:a>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(de,{variant:"secondary",className:"text-xs",children:"More available"})]}):e.jsx(e.Fragment,{children:!s&&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($a,{value:c.toString(),onValueChange:g=>u(parseInt(g)),disabled:s,children:[e.jsx(Ba,{className:"h-8 w-16",children:e.jsx(Va,{})}),e.jsx(Ka,{children:Ga.map(g=>e.jsx(Ua,{value:g.toString(),children:g},g))})]})]}),e.jsxs("div",{className:"text-sm text-gray-600 font-medium",children:["Showing ",a," ",a===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(F,{variant:"outline",size:"sm",onClick:p,disabled:t===0||s,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(fn,{className:"h-4 w-4"})}),e.jsxs(F,{variant:"outline",size:"sm",onClick:r,disabled:t===0||s,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($o,{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(F,{variant:"outline",size:"sm",onClick:n,disabled:!o||s,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(Ht,{className:"h-4 w-4 ml-1"})]}),d&&i&&e.jsx(F,{variant:"outline",size:"sm",onClick:h,disabled:!o||s,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(xn,{className:"h-4 w-4"})})]})]})}const qa=["error","warn","info","debug","trace"];function Ja({open:t,onOpenChange:o,filters:r,onApply:n,onReset:s,projectId:a}){const[c,u]=l.useState(r),[i,p]=l.useState(""),[h,d]=l.useState("");uo.useEffect(()=>{u(r)},[r,t]);const f=(m,b)=>{u(S=>({...S,levels:b?[...S.levels,m]:S.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((S,v)=>v!==m)}))};return e.jsx(en,{open:t,onOpenChange:o,children:e.jsxs(tn,{className:"max-w-lg",children:[e.jsx(rn,{children:e.jsxs(on,{className:"flex items-center gap-2",children:[e.jsx(lt,{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:qa.map(m=>e.jsx(F,{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(F,{onClick:g,disabled:!i||!h,children:"Add"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:c.metadata.map((m,b)=>e.jsxs(de,{variant:"secondary",className:"pl-2 flex items-center gap-1",children:[e.jsxs("span",{className:"font-semibold",children:[m.key,":"]})," ",m.value,e.jsx(F,{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(Vt,{className:"h-3 w-3"})})]},b))})]})]}),e.jsxs(nn,{className:"mt-6 flex gap-2",children:[e.jsx(F,{variant:"outline",onClick:s,children:"Reset"}),e.jsx(F,{onClick:()=>n(c),variant:"default",children:"Apply"})]})]})})}var Je={exports:{}},Ye,jt;function Ya(){if(jt)return Ye;jt=1;var t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Ye=t,Ye}var Qe,St;function Qa(){if(St)return Qe;St=1;var t=Ya();function o(){}function r(){}return r.resetWarningCache=o,Qe=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 s(){return n}var a={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:s,element:n,elementType:n,instanceOf:s,node:n,objectOf:s,oneOf:s,oneOfType:s,shape:s,exact:s,checkPropTypes:r,resetWarningCache:o};return a.PropTypes=a,a},Qe}var Ct;function Xa(){return Ct||(Ct=1,Je.exports=Qa()()),Je.exports}var re,Nt;function Za(){if(Nt)return re;Nt=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},s=n(Xa()),a=n(po());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,S=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")),a.createElement("div",o({},B,{dangerouslySetInnerHTML:{__html:'<pre class="__json-pretty-error__"'+u("error",y,K)+">"+p(U)+"</pre>"}}))}return a.createElement("div",o({},B,{dangerouslySetInnerHTML:{__html:'<pre class="'+v+'"'+u("main",y,K)+">"+this._pretty(y,U,b,+S,K)+"</pre>"}}))},f.prototype._pretty=function(g,x,m,b,S){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,S))},f.prototype._replace=function(g,x,m,b,S,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 S&&(P=P+'"'+A+S.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:s.any,json:s.any,replacer:s.func,silent:s.bool,space:s.oneOfType([s.number,s.string]),theme:s.object,themeClassName:s.string,onJSONPrettyError:s.func},f.defaultProps={data:"",json:"",silent:!0,space:2,themeClassName:"__json-pretty__"},f}(a.Component);return re=h,re}var el=Za();const tl=mo(el),rl=t=>{try{const o=JSON.parse(t);if(o&&typeof o=="object")return o}catch{}return!1};function ol({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"}},s=()=>{const i=`[${new Date(r.timestamp).toLocaleString()}] [${r.level.toUpperCase()}] ${r.message}`;navigator.clipboard.writeText(i).then(()=>ae.success("Log copied to clipboard")).catch(()=>ae.error("Failed to copy to clipboard"))},a=()=>{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(()=>ae.success("Metadata copied to clipboard")).catch(()=>ae.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(ho,{open:t,onOpenChange:o,children:e.jsxs(fo,{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(go,{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(de,{className:`${n(r.level)} px-3 py-1.5 rounded-full font-semibold transition-all duration-200`,children:r.level.toUpperCase()}),e.jsx(xo,{className:"text-gray-900 font-bold",children:"Log Details"})]}),e.jsx(vo,{className:"text-gray-700 font-medium",children:new Date(r.timestamp).toLocaleString()})]}),e.jsx(Vo,{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(F,{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(Oe,{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(F,{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(Oe,{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"?rl(i.value):!1,d=typeof i.value=="string"?c(i.value):!1;return e.jsxs(bo,{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(yo,{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(Sn,{className:"h-4 w-4 text-gray-500"})]}),e.jsxs(wo,{children:[e.jsx(jo,{}),e.jsxs("div",{className:le("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(tl,{data:h,themeClassName:"__json-pretty__"}):i.value,d&&e.jsxs(F,{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(bn,{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(So,{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(F,{variant:"outline",onClick:s,className:"mr-auto hover:bg-blue-50 hover:border-blue-300 transition-all duration-200",children:[e.jsx(Oe,{className:"h-4 w-4 mr-2"}),"Copy Log"]}),e.jsx(F,{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 nl(t){const[o,r]=l.useState(void 0),[n,s]=l.useState([]),[a,c]=l.useState(0),u=l.useCallback(h=>{h&&(s(d=>{const f=[...d.slice(0,a+1)];return o?f.push(o):a===0&&d.length===0&&f.push({id:"initial",timestamp:new Date().toISOString()}),f}),r(h),c(d=>d+1))},[a,o]),i=l.useCallback(()=>{if(a>0){const h=a>1?n[a-1]:void 0;r(h),c(d=>d-1),s(d=>d.slice(0,a))}},[a,n]),p=l.useCallback(()=>{r(void 0),s([]),c(0)},[]);return{cursor:o,currentPage:a,paginationHistory:n,handleNextPage:u,handlePrevPage:i,resetPagination:p,setCurrentPage:c,setCursor:r}}const sl=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"}},al=({selectedLogs:t,onSelectAll:o,onSelectRow:r,onOpenDetailSheet:n,currentLogs:s})=>[{id:"select",header:()=>e.jsx(bt,{checked:s&&s.length>0&&s.every(a=>t[a.id]),onCheckedChange:a=>o(!!a),"aria-label":"Select all rows on current page"}),cell:({row:a})=>e.jsx(bt,{checked:!!t[a.original.id],onCheckedChange:c=>r(a.original.id,!!c),"aria-label":"Select row"}),enableSorting:!1,enableHiding:!1,size:40},{accessorKey:"timestamp",header:"Timestamp",cell:a=>{const c=new Date(a.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:a=>{const c=a.getValue(),u=sl(c);return e.jsx(de,{className:`${u} font-semibold px-3 py-1 rounded-full border-0 transition-all duration-200`,children:c.toUpperCase()})}},{accessorKey:"message",header:"Message",cell:a=>e.jsx("div",{className:"font-mono text-sm whitespace-pre-wrap max-w-xl py-2 text-gray-800 leading-relaxed",children:a.getValue()})},{accessorKey:"metadata",header:"Metadata",cell:a=>{const c=a.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:a})=>{const c=a.original;return e.jsx(F,{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(Ht,{className:"h-4 w-4 text-gray-600 group-hover:text-blue-600 transition-colors"})})},size:50}],ll=500,_t=20;function il({projectId:t}){const{searchQuery:o,inputValue:r,setSearchQuery:n,filterModalOpen:s,openFilterModal:a,setFilterModalOpen:c,filters:u,handleApplyFilters:i,handleResetFilters:p,filtersActive:h}=_n({debounceTimeout:ll}),{sortDirection:d,sorting:f,handleToggleSortDirection:g,setSorting:x,resetSort:m}=Pn("desc"),{cursor:b,currentPage:S,handleNextPage:v,handlePrevPage:y,resetPagination:N}=nl(),{isDetailSheetOpen:A,currentLogDetail:q,openDetailSheet:_,setIsDetailSheetOpen:V}=Tn(),[P,J]=l.useState([]),Y={limit:_t,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}=Cn(t,Y),$=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:Q,handleSelectRow:ne,resetSelection:G}=Mn($),ie=l.useCallback(L=>{i(L),N(),G()},[i,N,G]),ee=l.useCallback(()=>{p(),N(),m(),G()},[p,N,m,G]),j=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(ue=>k[ue]);ae.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(ue=>k[ue]);ae.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=$.filter(ge=>L.includes(ge.id)).map(ge=>`[${new Date(ge.timestamp).toLocaleString()}] [${ge.level.toUpperCase()}] ${ge.message}`).join(`
`);navigator.clipboard.writeText(Ce).then(()=>{ae.success(`Copied ${L.length} logs to clipboard`)}).catch(()=>{ae.error("Failed to copy logs to clipboard")})},se=l.useMemo(()=>al({selectedLogs:k,onSelectAll:L=>Q(L),onSelectRow:ne,onOpenDetailSheet:_,currentLogs:$}),[k,Q,ne,_,$]),ce=Bo({data:$,columns:se,getCoreRowModel:Ho(),getSortedRowModel:Uo(),getFilteredRowModel:Ko(),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(Ja,{open:s,onOpenChange:c,filters:u,onApply:ie,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(Rn,{filters:u,sortDirection:d,onOpenFilterModal:a,onToggleSortDirection:j,displayedLogCount:B?void 0:$.length,isLoading:B}),e.jsx(Zs,{searchQuery:r,onSearchQueryChange:n,onOpenFilterModal:a,selectedCount:W,onDeleteSelected:M,onExportSelected:E,onCopySelected:D,isLoading:B}),e.jsx(oa,{table:ce,columns:se,isLoading:B,isError:K,logs:$,selectedLogs:k,isFiltered:h||!!o,onRetry:()=>{N(),U()},onClearFilters:ee}),e.jsx(Wa,{currentPage:S,hasNextPage:z,onPrevPage:O,onNextPage:R,isLoading:B,currentLogCount:$.length,pageSize:_t})]}),e.jsx(ol,{open:A,onOpenChange:V,log:q})]})}function cl({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(Co,{className:"h-3 w-3"})}),"Log Statistics"]})}),e.jsx(je,{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(Ut,{className:"h-3 w-3"})}),"Error Summary"]})}),e.jsx(je,{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(an,{className:"h-3 w-3"})}),"Activity"]})}),e.jsx(je,{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(de,{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 dl({projectId:t}){const{data:o,isLoading:r,isError:n}=Mo(t),{data:s,isLoading:a}=zo(t),c=Nn(),[u,i]=l.useState(!1),{editModalOpen:p,setEditModalOpen:h,deleteDialogOpen:d,setDeleteDialogOpen:f,autoRefresh:g,setAutoRefresh:x,handleRefresh:m,handleDeleteProject:b,handleConfirmDelete:S,handleEditProject:v,handleEditSubmit:y,updateProject:N,deleteProject:A}=Po(t),q=()=>{i(!0)},_=()=>{c.mutate(t,{onSuccess:()=>{i(!1)}})},V=r||a;return l.useEffect(()=>{if(!g)return;const P=setInterval(()=>{m()},5e3);return()=>clearInterval(P)},[g,t,m]),t?r?e.jsx(Ro,{}):n||!o?e.jsx(Eo,{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(Do,{project:o,isRefreshing:V,autoRefresh:g,onAutoRefreshChange:x,onEdit:v,onDelete:b,onRefresh:m}),e.jsx(cl,{metrics:s,isLoadingMetrics:a}),e.jsx(Io,{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.jsxs("div",{className:"flex justify-between items-center mb-6",children:[e.jsx("h2",{className:"text-2xl font-bold text-gray-900",children:"Project Logs"}),e.jsxs(F,{variant:"outline",size:"sm",onClick:q,className:"transition-all hover:border-orange-500/50 hover:bg-orange-50 text-orange-600 hover:text-orange-700",children:[e.jsx(No,{className:"h-4 w-4 mr-2"}),"Clear All Logs"]})]}),e.jsx(il,{projectId:o.id})]})]})}),e.jsx(sn,{open:p,onOpenChange:h,initialData:o?{name:o.name,description:o.description}:void 0,onSubmit:y,loading:N.isPending,mode:"edit"}),e.jsx(yt,{open:d,onOpenChange:f,title:"Delete Project?",description:"This will permanently delete the project and all its logs. This action cannot be undone.",onConfirm:S,loading:A.isPending,confirmLabel:"Delete"}),e.jsx(yt,{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(To,{})}const Nl=()=>{const{projectId:t}=_o.useParams();return e.jsx(dl,{projectId:t})};export{Nl as component};
