import{c as me,r as v,g as va,q as xa,s as ya,j as s,A as le,k as O,S as $e,B as A,y as ba,T as wa,f as U,z as mt,D as ft,G as ht,p as ke,H as gt,J as vt,K as xt,M as ja,t as ve,N as Na}from"./index-zgZmtGWP.js";import{C as pa,e as _e,f as It,u as Da,a as Ma,P as Ca,b as ka,c as Sa,d as _a,Q as Pa}from"./QuickAccessCards-Di9HhdMM.js";import{F as Ta,D as Oa,T as Fa,a as Wa,b as pe,c as Ea,f as We,d as Ya,e as Ee,C as At,g as Ve,S as La,u as Ra,h as Ia,i as Aa,j as Ha,k as Ba,l as $a}from"./scroll-area-BJr-369G.js";import{C as qe,a as yt,b as bt,d as wt}from"./card-DPbDbxNS.js";import{R as Ht}from"./switch-DMndCyaK.js";import{I as ze,L as G}from"./label-CMBNwj5B.js";import{S as Va}from"./search-BLT648Bh.js";import{S as qa}from"./skeleton-Dk9Mx5Ct.js";import{D as za,a as Xa,b as Qa,c as Ga,d as Ka,e as Ua,P as Ja,C as jt}from"./ConfirmDialog-BXch8StB.js";import{C as Za}from"./circle-x-CsUhHc1P.js";import{Z as en}from"./zap-Bq46snSY.js";import"./index-HlQ3xtPA.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 tn=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],an=me("CircleCheckBig",tn);/**
 * @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 nn=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Nt=me("CircleCheck",nn);/**
 * @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 rn=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],sn=me("Database",rn);/**
 * @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 on=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],ln=me("Eye",on);/**
 * @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 cn=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],pt=me("Hash",cn);/**
 * @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=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],un=me("Timer",dn);function mn(e,a=500){const[t,n]=v.useState(e);return v.useEffect(()=>{const r=setTimeout(()=>{n(e)},a);return()=>{clearTimeout(r)}},[e,a]),t}function fn(e,a){return{...va({queryKey:xa.traces.byProjectWithOptions(e,a),queryFn:()=>ya.traces.getByProjectId(e,a),enabled:!!e})}}function hn({debounceTimeout:e=500}={}){const[a,t]=v.useState(""),[n,r]=v.useState(!1),[o,i]=v.useState({status:[]}),l=mn(a,e),c=v.useMemo(()=>o.status.length>0||!!o.fromDate||!!o.toDate||o.minDuration!==void 0||o.maxDuration!==void 0,[o]),u=v.useCallback(()=>{r(!0)},[]),d=v.useCallback(m=>{i(m),r(!1)},[]),f=v.useCallback(()=>{i({status:[]}),t(""),r(!1)},[]);return{searchQuery:l,inputValue:a,setSearchQuery:t,filterModalOpen:n,openFilterModal:u,setFilterModalOpen:r,filters:o,handleApplyFilters:d,handleResetFilters:f,filtersActive:c}}function gn(e){const[a,t]=v.useState({}),n=v.useMemo(()=>Object.values(a).filter(Boolean).length,[a]),r=v.useCallback(l=>{if(l){const c={};e.forEach(u=>{c[u.id]=!0}),t(c)}else t({})},[e]),o=v.useCallback((l,c)=>{t(u=>({...u,[l]:c}))},[]),i=v.useCallback(()=>{t({})},[]);return{selectedTraces:a,selectedCount:n,handleSelectAll:r,handleSelectRow:o,resetSelection:i}}function vn(e="desc"){const[a,t]=v.useState(e),[n,r]=v.useState([{id:"startTime",desc:e==="desc"}]),o=v.useCallback(()=>{const l=a==="desc"?"asc":"desc";t(l),r([{id:"startTime",desc:l==="desc"}])},[a]),i=v.useCallback(()=>{t(e),r([{id:"startTime",desc:e==="desc"}])},[e]);return{sortDirection:a,sorting:n,handleToggleSortDirection:o,setSorting:r,resetSort:i}}function xn(){const[e,a]=v.useState(!1),[t,n]=v.useState(null),r=v.useCallback(i=>{n(i),a(!0)},[]),o=v.useCallback(()=>{a(!1),n(null)},[]);return{isDetailSheetOpen:e,currentTraceDetail:t,openDetailSheet:r,closeDetailSheet:o,setIsDetailSheetOpen:a}}const Ge=6048e5,yn=864e5,De=43200,Dt=1440,Mt=Symbol.for("constructDateFrom");function T(e,a){return typeof e=="function"?e(a):e&&typeof e=="object"&&Mt in e?e[Mt](a):e instanceof Date?new e.constructor(a):new Date(a)}function D(e,a){return T(a||e,e)}function F(e,a,t){const n=D(e,t==null?void 0:t.in);return isNaN(a)?T((t==null?void 0:t.in)||e,NaN):(a&&n.setDate(n.getDate()+a),n)}function H(e,a,t){const n=D(e,t==null?void 0:t.in);if(isNaN(a))return T((t==null?void 0:t.in)||e,NaN);if(!a)return n;const r=n.getDate(),o=T((t==null?void 0:t.in)||e,n.getTime());o.setMonth(n.getMonth()+a+1,0);const i=o.getDate();return r>=i?o:(n.setFullYear(o.getFullYear(),o.getMonth(),r),n)}let bn={};function fe(){return bn}function V(e,a){var l,c,u,d;const t=fe(),n=(a==null?void 0:a.weekStartsOn)??((c=(l=a==null?void 0:a.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??t.weekStartsOn??((d=(u=t.locale)==null?void 0:u.options)==null?void 0:d.weekStartsOn)??0,r=D(e,a==null?void 0:a.in),o=r.getDay(),i=(o<n?7:0)+o-n;return r.setDate(r.getDate()-i),r.setHours(0,0,0,0),r}function se(e,a){return V(e,{...a,weekStartsOn:1})}function Bt(e,a){const t=D(e,a==null?void 0:a.in),n=t.getFullYear(),r=T(t,0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);const o=se(r),i=T(t,0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);const l=se(i);return t.getTime()>=o.getTime()?n+1:t.getTime()>=l.getTime()?n:n-1}function ce(e){const a=D(e),t=new Date(Date.UTC(a.getFullYear(),a.getMonth(),a.getDate(),a.getHours(),a.getMinutes(),a.getSeconds(),a.getMilliseconds()));return t.setUTCFullYear(a.getFullYear()),+e-+t}function J(e,...a){const t=T.bind(null,e||a.find(n=>typeof n=="object"));return a.map(t)}function de(e,a){const t=D(e,a==null?void 0:a.in);return t.setHours(0,0,0,0),t}function $(e,a,t){const[n,r]=J(t==null?void 0:t.in,e,a),o=de(n),i=de(r),l=+o-ce(o),c=+i-ce(i);return Math.round((l-c)/yn)}function wn(e,a){const t=Bt(e,a),n=T(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),se(n)}function Xe(e,a,t){return F(e,a*7,t)}function jn(e,a,t){return H(e,a*12,t)}function Nn(e,a){let t,n=a==null?void 0:a.in;return e.forEach(r=>{!n&&typeof r=="object"&&(n=T.bind(null,r));const o=D(r,n);(!t||t<o||isNaN(+o))&&(t=o)}),T(n,t||NaN)}function pn(e,a){let t,n=a==null?void 0:a.in;return e.forEach(r=>{!n&&typeof r=="object"&&(n=T.bind(null,r));const o=D(r,n);(!t||t>o||isNaN(+o))&&(t=o)}),T(n,t||NaN)}function Me(e,a){const t=+D(e)-+D(a);return t<0?-1:t>0?1:t}function Dn(e){return T(e,Date.now())}function E(e,a,t){const[n,r]=J(t==null?void 0:t.in,e,a);return+de(n)==+de(r)}function Ke(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function Mn(e){return!(!Ke(e)&&typeof e!="number"||isNaN(+D(e)))}function ue(e,a,t){const[n,r]=J(t==null?void 0:t.in,e,a),o=n.getFullYear()-r.getFullYear(),i=n.getMonth()-r.getMonth();return o*12+i}function Cn(e,a,t){const[n,r]=J(t==null?void 0:t.in,e,a),o=V(n,t),i=V(r,t),l=+o-ce(o),c=+i-ce(i);return Math.round((l-c)/Ge)}function kn(e){return a=>{const n=(e?Math[e]:Math.trunc)(a);return n===0?0:n}}function Sn(e,a){return+D(e)-+D(a)}function _n(e,a){const t=D(e,a==null?void 0:a.in);return t.setHours(23,59,59,999),t}function Pe(e,a){const t=D(e,a==null?void 0:a.in),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function Pn(e,a){const t=D(e,a==null?void 0:a.in);return+_n(t,a)==+Pe(t,a)}function Tn(e,a,t){const[n,r,o]=J(t==null?void 0:t.in,e,e,a),i=Me(r,o),l=Math.abs(ue(r,o));if(l<1)return 0;r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-i*l);let c=Me(r,o)===-i;Pn(n)&&l===1&&Me(n,o)===1&&(c=!1);const u=i*(l-+c);return u===0?0:u}function On(e,a,t){const n=Sn(e,a)/1e3;return kn(t==null?void 0:t.roundingMethod)(n)}function Y(e,a){const t=D(e,a==null?void 0:a.in);return t.setDate(1),t.setHours(0,0,0,0),t}function $t(e,a){const t=D(e,a==null?void 0:a.in);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}function Ue(e,a){var l,c,u,d;const t=fe(),n=(a==null?void 0:a.weekStartsOn)??((c=(l=a==null?void 0:a.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??t.weekStartsOn??((d=(u=t.locale)==null?void 0:u.options)==null?void 0:d.weekStartsOn)??0,r=D(e,a==null?void 0:a.in),o=r.getDay(),i=(o<n?-7:0)+6-(o-n);return r.setDate(r.getDate()+i),r.setHours(23,59,59,999),r}function Vt(e,a){return Ue(e,{...a,weekStartsOn:1})}const Fn={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Wn=(e,a,t)=>{let n;const r=Fn[e];return typeof r=="string"?n=r:a===1?n=r.one:n=r.other.replace("{{count}}",a.toString()),t!=null&&t.addSuffix?t.comparison&&t.comparison>0?"in "+n:n+" ago":n};function Ye(e){return(a={})=>{const t=a.width?String(a.width):e.defaultWidth;return e.formats[t]||e.formats[e.defaultWidth]}}const En={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Yn={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Ln={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Rn={date:Ye({formats:En,defaultWidth:"full"}),time:Ye({formats:Yn,defaultWidth:"full"}),dateTime:Ye({formats:Ln,defaultWidth:"full"})},In={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},An=(e,a,t,n)=>In[e];function xe(e){return(a,t)=>{const n=t!=null&&t.context?String(t.context):"standalone";let r;if(n==="formatting"&&e.formattingValues){const i=e.defaultFormattingWidth||e.defaultWidth,l=t!=null&&t.width?String(t.width):i;r=e.formattingValues[l]||e.formattingValues[i]}else{const i=e.defaultWidth,l=t!=null&&t.width?String(t.width):e.defaultWidth;r=e.values[l]||e.values[i]}const o=e.argumentCallback?e.argumentCallback(a):a;return r[o]}}const Hn={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Bn={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},$n={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Vn={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},qn={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},zn={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Xn=(e,a)=>{const t=Number(e),n=t%100;if(n>20||n<10)switch(n%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},Qn={ordinalNumber:Xn,era:xe({values:Hn,defaultWidth:"wide"}),quarter:xe({values:Bn,defaultWidth:"wide",argumentCallback:e=>e-1}),month:xe({values:$n,defaultWidth:"wide"}),day:xe({values:Vn,defaultWidth:"wide"}),dayPeriod:xe({values:qn,defaultWidth:"wide",formattingValues:zn,defaultFormattingWidth:"wide"})};function ye(e){return(a,t={})=>{const n=t.width,r=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],o=a.match(r);if(!o)return null;const i=o[0],l=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(l)?Kn(l,f=>f.test(i)):Gn(l,f=>f.test(i));let u;u=e.valueCallback?e.valueCallback(c):c,u=t.valueCallback?t.valueCallback(u):u;const d=a.slice(i.length);return{value:u,rest:d}}}function Gn(e,a){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&a(e[t]))return t}function Kn(e,a){for(let t=0;t<e.length;t++)if(a(e[t]))return t}function Un(e){return(a,t={})=>{const n=a.match(e.matchPattern);if(!n)return null;const r=n[0],o=a.match(e.parsePattern);if(!o)return null;let i=e.valueCallback?e.valueCallback(o[0]):o[0];i=t.valueCallback?t.valueCallback(i):i;const l=a.slice(r.length);return{value:i,rest:l}}}const Jn=/^(\d+)(th|st|nd|rd)?/i,Zn=/\d+/i,er={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},tr={any:[/^b/i,/^(a|c)/i]},ar={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},nr={any:[/1/i,/2/i,/3/i,/4/i]},rr={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},sr={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},or={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},ir={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},lr={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},cr={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},dr={ordinalNumber:Un({matchPattern:Jn,parsePattern:Zn,valueCallback:e=>parseInt(e,10)}),era:ye({matchPatterns:er,defaultMatchWidth:"wide",parsePatterns:tr,defaultParseWidth:"any"}),quarter:ye({matchPatterns:ar,defaultMatchWidth:"wide",parsePatterns:nr,defaultParseWidth:"any",valueCallback:e=>e+1}),month:ye({matchPatterns:rr,defaultMatchWidth:"wide",parsePatterns:sr,defaultParseWidth:"any"}),day:ye({matchPatterns:or,defaultMatchWidth:"wide",parsePatterns:ir,defaultParseWidth:"any"}),dayPeriod:ye({matchPatterns:lr,defaultMatchWidth:"any",parsePatterns:cr,defaultParseWidth:"any"})},Je={code:"en-US",formatDistance:Wn,formatLong:Rn,formatRelative:An,localize:Qn,match:dr,options:{weekStartsOn:0,firstWeekContainsDate:1}};function ur(e,a){const t=D(e,a==null?void 0:a.in);return $(t,$t(t))+1}function qt(e,a){const t=D(e,a==null?void 0:a.in),n=+se(t)-+wn(t);return Math.round(n/Ge)+1}function zt(e,a){var d,f,m,h;const t=D(e,a==null?void 0:a.in),n=t.getFullYear(),r=fe(),o=(a==null?void 0:a.firstWeekContainsDate)??((f=(d=a==null?void 0:a.locale)==null?void 0:d.options)==null?void 0:f.firstWeekContainsDate)??r.firstWeekContainsDate??((h=(m=r.locale)==null?void 0:m.options)==null?void 0:h.firstWeekContainsDate)??1,i=T((a==null?void 0:a.in)||e,0);i.setFullYear(n+1,0,o),i.setHours(0,0,0,0);const l=V(i,a),c=T((a==null?void 0:a.in)||e,0);c.setFullYear(n,0,o),c.setHours(0,0,0,0);const u=V(c,a);return+t>=+l?n+1:+t>=+u?n:n-1}function mr(e,a){var l,c,u,d;const t=fe(),n=(a==null?void 0:a.firstWeekContainsDate)??((c=(l=a==null?void 0:a.locale)==null?void 0:l.options)==null?void 0:c.firstWeekContainsDate)??t.firstWeekContainsDate??((d=(u=t.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??1,r=zt(e,a),o=T((a==null?void 0:a.in)||e,0);return o.setFullYear(r,0,n),o.setHours(0,0,0,0),V(o,a)}function Xt(e,a){const t=D(e,a==null?void 0:a.in),n=+V(t,a)-+mr(t,a);return Math.round(n/Ge)+1}function C(e,a){const t=e<0?"-":"",n=Math.abs(e).toString().padStart(a,"0");return t+n}const K={y(e,a){const t=e.getFullYear(),n=t>0?t:1-t;return C(a==="yy"?n%100:n,a.length)},M(e,a){const t=e.getMonth();return a==="M"?String(t+1):C(t+1,2)},d(e,a){return C(e.getDate(),a.length)},a(e,a){const t=e.getHours()/12>=1?"pm":"am";switch(a){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];case"aaaa":default:return t==="am"?"a.m.":"p.m."}},h(e,a){return C(e.getHours()%12||12,a.length)},H(e,a){return C(e.getHours(),a.length)},m(e,a){return C(e.getMinutes(),a.length)},s(e,a){return C(e.getSeconds(),a.length)},S(e,a){const t=a.length,n=e.getMilliseconds(),r=Math.trunc(n*Math.pow(10,t-3));return C(r,a.length)}},ie={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Ct={G:function(e,a,t){const n=e.getFullYear()>0?1:0;switch(a){case"G":case"GG":case"GGG":return t.era(n,{width:"abbreviated"});case"GGGGG":return t.era(n,{width:"narrow"});case"GGGG":default:return t.era(n,{width:"wide"})}},y:function(e,a,t){if(a==="yo"){const n=e.getFullYear(),r=n>0?n:1-n;return t.ordinalNumber(r,{unit:"year"})}return K.y(e,a)},Y:function(e,a,t,n){const r=zt(e,n),o=r>0?r:1-r;if(a==="YY"){const i=o%100;return C(i,2)}return a==="Yo"?t.ordinalNumber(o,{unit:"year"}):C(o,a.length)},R:function(e,a){const t=Bt(e);return C(t,a.length)},u:function(e,a){const t=e.getFullYear();return C(t,a.length)},Q:function(e,a,t){const n=Math.ceil((e.getMonth()+1)/3);switch(a){case"Q":return String(n);case"QQ":return C(n,2);case"Qo":return t.ordinalNumber(n,{unit:"quarter"});case"QQQ":return t.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return t.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,a,t){const n=Math.ceil((e.getMonth()+1)/3);switch(a){case"q":return String(n);case"qq":return C(n,2);case"qo":return t.ordinalNumber(n,{unit:"quarter"});case"qqq":return t.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return t.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,a,t){const n=e.getMonth();switch(a){case"M":case"MM":return K.M(e,a);case"Mo":return t.ordinalNumber(n+1,{unit:"month"});case"MMM":return t.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return t.month(n,{width:"wide",context:"formatting"})}},L:function(e,a,t){const n=e.getMonth();switch(a){case"L":return String(n+1);case"LL":return C(n+1,2);case"Lo":return t.ordinalNumber(n+1,{unit:"month"});case"LLL":return t.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return t.month(n,{width:"wide",context:"standalone"})}},w:function(e,a,t,n){const r=Xt(e,n);return a==="wo"?t.ordinalNumber(r,{unit:"week"}):C(r,a.length)},I:function(e,a,t){const n=qt(e);return a==="Io"?t.ordinalNumber(n,{unit:"week"}):C(n,a.length)},d:function(e,a,t){return a==="do"?t.ordinalNumber(e.getDate(),{unit:"date"}):K.d(e,a)},D:function(e,a,t){const n=ur(e);return a==="Do"?t.ordinalNumber(n,{unit:"dayOfYear"}):C(n,a.length)},E:function(e,a,t){const n=e.getDay();switch(a){case"E":case"EE":case"EEE":return t.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(n,{width:"short",context:"formatting"});case"EEEE":default:return t.day(n,{width:"wide",context:"formatting"})}},e:function(e,a,t,n){const r=e.getDay(),o=(r-n.weekStartsOn+8)%7||7;switch(a){case"e":return String(o);case"ee":return C(o,2);case"eo":return t.ordinalNumber(o,{unit:"day"});case"eee":return t.day(r,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(r,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(r,{width:"short",context:"formatting"});case"eeee":default:return t.day(r,{width:"wide",context:"formatting"})}},c:function(e,a,t,n){const r=e.getDay(),o=(r-n.weekStartsOn+8)%7||7;switch(a){case"c":return String(o);case"cc":return C(o,a.length);case"co":return t.ordinalNumber(o,{unit:"day"});case"ccc":return t.day(r,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(r,{width:"narrow",context:"standalone"});case"cccccc":return t.day(r,{width:"short",context:"standalone"});case"cccc":default:return t.day(r,{width:"wide",context:"standalone"})}},i:function(e,a,t){const n=e.getDay(),r=n===0?7:n;switch(a){case"i":return String(r);case"ii":return C(r,a.length);case"io":return t.ordinalNumber(r,{unit:"day"});case"iii":return t.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(n,{width:"short",context:"formatting"});case"iiii":default:return t.day(n,{width:"wide",context:"formatting"})}},a:function(e,a,t){const r=e.getHours()/12>=1?"pm":"am";switch(a){case"a":case"aa":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(r,{width:"narrow",context:"formatting"});case"aaaa":default:return t.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(e,a,t){const n=e.getHours();let r;switch(n===12?r=ie.noon:n===0?r=ie.midnight:r=n/12>=1?"pm":"am",a){case"b":case"bb":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(r,{width:"narrow",context:"formatting"});case"bbbb":default:return t.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(e,a,t){const n=e.getHours();let r;switch(n>=17?r=ie.evening:n>=12?r=ie.afternoon:n>=4?r=ie.morning:r=ie.night,a){case"B":case"BB":case"BBB":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(r,{width:"narrow",context:"formatting"});case"BBBB":default:return t.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(e,a,t){if(a==="ho"){let n=e.getHours()%12;return n===0&&(n=12),t.ordinalNumber(n,{unit:"hour"})}return K.h(e,a)},H:function(e,a,t){return a==="Ho"?t.ordinalNumber(e.getHours(),{unit:"hour"}):K.H(e,a)},K:function(e,a,t){const n=e.getHours()%12;return a==="Ko"?t.ordinalNumber(n,{unit:"hour"}):C(n,a.length)},k:function(e,a,t){let n=e.getHours();return n===0&&(n=24),a==="ko"?t.ordinalNumber(n,{unit:"hour"}):C(n,a.length)},m:function(e,a,t){return a==="mo"?t.ordinalNumber(e.getMinutes(),{unit:"minute"}):K.m(e,a)},s:function(e,a,t){return a==="so"?t.ordinalNumber(e.getSeconds(),{unit:"second"}):K.s(e,a)},S:function(e,a){return K.S(e,a)},X:function(e,a,t){const n=e.getTimezoneOffset();if(n===0)return"Z";switch(a){case"X":return St(n);case"XXXX":case"XX":return re(n);case"XXXXX":case"XXX":default:return re(n,":")}},x:function(e,a,t){const n=e.getTimezoneOffset();switch(a){case"x":return St(n);case"xxxx":case"xx":return re(n);case"xxxxx":case"xxx":default:return re(n,":")}},O:function(e,a,t){const n=e.getTimezoneOffset();switch(a){case"O":case"OO":case"OOO":return"GMT"+kt(n,":");case"OOOO":default:return"GMT"+re(n,":")}},z:function(e,a,t){const n=e.getTimezoneOffset();switch(a){case"z":case"zz":case"zzz":return"GMT"+kt(n,":");case"zzzz":default:return"GMT"+re(n,":")}},t:function(e,a,t){const n=Math.trunc(+e/1e3);return C(n,a.length)},T:function(e,a,t){return C(+e,a.length)}};function kt(e,a=""){const t=e>0?"-":"+",n=Math.abs(e),r=Math.trunc(n/60),o=n%60;return o===0?t+String(r):t+String(r)+a+C(o,2)}function St(e,a){return e%60===0?(e>0?"-":"+")+C(Math.abs(e)/60,2):re(e,a)}function re(e,a=""){const t=e>0?"-":"+",n=Math.abs(e),r=C(Math.trunc(n/60),2),o=C(n%60,2);return t+r+a+o}const _t=(e,a)=>{switch(e){case"P":return a.date({width:"short"});case"PP":return a.date({width:"medium"});case"PPP":return a.date({width:"long"});case"PPPP":default:return a.date({width:"full"})}},Qt=(e,a)=>{switch(e){case"p":return a.time({width:"short"});case"pp":return a.time({width:"medium"});case"ppp":return a.time({width:"long"});case"pppp":default:return a.time({width:"full"})}},fr=(e,a)=>{const t=e.match(/(P+)(p+)?/)||[],n=t[1],r=t[2];if(!r)return _t(e,a);let o;switch(n){case"P":o=a.dateTime({width:"short"});break;case"PP":o=a.dateTime({width:"medium"});break;case"PPP":o=a.dateTime({width:"long"});break;case"PPPP":default:o=a.dateTime({width:"full"});break}return o.replace("{{date}}",_t(n,a)).replace("{{time}}",Qt(r,a))},hr={p:Qt,P:fr},gr=/^D+$/,vr=/^Y+$/,xr=["D","DD","YY","YYYY"];function yr(e){return gr.test(e)}function br(e){return vr.test(e)}function wr(e,a,t){const n=jr(e,a,t);if(console.warn(n),xr.includes(e))throw new RangeError(n)}function jr(e,a,t){const n=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${a}\`) for formatting ${n} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Nr=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,pr=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Dr=/^'([^]*?)'?$/,Mr=/''/g,Cr=/[a-zA-Z]/;function P(e,a,t){var d,f,m,h,g,x,y,p;const n=fe(),r=(t==null?void 0:t.locale)??n.locale??Je,o=(t==null?void 0:t.firstWeekContainsDate)??((f=(d=t==null?void 0:t.locale)==null?void 0:d.options)==null?void 0:f.firstWeekContainsDate)??n.firstWeekContainsDate??((h=(m=n.locale)==null?void 0:m.options)==null?void 0:h.firstWeekContainsDate)??1,i=(t==null?void 0:t.weekStartsOn)??((x=(g=t==null?void 0:t.locale)==null?void 0:g.options)==null?void 0:x.weekStartsOn)??n.weekStartsOn??((p=(y=n.locale)==null?void 0:y.options)==null?void 0:p.weekStartsOn)??0,l=D(e,t==null?void 0:t.in);if(!Mn(l))throw new RangeError("Invalid time value");let c=a.match(pr).map(b=>{const M=b[0];if(M==="p"||M==="P"){const k=hr[M];return k(b,r.formatLong)}return b}).join("").match(Nr).map(b=>{if(b==="''")return{isToken:!1,value:"'"};const M=b[0];if(M==="'")return{isToken:!1,value:kr(b)};if(Ct[M])return{isToken:!0,value:b};if(M.match(Cr))throw new RangeError("Format string contains an unescaped latin alphabet character `"+M+"`");return{isToken:!1,value:b}});r.localize.preprocessor&&(c=r.localize.preprocessor(l,c));const u={firstWeekContainsDate:o,weekStartsOn:i,locale:r};return c.map(b=>{if(!b.isToken)return b.value;const M=b.value;(!(t!=null&&t.useAdditionalWeekYearTokens)&&br(M)||!(t!=null&&t.useAdditionalDayOfYearTokens)&&yr(M))&&wr(M,a,String(e));const k=Ct[M[0]];return k(l,M,r.localize,u)}).join("")}function kr(e){const a=e.match(Dr);return a?a[1].replace(Mr,"'"):e}function Sr(e,a,t){const n=fe(),r=(t==null?void 0:t.locale)??n.locale??Je,o=2520,i=Me(e,a);if(isNaN(i))throw new RangeError("Invalid time value");const l=Object.assign({},t,{addSuffix:t==null?void 0:t.addSuffix,comparison:i}),[c,u]=J(t==null?void 0:t.in,...i>0?[a,e]:[e,a]),d=On(u,c),f=(ce(u)-ce(c))/1e3,m=Math.round((d-f)/60);let h;if(m<2)return t!=null&&t.includeSeconds?d<5?r.formatDistance("lessThanXSeconds",5,l):d<10?r.formatDistance("lessThanXSeconds",10,l):d<20?r.formatDistance("lessThanXSeconds",20,l):d<40?r.formatDistance("halfAMinute",0,l):d<60?r.formatDistance("lessThanXMinutes",1,l):r.formatDistance("xMinutes",1,l):m===0?r.formatDistance("lessThanXMinutes",1,l):r.formatDistance("xMinutes",m,l);if(m<45)return r.formatDistance("xMinutes",m,l);if(m<90)return r.formatDistance("aboutXHours",1,l);if(m<Dt){const g=Math.round(m/60);return r.formatDistance("aboutXHours",g,l)}else{if(m<o)return r.formatDistance("xDays",1,l);if(m<De){const g=Math.round(m/Dt);return r.formatDistance("xDays",g,l)}else if(m<De*2)return h=Math.round(m/De),r.formatDistance("aboutXMonths",h,l)}if(h=Tn(u,c),h<12){const g=Math.round(m/De);return r.formatDistance("xMonths",g,l)}else{const g=h%12,x=Math.trunc(h/12);return g<3?r.formatDistance("aboutXYears",x,l):g<9?r.formatDistance("overXYears",x,l):r.formatDistance("almostXYears",x+1,l)}}function _r(e,a){return Sr(e,Dn(e),a)}function Pr(e,a){const t=D(e,a==null?void 0:a.in),n=t.getFullYear(),r=t.getMonth(),o=T(t,0);return o.setFullYear(n,r+1,0),o.setHours(0,0,0,0),o.getDate()}function Tr(e){return Math.trunc(+D(e)/1e3)}function Or(e,a){const t=D(e,a==null?void 0:a.in),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(0,0,0,0),D(t,a==null?void 0:a.in)}function Fr(e,a){const t=D(e,a==null?void 0:a.in);return Cn(Or(t,a),Y(t,a),a)+1}function Qe(e,a){return+D(e)>+D(a)}function Gt(e,a){return+D(e)<+D(a)}function Ze(e,a,t){const[n,r]=J(t==null?void 0:t.in,e,a);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()}function Wr(e,a,t){const[n,r]=J(t==null?void 0:t.in,e,a);return n.getFullYear()===r.getFullYear()}function Le(e,a,t){return F(e,-a,t)}function Re(e,a,t){const n=D(e,t==null?void 0:t.in),r=n.getFullYear(),o=n.getDate(),i=T(e,0);i.setFullYear(r,a,15),i.setHours(0,0,0,0);const l=Pr(i);return n.setMonth(a,Math.min(o,l)),n}function Pt(e,a,t){const n=D(e,t==null?void 0:t.in);return isNaN(+n)?T(e,NaN):(n.setFullYear(a),n)}function Er({sortDirection:e,onToggleSortDirection:a,displayedTraceCount:t,isLoading:n,onRefresh:r}){return s.jsxs("div",{className:"flex items-center justify-between p-6 pb-4",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(le,{className:"h-5 w-5 text-blue-600"}),s.jsx("h3",{className:"text-xl font-semibold text-gray-900",children:"Traces"})]}),s.jsx("p",{className:"text-sm text-gray-600",children:n?"Loading traces...":t!==void 0?s.jsxs(s.Fragment,{children:[t," trace",t!==1?"s":""," found",t>0&&s.jsxs("span",{className:"ml-2 text-xs text-gray-500",children:["• Last updated ",_r(new Date,{addSuffix:!0})]})]}):"Traces"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs(O,{variant:"outline",size:"sm",onClick:a,className:"border-gray-200 hover:bg-gray-50",children:["Sort ",e==="desc"?"↓":"↑"]}),s.jsxs(O,{variant:"outline",size:"sm",onClick:r,className:"border-gray-200 hover:bg-gray-50",disabled:n,children:[s.jsx(Ht,{className:`h-4 w-4 mr-2 ${n?"animate-spin":""}`}),"Refresh"]})]})]})}function Yr({searchQuery:e,onSearchQueryChange:a,onOpenFilterModal:t,selectedCount:n,onDeleteSelected:r,onExportSelected:o,onCopySelected:i,isLoading:l}){return s.jsxs("div",{className:"flex items-center justify-between gap-4 px-6 py-4 border-t border-gray-100",children:[s.jsxs("div",{className:"flex items-center gap-4 flex-1",children:[s.jsxs("div",{className:"relative flex-1 max-w-sm",children:[s.jsx(Va,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 h-4 w-4"}),s.jsx(ze,{placeholder:"Search traces...",value:e,onChange:c=>a(c.target.value),className:"pl-10 border-gray-200 focus:border-blue-500 focus:ring-blue-500",disabled:l})]}),s.jsxs(O,{variant:"outline",size:"sm",onClick:t,className:"border-gray-200 hover:bg-gray-50",disabled:l,children:[s.jsx(Ta,{className:"h-4 w-4 mr-2"}),"Filter"]})]}),n>0&&s.jsxs(s.Fragment,{children:[s.jsx($e,{orientation:"vertical",className:"h-6"}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs(A,{variant:"secondary",className:"text-sm",children:[n," selected"]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(O,{variant:"outline",size:"sm",onClick:i,className:"border-gray-200 hover:bg-gray-50",children:[s.jsx(ba,{className:"h-4 w-4 mr-2"}),"Copy"]}),s.jsxs(O,{variant:"outline",size:"sm",onClick:o,className:"border-gray-200 hover:bg-gray-50",children:[s.jsx(Oa,{className:"h-4 w-4 mr-2"}),"Export"]}),s.jsxs(O,{variant:"outline",size:"sm",onClick:r,className:"border-red-200 text-red-600 hover:bg-red-50",children:[s.jsx(wa,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]})]})}function Lr({table:e,columns:a,isLoading:t,isError:n,traces:r,selectedTraces:o,isFiltered:i,onRetry:l,onClearFilters:c}){var u;return n?s.jsx("div",{className:"border-t border-gray-100",children:s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-6",children:[s.jsx(pa,{className:"h-12 w-12 text-red-400 mb-4"}),s.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"Error loading traces"}),s.jsx("p",{className:"text-sm text-gray-500 mb-4 text-center",children:"There was a problem loading the traces. Please try again."}),s.jsxs(O,{onClick:l,variant:"outline",children:[s.jsx(Ht,{className:"h-4 w-4 mr-2"}),"Try Again"]})]})}):s.jsx("div",{className:"border-t border-gray-100",children:s.jsxs(Fa,{children:[s.jsx(Wa,{children:e.getHeaderGroups().map(d=>s.jsx(pe,{className:"border-b border-gray-100 bg-gray-50/50",children:d.headers.map(f=>s.jsx(Ea,{className:"font-semibold text-gray-700 py-4",children:f.isPlaceholder?null:f.column.getCanSort()?s.jsxs(O,{variant:"ghost",onClick:f.column.getToggleSortingHandler(),className:"-ml-4 h-auto p-0 hover:bg-transparent font-semibold text-gray-700 hover:text-gray-900",children:[We(f.column.columnDef.header,f.getContext()),f.column.getIsSorted()==="asc"&&" ↑",f.column.getIsSorted()==="desc"&&" ↓"]}):We(f.column.columnDef.header,f.getContext())},f.id))},d.id))}),s.jsx(Ya,{children:t?(r.length>0?r:Array.from({length:5})).map((d,f)=>s.jsx(pe,{className:"border-b border-gray-50",children:a.map((m,h)=>s.jsx(Ee,{className:"py-6",children:s.jsx(qa,{className:"h-4 w-full"})},h))},f)):(u=e.getRowModel().rows)!=null&&u.length?e.getRowModel().rows.map((d,f)=>s.jsx(pe,{"data-state":o[d.original.id]?"selected":void 0,className:`
                  ${f%2===0?"bg-white/60":"bg-gray-50/60"} 
                  ${o[d.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:d.getVisibleCells().map(m=>s.jsx(Ee,{className:"py-5 px-6 text-gray-900",style:{width:m.column.getSize()!==150?m.column.getSize():void 0},children:We(m.column.columnDef.cell,m.getContext())},m.id))},d.id)):s.jsx(pe,{children:s.jsx(Ee,{colSpan:a.length,className:"h-32 text-center",children:s.jsxs("div",{className:"flex flex-col items-center justify-center space-y-3",children:[s.jsx(le,{className:"h-12 w-12 text-gray-300"}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-sm font-medium text-gray-900",children:i?"No traces match your filters":"No traces found"}),s.jsx("p",{className:"text-xs text-gray-500",children:i?"Try adjusting your search or filters":"Traces will appear here when they are created"})]}),i&&s.jsx(O,{variant:"outline",size:"sm",onClick:c,children:"Clear filters"})]})})})})]})})}function Rr({currentPage:e,hasNextPage:a,onPrevPage:t,onNextPage:n,isLoading:r,currentTraceCount:o,pageSize:i}){const l=e>0,c=a&&!r;return s.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-t border-gray-100",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("div",{className:"text-sm text-gray-600",children:["Page ",s.jsx("span",{className:"font-medium",children:e+1})]}),o>0&&s.jsxs("div",{className:"text-xs text-gray-500",children:["Showing ",o," traces"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(O,{variant:"outline",size:"sm",onClick:t,disabled:!l||r,className:"border-gray-200 hover:bg-gray-50 disabled:opacity-50",children:[s.jsx(At,{className:"h-4 w-4 mr-1"}),"Previous"]}),s.jsxs(O,{variant:"outline",size:"sm",onClick:n,disabled:!c,className:"border-gray-200 hover:bg-gray-50 disabled:opacity-50",children:["Next",s.jsx(_e,{className:"h-4 w-4 ml-1"})]})]})]})}var N=function(){return N=Object.assign||function(a){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(a[o]=t[o])}return a},N.apply(this,arguments)};function Ir(e,a){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&a.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(e);r<n.length;r++)a.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(t[n[r]]=e[n[r]]);return t}function Kt(e,a,t){for(var n=0,r=a.length,o;n<r;n++)(o||!(n in a))&&(o||(o=Array.prototype.slice.call(a,0,n)),o[n]=a[n]);return e.concat(o||Array.prototype.slice.call(a))}function be(e){return e.mode==="multiple"}function we(e){return e.mode==="range"}function Te(e){return e.mode==="single"}var Ar={root:"rdp",multiple_months:"rdp-multiple_months",with_weeknumber:"rdp-with_weeknumber",vhidden:"rdp-vhidden",button_reset:"rdp-button_reset",button:"rdp-button",caption:"rdp-caption",caption_start:"rdp-caption_start",caption_end:"rdp-caption_end",caption_between:"rdp-caption_between",caption_label:"rdp-caption_label",caption_dropdowns:"rdp-caption_dropdowns",dropdown:"rdp-dropdown",dropdown_month:"rdp-dropdown_month",dropdown_year:"rdp-dropdown_year",dropdown_icon:"rdp-dropdown_icon",months:"rdp-months",month:"rdp-month",table:"rdp-table",tbody:"rdp-tbody",tfoot:"rdp-tfoot",head:"rdp-head",head_row:"rdp-head_row",head_cell:"rdp-head_cell",nav:"rdp-nav",nav_button:"rdp-nav_button",nav_button_previous:"rdp-nav_button_previous",nav_button_next:"rdp-nav_button_next",nav_icon:"rdp-nav_icon",row:"rdp-row",weeknumber:"rdp-weeknumber",cell:"rdp-cell",day:"rdp-day",day_today:"rdp-day_today",day_outside:"rdp-day_outside",day_selected:"rdp-day_selected",day_disabled:"rdp-day_disabled",day_hidden:"rdp-day_hidden",day_range_start:"rdp-day_range_start",day_range_end:"rdp-day_range_end",day_range_middle:"rdp-day_range_middle"};function Hr(e,a){return P(e,"LLLL y",a)}function Br(e,a){return P(e,"d",a)}function $r(e,a){return P(e,"LLLL",a)}function Vr(e){return"".concat(e)}function qr(e,a){return P(e,"cccccc",a)}function zr(e,a){return P(e,"yyyy",a)}var Xr=Object.freeze({__proto__:null,formatCaption:Hr,formatDay:Br,formatMonthCaption:$r,formatWeekNumber:Vr,formatWeekdayName:qr,formatYearCaption:zr}),Qr=function(e,a,t){return P(e,"do MMMM (EEEE)",t)},Gr=function(){return"Month: "},Kr=function(){return"Go to next month"},Ur=function(){return"Go to previous month"},Jr=function(e,a){return P(e,"cccc",a)},Zr=function(e){return"Week n. ".concat(e)},es=function(){return"Year: "},ts=Object.freeze({__proto__:null,labelDay:Qr,labelMonthDropdown:Gr,labelNext:Kr,labelPrevious:Ur,labelWeekNumber:Zr,labelWeekday:Jr,labelYearDropdown:es});function as(){var e="buttons",a=Ar,t=Je,n={},r={},o=1,i={},l=new Date;return{captionLayout:e,classNames:a,formatters:Xr,labels:ts,locale:t,modifiersClassNames:n,modifiers:r,numberOfMonths:o,styles:i,today:l,mode:"default"}}function ns(e){var a=e.fromYear,t=e.toYear,n=e.fromMonth,r=e.toMonth,o=e.fromDate,i=e.toDate;return n?o=Y(n):a&&(o=new Date(a,0,1)),r?i=Pe(r):t&&(i=new Date(t,11,31)),{fromDate:o?de(o):void 0,toDate:i?de(i):void 0}}var Ut=v.createContext(void 0);function rs(e){var a,t=e.initialProps,n=as(),r=ns(t),o=r.fromDate,i=r.toDate,l=(a=t.captionLayout)!==null&&a!==void 0?a:n.captionLayout;l!=="buttons"&&(!o||!i)&&(l="buttons");var c;(Te(t)||be(t)||we(t))&&(c=t.onSelect);var u=N(N(N({},n),t),{captionLayout:l,classNames:N(N({},n.classNames),t.classNames),components:N({},t.components),formatters:N(N({},n.formatters),t.formatters),fromDate:o,labels:N(N({},n.labels),t.labels),mode:t.mode||n.mode,modifiers:N(N({},n.modifiers),t.modifiers),modifiersClassNames:N(N({},n.modifiersClassNames),t.modifiersClassNames),onSelect:c,styles:N(N({},n.styles),t.styles),toDate:i});return s.jsx(Ut.Provider,{value:u,children:e.children})}function S(){var e=v.useContext(Ut);if(!e)throw new Error("useDayPicker must be used within a DayPickerProvider.");return e}function Jt(e){var a=S(),t=a.locale,n=a.classNames,r=a.styles,o=a.formatters.formatCaption;return s.jsx("div",{className:n.caption_label,style:r.caption_label,"aria-live":"polite",role:"presentation",id:e.id,children:o(e.displayMonth,{locale:t})})}function ss(e){return s.jsx("svg",N({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},e,{children:s.jsx("path",{d:"M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z",fill:"currentColor",fillRule:"nonzero"})}))}function Zt(e){var a,t,n=e.onChange,r=e.value,o=e.children,i=e.caption,l=e.className,c=e.style,u=S(),d=(t=(a=u.components)===null||a===void 0?void 0:a.IconDropdown)!==null&&t!==void 0?t:ss;return s.jsxs("div",{className:l,style:c,children:[s.jsx("span",{className:u.classNames.vhidden,children:e["aria-label"]}),s.jsx("select",{name:e.name,"aria-label":e["aria-label"],className:u.classNames.dropdown,style:u.styles.dropdown,value:r,onChange:n,children:o}),s.jsxs("div",{className:u.classNames.caption_label,style:u.styles.caption_label,"aria-hidden":"true",children:[i,s.jsx(d,{className:u.classNames.dropdown_icon,style:u.styles.dropdown_icon})]})]})}function os(e){var a,t=S(),n=t.fromDate,r=t.toDate,o=t.styles,i=t.locale,l=t.formatters.formatMonthCaption,c=t.classNames,u=t.components,d=t.labels.labelMonthDropdown;if(!n)return s.jsx(s.Fragment,{});if(!r)return s.jsx(s.Fragment,{});var f=[];if(Wr(n,r))for(var m=Y(n),h=n.getMonth();h<=r.getMonth();h++)f.push(Re(m,h));else for(var m=Y(new Date),h=0;h<=11;h++)f.push(Re(m,h));var g=function(y){var p=Number(y.target.value),b=Re(Y(e.displayMonth),p);e.onChange(b)},x=(a=u==null?void 0:u.Dropdown)!==null&&a!==void 0?a:Zt;return s.jsx(x,{name:"months","aria-label":d(),className:c.dropdown_month,style:o.dropdown_month,onChange:g,value:e.displayMonth.getMonth(),caption:l(e.displayMonth,{locale:i}),children:f.map(function(y){return s.jsx("option",{value:y.getMonth(),children:l(y,{locale:i})},y.getMonth())})})}function is(e){var a,t=e.displayMonth,n=S(),r=n.fromDate,o=n.toDate,i=n.locale,l=n.styles,c=n.classNames,u=n.components,d=n.formatters.formatYearCaption,f=n.labels.labelYearDropdown,m=[];if(!r)return s.jsx(s.Fragment,{});if(!o)return s.jsx(s.Fragment,{});for(var h=r.getFullYear(),g=o.getFullYear(),x=h;x<=g;x++)m.push(Pt($t(new Date),x));var y=function(b){var M=Pt(Y(t),Number(b.target.value));e.onChange(M)},p=(a=u==null?void 0:u.Dropdown)!==null&&a!==void 0?a:Zt;return s.jsx(p,{name:"years","aria-label":f(),className:c.dropdown_year,style:l.dropdown_year,onChange:y,value:t.getFullYear(),caption:d(t,{locale:i}),children:m.map(function(b){return s.jsx("option",{value:b.getFullYear(),children:d(b,{locale:i})},b.getFullYear())})})}function ls(e,a){var t=v.useState(e),n=t[0],r=t[1],o=a===void 0?n:a;return[o,r]}function cs(e){var a=e.month,t=e.defaultMonth,n=e.today,r=a||t||n||new Date,o=e.toDate,i=e.fromDate,l=e.numberOfMonths,c=l===void 0?1:l;if(o&&ue(o,r)<0){var u=-1*(c-1);r=H(o,u)}return i&&ue(r,i)<0&&(r=i),Y(r)}function ds(){var e=S(),a=cs(e),t=ls(a,e.month),n=t[0],r=t[1],o=function(i){var l;if(!e.disableNavigation){var c=Y(i);r(c),(l=e.onMonthChange)===null||l===void 0||l.call(e,c)}};return[n,o]}function us(e,a){for(var t=a.reverseMonths,n=a.numberOfMonths,r=Y(e),o=Y(H(r,n)),i=ue(o,r),l=[],c=0;c<i;c++){var u=H(r,c);l.push(u)}return t&&(l=l.reverse()),l}function ms(e,a){if(!a.disableNavigation){var t=a.toDate,n=a.pagedNavigation,r=a.numberOfMonths,o=r===void 0?1:r,i=n?o:1,l=Y(e);if(!t)return H(l,i);var c=ue(t,e);if(!(c<o))return H(l,i)}}function fs(e,a){if(!a.disableNavigation){var t=a.fromDate,n=a.pagedNavigation,r=a.numberOfMonths,o=r===void 0?1:r,i=n?o:1,l=Y(e);if(!t)return H(l,-i);var c=ue(l,t);if(!(c<=0))return H(l,-i)}}var ea=v.createContext(void 0);function hs(e){var a=S(),t=ds(),n=t[0],r=t[1],o=us(n,a),i=ms(n,a),l=fs(n,a),c=function(f){return o.some(function(m){return Ze(f,m)})},u=function(f,m){c(f)||(m&&Gt(f,m)?r(H(f,1+a.numberOfMonths*-1)):r(f))},d={currentMonth:n,displayMonths:o,goToMonth:r,goToDate:u,previousMonth:l,nextMonth:i,isDateDisplayed:c};return s.jsx(ea.Provider,{value:d,children:e.children})}function je(){var e=v.useContext(ea);if(!e)throw new Error("useNavigation must be used within a NavigationProvider");return e}function Tt(e){var a,t=S(),n=t.classNames,r=t.styles,o=t.components,i=je().goToMonth,l=function(d){i(H(d,e.displayIndex?-e.displayIndex:0))},c=(a=o==null?void 0:o.CaptionLabel)!==null&&a!==void 0?a:Jt,u=s.jsx(c,{id:e.id,displayMonth:e.displayMonth});return s.jsxs("div",{className:n.caption_dropdowns,style:r.caption_dropdowns,children:[s.jsx("div",{className:n.vhidden,children:u}),s.jsx(os,{onChange:l,displayMonth:e.displayMonth}),s.jsx(is,{onChange:l,displayMonth:e.displayMonth})]})}function gs(e){return s.jsx("svg",N({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:s.jsx("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"})}))}function vs(e){return s.jsx("svg",N({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:s.jsx("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"})}))}var Se=v.forwardRef(function(e,a){var t=S(),n=t.classNames,r=t.styles,o=[n.button_reset,n.button];e.className&&o.push(e.className);var i=o.join(" "),l=N(N({},r.button_reset),r.button);return e.style&&Object.assign(l,e.style),s.jsx("button",N({},e,{ref:a,type:"button",className:i,style:l}))});function xs(e){var a,t,n=S(),r=n.dir,o=n.locale,i=n.classNames,l=n.styles,c=n.labels,u=c.labelPrevious,d=c.labelNext,f=n.components;if(!e.nextMonth&&!e.previousMonth)return s.jsx(s.Fragment,{});var m=u(e.previousMonth,{locale:o}),h=[i.nav_button,i.nav_button_previous].join(" "),g=d(e.nextMonth,{locale:o}),x=[i.nav_button,i.nav_button_next].join(" "),y=(a=f==null?void 0:f.IconRight)!==null&&a!==void 0?a:vs,p=(t=f==null?void 0:f.IconLeft)!==null&&t!==void 0?t:gs;return s.jsxs("div",{className:i.nav,style:l.nav,children:[!e.hidePrevious&&s.jsx(Se,{name:"previous-month","aria-label":m,className:h,style:l.nav_button_previous,disabled:!e.previousMonth,onClick:e.onPreviousClick,children:r==="rtl"?s.jsx(y,{className:i.nav_icon,style:l.nav_icon}):s.jsx(p,{className:i.nav_icon,style:l.nav_icon})}),!e.hideNext&&s.jsx(Se,{name:"next-month","aria-label":g,className:x,style:l.nav_button_next,disabled:!e.nextMonth,onClick:e.onNextClick,children:r==="rtl"?s.jsx(p,{className:i.nav_icon,style:l.nav_icon}):s.jsx(y,{className:i.nav_icon,style:l.nav_icon})})]})}function Ot(e){var a=S().numberOfMonths,t=je(),n=t.previousMonth,r=t.nextMonth,o=t.goToMonth,i=t.displayMonths,l=i.findIndex(function(g){return Ze(e.displayMonth,g)}),c=l===0,u=l===i.length-1,d=a>1&&(c||!u),f=a>1&&(u||!c),m=function(){n&&o(n)},h=function(){r&&o(r)};return s.jsx(xs,{displayMonth:e.displayMonth,hideNext:d,hidePrevious:f,nextMonth:r,previousMonth:n,onPreviousClick:m,onNextClick:h})}function ys(e){var a,t=S(),n=t.classNames,r=t.disableNavigation,o=t.styles,i=t.captionLayout,l=t.components,c=(a=l==null?void 0:l.CaptionLabel)!==null&&a!==void 0?a:Jt,u;return r?u=s.jsx(c,{id:e.id,displayMonth:e.displayMonth}):i==="dropdown"?u=s.jsx(Tt,{displayMonth:e.displayMonth,id:e.id}):i==="dropdown-buttons"?u=s.jsxs(s.Fragment,{children:[s.jsx(Tt,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),s.jsx(Ot,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id})]}):u=s.jsxs(s.Fragment,{children:[s.jsx(c,{id:e.id,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),s.jsx(Ot,{displayMonth:e.displayMonth,id:e.id})]}),s.jsx("div",{className:n.caption,style:o.caption,children:u})}function bs(e){var a=S(),t=a.footer,n=a.styles,r=a.classNames.tfoot;return t?s.jsx("tfoot",{className:r,style:n.tfoot,children:s.jsx("tr",{children:s.jsx("td",{colSpan:8,children:t})})}):s.jsx(s.Fragment,{})}function ws(e,a,t){for(var n=t?se(new Date):V(new Date,{locale:e,weekStartsOn:a}),r=[],o=0;o<7;o++){var i=F(n,o);r.push(i)}return r}function js(){var e=S(),a=e.classNames,t=e.styles,n=e.showWeekNumber,r=e.locale,o=e.weekStartsOn,i=e.ISOWeek,l=e.formatters.formatWeekdayName,c=e.labels.labelWeekday,u=ws(r,o,i);return s.jsxs("tr",{style:t.head_row,className:a.head_row,children:[n&&s.jsx("td",{style:t.head_cell,className:a.head_cell}),u.map(function(d,f){return s.jsx("th",{scope:"col",className:a.head_cell,style:t.head_cell,"aria-label":c(d,{locale:r}),children:l(d,{locale:r})},f)})]})}function Ns(){var e,a=S(),t=a.classNames,n=a.styles,r=a.components,o=(e=r==null?void 0:r.HeadRow)!==null&&e!==void 0?e:js;return s.jsx("thead",{style:n.head,className:t.head,children:s.jsx(o,{})})}function ps(e){var a=S(),t=a.locale,n=a.formatters.formatDay;return s.jsx(s.Fragment,{children:n(e.date,{locale:t})})}var et=v.createContext(void 0);function Ds(e){if(!be(e.initialProps)){var a={selected:void 0,modifiers:{disabled:[]}};return s.jsx(et.Provider,{value:a,children:e.children})}return s.jsx(Ms,{initialProps:e.initialProps,children:e.children})}function Ms(e){var a=e.initialProps,t=e.children,n=a.selected,r=a.min,o=a.max,i=function(u,d,f){var m,h;(m=a.onDayClick)===null||m===void 0||m.call(a,u,d,f);var g=!!(d.selected&&r&&(n==null?void 0:n.length)===r);if(!g){var x=!!(!d.selected&&o&&(n==null?void 0:n.length)===o);if(!x){var y=n?Kt([],n):[];if(d.selected){var p=y.findIndex(function(b){return E(u,b)});y.splice(p,1)}else y.push(u);(h=a.onSelect)===null||h===void 0||h.call(a,y,u,d,f)}}},l={disabled:[]};n&&l.disabled.push(function(u){var d=o&&n.length>o-1,f=n.some(function(m){return E(m,u)});return!!(d&&!f)});var c={selected:n,onDayClick:i,modifiers:l};return s.jsx(et.Provider,{value:c,children:t})}function tt(){var e=v.useContext(et);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}function Cs(e,a){var t=a||{},n=t.from,r=t.to;return n&&r?E(r,e)&&E(n,e)?void 0:E(r,e)?{from:r,to:void 0}:E(n,e)?void 0:Qe(n,e)?{from:e,to:r}:{from:n,to:e}:r?Qe(e,r)?{from:r,to:e}:{from:e,to:r}:n?Gt(e,n)?{from:e,to:n}:{from:n,to:e}:{from:e,to:void 0}}var at=v.createContext(void 0);function ks(e){if(!we(e.initialProps)){var a={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return s.jsx(at.Provider,{value:a,children:e.children})}return s.jsx(Ss,{initialProps:e.initialProps,children:e.children})}function Ss(e){var a=e.initialProps,t=e.children,n=a.selected,r=n||{},o=r.from,i=r.to,l=a.min,c=a.max,u=function(h,g,x){var y,p;(y=a.onDayClick)===null||y===void 0||y.call(a,h,g,x);var b=Cs(h,n);(p=a.onSelect)===null||p===void 0||p.call(a,b,h,g,x)},d={range_start:[],range_end:[],range_middle:[],disabled:[]};if(o?(d.range_start=[o],i?(d.range_end=[i],E(o,i)||(d.range_middle=[{after:o,before:i}])):d.range_end=[o]):i&&(d.range_start=[i],d.range_end=[i]),l&&(o&&!i&&d.disabled.push({after:Le(o,l-1),before:F(o,l-1)}),o&&i&&d.disabled.push({after:o,before:F(o,l-1)}),!o&&i&&d.disabled.push({after:Le(i,l-1),before:F(i,l-1)})),c){if(o&&!i&&(d.disabled.push({before:F(o,-c+1)}),d.disabled.push({after:F(o,c-1)})),o&&i){var f=$(i,o)+1,m=c-f;d.disabled.push({before:Le(o,m)}),d.disabled.push({after:F(i,m)})}!o&&i&&(d.disabled.push({before:F(i,-c+1)}),d.disabled.push({after:F(i,c-1)}))}return s.jsx(at.Provider,{value:{selected:n,onDayClick:u,modifiers:d},children:t})}function nt(){var e=v.useContext(at);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function Ce(e){return Array.isArray(e)?Kt([],e):e!==void 0?[e]:[]}function _s(e){var a={};return Object.entries(e).forEach(function(t){var n=t[0],r=t[1];a[n]=Ce(r)}),a}var B;(function(e){e.Outside="outside",e.Disabled="disabled",e.Selected="selected",e.Hidden="hidden",e.Today="today",e.RangeStart="range_start",e.RangeEnd="range_end",e.RangeMiddle="range_middle"})(B||(B={}));var Ps=B.Selected,z=B.Disabled,Ts=B.Hidden,Os=B.Today,Ie=B.RangeEnd,Ae=B.RangeMiddle,He=B.RangeStart,Fs=B.Outside;function Ws(e,a,t){var n,r=(n={},n[Ps]=Ce(e.selected),n[z]=Ce(e.disabled),n[Ts]=Ce(e.hidden),n[Os]=[e.today],n[Ie]=[],n[Ae]=[],n[He]=[],n[Fs]=[],n);return e.fromDate&&r[z].push({before:e.fromDate}),e.toDate&&r[z].push({after:e.toDate}),be(e)?r[z]=r[z].concat(a.modifiers[z]):we(e)&&(r[z]=r[z].concat(t.modifiers[z]),r[He]=t.modifiers[He],r[Ae]=t.modifiers[Ae],r[Ie]=t.modifiers[Ie]),r}var ta=v.createContext(void 0);function Es(e){var a=S(),t=tt(),n=nt(),r=Ws(a,t,n),o=_s(a.modifiers),i=N(N({},r),o);return s.jsx(ta.Provider,{value:i,children:e.children})}function aa(){var e=v.useContext(ta);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function Ys(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function Ls(e){return!!(e&&typeof e=="object"&&"from"in e)}function Rs(e){return!!(e&&typeof e=="object"&&"after"in e)}function Is(e){return!!(e&&typeof e=="object"&&"before"in e)}function As(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function Hs(e,a){var t,n=a.from,r=a.to;if(n&&r){var o=$(r,n)<0;o&&(t=[r,n],n=t[0],r=t[1]);var i=$(e,n)>=0&&$(r,e)>=0;return i}return r?E(r,e):n?E(n,e):!1}function Bs(e){return Ke(e)}function $s(e){return Array.isArray(e)&&e.every(Ke)}function Vs(e,a){return a.some(function(t){if(typeof t=="boolean")return t;if(Bs(t))return E(e,t);if($s(t))return t.includes(e);if(Ls(t))return Hs(e,t);if(As(t))return t.dayOfWeek.includes(e.getDay());if(Ys(t)){var n=$(t.before,e),r=$(t.after,e),o=n>0,i=r<0,l=Qe(t.before,t.after);return l?i&&o:o||i}return Rs(t)?$(e,t.after)>0:Is(t)?$(t.before,e)>0:typeof t=="function"?t(e):!1})}function rt(e,a,t){var n=Object.keys(a).reduce(function(o,i){var l=a[i];return Vs(e,l)&&o.push(i),o},[]),r={};return n.forEach(function(o){return r[o]=!0}),t&&!Ze(e,t)&&(r.outside=!0),r}function qs(e,a){for(var t=Y(e[0]),n=Pe(e[e.length-1]),r,o,i=t;i<=n;){var l=rt(i,a),c=!l.disabled&&!l.hidden;if(!c){i=F(i,1);continue}if(l.selected)return i;l.today&&!o&&(o=i),r||(r=i),i=F(i,1)}return o||r}var zs=365;function na(e,a){var t=a.moveBy,n=a.direction,r=a.context,o=a.modifiers,i=a.retry,l=i===void 0?{count:0,lastFocused:e}:i,c=r.weekStartsOn,u=r.fromDate,d=r.toDate,f=r.locale,m={day:F,week:Xe,month:H,year:jn,startOfWeek:function(y){return r.ISOWeek?se(y):V(y,{locale:f,weekStartsOn:c})},endOfWeek:function(y){return r.ISOWeek?Vt(y):Ue(y,{locale:f,weekStartsOn:c})}},h=m[t](e,n==="after"?1:-1);n==="before"&&u?h=Nn([u,h]):n==="after"&&d&&(h=pn([d,h]));var g=!0;if(o){var x=rt(h,o);g=!x.disabled&&!x.hidden}return g?h:l.count>zs?l.lastFocused:na(h,{moveBy:t,direction:n,context:r,modifiers:o,retry:N(N({},l),{count:l.count+1})})}var ra=v.createContext(void 0);function Xs(e){var a=je(),t=aa(),n=v.useState(),r=n[0],o=n[1],i=v.useState(),l=i[0],c=i[1],u=qs(a.displayMonths,t),d=r??(l&&a.isDateDisplayed(l))?l:u,f=function(){c(r),o(void 0)},m=function(y){o(y)},h=S(),g=function(y,p){if(r){var b=na(r,{moveBy:y,direction:p,context:h,modifiers:t});E(r,b)||(a.goToDate(b,r),m(b))}},x={focusedDay:r,focusTarget:d,blur:f,focus:m,focusDayAfter:function(){return g("day","after")},focusDayBefore:function(){return g("day","before")},focusWeekAfter:function(){return g("week","after")},focusWeekBefore:function(){return g("week","before")},focusMonthBefore:function(){return g("month","before")},focusMonthAfter:function(){return g("month","after")},focusYearBefore:function(){return g("year","before")},focusYearAfter:function(){return g("year","after")},focusStartOfWeek:function(){return g("startOfWeek","before")},focusEndOfWeek:function(){return g("endOfWeek","after")}};return s.jsx(ra.Provider,{value:x,children:e.children})}function st(){var e=v.useContext(ra);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}function Qs(e,a){var t=aa(),n=rt(e,t,a);return n}var ot=v.createContext(void 0);function Gs(e){if(!Te(e.initialProps)){var a={selected:void 0};return s.jsx(ot.Provider,{value:a,children:e.children})}return s.jsx(Ks,{initialProps:e.initialProps,children:e.children})}function Ks(e){var a=e.initialProps,t=e.children,n=function(o,i,l){var c,u,d;if((c=a.onDayClick)===null||c===void 0||c.call(a,o,i,l),i.selected&&!a.required){(u=a.onSelect)===null||u===void 0||u.call(a,void 0,o,i,l);return}(d=a.onSelect)===null||d===void 0||d.call(a,o,o,i,l)},r={selected:a.selected,onDayClick:n};return s.jsx(ot.Provider,{value:r,children:t})}function sa(){var e=v.useContext(ot);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function Us(e,a){var t=S(),n=sa(),r=tt(),o=nt(),i=st(),l=i.focusDayAfter,c=i.focusDayBefore,u=i.focusWeekAfter,d=i.focusWeekBefore,f=i.blur,m=i.focus,h=i.focusMonthBefore,g=i.focusMonthAfter,x=i.focusYearBefore,y=i.focusYearAfter,p=i.focusStartOfWeek,b=i.focusEndOfWeek,M=function(j){var w,L,ge,oe;Te(t)?(w=n.onDayClick)===null||w===void 0||w.call(n,e,a,j):be(t)?(L=r.onDayClick)===null||L===void 0||L.call(r,e,a,j):we(t)?(ge=o.onDayClick)===null||ge===void 0||ge.call(o,e,a,j):(oe=t.onDayClick)===null||oe===void 0||oe.call(t,e,a,j)},k=function(j){var w;m(e),(w=t.onDayFocus)===null||w===void 0||w.call(t,e,a,j)},R=function(j){var w;f(),(w=t.onDayBlur)===null||w===void 0||w.call(t,e,a,j)},I=function(j){var w;(w=t.onDayMouseEnter)===null||w===void 0||w.call(t,e,a,j)},q=function(j){var w;(w=t.onDayMouseLeave)===null||w===void 0||w.call(t,e,a,j)},X=function(j){var w;(w=t.onDayPointerEnter)===null||w===void 0||w.call(t,e,a,j)},Z=function(j){var w;(w=t.onDayPointerLeave)===null||w===void 0||w.call(t,e,a,j)},ee=function(j){var w;(w=t.onDayTouchCancel)===null||w===void 0||w.call(t,e,a,j)},Oe=function(j){var w;(w=t.onDayTouchEnd)===null||w===void 0||w.call(t,e,a,j)},Q=function(j){var w;(w=t.onDayTouchMove)===null||w===void 0||w.call(t,e,a,j)},te=function(j){var w;(w=t.onDayTouchStart)===null||w===void 0||w.call(t,e,a,j)},Fe=function(j){var w;(w=t.onDayKeyUp)===null||w===void 0||w.call(t,e,a,j)},he=function(j){var w;switch(j.key){case"ArrowLeft":j.preventDefault(),j.stopPropagation(),t.dir==="rtl"?l():c();break;case"ArrowRight":j.preventDefault(),j.stopPropagation(),t.dir==="rtl"?c():l();break;case"ArrowDown":j.preventDefault(),j.stopPropagation(),u();break;case"ArrowUp":j.preventDefault(),j.stopPropagation(),d();break;case"PageUp":j.preventDefault(),j.stopPropagation(),j.shiftKey?x():h();break;case"PageDown":j.preventDefault(),j.stopPropagation(),j.shiftKey?y():g();break;case"Home":j.preventDefault(),j.stopPropagation(),p();break;case"End":j.preventDefault(),j.stopPropagation(),b();break}(w=t.onDayKeyDown)===null||w===void 0||w.call(t,e,a,j)},W={onClick:M,onFocus:k,onBlur:R,onKeyDown:he,onKeyUp:Fe,onMouseEnter:I,onMouseLeave:q,onPointerEnter:X,onPointerLeave:Z,onTouchCancel:ee,onTouchEnd:Oe,onTouchMove:Q,onTouchStart:te};return W}function Js(){var e=S(),a=sa(),t=tt(),n=nt(),r=Te(e)?a.selected:be(e)?t.selected:we(e)?n.selected:void 0;return r}function Zs(e){return Object.values(B).includes(e)}function eo(e,a){var t=[e.classNames.day];return Object.keys(a).forEach(function(n){var r=e.modifiersClassNames[n];if(r)t.push(r);else if(Zs(n)){var o=e.classNames["day_".concat(n)];o&&t.push(o)}}),t}function to(e,a){var t=N({},e.styles.day);return Object.keys(a).forEach(function(n){var r;t=N(N({},t),(r=e.modifiersStyles)===null||r===void 0?void 0:r[n])}),t}function ao(e,a,t){var n,r,o,i=S(),l=st(),c=Qs(e,a),u=Us(e,c),d=Js(),f=!!(i.onDayClick||i.mode!=="default");v.useEffect(function(){var I;c.outside||l.focusedDay&&f&&E(l.focusedDay,e)&&((I=t.current)===null||I===void 0||I.focus())},[l.focusedDay,e,t,f,c.outside]);var m=eo(i,c).join(" "),h=to(i,c),g=!!(c.outside&&!i.showOutsideDays||c.hidden),x=(o=(r=i.components)===null||r===void 0?void 0:r.DayContent)!==null&&o!==void 0?o:ps,y=s.jsx(x,{date:e,displayMonth:a,activeModifiers:c}),p={style:h,className:m,children:y,role:"gridcell"},b=l.focusTarget&&E(l.focusTarget,e)&&!c.outside,M=l.focusedDay&&E(l.focusedDay,e),k=N(N(N({},p),(n={disabled:c.disabled,role:"gridcell"},n["aria-selected"]=c.selected,n.tabIndex=M||b?0:-1,n)),u),R={isButton:f,isHidden:g,activeModifiers:c,selectedDays:d,buttonProps:k,divProps:p};return R}function no(e){var a=v.useRef(null),t=ao(e.date,e.displayMonth,a);return t.isHidden?s.jsx("div",{role:"gridcell"}):t.isButton?s.jsx(Se,N({name:"day",ref:a},t.buttonProps)):s.jsx("div",N({},t.divProps))}function ro(e){var a=e.number,t=e.dates,n=S(),r=n.onWeekNumberClick,o=n.styles,i=n.classNames,l=n.locale,c=n.labels.labelWeekNumber,u=n.formatters.formatWeekNumber,d=u(Number(a),{locale:l});if(!r)return s.jsx("span",{className:i.weeknumber,style:o.weeknumber,children:d});var f=c(Number(a),{locale:l}),m=function(h){r(a,t,h)};return s.jsx(Se,{name:"week-number","aria-label":f,className:i.weeknumber,style:o.weeknumber,onClick:m,children:d})}function so(e){var a,t,n=S(),r=n.styles,o=n.classNames,i=n.showWeekNumber,l=n.components,c=(a=l==null?void 0:l.Day)!==null&&a!==void 0?a:no,u=(t=l==null?void 0:l.WeekNumber)!==null&&t!==void 0?t:ro,d;return i&&(d=s.jsx("td",{className:o.cell,style:r.cell,children:s.jsx(u,{number:e.weekNumber,dates:e.dates})})),s.jsxs("tr",{className:o.row,style:r.row,children:[d,e.dates.map(function(f){return s.jsx("td",{className:o.cell,style:r.cell,role:"presentation",children:s.jsx(c,{displayMonth:e.displayMonth,date:f})},Tr(f))})]})}function Ft(e,a,t){for(var n=t!=null&&t.ISOWeek?Vt(a):Ue(a,t),r=t!=null&&t.ISOWeek?se(e):V(e,t),o=$(n,r),i=[],l=0;l<=o;l++)i.push(F(r,l));var c=i.reduce(function(u,d){var f=t!=null&&t.ISOWeek?qt(d):Xt(d,t),m=u.find(function(h){return h.weekNumber===f});return m?(m.dates.push(d),u):(u.push({weekNumber:f,dates:[d]}),u)},[]);return c}function oo(e,a){var t=Ft(Y(e),Pe(e),a);if(a!=null&&a.useFixedWeeks){var n=Fr(e,a);if(n<6){var r=t[t.length-1],o=r.dates[r.dates.length-1],i=Xe(o,6-n),l=Ft(Xe(o,1),i,a);t.push.apply(t,l)}}return t}function io(e){var a,t,n,r=S(),o=r.locale,i=r.classNames,l=r.styles,c=r.hideHead,u=r.fixedWeeks,d=r.components,f=r.weekStartsOn,m=r.firstWeekContainsDate,h=r.ISOWeek,g=oo(e.displayMonth,{useFixedWeeks:!!u,ISOWeek:h,locale:o,weekStartsOn:f,firstWeekContainsDate:m}),x=(a=d==null?void 0:d.Head)!==null&&a!==void 0?a:Ns,y=(t=d==null?void 0:d.Row)!==null&&t!==void 0?t:so,p=(n=d==null?void 0:d.Footer)!==null&&n!==void 0?n:bs;return s.jsxs("table",{id:e.id,className:i.table,style:l.table,role:"grid","aria-labelledby":e["aria-labelledby"],children:[!c&&s.jsx(x,{}),s.jsx("tbody",{className:i.tbody,style:l.tbody,children:g.map(function(b){return s.jsx(y,{displayMonth:e.displayMonth,dates:b.dates,weekNumber:b.weekNumber},b.weekNumber)})}),s.jsx(p,{displayMonth:e.displayMonth})]})}function lo(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var co=lo()?v.useLayoutEffect:v.useEffect,Be=!1,uo=0;function Wt(){return"react-day-picker-".concat(++uo)}function mo(e){var a,t=e??(Be?Wt():null),n=v.useState(t),r=n[0],o=n[1];return co(function(){r===null&&o(Wt())},[]),v.useEffect(function(){Be===!1&&(Be=!0)},[]),(a=e??r)!==null&&a!==void 0?a:void 0}function fo(e){var a,t,n=S(),r=n.dir,o=n.classNames,i=n.styles,l=n.components,c=je().displayMonths,u=mo(n.id?"".concat(n.id,"-").concat(e.displayIndex):void 0),d=n.id?"".concat(n.id,"-grid-").concat(e.displayIndex):void 0,f=[o.month],m=i.month,h=e.displayIndex===0,g=e.displayIndex===c.length-1,x=!h&&!g;r==="rtl"&&(a=[h,g],g=a[0],h=a[1]),h&&(f.push(o.caption_start),m=N(N({},m),i.caption_start)),g&&(f.push(o.caption_end),m=N(N({},m),i.caption_end)),x&&(f.push(o.caption_between),m=N(N({},m),i.caption_between));var y=(t=l==null?void 0:l.Caption)!==null&&t!==void 0?t:ys;return s.jsxs("div",{className:f.join(" "),style:m,children:[s.jsx(y,{id:u,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),s.jsx(io,{id:d,"aria-labelledby":u,displayMonth:e.displayMonth})]},e.displayIndex)}function ho(e){var a=S(),t=a.classNames,n=a.styles;return s.jsx("div",{className:t.months,style:n.months,children:e.children})}function go(e){var a,t,n=e.initialProps,r=S(),o=st(),i=je(),l=v.useState(!1),c=l[0],u=l[1];v.useEffect(function(){r.initialFocus&&o.focusTarget&&(c||(o.focus(o.focusTarget),u(!0)))},[r.initialFocus,c,o.focus,o.focusTarget,o]);var d=[r.classNames.root,r.className];r.numberOfMonths>1&&d.push(r.classNames.multiple_months),r.showWeekNumber&&d.push(r.classNames.with_weeknumber);var f=N(N({},r.styles.root),r.style),m=Object.keys(n).filter(function(g){return g.startsWith("data-")}).reduce(function(g,x){var y;return N(N({},g),(y={},y[x]=n[x],y))},{}),h=(t=(a=n.components)===null||a===void 0?void 0:a.Months)!==null&&t!==void 0?t:ho;return s.jsx("div",N({className:d.join(" "),style:f,dir:r.dir,id:r.id,nonce:n.nonce,title:n.title,lang:n.lang},m,{children:s.jsx(h,{children:i.displayMonths.map(function(g,x){return s.jsx(fo,{displayIndex:x,displayMonth:g},x)})})}))}function vo(e){var a=e.children,t=Ir(e,["children"]);return s.jsx(rs,{initialProps:t,children:s.jsx(hs,{children:s.jsx(Gs,{initialProps:t,children:s.jsx(Ds,{initialProps:t,children:s.jsx(ks,{initialProps:t,children:s.jsx(Es,{children:s.jsx(Xs,{children:a})})})})})})})}function xo(e){return s.jsx(vo,N({},e,{children:s.jsx(go,{initialProps:e})}))}function Et({className:e,classNames:a,showOutsideDays:t=!0,...n}){return s.jsx(xo,{showOutsideDays:t,className:U("p-3",e),classNames:{months:"flex flex-col sm:flex-row gap-2",month:"flex flex-col gap-4",caption:"flex justify-center pt-1 relative items-center w-full",caption_label:"text-sm font-medium",nav:"flex items-center gap-1",nav_button:U(mt({variant:"outline"}),"size-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-x-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:U("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-range-end)]:rounded-r-md",n.mode==="range"?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md"),day:U(mt({variant:"ghost"}),"size-8 p-0 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start aria-selected:bg-primary aria-selected:text-primary-foreground",day_range_end:"day-range-end aria-selected:bg-primary aria-selected:text-primary-foreground",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground aria-selected:text-muted-foreground",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...a},components:{IconLeft:({className:r,...o})=>s.jsx(At,{className:U("size-4",r),...o}),IconRight:({className:r,...o})=>s.jsx(_e,{className:U("size-4",r),...o})},...n})}const yo=[{value:"running",label:"Running"},{value:"completed",label:"Completed"},{value:"failed",label:"Failed"}];function bo({open:e,onOpenChange:a,filters:t,onApply:n,onReset:r,projectId:o}){const[i,l]=v.useState(t),[c,u]=v.useState(t.fromDate?new Date(t.fromDate):void 0),[d,f]=v.useState(t.toDate?new Date(t.toDate):void 0);v.useEffect(()=>{l(t),u(t.fromDate?new Date(t.fromDate):void 0),f(t.toDate?new Date(t.toDate):void 0)},[t]);const m=(x,y)=>{l(p=>({...p,status:y?[...p.status,x]:p.status.filter(b=>b!==x)}))},h=()=>{const x={...i,fromDate:c?c.toISOString():void 0,toDate:d?d.toISOString():void 0};n(x)},g=()=>{l({status:[]}),u(void 0),f(void 0),r()};return s.jsx(za,{open:e,onOpenChange:a,children:s.jsxs(Xa,{className:"sm:max-w-[425px]",children:[s.jsxs(Qa,{children:[s.jsx(Ga,{children:"Filter Traces"}),s.jsx(Ka,{children:"Apply filters to narrow down the traces displayed in the table."})]}),s.jsxs("div",{className:"space-y-6 py-4",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsx(G,{className:"text-sm font-medium",children:"Status"}),s.jsx("div",{className:"space-y-2",children:yo.map(x=>s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Ve,{id:`status-${x.value}`,checked:i.status.includes(x.value),onCheckedChange:y=>m(x.value,!!y)}),s.jsx(G,{htmlFor:`status-${x.value}`,className:"text-sm font-normal cursor-pointer",children:x.label})]},x.value))})]}),s.jsx($e,{}),s.jsxs("div",{className:"space-y-3",children:[s.jsx(G,{className:"text-sm font-medium",children:"Date Range"}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(G,{htmlFor:"from-date",className:"text-xs text-gray-500",children:"From"}),s.jsxs(ft,{children:[s.jsx(ht,{asChild:!0,children:s.jsxs(O,{variant:"outline",className:U("w-full justify-start text-left font-normal",!c&&"text-muted-foreground"),children:[s.jsx(ke,{className:"mr-2 h-4 w-4"}),c?P(c,"PPP"):"Pick a date"]})}),s.jsx(gt,{className:"w-auto p-0",children:s.jsx(Et,{mode:"single",selected:c,onSelect:u,initialFocus:!0})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(G,{htmlFor:"to-date",className:"text-xs text-gray-500",children:"To"}),s.jsxs(ft,{children:[s.jsx(ht,{asChild:!0,children:s.jsxs(O,{variant:"outline",className:U("w-full justify-start text-left font-normal",!d&&"text-muted-foreground"),children:[s.jsx(ke,{className:"mr-2 h-4 w-4"}),d?P(d,"PPP"):"Pick a date"]})}),s.jsx(gt,{className:"w-auto p-0",children:s.jsx(Et,{mode:"single",selected:d,onSelect:f,initialFocus:!0})})]})]})]})]}),s.jsx($e,{}),s.jsxs("div",{className:"space-y-3",children:[s.jsx(G,{className:"text-sm font-medium",children:"Duration (ms)"}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(G,{htmlFor:"min-duration",className:"text-xs text-gray-500",children:"Min"}),s.jsx(ze,{id:"min-duration",type:"number",placeholder:"0",value:i.minDuration||"",onChange:x=>l(y=>({...y,minDuration:x.target.value?Number(x.target.value):void 0}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(G,{htmlFor:"max-duration",className:"text-xs text-gray-500",children:"Max"}),s.jsx(ze,{id:"max-duration",type:"number",placeholder:"1000",value:i.maxDuration||"",onChange:x=>l(y=>({...y,maxDuration:x.target.value?Number(x.target.value):void 0}))})]})]})]})]}),s.jsxs(Ua,{children:[s.jsx(O,{variant:"outline",onClick:g,children:"Reset"}),s.jsx(O,{onClick:h,children:"Apply Filters"})]})]})})}const Yt=e=>e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(2)}s`:`${(e/6e4).toFixed(2)}m`,oa=(e,a=0,t=new Set)=>{const n=[];for(const r of e){const o=r.spans?r.spans.length>0:!1;n.push({...r,level:a,hasChildren:o}),o&&!t.has(r.id)&&n.push(...oa((r==null?void 0:r.spans)??[],a+1,t))}return n};function wo({open:e,onOpenChange:a,trace:t}){const[n,r]=v.useState(new Set),o=m=>{r(h=>{const g=new Set(h);return g.has(m)?g.delete(m):g.add(m),g})};if(!t)return s.jsx(vt,{open:e,onOpenChange:a,children:s.jsx(xt,{className:"w-[100vw] !max-w-[100vw] h-[100vh] overflow-hidden !w-[100vw] bg-gradient-to-br from-slate-50 via-blue-50 to-indigo-50",children:s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsxs("div",{className:"text-center space-y-6",children:[s.jsx("div",{className:"inline-flex items-center justify-center p-6 bg-gradient-to-r from-blue-500 to-purple-600 rounded-3xl text-white shadow-xl",children:s.jsx(le,{className:"h-12 w-12"})}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("h3",{className:"text-2xl font-bold bg-gradient-to-r from-gray-900 to-gray-600 bg-clip-text text-transparent",children:"No Trace Selected"}),s.jsx("p",{className:"text-gray-600 max-w-md mx-auto",children:"Select a trace from the table to view detailed information about its execution and spans."})]})]})})})});const i=new Date(t.startTime),l=t.endTime?new Date(t.endTime):null,c=l?l.getTime()-i.getTime():null,u=t.spans||[],d=oa(u,0,n),f=t.status||"running";return s.jsx(vt,{open:e,onOpenChange:a,children:s.jsxs(xt,{className:"w-[100vw] !max-w-[100vw] h-[100vh] overflow-hidden !w-[100vw] bg-gradient-to-br from-slate-50 via-blue-50 to-indigo-50",children:[s.jsx("div",{className:"bg-gradient-to-r from-blue-500 to-purple-600 text-white p-8 -m-6 mb-8 shadow-xl",children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"p-3 bg-white/20 rounded-2xl backdrop-blur-sm",children:s.jsx(le,{className:"h-8 w-8"})}),s.jsxs("div",{children:[s.jsx("h1",{className:"text-3xl font-bold",children:"Trace Details"}),s.jsx("p",{className:"text-blue-100 text-lg mt-1",children:"Comprehensive trace execution analysis"})]})]})}),s.jsx(La,{className:"h-[calc(100vh-200px)] px-2",children:s.jsxs("div",{className:"space-y-8",children:[s.jsxs(qe,{className:"border-0 shadow-xl bg-white/80 backdrop-blur-sm",children:[s.jsx(yt,{className:"pb-6",children:s.jsxs(bt,{className:"flex items-center gap-3 text-2xl",children:[s.jsx("div",{className:"p-2 bg-gradient-to-r from-blue-500 to-purple-600 rounded-xl text-white",children:s.jsx(sn,{className:"h-6 w-6"})}),s.jsx("span",{className:"bg-gradient-to-r from-gray-900 to-gray-600 bg-clip-text text-transparent",children:"Basic Information"})]})}),s.jsx(wt,{className:"space-y-6",children:s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-gray-700",children:[s.jsx(pt,{className:"h-4 w-4 text-blue-600"}),"TRACE NAME"]}),s.jsx("div",{className:"p-4 bg-gradient-to-r from-blue-50 to-indigo-50 rounded-xl border border-blue-200/50 shadow-sm",children:s.jsx("p",{className:"font-mono text-sm text-gray-900 break-all",children:t.name})})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-gray-700",children:[s.jsx(pt,{className:"h-4 w-4 text-purple-600"}),"TRACE ID"]}),s.jsx("div",{className:"p-4 bg-gradient-to-r from-purple-50 to-pink-50 rounded-xl border border-purple-200/50 shadow-sm",children:s.jsx("p",{className:"font-mono text-sm text-gray-900 break-all",children:t.id})})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-gray-700",children:[s.jsx(ke,{className:"h-4 w-4 text-green-600"}),"START TIME"]}),s.jsx("div",{className:"p-4 bg-gradient-to-r from-green-50 to-emerald-50 rounded-xl border border-green-200/50 shadow-sm",children:s.jsx("p",{className:"font-mono text-sm text-gray-900",children:P(i,"MMM dd, yyyy HH:mm:ss")})})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-gray-700",children:[s.jsx(ke,{className:"h-4 w-4 text-orange-600"}),"END TIME"]}),s.jsx("div",{className:"p-4 bg-gradient-to-r from-orange-50 to-amber-50 rounded-xl border border-orange-200/50 shadow-sm",children:s.jsx("p",{className:"font-mono text-sm text-gray-900",children:l?P(l,"MMM dd, yyyy HH:mm:ss"):"In Progress"})})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-gray-700",children:[s.jsx(un,{className:"h-4 w-4 text-cyan-600"}),"DURATION"]}),s.jsx("div",{className:"p-4 bg-gradient-to-r from-cyan-50 to-sky-50 rounded-xl border border-cyan-200/50 shadow-sm",children:s.jsx("p",{className:"font-mono text-sm text-gray-900",children:c!==null?Yt(c):"N/A"})})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-gray-700",children:[s.jsx(le,{className:"h-4 w-4 text-indigo-600"}),"STATUS"]}),s.jsxs("div",{className:"p-4 bg-gradient-to-r from-indigo-50 to-violet-50 rounded-xl border border-indigo-200/50 shadow-sm",children:[f==="completed"&&s.jsxs(A,{className:"bg-gradient-to-r from-green-500 to-emerald-600 text-white border-0 shadow-lg text-sm px-4 py-2",children:[s.jsx(an,{className:"h-4 w-4 mr-2"}),"Completed"]}),f==="failed"&&s.jsxs(A,{className:"bg-gradient-to-r from-red-500 to-rose-600 text-white border-0 shadow-lg text-sm px-4 py-2",children:[s.jsx(Za,{className:"h-4 w-4 mr-2"}),"Failed"]}),f==="running"&&s.jsxs(A,{className:"bg-gradient-to-r from-blue-500 to-cyan-600 text-white border-0 shadow-lg text-sm px-4 py-2",children:[s.jsx(It,{className:"h-4 w-4 mr-2"}),"Running"]})]})]})]})})]}),s.jsxs(qe,{className:"border-0 shadow-xl bg-white/80 backdrop-blur-sm",children:[s.jsx(yt,{className:"pb-6",children:s.jsxs(bt,{className:"flex items-center gap-3 text-2xl",children:[s.jsx("div",{className:"p-2 bg-gradient-to-r from-green-500 to-blue-600 rounded-xl text-white",children:s.jsx(en,{className:"h-6 w-6"})}),s.jsx("span",{className:"bg-gradient-to-r from-gray-900 to-gray-600 bg-clip-text text-transparent",children:"Spans"}),s.jsxs(A,{className:"ml-auto bg-gradient-to-r from-green-500 to-blue-600 text-white border-0 shadow-lg text-base px-4 py-2",children:[d.length," ",d.length===1?"span":"spans"]})]})}),s.jsx(wt,{children:d.length>0?s.jsx("div",{className:"space-y-6",children:s.jsx("div",{className:"bg-gradient-to-r from-white to-gray-50/50 rounded-2xl border border-gray-200/50 shadow-lg p-6",children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsx("h4",{className:"text-lg font-semibold text-gray-900",children:"Timeline Visualization"}),s.jsx("div",{className:"text-sm text-gray-600 font-mono",children:i&&l?s.jsxs("span",{children:[P(i,"HH:mm:ss")," → ",P(l,"HH:mm:ss")]}):s.jsx("span",{children:"Timeline"})})]}),s.jsx("div",{className:"space-y-3",children:d.map((m,h)=>{var q,X;const g=m.startTime?new Date(m.startTime).getTime():0,x=m.endTime?new Date(m.endTime).getTime():Date.now(),y=i.getTime(),b=(l?l.getTime():Date.now())-y,M=b>0?(g-y)/b*100:0,k=b>0?(x-g)/b*100:100,R=["from-blue-500 to-blue-600","from-purple-500 to-purple-600","from-green-500 to-green-600","from-orange-500 to-orange-600","from-pink-500 to-pink-600","from-cyan-500 to-cyan-600","from-indigo-500 to-indigo-600","from-red-500 to-red-600"],I=R[h%R.length];return s.jsxs("div",{className:"relative",children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsxs("div",{className:"flex items-center gap-3",style:{marginLeft:`${m.level*20}px`},children:[m.hasChildren?s.jsx("button",{onClick:()=>o(m.id),className:"flex items-center justify-center w-5 h-5 rounded hover:bg-gray-200 transition-colors",title:n.has(m.id)?"Expand children":"Collapse children",children:n.has(m.id)?s.jsx(_e,{className:"w-3 h-3 text-gray-600"}):s.jsx(ja,{className:"w-3 h-3 text-gray-600"})}):s.jsx("div",{className:"w-5 h-5 flex items-center justify-center",children:m.level>0&&s.jsx("div",{className:"w-1 h-1 bg-gray-400 rounded-full"})}),m.level>0&&s.jsxs("div",{className:"flex items-center",children:[[...Array(m.level)].map((Z,ee)=>s.jsx("div",{className:"w-4 h-px bg-gray-300 mr-1"},ee)),s.jsx("div",{className:"w-2 h-2 border-l border-b border-gray-300 mr-2"})]}),s.jsx("div",{className:`w-3 h-3 rounded-full bg-gradient-to-r ${I}`}),s.jsx("span",{className:"text-sm font-medium text-gray-900 truncate max-w-xs",children:m.name||`Span ${h+1}`}),m.level>0&&s.jsxs(A,{variant:"outline",className:"text-xs px-2 py-1 bg-gray-50",children:["L",m.level]}),m.hasChildren&&s.jsxs(A,{variant:"outline",className:"text-xs px-2 py-1 bg-blue-50 text-blue-700",children:[(q=m.spans)==null?void 0:q.length," child",((X=m==null?void 0:m.spans)==null?void 0:X.length)!==1?"ren":""]})]}),s.jsx("div",{className:"flex items-center gap-2 text-xs text-gray-600",children:m.startTime&&m.endTime&&s.jsx(A,{variant:"outline",className:"text-xs px-2 py-1",children:Yt(x-g)})})]}),s.jsxs("div",{className:"relative h-8 bg-gray-100 rounded-lg overflow-hidden",style:{marginLeft:`${m.level*20}px`},children:[s.jsx("div",{className:"absolute inset-0 flex",children:[...Array(10)].map((Z,ee)=>s.jsx("div",{className:"flex-1 border-r border-gray-200 last:border-r-0"},ee))}),s.jsx("div",{className:`absolute top-1 bottom-1 bg-gradient-to-r ${I} rounded shadow-sm transition-all duration-300 hover:shadow-md`,style:{left:`${Math.max(0,Math.min(M,100))}%`,width:`${Math.max(1,Math.min(k,100-Math.max(0,M)))}%`},children:s.jsx("div",{className:"h-full flex items-center justify-center text-white text-xs font-medium px-2",children:k>15&&s.jsx("span",{className:"truncate",children:m.startTime&&P(new Date(m.startTime),"HH:mm:ss")})})})]}),s.jsx("div",{className:"mt-2 text-xs text-gray-500 font-mono pl-6",style:{marginLeft:`${m.level*20}px`},children:m.startTime&&s.jsxs("span",{children:["Start: ",P(new Date(m.startTime),"HH:mm:ss.SSS"),m.endTime&&s.jsxs("span",{className:"ml-4",children:["End: ",P(new Date(m.endTime),"HH:mm:ss.SSS")]})]})})]},m.id||h)})}),s.jsxs("div",{className:"mt-6 pt-4 border-t border-gray-200",children:[s.jsxs("div",{className:"flex justify-between text-xs text-gray-500 font-mono",children:[s.jsx("span",{children:"0%"}),s.jsx("span",{children:"25%"}),s.jsx("span",{children:"50%"}),s.jsx("span",{children:"75%"}),s.jsx("span",{children:"100%"})]}),s.jsx("div",{className:"mt-1 text-xs text-gray-400 text-center",children:"Timeline Progress"})]})]})})}):s.jsxs("div",{className:"text-center py-20",children:[s.jsx("div",{className:"inline-flex items-center justify-center p-6 bg-gradient-to-r from-gray-100 to-gray-200 rounded-3xl mb-6",children:s.jsx(ln,{className:"h-12 w-12 text-gray-500"})}),s.jsx("h3",{className:"text-2xl font-bold bg-gradient-to-r from-gray-900 to-gray-600 bg-clip-text text-transparent mb-3",children:"No spans found for this trace"}),s.jsx("p",{className:"text-gray-600 max-w-md mx-auto text-lg",children:"Spans will appear here when available"})]})})]})]})})]})})}function jo(e){const[a,t]=v.useState(void 0),[n,r]=v.useState([void 0]),[o,i]=v.useState(0),l=v.useCallback(d=>{const f=[...n.slice(0,o+1),d];r(f),t(d),i(o+1)},[n,o]),c=v.useCallback(()=>{if(o>0){const d=n[o-1];t(d),i(o-1)}},[n,o]),u=v.useCallback(()=>{t(void 0),r([void 0]),i(0)},[]);return{cursor:a,currentPage:o,handleNextPage:l,handlePrevPage:c,resetPagination:u}}const No=e=>e<100?"bg-green-500":e<500?"bg-yellow-500":e<1e3?"bg-orange-500":"bg-red-500",Lt=e=>e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(2)}s`:`${(e/6e4).toFixed(2)}m`;function po({selectedTraces:e,onSelectAll:a,onSelectRow:t,onViewTrace:n,onDeleteTrace:r,currentTraces:o}){return[{id:"select",header:({table:i})=>{const l=o.length>0&&o.every(u=>e[u.id]),c=o.some(u=>e[u.id])&&!l;return s.jsx(Ve,{checked:l,ref:u=>{u&&(u.indeterminate=c)},onCheckedChange:u=>a(!!u),"aria-label":"Select all",className:"translate-y-[2px]"})},cell:({row:i})=>s.jsx(Ve,{checked:!!e[i.original.id],onCheckedChange:l=>t(i.original.id,!!l),"aria-label":"Select row",className:"translate-y-[2px]"}),enableSorting:!1,enableHiding:!1},{accessorKey:"startTime",header:"Start Time",enableSorting:!0,cell:({row:i})=>{const l=new Date(i.getValue("startTime"));return s.jsxs("div",{className:"space-y-1",children:[s.jsx("div",{className:"text-sm font-medium text-gray-900",children:P(l,"MMM dd, HH:mm:ss")}),s.jsx("div",{className:"text-xs text-gray-500",children:P(l,"yyyy")})]})}},{accessorKey:"name",header:"Trace Name",cell:({row:i})=>{const l=new Date(i.getValue("startTime"));return s.jsxs("div",{className:"space-y-1",children:[s.jsx("div",{className:"font-medium text-gray-900",children:i.getValue("name")}),s.jsxs("div",{className:"text-xs text-gray-500 flex items-center gap-1",children:[s.jsx(It,{className:"h-3 w-3"}),P(l,"HH:mm:ss")]})]})}},{accessorKey:"duration",header:"Duration",cell:({row:i,table:l})=>{const c=i.getValue("status"),u=new Date(i.getValue("startTime")),d=i.original.endTime;console.log({startTime:u,endTime:d});const m=l.getRowModel().rows.map(b=>b.original).map(b=>{const M=new Date(b.startTime).getTime();if(b.endTime){const k=new Date(b.endTime).getTime();return Math.max(0,k-M)}else if(b.status==="running"){const k=new Date().getTime();return Math.max(0,k-M)}return 0}),h=m.length>0?Math.max(...m):1;if(!d&&c==="running"){const M=Math.max(0,new Date().getTime()-u.getTime()),k=Lt(M),R=h>0?Math.min(M/h*100,100):0;return s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"flex items-center",children:s.jsx("span",{className:"text-sm font-mono font-medium text-gray-900",children:k})}),s.jsx("div",{className:"w-full bg-gray-200 rounded-full h-2",children:s.jsx("div",{className:"bg-blue-500 h-2 rounded-full animate-pulse",style:{width:`${R}%`}})})]})}if(!d)return s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"flex items-center",children:s.jsx("span",{className:"text-sm font-mono font-medium text-gray-500",children:"-"})}),s.jsx("div",{className:"w-full bg-gray-200 rounded-full h-2",children:s.jsx("div",{className:"bg-gray-300 h-2 rounded-full",style:{width:"0%"}})})]});const g=Math.max(0,new Date(d).getTime()-u.getTime()),x=Lt(g),y=No(g),p=h>0?Math.min(g/h*100,100):0;return s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"flex items-center",children:s.jsx("span",{className:"text-sm font-mono font-medium text-gray-900",children:x})}),s.jsx("div",{className:"w-full bg-gray-200 rounded-full h-2",children:s.jsx("div",{className:`h-2 rounded-full transition-all duration-300 ${y}`,style:{width:`${p}%`}})})]})}},{accessorKey:"spans",header:"Spans",cell:({row:i})=>{const l=i.getValue("spans"),c=(l==null?void 0:l.length)||0;return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(A,{variant:"outline",className:"text-purple-600 border-purple-200",children:c}),s.jsx("span",{className:"text-xs text-gray-500",children:c===1?"span":"spans"})]})}},{accessorKey:"status",header:"Status",cell:({row:i})=>{const l=i.getValue("status"),c=new Date(i.getValue("startTime")),d=new Date().getTime()-c.getTime()<3e5;switch(l){case"running":return s.jsxs(A,{variant:"outline",className:"text-blue-600 border-blue-200",children:[s.jsx(le,{className:"h-3 w-3 mr-1 animate-pulse"}),"Running"]});case"failed":return s.jsxs(A,{variant:"outline",className:"text-red-600 border-red-200",children:[s.jsx(Nt,{className:"h-3 w-3 mr-1"}),"Failed"]});case"completed":default:return s.jsxs(A,{variant:"outline",className:`${d?"text-green-600 border-green-200":"text-gray-600 border-gray-200"}`,children:[s.jsx(Nt,{className:"h-3 w-3 mr-1"}),"Completed"]})}}},{id:"actions",header:"",cell:({row:i})=>{const l=i.original;return s.jsx(O,{variant:"ghost",size:"icon",onClick:()=>n(l),className:"rounded-full hover:bg-blue-50 hover:border-blue-200 border border-transparent transition-all duration-200 group","aria-label":"View trace details",children:s.jsx(_e,{className:"h-4 w-4 text-gray-600 group-hover:text-blue-600 transition-colors"})})},size:50}]}const Do=500,Rt=20;function Mo({projectId:e}){const{searchQuery:a,inputValue:t,setSearchQuery:n,filterModalOpen:r,openFilterModal:o,setFilterModalOpen:i,filters:l,handleApplyFilters:c,handleResetFilters:u,filtersActive:d}=hn({debounceTimeout:Do}),{sortDirection:f,sorting:m,handleToggleSortDirection:h,setSorting:g,resetSort:x}=vn("desc"),{cursor:y,currentPage:p,handleNextPage:b,handlePrevPage:M,resetPagination:k}=jo(),{isDetailSheetOpen:R,currentTraceDetail:I,openDetailSheet:q,setIsDetailSheetOpen:X}=xn(),[Z,ee]=v.useState([]),Oe={limit:Rt,sortDirection:f,...l.status.length>0?{status:l.status}:{},...l.fromDate?{fromDate:l.fromDate}:{},...l.toDate?{toDate:l.toDate}:{},...l.minDuration!==void 0?{minDuration:l.minDuration}:{},...l.maxDuration!==void 0?{maxDuration:l.maxDuration}:{},...a?{nameContains:a}:{},...y?{cursor:y}:{}},{data:Q,isLoading:te,isError:Fe,refetch:he}=fn(e,Oe),W=(Q==null?void 0:Q.traces)??[],j=(Q==null?void 0:Q.hasNextPage)||!1,w=v.useCallback(()=>{if(j&&W.length>0){const _=W[W.length-1];return console.log("get next cursor",{cursor:y,latestTrace:_}),{id:_.id,timestamp:_.startTime}}return null},[j,W]),{selectedTraces:L,selectedCount:ge,handleSelectAll:oe,handleSelectRow:it,resetSelection:ae}=gn(W),ia=v.useCallback(_=>{c(_),k(),ae()},[c,k,ae]),lt=v.useCallback(()=>{u(),k(),x(),ae()},[u,k,x,ae]),la=v.useCallback(()=>{h(),k(),ae()},[h,k,ae]),ca=v.useCallback(()=>{const _=w();_&&b(_)},[b,w]),da=v.useCallback(()=>{M()},[M]);v.useCallback(()=>{k(),he()},[k,he]);const ct=v.useCallback(_=>{q(_)},[q]),dt=v.useCallback(_=>{ve.info(`Mock Deleting trace ${_}...`,{description:"This is a placeholder. Actual deletion would be implemented here."})},[]),ua=()=>{const _=Object.keys(L).filter(Ne=>L[Ne]);ve.info(`Mock Deleting ${_.length} traces...`,{description:"This is a placeholder. Actual deletion would be implemented here."}),ae()},ma=()=>{const _=Object.keys(L).filter(Ne=>L[Ne]);ve.info(`Mock Exporting ${_.length} traces...`,{description:"This is a placeholder. Actual export would be implemented here."})},fa=()=>{const _=Object.keys(L).filter(ne=>L[ne]),ga=W.filter(ne=>_.includes(ne.id)).map(ne=>`[${new Date(ne.startTime).toLocaleString()}] ${ne.name} (${ne.id})`).join(`
`);navigator.clipboard.writeText(ga).then(()=>{ve.success(`Copied ${_.length} traces to clipboard`)}).catch(()=>{ve.error("Failed to copy traces to clipboard")})},ut=v.useMemo(()=>po({selectedTraces:L,onSelectAll:_=>oe(_),onSelectRow:it,onViewTrace:ct,onDeleteTrace:dt,currentTraces:W}),[L,oe,it,ct,dt,W]),ha=Ra({data:W,columns:ut,getCoreRowModel:Ha(),getSortedRowModel:Aa(),getFilteredRowModel:Ia(),onSortingChange:g,onColumnFiltersChange:ee,state:{sorting:m,columnFilters:Z},manualPagination:!0,manualSorting:!0,manualFiltering:!0,enableRowSelection:!0,onRowSelectionChange:()=>{},debugTable:!1});return s.jsxs(s.Fragment,{children:[s.jsx(bo,{open:r,onOpenChange:i,filters:l,onApply:ia,onReset:lt,projectId:e}),s.jsxs(qe,{className:"bg-white/60 backdrop-blur-sm border-gray-200/50 shadow-lg w-full",children:[s.jsx(Er,{filters:l,sortDirection:f,onOpenFilterModal:o,onToggleSortDirection:la,displayedTraceCount:te?void 0:W.length,isLoading:te}),s.jsx(Yr,{searchQuery:t,onSearchQueryChange:n,onOpenFilterModal:o,selectedCount:ge,onDeleteSelected:ua,onExportSelected:ma,onCopySelected:fa,isLoading:te}),s.jsx(Lr,{table:ha,columns:ut,isLoading:te,isError:Fe,traces:W,selectedTraces:L,isFiltered:d||!!a,onRetry:()=>{k(),he()},onClearFilters:lt}),s.jsx(Rr,{currentPage:p,hasNextPage:j,onPrevPage:da,onNextPage:ca,isLoading:te,currentTraceCount:W.length,pageSize:Rt})]}),s.jsx(wo,{open:R,onOpenChange:X,trace:I})]})}function Co({projectId:e}){const{data:a,isLoading:t,isError:n}=Da(e),{data:r,isLoading:o}=Ba(e),i=$a(),[l,c]=v.useState(!1),{editModalOpen:u,setEditModalOpen:d,deleteDialogOpen:f,setDeleteDialogOpen:m,autoRefresh:h,setAutoRefresh:g,handleRefresh:x,handleDeleteProject:y,handleConfirmDelete:p,handleEditProject:b,handleEditSubmit:M,updateProject:k,deleteProject:R}=Ma(e),I=()=>{c(!0)},q=()=>{i.mutate(e,{onSuccess:()=>{c(!1)}})},X=t||o;return v.useEffect(()=>{if(!h)return;const Z=setInterval(()=>{x()},5e3);return()=>clearInterval(Z)},[h,e,x]),e?t?s.jsx(ka,{}):n||!a?s.jsx(Sa,{projectId:e,project:a}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"min-h-full bg-gradient-to-br from-slate-50 via-blue-50 to-indigo-50 p-6",children:s.jsxs("div",{className:"max-w-6xl mx-auto space-y-8",children:[s.jsx(_a,{project:a,isRefreshing:X,autoRefresh:h,onAutoRefreshChange:g,onEdit:b,onDelete:y,onClearLogs:I,onRefresh:x}),s.jsx(Pa,{projectId:a.id,currentPage:"traces"}),s.jsxs("div",{className:"bg-white/60 backdrop-blur-sm border border-gray-200/50 shadow-lg rounded-lg p-6",children:[s.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-6",children:"Project Traces"}),s.jsx(Mo,{projectId:a.id})]})]})}),s.jsx(Ja,{open:u,onOpenChange:d,initialData:a?{name:a.name,description:a.description}:void 0,onSubmit:M,loading:k.isPending,mode:"edit"}),s.jsx(jt,{open:f,onOpenChange:m,title:"Delete Project?",description:"This will permanently delete the project and all its logs. This action cannot be undone.",onConfirm:p,loading:R.isPending,confirmLabel:"Delete"}),s.jsx(jt,{open:l,onOpenChange:c,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:q,loading:i.isPending,confirmLabel:"Clear Logs"})]}):s.jsx(Ca,{})}const Io=()=>{const{projectId:e}=Na.useParams();return s.jsx(Co,{projectId:e})};export{Io as component};
