import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{t}from"./GovernanceLayout-BataOl2A.js";import{Ea as n,Hy as r,Ly as i,Pg as a,Zv as o,ap as s,dg as c,hv as l,kp as u,lh as d,m_ as f,pl as p,rd as m,ty as h}from"./index-DDwwBb9e.js";import{t as g}from"./WithFeatureFlagGuard-DJITjVRM.js";import{t as _}from"./WithPermissionGuard-wX0IC3VF.js";var v=e(n()),y=r(),b=e=>e===0?`$0.00`:(0,v.default)(e).format(`$0,0.00`),x=e=>{if(!e)return`—`;let t=typeof e==`string`?new Date(e):e;if(Number.isNaN(t.getTime()))return`—`;let n=Date.now()-t.getTime();if(n<0)return`just now`;let r=Math.floor(n/1e3);if(r<60)return`${r}s ago`;let i=Math.floor(r/60);if(i<60)return`${i}m ago`;let a=Math.floor(i/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`};function S(){let e=u(),n=typeof e.query.id==`string`?e.query.id:null,{organization:r,organizations:g}=s({redirectToOnboarding:!1}),_=r?.id??``,S=g?.flatMap(e=>e.teams??[]).find(e=>e.id===n)?.projects?.[0]?.slug??null,w=d.activityMonitor.spendByTeam.useQuery({organizationId:_,windowDays:30,limit:500},{enabled:!!_,refetchOnWindowFocus:!1}),T=(w.data??[]).find(e=>e.teamId===n);return(0,y.jsx)(t,{pageTitle:T?`${T.teamName} · AI Governance · LangWatch`:`Team · AI Governance · LangWatch`,children:(0,y.jsxs)(c,{align:`stretch`,gap:4,width:`full`,maxW:`container.xl`,children:[(0,y.jsxs)(c,{align:`start`,gap:1,children:[(0,y.jsxs)(o,{fontSize:`xs`,color:`fg.muted`,children:[(0,y.jsx)(p,{href:`/settings/governance`,color:`blue.600`,children:`← AI Governance`}),` `,`·`,` `,(0,y.jsx)(p,{href:`/settings/governance/teams`,color:`blue.600`,children:`All teams`})]}),(0,y.jsxs)(f,{gap:2,children:[(0,y.jsx)(i,{width:`14px`,height:`14px`,borderRadius:`full`,backgroundColor:T?m(T.teamName):`fg.muted`}),(0,y.jsx)(h,{size:`md`,children:T?.teamName??`Team not found`})]})]}),w.isLoading?(0,y.jsx)(l,{}):T?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(a,{columns:{base:1,md:4},gap:3,children:[(0,y.jsx)(C,{label:`Spend (30 d)`,value:b(T.spendUsd)}),(0,y.jsx)(C,{label:`Requests`,value:(0,v.default)(T.requestCount).format(`0,0`)}),(0,y.jsx)(C,{label:`Last active`,value:x(T.lastActivityIso)}),(0,y.jsx)(C,{label:`Sources`,value:`${T.sourceCount} ${T.sourceCount===1?`source`:`sources`}`})]}),(0,y.jsxs)(i,{borderWidth:`1px`,borderColor:`border.muted`,borderRadius:`md`,padding:4,children:[(0,y.jsx)(o,{fontSize:`sm`,fontWeight:`medium`,marginBottom:1,children:`Detail metrics`}),(0,y.jsx)(o,{fontSize:`xs`,color:`fg.muted`,marginBottom:3,children:`Per-day spend, per-user breakdown, and model mix for this team will land here in a follow-up.`}),S&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(p,{href:`/${S}/traces`,color:`blue.600`,fontSize:`sm`,fontWeight:`medium`,children:`View this team's workspace traces →`}),(0,y.jsx)(o,{fontSize:`xs`,color:`fg.subtle`,marginTop:1,marginBottom:3,children:`The trace explorer opens with the team's data. A 'Viewing as admin' banner stays present + the access is logged to /settings/audit-log.`})]}),(0,y.jsx)(p,{href:`/settings/governance`,color:`blue.600`,fontSize:`sm`,fontWeight:`medium`,children:`See this team in the bird's-eye chart →`}),(0,y.jsxs)(o,{fontSize:`xs`,color:`fg.subtle`,marginTop:1,children:[`The chart's `,`'By Team'`,` toggle exercises the same data through one orthogonal lens until the dedicated drilldown ships.`]})]})]}):(0,y.jsx)(i,{borderWidth:`1px`,borderColor:`border.muted`,borderRadius:`md`,padding:5,children:(0,y.jsx)(o,{fontSize:`sm`,color:`fg.muted`,children:`No spend data for this team in the last 30 days. The team may not have any associated ingestion sources reporting activity yet.`})})]})})}function C({label:e,value:t}){return(0,y.jsxs)(i,{borderWidth:`1px`,borderColor:`border.muted`,borderRadius:`md`,padding:3,children:[(0,y.jsx)(o,{fontSize:`xs`,fontWeight:`semibold`,color:`fg.muted`,textTransform:`uppercase`,letterSpacing:`wider`,children:e}),(0,y.jsx)(h,{as:`span`,size:`sm`,marginTop:1,children:t})]})}var w=g(`release_ui_ai_governance_enabled`,{bypassOnboardingRedirect:!0})(_(`organization:manage`,{bypassOnboardingRedirect:!0})(S));export{w as default};
//# sourceMappingURL=_id_-Nmf-0Dd6.js.map