1import{aO as xt,a as t,by as Et,D as re,km as u,aI as bt,gf as Tt,L as We,j as l,W as J,kn as M,ai as qe,N as vt,cP as Ct,ko as U,kp as kt,aP as xe,n as se,o as ne,p as ae,cQ as oe,cW as Xe,r as Ee,w as _,kq as Ye,G as St,l as Me,b4 as q,b6 as X,b3 as Y,U as me,J as ke,aT as ge,an as It,O as V,ap as Nt,ao as Se,kr as Lt,a5 as wt,aM as Mt,ks as _t,aw as Ke,ae as Dt,da as W,kt as At,ku as Bt,fV as Ze,eW as Pt,kv as Ot,eS as Vt,eT as Ie,eU as Gt,cD as Ft,kw as pe,cd as be,aG as Ne,ad as Z,g4 as Rt,fm as Kt,cT as ie,kx as Ht,_ as Je,al as Qt,ky as jt,af as ze,a0 as et,a1 as tt,db as le,c7 as Ut,it as $t,d4 as Wt,cK as He,dc as qt,eK as te,kz as Xt,dd as Yt,bb as de,ag as Zt,bD as rt,bH as Jt,dh as zt,kA as er,hv as tr,kB as rr,kC as sr,a4 as st,Z as nr,a7 as ar,bE as or,bF as lr,kD as cr,di as ir,dK as dr,bu as ur,bC as hr,bI as mr,bw as gr,bJ as ue}from"./index-BFa3nKuT.js";import{a as x,p as Q,e as Qe}from"./datepicker-CN3oO0F6.js";import"./visx-o561FtCw.js";import{u as pr,E as fr,a as nt,b as yr,F as xr,c as Er,C as br}from"./router-c71EEzlZ.js";import{g as at}from"./pagination-D7CFms1s.js";import{u as Tr,m as vr,N as ot}from"./apollo-B9xYJgZj.js";import{R as Cr,a7 as kr,a2 as Sr,a3 as Ir,a4 as Nr,ak as Lr,ar as wr,a5 as Mr,a6 as _r}from"./charts-BEfaN6Tb.js";import{c as Dr}from"./tanstack-82Oensom.js";import{A as Ar}from"./executionDisplayLabel-DDOCh7EL.js";import"./framerMotion-KnKeNhwd.js";import"./shiki-DSW_v8w1.js";import"./betterAuth-wecmey9t.js";import"./virtuoso-_8EeKo1c.js";import"./sentry-BM1d0HPc.js";import"./forms-BE_8TKCw.js";import"./amplitude-rTYtQKJT.js";import"./amplify-FijOe782.js";import"./qrcode-CMNUHY9J.js";import"./dnd-BjCurfON.js";import"./accordion-SF-PpDjf.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"01e610d75577dcaf5e5c9af84e79c9458f58a767"},e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=(function(s){for(var n=1;n<arguments.length;n++){var a=arguments[n];if(a!=null)for(var d in a)a.hasOwnProperty(d)&&(s[d]=a[d])}return s})({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:currents-dashboard":!0});var r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="50770948-4f5c-4145-95e9-ccc1349b57ee",e._sentryDebugIdIdentifier="sentry-dbid-50770948-4f5c-4145-95e9-ccc1349b57ee")}catch{}})();function Br(e){for(var r=-1,s=e==null?0:e.length,n=0,a=[];++r<s;){var d=e[r];d&&(a[n++]=d)}return a}const lt="error_explorer",ct=14,z=()=>xt({key:lt,defaultLookback:ct}),Pr=()=>t(Et,{queryKey:lt,defaultLookback:ct}),fe=vr(null),it=e=>{fe()!==e&&fe(e)},Or=()=>{it(null)},ee=()=>{const e=Tr(fe),[r,s]=z();return x.useEffect(()=>{if(e){const{start:n,end:a}=e;(r>new Date(n)||s<new Date(a))&&fe(null)}},[r.toString(),s.toString()]),[e,it]},ce=e=>{const[r,s]=re(e,bt);function n(a){if(!a)return s(void 0);s(a)}return[r??null,n]},_e=()=>ce("e"),De=()=>ce("e_c"),Ae=()=>ce("e_a"),Be=()=>ce("e_t"),Pe=()=>ce("e_tt"),Vr=We(["test","branch","none"]),Gr=()=>{const[e,r]=re("error_details_group",Vr);return[e??"test",n=>r(n)]},Fr=Tt(Object.values(u)),Oe=()=>{const[e,r]=re("by",Fr);function s(a){if(!a)return r(void 0);r(a)}let n=e??[];return n.length===0&&(n=[u.Message]),[n,s]},Rr=[{value:M.Occurrence,label:Te(M.Occurrence)},{value:M.Test,label:Te(M.Test)},{value:M.Branch,label:Te(M.Branch)}],Ve=()=>{const[e,r]=re("metric",We([M.Occurrence,M.Test,M.Branch]));return[e??M.Occurrence,r]},Kr=()=>{const[e,r]=Ve();return l("div",{className:"flex items-center gap-2 justify-between",children:[t(J,{span:!0,children:"Metric"}),t(qe,{value:e,onValueChange:s=>r(s),options:Rr,placeholder:"Metric"})]})};function Te(e){switch(e){case M.Branch:return"Branch";case M.Test:return"Test";default:case M.Occurrence:return"Occurrence"}}const dt=[3,5,10],Hr=dt.map(e=>({value:e.toString(),label:e.toString()})),ut=()=>{const[e,r]=re("top_items",vt);return[e??dt[0],r]},Qr=()=>{const[e,r]=ut();return l("div",{className:"flex items-center gap-2 justify-between",children:[t(J,{span:!0,children:"Top Items"}),t(qe,{value:e.toString(),onValueChange:s=>r(parseInt(s,10)),options:Hr,placeholder:"Top Items"})]})},jr=e=>Br([{label:e.map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join(" + "),value:U.Error},{label:"Occurrences",value:U.Count},{label:"Affected Tests",value:U.Tests},{label:"Affected Branches",value:U.Branches}]),ht=()=>{const[e,r]=Ct();return[e??U.Count,r]},Ur=e=>{const r=$r(),{loading:s,data:n,previousData:a,error:d}=kt({fetchPolicy:"cache-and-network",variables:{input:{...e,...r,limit:e.limit}}});return{data:s?a:n,loading:s,error:d}},$r=()=>
1{const[e]=xe(),[r]=se(),[s]=ne(),[n]=ae(),[a]=oe(),[d]=ht(),[m]=Xe(),[g]=ee(),[p]=Ee("tags"),[i]=Ve(),[h]=ut();return{groups:e,branches:r,authors:s,tags:n,page:a,orderBy:d,orderDirection:m,zoomStart:g!=null&&g.start?_(Q(g.start)):null,zoomEnd:g!=null&&g.end?_(Q(g.end)):null,tagsLogicalOperator:p,metric:i,topItemsLimit:h}},ve=300,je=10,Wr=10,qr=28,Xr=0,Yr=e=>{const r=e.flatMap(s=>s.items);return Cr(r,"key")},mt=(e,r)=>{var s;return(s=e.items)==null?void 0:s.find(n=>n.key===r)},Zr=(e,r,s)=>{const n=mt(e,r);if(!n)return 0;switch(s){case M.Test:return n.tests??0;case M.Branch:return n.branches??0;case M.Occurrence:default:return n.count??0}},Jr=(e,r)=>s=>Zr(s,e,r),zr=(e,r)=>e.slice().sort((s,n)=>Ye(s.name,n.name)).map(s=>{const n=r(s.payload,s.name);return n?{color:s.color,key:s.name,message:n.message,error_category:n.error_category,error_action:n.error_action,error_target:n.error_target,signature:n.signature,title:n.title,spec:n.spec,value:s.value}:null}).filter(St),Ge={[u.Target]:"error_target",[u.Action]:"error_action",[u.Category]:"error_category",[u.Message]:"message",[u.Test]:"title"},es={[u.Target]:"Target",[u.Message]:"Message",[u.Action]:"Action",[u.Category]:"Category",[u.Test]:"Test"},ye={[u.Target]:"Target",[u.Message]:"Message",[u.Action]:"Action",[u.Category]:"Category",[u.Test]:"Test"},gt={[u.Target]:"e.g. CSS selector, URL, Hook etc.",[u.Message]:"original error message",[u.Action]:"e.g. click, submit, etc.",[u.Category]:"e.g. Assertion, Timeout, etc.",[u.Test]:"test title and spec"},ts={[u.Target]:"T",[u.Message]:"M",[u.Action]:"A",[u.Category]:"C",[u.Test]:"TE"},Le=[u.Target,u.Message,u.Action,u.Category,u.Test],H=({value:e,short:r=!0})=>l("div",{className:"flex items-center gap-1",children:[t("span",{className:Me("text-white text-[8px] bg-theme-warning rounded px-2 font-medium text-center w-[12px] h-[16px] flex justify-center items-center shadow-sm saturate-60",e===u.Message&&"bg-theme-error",e===u.Action&&"bg-theme-violet",e===u.Category&&"bg-theme-success",e===u.Target&&"bg-theme-warning",e===u.Test&&"bg-theme-cyan",{"w-fit":!r||e===u.Test}),children:r?ts[e]:ye[e]}),!r&&t("span",{className:"text-[10px]",children:gt[e]})]}),rs=({value:e})=>e===null?t("span",{className:"bg-theme-hover rounded px-1 py-0.5 font-mono text-[10px] truncate",children:"null"}):t("span",{className:"truncate",children:e}),Fe=({children:e,className:r,brackets:s,...n})=>l("div",{className:Me("ty-text relative truncate rounded",{"pl-6":s},r),...n,children:[e,s&&t(ss,{})]}),ss=()=>t("div",{className:"absolute top-1/2 left-[10px] border-l border-t border-b border-theme-secondary h-[80%] w-[4px] translate-y-[-50%]",children:t("div",{className:"absolute top-1/2 left-0 -translate-x-1/2 -translate-y-1/2 leading-none"})}),Re=({dimension:e,value:r})=>t("div",{className:"flex gap-2",children:l(Y,{children:[l(q,{className:"flex items-center gap-2 relative truncate w-fit",children:[t(H,{value:e}),t(rs,{value:r})]}),l(X,{side:"top",align:"center",className:"flex flex-col gap-1 text-xs break-all max-w-[300px]",children:[t("span",{children:t(H,{value:e,short:!1})}),t("span",{className:"font-mono text-[10px] break-all",children:r})]})]},e)});function ns(e){const[r]=Oe();return t(Fe,{className:Me("flex flex-col gap-1 py-1"),brackets:r.length>1,children:r==null?void 0:r.map(s=>t(Re,{dimension:s,value:e.row.original[Ge[s]]},s))})}const as=({payload:e,dimensions:r})=>{if(!e||!e.length)return null;const s=zr(e,mt);return t(os,{date:e[0].payload.date,tooltipData:s,dimensions:r})},os=({date:e,dimensions:r,tooltipData:s})=>l(Nt,{children:[t(It,{font:me.font.small,span:!0,b:!0,children:t(ke,{value:ge(e),short:!0})}),s.map(n=>t(ls,{dimensions:r,item:n},n.key)),l(we,{children:[t("span",{}),t(J,{span:!0,font:me.font.smaller,b:!0,children:"Overall"}),t("span",{className:"text-right font-mono text-xs text-theme-secondary",children:V(s.reduce((n,a)=>n+a.value,0))})]})]}),we=({children:e})=>t("div",{className:"grid grid-cols-[16px_minmax(20px,300px)_auto] gap-2 items-baseline",children:e}),ls=({dimensions:e,item:r})=>r.key==="Others"?l(we,{children:[t(Se,{color:r.color,active:!0}),t(J,{span:!0,font:me.font.smaller,children:r.key}),t("span",{className:"text-right font-mono text-xs text-theme-secondary",children:V(r.value)})]}):l(we,{children:[t(Se,{color:r.color,active:!0}),t(Fe,{className:"flex flex-col gap-1",children:e.map(s=>t(Re,{dimension:s,value:r[Ge[s]]??null},s))}),t("span",{className:"text-right font-mono text-xs text-theme-secondary",children:V(r.value)})]}),pt=10,cs="var(--ui-v2-elevation-3)",is="var(--ui-v2-border-main)",Ue="var(--ui-v2-content-secondary-idle)",ds=({x:e=0,y:r=0,width:s=pt,height:n=0})=>{const a=r+n/2-4,d=r+n/2+4,m=e+s/2;return l("g",{style:{cursor:"ew-resize"},children:[t("rect",{x:e,y:r,width:s,height:n,rx:2,ry:2,fill:cs,stroke:is,strokeWidth:1}),t("line",{x1:m-1.5,x2:m-1.5,y1:a,y2:d,stroke:Ue,strokeWidth:1}),t("line",{x1:m+1.5,x2:m+1.5,y1:a,y2:d,stroke:Ue,strokeWidth:1})]})},us=({sortedLegend:e,colorMap:r,activeKeys:s,dimensions:n,onLegendClick:a})=>t(Lt,{children:e.map(d=>l("div",{onClick:()=>
1a(d.key),title:d.key,className:"text-theme-secondary grid grid-cols-[16px_minmax(20px,auto)] items-baseline",children:[t(Se,{color:r[d.key],active:s.includes(d.key)||s.length===0}),d.key==="Others"&&t("span",{className:"text-xs",children:d.key}),d.key!=="Others"&&t(Fe,{className:"flex flex-col gap-1 text-xs",children:n.map(m=>t(Re,{dimension:m,value:d[Ge[m]]},m))})]},d.key))}),hs=({timeline:e,loading:r,dimensions:s})=>{const n=wt(),[a]=Ve(),[,d]=oe(),[m,g]=ee(),[p,i]=x.useState([]),h=x.useCallback(c=>as({...c,dimensions:s}),[s]),y=x.useMemo(()=>Yr(e),[e]),f=x.useMemo(()=>y.map(c=>c.key),[y]),T=x.useMemo(()=>Mt(f),[f]),k=x.useMemo(()=>[...y].sort((c,v)=>Ye(c.key,v.key)),[y]),S=x.useMemo(()=>[...y].sort((c,v)=>_t(c.key,v.key)),[y]),I=x.useCallback(c=>{i(v=>v.includes(c)?v.filter(o=>o!==c):v.length===0?[c]:[c,...v.filter(o=>o!==c)])},[]),E=x.useMemo(()=>({value:a.charAt(0).toUpperCase()+a.slice(1),angle:-90,position:"insideLeft",className:"fill-theme-secondary font-sans text-xs"}),[a]),C=x.useCallback(c=>Ke(ge(c)),[]),D=x.useCallback(c=>new Intl.NumberFormat("en").format(c),[]),j=x.useMemo(()=>({fill:n.palette.secondary}),[n.palette.secondary]),G=x.useMemo(()=>({fill:n.palette.secondary}),[n.palette.secondary]),B=x.useMemo(()=>r?!1:{fill:n.palette.foregroundHover,opacity:.05},[r,n.palette.foregroundHover]),P=x.useCallback(()=>t(us,{sortedLegend:k,colorMap:T,activeKeys:p,dimensions:s,onLegendClick:I}),[k,T,p,s,I]),[b,w]=x.useState(null);x.useEffect(()=>{if(!m){w(null);return}w(c=>(c==null?void 0:c.startIndex)===m.startIndex&&(c==null?void 0:c.endIndex)===m.endIndex?c:{startIndex:m.startIndex,endIndex:m.endIndex})},[m]);const F=x.useCallback(c=>{const{startIndex:v,endIndex:o}=c;v===void 0||o===void 0||w({startIndex:v,endIndex:o})},[]),O=x.useCallback(()=>{var K,$;if(!b)return;const{startIndex:c,endIndex:v}=b,o=(K=e[c])==null?void 0:K.date;let L=($=e[v])==null?void 0:$.date;!o||!L||(o===L&&(L=Qe(Q(L),1).toISOString()),g({start:o,end:L,startIndex:c,endIndex:v}))},[b,e,g]),N=x.useCallback(c=>{if(!(c!=null&&c.date))return;const v=e.findIndex(o=>o.date===c.date);d(1),g({start:c.date,end:Qe(Q(c.date),1).toISOString(),startIndex:v,endIndex:v})},[e,d,g]),R=x.useMemo(()=>S.filter(c=>p.length===0||p.includes(c.key)).map(c=>({key:c.key,dataKey:Jr(c.key,a),fill:T[c.key]})),[S,p,a,T]),A=r&&e.length===0;return t(Dt,{flexDirection:"column",gap:n.layout.gapHalf,width:"100%",children:t("div",{className:"relative w-full",style:{height:ve},children:A?t("div",{className:"absolute inset-0 z-10 h-full w-full animate-pulse rounded-md bg-theme-hover/50"}):t(kr,{width:"100%",height:ve,children:l(_r,{data:e,height:ve,children:[t(Sr,{dataKey:"date",fontSize:je,tick:G,tickFormatter:Ke,minTickGap:24,interval:"preserveStartEnd"}),t(Ir,{fontSize:je,tickCount:Wr,tick:j,fill:n.palette.foreground,tickFormatter:D,tickLine:!1,label:E,className:"fill-theme-secondary font-mono text-xs"}),t(Nr,{content:h,cursor:B}),t(Lr,{content:P}),t(wr,{alwaysShowText:!0,dataKey:"date",height:qr,travellerWidth:pt,traveller:ds,startIndex:b==null?void 0:b.startIndex,endIndex:b==null?void 0:b.endIndex,className:"text-xs [&_.recharts-text]:fill-[var(--ui-v2-chart-axis)] [&_.recharts-brush-slide]:fill-[var(--ui-v2-ui-primary-selected)] [&_.recharts-brush-slide]:[fill-opacity:1]",fill:"var(--ui-v2-elevation-canvas)",stroke:"var(--ui-v2-chart-grid)",onChange:F,onDragEnd:O,tickFormatter:C}),R.map(c=>t(Mr,{name:c.key,dataKey:c.dataKey,stackId:Xr,fill:c.fill,isAnimationActive:!1,className:"cursor-pointer",onClick:N},c.key))]})})})})},he=Dr(),Ce={kind:"fixed",px:140},ms=e=>{const r=e.map(s=>es[s]).join(" + ");return[he.accessor("message",{id:"message",minSize:320,size:560,meta:{alwaysVisible:!0,selectorLabel:r,sortValue:U.Error,align:"start"},header:()=>r,cell:ns}),he.accessor("count",{id:"count",meta:{selectorLabel:"Occurrences",sortValue:U.Count,width:Ce},header:()=>"Occurrences",cell:s=>t(W.NumberCell,{children:V(s.getValue())})}),he.accessor(s=>s.details.tests.count,{id:"affectedTests",meta:{selectorLabel:"Affected Tests",sortValue:U.Tests,width:Ce},header:()=>"Affected Tests",cell:s=>t(W.NumberCell,{children:V(s.getValue())})}),he.accessor(s=>s.details.branches.count,{id:"affectedBranches",meta:{selectorLabel:"Affected Branches",sortValue:U.Branches,width:Ce},header:()=>"Affected Branches",cell:s=>t(W.NumberCell,{children:V(s.getValue())})})]},gs=25,$e=e=>`${e.instanceId}:${e.testId}:${e.groupId}:${e.createdAt}`;function ft({orgId:e,projectId:r,error:s,error_category:n,error_action:a,error_target:d,signature:m=null,branch:g=null}){const[p,i]=z(),[h]=ee(),[y]=xe(),[f]=se(),[T]=ne(),[k]=ae(),[S]=Ee("tags"),I=h!=null&&h.start?_(Q(h.start)):_(p),E=h!=null&&h.end?_(Q(h.end)):_(i),C={orgId:e,projectId:r,error:s,error_category:n,error_action:a,error_target:d,signature:m,branch:g,dateStart:I,dateEnd:E,groups:y,branches:f,authors:T,tags:k,tagsLogicalOperator:S,limit:gs},{data:D,loading:j,error:G,fetchMore:B,networkStatus:P}=At({variables:{input:{...C,skip:0}},fetchPolicy:"cache-and-network",notifyOnNetworkStatusChange:!0}),b=D==null?void 0:D.errorTestExecutions,w=x.useMemo(()=>(b==null?void 0:b.results)??[],[b==null?void 0:b.results]),F=(b==null?void 0:b.count)??0,O=w.length<
1F,N=P===ot.fetchMore,R=async()=>{!O||N||await B({variables:{input:{...C,skip:w.length}},updateQuery:(A,{fetchMoreResult:c})=>{if(!(c!=null&&c.errorTestExecutions))return A;const v=c.errorTestExecutions,o=A.errorTestExecutions,L=new Set(((o==null?void 0:o.results)??[]).map($e)),K=v.results.filter($=>!L.has($e($)));return{...A,errorTestExecutions:{...v,results:[...(o==null?void 0:o.results)??[],...K]}}}})};return{executions:w,loading:j&&w.length===0,loadingMore:N,error:G,hasMore:O,loadMore:R}}const ps=25;function fs({orgId:e,projectId:r,error:s,error_category:n,error_action:a,error_target:d,signature:m=null,groupBy:g}){const[p,i]=z(),[h]=ee(),[y]=xe(),[f]=se(),[T]=ne(),[k]=ae(),[S]=Ee("tags"),I=h!=null&&h.start?_(Q(h.start)):_(p),E=h!=null&&h.end?_(Q(h.end)):_(i),C={orgId:e,projectId:r,error:s,error_category:n,error_action:a,error_target:d,signature:m,groupBy:g,dateStart:I,dateEnd:E,groups:y,branches:f,authors:T,tags:k,tagsLogicalOperator:S,limit:ps},{data:D,loading:j,error:G,fetchMore:B,networkStatus:P}=Bt({variables:{input:{...C,skip:0}},fetchPolicy:"cache-and-network",notifyOnNetworkStatusChange:!0}),b=D==null?void 0:D.errorGroupList,w=x.useMemo(()=>(b==null?void 0:b.results)??[],[b==null?void 0:b.results]),F=(b==null?void 0:b.count)??0,O=w.length<F,N=P===ot.fetchMore,R=async()=>{!O||N||await B({variables:{input:{...C,skip:w.length}},updateQuery:(A,{fetchMoreResult:c})=>{if(!(c!=null&&c.errorGroupList))return A;const v=c.errorGroupList,o=A.errorGroupList,L=new Set(((o==null?void 0:o.results)??[]).map($=>$.key)),K=v.results.filter($=>!L.has($.key));return{...A,errorGroupList:{...v,results:[...(o==null?void 0:o.results)??[],...K]}}}})};return{groups:w,total:F,loading:j&&w.length===0,loadingMore:N,error:G,hasMore:O,loadMore:R}}function ys(e){return{id:`${e.instanceId}:${e.testId}:${e.groupId}:${e.createdAt}`,status:Ft(e.state),flaky:e.flaky,group:e.groupId.trim()?t(Gt,{label:Ie(e.groupId,48),tooltip:e.groupId}):void 0,primary:l("span",{className:"flex min-w-0 items-center gap-ui-v2-2",children:[e.title?t("span",{className:"min-w-0 truncate",children:e.title}):null,t(Ar,{prTitle:e.prTitle,commitMessage:e.commit.message,prId:e.prId,commitSha:e.commit.sha})]}),time:t(Vt,{date:new Date(Ot(e.createdAt)),label:"Executed at"})}}function yt({executions:e,error:r,emptyLabel:s="No executions found"}){var g;const n=Ze();if(r)return t("div",{className:"pl-6 pb-2",children:t("span",{className:"text-theme-error text-sm",children:"Failed to load executions"})});if(e.length===0)return t("div",{className:"pl-6 pb-2",children:t("span",{className:"text-theme-secondary text-sm",children:s})});const a=new Map,d=e.map(p=>{const i=ys(p);return a.set(i.id,p),i}),m=n.testId&&n.instanceId?(g=d.find(p=>{const i=a.get(p.id);return(i==null?void 0:i.testId)===n.testId&&(i==null?void 0:i.instanceId)===n.instanceId}))==null?void 0:g.id:void 0;return t(Pt,{items:d,selectedId:m,onSelectItem:p=>{const i=a.get(p.id);i&&n.open(i.testId,i.instanceId)}})}function xs({orgId:e,projectId:r,signature:s,branch:n,error:a,error_category:d,error_action:m,error_target:g}){const{executions:p,loading:i,error:h,hasMore:y,loadingMore:f,loadMore:T}=ft({orgId:e,projectId:r,signature:s,branch:n,error:a,error_category:d,error_action:m,error_target:g});return i?t("div",{className:"pl-6 py-2",children:t(be,{})}):l("div",{className:"flex flex-col gap-2",children:[t(yt,{executions:p,error:h==null?void 0:h.message,emptyLabel:"No executions in this period"}),y?t(Z,{type:"secondary",disabled:f,className:"self-start",onClick:()=>T(),children:f?"Loadingâ¦":"Load more"}):null]})}function Es({group:e,groupBy:r,orgId:s,projectId:n,scopeSignature:a,error:d,error_category:m,error_action:g,error_target:p}){var S,I,E;const[i,h]=x.useState(!1),y=r===pe.Branch,f=((S=e.spec)==null?void 0:S.trim())||"unknown spec",T=((I=e.branch)==null?void 0:I.trim())||"unknown branch",k=(E=e.title)==null?void 0:E.trim();return t(Kt,{label:y?l(Y,{children:[t(q,{asChild:!0,children:l("span",{className:"inline-flex min-w-0 items-center gap-ui-v2-1",children:[t(Rt,{"aria-hidden":!0,className:"shrink-0"}),t("span",{className:"truncate",children:Ie(T,64)})]})}),t(X,{children:`Branch: ${T}`})]}):l("span",{className:"flex min-w-0 items-center gap-ui-v2-2",children:[t("span",{className:"min-w-0 truncate",children:k||f}),k?t("span",{className:"shrink-0 text-ui-v2-content-secondary-idle",title:f,children:Ie(f,40)}):null]}),count:`${V(e.occurrences)} ${Ne("execution",e.occurrences)}`,expanded:i,onToggle:()=>h(C=>!C),children:t("div",{className:"max-h-[400px] overflow-y-auto",children:t(xs,{orgId:s,projectId:n,signature:y?a:e.signature??null,branch:y?e.branch??"":null,error:d,error_category:m,error_action:g,error_target:p})})})}function bs({groupBy:e,orgId:r,projectId:s,signature:n,error:a,error_category:d,error_action:m,error_target:g}){const{groups:p,total:i,loading:h,loadingMore:y,hasMore:f,loadMore:T}=fs({orgId:r,projectId:s,groupBy:e,signature:n,error:a,error_category:d,error_action:m,error_target:g}),k=e===pe.Branch?"branch":"test";return h?t(be,{}):p.length===0?l(J,{span:!0,children:["No affected ",Ne(k,2)," in this period"]}):l("div",{className:"flex flex-col gap-2 pr-2",children:[p.map(S=>t(Es,{group:S,groupBy:e,orgId:r,projectId:s,scopeSignature:n,error:a,error_category:d,error_action:m,error_target:g},S.key)),l("div",{className:"flex items-center justify-between gap-1 mt-1",children:[f&&t(Z,{type:"secondary",onClick:()=>
1T(),disabled:y,children:y?"Loadingâ¦":"Load more"}),l("span",{className:"ty-text",children:["Showing ",V(p.length)," out of ",V(i)," ","affected ",Ne(k,i)]})]})]})}function Ts({error:e,error_category:r,error_action:s,error_target:n,signature:a,orgId:d,projectId:m}){const[g,p]=Gr(),{loading:i,data:h}=Cs({errorMessage:e,error_category:r,error_action:s,error_target:n,signature:a,orgId:d,projectId:m}),y=h==null?void 0:h.errorExplorerItemDetailsV2,f=(y==null?void 0:y.testsTotal)??0,T=(y==null?void 0:y.branchesTotal)??0;return i&&!y?t(be,{}):l("div",{className:"flex flex-col gap-2 w-full pt-2 px-2",children:[t("div",{className:"flex flex-wrap items-end justify-between gap-2",children:l(ie,{value:g,onValueChange:k=>p(k),"aria-label":"Group affected executions by",children:[t(ie.Item,{value:"none",children:"Executions"}),l(ie.Item,{value:"test",children:["Tests (",V(f),")"]}),l(ie.Item,{value:"branch",children:["Branches (",V(T),")"]})]})}),g==="none"?t(vs,{orgId:d,projectId:m,signature:a,error:e,error_category:r,error_action:s,error_target:n}):t(bs,{groupBy:g==="branch"?pe.Branch:pe.Test,orgId:d,projectId:m,signature:a,error:e,error_category:r,error_action:s,error_target:n})]})}function vs({orgId:e,projectId:r,signature:s,error:n,error_category:a,error_action:d,error_target:m}){const{executions:g,loading:p,error:i,hasMore:h,loadingMore:y,loadMore:f}=ft({orgId:e,projectId:r,signature:s,error:n,error_category:a,error_action:d,error_target:m});return p?t(be,{}):l("div",{className:"flex flex-col gap-2 pr-2",children:[t(yt,{executions:g,error:i==null?void 0:i.message,emptyLabel:"No executions in this period"}),h?t("div",{className:"flex items-center justify-between gap-1",children:t(Z,{type:"secondary",className:"self-start",disabled:y,onClick:()=>f(),children:y?"Loadingâ¦":"Load more"})}):null]})}const Cs=({errorMessage:e,error_category:r,error_action:s,error_target:n,signature:a,orgId:d,projectId:m})=>{const[g,p]=z(),[i]=ee(),[h]=xe(),[y]=se(),[f]=ne(),[T]=ae(),[k]=Ee("tags"),{loading:S,data:I,previousData:E,error:C}=Ht({fetchPolicy:"cache-and-network",variables:{input:{orgId:d,projectId:m,error:e??null,error_category:r??null,error_action:s??null,error_target:n??null,signature:a??null,groups:h,branches:y,authors:f,tags:T,tagsLogicalOperator:k,dateStart:i!=null&&i.start?_(Q(i==null?void 0:i.start)):_(g),dateEnd:i!=null&&i.end?_(Q(i==null?void 0:i.end)):_(p)}}});return{loading:S,data:S?E:I,error:C}},ks=e=>{const[,r]=_e();function s(...n){r(...n),e.onChange&&e.onChange(...n)}return t(le,{...e,onChange:s})},Ss=e=>{const[,r]=De();function s(...n){r(...n),e.onChange&&e.onChange(...n)}return t(le,{...e,onChange:s})},Is=e=>{const[,r]=Ae();function s(...n){r(...n),e.onChange&&e.onChange(...n)}return t(le,{...e,onChange:s})},Ns=e=>{const[,r]=Be();function s(...n){r(...n),e.onChange&&e.onChange(...n)}return t(le,{...e,onChange:s})},Ls=e=>{const[,r]=Pe();function s(...n){r(...n),e.onChange&&e.onChange(...n)}return t(le,{...e,onChange:s})},ws=({fields:e,onChange:r})=>{const[s,n]=_e(),[a,d]=De(),[m,g]=Ae(),[p,i]=Be(),[h,y]=Pe(),f=[s,a,m,p,h].filter(Boolean);return l(tt,{children:[l(Y,{delayDuration:300,children:[t(q,{asChild:!0,children:t(Je,{asChild:!0,children:t(Z,{type:"primary",leftIcon:t(jt,{}),children:l("span",{className:"gap-2 flex items-center",children:["Search"," ",f.length>0&&t(Qt,{type:"success",scale:me.scale.tiny,children:f.length})]})})})}),t(X,{children:"Search and filter errors"})]}),t(et,{children:l("div",{className:"flex flex-col gap-ui-v2-4",children:[t(ze,{children:"Search"}),(e.includes(u.Message)||s)&&l("div",{className:"flex flex-col items-start justify-start gap-2",children:[t(H,{value:u.Message,short:!1}),t(ks,{onChange:r,initialValue:s})]}),(e.includes(u.Category)||a)&&l("div",{className:"flex flex-col items-start justify-start gap-2",children:[t(H,{value:u.Category,short:!1}),t(Ss,{onChange:r,initialValue:a})]}),(e.includes(u.Action)||m)&&l("div",{className:"flex flex-col items-start justify-start gap-2",children:[t(H,{value:u.Action,short:!1}),t(Is,{onChange:r,initialValue:m})]}),(e.includes(u.Target)||p)&&l("div",{className:"flex flex-col items-start justify-start gap-2",children:[t(H,{value:u.Target,short:!1}),t(Ns,{onChange:r,initialValue:p})]}),(e.includes(u.Test)||h)&&l("div",{className:"flex flex-col items-start justify-start gap-2",children:[t(H,{value:u.Test,short:!1}),t(Ls,{onChange:r,initialValue:h})]}),f.length>0&&t(Z,{type:"secondary",onClick:()=>{n(""),d(""),g(""),i(""),y(""),r()},children:"Clear all filters"})]})})]})},Ms=({data:e,limit:r,disabled:s=!1,overallItemsCount:n,projectId:a,orgId:d})=>{const[m,g]=Oe(),p=m.join(","),i=x.useMemo(()=>m,[p]),[h,y]=x.useState(Le),[f,T]=ht(),[k,S,I]=Xe(),[E,C]=oe(),[D,j]=Ut("errorExplorerV2_density","compact"),G=x.useMemo(()=>ms(i),[i]),B=x.useMemo(()=>jr(i??[]),[i]),{columnVisibility:P,setColumnVisibility:b}=pr({columns:G,namespace:"errorExplorerV2"}),w=x.useMemo(()=>e.map(o=>({projectId:a,orgId:d,id:$t([o.message,o.error_category,o.error_action,o.error_target,o.signature,o.title,o.spec].join("")),...o})),[e,a,d]),F=Wt({data:w,columns:G,getRowId:o=>o.id,columnVisibility:P,onColumnVisibilityChange:b}),O=x.useCallback(o=>{T(o),C(1)},[T,C]),N=x.useCallback(o=>{const L=o;L===f?I():(T(L),S(He.Desc)),C(1)},[f,I,T,S,C]),R=x.useCallback(o=>{const L=h.filter(K=>o.includes(K));g(L.length===0?[u.Message]:L),C(1),T(null)},[h,g,C,T]),A=x.useCallback(o=>{y(o);const L=o.filter(K=>i.includes(K));g(L.length===0?[u.Message]:L),C(1),T(null)},[i,g,C,T]),c=x.useCallback(o=>t(Ts,{error:o.original.message,error_category:o.original.error_category,error_action:o.original.error_action,error_target:o.original.error_target,signature:o.original.signature??null,orgId:o.original.orgId,projectId:o.original.projectId}),[]),{pagesCount:v}=at({count:n,limit:r,page:E});return t(W,{instance:F,density:D,loading:s,sort:{value:f,direction:k===He.Asc?"asc":"desc",onChange:N},keyboardNav:{rowCount:n,rowIndexStart:(E-1)*r},renderExpandedRow:c,enableColumnSelector:!0,enableResize:!0,emptyState:t(W.Empty,{title:"No errors found",caption:"No errors matched the current filters in this date range."}),children:l(W.Toolbar,{children:[l(Y,{delayDuration:300,children:[t(q,{asChild:!0,children:t("span",{className:"inline-flex",children:t(fr,{projectId:a,density:D,onDensityChange:j})})}),t(X,{children:"Table settings"})]}),l(Y,{delayDuration:300,children:[t(q,{asChild:!0,children:t("span",{className:"inline-flex",children:t(W.ColumnsButton,{type:"primary"})})}),t(X,{children:"Table columns"})]}),l(Y,{delayDuration:300,children:[t(q,{asChild:!0,children:t("span",{className:"inline-flex",children:t(qt,{value:f,onChange:O,options:B,buttonType:"primary"})})}),t(X,{children:"Sort table"})]}),l(Y,{delayDuration:300,children:[t(q,{asChild:!0,children:t("span",{className:"inline-flex",children:l(te,{value:i,onValueChange:o=>R([...o]),options:h.map(o=>({value:o,label:ye[o]})),children:[t(te.Trigger,{asChild:!0,children:t(Z,{type:"primary",chevron:t(Xt,{}),children:l("span",{className:"flex items-center gap-1.5",children:["Group By",i.map(o=>t(H,{value:o},o))]})})}),t(te.Content,{children:t(te.SortableGroup,{values:h,onReorder:o=>A([...o]),children:h.map(o=>t(te.Item,{value:o,children:ye[o]},o))})})]})})}),t(X,{children:"Group errors by fields"})]}),t(ws,{fields:i,onChange:()=>C(1)}
1),t(W.Toolbar.End,{children:t(Yt,{page:E,count:v,onChange:C})})]})})},_s=rt(({orgModel:e,projectId:r})=>(Jt(r,{sideNavActiveSubItem:"insights"}),t(zt,{value:{orgId:e.org.orgId,projectId:r},children:t(As,{orgId:e.org.orgId,projectId:r})}))),Ds=()=>t(de,{type:"single",collapsible:!0,className:"mb-ui-v2-3",children:l(de.Item,{value:"item-1",tone:"info",children:[t(de.Header,{children:"Learn more about the Error Explorer"}),t(de.Content,{children:l("div",{className:"flex flex-col gap-ui-v2-3",children:[t("p",{children:"When a test fails, the error message can be too generic to distinguish between different root causes. On the other hand, a single problematic component can trigger different types of errors."}),t("p",{children:"In addition to the error message, Currents extracts additional fields to help you understand the root cause and the impact of errors generated by your tests:"}),t("ul",{className:"list-disc space-y-1 pl-ui-v2-4",children:Le.map(e=>l("li",{children:[t("strong",{children:ye[e]})," â"," ",gt[e]]},e))}),l("p",{children:["Combine fields in the ",t("strong",{children:"Group By"})," dropdown to find patterns. Drag fields to change grouping order. For example:"]}),l("ul",{className:"list-disc space-y-1 pl-ui-v2-4",children:[l("li",{children:[t("strong",{children:"Target"})," + ",t("strong",{children:"Action"})," to explore the impact of a CSS selector failing when performing a particular action."]}),l("li",{children:[t("strong",{children:"Target"})," + ",t("strong",{children:"Action"})," +"," ",t("strong",{children:"Message"})," to narrow down a selector and action to a specific error message."]}),l("li",{children:[t("strong",{children:"Test"})," to see which tests are affected by the same error pattern."]})]}),l("p",{children:["Expand a row to inspect affected tests and branches, browse recent executions, and filter by individual field values. When Currents cannot reliably identify a field, it is set to"," ",t("code",{className:"rounded bg-theme-hover px-1 py-0.5 font-mono text-[10px]",children:"null"}),"."]}),l("div",{className:"flex flex-col gap-ui-v2-2",children:[t("strong",{children:"Error Fields"}),Le.map(e=>l("div",{className:"flex items-center gap-2",children:[t(H,{value:e}),t(H,{value:e,short:!1})]},e))]}),t("p",{children:t(Zt,{icon:!0,href:"https://docs.currents.dev/dashboard/test-suite-performance-explorer/errors-explorer",children:"Learn more about the Error Explorer"})})]})})]})}),As=({orgId:e,projectId:r})=>{const[s,n]=z(),{timezone:a}=er(),[d]=nt(r),[m]=oe(),[g]=_e(),[p]=De(),[i]=Ae(),[h]=Be(),[y]=Pe(),[f]=Oe(),[T]=ae(),[k]=ne(),[S]=se(),I=tr(r),{data:E,loading:C}=Ur({orgId:e,projectId:r,dateStart:_(s),dateEnd:_(n),limit:d,page:m,errorMessage:[g],errorCategory:[p],errorAction:[i],errorTarget:[h],testTitle:[y],groupBy:f}),D=x.useMemo(()=>{const B=(E==null?void 0:E.topErrorsV2.results)??[],P=f.includes(u.Message),b=f.includes(u.Category),w=f.includes(u.Action),F=f.includes(u.Target),O=f.includes(u.Test);return B.map(N=>{var R,A,c,v;return{message:P?N.message:void 0,category:b?N.error_category:void 0,action:w?N.error_action:void 0,target:F?N.error_target:void 0,signature:O?N.signature:void 0,title:O?N.title:void 0,spec:O?N.spec:void 0,occurrences:N.count??0,tests:((A=(R=N.details)==null?void 0:R.tests)==null?void 0:A.count)??0,branches:((v=(c=N.details)==null?void 0:c.branches)==null?void 0:v.count)??0}})},[E==null?void 0:E.topErrorsV2.results,f]),j=x.useMemo(()=>({projectName:(I==null?void 0:I.name)??r,dateStart:s,dateEnd:n,resolution:"auto",tagsFilter:T??[],authorsFilter:k??[],branchesFilter:S??[]}),[I==null?void 0:I.name,r,s,n,T,k,S]),G=x.useMemo(()=>(E==null?void 0:E.topErrorsV2.timeline.map(B=>{const P=rr(B.date,a);return{...B,date:P&&!Number.isNaN(P.getTime())?P.toISOString():B.date}}))??[],[E==null?void 0:E.topErrorsV2.timeline,a]);return sr(D,"Error Explorer",j),l("div",{children:[t("div",{className:"mb-ui-v2-2",children:t(Bs,{count:(E==null?void 0:E.topErrorsV2.count)??0,projectId:r})}),t(Ps,{}),t(hs,{timeline:G,loading:C,dimensions:f}),t(Ms,{data:(E==null?void 0:E.topErrorsV2.results)??[],overallItemsCount:(E==null?void 0:E.topErrorsV2.count)??0,limit:d,projectId:r,orgId:e,disabled:C})]})};function Bs({count:e,projectId:r}){const[s]=oe(),[n]=nt(r),{rangeStart:a,rangeEnd:d}=at({count:e,limit:n,page:s});return l(J,{children:["Showing ",a," - ",d," out of ",e," errors"]})}
1function Ps(){const[e]=ee();return l("div",{className:"mb-ui-v2-1 flex min-h-7 flex-wrap items-center justify-between gap-ui-v2-2",children:[t("span",{className:"ty-text-sm uppercase text-ui-v2-content-secondary-idle",children:"Timeline â drag the handles to filter by date range"}),l("div",{className:"flex items-center gap-ui-v2-2",children:[e&&l(st,{children:[l(J,{span:!0,children:[t(ke,{short:!0,value:ge(e.start),hideUTCInTooltip:!0})," ","-"," ",t(ke,{short:!0,value:ge(e.end),hideUTCInTooltip:!0})]}),t(Z,{type:"secondary",onClick:Or,children:"Reset"})]}),l(tt,{children:[l(Y,{delayDuration:300,children:[t(q,{asChild:!0,children:t(Je,{asChild:!0,children:t(Z,{type:"secondary",leftIcon:t(nr,{}),children:"Settings"})})}),t(X,{children:"Timeline settings"})]}),t(et,{align:"end",children:l("div",{className:"flex flex-col gap-2",children:[t(ze,{children:"Timeline Settings"}),t(Kr,{}),t(Qr,{})]})})]})]})]})}const Os=rt(({children:e,project:r})=>{const{exportData:s,exportTitle:n,exportMeta:a}=hr();return l(st,{children:[t(mr,{children:l("title",{children:[r.name??""," - Error Explorer"]})}),t(br,{controls:t(Pr,{}),actions:s.length>0&&a&&t(Er,{title:n||"Error Explorer",meta:a,jsonData:s}),side:t(xr,{children:t(gr,{projectId:r.projectId,termTypes:[ue.Tag,ue.Branch,ue.AuthorName,ue.Group]})}),children:e})]})}),sn=()=>{const e=ar(),[r,s]=z(),n=Ze();return or([{label:`${(e==null?void 0:e.name)??""} Insights`,link:lr(e==null?void 0:e.projectId),type:"project"},{label:"Error Explorer",link:cr((e==null?void 0:e.projectId)??"")}]),e?l(ur,{children:[l(Os,{project:e,children:[t(Ds,{}),t(yr,{title:"Error Explorer",dateStart:r,dateEnd:s}),t(_s,{projectId:e.projectId})]}),t(dr,{instanceId:n.instanceId,testId:n.testId,onClose:n.close})]}):t(ir,{caption:"No errors detected"})};export{sn as ErrorExplorerView,sn as default}; 2//# sourceMappingURL=errorExplorerView-DfnS_eZ-.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.