import{d as b,e as k,c as n,a as t,f as g,w,t as a,u as v,F as x,b as l,l as N,r as m,j as T,m as D,o as r,h as I,_ as V}from"./index.js";import{c as R,s as C}from"./client.js";import{S as J}from"./SpanTree.js";const O={class:"breadcrumbs"},z={class:"page-header"},B={class:"page-header__subtitle mono"},F={class:"flex gap-2"},j={class:"badge badge--info"},A={key:0,class:"loading-center"},M={key:1,class:"card",style:{color:"var(--error)"}},$={key:0,class:"card mb-4"},E={class:"trace-summary"},P={class:"trace-summary__stat"},q={class:"trace-summary__value"},G={class:"trace-summary__stat"},H={class:"trace-summary__value mono"},K={class:"trace-summary__stat"},L={class:"trace-summary__value"},Q={class:"trace-summary__stat"},U={style:{"font-size":"0.85rem","font-weight":"500"}},W={key:1,class:"trace-io mb-4"},X={key:0,class:"trace-io__card"},Y={class:"trace-io__value"},Z={key:1,class:"trace-io__card"},tt={class:"trace-io__value"},st={key:2,class:"mt-4"},et={class:"json-view"},at=b({__name:"TraceDetailView",setup(ot){const c=N().params.runId,o=m([]),p=m(!0),_=m("");k(async()=>{try{o.value=await R.getRunTrace(c)}catch(e){_.value=e.message}finally{p.value=!1}});const u=T(()=>o.value.find(e=>!e.ParentSpanId));function i(e){var s,d;return((d=(s=u.value)==null?void 0:s.SpanAttributes)==null?void 0:d[e])??""}function y(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function h(){if(!u.value)return"—";const e=u.value.Duration/1e6;return e<1e3?`${Math.round(e)}ms`:`${(e/1e3).toFixed(1)}s`}return(e,s)=>{var f;const d=D("router-link");return r(),n("div",null,[t("div",O,[g(d,{to:"/traces"},{default:w(()=>[...s[0]||(s[0]=[I("Traces",-1)])]),_:1}),s[1]||(s[1]=t("span",null,"›",-1)),t("span",null,a(v(C)(v(c))),1)]),t("div",z,[t("div",null,[s[2]||(s[2]=t("h1",null,"Trace Detail",-1)),t("div",B,"Run "+a(v(c)),1)]),t("div",F,[t("span",j,a(o.value.length)+" spans",1)])]),p.value?(r(),n("div",A,[...s[3]||(s[3]=[t("div",{class:"spinner"},null,-1)])])):_.value?(r(),n("div",M,a(_.value),1)):(r(),n(x,{key:2},[o.value.length>0?(r(),n("div",$,[t("div",E,[t("div",P,[s[4]||(s[4]=t("div",{class:"section__title"},"Total Spans",-1)),t("div",q,a(o.value.length),1)]),t("div",G,[s[5]||(s[5]=t("div",{class:"section__title"},"Duration",-1)),t("div",H,a(h()),1)]),t("div",K,[s[6]||(s[6]=t("div",{class:"section__title"},"Services",-1)),t("div",L,a(new Set(o.value.map(S=>S.ServiceName)).size),1)]),t("div",Q,[s[7]||(s[7]=t("div",{class:"section__title"},"Root Span",-1)),t("div",U,a(((f=u.value)==null?void 0:f.SpanName)||"—"),1)])])])):l("",!0),i("input.value")||i("output.value")?(r(),n("div",W,[i("input.value")?(r(),n("div",X,[s[8]||(s[8]=t("div",{class:"trace-io__label"},"Input",-1)),t("pre",Y,a(y(i("input.value"))),1)])):l("",!0),i("output.value")?(r(),n("div",Z,[s[9]||(s[9]=t("div",{class:"trace-io__label"},"Output",-1)),t("pre",tt,a(y(i("output.value"))),1)])):l("",!0)])):l("",!0),g(J,{spans:o.value},null,8,["spans"]),o.value.length>0?(r(),n("div",st,[t("details",null,[s[10]||(s[10]=t("summary",{style:{cursor:"pointer",color:"var(--text-secondary)","font-size":"0.85rem","margin-bottom":"8px"}}," Raw span data ",-1)),t("div",et,a(JSON.stringify(o.value,null,2)),1)])])):l("",!0)],64))])}}}),ut=V(at,[["__scopeId","data-v-8d20dc57"]]);export{ut as default};
