PageSourceSearch

https://app.kapa.ai/assets/index-CZ9JqZkg.js

js kapa.ai collected 2026-09-24 19:19:00 UTC 97,746 bytes, 2 lines download raw bytes

1import{r as g,j as e,G as k,B as A,ae as Tr,x,d as We,aI as F,ag as Se,ay as Ze,v as Ut,aQ as B,o as z,T as Nr,aa as Gt,aP as yt,S as O,F as Ce,ai as Vt,aA as Kt,H as $t,t as Ue}from"./vendor-mantine-BR5daWbi.js";import{b as Qe,k as Dr}from"./vendor-data-BEEH8umM.js";import{u as q,_ as Xe,v as te,w as ve,T as ke,l as Ee,B as R,m as Te,o as X,c as $,x as se,y as qt,r as Yt,D as J,A as bt,C as wt,F as be,I as Je,J as Ar,N as Mr}from"./index-Bo80QBJz.js";import{s as W,d as _e,D as Pr}from"./date-range-picker-Bc8-WRsp.js";import{w as zr,u as Ir}from"./use-url-filters-a0YNB_Ur.js";import{C as Fr,R as Rr}from"./use-filters-Cl3fynbp.js";import{e as St,s as _t,a as Or,b as Br,c as Hr,d as Ur,f as Wt,g as Zt,h as Gr,i as Vr,t as Kr,j as Lt,k as $r,l as qr,m as Yr}from"./vendor-date-Ddnof5lh.js";import{u as et,P as Wr,a as Zr,b as Qr}from"./page-layout-D_FYPouV.js";import{g as Qt}from"./project-color-DkQ-WGzk.js";import{L as Xt,a as Xr,d as Jr}from"./vendor-react-CvsrXiTQ.js";import{S as K}from"./skeleton-DCJ2U9rU.js";import{a6 as Ne,aJ as eo,aI as tt,a0 as De,at as Jt,z as to,aK as so,aL as ro,aM as oo,aa as no,aB as es,y as ao,w as lo,a4 as ts,aN as ss,aO as io,aP as co}from"./vendor-icons-ywK6O-a8.js";import{R as de,B as Ae,C as Me,X as ue,Y as me,T as he,b as ie,c as uo,L as rs,d as mo,e as os,A as ho,a as po,D as go}from"./vendor-charts-BzGwKu8R.js";import{E as fo,a as xo,b as vo,c as jo,d as yo,e as bo,f as wo}from"./empty-state-card-BTiaNSWM.js";import{b as So,c as _o,d as Lo,P as Co}from"./platform-bar-DESVsJ7x.js";import{m as ko}from"./monogram-B19bmWzG.js";import{M as Eo}from"./vendor-table-C0269ijS.js";import{T as To}from"./truncated-text-tooltip-I-k0syyW.js";import{S as No}from"./single-select-filter-DttNXIj3.js";import{C as Do,a as Ao,b as Mo,c as Po,d as zo}from"./combobox-roBEXobY.js";import{F as Io}from"./filter-button-D77GyeLG.js";import"./integration-type-icon-8HXjIKJc.js";import{g as Fo}from"./integration-types-Bt3tiieh.js";import{M as Ro}from"./multi-select-filter-B9kNKk78.js";import{P as Oo}from"./page-header-help-NbHP697b.js";import{W as Bo}from"./warning-banners-DfIHwpVk.js";import"./vendor-baseui-uAQgzSok.js";import"./vendor-syntax-BxWJNGeb.js";import"./vendor-markdown-KnfJHi8i.js";import"./date-input-DqYLoOy9.js";import"./input-CD4K4QyY.js";import"./toggle-group-BDDpHqSn.js";import"./use-is-mobile-HBahKhNX.js";import"./use-analytics-CiL_51B4.js";import"./zendesk-icon-Bk6_5jzr.js";import"./filter-chip-Cvtq-zfV.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};t.SENTRY_RELEASE={id:"30ecadcb485edf38c71e62214c8874da90fe716f"}}catch{}})();try{(function(){var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new t.Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="bdb94a14-b7e5-4290-8b76-14efe6dcbc90",t._sentryDebugIdIdentifier="sentry-dbid-bdb94a14-b7e5-4290-8b76-14efe6dcbc90")})()}catch{}const st=(t,s)=>{if(s.length===0)return t;const r=new Set(s);return t.filter(o=>o.integration_type!==null&&r.has(o.integration_type))},ns=(t,s)=>st(t,s).length>0,ce=t=>t&&t.length>0?[...t].sort():void 0,Ho=({startDateTime:t,endDateTime:s,aggregationPeriod:r,projectFilterKey:o,integrationFilterKey:n,groupBy:l})=>{const d=new URLSearchParams({start_date_time:_e(t,"start"),end_date_time:_e(s,"end"),aggregation_period:r,timezone:W()});return l&&d.set("group_by",l),o&&d.set("project_filter",o.join(",")),n&&d.set("integration_filter",n.join(",")),d},as=({projectFilter:t})=>{const s=q(),r=s.user?.user.team.id??"",o=ce(t);return Qe({queryKey:["team-integrations",r,o],queryFn:async()=>{const l=new URLSearchParams;o&&l.set("project_filter",o.join(","));const d=l.toString(),u=await s.authFetch(`/query/internal/teams/${r}/integrations/${d?`?${d}`:""}`,{method:"GET",headers:{"Content-Type":"application/json"}});if(!u.ok)throw new Error(u.statusText);return u.json()},enabled:!!r,meta:{errorMessage:"Failed to fetch integrations. Please refresh the page and try again."}})};var G=(t=>(t.HOUR="HOUR",t.DAY="DAY",t.WEEK="WEEK",t.MONTH="MONTH",t.YEAR="YEAR",t))(G||{});const re=(t,s)=>
1{switch(s){case"HOUR":return t.toLocaleString("en-US",{hour:"2-digit",hour12:!0,timeZone:W()});case"DAY":return t.toLocaleDateString("en-US",{day:"2-digit",month:"short",timeZone:W()});case"WEEK":{const r=Kr(t,W()),o=Zt(r,{weekStartsOn:1}),n=Wt(r,{weekStartsOn:1});return`${Lt(o,"MMM d")} - ${Lt(n,"d")}`}case"MONTH":return t.toLocaleDateString("en-US",{month:"short",year:"numeric",timeZone:W()});case"YEAR":return t.toLocaleDateString("en-US",{year:"numeric",timeZone:W()});default:return t.toLocaleDateString("en-US",{timeZone:W()})}},Oe=(t,s)=>{switch(s){case"HOUR":return{start:Vr(t),end:Gr(t)};case"DAY":return{start:_t(t),end:St(t)};case"WEEK":return{start:Zt(t,{weekStartsOn:1}),end:Wt(t,{weekStartsOn:1})};case"MONTH":return{start:Ur(t),end:Hr(t)};case"YEAR":return{start:Br(t),end:Or(t)};default:return{start:_t(t),end:St(t)}}},Uo=(t,s)=>{const r={...t};s?.start&&s?.end&&(r.startDateString=s.start.toISOString(),r.endDateString=s.end.toISOString());const o=new URLSearchParams;zr(o,Fr,r);const n=o.toString();return n?`?${n}`:""},Ct={last_7_days:G.DAY,last_14_days:G.DAY,last_1_month:G.WEEK,last_3_months:G.WEEK,last_12_months:G.MONTH},Go=(t,s)=>{if(s&&s in Ct)return Ct[s];if(!t[0]||!t[1])return null;const r=Math.ceil(Math.abs(t[0].getTime()-t[1].getTime())/(1e3*3600*24));return r<30?G.DAY:r<90?G.WEEK:G.MONTH},Vo=()=>{const[t]=g.useState(()=>new Date),[s,r]=g.useState(()=>$r(t,{months:1})),[o,n]=g.useState(t),[l,d]=g.useState(G.WEEK),u=g.useCallback((i,a)=>{r(i[0]),n(i[1]);const c=Go(i,a);c&&d(c)},[]);return{startDateTime:s,endDateTime:o,aggregationPeriod:l,onDateRangeChange:u}},Ko={troubleshooting:{selfServeIntentFilter:[ve.Troubleshooting]},guiding:{selfServeIntentFilter:[ve.Guiding]},lookup:{selfServeIntentFilter:[ve.Lookup]},other:{selfServeIntentFilter:[ve.Other]},uncertain:{certaintyFilter:"uncertain"},downvoted:{reactionFilter:Rr.Downvote},pushback:{selfServeSignalFilter:[te.Pushback]},negativeSentiment:{selfServeSignalFilter:[te.NegativeSentiment]}},$o=({aggregationPeriod:t,groupBy:s,teamIntegrations:r,integrationFilter:o,startDateTime:n,endDateTime:l})=>{const d=q(),u=g.useCallback(({projectId:p,range:h,filters:v,source:j})=>{Xe?.capture("dashboard_drilldown",{project_id:p,source:j}),d.project.selectProject(p,{path:"/conversations",search:Uo(v,h)})},[d.project]),i=g.useMemo(()=>n&&l?{start:n,end:l}:void 0,[n,l]),a=g.useCallback(p=>{const h=o.filter(v=>r.some(j=>j.id===v&&j.project_id===p));return h.length>0?{integrationFilter:h}:{}},[o,r]),c=g.useCallback((p,h)=>{if(s==="project"){u({projectId:p,range:Oe(h,t),filters:a(p),source:"by_group_project"});return}const v=r.find(j=>j.id===p);v&&u({projectId:v.project_id,range:Oe(h,t),filters:{integrationFilter:[p]},source:"by_group_integration"})},[t,s,r,a,u]),m=g.useCallback((p,h)=>{const v=d.project.selected?.id;v&&u({projectId:v,range:h?Oe(h,t):i,filters:{...Ko[p],...a(v)},source:h?`self_serve_bar_${p}`:`self_serve_legend_${p}`})},[t,d.project.selected?.id,u,a,i]),f=g.useCallback((p,h)=>{u({projectId:h,range:i,filters:{customTagsIncludeFilter:[p],...a(h)},source:"custom_tag"})},[u,a,i]);return{onBarDrillDown:c,onSelfServeSegmentDrillDown:m,onCustomTagDrillDown:f}},rt=["overview","external","internal","support","agents"],ls=rt[0],qo=[{key:"projects",type:"string[]"},{key:"integrations",type:"string[]"},{key:"group_by",type:"string",defaultValue:"integration"},{key:"preset",type:"string",defaultValue:ls}],Yo=t=>t==="project"||t==="integration",Wo=t=>rt.includes(t),ot=()=>{const{filters:t,setFilters:s}=Ir({fields:qo,onChangeResetPagination:!1}),r=Wo(t.preset)?t.preset:ls,o=t.projects,n=t.integrations,l=Yo(t.group_by)?t.group_by:"integration",d=g.useCallback(a=>s({projects:a}),[s]),u=g.useCallback((a,c)=>s({integrations:a},c),[s]),i=g.useCallback(a=>s({group_by:a}),[s]);return{preset:r,projects:o,integrations:n,groupBy:l,setProjects:d,setIntegrations:u,setGroupBy:i,setFilters:s}},is=["SUPPORT_FORM_DEFLECTOR"],cs=["KAPA_MCP","API"],Zo=[],ds=()=>{const t=q(),{preset:s,projects:r}=ot(),o=g.useMemo(()=>t.project.availableProjects??[],[t.project.availableProjects]),n=s==="internal"||s==="external",l=g.useMemo(()=>s==="internal"?o.filter(c=>c.is_internal):s==="external"?o.filter(c=>!c.is_internal):o,[s,o]),d=s==="internal"?"All Internal":s==="external"?"All External":"All",u=s==="support"?is:s==="agents"?cs:Zo,i=g.useMemo(()=>
1{if(r.length===0)return r;const c=new Set(l.map(f=>f.id)),m=r.filter(f=>c.has(f));return m.length===r.length?r:m},[r,l]),a=g.useMemo(()=>i.length>0?i:n?l.map(c=>c.id):[],[i,n,l]);return{scopedProjects:l,projectAllLabel:d,integrationTypeFilter:u,projectFilterValue:i,effectiveProjectFilter:a}},us=g.createContext(null),H=()=>{const t=g.useContext(us);if(!t)throw new Error("useDashboardView must be used within DashboardViewProvider");return t},Qo=({children:t})=>{const s=q(),{preset:r,integrations:o,groupBy:n,setFilters:l}=ot(),{scopedProjects:d,effectiveProjectFilter:u,integrationTypeFilter:i}=ds(),{startDateTime:a,endDateTime:c,aggregationPeriod:m,onDateRangeChange:f}=Vo(),p=as({projectFilter:u}),h=g.useMemo(()=>p.data??[],[p.data]),v=et(p.isLoading),j=g.useMemo(()=>{if(o.length===0||!p.data)return o;const S=new Set(st(h,i).map(D=>D.id)),E=o.filter(D=>S.has(D));return E.length===o.length?o:E},[o,p.data,h,i]),{onBarDrillDown:_,onSelfServeSegmentDrillDown:w,onCustomTagDrillDown:b}=$o({aggregationPeriod:m,groupBy:n,teamIntegrations:h,integrationFilter:j,startDateTime:a,endDateTime:c}),C=g.useCallback(S=>{S!==r&&(l({preset:S,projects:[],integrations:[]}),Xe?.capture("dashboard_preset_switched",{project_id:s.project.selected?.id,project_name:s.project.selected?.project_name,from_preset:r,to_preset:S}))},[r,l,s.project]),T=g.useMemo(()=>({preset:r,onPresetChange:C,startDateTime:a,endDateTime:c,aggregationPeriod:m,onDateRangeChange:f,projectFilter:u,integrationFilter:j,groupBy:n,scopedProjects:d,teamIntegrations:h,isLoadingIntegrations:v,onBarDrillDown:_,onSelfServeSegmentDrillDown:w,onCustomTagDrillDown:b}),[r,C,a,c,m,f,u,j,n,d,h,v,_,w,b]);return e.jsx(us,{value:T,children:t})},oe=({path:t,queryKeyPrefix:s,errorMessage:r,grouped:o=!0},n)=>{const l=q(),d=l.user?.user.team.id??"",{startDateTime:u,endDateTime:i,aggregationPeriod:a,projectFilter:c,integrationFilter:m,groupBy:f}=H(),p=ce(c),h=ce(m),v=o?f:void 0,j=!!u&&!!i,{data:_,isLoading:w,isError:b}=Qe({queryKey:[s,d,u,i,a,p,h,v],queryFn:async({signal:C})=>{const T=Ho({startDateTime:u,endDateTime:i,aggregationPeriod:a,projectFilterKey:p,integrationFilterKey:h,groupBy:v}),S=await l.authFetch(`/query/internal/teams/${d}/analytics/${t}?${T.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"},signal:C});if(!S.ok)throw new Error(S.statusText);return S.json()},enabled:!!d&&j&&n,meta:{errorMessage:r}});return{data:_,isLoading:et(w),isError:n&&b}},nt=t=>oe({path:"activity/",queryKeyPrefix:"analytics-team-activity",errorMessage:"Failed to fetch activity data. Please refresh the page and try again."},t),Pe=t=>oe({path:"activity/counting/cross-project/",queryKeyPrefix:"analytics-team-counting",errorMessage:"Failed to fetch counting data. Please refresh the page and try again."},t),Xo=t=>oe({path:"agent-activity/",queryKeyPrefix:"analytics-team-agent-activity",errorMessage:"Failed to fetch agent activity data. Please refresh the page and try again."},t),Jo=t=>oe({path:"mcp-client-activity/",queryKeyPrefix:"analytics-team-mcp-client-activity",errorMessage:"Failed to fetch MCP client data. Please refresh the page and try again."},t),at=t=>oe({path:"self-serve/",queryKeyPrefix:"analytics-team-self-serve",errorMessage:"Failed to fetch self-serve data. Please refresh the page and try again.",grouped:!1},t),lt=t=>oe({path:"time-saved/",queryKeyPrefix:"analytics-team-time-saved",errorMessage:"Failed to fetch time-saved data. Please refresh the page and try again.",grouped:!1},t),it=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,ct=()=>!it(),Y=({title:t,description:s,action:r,hint:o,info:n})=>e.jsxs(k,{justify:"space-between",align:"flex-start",children:[e.jsxs(A,{children:[e.jsxs(k,{gap:4,align:"center",mb:X("sm",.5),children:[e.jsx(Tr,{order:6,c:"var(--color-foreground)",fw:500,fz:"lg",sx:{lineHeight:"1rem"},children:t}),n&&e.jsxs(ke,{children:[e.jsx(Ee,{render:e.jsx(R,{variant:"ghost",size:"icon-sm","aria-label":`About ${t}`,children:e.jsx(Ne,{className:"size-3.5",stroke:1.5})})}),e.jsx(Te,{side:"top",children:n})]})]}),e.jsx(x,{c:"var(--color-foreground-secondary)",fz:"sm",children:s}),o?e.jsxs(k,{gap:4,align:"center",mt:X("xs",.5),children:[e.jsx(eo,{size:14,stroke:1.5,color:"var(--color-foreground-secondary)"}),e.jsx(x,{c:"var(--color-foreground-secondary)",fz:"xs",children:o})]}
1):e.jsx(x,{"aria-hidden":!0,c:"var(--color-foreground-secondary)",fz:"xs",mt:X("xs",.5),children:" "})]}),r]});Y.displayName="BoxHeader";const ms=({Logo:t,label:s,color:r})=>t?e.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center",children:e.jsx(t,{className:"size-[18px]"})}):e.jsx("span",{"aria-hidden":"true",className:"flex size-5 shrink-0 items-center justify-center rounded text-[10px] font-semibold text-white",style:{backgroundColor:r},children:s.charAt(0).toUpperCase()});ms.displayName="ClientLogo";const Be=350,hs=188,kt=28,en=6,tn=({x:t,y:s,payload:r,rowsById:o})=>{const n=r?o.get(r.value):void 0;if(!n||t===void 0||s===void 0)return null;const l=hs-12;return e.jsx("foreignObject",{x:t-l-8,y:s-kt/2,width:l,height:kt,children:e.jsxs(k,{gap:6,justify:"flex-end",wrap:"nowrap",h:"100%",ml:4,children:[n.hideIcon?null:e.jsx(ms,{Logo:n.Logo,label:n.label,color:n.color}),e.jsx(x,{c:"dimmed",fz:"sm",truncate:!0,miw:0,title:n.label,children:n.label})]})})},sn=({active:t,payload:s,total:r})=>{if(!t||!s||s.length===0)return null;const o=s[0].payload,n=r>0?Math.round(o.value/r*100):0,l=o.members.length>1||o.members[0]?.name!==o.label,d=o.members.slice(0,en),u=o.members.length-d.length;return e.jsxs(Ze,{padding:"sm",radius:"md",shadow:"md",withBorder:!0,sx:{maxWidth:280},children:[e.jsxs(A,{sx:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(A,{sx:{width:10,height:10,borderRadius:3,backgroundColor:o.color,flexShrink:0}}),e.jsx(x,{fw:"bold",fz:"sm",sx:{flexGrow:1},children:o.label}),e.jsx(x,{fw:"bold",fz:"sm",children:o.value})]}),e.jsxs(x,{c:"dimmed",fz:"xs",mt:2,children:[n,"% of OAuth MCP queries"]}),l?e.jsxs(A,{mt:"xs",sx:{display:"flex",flexDirection:"column",gap:4},children:[d.map(i=>{const a=i.Logo;return e.jsxs(A,{sx:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(A,{sx:{width:16,height:16,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center"},children:a?e.jsx(a,{}):null}),e.jsx(x,{fz:"xs",c:"dimmed",title:i.name,sx:{flexGrow:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i.name}),e.jsx(x,{fz:"xs",children:i.value})]},i.name)}),u>0?e.jsxs(x,{c:"dimmed",fz:"xs",sx:{paddingLeft:24},children:["+",u," more"]}):null]}):null]})},ps=({title:t,subtitle:s,data:r,isLoading:o=!1})=>{const n=We(),l=r.reduce((u,i)=>u+i.value,0),d=new Map(r.map(u=>[u.id,u]));return e.jsxs("div",{children:[e.jsx(Y,{title:t,description:s}),e.jsx(F,{h:"md"}),o?e.jsx(K,{className:"h-(--skeleton-height) w-full",style:{"--skeleton-height":`${Be}px`}}):r.length===0?e.jsx(Se,{h:Be,children:e.jsx(x,{fz:"sm",c:"dimmed",children:"No data available"})}):e.jsx(de,{width:"100%",height:Be,debounce:200,children:e.jsxs(Ae,{layout:"vertical",data:r,margin:{top:4,right:56,left:0,bottom:0},barCategoryGap:"20%",children:[e.jsx(Me,{stroke:"var(--color-line)",horizontal:!1,vertical:!0}),e.jsx(ue,{type:"number",axisLine:!1,tickLine:!1,tick:{fontSize:n.fontSizes.xs,fill:"var(--color-foreground-secondary)"}}),e.jsx(me,{type:"category",dataKey:"id",width:hs,interval:0,axisLine:!1,tickLine:!1,tick:e.jsx(tn,{rowsById:d})}),e.jsx(he,{cursor:{fill:"var(--color-surface-secondary)"},wrapperStyle:{outline:"none",zIndex:1e3},content:e.jsx(sn,{total:l})}),e.jsxs(ie,{dataKey:"value",maxBarSize:40,isAnimationActive:ct(),children:[r.map(u=>e.jsx(uo,{fill:u.color},u.id)),e.jsx(rs,{dataKey:"value",position:"right",content:({x:u,y:i,width:a,height:c,value:m})=>{if(m==null||u==null||i==null||a==null||c==null)return null;const f=String(m),p=Math.max(34,f.length*9+16),h=Number(i)+Number(c)/2,v=Number(u)+Number(a)+6;return e.jsxs("g",{children:[e.jsx("rect",{x:v,y:h-12,width:p,height:24,rx:8,ry:8,fill:"var(--color-surface-elevated)",stroke:"var(--color-line-strong)",strokeWidth:1}),e.jsx("text",{x:v+p/2,y:h,textAnchor:"middle",dominantBaseline:"middle",fill:"var(--color-foreground)",fontSize:n.fontSizes.sm,children:m})]})}})]})]})})]})};ps.displayName="AgentClientBarList";const rn="/assets/antigravity-yFWLfeWJ.svg",on="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cpath%20d='M6.513%2018.419c-1.6%200-3.107-.64-4.247-1.802A6.146%206.146%200%2001.5%2012.287c0-1.63.626-3.168%201.766-4.33%201.14-1.162%202.647-1.802%204.247-1.802s3.132.655%204.25%201.795c.835.849.835%202.23%200%203.078a2.11%202.11%200%2001-3.02%200%201.737%201.737%200%2000-1.234-.521c-.945%200-1.744.813-1.744%201.776%200%20.964.799%201.777%201.744%201.777.46%200%20.907-.19%201.234-.522a2.11%202.11%200%20013.02%200c.835.85.835%202.23%200%203.079a5.997%205.997%200%2001-4.25%201.794v.008z'%20fill='%23EA5E5D'/%3e%3cpath%20d='M12.026%2024c-1.6%200-3.107-.64-4.247-1.802a6.146%206.146%200%2001-1.766-4.33c0-1.63.644-3.193%201.762-4.337a2.11%202.11%200%20013.021%200c.834.849.834%202.23%200%203.078-.324.331-.51.788-.51%201.255%200%20.964.798%201.777%201.744%201.777.945%200%201.744-.813%201.744-1.777%200-.341-.083-.83-.475-1.233a6.255%206.255%200%2001-1.77-4.348c0-1.615.627-3.168%201.767-4.33s2.646-1.802%204.247-1.802c1.6%200%203.107.64%204.247%201.802a6.146%206.146%200%20011.766%204.33c0%201.63-.644%203.194-1.762%204.337a2.11%202.11%200%2001-3.021%200%202.206%202.206%200%20010-3.078c.323-.331.51-.788.51-1.255%200-.964-.798-1.777-1.744-1.777s-1.744.813-1.744%201.777c0%20.47.19.935.521%201.27%201.115%201.136%201.727%202.667%201.727%204.311a6.122%206.122%200%2001-1.766%204.33C15.137%2023.36%2013.63%2024%2012.03%2024h-.004z'%20fill='%23EA5E5D'/%3e%3cpath%20d='M12.026%206.867L8.53%203.587a1.336%201.336%200%20111.827-1.949l1.4%201.313L13.744.495a1.336%201.336%200%20012.075%201.68l-3.798%204.692h.004z'%20fill='%2323AF69'/%3e%3c/svg%3e",nn="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20100%20100'%20fill='hsl(14.8,%2063.1%25,%2059.6%25)'%3e%3cpath%20d='m19.6%2066.5%2019.7-11%20.3-1-.3-.5h-1l-3.3-.2-11.2-.3L14%2053l-9.5-.5-2.4-.5L0%2049l.2-1.5%202-1.3%202.9.2%206.3.5%209.5.6%206.9.4L38%2049.1h1.6l.2-.7-.5-.4-.4-.4L29%2041l-10.6-7-5.6-4.1-3-2-1.5-2-.6-4.2%202.7-3%203.7.3.9.2%203.7%202.9%208%206.1L37%2036l1.5%201.2.6-.4.1-.3-.7-1.1L33%2025l-6-10.4-2.7-4.3-.7-2.6c-.3-1-.4-2-.4-3l3-4.2L28%200l4.2.6L33.8%202l2.6%206%204.1%209.3L47%2029.9l2%203.8%201%203.4.3%201h.7v-.5l.5-7.2%201-8.7%201-11.2.3-3.2%201.6-3.8%203-2L61%202.6l2%202.9-.3%201.8-1.1%207.7L59%2027.
11l-1.5%208.2h.9l1-1.1%204.1-5.4%206.9-8.6%203-3.5L77%2013l2.3-1.8h4.3l3.1%204.7-1.4%204.9-4.4%205.6-3.7%204.7-5.3%207.1-3.2%205.7.3.4h.7l12-2.6%206.4-1.1%207.6-1.3%203.5%201.6.4%201.6-1.4%203.4-8.2%202-9.6%202-14.3%203.3-.2.1.2.3%206.4.6%202.8.2h6.8l12.6%201%203.3%202%201.9%202.7-.3%202-5.1%202.6-6.8-1.6-16-3.8-5.4-1.3h-.8v.4l4.6%204.5%208.3%207.5L89%2080.1l.5%202.4-1.3%202-1.4-.2-9.2-7-3.6-3-8-6.8h-.5v.7l1.8%202.7%209.8%2014.7.5%204.5-.7%201.4-2.6%201-2.7-.6-5.8-8-6-9-4.7-8.2-.5.4-2.9%2030.2-1.3%201.5-3%201.2-2.5-2-1.4-3%201.4-6.2%201.6-8%201.3-6.4%201.2-7.9.7-2.6v-.2H49L43%2072l-9%2012.3-7.2%207.6-1.7.7-3-1.5.3-2.8L24%2086l10-12.8%206-7.9%204-4.6-.1-.5h-.3L17.2%2077.4l-4.7.6-2-2%20.2-3%201-1%208-5.5Z'/%3e%3c/svg%3e",an="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20466.73%20487.04'%20fill='%239663F1'%3e%3cpath%20d='M463.6,275.08l-29.26-58.75v-33.83c0-56.08-45.01-101.5-100.53-101.5h-50.01c3.62-7.43,5.61-15.79,5.61-24.61,0-31.17-25.08-56.39-56.07-56.39s-56.07,25.22-56.07,56.39c0,8.82,1.99,17.17,5.61,24.61h-50.01c-55.51,0-100.52,45.42-100.52,101.5v33.83l-29.87,58.59c-3.01,5.9-3.01,12.92,0,18.81l29.87,57.93v33.83c0,56.08,45.01,101.5,100.52,101.5h200.95c55.51,0,100.53-45.42,100.53-101.5v-33.83l29.21-58.13c2.9-5.79,2.9-12.61.05-18.46ZM202.75,322.96c0,25.48-20.54,46.14-45.88,46.14s-45.88-20.66-45.88-46.14v-82.02c0-25.48,20.54-46.14,45.88-46.14s45.88,20.66,45.88,46.14v82.02ZM350.58,322.96c0,25.48-20.54,46.14-45.88,46.14s-45.88-20.66-45.88-46.14v-82.02c0-25.48,20.54-46.14,45.88-46.14s45.88,20.66,45.88,46.14v82.02Z'/%3e%3c/svg%3e",ln="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='%23383be0'%20fill-rule='evenodd'%3e%3cpath%20clip-rule='evenodd'%20d='M8.086.457a6.105%206.105%200%20013.046-.415c1.333.153%202.521.72%203.564%201.7a.117.117%200%2000.107.029c1.408-.346%202.762-.224%204.061.366l.063.03.154.076c1.357.703%202.33%201.77%202.918%203.198.278.679.418%201.388.421%202.126a5.655%205.655%200%2001-.18%201.631.167.167%200%2000.04.155%205.982%205.982%200%20011.578%202.891c.385%201.901-.01%203.615-1.183%205.14l-.182.22a6.063%206.063%200%2001-2.934%201.851.162.162%200%2000-.108.102c-.255.736-.511%201.364-.987%201.992-1.199%201.582-2.962%202.462-4.948%202.451-1.583-.008-2.986-.587-4.21-1.736a.145.145%200%2000-.14-.032c-.518.167-1.04.191-1.604.185a5.924%205.924%200%2001-2.595-.622%206.058%206.058%200%2001-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74%207.74%200%2001-.495-1.283%206.11%206.11%200%2001-.017-3.064.166.166%200%2000.008-.074.115.115%200%2000-.037-.064%205.958%205.958%200%2001-1.38-2.202%205.196%205.196%200%2001-.333-1.589%206.915%206.915%200%2001.188-2.132c.45-1.484%201.309-2.648%202.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129%200%2000.087-.087A6.016%206.016%200%20015.635%202.31C6.315%201.464%207.132.846%208.086.457zm-.804%207.85a.848.848%200%2000-1.473.842l1.694%202.965-1.688%202.848a.849.849%200%20001.46.864l1.94-3.272a.849.849%200%2000.007-.854l-1.94-3.393zm5.446%206.24a.849.849%200%20000%201.695h4.848a.849.849%200%20000-1.696h-4.848z'/%3e%3c/svg%3e",cn="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20512%20416'%20fill='%23e4e4e7'%20fill-rule='evenodd'%20clip-rule='evenodd'%3e%3cpath%20d='M181.33%20266.143c0-11.497%209.32-20.818%2020.818-20.818%2011.498%200%2020.819%209.321%2020.819%2020.818v38.373c0%2011.497-9.321%2020.818-20.819%2020.818-11.497%200-20.818-9.32-20.818-20.818v-38.373zM308.807%20245.325c-11.477%200-20.798%209.321-20.798%2020.818v38.373c0%2011.497%209.32%2020.818%2020.798%2020.818%2011.497%200%2020.818-9.32%2020.818-20.818v-38.373c0-11.497-9.32-20.818-20.818-20.818z'%20fill-rule='nonzero'/%3e%3cpath%20d='M512.002%20246.393v57.384c-.02%207.411-3.696%2014.638-9.67%2019.011C431.767%20374.444%20344.695%20416%20256%20416c-98.138%200-196.379-56.542-246.33-93.21-5.975-4.374-9.65-11.6-9.671-19.012v-57.384a35.347%2035.347%200%20016.857-20.922l15.583-21.085c8.336-11.312%2020.757-14.31%2033.98-14.31%204.988-56.953%2016.794-97.604%2045.024-127.354C155.194%205.77%20226.56%200%20256%200c29.441%200%20100.807%205.77%20154.557%2062.722%2028.19%2029.75%2040.036%2070.401%2045.025%20127.354%2013.263%200%2025.602%202.936%2033.958%2014.31l15.583%2021.127c4.476%206.077%206.878%2013.345%206.878%2020.88zm-97.666-26.075c-.677-13.058-11.292-18.19-22.338-21.824-11.64%207.309-25.848%2010.183-39.46%2010.183-14.454%200-41.432-3.47-63.872-25.869-5.667-5.625-9.527-14.454-12.155-24.247a212.902%20212.902%200%2000-20.469-1.
1088c-6.098%200-13.099.349-20.551%201.088-2.628%209.793-6.509%2018.622-12.155%2024.247-22.4%2022.4-49.418%2025.87-63.872%2025.87-13.612%200-27.86-2.855-39.501-10.184-11.005%203.613-21.558%208.828-22.277%2021.824-1.17%2024.555-1.272%2049.11-1.375%2073.645-.041%2012.318-.082%2024.658-.288%2036.976.062%207.166%204.374%2013.818%2010.882%2016.774%2052.97%2024.124%20103.045%2036.278%20149.137%2036.278%2046.01%200%2096.085-12.154%20149.014-36.278%206.508-2.956%2010.84-9.608%2010.881-16.774.637-36.832.124-73.809-1.642-110.62h.041zM107.521%20168.97c8.643%208.623%2024.966%2014.392%2042.56%2014.392%2013.448%200%2039.03-2.874%2060.156-24.329%209.28-8.951%2015.05-31.35%2014.413-54.079-.657-18.231-5.769-33.28-13.448-39.665-8.315-7.371-27.203-10.574-48.33-8.644-22.399%202.238-41.267%209.588-50.875%2019.833-20.798%2022.728-16.323%2080.317-4.476%2092.492zm130.556-56.008c.637%203.51.965%207.35%201.273%2011.517%200%202.875%200%205.77-.308%208.952%206.406-.636%2011.847-.636%2016.959-.636s10.553%200%2016.959.636c-.329-3.182-.329-6.077-.329-8.952.329-4.167.657-8.007%201.294-11.517-6.735-.637-12.812-.965-17.924-.965s-11.21.328-17.924.965zm49.275-8.008c-.637%2022.728%205.133%2045.128%2014.413%2054.08%2021.105%2021.454%2046.708%2024.328%2060.155%2024.328%2017.596%200%2033.918-5.769%2042.561-14.392%2011.847-12.175%2016.322-69.764-4.476-92.492-9.608-10.245-28.476-17.595-50.875-19.833-21.127-1.93-40.015%201.273-48.33%208.644-7.679%206.385-12.791%2021.434-13.448%2039.665z'/%3e%3c/svg%3e",dn="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20747%20851'%20fill='none'%3e%3cpath%20d='M731.545%20201.413L390.888%204.73778C379.949%20-1.57926%20366.452%20-1.57926%20355.513%204.73778L14.8731%20201.413C5.67749%20206.723%200.00012207%20216.542%200.00012207%20227.177V623.776C0.00012207%20634.394%205.67749%20644.23%2014.8731%20649.539L355.529%20846.214C366.468%20852.532%20379.966%20852.532%20390.905%20846.214L731.56%20649.539C740.756%20644.23%20746.434%20634.409%20746.434%20623.776V227.177C746.434%20216.558%20740.756%20206.723%20731.56%20201.413H731.545ZM710.147%20243.074L381.293%20812.663C379.07%20816.501%20373.201%20814.933%20373.201%20810.487V437.526C373.201%20430.074%20369.218%20423.18%20362.757%20419.438L39.7735%20232.966C35.9353%20230.744%2037.5026%20224.874%2041.9484%20224.874H699.655C708.996%20224.874%20714.833%20234.997%20710.162%20243.09H710.147V243.074Z'%20fill='%23e4e4e7'/%3e%3c/svg%3e",un="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20viewBox='0%200%2016%2016'%3e%3cpath%20d='M16%208.016A8.522%208.522%200%20008.016%2016h-.032A8.521%208.521%200%20000%208.016v-.032A8.521%208.521%200%20007.984%200h.032A8.522%208.522%200%200016%207.984v.032z'%20fill='url(%23prefix__paint0_radial_980_20147)'/%3e%3cdefs%3e%3cradialGradient%20id='prefix__paint0_radial_980_20147'%20cx='0'%20cy='0'%20r='1'%20gradientUnits='userSpaceOnUse'%20gradientTransform='matrix(16.1326%205.4553%20-43.70045%20129.2322%201.588%206.503)'%3e%3cstop%20offset='.067'%20stop-color='%239168C0'/%3e%3cstop%20offset='.343'%20stop-color='%235684D1'/%3e%3cstop%20offset='.672'%20stop-color='%231BA1E3'/%3e%3c/radialGradient%3e%3c/defs%3e%3c/svg%3e",mn="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20512%20512'%20fill-rule='evenodd'%20clip-rule='evenodd'%3e%3cpath%20d='M20.34%203.66L3.66%2020.34A12.508%2012.508%200%20000%2029.18V59c0%202.76%202.24%205%205%205h29.82c3.32%200%206.49-1.32%208.84-3.66l16.68-16.68c2.34-2.34%203.66-5.52%203.66-8.84V5c0-2.76-2.24-5-5-5H29.18c-3.32%200-6.49%201.32-8.84%203.66z'%20fill='url(%23prefix___Linear1)'%20fill-rule='nonzero'%20transform='matrix(7.81247%200%200%207.81247%206%206)'/%3e%3cpath%20fill-rule='nonzero'%20d='M68.5%20131h312.499v312.499h-312.5z'/%3e%3cpath%20fill='%23fff'%20fill-rule='nonzero'%20d='M107.562%20373.186h132.812v31.25H107.562z'/%3e%3cdefs%3e%3clinearGradient%20id='prefix___Linear1'%20x1='0'%20y1='0'%20x2='1'%20y2='0'%20gradientUnits='userSpaceOnUse'%20gradientTransform='rotate(-44.6%2076.892%2030.324)%20scale(86.75)'%3e%3cstop%20offset='0'%20stop-color='%23ff9419'/%3e%3cstop%20offset='.43'%20stop-color='%23ff021d'/%3e%3cstop%20offset='.99'%20stop-color='%23e600ff'/%3e%3cstop%20offset='1'%20stop-color='%23e600ff'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",hn="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20320%20320'%20fill='%23e4e4e7'%3e%3cpath%20d='m297.
106%20130.97c7.26-21.79%204.76-45.66-6.85-65.48-17.46-30.4-52.56-46.04-86.84-38.68-15.25-17.18-37.16-26.95-60.13-26.81-35.04-.08-66.13%2022.48-76.91%2055.82-22.51%204.61-41.94%2018.7-53.31%2038.67-17.59%2030.32-13.58%2068.54%209.92%2094.54-7.26%2021.79-4.76%2045.66%206.85%2065.48%2017.46%2030.4%2052.56%2046.04%2086.84%2038.68%2015.24%2017.18%2037.16%2026.95%2060.13%2026.8%2035.06.09%2066.16-22.49%2076.94-55.86%2022.51-4.61%2041.94-18.7%2053.31-38.67%2017.57-30.32%2013.55-68.51-9.94-94.51zm-120.28%20168.11c-14.03.02-27.62-4.89-38.39-13.88.49-.26%201.34-.73%201.89-1.07l63.72-36.8c3.26-1.85%205.26-5.32%205.24-9.07v-89.83l26.93%2015.55c.29.14.48.42.52.74v74.39c-.04%2033.08-26.83%2059.9-59.91%2059.97zm-128.84-55.03c-7.03-12.14-9.56-26.37-7.15-40.18.47.28%201.3.79%201.89%201.13l63.72%2036.8c3.23%201.89%207.23%201.89%2010.47%200l77.79-44.92v31.1c.02.32-.13.63-.38.83l-64.41%2037.19c-28.69%2016.52-65.33%206.7-81.92-21.95zm-16.77-139.09c7-12.16%2018.05-21.46%2031.21-26.29%200%20.55-.03%201.52-.03%202.2v73.61c-.02%203.74%201.98%207.21%205.23%209.06l77.79%2044.91-26.93%2015.55c-.27.18-.61.21-.91.08l-64.42-37.22c-28.63-16.58-38.45-53.21-21.95-81.89zm221.26%2051.49-77.79-44.92%2026.93-15.54c.27-.18.61-.21.91-.08l64.42%2037.19c28.68%2016.57%2038.51%2053.26%2021.94%2081.94-7.01%2012.14-18.05%2021.44-31.2%2026.28v-75.81c.03-3.74-1.96-7.2-5.2-9.06zm26.8-40.34c-.47-.29-1.3-.79-1.89-1.13l-63.72-36.8c-3.23-1.89-7.23-1.89-10.47%200l-77.79%2044.92v-31.1c-.02-.32.13-.63.38-.83l64.41-37.16c28.69-16.55%2065.37-6.7%2081.91%2022%206.99%2012.12%209.52%2026.31%207.15%2040.1zm-168.51%2055.43-26.94-15.55c-.29-.14-.48-.42-.52-.74v-74.39c.02-33.12%2026.89-59.96%2060.01-59.94%2014.01%200%2027.57%204.92%2038.34%2013.88-.49.26-1.33.73-1.89%201.07l-63.72%2036.8c-3.26%201.85-5.26%205.31-5.24%209.06l-.04%2089.79zm14.63-31.54%2034.65-20.01%2034.65%2020v40.01l-34.65%2020-34.65-20z'/%3e%3c/svg%3e",pn="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20240%20300'%3e%3cpath%20d='M180%20240H60V120H180V240Z'%20fill='%2371717a'/%3e%3cpath%20d='M180%2060H60V240H180V60ZM240%20300H0V0H240V300Z'%20fill='%23e4e4e7'/%3e%3c/svg%3e",gn="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2040%2040'%20fill='%23FF6161'%3e%3cpath%20d='M10,25.8V30L0,20l2.1-2.1L10,25.8z%20M14.2,30H10l10,10l2.1-2.1L14.2,30z%20M37.9,22.1L40,20L20,0l-2.1,2.1l7.9,7.9H21l-5.5-5.5l-2.1,2.1l3.4,3.4h-2.4v15.5H30v-2.4l3.4,3.4l2.1-2.1L30,19v-4.8L37.9,22.1z%20M11,9L9,11.1l2.2,2.2l2.1-2.1L11,9z%20M28.8,26.7l-2.1,2.1l2.2,2.2L31,29L28.8,26.7z%2
10M6.6,13.4l-2.1,2.1l5.5,5.5v-4.2L6.6,13.4z%20M23.1,30H19l5.5,5.5l2.1-2.1L23.1,30z'/%3e%3c/svg%3e",fn="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='%2332F08C'%3e%3cpath%20d='M24%2020.541H3.428v-3.426H0V3.4h24V20.54zM3.428%2017.115h17.144V6.827H3.428v10.288zm8.573-5.196l-2.425%202.424-2.424-2.424%202.424-2.424%202.425%202.424zm6.857-.001l-2.424%202.423-2.425-2.423%202.425-2.425%202.424%202.425z'/%3e%3c/svg%3e",xn="/assets/visualstudio-B9ndxb8e.svg",vn="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20100%20100'%20fill='none'%3e%3cmask%20id='vscode-mask'%20mask-type='alpha'%20maskUnits='userSpaceOnUse'%20x='0'%20y='0'%20width='100'%20height='100'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M70.9119%2099.3171C72.4869%2099.9307%2074.2828%2099.8914%2075.8725%2099.1264L96.4608%2089.2197C98.6242%2088.1787%20100%2085.9892%20100%2083.5872V16.4133C100%2014.0113%2098.6243%2011.8218%2096.4609%2010.7808L75.8725%200.873756C73.7862%20-0.130129%2071.3446%200.11576%2069.5135%201.44695C69.252%201.63711%2069.0028%201.84943%2068.769%202.08341L29.3551%2038.0415L12.1872%2025.0096C10.589%2023.7965%208.35363%2023.8959%206.86933%2025.2461L1.36303%2030.2549C-0.452552%2031.9064%20-0.454633%2034.7627%201.35853%2036.417L16.2471%2050.0001L1.35853%2063.5832C-0.454633%2065.2374%20-0.452552%2068.0938%201.36303%2069.7453L6.86933%2074.7541C8.35363%2076.1043%2010.589%2076.2037%2012.1872%2074.9905L29.3551%2061.9587L68.769%2097.9167C69.3925%2098.5406%2070.1246%2099.0104%2070.9119%2099.3171ZM75.0152%2027.2989L45.1091%2050.0001L75.0152%2072.7012V27.2989Z'%20fill='white'/%3e%3c/mask%3e%3cg%20mask='url(%23vscode-mask)'%3e%3cpath%20d='M96.4614%2010.7962L75.8569%200.875542C73.4719%20-0.272773%2070.6217%200.211611%2068.75%202.08333L1.29858%2063.5832C-0.515693%2065.2373%20-0.513607%2068.0937%201.30308%2069.7452L6.81272%2074.754C8.29793%2076.1042%2010.5347%2076.2036%2012.1338%2074.9905L93.3609%2013.3699C96.086%2011.3026%20100%2013.2462%20100%2016.6667V16.4275C100%2014.0265%2098.6246%2011.8378%2096.4614%2010.7962Z'%20fill='%230065A9'/%3e%3cpath%20d='M96.4614%2089.2038L75.8569%2099.1245C73.4719%20100.273%2070.6217%2099.7884%2068.75%2097.9167L1.29858%2036.4169C-0.515693%2034.7627%20-0.513607%2031.9063%201.30308%2030.2548L6.81272%2025.246C8.29793%2023.8958%2010.5347%2023.7964%2012.1338%2025.0095L93.3609%2086.6301C96.086%2088.6974%20100%2086.7538%20100%2083.3334V83.5726C100%2085.9735%2098.6246%2088.1622%2096.4614%2089.2038Z'%20fill='%23007ACC'/%3e%3cpath%20d='M75.8578%2099.1263C73.4721%20100.274%2070.6219%2099.7885%2068.75%2097.9166C71.0564%20100.223%2075%2098.5895%2075%2095.3278V4.67213C75%201.41039%2071.0564%20-0.223106%2068.75%202.08329C70.6219%200.211402%2073.4721%20-0.273666%2075.8578%200.873633L96.4587%2010.7807C98.6234%2011.8217%20100%2014.0112%20100%2016.4132V83.5871C100%2085.9891%2098.6234%2088.1786%2096.4586%2089.2196L75.8578%2099.1263Z'%20fill='%231F9CF0'/%3e%3c/g%3e%3c/svg%3e",jn="/assets/windsurf--j0Z8UKU.svg",M=({src:t,className:s})=>e.jsx("img",{src:t,alt:"",className:$("size-full object-contain",s)}),Ge=({className:t})=>e.jsx(M,{src:nn,className:t});Ge.displayName="ClaudeLogo";const gs=({className:t})=>e.jsx(M,{src:vn,className:t});gs.displayName="VSCodeLogo";const fs=({className:t})=>e.jsx(M,{src:un,className:t});fs.displayName="GeminiLogo";const xs=({className:t})=>e.jsx(M,{src:mn,className:t});xs.displayName="JetBrainsLogo";const vs=({className:t})=>e.jsx(M,{src:gn,className:t});vs.displayName="RaycastLogo";const js=({className:t})=>e.jsx(M,{src:jn,className:t});js.displayName="WindsurfLogo";const ys=({className:t})=>e.jsx(M,{src:an,className:t});ys.displayName="ClineLogo";const bs=({className:t})=>e.jsx(M,{src:dn,className:t});bs.displayName="CursorLogo";const ws=({className:t})=>e.jsx(M,{src:hn,className:t});ws.displayName="OpenAILogo";const Ss=({className:t})=>e.jsx(M,{src:cn,className:t});Ss.displayName="GithubCopilotLogo";const _s=({className:t})=>e.jsx(M,{src:pn,className:t});_s.displayName="OpenCodeLogo";const Ls=({className:t})=>e.jsx(M,{src:ln,className:t});Ls.displayName="CodexLogo";const Cs=({className:t})=>e.jsx(M,{src:on,className:t});Cs.displayName="CherryStudioLogo";
1const ks=({className:t})=>e.jsx(M,{src:rn,className:t});ks.displayName="AntigravityLogo";const Es=({className:t})=>e.jsx(M,{src:fn,className:t});Es.displayName="TraeLogo";const Ts=({className:t})=>e.jsx(M,{src:xn,className:t});Ts.displayName="VisualStudioLogo";const yn="var(--color-neutral-400)",je="var(--color-neutral-50)",Et="#D97757",bn="#8E75B2",wn="#FF6363",Sn="#007ACC",_n="#8B52F4",Ln="#317CFF",Cn="#9663F1",kn="#383BE0",En="#432973",Tn="#EA5E5D",Nn="#4796E3",Dn="#32F08C",An="#D96BA0",Z={id:"__other__",label:"Other",color:An},Mn=[{keywords:["claudecode"],id:"claude-code",label:"Claude Code",Logo:Ge,color:Et},{keywords:["claude","anthropic"],id:"claude",label:"Claude",Logo:Ge,color:Et},{keywords:["cursor"],id:"cursor",label:"Cursor",Logo:bs,color:je},{keywords:["windsurf","devin"],id:"windsurf",label:"Devin",Logo:js,color:Ln},{keywords:["cline"],id:"cline",label:"Cline",Logo:ys,color:Cn},{keywords:["copilot"],id:"copilot",label:"GitHub Copilot",Logo:Ss,color:je},{keywords:["opencode"],id:"opencode",label:"OpenCode",Logo:_s,color:je},{keywords:["codex"],id:"codex",label:"Codex",Logo:Ls,color:kn},{keywords:["openai","chatgpt"],id:"chatgpt",label:"ChatGPT",Logo:ws,color:je},{keywords:["gemini"],id:"gemini",label:"Gemini",Logo:fs,color:bn},{keywords:["jetbrains"],id:"jetbrains",label:"JetBrains",Logo:xs,color:En},{keywords:["raycast"],id:"raycast",label:"Raycast",Logo:vs,color:wn},{keywords:["visualstudiocode","vscode"],id:"vscode",label:"VS Code",Logo:gs,color:Sn},{keywords:["visualstudio"],id:"visual-studio",label:"Visual Studio",Logo:Ts,color:_n},{keywords:["trae"],id:"trae",label:"Trae",Logo:Es,color:Dn},{keywords:["cherrystudio","cherry"],id:"cherry-studio",label:"Cherry Studio",Logo:Cs,color:Tn},{keywords:["antigravity"],id:"antigravity",label:"Antigravity",Logo:ks,color:Nn}],Ns=t=>t.replace(/\s*\([^)]*\)\s*$/,"").trim(),Pn=t=>Ns(t).toLowerCase().replace(/[^a-z0-9]/g,""),zn=t=>{const s=Ns(t);if(s==="")return Z;const r=Pn(t);if(r==="")return Z;const o=Mn.find(n=>n.keywords.some(l=>r.includes(l)));return o?{id:o.id,label:o.label,Logo:o.Logo,color:o.color}:{id:r||s,label:s,color:yn}},He=8,In=t=>{const s=new Map;t.forEach(c=>c.breakdown_by_client.forEach(m=>{const f=zn(m.client);let p=s.get(f.id);p||(p={client:f,value:0,members:new Map},s.set(f.id,p)),p.value+=m.count;const h=m.client||"No client reported",v=p.members.get(h);p.members.set(h,{value:(v?.value??0)+m.count,Logo:f.Logo})}));const r=c=>Array.from(c,([m,f])=>({name:m,value:f.value,Logo:f.Logo})).sort((m,f)=>f.value-m.value),o=Array.from(s.values()).filter(c=>c.value>0),n=o.find(c=>c.client.id===Z.id),l=o.filter(c=>c.client.id!==Z.id).sort((c,m)=>m.value-c.value),d=l.length+(n?1:0)>He,u=d?l.slice(0,He-1):l,i=d?l.slice(He-1):[],a=u.map(c=>({id:c.client.id,label:c.client.label,value:c.value,color:c.client.color,Logo:c.client.Logo,members:r(c.members)}));if(n||i.length>0){const c=new Map(n?.members??[]);i.forEach(f=>f.members.forEach((p,h)=>{const v=c.get(h);c.set(h,{value:(v?.value??0)+p.value,Logo:p.Logo})}));const m=(n?.value??0)+i.reduce((f,p)=>f+p.value,0);m>0&&a.push({id:Z.id,label:Z.label,value:m,color:Z.color,hideIcon:!0,members:r(c)})}return a},Ds=t=>({filter:`drop-shadow(0 0 6px ${t})`}),As=()=>{const[t,s]=g.useState(null),r=g.useCallback((n,l)=>{s(l?{key:n,period:l.getTime()}:null)},[]),o=g.useCallback(()=>s(null),[]);return{hoveredBar:t,onBarEnter:r,onBarLeave:o}},Fn=8,Rn=360,Ms=({active:t,payload:s,series:r,aggregationPeriod:o,isDrillable:n})=>{if(!t||!s||s.length===0)return null;const l=s[0].payload,d=[...r].reverse().map(a=>{const c=l[a.key];return{entry:a,count:typeof c=="number"?c:0}}).filter(a=>a.count>0),u=d.slice(0,Fn),i=d.length-u.length;return e.jsxs(Ze,{padding:"sm",radius:"md",shadow:"md",withBorder:!0,sx:{maxWidth:Rn},children:[e.jsx(x,{fw:"bold",fz:"md",sx:{marginBottom:X("xxs")},children:re(l.period,o)}),e.jsxs(A,{sx:{display:"flex",flexDirection:"column",gap:X("xxs")},children:[u.map(({entry:a,count:c})=>e.jsxs(A,{sx:{display:"flex",alignItems:"center",gap:X("md")},children:[e.jsx(A,{"aria-hidden":"true",sx:{width:12,height:12,borderRadius:3,backgroundColor:a.color,flexShrink:0}}),e.jsx(x,{fz:"sm",title:a.label,sx:{flexGrow:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.label}),e.jsx(x,{fw:"bold",fz:"sm",sx:{flexShrink:0,textAlign:"right"},children:c})]},a.key)),i>0?e.jsxs(x,{c:"dimmed",fz:"xs",children:["+",i," more"]}):null]}),n?e.jsx(x,{c:"dimmed",fz:"xs",sx:{marginTop:X("xs")},children:"Click to view its conversations"}):null]})};Ms.displayName="ByGroupTooltip";const Ve=22,On=36,Bn=4,Hn=7,Un=8,Gn=t=>t.length*Hn+Un,Ps=(t,s)=>
1{const r=t-Bn,o=Gn(s),n=Math.min(r,Math.max(o,On));return n>=o?n:null},zs=t=>{const s=t.map(r=>r?.x).filter(r=>r!=null);return s.length>1?Math.abs(s[1]-s[0]):t[0]?.width??0},Is=t=>t.reduce((s,r)=>r.length>s.length?r:s,""),dt=({cx:t,cy:s,width:r,height:o,label:n})=>e.jsxs("g",{children:[e.jsx("rect",{x:t-r/2,y:s-o/2,width:r,height:o,rx:o/2,ry:o/2,strokeWidth:1,className:"fill-surface-elevated stroke-line-strong"}),e.jsx("text",{x:t,y:s+1,textAnchor:"middle",dominantBaseline:"middle",className:"fill-foreground text-xs font-semibold",children:n})]});dt.displayName="ChartPillLabel";const Vn=7,Fs=({totals:t,formattedGraphicalItems:s=[]})=>{const r=s.map(l=>l.props?.data??[]),o=t.map(l=>Number.isFinite(l)?l.toLocaleString():""),n=Ps(zs(r[0]??[]),Is(o));return n==null?null:e.jsx("g",{pointerEvents:"none",children:t.map((l,d)=>{const u=r.map(c=>c[d]).filter(c=>c!=null),i=u.find(c=>c.x!=null&&!!c.width),a=u.map(c=>c.y).filter(c=>c!=null);return!o[d]||l===0||a.length===0||i?.x==null||!i.width?null:e.jsx(dt,{cx:i.x+i.width/2,cy:Math.min(...a)-Ve/2-Vn,width:n,height:Ve,label:o[d]},d)})})};Fs.displayName="ByGroupTotalPills";const Le=({title:t,subtitle:s,data:r,series:o,aggregationPeriod:n,height:l,fillHeight:d=!1,maxBarSize:u,isLoading:i=!1,hideYAxisValues:a=!1,info:c,onBarClick:m})=>{const f=We(),{hoveredBar:p,onBarEnter:h,onBarLeave:v}=As();return e.jsxs(A,{sx:d?{display:"flex",flexDirection:"column",height:"100%"}:void 0,children:[t&&s&&e.jsxs(e.Fragment,{children:[e.jsx(Y,{title:t,description:s,info:c,hint:m?"Click a bar to view its conversations":void 0}),e.jsx(F,{h:"md"})]}),e.jsx(A,{sx:d?{flex:1,minHeight:0}:void 0,children:i?e.jsx(K,{className:$("w-full",d?"h-full min-h-(--skeleton-height)":"h-(--skeleton-height)"),style:{"--skeleton-height":`${l}px`}}):o.length===0?e.jsx(Se,{h:d?"100%":l,mih:d?l:void 0,children:e.jsx(x,{fz:"sm",c:"dimmed",children:"No data available"})}):e.jsx(de,{width:"100%",height:d?"100%":l,minHeight:d?l:void 0,debounce:200,children:e.jsxs(Ae,{data:r,margin:{top:30,right:30,left:0,bottom:0},onMouseLeave:v,children:[e.jsx(ue,{axisLine:!1,tickLine:!1,dataKey:"period",tickFormatter:j=>re(j,n),tick:{fontSize:f.fontSizes.xs,fill:"var(--color-foreground-secondary)"}}),e.jsx(me,{axisLine:!1,tickLine:!1,tick:{fontSize:f.fontSizes.sm,fill:"var(--color-foreground-secondary)"},hide:a}),e.jsx(Me,{stroke:"var(--color-line)",vertical:!1,horizontal:!0}),o.map(j=>{const _=!!m&&(j.drillable??!0);return e.jsx(ie,{dataKey:j.key,stackId:"a",fill:j.color,background:!1,maxBarSize:u,isAnimationActive:ct(),cursor:_?"pointer":void 0,onClick:_?w=>{const b=w.payload;b&&m?.(j.key,b.period)}:void 0,onMouseEnter:w=>{if(!_){v();return}const b=w.payload;h(j.key,b?.period)},onMouseLeave:v,shape:_?w=>{const b=w,C=p?.key===j.key&&b.payload?.period.getTime()===p.period;return e.jsx(mo,{...b,style:C?Ds(j.color):void 0})}:void 0},j.key)}),e.jsx(os,{component:e.jsx(Fs,{totals:r.map(j=>j.totalCount)})}),e.jsx(he,{allowEscapeViewBox:{x:!1,y:!0},wrapperStyle:{outline:"none",zIndex:1e3},cursor:!1,content:e.jsx(Ms,{series:o,aggregationPeriod:n,isDrillable:p!==null})})]})})})]})};Le.displayName="ByGroupTimeseriesChart";const pe=({illustrationClassName:t,icon:s,title:r,description:o,children:n})=>e.jsx("div",{className:"flex h-full min-h-0 items-center justify-center",children:e.jsxs(fo,{className:"w-full max-w-2xl",children:[e.jsx(xo,{className:t,children:s}),e.jsxs(vo,{children:[e.jsxs(jo,{children:[e.jsx(yo,{children:r}),e.jsx(bo,{children:o})]}),e.jsx(wo,{children:n})]})]})});pe.displayName="DashboardEmptyState";const ne=()=>e.jsx(Ut,{variant:"light",color:"red",title:"Couldn't load dashboard",icon:e.jsx(tt,{size:16}),children:"Something went wrong loading the dashboard data. Refresh the page and try again."});ne.displayName="DashboardErrorState";const Ke=(t,s,r,o)=>{const n=new Map,l=t.map(i=>{const a={};return i.breakdown.forEach(c=>{a[c.key]=(a[c.key]??0)+c.count;const m=n.get(c.key);m?m.total+=c.count:n.set(c.key,{key:c.key,label:c.label??"Unknown",total:c.count})}),{period:new Date(i.period),totalCount:s(i),counts:a}}),d=Array.from(n.values()).filter(i=>i.total>0).sort((i,a)=>i.total-a.total).map(i=>({key:i.key,label:i.label,color:r(i.key),drillable:o?.has(i.key)??!1}));return{data:l.map(({period:i,totalCount:a,counts:c})=>{const m={period:i,totalCount:a};return d.forEach(f=>{m[f.key]=c[f.key]??0}),m}),series:d}},Rs=()=>{const t=q(),{aggregationPeriod:s,groupBy:r,scopedProjects:o,teamIntegrations:n,isLoadingIntegrations:l,onBarDrillDown:d}=H(),u=Xo(!0),i=Jo(!0),a=g.useMemo(()=>u.data?.time_series??[],[u.data]),c=g.useMemo(()=>i.data?.time_series??[],[i.data]),m=g.useMemo(()=>{const S=new Map;
1return n.forEach((E,D)=>S.set(E.id,D+1)),S},[n]),f=g.useMemo(()=>r==="project"?S=>se(Qt(S,o)):S=>se(m.get(S)??1),[r,o,m]),p=g.useMemo(()=>r==="integration"?new Set(n.map(S=>S.id)):void 0,[r,n]),h=g.useMemo(()=>Ke(a.map(S=>({period:S.period,total_count:S.total_count,breakdown:S.breakdown_by_group})),S=>S.total_count,f,p),[a,f,p]),v=g.useMemo(()=>In(c),[c]),j=t.project.selected?.id?qt(Yt.integrationNew.build({project:t.project.selected.id}),{type:"KAPA_MCP",source:"agents_empty_state"}):void 0;if(u.isError||i.isError)return e.jsx(ne,{});const _=a.some(S=>S.total_count>0),w=ns(n,cs);if(!u.isLoading&&!l&&!_&&!w)return e.jsxs(pe,{illustrationClassName:"bg-preset-agents",icon:e.jsx(Jt,{size:84,stroke:1.5,className:"text-white"}),title:"Connect your AI agents",description:"Give Claude, Cursor, and your own agents access to your knowledge sources through a hosted MCP server.",children:[j?e.jsx(R,{render:e.jsx(Xt,{to:j}),children:"Create an MCP server"}):null,e.jsxs(R,{variant:"secondary",render:e.jsx("a",{href:J.integrations.mcp,target:"_blank",rel:"noreferrer"}),children:["Learn more",e.jsx(De,{size:14,"data-icon":"inline-end"})]})]});const b=l||u.isLoading,C=l||i.isLoading,T=r==="project"?"Agent query volume across selected projects":"Agent query volume across selected integrations";return e.jsxs(B,{gutter:"md",children:[e.jsx(B.Col,{span:{base:12,lg:6},children:e.jsx(z,{shadow:"md",radius:"md",p:"xl",withBorder:!0,h:"100%",children:e.jsx(Le,{title:"Agent queries",subtitle:T,data:h.data,series:h.series,aggregationPeriod:s,height:350,maxBarSize:120,isLoading:b,onBarClick:r==="integration"?d:void 0})})}),e.jsx(B.Col,{span:{base:12,lg:6},children:e.jsx(z,{shadow:"md",radius:"md",p:"xl",withBorder:!0,h:"100%",children:e.jsx(ps,{title:"Queries by MCP client",subtitle:"Queries from OAuth-authenticated MCP clients",data:v,isLoading:C})})})]})};Rs.displayName="AgentsDashboard";const ut=({className:t,...s})=>e.jsx("div",{"data-slot":"card-row",className:$("grid grid-cols-[repeat(auto-fit,minmax(min(11rem,100%),1fr))] gap-4",t),...s});ut.displayName="CardRow";const Kn=6,$n=48,qn=.25,Os=t=>Math.max(Math.min(Kn,t*qn)/2,(t-$n)/2),Yn=t=>Math.max(t-Os(t)*2,1),Tt=1,Wn='[data-slot="self-serve-bar"]',Zn='[data-slot="self-serve-bar-fill"]',Bs=({x:t,y:s,width:r,height:o,fill:n,fillOpacity:l,payload:d,glowPeriod:u,glowColor:i,onPaintedClick:a,onPaintedEnter:c,onPaintedLeave:m})=>{if(t==null||s==null||r==null||o==null)return e.jsx("g",{});const f=Os(r),p=d?.period,h=u!=null&&p?.getTime()===u;return e.jsxs("g",{"data-slot":"self-serve-bar",children:[e.jsx("rect",{x:t-Tt,y:s,width:r+Tt*2,height:o,fill:"transparent"}),e.jsx("rect",{"data-slot":"self-serve-bar-fill",x:t+f,y:s,width:Yn(r),height:o,fill:n,fillOpacity:l,cursor:a?"pointer":void 0,style:h&&i?Ds(i):void 0,onClick:p&&a?()=>a(p):void 0,onMouseEnter:p&&c?()=>c(p):void 0,onMouseLeave:m})]})};Bs.displayName="SelfServeBarShape";const ze=["troubleshooting","guiding","lookup","other"],Hs=["uncertain","negativeSentiment","downvoted","pushback"],Qn={troubleshooting:{label:"Troubleshooting",description:"Unblocked an error or broken state",bucketKey:"self_served_troubleshooting"},guiding:{label:"Guiding",description:"Walked the user through setup or usage",bucketKey:"self_served_guiding"},lookup:{label:"Lookup",description:"Surfaced a specific fact, symbol, or doc",bucketKey:"self_served_lookup"},other:{label:"Other",description:"Other successfully resolved questions",bu
1cketKey:"self_served_other"},uncertain:{label:"Uncertain",description:"Missing knowledge to answer confidently",bucketKey:"not_self_served_uncertain"},negativeSentiment:{label:wt[te.NegativeSentiment],description:bt[te.NegativeSentiment],bucketKey:"not_self_served_negative_sentiment"},downvoted:{label:"Downvoted",description:"User gave an explicit thumbs-down",bucketKey:"not_self_served_downvoted"},pushback:{label:wt[te.Pushback],description:bt[te.Pushback],bucketKey:"not_self_served_pushback"}},Us=t=>t.map(s=>({key:s,...Qn[s]})),mt=Us(ze),ht=Us(Hs),Gs=[...ze,...Hs],Vs=Object.fromEntries([...mt,...ht].map(t=>[t.key,t])),Xn=new Set(ze),Ks=t=>Xn.has(t)?"self":"notSelf",$s=t=>t==="self"?mt:ht,Jn=(t,s)=>t.kind==="group"?t.group===s:t.source==="legend"&&Ks(t.key)===s,ea=t=>Object.fromEntries(Gs.map(s=>[s,t[Vs[s].bucketKey]])),qs=t=>t.map(s=>{const r=s.total-s.off_topic,o=ea(s);return{...Object.fromEntries(Gs.map(l=>[l,r>0?o[l]/r*100:0])),period:new Date(s.period),eligible:r,counts:o}}),Ys=(t,s)=>Math.round(t[s]),Ws=(t,s)=>$s(s).reduce((r,o)=>r+t[o.key],0),ta=(t,s)=>Math.round(Ws(t,s)),Nt=(t,s)=>[...t].sort((r,o)=>(s?.[o.bucketKey]??0)-(s?.[r.bucketKey]??0)),sa=(t,s,r)=>{if(s<=0)return t.map(()=>0);const o=t.map(u=>u/s*100),n=o.map(u=>Math.floor(u)),l=o.map((u,i)=>({index:i,remainder:u-Math.floor(u)})).sort((u,i)=>i.remainder-u.remainder);let d=r-n.reduce((u,i)=>u+i,0);for(const{index:u}of l){if(d<=0)break;n[u]+=1,d-=1}for(const{index:u}of[...l].reverse()){if(d>=0)break;n[u]>0&&(n[u]-=1,d+=1)}return n},ra=t=>{const s=Math.round(t);return s===0&&t>0?"<1":s.toLocaleString()},Dt="flex w-full flex-col gap-1 px-4 py-2 text-left",Zs=({item:t,onEnter:s,onLeave:r,onSelect:o})=>{const n=e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{"aria-hidden":"true",style:{"--legend-color":t.color},className:"size-2.5 shrink-0 rounded-full bg-[var(--legend-color)]"}),e.jsx("span",{className:"text-foreground truncate text-sm font-medium",children:t.label}),e.jsxs("span",{className:"text-foreground-secondary shrink-0 text-sm",children:[t.share,"%"]})]}),e.jsx("span",{className:"text-foreground-secondary text-xs",children:t.description})]});return o?e.jsx("button",{type:"button",className:$(Dt,"focus-visible:ring-ring/50 cursor-pointer outline-none focus-visible:ring-3 focus-visible:ring-inset"),onClick:o,onMouseEnter:s,onMouseLeave:r,onFocus:s,onBlur:r,children:n}):e.jsx("div",{className:Dt,onMouseEnter:s,onMouseLeave:r,children:n})};Zs.displayName="SelfServeLegendRow";const oa=80,$e=({heading:t,segmentColors:s,share:r,items:o,activeKey:n,onOpenChange:l,onSegmentEnter:d,onSegmentLeave:u,onSegmentSelect:i})=>e.jsxs(So,{onOpenChange:l,children:[e.jsxs(_o,{"data-slot":"self-serve-legend-trigger",onClickCapture:a=>{a.detail!==0&&a.stopPropagation()},openOnHover:!0,delay:0,closeDelay:oa,className:"hover:bg-fill-quaternary focus-visible:ring-ring/50 flex items-center justify-between gap-3 rounded-md px-3 py-1.5 text-left transition-colors outline-none focus-visible:ring-3",children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{"aria-hidden":"true",className:"flex shrink-0 items-center",children:s.map((a,c)=>e.jsx("span",{style:{"--legend-color":a},className:$("ring-surface-elevated size-2.5 rounded-full bg-[var(--legend-color)] ring-1",c>0&&"-ml-0.5")},a))}),e.jsx("span",{className:"text-foreground truncate text-sm font-medium",children:t})]}),e.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[e.jsxs("span",{className:"text-foreground text-sm font-bold",children:[r,"%"]}),e.jsx(to,{size:14,className:"text-foreground-secondary"})]})]}),e.jsx(Lo,{"data-slot":"self-serve-legend-popup",align:"start",sideOffset:0,"aria-label":`${t} breakdown`,className:"w-(--anchor-width) min-w-56 gap-0 overflow-hidden p-0",children:e.jsx("ul",{className:"flex flex-col",children:o.map(a=>e.jsx("li",{className:$("transition-colors",n===a.key&&"bg-fill-quaternary"),children:e.jsx(Zs,{item:a,onEnter:()=>d(a.key),onLeave:u,onSelect:i?()=>i(a.key):void 0})},a.key))})})]});$e.displayName="SelfServeRateLegendGroup";const na=(t,s)=>t.find(r=>r?.item?.props?.dataKey===s)?.props?.data??[],aa=(t,s)=>{if(s.kind==="group"){const o=t.map(n=>n.y).filter(n=>n!=null);return o.length>0?Math.min(...o):null}const[r]=t;
1return r?.y!=null&&r.height!=null?r.y+r.height/2:null},Qs=({chartData:t,target:s,formattedGraphicalItems:r=[]})=>{const n=(s.kind==="group"?$s(s.group).map(i=>i.key):[s.key]).map(i=>na(r,i)),l=i=>s.kind==="group"?ta(i,s.group):Ys(i,s.key),d=Is(t.filter(i=>i.eligible!==0&&l(i)!==0).map(i=>`${l(i)}%`)),u=Ps(zs(n[0]??[]),d);return u==null?null:e.jsx("g",{pointerEvents:"none",children:t.map((i,a)=>{const c=n.map(h=>h[a]).filter(h=>h!=null),m=c.find(h=>h.x!=null&&!!h.width),f=l(i),p=aa(c,s);return i.eligible===0||f===0||p==null||m?.x==null||!m.width?null:e.jsx(dt,{cx:m.x+m.width/2,cy:p,width:u,height:Ve,label:`${f}%`},i.period.getTime())})})};Qs.displayName="SelfServeRateOverlay";const Xs=({active:t,payload:s,segmentKey:r,segmentLabel:o,segmentColor:n,isDrillable:l})=>{if(!t||!r||!s?.length)return null;const d=s[0].payload,u=ra(d.counts[r]);return e.jsxs("div",{className:"bg-surface-elevated-secondary text-foreground ring-line shadow-floating flex flex-col gap-1 rounded-lg px-3 py-2 ring-1",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("span",{"aria-hidden":"true",style:{"--segment-color":n},className:"size-2.5 shrink-0 rounded-full bg-[var(--segment-color)]"}),e.jsx("span",{className:"font-semibold",children:o}),e.jsxs("span",{className:"font-bold",children:[Ys(d,r),"%"]}),e.jsxs("span",{className:"text-foreground-secondary whitespace-nowrap",children:[u," conversation",u==="1"||u==="<1"?"":"s"]})]}),l?e.jsx("span",{className:"text-foreground-secondary text-xs",children:"Click to view its conversations"}):null]})};Xs.displayName="SelfServeRateTooltip";const Js="The self-serve rate only covers conversations, and this range has none.",ye=250,At=.16,la={troubleshooting:8,guiding:6,lookup:4,other:3},ia=[.38,.55,.74,.95],er=({data:t,aggregationPeriod:s,isLoading:r=!1,isError:o=!1,insufficientConversationalTraffic:n=!1,onSegmentClick:l})=>{const d=We(),[u,i]=g.useState(null),{hoveredBar:a,onBarEnter:c,onBarLeave:m}=As(),f=g.useMemo(()=>qs(t?.time_series??[]),[t]),p=t?.totals,h=p?.eligible??0,v=!r&&!o&&!n&&h>0&&f.length>0,j=p!==void 0?Math.round(p.self_serve_success_rate*100):null,_=Nt(mt,p),w=Nt(ht,p),b=Object.fromEntries([...ze.map(y=>[y,d.colors.success[la[y]]]),...w.map((y,N)=>[y.key,`color-mix(in oklab, var(--color-foreground) ${(ia[N]??1)*100}%, transparent)`])]),C=y=>u?u.kind==="group"?Ks(y)===u.group?1:At:u.key===y?1:At:1,T=u?.kind==="segment"?u.key:null,S=(y,N)=>y.map((P,I)=>({key:P.key,label:P.label,description:P.description,color:b[P.key],share:N[I]??0})),E=y=>y.map(N=>b[N.key]),D=(y,N)=>sa(y.map(P=>p?.[P.bucketKey]??0),h,N),U=j??0,ge=D(_,U),Fe=D(w,100-U),fe=(y,N)=>y.relatedTarget instanceof Element&&y.relatedTarget.closest(N)!==null,Re=(y,N,P)=>{fe(P,Wn)||i(I=>I?.kind==="segment"&&I.source==="chart"?null:I)},xe=y=>{fe(y,Zn)||m()},ae=y=>N=>{if(N){i({kind:"group",group:y});return}i(P=>P!==null&&Jn(P,y)?null:P)};return e.jsxs("div",{children:[e.jsx(Y,{title:"Self-serve rate",description:"Estimated share of conversations users resolved on their own",hint:l&&v?"Click a segment to view its conversations":void 0,action:r?e.jsx(K,{className:"h-[34px] w-18"}):v&&j!==null?e.jsx(Nr,{label:"Self-serve rate for the selected time period",position:"top",withArrow:!0,multiline:!0,w:220,events:{hover:!0,focus:!0,touch:!0},children:e.jsxs(Gt,{fz:"3xl",fw:700,c:"success.4",lh:1,children:[j,"%"]})}):null}),e.jsx(F,{h:"lg"}),r?e.jsxs(e.Fragment,{children:[e.jsx(K,{className:"h-(--skeleton-height) w-full",style:{"--skeleton-height":`${ye}px`}}),e.jsx(F,{h:"lg"}),e.jsxs(yt,{cols:{base:1,xs:2},spacing:0,children:[e.jsx(K,{className:"h-8 w-full"}),e.jsx(K,{className:"h-8 w-full"})]})]}):o?e.jsx(Se,{h:ye,children:e.jsxs(O,{align:"center",gap:6,children:[e.jsx(tt,{size:28,stroke:1.5,color:"var(--color-foreground-tertiary)"}),e.jsx(x,{fz:"sm",fw:500,c:"var(--color-foreground)",children:"Couldn't load self-serve data"}),e.jsx(x,{fz:"xs",c:"var(--color-foreground-secondary)",ta:"center",maw:320,children:"Refresh the page to try again."})]})}):v?e.jsxs(e.Fragment,{children:[e.jsx(de,{width:"100%",height:ye,debounce:200,children:e.jsxs(Ae,{data:f,margin:{top:20,right:30,left:0,bottom:0},barCategoryGap:0,onMouseLeave:()=>{i(null),m()},children:[e.jsx(ue,{dataKey:"period",tickFormatter:y=>re(y,s),tick:{fontSize:d.fontSizes.xs,fill:"var(--color-foreground-secondary)"}
1,tickMargin:10,tickLine:!1,axisLine:!1}),e.jsx(me,{domain:[0,100],allowDataOverflow:!0,width:44,tickFormatter:y=>`${y}%`,tickLine:!1,axisLine:!1,tick:{fontSize:d.fontSizes.sm,fill:"var(--color-foreground-secondary)"}}),e.jsx(Me,{stroke:"var(--color-line)",vertical:!1,horizontal:!0}),[..._,...w].map(y=>e.jsx(ie,{dataKey:y.key,stackId:"a",fill:b[y.key],fillOpacity:C(y.key),background:!1,isAnimationActive:ct(),onMouseEnter:()=>i({kind:"segment",key:y.key,source:"chart"}),onMouseLeave:Re,shape:e.jsx(Bs,{glowPeriod:a?.key===y.key?a.period:null,glowColor:b[y.key],onPaintedEnter:N=>c(y.key,N),onPaintedLeave:xe,onPaintedClick:l?N=>l(y.key,N):void 0})},y.key)),u!==null?e.jsx(os,{component:e.jsx(Qs,{chartData:f,target:u})}):null,e.jsx(he,{wrapperStyle:{outline:"none",zIndex:1e3,pointerEvents:"none"},cursor:{fill:"transparent"},content:e.jsx(Xs,{segmentKey:T,segmentLabel:T?Vs[T].label:void 0,segmentColor:T?b[T]:void 0,isDrillable:!!l&&a!==null})})]})}),e.jsx(F,{h:"lg"}),e.jsxs(yt,{cols:{base:1,xs:2},spacing:0,children:[e.jsx($e,{heading:"Self-served",segmentColors:E(_),share:U,items:S(_,ge),activeKey:T,onOpenChange:ae("self"),onSegmentEnter:y=>i({kind:"segment",key:y,source:"legend"}),onSegmentLeave:()=>i({kind:"group",group:"self"}),onSegmentSelect:l?y=>l(y):void 0}),e.jsx($e,{heading:"Not self-served",segmentColors:E(w),share:100-U,items:S(w,Fe),activeKey:T,onOpenChange:ae("notSelf"),onSegmentEnter:y=>i({kind:"segment",key:y,source:"legend"}),onSegmentLeave:()=>i({kind:"group",group:"notSelf"}),onSegmentSelect:l?y=>l(y):void 0})]})]}):e.jsx(Se,{h:ye,children:e.jsxs(O,{align:"center",gap:6,children:[n?e.jsx(so,{size:28,stroke:1.5,color:"var(--color-foreground-tertiary)"}):e.jsx(ro,{size:28,stroke:1.5,color:"var(--color-foreground-tertiary)"}),e.jsx(x,{fz:"sm",fw:500,c:"var(--color-foreground)",children:n?"No conversations to measure":"No self-serve data for this range"}),e.jsx(x,{fz:"xs",c:"var(--color-foreground-secondary)",ta:"center",maw:320,children:n?Js:"Once conversations in the selected range are labeled, the self-serve breakdown appears here."})]})})]})};er.displayName="SelfServeRateChart";const Mt=(t,s)=>t.map(r=>({period:new Date(r.period),value:s(r)})),tr=({active:t,payload:s,aggregationPeriod:r,valueFormatter:o})=>{if(!t||!s?.length)return null;const n=s[0].payload;return n.value===null?null:e.jsxs("div",{className:"bg-surface-elevated-secondary text-foreground ring-line shadow-floating flex flex-col gap-0.5 rounded-lg px-3 py-2 text-sm r
1ing-1",children:[e.jsx("span",{className:"text-foreground-secondary text-xs",children:re(n.period,r)}),e.jsx("span",{className:"font-medium",children:o(n.value)})]})};tr.displayName="SparklineTooltip";const ee="var(--color-foreground)",ca=t=>t.toLocaleString(),V=({label:t,value:s,tooltip:r,data:o,aggregationPeriod:n,valueFormatter:l=ca,isLoading:d=!1,className:u})=>{const i=`sparkline-fill-${g.useId()}`,a=g.useMemo(()=>{const h=new Set;return o.forEach((v,j)=>{const _=(o[j-1]?.value??null)!==null||(o[j+1]?.value??null)!==null;v.value!==null&&!_&&h.add(j)}),h},[o]),c=o.some(h=>h.value!==null&&h.value!==0),m=!d&&c&&o.length>1,[f,p]=g.useState(0);return g.useEffect(()=>{if(!m)return;const h=()=>p(v=>v+1);return window.addEventListener("blur",h),document.addEventListener("visibilitychange",h),()=>{window.removeEventListener("blur",h),document.removeEventListener("visibilitychange",h)}},[m]),e.jsxs("div",{"data-slot":"sparkline-stat-card",className:$("bg-surface-elevated border-line shadow-floating flex h-full flex-col gap-2 rounded-lg border p-4",u),children:[e.jsxs("div",{"data-slot":"sparkline-stat-card-header",className:"flex flex-col gap-1",children:[d?e.jsx("div",{className:"bg-surface-secondary h-6 w-20 animate-pulse rounded motion-reduce:animate-none"}):e.jsx("div",{className:"text-foreground text-2xl leading-tight font-medium tabular-nums",children:s}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-foreground-secondary text-xs",children:t}),r?e.jsxs(ke,{children:[e.jsx(Ee,{render:e.jsx(R,{variant:"ghost",size:"icon-sm",className:"text-foreground-secondary -my-1 rounded-full","aria-label":`About ${t}`,children:e.jsx(Ne,{className:"size-3.5",stroke:1.5})})}),e.jsx(Te,{children:r})]}):null]})]}),e.jsx("div",{"data-slot":"sparkline-stat-card-chart",onMouseDown:h=>h.preventDefault(),className:"focus-within:ring-ring/50 h-8 w-full rounded-sm focus-within:ring-3 [&_.recharts-surface]:outline-none",children:d?e.jsx("div",{className:"bg-surface-secondary h-full w-full animate-pulse rounded motion-reduce:animate-none"}):m?e.jsx(de,{width:"100%",height:"100%",debounce:200,children:e.jsxs(ho,{data:o,margin:{top:5,right:5,bottom:0,left:5},accessibilityLayer:!0,"aria-label":`${t} per period, ${o.length} points`,children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:i,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:ee,stopOpacity:.4}),e.jsx("stop",{offset:"100%",stopColor:ee,stopOpacity:.02})]})}),e.jsx(ue,{dataKey:"period",hide:!0}),e.jsx(me,{hide:!0,domain:[0,"dataMax"]}),e.jsx(he,{cursor:{stroke:"var(--color-foreground-secondary)",strokeDasharray:"3 3"},wrapperStyle:{outline:"none",zIndex:1e3},content:e.jsx(tr,{aggregationPeriod:n,valueFormatter:l})}),e.jsx(po,{type:"monotone",dataKey:"value",stroke:ee,strokeWidth:1.5,fill:`url(#${i})`,dot:a.size===0?!1:h=>a.has(h.index)?e.jsx("circle",{cx:h.cx,cy:h.cy,r:2,fill:ee},h.index):e.jsx("g",{},h.index),activeDot:{r:3,fill:ee,stroke:ee},isAnimationActive:!1})]})},f):e.jsx("div",{className:"h-full w-full"})})]})};V.displayName="SparklineStatCard";const pt=60,sr=t=>Math.round(t*pt),le=t=>{const s=sr(t);return s<pt?`${s} min`:`${t.toLocaleString(void 0,{minimumFractionDigits:1,maximumFractionDigits:1})} hrs`},da=t=>t?.totals.estimate_basis==="per_question",ua=t=>{const s=sr(t);return s<pt?`${s} min`:`${Math.round(t).toLocaleString()} hrs`},ma=.9,ha=t=>t!==null&&t<ma?`Based on the ${Math.floor(t*100)}% of traffic that's tracked`:null,Pt=(t,s,r)=>r<=0?null:t===0?0:t==null||s==null?null:t*s/r,pa=(t,s)=>{const r=t?.totals.time_saved_hours??null,o=t?.totals.tracked_question_share??null,n=s?.total_unique_users??0,l=Pt(t?.totals.time_saved_hours,o,n),d=new Map((s?.time_series??[]).map(a=>[new Date(a.period).getTime(),a.total_unique_user_count])),u=[],i=[];for(const a of t?.time_series??[]){const c=new Date(a.period),m=a.time_saved_hours??null;u.push({period:c,value:m});const f=d.get(c.getTime())??0;i.push({period:c,value:Pt(a.time_saved_hours,a.tracked_question_share,f)})}return{totalHours:r,hoursPerPerson:l,totalData:u,perPersonData:i,trackedShare:o}},Ie=({activityData:t,countingData:s,selfServeData:r,timeSavedData:o,isLoadingActivity:n,isLoadingCounting:l,isLoadingSelfServe:d,isLoadingTimeSaved:u,isErrorSelfServe:i,isErrorTimeSaved:a})=>{const{aggregationPeriod:c,groupBy:m,preset:f,scopedProjects:p,teamIntegrations:h,onBarDrillDown:v,onSelfServeSegmentDrillDown:j}=H(),_=g.useMemo(()=>{const L=new Map;return h.forEach((kr,Er)=>L.set(kr.id,Er+1)),L},[h]),w=g.useMemo(()=>m==="project"?L=>se(Qt(L,p)):L=>se(_.get(L)??1),[m,p,_]),b=g.useMemo(()=>new Set(m==="project"?p.map(L=>L.id):h.map(L=>L.id)),[m,p,h]),C=g.useMemo(()=>Ke(t?.time_series??[],L=>L.total_count,w,b),[t,w,b]),T=g.useMemo(()=>Ke(s?.time_series??[],L=>L.total_unique_user_count,w,b),[s,w,b]),S=t?.aggregate_statistics.total_questions??0,E=s?.total_unique_users??0,D=r?.totals,U=da(a?void 0:o),ge=!i&&!U&&D&&D.eligible>0?Math.round(D.self_serve_success_rate*100):null,Fe=g.useMemo(()=>Mt(t?.time_series??[],L=>L.total_count),[t]),fe=g.useMemo(()=>Mt(s?.time_series??[],L=>L.total_unique_user_count),[s]),Re=g.useMemo(()=>!i&&!U&&r?qs(r.time_series).map(L=>({period:L.period,value:Ws(L,"self")})):[],[i,U,r]),{totalHours:xe,hoursPerPerson:ae,totalData:y,perPersonData:N,trackedShare:P}=g.useMemo(()=>pa(a?void 0:o,s),[a,o,s]),I=f==="internal"?"employee":"user",xt="Estimates each self-served question at 10 minutes",br=P===0&&E===0,vt=ha(P),wr=br?`This range has traffic, but none of it is attributed to any ${I}, so per-${I} savings can't be measured. Enable user tracking to see them.`:`Time saved per tracked ${I}: hours from tracked traffic divided by the tracked ${I}s active in the range. ${xt}${vt?`. ${vt}`:""}`,Sr=`Time kapa saved your ${I}s over the range. ${xt}`,_r=U?Js:"Estimated share of conversations users resolved on their own",Lr=m==="project"?"Question volume trends across selected projects":"Question volume trends across selected integrations",jt=m==="project"?"Users per project":"Users per integration",Cr=`Each user is counted once per period. Someone active in several ${m==="project"?"projects":"integrations"} appears in every stack, so the stacks can add up to more than the displayed total.`;return e.jsxs(e.Fragment,{children:[e.jsxs(ut,{children:[e.jsx(V,{label:"Total questions",value:S.toLocaleStr
1ing(),tooltip:"All questions asked across the selected projects and integrations",data:Fe,aggregationPeriod:c,isLoading:n}),e.jsx(V,{label:"Unique users",value:E.toLocaleString(),tooltip:"Distinct end users active in the selected range. The trend shows each period's own unique count, which cannot sum to the range total",data:fe,aggregationPeriod:c,isLoading:l}),e.jsx(V,{label:"Self-serve rate",value:ge!==null?`${ge}%`:"N/A",tooltip:_r,data:Re,aggregationPeriod:c,valueFormatter:L=>`${Math.round(L)}%`,isLoading:d||u}),e.jsx(V,{label:`Time saved per ${I}`,value:ae!==null?le(ae):"N/A",tooltip:wr,data:N,aggregationPeriod:c,valueFormatter:L=>`${le(L)} per ${I}`,isLoading:u||l}),e.jsx(V,{label:"Total time saved",value:xe!==null?ua(xe):"N/A",tooltip:Sr,data:y,aggregationPeriod:c,valueFormatter:L=>`${le(L)} saved`,isLoading:u})]}),e.jsx(z,{shadow:"md",radius:"md",p:"xl",withBorder:!0,children:e.jsx(Le,{title:"Total Questions Answered",subtitle:Lr,data:C.data,series:C.series,aggregationPeriod:c,height:350,maxBarSize:120,isLoading:n,onBarClick:v})}),e.jsxs(B,{gutter:"md",children:[e.jsx(B.Col,{span:{base:12,lg:6},children:e.jsx(z,{shadow:"md",radius:"md",p:"xl",withBorder:!0,h:"100%",children:!l&&(s?.total_unique_users??0)===0?e.jsxs(e.Fragment,{children:[e.jsx(x,{fw:600,fz:"md",mb:4,children:"Active Users"}),e.jsx(x,{fz:"sm",c:"dimmed",mb:"md",children:jt}),e.jsxs(Ce,{justify:"center",align:"center",h:"100%",direction:"column",py:"xl",children:[e.jsx(x,{fz:"md",c:"var(--color-foreground)",children:"No active users in this range. Anonymous user tracking may not be enabled."}),e.jsx(F,{h:"md"}),e.jsx(R,{variant:"ghost",render:e.jsx("a",{href:J.integrations.widgetUserTracking,target:"_blank",rel:"noreferrer"}),children:"Learn More"})]})]}):e.jsx(Le,{title:"Active Users",subtitle:jt,data:T.data,series:T.series,aggregationPeriod:c,height:300,fillHeight:!0,maxBarSize:40,isLoading:l,hideYAxisValues:!0,info:Cr})})}),e.jsx(B.Col,{span:{base:12,lg:6},children:e.jsx(z,{shadow:"md",radius:"md",p:"xl",withBorder:!0,h:"100%",children:e.jsx(er,{data:r,aggregationPeriod:c,isLoading:d||u,isError:i,insufficientConversationalTraffic:U,onSegmentClick:j})})})]})]})};Ie.displayName="OverviewChartsBase";var Q=(t=>(t[t.VERY_UNHELPFUL=1]="VERY_UNHELPFUL",t[t.UNHELPFUL=2]="UNHELPFUL",t[t.NEUTRAL=3]="NEUTRAL",t[t.HELPFUL=4]="HELPFUL",t[t.VERY_HELPFUL=5]="VERY_HELPFUL",t))(Q||{});const ga=10,zt={[Q.VERY_UNHELPFUL]:{emoji:"😠",label:"Very Unhelpful"},[Q.UNHELPFUL]:{emoji:"🙁",label:"Unhelpful"},[Q.NEUTRAL]:{emoji:"😐",label:"Neutral"},[Q.HELPFUL]:{emoji:"🙂",label:"Helpful"},[Q.VERY_HELPFUL]:{emoji:"😃",label:"Very Helpful"}},fa=({feedbackByRating:t,isLoading:s=!1})=>{const r=t.reduce((n,l)=>n+l.count,0),o=be(t?.filter(n=>n.rating>=Q.HELPFUL).reduce((n,l)=>n+l.count,0)??0,r);return e.jsx(z,{shadow:"md",radius:"md",p:"xl",withBorder:!0,h:"100%",children:e.jsxs(A,{h:"100%",children:[e.jsx(Y,{title:"User Satisfaction",description:e.jsxs(e.Fragment,{children:["Satisfaction ratings from 4% of anonymous widget users."," ",e.jsx(Vt,{href:J.integrations.widgetSatisfaction,target:"_blank",rel:"noopener noreferrer",c:"chart.2",inherit:!0,children:"Learn more"})]})}),e.jsx(F,{h:"xl"}),s?e.jsx(K,{className:"h-50 w-full"}):r>=ga?e.jsxs(k,{align:"stretch",gap:"xl",children:[e.jsxs(O,{w:{base:"100%",md:"190px",lg:"100%",xl:"190px"},children:[e.jsxs(z,{shadow:"md",radius:"md",p:"md",withBorder:!0,bg:"var(--color-surface-secondary)",children:[e.jsxs(Ce,{gap:"xs",align:"center",justify:"space-between",children:[e.jsxs(x,{c:"var(--color-foreground)",fz:"3xl",children:[o,"%"]}),e.jsx(Kt,{color:"success.4",size:"sm",variant:"light",radius:"md",children:e.jsx(oo,{size:"1rem"})})]}),e.jsx(x,{c:"var(--color-foreground-secondary)",fz:"sm",maw:"200px",children:"of users rated the experience as Helpful or Very Helpful"})]}),e.jsxs(z,{shadow:"md",radius:"md",p:"md",withBorder:!0,bg:"var(--color-surface-secondary)",children:[e.jsx(x,{c:"var(--color-foreground)",fz:"3xl",children:r}),e.jsx(x,{c:"var(--color-foreground-secondary)",fz:"sm",children:"Total Ratings"})]})]}),e.jsx(O,{flex:1,align:"stretch",justify:"center",gap:"lg",children:[...t].sort((n,l)=>l.rating-n.rating).map((n,l)=>e.jsxs(k,{wrap:"nowrap",children:[e.jsxs(k,{w:"140px",children:[e.jsx(x,{fz:"lg",children:zt[n.rating].emoji}),e.jsx(x,{c:"var(--color-foreground-secondary)",fz:"sm",children:zt[n.rating].label})]}),e.jsxs(k,{flex:1,wrap:"nowrap",children:[e.jsx($t,{value:be(n.count,r),size:"md",color:"chart.6",radius:"sm",miw:"50px",w:"100%",sx:d=>({"& .mantine-Progress-bar":{backgroundColor:d.colors.chart[6]}})}),e.jsxs(x,{c:"var(--color-foreground-secondary)",fz:"sm",children:[be(n.count,r),"%"]})]})]},l))})]}):e.jsx(k,{justify:"center",align:"center",mih:160,children:e.jsx(x,{c:"var(--color-foreground-secondary)",fz:"sm",children:"We haven't collected enough data for this time period."})})]})})},It=6,Ft=240,Rt=["chart.8","violet.8","indigo.8","teal.8","yellow.8","orange.8","red.8"],xa=({totalQuestionsByLanguage:t,subtitle:s="User language preferences across questions",isLoading:r=!1})=>{const o=[...t].sort((a,c)=>c.count-a.count),n=o.slice(0,It),d=o.slice(It).reduce((a,c)=>a+c.count,0),u=t.reduce((a,c)=>a+c.count,0),i=n.map((a,c)=>({name:a.name,value:Math.round(a.count/u*100),color:Rt[c%Rt.length]}));return d>0&&i.push({name:"Other",value:Math.round(d/u*100),color:"var(--color-foreground-secondary)"}),e.jsx(z,{shadow:"md",radius:"md",p:"xl",withBorder:!0,h:"100%",children:e.jsxs(A,{children:[e.jsx(Y,{title:"Language Distribution",description:s}),e.jsx(F,{h:"xl"}),r?e.jsx(K,{className:"h-(--skeleton-height) w-full",style:{"--skeleton-height":`${Ft}px`}}):t.length>0?e.jsxs(k,{align:"stretch",gap:"xl",justify:"space-around",children:[e.jsx(O,{w:{base:"100%",md:"250px",lg:"100%",xl:"250px"},align:"center",justify:"center",children:e.jsx(go,{data:i,tooltipDataSource:"segment",withLabelsLine:!0,size:Ft,thickness:40,startAngle:90,endAngle:-270,h:"100%",w:"100%",valueFormatter:a=>`${a}%`})}),e.jsx(O,{flex:1,align:"stretch",justify:"center",gap:"lg",maw:300,children:e.jsx(O,{flex:1,gap:"sm",justify:"center",children:i.map((a,c)=>e.jsxs(k,{justify:"space-between",wrap:"nowrap",children:[e.jsxs(k,{gap:"xs",wrap:"nowrap",children:[e.jsx(Kt,{color:a.color,variant:"transparent",size:"sm",children:e.jsx(no,{size:"1rem"})}),e.jsx(x,{c:"var(--color-foreground)",fz:"sm",miw:"80px",children:a.name})]}),e.jsxs(x,{c:"var(--color-foreground-secondary)",fz:"md",ta:"right",children:[a.value.toLocaleStr
1ing(),"%"]})]},c))})})]}):e.jsx(k,{justify:"center",align:"center",mih:160,children:e.jsx(x,{c:"var(--color-foreground-secondary)",fz:"sm",children:"No language data available for this time period."})})]})})},gt=({activityData:t,isLoading:s})=>{const r=t?.aggregate_statistics.user_satisfaction_feedback_by_rating??[],o=t?.aggregate_statistics.total_questions_by_language??[];return e.jsxs(B,{gutter:"md",children:[e.jsx(B.Col,{span:{base:12,lg:6},children:e.jsx(fa,{feedbackByRating:r,isLoading:s})}),e.jsx(B.Col,{span:{base:12,lg:6},children:e.jsx(xa,{totalQuestionsByLanguage:o,isLoading:s})})]})};gt.displayName="SatisfactionAndLanguageSection";const rr=()=>{const{scopedProjects:t}=H(),s=t.length===0,r=nt(!s),o=Pe(!s),n=at(!s),l=lt(!s);return s?e.jsx(pe,{illustrationClassName:"bg-preset-external",icon:e.jsx(es,{size:84,stroke:1.5,className:"text-white"}),title:"Help your users",description:"Deploy Kapa on your documentation, website, or in-app experience to give users instant answers.",children:e.jsxs(R,{render:e.jsx("a",{href:J.integrations.base,target:"_blank",rel:"noreferrer"}),children:["Get started",e.jsx(De,{size:14,"data-icon":"inline-end"})]})}):r.isError||o.isError?e.jsx(ne,{}):e.jsxs(O,{gap:"lg",children:[e.jsx(Ie,{activityData:r.data,countingData:o.data,selfServeData:n.data,timeSavedData:l.data,isLoadingActivity:r.isLoading,isLoadingCounting:o.isLoading,isLoadingSelfServe:n.isLoading,isLoadingTimeSaved:l.isLoading,isErrorSelfServe:n.isError,isErrorTimeSaved:l.isError}),e.jsx(gt,{activityData:r.data,isLoading:r.isLoading})]})};rr.displayName="ExternalDashboard";const va=({pageSize:t,enabled:s})=>{const r=q(),o=r.user?.user.team.id??"",{startDateTime:n,endDateTime:l,projectFilter:d,integrationFilter:u}=H(),i=ce(d),a=ce(u),c=!!n&&!!l,[m,f]=g.useState(null),[p,h]=g.useState(""),v=JSON.stringify([n,l,i??[],a??[]]);v!==p&&(h(v),f(null));const j=async()=>{const E=new URLSearchParams({start_date_time:_e(n,"start"),end_date_time:_e(l,"end"),timezone:W(),page_size:String(t)});m&&E.set("cursor",m),i&&E.set("project_filter",i.join(",")),a&&E.set("integration_filter",a.join(","));const D=await r.authFetch(`/query/internal/teams/${o}/analytics/top-users/?${E.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"}});if(!D.ok)throw new Error(D.statusText);return D.json()},{data:_,isLoading:w,isError:b}=Qe({queryKey:["analytics-team-top-users",o,n,l,i,a,m,t],queryFn:j,enabled:!!o&&c&&s,placeholderData:Dr,meta:{errorMessage:"Failed to fetch top users. Please refresh the page and try again."}}),C=g.useMemo(()=>(_?.results??[]).map(E=>({rank:E.rank,label:E.label,email:E.email,questions:E.question_count,timeSavedHours:E.time_saved_hours,lastActiveAt:E.last_active_at})),[_]),T=_?.next_cursor??null,S=_?.previous_cursor??null;return{data:C,nextCursor:T,previousCursor:S,isLoading:et(w),isError:b,onNext:()=>f(T),onPrevious:()=>f(S)}},ja=t=>[{header:"#",accessorKey:"rank",size:48,mantineTableHeadCellProps:{align:"center"},mantineTableBodyCellProps:{align:"center"},Cell:({cell:s})=>e.jsx(x,{size:"sm",c:"dimmed",children:s.getValue()})},{header:"User",accessorKey:"label",size:240,Cell:({row:s})=>e.jsxs(k,{gap:"sm",wrap:"nowrap",children:[e.jsx(Je,{size:"sm",colorSeed:s.original.email??s.original.label,children:e.jsx(Ar,{children:ko(s.original.label)})}),e.jsx(x,{size:"sm",truncate:!0,miw:0,children:s.original.label})]})},{header:"Questions",accessorKey:"questions",size:120,mantineTableHeadCellProps:{align:"right"},mantineTableBodyCellProps:{align:"right"},Cell:({cell:s})=>e.jsx(x,{size:"sm",children:s.getValue().toLocaleString()})},{header:"Time saved",accessorKey:"timeSavedHours",size:120,mantineTableHeadCellProps:{align:"right"},mantineTableBodyCellProps:{align:"right"},Header:e.jsxs(k,{gap:4,align:"center",wrap:"nowrap",children:[e.jsx("span",{children:"Time saved"}),e.jsxs(ke,{children:[e.jsx(Ee,{render:e.jsx(R,{variant:"ghost",size:"icon-sm",className:"text-foreground-secondary rounded-full","aria-label":"How time saved is calculated",children:e.jsx(Ne,{className:"size-4",stroke:1.5})})}),e.jsx(Te,{className:"leading-tight",children:"Time this user saved. Estimates each answered question at 10 minutes, excluding uncertain or downvoted answers."})]})]}),Cell:({cell:s})=>e.jsx(x,{size:"sm",c:"success.4",children:le(s.getValue())})},{header:"Last active",accessorKey:"lastActiveAt",size:140,mantineTableHeadCellProps:{align:"right"},mantineTableBodyCellProps:{align:"right"},Cell:({cell:s})=>e.jsx(x,{size:"sm",c:"dimmed",children:qr(new Date(s.getValue()),t,{addSuffix:!0})})}],or=({data:t,isLoading:s=!1,isError:r=!1,nextCursor:o,previousCursor:n,onNext:l,onPrevious:d,now:u})=>{const[i]=g.useState(()=>Date.now()),a=u??i,c=g.useMemo(()=>ja(a),[a]);return e.jsxs(z,{shadow:"md",radius:"md",p:"xl",withBorder:!0,children:[e.jsxs(k,{gap:4,mb:"md",children:[e.jsx(x,{fz:"lg",fw:500,children:"Top users"}),e.jsxs(ke,{children:[e.jsx(Ee,{render:e.jsx(R,{variant:"ghost",size:"icon-sm",className:"text-foreground-secondary rounded-full","aria-label":"About top users",children:e.jsx(Ne,{stroke:1.5})})}),e.jsx(Te,{children:"Your most active users in the selected period, ranked by questions asked."})]})]}),r?e.jsx(Ut,{variant:"light",color:"red",title:"Couldn't load top users",icon:e.jsx(tt,{size:16}),children:"Something went wrong loading the leaderboard. Refresh the page and try again."}):!s&&t.length===0?e.jsxs(Ce,{direction:"column",align:"center",justify:"center",py:"3rem",children:[e.jsx(x,{fz:"md",c:"var(--color-foreground)",children:"No active users in the selected period"}),e.jsx(x,{fz:"sm",c:"dimmed",mt:4,children:"Adjust the date range or filters to 
1see your most active users."})]}):e.jsxs(e.Fragment,{children:[e.jsx(Eo,{columns:c,data:t,enablePagination:!1,enableSorting:!1,enableColumnActions:!1,enableColumnFilters:!1,enableColumnOrdering:!1,enableDensityToggle:!1,enableFullScreenToggle:!1,enableHiding:!1,enableRowSelection:!1,enableTopToolbar:!1,enableBottomToolbar:!1,mantineLoadingOverlayProps:{visible:!1},mantinePaperProps:{sx:{"--mrt-base-background-color":"var(--color-surface-elevated)"}},mantineTableProps:{highlightOnHover:!1},state:{isLoading:s,showProgressBars:!1}}),e.jsxs(k,{justify:"flex-end",gap:"sm",mt:"md",children:[e.jsxs(R,{variant:"secondary",size:"sm",onClick:d,disabled:!n,children:[e.jsx(ao,{"data-icon":"inline-start"}),"Previous"]}),e.jsxs(R,{variant:"secondary",size:"sm",onClick:l,disabled:!o,children:["Next",e.jsx(lo,{"data-icon":"inline-end"})]})]})]})]})};or.displayName="TopUsersTable";const ya=10,nr=()=>{const{scopedProjects:t}=H(),s=t.length===0,r=nt(!s),o=Pe(!s),n=at(!s),l=lt(!s),d=va({pageSize:ya,enabled:!s});return s?e.jsx(pe,{illustrationClassName:"bg-preset-internal",icon:e.jsx(ts,{size:84,stroke:1.5,className:"text-white"}),title:"Help your team",description:"Make deep product knowledge accessible to everyone on your team. Access it through Slack or the Internal Assistant.",children:e.jsxs(R,{render:e.jsx("a",{href:J.integrations.base,target:"_blank",rel:"noreferrer"}),children:["Get started",e.jsx(De,{size:14,"data-icon":"inline-end"})]})}):r.isError||o.isError?e.jsx(ne,{}):e.jsxs(O,{gap:"lg",children:[e.jsx(Ie,{activityData:r.data,countingData:o.data,selfServeData:n.data,timeSavedData:l.data,isLoadingActivity:r.isLoading,isLoadingCounting:o.isLoading,isLoadingSelfServe:n.isLoading,isLoadingTimeSaved:l.isLoading,isErrorSelfServe:n.isError,isErrorTimeSaved:l.isError}),e.jsx(or,{data:d.data,isLoading:d.isLoading,isError:d.isError,nextCursor:d.nextCursor,previousCursor:d.previousCursor,onNext:d.onNext,onPrevious:d.onPrevious})]})};nr.displayName="InternalDashboard";const ar=({tag:t})=>e.jsx(A,{w:"180px",children:e.jsx(Ue,{color:t.color,variant:"light",fz:"sm",size:"lg",fw:500,maw:"100%",opacity:t.is_deleted?.5:void 0,styles:{root:{cursor:"inherit"},label:{display:"block",maxWidth:"100%",overflow:"hidden"}},children:e.jsx(To,{inherit:!0,label:t.is_deleted?`${t.name} (deleted)`:void 0,children:t.name})})});ar.displayName="CustomTagBadge";const lr=({tag:t,share:s,onClick:r})=>{const[o,n]=g.useState(!1),l=e.jsxs(k,{wrap:"nowrap",w:"100%",children:[e.jsx(ar,{tag:t}),e.jsxs(k,{flex:1,wrap:"nowrap",children:[e.jsx($t,{value:s,size:"md",color:"chart.6",radius:"sm",miw:"50px",w:"100%"}),e.jsxs(x,{c:"var(--color-foreground-secondary)",fz:"sm",children:[s,"%"]})]})]});return r?e.jsx(Gt,{onClick:r,onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),onFocus:()=>n(!0),onBlur:()=>n(!1),"aria-label":`View conversations tagged ${t.name}`,w:"100%",children:e.jsx(z,{bg:o?"var(--color-surface-secondary)":"transparent",radius:"sm",px:"xs",py:4,sx:{boxShadow:"none"},children:l})}):e.jsx(z,{bg:"transparent",radius:"sm",px:"xs",py:4,sx:{boxShadow:"none"},children:l})};lr.displayName="CustomTagRow";const ba=5,wa=({totalThreadsByCustomTag:t,isLoading:s=!1,onTagClick:r})=>{const o=t.reduce((l,d)=>l+d.count,0),n=[...t].sort((l,d)=>d.count-l.count).slice(0,ba);return e.jsx(z,{shadow:"md",radius:"md",p:"xl",withBorder:!0,h:"100%",children:e.jsxs(A,{h:"100%",children:[e.jsx(Y,{title:"Custom Tags",description:"AI-assigned conversation categories",hint:r&&o>0?"Click a tag to view its conversations":void 0}),e.jsx(F,{h:"xl"}),s?e.jsx(K,{className:"h-50 w-full"}):o>0?e.jsx(O,{flex:1,align:"stretch",justify:"center",gap:"lg",mx:"-xs",children:n.map(l=>e.jsx(lr,{tag:l,share:be(l.count,o),onClick:r?()=>r(l.id,l.project_id):void 0},l.id))}):e.jsx(k,{justify:"center",align:"center",mih:160,children:e.jsx(x,{c:"var(--color-foreground-secondary)",fz:"sm",children:"No custom tags have been assigned yet."})})]})})},ir=()=>{const{onCustomTagDrillDown:t}=H(),s=nt(!0),r=Pe(!0),o=at(!0),n=lt(!0);return s.isError||r.isError?e.jsx(ne,{}):e.jsxs(O,{gap:"lg",children:[e.jsx(Ie,{activityData:s.data,countingData:r.data,selfServeData:o.data,timeSavedData:n.data,isLoadingActivity:s.isLoading,isLoadingCounting:r.isLoading,isLoadingSelfServe:o.isLoading,isLoadingTimeSaved:n.isLoading,isErrorSelfServe:o.isError,isErrorTimeSaved:n.isError}),e.jsx(gt,{activityData:s.data,isLoading:s.isLoading}),e.jsx(B,{gutter:"md",children:e.jsx(B.Col,{span:{base:12,lg:6},children:e.jsx(wa,{totalThreadsByCustomTag:r.data?.total_threads_by_custom_tag??[],isLoading:r.isLoading,onTagClick:t})})})]})};ir.displayName="OverviewDashboard";const qe="var(--color-intent-success)",Sa="color-mix(in oklab, var(--color-foreground) 18%, transparent)",cr=(t,s)=>{const r=t+s;return r===0?null:Math.round(t/r*100)},_a=({active:t,payload:s,aggregationPeriod:r})=>{if(!t||!s?.length)return null;const o=s[0].payload,n=o.deflectedCount+o.notDeflectedCount,l=cr(o.deflectedCount,o.notDeflectedCount);
1return e.jsxs(Ze,{padding:"sm",radius:"md",shadow:"md",withBorder:!0,children:[e.jsx(x,{fz:"md",mb:"xxs",children:re(o.period,r)}),e.jsxs(A,{sx:{display:"flex",flexDirection:"column",gap:"var(--mantine-spacing-xxs, 0.5rem)"},children:[e.jsxs(k,{justify:"space-between",gap:"lg",children:[e.jsx(Ue,{variant:"light",sx:{color:qe,backgroundColor:`color-mix(in oklch, ${qe} 20%, transparent)`},children:"Deflected"}),e.jsx(x,{fw:700,fz:"sm",children:o.deflectedCount})]}),e.jsxs(k,{justify:"space-between",gap:"lg",children:[e.jsx(Ue,{color:"gray",variant:"light",children:"Not deflected"}),e.jsx(x,{fw:700,fz:"sm",children:o.notDeflectedCount})]}),e.jsxs(k,{justify:"space-between",gap:"lg",children:[e.jsx(x,{c:"dimmed",fz:"sm",children:"Total"}),e.jsx(x,{fw:700,fz:"sm",children:n})]}),e.jsxs(k,{justify:"space-between",gap:"lg",children:[e.jsx(x,{c:"dimmed",fz:"sm",children:"Deflection rate"}),e.jsx(x,{fw:700,fz:"sm",children:l===null?"—":`${l}%`})]})]})]})},dr=({title:t,subtitle:s,data:r,aggregationPeriod:o,height:n,maxBarSize:l,isLoading:d=!1})=>e.jsxs("div",{children:[t?e.jsx(Y,{title:t,description:s??""}):null,t||s?e.jsx(F,{h:"md"}):null,d?e.jsx(K,{className:"h-(--skeleton-height) w-full",style:{"--skeleton-height":`${n}px`}}):e.jsx(de,{width:"100%",height:n,debounce:200,children:e.jsxs(Ae,{data:r,margin:{top:30,right:30,left:0,bottom:0},children:[e.jsx(ue,{axisLine:!1,tickLine:!1,dataKey:"period",tickFormatter:i=>re(i,o),tick:{fontSize:12,fill:"var(--color-foreground-secondary)"}}),e.jsx(me,{axisLine:!1,tickLine:!1,tick:{fontSize:14,fill:"var(--color-foreground-secondary)"}}),e.jsx(Me,{stroke:"var(--color-line)",vertical:!1,horizontal:!0}),e.jsx(ie,{dataKey:"deflectedCount",stackId:"a",fill:qe,background:!1,maxBarSize:l,isAnimationActive:!1}),e.jsx(ie,{dataKey:"notDeflectedCount",stackId:"a",fill:Sa,background:!1,maxBarSize:l,isAnimationActive:!1,children:e.jsx(rs,{position:"top",content:({width:i,x:a,y:c,index:m})=>{if(typeof m!="number"||!i||Number(i)<40)return null;const f=r[m],p=cr(f.deflectedCount,f.notDeflectedCount),h=p===null?"—":`${p}%`;return e.jsxs("g",{children:[e.jsx("rect",{x:Number(a)+Number(i)/2-22,y:Number(c)-30,width:44,height:24,fill:"var(--color-surface-elevated)",stroke:"var(--color-line-strong)",strokeWidth:1,rx:8,ry:8}),e.jsx("text",{x:Number(a)+Number(i)/2,y:Number(c)-16,dy:0,fill:"var(--color-foreground)",textAnchor:"middle",dominantBaseline:"middle",fontSize:14,children:h})]})}})}),e.jsx(he,{wrapperStyle:{outline:"none",zIndex:1e3},cursor:{fill:"transparent"},content:e.jsx(_a,{aggregationPeriod:o})})]})})]});dr.displayName="DeflectionRateTimeseriesChart";const La=1920,Ca=365,ka=(t,s)=>Yr(s,t)+1,Ea=(t,s,r)=>{if(!s||!r)return null;const o=ka(s,r);return o<=0?null:t/o*Ca/La},Ta=t=>{if(!Number.isFinite(t)||t<=0)return"0 employees";if(t<.05)return"<0.1 employees";const s=t.toFixed(1);return s==="1.0"?"1 employee":`${s} employees`},Ot=(t,s)=>{const r=t+s;return r===0?null:t/r*100},Na=(t,s,r)=>{const o=t?.total_support_tickets_deflected??0,n=t?.total_support_tickets_not_deflected??0,l=o+n,d=Math.round(Ot(o,n)??0),i=(t?.time_series??[]).map(c=>{const m=c.support_tickets_deflected??0,f=c.support_tickets_not_deflected??0;return{period:new Date(c.period),deflected:m,notDeflected:f,attempts:m+f,rate:Ot(m,f),hoursSaved:c.deflection_time_saved_hours??null}}),a=t?.total_deflection_time_saved_hours??null;return{totalTicketsOpened:l,deflectedCount:o,deflectionPercentage:d,employees:a!==null?Ea(a,s,r):null,attemptsData:i.map(({period:c,attempts:m})=>({period:c,value:m})),successfulData:i.map(({period:c,deflected:m})=>({period:c,value:m})),rateData:i.map(({period:c,rate:m})=>({period:c,value:m})),hoursSavedData:i.map(({period:c,hoursSaved:m})=>({period:c,value:m}))}},ur=({totalTicketsOpened:t,deflectedCount:s,deflectionPercentage:r,attemptsData:o,successfulData:n,rateData:l,employees:d,hoursSavedData:u,aggregationPeriod:i,isLoading:a=!1})=>e.jsxs(ut,{children:[e.jsx(V,{label:"Deflection attempts",value:t.toLocaleString(),tooltip:"Support forms your users opened, which kapa attempted to deflect",data:o,aggregationPeriod:i,isLoading:a}
1),e.jsx(V,{label:"Successful deflections",value:s.toLocaleString(),tooltip:"Support requests kapa was able to deflect",data:n,aggregationPeriod:i,isLoading:a}),e.jsx(V,{label:"Deflection rate",value:`${r}%`,tooltip:"Share of support requests kapa deflected",data:l,aggregationPeriod:i,valueFormatter:c=>`${Math.round(c)}%`,isLoading:a}),e.jsx(V,{label:"Added to your team",value:d!==null?Ta(d):"N/A",tooltip:"Assumes 15 minutes handling time per ticket and an employee working 8-hour days, 20 days a month",data:u,aggregationPeriod:i,valueFormatter:c=>`${le(c)} saved`,isLoading:a})]});ur.displayName="SupportDeflectionCards";const mr=()=>{const t=q(),{teamIntegrations:s,isLoadingIntegrations:r,aggregationPeriod:o,startDateTime:n,endDateTime:l}=H(),d=Pe(!0),{totalTicketsOpened:u,deflectedCount:i,deflectionPercentage:a,attemptsData:c,successfulData:m,rateData:f,employees:p,hoursSavedData:h}=g.useMemo(()=>Na(d.data,n,l),[d.data,n,l]),v=d.data?.time_series?.map(C=>({period:new Date(C.period),deflectedCount:C.support_tickets_deflected??0,notDeflectedCount:C.support_tickets_not_deflected??0}))??[],j=r||d.isLoading||!d.data,_=ns(s,is),w=C=>Xe?.capture(C,{project_id:t.project.selected?.id,project_name:t.project.selected?.project_name}),b=t.project.selected?.id?qt(Yt.integrationNew.build({project:t.project.selected.id}),{type:"SUPPORT_FORM_DEFLECTOR",source:"support_empty_state"}):void 0;return d.isError?e.jsx(ne,{}):!r&&!_?e.jsxs(pe,{illustrationClassName:"bg-preset-support",icon:e.jsx(ss,{size:84,stroke:1.5,className:"text-white"}),title:"Deflect tickets automatically",description:"Reduce support volume by 20-40% with AI-powered responses before ticket submission.",children:[b?e.jsx(R,{onClick:()=>w("support_dashboard_add_integration_clicked"),render:e.jsx(Xt,{to:b}),children:"Add integration"}):null,e.jsxs(R,{variant:"secondary",onClick:()=>w("support_dashboard_learn_more_clicked"),render:e.jsx("a",{href:J.integrations.supportFormDeflector,target:"_blank",rel:"noreferrer"}),children:["Learn more",e.jsx(De,{size:14,"data-icon":"inline-end"})]})]}):e.jsxs(O,{gap:"lg",children:[e.jsx(ur,{totalTicketsOpened:u,deflectedCount:i,deflectionPercentage:a,attemptsData:c,successfulData:m,rateData:f,employees:p,hoursSavedData:h,aggregationPeriod:o,isLoading:j}),e.jsx(z,{shadow:"md",radius:"md",p:"xl",withBorder:!0,children:!j&&u===0?e.jsxs(e.Fragment,{children:[e.jsx(Y,{title:"Deflection rate over time",description:"Successful deflections versus attempts, per period"}),e.jsx(F,{h:"lg"}),e.jsxs(Ce,{justify:"center",align:"center",direction:"column",py:"xl",children:[e.jsx(io,{size:"2rem",stroke:1.2,color:"var(--color-foreground-tertiary)"}),e.jsx(F,{h:"sm"}),e.jsx(x,{fz:"md",c:"var(--color-foreground)",fw:500,children:"No deflection data yet"}),e.jsx(F,{h:"xs"}),e.jsxs(x,{fz:"sm",c:"var(--color-foreground-secondary)",ta:"center",maw:420,children:["Tickets will appear here once your Support Form Deflector starts seeing traffic."," ",e.jsx(Vt,{href:J.integrations.supportFormDeflector,target:"_blank",rel:"noreferrer",c:"var(--color-foreground)",inherit:!0,children:"Learn more"}),"."]})]})]}):e.jsx(dr,{title:"Deflection rate over time",subtitle:"Successful deflections versus attempts, per period",data:v,aggregationPeriod:o,height:350,maxBarSize:120,isLoading:j})})]})};mr.displayName="SupportDashboard";const hr=()=>
1{const{preset:t}=H();switch(t){case"overview":return e.jsx(ir,{});case"internal":return e.jsx(nr,{});case"external":return e.jsx(rr,{});case"support":return e.jsx(mr,{});case"agents":return e.jsx(Rs,{});default:return t}};hr.displayName="DashboardBody";const pr=()=>{const{startDateTime:t,endDateTime:s,onDateRangeChange:r}=H();return e.jsx(Pr,{value:[t,s],onChange:r})};pr.displayName="DashboardDateRangeFilter";const Da=[{value:"integration",label:"Integration"},{value:"project",label:"Project"}],gr=({value:t,onChange:s,defaultOpen:r=!1})=>e.jsx(No,{label:"Group by",options:Da,value:t,onChange:s,defaultOpen:r});gr.displayName="DashboardGroupBySelect";const fr=({items:t,value:s,onChange:r,label:o,disabled:n=!1,defaultOpen:l=!1,className:d})=>{const[u,i]=g.useState(l);if(t.length===0)return null;const a=t.find(m=>m.value===s)??t[0],c=m=>{i(!1),m&&m.value!==s&&r(m.value)};return e.jsxs(Do,{items:t,value:a,onValueChange:c,isItemEqualToValue:(m,f)=>m.value===f.value,itemToStringLabel:m=>m.label,filter:null,open:u,onOpenChange:i,disabled:n,children:[e.jsx(Ao,{"aria-label":`${o}, ${a.label}`,render:e.jsx(Io,{"data-slot":"preset-selector-trigger",icon:a.icon,value:a.label,disabled:n,style:{"--preset-color":a.color,"--preset-foreground":a.foreground},className:$("not-data-disabled:border-transparent not-data-disabled:bg-(--preset-color) not-data-disabled:text-(--preset-foreground) not-data-disabled:aria-expanded:text-(--preset-foreground) not-data-disabled:[&_[data-slot^=filter-button]]:text-(--preset-foreground)",d)})}),e.jsx(Mo,{"aria-label":o,className:"w-auto",children:e.jsx(Po,{children:m=>e.jsxs(zo,{value:m,className:"data-highlighted:[&_[data-slot=preset-selector-item-icon][aria-hidden]]:text-(--preset-foreground) data-highlighted:[&_[data-slot=preset-selector-item-icon][aria-hidden]_*]:text-(--preset-foreground)",children:[e.jsx("span",{"aria-hidden":"true","data-slot":"preset-selector-item-icon",style:{"--preset-color":m.color,"--preset-foreground":m.foreground},className:"flex size-5 shrink-0 items-center justify-center rounded-md bg-(--preset-color) text-(--preset-foreground) [&_svg]:size-3.5",children:m.icon}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:m.label})]},m.value)})})]})};fr.displayName="PresetSelector";const Aa={overview:{label:"Overview",icon:e.jsx(co,{}),color:"var(--color-accent-brand)",foreground:"var(--color-accent-brand-foreground)"},external:{label:"External",icon:e.jsx(es,{}),color:"var(--color-preset-external)",foreground:"var(--color-white)"},internal:{label:"Internal",icon:e.jsx(ts,{}),color:"var(--color-preset-internal)",foreground:"var(--color-white)"},support:{label:"Support",icon:e.jsx(ss,{}),color:"var(--color-preset-support)",foreground:"var(--color-white)"},agents:{label:"Agents",icon:e.jsx(Jt,{}),color:"var(--color-preset-agents)",foreground:"var(--color-white)"}},Ma=rt.map(t=>({value:t,...Aa[t]})),xr=({value:t,onChange:s})=>e.jsx(fr,{items:Ma,value:t,onChange:s,label:"Preset"});xr.displayName="DashboardPresetSelector";const Bt=900,Pa=300,we={mounted:!1,expanded:!1},za=t=>{const[s,r]=g.useState(we),o=g.useRef(t);return g.useEffect(()=>{const n=o.current;if(o.current=t,!t){n&&r(we);return}if(n||it())return;r({mounted:!0,expanded:!1});const l=requestAnimationFrame(()=>r({mounted:!0,expanded:!0})),d=setTimeout(()=>r({mounted:!0,expanded:!1}),Bt),u=setTimeout(()=>r(we),Bt+Pa);return()=>{cancelAnimationFrame(l),clearTimeout(d),clearTimeout(u)}},[t]),s},Ia=t=>{const[s,r]=g.useState(()=>({mounted:t,expanded:t})),o=g.useRef(t);return g.useEffect(()=>{const n=o.current;if(o.current=t,!t){r(we);return}if(n)return;if(it()){r({mounted:!0,expanded:!0});return}r({mounted:!0,expanded:!1});const l=requestAnimationFrame(()=>r({mounted:!0,expanded:!0}));return()=>cancelAnimationFrame(l)},[t]),s},Ye=({mounted:t,expanded:s,color:r,collapsedMarginClassName:o="-mr-2"})=>t?e.jsx("span",{"aria-hidden":"true","data-slot":"color-signal",className:$("inline-flex shrink-0 items-center overflow-hidden","motion-safe:transition-all motion-safe:duration-300 motion-safe:ease-out",s?"w-4 opacity-100":$("w-0 opacity-0",o)),children:e.jsx(Je,{shape:"square",size:"xs",color:r})}):null;Ye.displayName="ColorSignal";
1const ft=({items:t,paletteOrder:s,colored:r=!0,...o})=>{const n=g.useMemo(()=>{const i=new Map;return(s??t.map(c=>c.id)).forEach((c,m)=>i.set(c,m+1)),i},[s,t]),l=i=>r?se(n.get(i)??1):void 0,d=za(r),u=Ia(r);return e.jsx(Ro,{items:t,renderItemSwatch:i=>{const a=l(i);return a?e.jsx(Je,{shape:"square",size:"xs",color:a}):null},renderChipSwatch:r?i=>{const a=l(i);return a?e.jsx(Ye,{mounted:u.mounted,expanded:u.expanded,color:a,collapsedMarginClassName:"-mr-1.5"}):null}:void 0,triggerSwatch:e.jsx(Ye,{mounted:d.mounted,expanded:d.expanded,color:se(1)}),...o})};ft.displayName="MultiSelectFilter";const vr=({value:t,onChange:s,integrations:r,paletteIntegrations:o,colored:n=!0,defaultOpen:l=!1})=>{const d=g.useMemo(()=>{const a=new Map;return r.forEach(c=>{const m=Fo(c.integration_type),f={id:c.id,label:c.name??"Unnamed integration",searchText:[c.name??"",c.project_name,m].join(" "),suffix:e.jsx("span",{className:"text-foreground-secondary ml-4 max-w-[200px] shrink-0 truncate text-[11px]",children:m})},p=a.get(c.project_name)??[];p.push(f),a.set(c.project_name,p)}),Array.from(a,([c,m])=>({value:c,items:m}))},[r]),u=g.useMemo(()=>d.flatMap(a=>a.items),[d]),i=g.useMemo(()=>(o??r).map(a=>a.id),[o,r]);return e.jsx(ft,{value:t,onChange:s,items:u,groups:d,label:"Integration",itemNounPlural:"integrations",paletteOrder:i,colored:n,defaultOpen:l})};vr.displayName="IntegrationMultiFilter";const Ht=t=>({id:t.id,label:t.project_name}),jr=({value:t,onChange:s,projects:r,allLabel:o,colored:n=!0,defaultOpen:l=!1})=>{const d=g.useMemo(()=>[{value:"External",items:r.filter(a=>!a.is_internal).map(Ht)},{value:"Internal",items:r.filter(a=>a.is_internal).map(Ht)}].filter(a=>a.items.length>0),[r]),u=g.useMemo(()=>d.flatMap(a=>a.items),[d]),i=g.useMemo(()=>r.map(a=>a.id),[r]);return e.jsx(ft,{value:t,onChange:s,items:u,groups:d,label:"Project",itemNounPlural:"projects",allLabel:o,paletteOrder:i,colored:n,defaultOpen:l})};jr.displayName="ProjectMultiFilter";const yr=()=>{const t=q(),s=Xr(),{integrations:r,groupBy:o,setProjects:n,setIntegrations:l,setGroupBy:d}
1=ot(),{preset:u,onPresetChange:i}=H(),{scopedProjects:a,projectAllLabel:c,projectFilterValue:m,effectiveProjectFilter:f,integrationTypeFilter:p}=ds(),h=as({projectFilter:f}),v=g.useMemo(()=>h.data??[],[h.data]),j=g.useMemo(()=>st(v,p),[v,p]);g.useEffect(()=>{if(!h.data||r.length===0)return;const w=new Set(j.map(C=>C.id)),b=r.filter(C=>w.has(C));b.length!==r.length&&l(b,{replace:!0})},[h.data,j,r,l]);const _=w=>{if(w.length===1&&w[0]!==t.project.selected?.id){const b=new URLSearchParams(s.search);b.delete("projects"),b.append("projects",w[0]),t.project.selectProject(w[0],{search:`?${b.toString()}`});return}n(w)};return e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(xr,{value:u,onChange:i}),e.jsx(jr,{value:m,onChange:_,projects:a,allLabel:c,colored:o==="project"}),e.jsx(vr,{value:r,onChange:l,integrations:j,paletteIntegrations:v,colored:o==="integration"}),e.jsx(gr,{value:o,onChange:d})]})};yr.displayName="DashboardFilterBarContainer";const jl=()=>{const{project:t}=Jr();return e.jsx(Qo,{children:e.jsx(Wr,{slots:{banner:e.jsx(Bo,{}),sidebar:e.jsx(Mr,{}),content:e.jsx(Zr,{slots:{header:t?e.jsx(Qr,{title:"Dashboard"}):null,help:e.jsx(Oo,{label:"About Dashboard",children:"Explore usage statistics for your Kapa deployments: External (public deployments), Internal (for your employees), Support (the support form deflector), and Agents (AI agents via MCP), with Overview summarizing all of them. Refreshed daily."}),filtersLeft:e.jsx(yr,{}),filtersRight:e.jsx(pr,{}),body:e.jsx(hr,{})}}),footer:e.jsx(Co,{})}})})};export{jl as default};
2//# sourceMappingURL=index-CZ9JqZkg.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.