import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{Fr as t,Ht as n,Jt as r,Lt as i,Vn as a,Vt as o,Wn as s,Xt as c,Yt as l,Zr as u,an as d,bi as f,ei as p,fn as m,ft as h,gi as g,gn as _,hi as v,mi as ee,mt as y,nn as b,qn as x,ri as S,rn as C,si as w,sn as T,t as E,ur as D,zn as O}from"./vendor-DU4C2Mru.js";import{n as k,t as te}from"./api--bJYSUUx.js";import{H as A,J as ne,M as j,R as M,S as re,T as ie,V as ae,X as oe,d as se,f as ce,g as le,k as ue,vt as N,w as de}from"./index-B7s3VjPV.js";import{a as fe,c as pe,o as me,r as P,s as he}from"./registry-CL7gaVhP.js";import{n as F,t as I}from"./flags-DiQ3rOp9.js";import{t as ge}from"./rank-medal-DUujkT4g.js";import{t as L}from"./AgentIcon-CuXjXZM3.js";import{t as R}from"./MapImage-wRd7latf.js";import{t as z}from"./WidgetEmpty-CcNoL3DG.js";import{c as B,o as V,r as H,s as _e,t as U}from"./vendor-charts-bts2Ymlc.js";import{n as W,t as G}from"./Skeleton-NOc6oj1i.js";import{n as ve,t as ye}from"./seo-helpers-D-XcFZDv.js";import{n as be,r as xe,t as Se}from"./EditWidgetsButton-B9CBpCjw.js";import{t as Ce}from"./WatchButton-_J6pIOBL.js";import{n as we,r as Te,t as Ee}from"./FilterBar-vmNBx3Ut.js";import{t as K}from"./QueryError-zb9leCRq.js";import{t as De}from"./WidgetStateContainer-B6hr_tBM.js";import{a as Oe,i as ke,n as Ae,o as je,r as Me,t as Ne}from"./RailPeek-hYr-LMGf.js";import{n as Pe,r as Fe,t as Ie}from"./RatingChartWidget-CaaCwBHz.js";import{t as Le}from"./EntityNotFound-DmD02JKj.js";var q=e(f(),1),Re={igl:`bg-purple-500/15 text-purple-700 border-purple-500/20 dark:text-purple-400`,controller:`bg-blue-500/15 text-blue-700 border-blue-500/20 dark:text-blue-400`,initiator:`bg-amber-500/15 text-amber-700 border-amber-500/20 dark:text-amber-400`,duelist:`bg-red-500/15 text-red-700 border-red-500/20 dark:text-red-400`,sentinel:`bg-green-500/15 text-green-700 border-green-500/20 dark:text-green-400`,flex:`bg-cyan-500/15 text-cyan-700 border-cyan-500/20 dark:text-cyan-400`},ze={igl:`bg-purple-500/10 text-purple-700 dark:text-purple-400`,duelist:`bg-red-500/10 text-red-700 dark:text-red-400`,controller:`bg-blue-500/10 text-blue-700 dark:text-blue-400`,sentinel:`bg-green-500/10 text-green-700 dark:text-green-400`,initiator:`bg-amber-500/10 text-amber-700 dark:text-amber-400`,flex:`bg-cyan-500/10 text-cyan-700 dark:text-cyan-400`},Be=`bg-zinc-500/10 text-zinc-600 border-zinc-500/20 dark:text-zinc-400`,Ve=`bg-zinc-500/10 text-zinc-500`;function He(e){return e?Re[e.toLowerCase()]??Be:Be}function Ue(e){return e?ze[e.toLowerCase()]??Ve:Ve}var J=S();function We({role:e,className:t}){return e?(0,J.jsx)(`span`,{className:N(`inline-flex shrink-0 items-center rounded-md border px-1.5 py-0.5 text-2xs font-semibold uppercase tracking-wider whitespace-nowrap`,He(e),t),children:e}):null}function Y(e,t){return e===`kd`?t.toFixed(2):e===`kast`?`${Math.round(t)}%`:String(Math.round(t))}function Ge(e,t,n){return e===1?t:n}var Ke=new Set([`glicko`,`acs`,`kd`,`adr`,`kast`]),X={glicko:`Glicko`,acs:`ACS`,kd:`K/D`,adr:`ADR`,kast:`KAST`},qe=[{value:`glicko`,label:`Glicko`},{value:`acs`,label:`ACS`},{value:`kd`,label:`K/D`},{value:`adr`,label:`ADR`},{value:`kast`,label:`KAST`}];function Je(e){let{explicitStat:t}=e;return t&&Ke.has(t)?t:`glicko`}function Ye(e){return!(!e||e.includes(`/img/base/ph/`))}function Xe(e){return e.startsWith(`//`)?`https:${e}`:e}function Ze({selectedSlug:e,expanded:r,compact:i,isPinned:a=!1,onToggleVariant:o}){let{gameSlug:s}=v(),c=ee(),l=Ne(),{filters:u,setTier:d}=re(),[f,m]=g(),h=(0,q.useMemo)(()=>Je({explicitStat:f.get(`stat`)}),[f]),_=(0,q.useCallback)(e=>{m(t=>(t.set(`stat`,e),t),{replace:!0})},[m]),y=u.role||`all`,[b,S]=(0,q.useState)(``),[C,T]=(0,q.useState)(``),[E,D]=(0,q.useState)(!1),O=(0,q.useRef)(void 0),te=(0,q.useRef)(!1);(0,q.useEffect)(()=>{!te.current&&u.tier===null&&(te.current=!0,d(`vct`))},[u.tier,d]);let ne=(0,q.useCallback)(e=>{S(e),clearTimeout(O.current),O.current=setTimeout(()=>T(e),300)},[]),M=C.length>=2,ie=(0,q.useRef)(null),oe=me(),{data:ce,isLoading:le,isError:ue,error:de,refetch:fe,fetchNextPage:pe,hasNextPage:P,isFetchingNextPage:F}=he(s,{stat:h,limit:50,tier:u.tier,region:u.region,subRegion:u.subRegion,tiers:[`t1`,`t2`,`gc`],role:y,minMaps:5,from:oe}),L=(0,q.useMemo)(()=>ce?.pages.flat(),[ce]),{data:R,isLoading:z,isError:B,refetch:V}=p({queryKey:[`playerSearch`,s,C],queryFn:()=>k(`/games/${s}/players?${new URLSearchParams({q:C,tiers:`t1,t2,gc`})}`),enabled:M,staleTime:300*1e3}),H=L,_e=(0,q.useMemo)(()=>H?.length?Math.max(...H.map(e=>e.value??0)):0,[H]),U=(0,q.useRef)(null);(0,q.useEffect)(()=>{let e=U.current;if(!e)return;let t=new IntersectionObserver(e=>{e[0].isIntersecting&&P&&!F&&!M&&pe()},{threshold:0});return t.observe(e),()=>t.disconnect()},[P,F,pe,M]);let W=M?z:le,G=!M&&ue;if(i){let t=(M?R:H)??[];return(0,J.jsxs)(Ae,{label:`Players`,isPinned:a,onExpand:()=>o?.(),children:[W&&(0,J.jsx)(`div`,{className:`space-y-1`,children:Array.from({length:10}).map((e,t)=>(0,J.jsx)(`div`,{className:`mx-auto h-10 w-10 animate-pulse rounded-lg bg-zinc-100 dark:bg-zinc-800`},t))}),!M&&(0,J.jsxs)(`div`,{className:`space-y-0.5`,children:[(H??[]).map(t=>{let n=I(t.player.country);return(0,J.jsx)(Me,{selected:e===t.player.slug,onClick:()=>c(`/${s}/players/${t.player.slug}`),rank:`#${t.rank}`,main:t.player.team?(0,J.jsx)(j,{name:t.player.team.name,slug:t.player.team.slug,abbreviation:t.player.team.abbreviation,size:`sm`}):(0,J.jsx)(`div`,{className:`flex h-6 w-6 items-center justify-center rounded bg-zinc-200 text-[8px] font-bold text-zinc-400 dark:bg-zinc-700`,children:`FA`}),peek:t.player.ign,onPeek:e=>l.show((0,J.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[n&&(0,J.jsx)(`span`,{className:`text-sm`,children:n}),(0,J.jsx)(`span`,{className:`text-sm font-bold text-zinc-900 dark:text-zinc-100`,children:t.player.ign})]}),(0,J.jsxs)(`div`,{className:`text-xs text-zinc-500 dark:text-zinc-400`,children:[t.player.team?.name??`Free Agent`,t.player.role&&(0,J.jsxs)(`span`,{className:`ml-1 capitalize text-zinc-400`,children:[`· `,t.player.role]})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,J.jsxs)(`span`,{className:`font-mono font-bold tabular-nums text-zinc-700 dark:text-zinc-300`,children:[Y(h,t.value),` `,(0,J.jsx)(`span`,{className:`font-sans text-zinc-400`,children:X[h]})]}),(0,J.jsxs)(`span`,{className:`text-zinc-400`,children:[`#`,t.rank]})]})]}),e),onPeekEnd:l.hide},t.player.id)}),(0,J.jsx)(`div`,{ref:U,className:`h-1`}),F&&(0,J.jsx)(`div`,{className:`flex justify-center py-2`,children:(0,J.jsx)(x,{size:14,className:`animate-spin text-zinc-400`})})]}),M&&B&&(0,J.jsx)(K,{message:`Failed to load player search`,onRetry:()=>void V(),className:`!py-4`}),M&&!B&&R&&(0,J.jsx)(`div`,{className:`space-y-0.5`,children:R.map(t=>{let n=I(t.country);return(0,J.jsx)(Me,{selected:e===t.slug,onClick:()=>c(`/${s}/players/${t.slug}`),main:t.team?(0,J.jsx)(j,{name:t.team.name,slug:t.team.slug,abbreviation:t.team.abbreviation,size:`sm`}):(0,J.jsx)(`div`,{className:`flex h-6 w-6 items-center justify-center rounded bg-zinc-200 text-[8px] font-bold text-zinc-400 dark:bg-zinc-700`,children:`FA`}),peek:t.ign,onPeek:e=>l.show((0,J.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[n&&(0,J.jsx)(`span`,{className:`text-sm`,children:n}),(0,J.jsx)(`span`,{className:`text-sm font-bold text-zinc-900 dark:text-zinc-100`,children:t.ign})]}),(0,J.jsxs)(`div`,{className:`text-xs text-zinc-500 dark:text-zinc-400`,children:[t.team?.name??`Free Agent`,t.role&&(0,J.jsxs)(`span`,{className:`ml-1 capitalize text-zinc-400`,children:[`· `,t.role]})]})]}),e),onPeekEnd:l.hide},t.id)})}),!W&&t.length===0&&(0,J.jsx)(`div`,{className:`py-6 text-center text-2xs text-zinc-500`,children:`Empty`}),l.portal]})}return r?(0,J.jsxs)(`div`,{className:`flex h-full w-full flex-col overflow-hidden`,children:[E&&(0,J.jsx)(Ee,{onClose:()=>D(!1)}),(0,J.jsx)(se,{title:`Players`,actions:(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(Qe,{value:h,onChange:e=>_(e)}),(0,J.jsx)(et,{value:b,onChange:ne,placeholder:`Search players...`}),(0,J.jsx)(we,{open:E,onToggle:()=>D(e=>!e)})]}),className:`flex min-h-0 flex-1 flex-col overflow-hidden`,seo:{description:`Browse Valorant pro player stats, rankings, ratings, and roles. Filter by league, region, and role to find the top performers.`},children:(0,J.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:(0,J.jsxs)(`div`,{className:`mx-auto max-w-5xl`,children:[W&&(0,J.jsx)(A,{kind:`table`}),!W&&G&&(0,J.jsx)(ae,{error:de??Error(`Failed to load player leaderboard`),retry:()=>void fe()}),!W&&M&&B&&(0,J.jsx)(K,{message:`Failed to load player search`,onRetry:()=>void V()}),!W&&M&&!B&&R&&(0,J.jsxs)(`div`,{className:`glk-card !p-0 overflow-hidden`,children:[(0,J.jsx)(`div`,{className:`divide-y divide-zinc-100 dark:divide-zinc-800/50`,children:R.map(e=>{let n=I(e.country);return(0,J.jsxs)(w,{to:`/${s}/players/${e.slug}`,"aria-label":`View profile for ${e.ign}${e.team?`, ${e.team.name}`:``}`,className:`group flex w-full items-center gap-3 px-3 py-2.5 text-left transition-colors duration-200 hover:bg-zinc-50 dark:hover:bg-zinc-800/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--glk-brand)]`,children:[(0,J.jsx)($e,{avatarUrl:e.avatarUrl,ign:e.ign,team:e.team}),(0,J.jsxs)(`div`,{className:`flex-1 overflow-hidden`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsxs)(`span`,{className:`truncate text-sm font-semibold text-zinc-900 transition-colors group-hover:text-[var(--glk-brand)] dark:text-zinc-100`,children:[n&&(0,J.jsx)(`span`,{className:`mr-1`,children:n}),e.ign]}),e.team?.abbreviation&&(0,J.jsx)(`span`,{className:`hidden flex-shrink-0 text-xs text-zinc-400 sm:inline`,children:e.team.abbreviation}),(0,J.jsx)(We,{role:e.role})]}),(0,J.jsxs)(`div`,{className:`truncate text-xs text-zinc-500 dark:text-zinc-400`,children:[e.team?.name??`Free Agent`,e.mapsPlayed>0&&(0,J.jsxs)(`span`,{className:`ml-1.5 text-zinc-400 dark:text-zinc-500`,children:[`· `,e.mapsPlayed,` maps`]})]})]}),e.careerAvgAcs!=null&&(0,J.jsx)(`span`,{className:`font-mono text-sm font-bold tabular-nums text-zinc-700 dark:text-zinc-300`,children:Math.round(e.careerAvgAcs)}),(0,J.jsx)(t,{size:14,className:`shrink-0 text-zinc-300 group-hover:text-zinc-500 dark:text-zinc-600 dark:group-hover:text-zinc-400`})]},e.id)})}),R.length===0&&(0,J.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 py-12 text-zinc-400`,children:[(0,J.jsx)(n,{size:28,strokeWidth:1.5}),(0,J.jsx)(`p`,{className:`text-sm`,children:`No players match your search`})]})]}),!W&&!G&&!M&&H&&H.length>0&&(0,J.jsxs)(`div`,{className:`glk-card !p-0 overflow-hidden`,children:[(0,J.jsxs)(`div`,{className:`sticky top-0 z-10 flex items-center gap-3 border-b border-zinc-200/80 bg-zinc-50/95 px-3 py-2 backdrop-blur-sm dark:border-zinc-800 dark:bg-zinc-900/95`,children:[(0,J.jsx)(`span`,{className:`w-8 text-center glk-eyebrow`,children:`#`}),(0,J.jsx)(`span`,{className:`w-9`}),(0,J.jsx)(`span`,{className:`flex-1 glk-eyebrow`,children:`Player`}),(0,J.jsx)(`span`,{className:`hidden w-20 text-center glk-eyebrow sm:block`,children:`Role`}),(0,J.jsx)(`span`,{className:`w-16 text-right glk-eyebrow`,children:X[h]}),(0,J.jsx)(`span`,{className:`w-4`})]}),(0,J.jsx)(`div`,{className:`divide-y divide-zinc-100 dark:divide-zinc-800/50`,children:H.map(e=>{let n=I(e.player.country),r=_e>0?e.value/_e*100:0,i=e.rank<=3;return(0,J.jsxs)(w,{to:`/${s}/players/${e.player.slug}`,"aria-label":`#${e.rank} ${e.player.ign}${e.player.team?`, ${e.player.team.name}`:``} — ${X[h]} ${Y(h,e.value)}`,className:`group relative flex w-full items-center gap-3 px-3 py-2.5 text-left transition-colors duration-200 hover:bg-zinc-50 dark:hover:bg-zinc-800/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--glk-brand)]`,children:[(0,J.jsx)(`div`,{className:N(`pointer-events-none absolute inset-y-0 left-0 transition-all`,i?`bg-zinc-100 dark:bg-zinc-800/60`:`bg-zinc-50/40 dark:bg-zinc-900/40`),style:{width:`${r}%`}}),(0,J.jsx)(`div`,{className:`relative z-10 flex w-8 justify-center`,children:(0,J.jsx)(ge,{rank:e.rank})}),(0,J.jsx)($e,{avatarUrl:e.player.avatarUrl,ign:e.player.ign,team:e.player.team,highlight:i}),(0,J.jsxs)(`div`,{className:`relative z-10 flex-1 overflow-hidden`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsxs)(`span`,{className:N(`truncate text-sm font-semibold transition-colors group-hover:text-[var(--glk-brand)]`,i?`text-zinc-900 dark:text-zinc-50`:`text-zinc-900 dark:text-zinc-100`),children:[n&&(0,J.jsx)(`span`,{className:`mr-1`,children:n}),e.player.ign]}),e.player.team?.abbreviation&&(0,J.jsx)(`span`,{className:`hidden flex-shrink-0 text-xs text-zinc-400 sm:inline`,children:e.player.team.abbreviation})]}),(0,J.jsx)(`div`,{className:`truncate text-xs text-zinc-500 dark:text-zinc-400`,children:e.player.team?.name??`Free Agent`})]}),(0,J.jsx)(`div`,{className:`relative z-10 hidden w-20 justify-center sm:flex`,children:(0,J.jsx)(We,{role:e.player.role})}),(0,J.jsx)(`span`,{className:N(`relative z-10 w-16 text-right font-mono text-sm font-bold tabular-nums`,i?`text-[var(--glk-brand)]`:`text-zinc-800 dark:text-zinc-200`),children:Y(h,e.value)}),(0,J.jsx)(t,{size:14,className:`relative z-10 shrink-0 text-zinc-300 group-hover:text-zinc-500 dark:text-zinc-600 dark:group-hover:text-zinc-400`})]},e.player.id)})}),(0,J.jsx)(`div`,{ref:U,className:`h-1`}),F&&(0,J.jsx)(`div`,{className:`flex justify-center py-3`,children:(0,J.jsx)(x,{size:16,className:`animate-spin text-zinc-400`})})]}),!W&&!G&&!M&&H&&H.length===0&&(0,J.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 py-16 text-zinc-400`,children:[(0,J.jsx)(n,{size:32,strokeWidth:1.5}),(0,J.jsx)(`p`,{className:`text-sm`,children:`No players found`}),(0,J.jsx)(`p`,{className:`text-xs`,children:y!==`all`||u.tier!==null?`No players match the current filters`:`Try a different stat or clear filters`})]})]})})})]}):(0,J.jsxs)(Oe,{title:`Players`,width:`w-80`,scrollRef:ie,actions:o?(0,J.jsx)(ke,{isPinned:a,variant:`full`,onClick:o}):void 0,children:[(0,J.jsx)(`div`,{className:`mb-2`,children:(0,J.jsx)(`input`,{value:b,onChange:e=>ne(e.target.value),placeholder:`Search...`,"aria-label":`Search players`,className:`w-full rounded-md border border-zinc-200 bg-zinc-50 px-2.5 py-1.5 text-xs text-zinc-800 outline-none placeholder:text-zinc-400 focus:border-[var(--glk-brand)] focus:ring-1 focus:ring-[var(--glk-brand)]/20 dark:border-zinc-800 dark:bg-zinc-900 dark:text-zinc-200 dark:placeholder:text-zinc-500`})}),W&&(0,J.jsx)(`div`,{className:`space-y-1`,children:Array.from({length:8}).map((e,t)=>(0,J.jsx)(`div`,{className:`skeleton-shimmer rounded-lg h-10`,style:{opacity:1-t*.08}},t))}),!M&&G&&(0,J.jsx)(K,{message:`Failed to load players`,onRetry:()=>void fe(),className:`!py-6`}),M&&B&&(0,J.jsx)(K,{message:`Failed to load player search`,onRetry:()=>void V(),className:`!py-6`}),M&&!B&&R&&(0,J.jsxs)(`div`,{className:`space-y-0.5`,children:[R.map(n=>{let r=I(n.country),i=e===n.slug;return(0,J.jsxs)(w,{to:`/${s}/players/${n.slug}`,"aria-label":`View profile for ${n.ign}${n.team?`, ${n.team.name}`:``}`,"aria-current":i?`page`:void 0,className:N(`group flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--glk-brand)] focus-visible:ring-offset-1`,i?`bg-[var(--glk-brand)]/10`:`hover:bg-zinc-100 dark:hover:bg-zinc-800/60`),children:[(0,J.jsx)(`div`,{className:`flex h-5 w-5 flex-shrink-0 items-center justify-center`,children:n.team?(0,J.jsx)(j,{name:n.team.name,slug:n.team.slug,abbreviation:n.team.abbreviation,size:`sm`}):(0,J.jsx)(`div`,{className:`flex h-5 w-5 items-center justify-center rounded bg-zinc-200 text-[7px] font-bold text-zinc-400 dark:bg-zinc-800 dark:text-zinc-500`,children:`FA`})}),(0,J.jsxs)(`div`,{className:`flex-1 overflow-hidden`,children:[(0,J.jsxs)(`div`,{className:N(`truncate text-xs font-semibold transition-colors`,i?`text-[var(--glk-brand)]`:`text-zinc-900 group-hover:text-[var(--glk-brand)] dark:text-zinc-100`),children:[r&&(0,J.jsx)(`span`,{className:`mr-1`,children:r}),n.ign]}),(0,J.jsxs)(`div`,{className:`text-xs text-zinc-500 dark:text-zinc-400`,children:[n.team?.abbreviation??n.team?.name??`—`,n.role&&(0,J.jsxs)(`span`,{className:`ml-1 text-zinc-400 dark:text-zinc-500`,children:[`· `,n.role]})]})]}),n.careerAvgAcs!=null&&(0,J.jsx)(`span`,{className:`glk-metric glk-metric-sm text-zinc-800 dark:text-zinc-200`,children:Math.round(n.careerAvgAcs)}),(0,J.jsx)(t,{size:14,className:N(`shrink-0 transition-colors`,i?`text-[var(--glk-brand)]`:`text-zinc-300 group-hover:text-[var(--glk-brand)] dark:text-zinc-600`)})]},n.id)}),R.length===0&&(0,J.jsx)(`div`,{className:`py-8 text-center text-xs text-zinc-500`,children:`No players found`})]}),!M&&!G&&H&&(0,J.jsxs)(`div`,{className:`space-y-0.5`,children:[H.map(n=>{let r=I(n.player.country),i=e===n.player.slug,a=n.rank<=3;return(0,J.jsxs)(w,{to:`/${s}/players/${n.player.slug}`,"aria-label":`#${n.rank} ${n.player.ign}${n.player.team?`, ${n.player.team.name}`:``} — ${X[h]} ${Y(h,n.value)}`,"aria-current":i?`page`:void 0,className:N(`group flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--glk-brand)] focus-visible:ring-offset-1`,i?`bg-[var(--glk-brand)]/10`:`hover:bg-zinc-100 dark:hover:bg-zinc-800/60`),children:[(0,J.jsx)(`span`,{className:N(`w-6 text-right glk-tabular text-xs font-bold`,a?`text-[var(--glk-brand)]`:`text-zinc-400 dark:text-zinc-500`),children:n.rank}),(0,J.jsx)(`div`,{className:`flex h-5 w-5 flex-shrink-0 items-center justify-center`,children:n.player.team?(0,J.jsx)(j,{name:n.player.team.name,slug:n.player.team.slug,abbreviation:n.player.team.abbreviation,size:`sm`}):(0,J.jsx)(`div`,{className:`flex h-5 w-5 items-center justify-center rounded bg-zinc-200 text-[7px] font-bold text-zinc-400 dark:bg-zinc-800 dark:text-zinc-500`,children:`FA`})}),(0,J.jsxs)(`div`,{className:`flex-1 overflow-hidden`,children:[(0,J.jsxs)(`div`,{className:N(`truncate text-xs font-semibold transition-colors`,i?`text-[var(--glk-brand)]`:`text-zinc-900 group-hover:text-[var(--glk-brand)] dark:text-zinc-100`),children:[r&&(0,J.jsx)(`span`,{className:`mr-1`,children:r}),n.player.ign]}),(0,J.jsxs)(`div`,{className:`text-xs text-zinc-500 dark:text-zinc-400`,children:[n.player.team?.abbreviation??n.player.team?.name??`—`,n.player.role&&(0,J.jsxs)(`span`,{className:`ml-1 text-zinc-400 dark:text-zinc-500`,children:[`· `,n.player.role]})]})]}),(0,J.jsx)(`span`,{className:`glk-metric glk-metric-sm text-zinc-800 dark:text-zinc-200`,children:Y(h,n.value)}),(0,J.jsx)(t,{size:14,className:N(`shrink-0 transition-colors`,i?`text-[var(--glk-brand)]`:`text-zinc-300 group-hover:text-[var(--glk-brand)] dark:text-zinc-600`)})]},n.player.id)}),(0,J.jsx)(`div`,{ref:U,className:`h-1`}),F&&(0,J.jsx)(`div`,{className:`flex justify-center py-3`,children:(0,J.jsx)(x,{size:16,className:`animate-spin text-zinc-400`})}),H.length===0&&(0,J.jsx)(`div`,{className:`py-8 text-center text-xs text-zinc-500`,children:`No players found for this tier`})]})]})}function Qe({value:e,onChange:t}){return(0,J.jsx)(`div`,{role:`group`,"aria-label":`Sort by stat`,className:`inline-flex gap-0.5 rounded-lg border border-zinc-200 p-0.5 dark:border-zinc-800`,children:qe.map(n=>(0,J.jsx)(`button`,{type:`button`,onClick:()=>t(n.value),"aria-pressed":e===n.value,className:N(`rounded-md px-2 py-1 text-xs font-semibold uppercase tracking-wider tabular-nums transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--glk-brand)] focus-visible:ring-offset-1`,e===n.value?`bg-zinc-900 text-white dark:bg-zinc-100 dark:text-zinc-900`:`text-zinc-500 hover:text-zinc-800 dark:text-zinc-400 dark:hover:text-zinc-200`),children:n.label},n.value))})}function $e({avatarUrl:e,ign:t,team:n,highlight:r}){let i=Ye(e);return(0,J.jsxs)(`div`,{className:`relative z-10 flex h-9 w-9 flex-shrink-0 items-center justify-center`,children:[i?(0,J.jsx)(`img`,{src:Xe(e),alt:`${t} avatar`,loading:`lazy`,className:N(`h-9 w-9 rounded-lg object-cover bg-zinc-200 dark:bg-zinc-800`,r?`ring-2 ring-[var(--glk-brand)]`:`ring-1 ring-zinc-200 dark:ring-zinc-700`)}):n?(0,J.jsx)(j,{name:n.name,slug:n.slug,abbreviation:n.abbreviation,logoUrl:n.logoUrl,size:`md`}):(0,J.jsx)(`div`,{"aria-label":`${t} initials`,className:`flex h-9 w-9 items-center justify-center rounded-lg bg-gradient-to-br from-zinc-200 to-zinc-300 text-xs font-bold text-zinc-500 dark:from-zinc-700 dark:to-zinc-800 dark:text-zinc-400`,children:t.charAt(0).toUpperCase()}),i&&n&&(0,J.jsx)(`div`,{className:`absolute -bottom-0.5 -right-0.5 flex h-4 w-4 items-center justify-center rounded bg-white ring-1 ring-zinc-200 dark:bg-zinc-900 dark:ring-zinc-700`,children:(0,J.jsx)(j,{name:n.name,slug:n.slug,abbreviation:n.abbreviation,logoUrl:n.logoUrl,size:`xs`})})]})}function et({value:e,onChange:t,placeholder:n}){let[r,i]=(0,q.useState)(e.length>0),a=(0,q.useRef)(null),o=(0,q.useCallback)(()=>{i(!0),setTimeout(()=>a.current?.focus(),0)},[]),s=(0,q.useCallback)(()=>{e||i(!1)},[e]);return r?(0,J.jsxs)(`div`,{className:`relative w-40 sm:w-48`,children:[(0,J.jsx)(_,{size:14,className:`absolute left-2.5 top-1/2 -translate-y-1/2 text-zinc-400`,"aria-hidden":`true`}),(0,J.jsx)(`input`,{ref:a,value:e,onChange:e=>t(e.target.value),onBlur:s,placeholder:n,"aria-label":n??`Search players`,className:`w-full rounded-md border border-zinc-200 bg-zinc-50 py-1.5 pl-8 pr-3 text-xs text-zinc-800 outline-none placeholder:text-zinc-400 focus:border-[var(--glk-brand)] focus:ring-1 focus:ring-[var(--glk-brand)]/20 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-200 dark:placeholder:text-zinc-500`})]}):(0,J.jsx)(`button`,{onClick:o,className:`flex h-8 w-8 items-center justify-center rounded-md border border-zinc-200 text-zinc-400 transition-colors hover:border-zinc-300 hover:text-zinc-600 dark:border-zinc-700 dark:hover:border-zinc-600 dark:hover:text-zinc-300`,title:`Search`,"aria-label":`Search`,children:(0,J.jsx)(_,{size:14})})}function tt(e,t){return t===`acs`?e.acs:t===`kd`?e.kills==null?null:e.kills/(e.deaths??1):t===`adr`?e.adr:null}function nt(e){if(e.length<2)return`stable`;let t=e.slice(-5),n=e.slice(-10,-5);if(n.length===0)return`stable`;let r=t.reduce((e,t)=>e+t,0)/t.length,i=n.reduce((e,t)=>e+t,0)/n.length;if(i===0)return`stable`;let a=(r-i)/i;return a>.05?`up`:a<-.05?`down`:`stable`}var rt={acs:`ACS`,kd:`K/D`,adr:`ADR`},it={up:`#22c55e`,down:`#ef4444`,stable:`#a1a1aa`};function at({recentStats:e,className:t}){let[n,r]=(0,q.useState)(`acs`),i=e.map(e=>tt(e,n)),a=[];i.forEach((e,t)=>{e!=null&&a.push(t)});let o=a.filter(t=>e[t].match.team1!=null&&e[t].match.team2!=null).map(t=>{let r=e[t],a=i[t],o=r.match.team1.id===r.teamId?r.match.team2.abbreviation??r.match.team2.name:r.match.team1.abbreviation??r.match.team1.name;return{value:Math.round(n===`kd`?a*100:a)/(n===`kd`?100:1),label:`${r.mapResult.mapName} vs ${o}`}}),s=nt(o.map(e=>e.value)),u=it[s],d=`trend-gradient-${n}`,f=s===`up`?l:s===`down`?c:O,p=s===`up`?`Trending up`:s===`down`?`Trending down`:`Stable`,m=s===`up`?`text-green-500`:s===`down`?`text-red-500`:`text-zinc-400`;return o.length<2?(0,J.jsxs)(`div`,{className:N(`glk-card bg-zinc-50 dark:bg-zinc-900`,t),children:[(0,J.jsx)(`div`,{className:`mb-3 flex items-center justify-between`,children:(0,J.jsx)(`div`,{className:`flex gap-0.5 rounded-md bg-zinc-100 p-0.5 dark:bg-zinc-800`,children:[`acs`,`kd`,`adr`].map(e=>(0,J.jsx)(`button`,{onClick:()=>r(e),"aria-pressed":n===e,className:N(`rounded px-2 py-0.5 text-xs font-semibold uppercase transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--glk-brand)] focus-visible:ring-offset-1`,n===e?`bg-white text-zinc-900 shadow-sm dark:bg-zinc-700 dark:text-zinc-100`:`text-zinc-400`),children:rt[e]},e))})}),(0,J.jsx)(`p`,{className:`text-sm text-zinc-400`,children:`Not enough data for trend`})]}):(0,J.jsxs)(`div`,{className:N(`glk-card bg-zinc-50 dark:bg-zinc-900`,t),children:[(0,J.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,J.jsx)(`div`,{className:`flex gap-0.5 rounded-md bg-zinc-100 p-0.5 dark:bg-zinc-800`,children:[`acs`,`kd`,`adr`].map(e=>(0,J.jsx)(`button`,{onClick:()=>r(e),className:N(`rounded px-2 py-0.5 text-xs font-semibold uppercase transition-colors`,n===e?`bg-white text-zinc-900 shadow-sm dark:bg-zinc-700 dark:text-zinc-100`:`text-zinc-400`),children:rt[e]},e))}),(0,J.jsxs)(`div`,{className:N(`flex items-center gap-1 text-xs font-semibold`,m),children:[(0,J.jsx)(f,{size:12,"aria-hidden":`true`}),(0,J.jsx)(`span`,{children:p})]})]}),(0,J.jsx)(`div`,{role:`img`,"aria-label":`${rt[n]} performance trend over ${o.length} maps — ${p}`,children:(0,J.jsx)(B,{width:`100%`,height:160,children:(0,J.jsxs)(U,{data:o,margin:{top:4,right:4,bottom:0,left:0},children:[(0,J.jsx)(`defs`,{children:(0,J.jsxs)(`linearGradient`,{id:d,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,J.jsx)(`stop`,{offset:`5%`,stopColor:u,stopOpacity:.3}),(0,J.jsx)(`stop`,{offset:`95%`,stopColor:u,stopOpacity:0})]})}),(0,J.jsx)(H,{hide:!0,domain:[`dataMin - 10`,`dataMax + 10`]}),(0,J.jsx)(_e,{contentStyle:{backgroundColor:`var(--color-card)`,border:`1px solid var(--color-border)`,borderRadius:`6px`,color:`var(--color-card-foreground)`,fontSize:`11px`},formatter:e=>{let t=typeof e==`number`?e:0;return[n===`kd`?t.toFixed(2):Math.round(t),rt[n]]},labelFormatter:(e,t)=>t&&t.length>0?t[0].payload.label:``}),(0,J.jsx)(V,{type:`monotone`,dataKey:`value`,stroke:u,strokeWidth:2,fill:`url(#${d})`,dot:!1,activeDot:{r:3,fill:u}})]})})})]})}var ot=y(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function Z({className:e,variant:t=`default`,render:n,...r}){return E({defaultTagName:`span`,props:h({className:N(ot({variant:t}),e)},r),render:n,state:{slot:`badge`,variant:t}})}var st=50;function ct({isLive:e,date:t}){return e?(0,J.jsxs)(`span`,{"data-testid":`match-log-live-badge`,className:`inline-flex items-center gap-1 rounded bg-red-500/10 px-1 py-0.5 text-[10px] font-bold uppercase tracking-wide text-red-500 dark:text-red-400`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`h-1.5 w-1.5 rounded-full bg-red-500 animate-pulse`}),`Live`]}):(0,J.jsx)(`span`,{className:`text-zinc-400 text-2xs sm:text-xs`,children:t})}function lt({recentStats:e,gameSlug:t}){let[n,r]=(0,q.useState)(st);(0,q.useEffect)(()=>{r(st)},[e.length]);let i=(0,q.useMemo)(()=>e.slice(0,n),[e,n]),a=e.length>n;return e.length===0?(0,J.jsx)(`p`,{className:`text-sm text-zinc-400`,children:`No recent maps available.`}):(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:`border-b border-zinc-200 dark:border-zinc-800`,children:[(0,J.jsx)(`th`,{className:`pb-2 text-left glk-eyebrow`,children:`Result`}),(0,J.jsx)(`th`,{className:`pb-2 text-left glk-eyebrow`,children:`Map`}),(0,J.jsx)(`th`,{className:`pb-2 text-left glk-eyebrow`,children:`Opponent`}),(0,J.jsx)(`th`,{className:`hidden sm:table-cell pb-2 text-left glk-eyebrow`,children:`Agent`}),(0,J.jsx)(`th`,{className:`hidden sm:table-cell pb-2 text-right glk-eyebrow`,children:`ACS`}),(0,J.jsx)(`th`,{className:`hidden sm:table-cell pb-2 text-right glk-eyebrow`,children:`K/D`})]})}),(0,J.jsx)(`tbody`,{children:i.map(e=>{let n=e.mapResult.winnerId!=null&&e.mapResult.winnerId===e.teamId,r=e.mapResult.winnerId===null,i=e.match.team1.id===e.teamId?e.match.team2:e.match.team1,a=i.abbreviation??i.name,o=!e.match.playedAt&&e.match.status===`live`,s=e.match.playedAt?new Date(e.match.playedAt).toLocaleDateString(`en-US`,{month:`short`,day:`numeric`}):``,c=e.kills!=null&&e.deaths!=null?e.deaths===0?`—`:(e.kills/e.deaths).toFixed(2):`—`;return(0,J.jsxs)(`tr`,{className:`border-b border-zinc-100 dark:border-zinc-800/50`,children:[(0,J.jsx)(`td`,{className:`py-2`,children:(0,J.jsx)(`span`,{className:N(`inline-flex h-5 w-5 items-center justify-center rounded text-xs font-bold`,r?`bg-zinc-100 text-zinc-400 dark:bg-zinc-800 dark:text-zinc-500`:n?`bg-[var(--glk-win)]/10 text-[var(--glk-win)]`:`bg-red-500/10 text-red-500`),children:r?`–`:n?`W`:`L`})}),(0,J.jsx)(`td`,{className:`py-2 text-zinc-700 dark:text-zinc-300`,children:(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,J.jsx)(R,{name:e.mapResult.mapName,variant:`thumbnail`,className:`!h-3.5 !w-6 rounded-[2px] opacity-60`}),(0,J.jsx)(`span`,{className:`hidden sm:inline`,children:e.mapResult.mapName})]})}),(0,J.jsx)(`td`,{className:`py-2 text-zinc-500`,children:e.match.id?(0,J.jsxs)(w,{to:`/${t}/matches/${e.match.id}`,className:`hover:underline hover:text-zinc-700 dark:hover:text-zinc-300 transition-colors`,children:[(0,J.jsx)(`span`,{className:`sm:hidden`,children:a}),(0,J.jsx)(`span`,{className:`hidden sm:inline`,children:i.name}),` `,(0,J.jsx)(ct,{isLive:o,date:s})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`sm:hidden`,children:a}),(0,J.jsx)(`span`,{className:`hidden sm:inline`,children:i.name}),` `,(0,J.jsx)(ct,{isLive:o,date:s})]})}),(0,J.jsx)(`td`,{className:`hidden sm:table-cell py-2 text-zinc-700 dark:text-zinc-300`,children:(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,J.jsx)(L,{name:e.agent??``,size:`xs`,showFallback:!1}),e.agent]})}),(0,J.jsx)(`td`,{className:`hidden sm:table-cell py-2 text-right glk-metric font-semibold text-zinc-900 dark:text-zinc-100`,children:e.acs??`—`}),(0,J.jsx)(`td`,{className:`hidden sm:table-cell py-2 text-right glk-metric text-zinc-700 dark:text-zinc-300`,children:c})]},e.id)})})]}),(0,J.jsxs)(`div`,{className:`mt-2 flex items-center justify-between`,children:[(0,J.jsxs)(`p`,{className:`text-xs text-zinc-400`,children:[n>=e.length?e.length:n,` of `,e.length,` `,Ge(e.length,`map`,`maps`)]}),a&&(0,J.jsx)(`button`,{onClick:()=>r(t=>Math.min(t+st,e.length)),className:`text-xs font-semibold text-[var(--glk-brand)] hover:underline`,children:`Show more`})]})]})}function ut({results:e,mapName:t}){if(e.length===0)return null;let n=e.filter(e=>e===`W`).length,r=e.slice(-10);return(0,J.jsx)(`div`,{className:`flex gap-px`,role:`img`,"aria-label":`Recent results on ${t}: ${n}W ${e.length-n}L`,children:r.map((e,t)=>(0,J.jsx)(`div`,{className:`h-2.5 w-1.5 rounded-[1px] ${e===`W`?`bg-emerald-500`:`bg-rose-500`}`,style:{opacity:.35+t/Math.max(r.length-1,1)*.65}},t))})}function dt({winRate:e,size:t=28}){let n=(t-3)/2,r=t/2,i=t/2,a=2*Math.PI*n,o=a*e,s=Math.round(e*100);return(0,J.jsxs)(`svg`,{width:t,height:t,viewBox:`0 0 ${t} ${t}`,className:`flex-shrink-0`,"aria-hidden":`true`,children:[(0,J.jsx)(`circle`,{cx:r,cy:i,r:n,fill:`none`,stroke:`currentColor`,strokeOpacity:`0.08`,strokeWidth:`2.5`}),(0,J.jsx)(`circle`,{cx:r,cy:i,r:n,fill:`none`,stroke:s>=50?`var(--glk-win)`:`var(--glk-loss)`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeDasharray:`${o} ${a}`,strokeDashoffset:a*.25,opacity:`0.7`}),(0,J.jsx)(`text`,{x:r,y:i+.5,textAnchor:`middle`,dominantBaseline:`middle`,className:`fill-zinc-600 dark:fill-zinc-300`,fontSize:`7`,fontWeight:`bold`,fontFamily:`var(--font-mono)`,children:s})]})}function ft({recentStats:e}){let t=(0,q.useMemo)(()=>{let t=new Map;for(let n of e){let e=n.mapResult.mapName,r=t.get(e)??{wins:0,losses:0,totalAcs:0,acsCount:0,results:[]},i=n.mapResult.winnerId!=null&&n.mapResult.winnerId===n.teamId;n.mapResult.winnerId!=null&&(i?(r.wins++,r.results.push(`W`)):(r.losses++,r.results.push(`L`))),n.acs!=null&&(r.totalAcs+=n.acs,r.acsCount++),t.set(e,r)}let n=[];for(let[e,r]of t){let t=r.wins+r.losses;n.push({mapName:e,wins:r.wins,losses:r.losses,total:t,winRate:t>0?r.wins/t:0,avgAcs:r.acsCount>0?Math.round(r.totalAcs/r.acsCount):0,results:r.results})}return n.sort((e,t)=>t.total-e.total)},[e]);return t.length===0?(0,J.jsx)(z,{icon:(0,J.jsx)(s,{size:24,strokeWidth:1.5,"aria-hidden":`true`}),message:`No map data yet`,submessage:`Map-specific performance will appear after matches are played.`}):(0,J.jsx)(`div`,{className:`space-y-1.5`,children:t.map(e=>{let t=e.winRate>=.7&&e.total>=3,n=e.winRate<=.3&&e.total>=3;return(0,J.jsxs)(`div`,{className:`group relative overflow-hidden rounded-lg border transition-colors ${t?`border-emerald-200/50 bg-emerald-50/30 dark:border-emerald-800/20 dark:bg-emerald-900/5`:n?`border-red-200/30 bg-red-50/20 dark:border-red-900/20 dark:bg-red-900/5`:`border-zinc-100 dark:border-zinc-800/50`}`,"aria-label":`${e.mapName}: ${e.wins}W ${e.losses}L, ACS ${e.avgAcs}${t?` (best map)`:n?` (worst map)`:``}`,children:[(0,J.jsx)(`div`,{className:`absolute inset-0 opacity-[0.03] dark:opacity-[0.05]`,children:(0,J.jsx)(R,{name:e.mapName,variant:`strip`,index:0,total:1})}),(0,J.jsxs)(`div`,{className:`relative flex items-center gap-2.5 px-3 py-2`,children:[(0,J.jsx)(dt,{winRate:e.winRate}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(`span`,{className:`glk-eyebrow text-zinc-700 dark:text-zinc-300`,children:e.mapName}),t&&(0,J.jsx)(`span`,{className:`rounded bg-emerald-100 px-1 py-0.5 text-[8px] font-bold uppercase text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400`,children:`Best`}),n&&(0,J.jsx)(`span`,{className:`rounded bg-red-100 px-1 py-0.5 text-[8px] font-bold uppercase text-red-600 dark:bg-red-900/30 dark:text-red-400`,children:`Worst`})]}),(0,J.jsx)(`div`,{className:`mt-0.5`,children:(0,J.jsx)(ut,{results:e.results,mapName:e.mapName})})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-3 text-right`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`glk-metric-sm text-zinc-700 dark:text-zinc-200`,children:e.avgAcs}),(0,J.jsx)(`div`,{className:`text-2xs text-zinc-400`,children:`ACS`})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`span`,{className:`glk-tabular text-xs text-zinc-500`,children:[(0,J.jsxs)(`span`,{className:`font-bold text-emerald-600 dark:text-emerald-400`,children:[e.wins,`W`]}),` `,(0,J.jsxs)(`span`,{className:`font-bold text-red-500 dark:text-red-400`,children:[e.losses,`L`]})]}),(0,J.jsxs)(`div`,{className:`text-2xs text-zinc-400`,children:[e.total,` `,Ge(e.total,`map`,`maps`)]})]})]})]})]},e.mapName)})})}function pt({fkRate:e,total:t}){let n=Math.round(e*100),r=Math.max(e*100,2),i=Math.max((1-e)*100,2);return(0,J.jsxs)(`div`,{className:`space-y-1`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between glk-eyebrow`,children:[(0,J.jsx)(`span`,{className:`text-emerald-600 dark:text-emerald-400`,children:`First Kills`}),(0,J.jsx)(`span`,{className:`text-red-500 dark:text-red-400`,children:`First Deaths`})]}),(0,J.jsxs)(`div`,{className:`flex h-5 gap-0.5 overflow-hidden rounded-md`,children:[(0,J.jsx)(`div`,{className:`flex items-center justify-end rounded-l-md bg-emerald-500/70 px-1.5 transition-all`,style:{width:`${r}%`},children:r>15&&(0,J.jsxs)(`span`,{className:`text-2xs font-bold text-white`,children:[n,`%`]})}),(0,J.jsx)(`div`,{className:`flex items-center rounded-r-md bg-red-500/50 px-1.5 transition-all`,style:{width:`${i}%`},children:i>15&&(0,J.jsxs)(`span`,{className:`text-2xs font-bold text-white`,children:[100-n,`%`]})})]}),(0,J.jsxs)(`div`,{className:`text-center text-2xs text-zinc-400`,children:[t,` opening duels`]})]})}function mt({diffs:e}){if(e.length<2)return null;let t=Math.max(Math.abs(Math.min(...e)),Math.abs(Math.max(...e)),1),n=e.length*6,r=e.filter(e=>e>0).length,i=e.filter(e=>e<0).length;return(0,J.jsxs)(`svg`,{width:`100%`,height:40,viewBox:`0 0 ${n} 40`,className:`overflow-visible`,role:`img`,"aria-label":`FK–FD per map: ${r} positive, ${i} negative across ${e.length} maps`,children:[(0,J.jsx)(`line`,{x1:`0`,y1:20,x2:n,y2:20,stroke:`currentColor`,strokeOpacity:`0.1`,strokeWidth:`1`}),e.map((n,r)=>{let i=r*6+3,a=Math.abs(n/t)*18,o=n>=0?20-a:20,s=n>=0?`#22c55e`:`#ef4444`;return(0,J.jsx)(`rect`,{x:i-1.5,y:o,width:`3`,height:Math.max(a,1),rx:`1`,fill:s,opacity:.3+r/e.length*.5},r)})]})}function ht({recentStats:e}){let t=(0,q.useMemo)(()=>{let t=0,n=0,r=0,i=0,a=0,o=0,s=0,c=[];for(let l of e)l.fk!=null&&l.fd!=null&&(t+=l.fk,n+=l.fd,c.push(l.fk-l.fd),r++),l.kills!=null&&l.deaths!=null&&(i+=l.kills,a+=l.deaths,o+=l.assists??0,s++);let l=t+n,u=l>0?t/l:.5,d=r>0?t/r:0,f=r>0?n/r:0,p=s>0?i/s:0,m=s>0?a/s:0,h=s>0?o/s:0,g=a>0?i/a:0,_=a>0?(i+o)/a:0,v=t-n;return{totalFk:t,totalFd:n,totalDuels:l,fkRate:u,avgFkPerMap:d,avgFdPerMap:f,avgKills:p,avgDeaths:m,avgAssists:h,kd:g,kda:_,fkDiff:v,diffs:c,fkMaps:r,kdMaps:s}},[e]);return t.fkMaps===0&&t.kdMaps===0?(0,J.jsx)(z,{icon:(0,J.jsx)(u,{size:24,strokeWidth:1.5,"aria-hidden":`true`}),message:`No impact data yet`,submessage:`Kill and opening-duel stats will appear after matches are logged.`}):(0,J.jsxs)(`div`,{className:`space-y-4`,children:[(0,J.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-3`,children:[{label:`Avg Kills`,value:t.avgKills.toFixed(1),color:`text-zinc-900 dark:text-zinc-100`},{label:`Avg Deaths`,value:t.avgDeaths.toFixed(1),color:`text-zinc-900 dark:text-zinc-100`},{label:`K/D`,value:t.kd.toFixed(2),color:t.kd>=1?`text-emerald-600 dark:text-emerald-400`:`text-red-500`},{label:`KDA`,value:t.kda.toFixed(2),color:`text-zinc-900 dark:text-zinc-100`}].map(e=>(0,J.jsxs)(`div`,{className:`rounded-lg bg-zinc-100/80 px-2.5 py-2 dark:bg-zinc-800/40`,children:[(0,J.jsx)(`div`,{className:`glk-eyebrow`,children:e.label}),(0,J.jsx)(`div`,{className:`glk-metric-md ${e.color}`,children:e.value})]},e.label))}),t.fkMaps>0&&(0,J.jsxs)(`div`,{className:`rounded-lg bg-zinc-100/80 p-3 dark:bg-zinc-800/40`,children:[(0,J.jsxs)(`div`,{className:`mb-2 flex items-center gap-1 glk-eyebrow`,children:[`Opening Duels`,(0,J.jsx)(Fe,{text:`First Kill vs First Death ratio across all maps. Higher FK% means this player wins more opening engagements.`})]}),(0,J.jsx)(pt,{fkRate:t.fkRate,total:t.totalDuels}),(0,J.jsx)(`div`,{className:`mt-3 flex items-center justify-between`,children:(0,J.jsxs)(`div`,{className:`flex gap-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`glk-metric-sm text-emerald-600 dark:text-emerald-400`,children:t.avgFkPerMap.toFixed(1)}),(0,J.jsx)(`div`,{className:`text-2xs text-zinc-400`,children:`FK/map`})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`glk-metric-sm text-red-500`,children:t.avgFdPerMap.toFixed(1)}),(0,J.jsx)(`div`,{className:`text-2xs text-zinc-400`,children:`FD/map`})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`div`,{className:`glk-metric-sm ${t.fkDiff>=0?`text-emerald-600 dark:text-emerald-400`:`text-red-500`}`,children:[t.fkDiff>=0?`+`:``,t.fkDiff]}),(0,J.jsx)(`div`,{className:`text-2xs text-zinc-400`,children:`FK diff`})]})]})}),t.diffs.length>2&&(0,J.jsxs)(`div`,{className:`mt-3`,children:[(0,J.jsx)(`div`,{className:`text-2xs text-zinc-400 mb-1`,children:`FK–FD per map (recent →)`}),(0,J.jsx)(mt,{diffs:t.diffs.slice().reverse()})]})]})]})}var gt={Jett:`Duelist`,Raze:`Duelist`,Reyna:`Duelist`,Phoenix:`Duelist`,Yoru:`Duelist`,Neon:`Duelist`,Iso:`Duelist`,Waylay:`Duelist`,Omen:`Controller`,Brimstone:`Controller`,Astra:`Controller`,Viper:`Controller`,Harbor:`Controller`,Clove:`Controller`,Sage:`Sentinel`,Cypher:`Sentinel`,Killjoy:`Sentinel`,Chamber:`Sentinel`,Deadlock:`Sentinel`,Vyse:`Sentinel`,Sova:`Initiator`,Breach:`Initiator`,Skye:`Initiator`,Kayo:`Initiator`,Fade:`Initiator`,Gekko:`Initiator`,Tejo:`Initiator`},_t={Duelist:`#ef4444`,Controller:`#3b82f6`,Sentinel:`#22c55e`,Initiator:`#f59e0b`};function vt({agents:e,size:t=80}){let n=t/2,r=t/2,i=(t-8)/2,a=2*Math.PI*i,o=-a*.25,s=e.map(e=>`${e.agent} ${Math.round(e.pct*100)}%`).join(`, `);return(0,J.jsxs)(`svg`,{width:t,height:t,viewBox:`0 0 ${t} ${t}`,className:`flex-shrink-0`,role:`img`,"aria-label":`Agent usage ring: ${s}`,children:[e.map(e=>{let t=a*e.pct,s=(0,J.jsx)(`circle`,{cx:n,cy:r,r:i,fill:`none`,stroke:_t[gt[e.agent]??`Duelist`]??`#71717a`,strokeWidth:`5`,strokeLinecap:`round`,strokeDasharray:`${Math.max(t-2,1)} ${a-Math.max(t-2,1)}`,strokeDashoffset:-o,opacity:`0.65`},e.agent);return o+=t,s}),(0,J.jsx)(`text`,{x:n,y:r-3,textAnchor:`middle`,dominantBaseline:`middle`,className:`fill-zinc-800 dark:fill-zinc-200`,fontSize:`16`,fontWeight:`900`,children:e.length}),(0,J.jsx)(`text`,{x:n,y:r+10,textAnchor:`middle`,dominantBaseline:`middle`,className:`fill-zinc-400`,fontSize:`8`,fontWeight:`600`,children:`AGENTS`})]})}function yt({recentStats:e}){let t=(0,q.useMemo)(()=>{let t=new Map;for(let n of e){if(!n.agent)continue;let e=t.get(n.agent)??{maps:0,totalAcs:0,acsCount:0,totalKills:0,totalDeaths:0,kdCount:0,wins:0};e.maps++,n.acs!=null&&(e.totalAcs+=n.acs,e.acsCount++),n.kills!=null&&n.deaths!=null&&(e.totalKills+=n.kills,e.totalDeaths+=n.deaths,e.kdCount++),n.mapResult.winnerId===n.teamId&&e.wins++,t.set(n.agent,e)}let n=e.filter(e=>e.agent).length,r=[];for(let[e,i]of t)r.push({agent:e,maps:i.maps,pct:n>0?i.maps/n:0,avgAcs:i.acsCount>0?Math.round(i.totalAcs/i.acsCount):0,avgKd:i.kdCount>0&&i.totalDeaths>0?i.totalKills/i.totalDeaths:null,winRate:i.maps>0?i.wins/i.maps:0,wins:i.wins,losses:i.maps-i.wins});return r.sort((e,t)=>t.maps-e.maps)},[e]);if(t.length===0)return(0,J.jsx)(z,{icon:(0,J.jsx)(C,{size:24,strokeWidth:1.5,"aria-hidden":`true`}),message:`No agent data yet`,submessage:`Stats will appear once this player has logged a map.`});let n=t[0],r=t.filter(e=>e.maps>=3).length;return(0,J.jsxs)(`div`,{className:`space-y-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,J.jsx)(vt,{agents:t}),(0,J.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(L,{name:n.agent,size:`lg`}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`text-sm font-black text-zinc-900 dark:text-zinc-100`,children:n.agent}),(0,J.jsxs)(`div`,{className:`text-2xs text-zinc-400`,children:[`Primary — `,Math.round(n.pct*100),`% pick rate`]})]})]}),(0,J.jsxs)(`div`,{className:`mt-1.5 flex gap-2`,children:[(0,J.jsx)(`span`,{className:`rounded bg-zinc-100 px-1.5 py-0.5 text-2xs font-bold text-zinc-600 dark:bg-zinc-800 dark:text-zinc-300`,children:r>=4?`Flex player`:r>=2?`${r}-agent pool`:`One-trick`}),n.pct>=.6&&(0,J.jsx)(`span`,{className:`rounded bg-amber-100 px-1.5 py-0.5 text-2xs font-bold text-amber-700 dark:bg-amber-900/30 dark:text-amber-400`,children:`Specialist`})]})]})]}),(0,J.jsxs)(`div`,{className:`space-y-1`,children:[t.map(e=>{let t=_t[gt[e.agent]??`Duelist`]??`#71717a`,n=e.avgKd==null?``:`K/D ${e.avgKd.toFixed(2)}`;return(0,J.jsxs)(`div`,{className:`relative flex items-center gap-2 rounded-md px-2 py-1.5 overflow-hidden`,role:`row`,"aria-label":`${e.agent}: ${Math.round(e.pct*100)}% pick rate, ACS ${e.avgAcs}${n?`, `+n:``}, ${e.maps} maps`,children:[(0,J.jsx)(`div`,{className:`absolute inset-0 rounded-md`,style:{width:`${Math.max(e.pct*100,3)}%`,backgroundColor:t,opacity:.06}}),(0,J.jsx)(L,{name:e.agent,size:`sm`,className:`relative z-10`}),(0,J.jsx)(`span`,{className:`relative z-10 w-12 sm:w-16 truncate text-xs font-semibold text-zinc-700 dark:text-zinc-300`,children:e.agent}),(0,J.jsx)(`div`,{className:`relative z-10 flex-1 min-w-0 h-2 rounded-full bg-zinc-200/60 dark:bg-zinc-700/30 overflow-hidden`,children:(0,J.jsx)(`div`,{className:`h-full rounded-full`,style:{width:`${Math.max(e.pct*100,3)}%`,backgroundColor:t,opacity:.6}})}),(0,J.jsxs)(`span`,{className:`relative z-10 w-8 text-right glk-metric-sm text-zinc-500`,children:[Math.round(e.pct*100),`%`]}),(0,J.jsx)(`span`,{className:`relative z-10 hidden sm:inline w-8 text-right glk-metric-sm text-zinc-700 dark:text-zinc-300`,children:e.avgAcs}),(0,J.jsx)(`span`,{className:N(`relative z-10 hidden sm:inline w-8 text-right glk-metric-sm`,e.avgKd!=null&&e.avgKd>=1?`text-emerald-600 dark:text-emerald-400`:`text-red-500`),children:e.avgKd==null?`—`:e.avgKd.toFixed(2)}),(0,J.jsx)(`span`,{className:`relative z-10 w-7 text-right glk-tabular text-2xs text-zinc-400`,children:e.maps})]},e.agent)}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2 px-2 glk-eyebrow`,children:[(0,J.jsx)(`span`,{className:`w-5`}),(0,J.jsx)(`span`,{className:`w-12 sm:w-16`}),(0,J.jsx)(`span`,{className:`flex-1 text-center`,children:`Usage`}),(0,J.jsx)(`span`,{className:`w-8 text-right`,children:`%`}),(0,J.jsx)(`span`,{className:`hidden sm:inline w-8 text-right`,children:`ACS`}),(0,J.jsx)(`span`,{className:`hidden sm:inline w-8 text-right`,children:`K/D`}),(0,J.jsx)(`span`,{className:`w-7 text-right`,children:`Maps`})]})]})]})}function bt({recentStats:e}){let t=(0,q.useMemo)(()=>{let t=new Map;for(let n of e){let e=n.match.team1?.id===n.teamId?n.match.team2:n.match.team1;if(!e)continue;let r=t.get(e.id)??{name:e.name,maps:0,wins:0,totalAcs:0,acsCount:0,totalKills:0,totalDeaths:0,kdCount:0};r.maps++,n.mapResult.winnerId===n.teamId&&r.wins++,n.acs!=null&&(r.totalAcs+=n.acs,r.acsCount++),n.kills!=null&&n.deaths!=null&&(r.totalKills+=n.kills,r.totalDeaths+=n.deaths,r.kdCount++),t.set(e.id,r)}let n=[];for(let[,e]of t)e.maps<2||n.push({name:e.name,maps:e.maps,wins:e.wins,losses:e.maps-e.wins,winRate:e.maps>0?e.wins/e.maps:0,avgAcs:e.acsCount>0?Math.round(e.totalAcs/e.acsCount):0,avgKd:e.kdCount>0&&e.totalDeaths>0?e.totalKills/e.totalDeaths:null});return n.sort((e,t)=>t.maps-e.maps).slice(0,8)},[e]);if(t.length===0)return(0,J.jsx)(z,{icon:(0,J.jsx)(n,{size:24,strokeWidth:1.5,"aria-hidden":`true`}),message:`Not enough opponent data`,submessage:`Requires matches against the same opponent 2+ times.`});let r=t.filter(e=>e.maps>=3),i=r.length>0?r.reduce((e,t)=>e.winRate<t.winRate?e:t):null,a=r.length>0?r.reduce((e,t)=>e.winRate>t.winRate?e:t):null;return(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(i||a)&&(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2 mb-1`,children:[a&&a.winRate>=.6&&(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-emerald-100 px-1.5 py-0.5 text-2xs font-bold text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400`,children:[`Dominates vs `,a.name,(0,J.jsxs)(`span`,{className:`text-emerald-500`,children:[Math.round(a.winRate*100),`%`]})]}),i&&i.winRate<=.4&&(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-red-100 px-1.5 py-0.5 text-2xs font-bold text-red-600 dark:bg-red-900/30 dark:text-red-400`,children:[`Struggles vs `,i.name,(0,J.jsxs)(`span`,{className:`text-red-500`,children:[Math.round(i.winRate*100),`%`]})]})]}),(0,J.jsxs)(`div`,{className:`space-y-1`,children:[t.map(e=>(0,J.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md px-2 py-1.5`,role:`row`,"aria-label":`vs ${e.name}: ${e.wins}W ${e.losses}L (${Math.round(e.winRate*100)}% win rate), ACS ${e.avgAcs}`,children:[(0,J.jsx)(`span`,{className:`w-20 sm:w-28 truncate text-xs font-semibold text-zinc-700 dark:text-zinc-300`,children:e.name}),(0,J.jsxs)(`div`,{className:`flex-1 min-w-0 h-3 rounded-full bg-zinc-200/60 dark:bg-zinc-700/30 overflow-hidden flex`,"aria-hidden":`true`,children:[(0,J.jsx)(`div`,{className:`h-full bg-emerald-500/60 transition-all`,style:{width:`${e.winRate*100}%`}}),(0,J.jsx)(`div`,{className:`h-full bg-red-500/40 transition-all`,style:{width:`${(1-e.winRate)*100}%`}})]}),(0,J.jsxs)(`span`,{className:`w-10 sm:w-12 text-right text-2xs tabular-nums text-zinc-500`,children:[(0,J.jsxs)(`span`,{className:`font-bold text-emerald-600 dark:text-emerald-400`,children:[e.wins,`W`]}),` `,(0,J.jsxs)(`span`,{className:`font-bold text-red-500`,children:[e.losses,`L`]})]}),(0,J.jsx)(`span`,{className:`hidden sm:inline w-8 text-right glk-metric-sm text-zinc-700 dark:text-zinc-200`,children:e.avgAcs}),(0,J.jsx)(`span`,{className:`hidden sm:inline w-8 text-right glk-metric-sm text-zinc-500`,children:e.avgKd==null?`—`:e.avgKd.toFixed(2)})]},e.name)),(0,J.jsxs)(`div`,{className:`flex items-center gap-2 px-2 glk-eyebrow`,children:[(0,J.jsx)(`span`,{className:`w-20 sm:w-28`,children:`Opponent`}),(0,J.jsx)(`span`,{className:`flex-1 text-center`,children:`Win Rate`}),(0,J.jsx)(`span`,{className:`w-10 sm:w-12 text-right`,children:`Record`}),(0,J.jsx)(`span`,{className:`hidden sm:inline w-8 text-right`,children:`ACS`}),(0,J.jsx)(`span`,{className:`hidden sm:inline w-8 text-right`,children:`K/D`})]})]})]})}function xt(e,t){return de(ie.playerSentiment,{gameSlug:e,playerSlug:t},{enabled:!!t})}function St(e){let t=e.toLowerCase().replace(/[\s-]+/g,`_`);return t.includes(`favorite`)||t.includes(`favourite`)?d:t.includes(`clutch`)?i:t.includes(`rising`)?l:t.includes(`villain`)||t.includes(`liability`)?m:t.includes(`washed`)?o:t.includes(`inconsistent`)?r:t.includes(`underrated`)?T:t.includes(`overhyped`)?a:t.includes(`leader`)?D:t.includes(`neutral`)?n:b}function Ct(e){let t=e.toLowerCase().replace(/[\s-]+/g,`_`);return t.includes(`favorite`)||t.includes(`favourite`)||t.includes(`clutch`)||t.includes(`rising`)||t.includes(`underrated`)||t.includes(`leader`)?`text-emerald-500 dark:text-emerald-400`:t.includes(`villain`)||t.includes(`liability`)||t.includes(`washed`)||t.includes(`overhyped`)||t.includes(`inconsistent`)?`text-rose-500 dark:text-rose-400`:`text-zinc-400 dark:text-zinc-500`}function wt(e){let t=e.toLowerCase().replace(/[\s-]+/g,`_`);return t.includes(`favorite`)||t.includes(`favourite`)||t.includes(`clutch`)||t.includes(`rising`)||t.includes(`underrated`)||t.includes(`leader`)?`bg-emerald-500/70 dark:bg-emerald-500/60`:t.includes(`villain`)||t.includes(`liability`)||t.includes(`washed`)||t.includes(`overhyped`)||t.includes(`inconsistent`)?`bg-rose-500/70 dark:bg-rose-500/60`:`bg-zinc-400/60 dark:bg-zinc-500/50`}function Tt(e){return e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function Et(e){return e.replace(/_/g,` `).toLowerCase()}function Dt(e){return e>=.6?`Community Icon`:e>=.35?`Highly Rated`:e>=.15?`Gaining Hype`:e>-.15?`Mixed Opinions`:e>-.35?`Under Fire`:e>-.6?`Struggling`:`Fan Villain`}function Ot(e){return e>=.35?`text-emerald-400 bg-emerald-500/10 border-emerald-500/20`:e>=.15?`text-emerald-500/80 bg-emerald-500/5 border-emerald-500/10`:e>-.15?`text-zinc-400 bg-zinc-500/10 border-zinc-500/20`:e>-.35?`text-rose-500/80 bg-rose-500/5 border-rose-500/10`:`text-rose-400 bg-rose-500/10 border-rose-500/20`}function kt({score:e,delta:t,verdict:n,verdictCls:r}){let i=e>=0,a=t>=0,o=a?l:c;return(0,J.jsxs)(`div`,{className:N(`flex items-center gap-4 rounded-xl border px-4 py-3`,r),children:[(0,J.jsxs)(`div`,{className:`flex-shrink-0 text-center`,children:[(0,J.jsxs)(`div`,{className:`glk-metric glk-metric-xl leading-none`,children:[i?`+`:``,e.toFixed(2)]}),(0,J.jsx)(`div`,{className:`mt-0.5 glk-eyebrow opacity-70`,children:`sentiment`})]}),(0,J.jsx)(`div`,{className:`h-10 w-px bg-current opacity-20`}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`text-sm font-black uppercase tracking-wide leading-tight`,children:n}),(0,J.jsxs)(`div`,{className:`mt-1 flex items-center gap-1 text-xs font-medium opacity-75`,children:[(0,J.jsx)(o,{size:11,"aria-hidden":`true`}),(0,J.jsxs)(`span`,{children:[a?`+`:``,t.toFixed(2),` vs prior 7d`]})]})]})]})}function At({label:e,count:t,maxCount:n}){let r=St(e),i=Ct(e),a=wt(e),o=n>0?t/n*100:0;return(0,J.jsxs)(`div`,{className:`flex items-center gap-2 py-1`,children:[(0,J.jsx)(r,{size:12,className:N(`flex-shrink-0`,i),"aria-hidden":`true`}),(0,J.jsx)(`span`,{className:N(`w-28 flex-shrink-0 text-xs font-semibold`,i),children:Tt(e)}),(0,J.jsx)(`div`,{className:`flex h-2 flex-1 overflow-hidden rounded-full bg-zinc-100 dark:bg-zinc-800`,children:(0,J.jsx)(`div`,{className:N(`h-full rounded-full transition-all`,a),style:{width:`${o}%`}})}),(0,J.jsx)(`span`,{className:`w-5 flex-shrink-0 text-right text-xs font-bold tabular-nums text-zinc-500 dark:text-zinc-400`,children:t})]})}function jt(){return(0,J.jsxs)(`div`,{className:`space-y-4`,children:[(0,J.jsx)(G,{className:`h-[72px] rounded-xl`}),(0,J.jsx)(W,{count:3,className:`h-6`})]})}function Mt({gameSlug:e,playerSlug:t}){let{data:r,isLoading:i,isError:a}=xt(e,t);if(i)return(0,J.jsx)(jt,{});if(a)return(0,J.jsx)(z,{icon:(0,J.jsx)(n,{size:22,strokeWidth:1.5,"aria-hidden":`true`}),message:`Couldn't load reputation data`});if(!r||r.mentionCount===0)return(0,J.jsx)(z,{icon:(0,J.jsx)(n,{size:22,strokeWidth:1.5,"aria-hidden":`true`}),message:`No community signals yet`,submessage:`Reputation builds as the community talks about this player`});let{currentSentiment:o,delta:s,mentionCount:c,topLabel:l,labels:u,topThemes:d}=r,f=Dt(o),p=Ot(o),m=u.slice(0,5),h=m.reduce((e,t)=>Math.max(e,t.count),0);return(0,J.jsxs)(`div`,{className:`space-y-4`,children:[(0,J.jsx)(`div`,{className:`flex items-center justify-between px-0.5`,children:(0,J.jsx)(`span`,{className:`glk-eyebrow`,children:`Community scouting report · last 7d`})}),(0,J.jsx)(kt,{score:o,delta:s,verdict:f,verdictCls:p}),l&&(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`glk-eyebrow`,children:`Top Label`}),(0,J.jsx)(`span`,{className:N(`glk-eyebrow rounded-full border px-2 py-0.5`,p),children:Tt(l)})]}),m.length>0&&(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`mb-1.5 glk-eyebrow`,children:`Reputation Labels`}),(0,J.jsx)(`div`,{className:`space-y-0.5`,children:m.map(e=>(0,J.jsx)(At,{label:e.label,count:e.count,maxCount:h},e.label))})]}),d.length>0&&(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`mb-1.5 glk-eyebrow`,children:`Recurring Themes`}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:d.map(e=>(0,J.jsx)(`span`,{className:`rounded-full bg-zinc-100 px-2.5 py-0.5 text-xs font-medium text-zinc-500 dark:bg-zinc-800 dark:text-zinc-400`,children:Et(e.theme)},e.theme))})]}),(0,J.jsxs)(`p`,{className:`text-2xs text-zinc-400 dark:text-zinc-600`,children:[`Based on `,c,` community signal`,c===1?``:`s`]})]})}function Nt({status:e,isCoach:t,className:n}){return t?(0,J.jsx)(Z,{variant:`secondary`,className:N(`bg-teal-100 text-teal-700 dark:bg-teal-900/40 dark:text-teal-300 text-xs px-1.5 py-0 font-semibold`,n),children:`Coach`}):e===`active`?null:e===`free_agent`?(0,J.jsx)(Z,{variant:`secondary`,className:N(`bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300 text-xs px-1.5 py-0 font-semibold`,n),children:`Free Agent`}):e===`reserve`?(0,J.jsx)(Z,{variant:`secondary`,className:N(`bg-slate-100 text-slate-600 dark:bg-slate-800/60 dark:text-slate-300 text-xs px-1.5 py-0 font-semibold`,n),children:`Reserve`}):e===`inactive`?(0,J.jsx)(Z,{variant:`secondary`,className:N(`bg-zinc-100 text-zinc-500 dark:bg-zinc-800 dark:text-zinc-400 text-xs px-1.5 py-0 font-semibold`,n),children:`Inactive`}):e===`retired`?(0,J.jsx)(Z,{variant:`secondary`,className:N(`bg-zinc-200 text-zinc-600 dark:bg-zinc-700 dark:text-zinc-400 text-xs px-1.5 py-0 font-semibold`,n),children:`Retired`}):(0,J.jsx)(Z,{variant:`outline`,className:N(`text-xs px-1.5 py-0 font-semibold`,n),children:e})}var Pt=[{id:`last20`,label:`Last 20`,count:20},{id:`last50`,label:`Last 50`,count:50},{id:`career`,label:`Career`,count:2e3}];function Q({label:e,value:t}){return(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`glk-eyebrow`,children:e}),(0,J.jsx)(`div`,{className:`glk-metric text-lg sm:text-2xl font-bold text-zinc-900 dark:text-zinc-100`,children:t})]})}function $(e,t=0){return e==null?`—`:t>0?e.toFixed(t):Math.round(e).toString()}function Ft(e){if(e.length===0)return null;let t=0,n=0,r=0,i=0,a=0,o=0,s=0,c=0,l=0,u=0,d=0,f=0;for(let p of e)p.acs!=null&&(t+=p.acs,n++),p.kills!=null&&p.deaths!=null&&(r+=p.kills,i+=p.deaths,a++),p.adr!=null&&(o+=p.adr,s++),p.kast!=null&&p.kast>=0&&p.kast<=1&&(c+=p.kast,l++),p.hsPct!=null&&p.hsPct>=0&&p.hsPct<=1&&(u+=p.hsPct,d++),p.mapResult.winnerId===p.teamId&&f++;return{avgAcs:n>0?t/n:null,avgKd:a>0&&i>0?r/i:null,avgAdr:s>0?o/s:null,avgKast:l>0?c/l:null,avgHsPct:d>0?u/d:null,maps:e.length,wins:f,losses:e.length-f,winRate:e.length>0?f/e.length:null}}function It(){let{gameSlug:e,playerSlug:t}=v(),[n,r]=(0,q.useState)(`last20`),i=Pt.find(e=>e.id===n).count,{data:a,isLoading:o,isFetching:s,isError:c,error:l,refetch:u}=pe(e,t,i),{isWatching:d,addToWatchlist:f,removeFromWatchlist:p,getPageWidgetConfig:m,updatePageWidgetConfig:h}=M(),{data:g}=fe(e,t),[_,ee]=(0,q.useState)(!1);ue(a?.ign);let y=(0,q.useMemo)(()=>{if(!a)return[];let e=Pt.find(e=>e.id===n).count;return a.recentStats.slice(0,e)},[a,n]),b=(0,q.useMemo)(()=>Ft(y),[y]),x=(0,q.useMemo)(()=>({gameSlug:e??``,playerSlug:t}),[e,t]),S=(0,q.useMemo)(()=>{let r=[];y.length>1&&r.push({key:`performanceTrend`,title:`Performance Trend — ${Pt.find(e=>e.id===n).label} (${y.length} ${Ge(y.length,`map`,`maps`)})`,size:`lg`,component:(0,J.jsx)(at,{recentStats:y})}),y.length>0&&r.push({key:`agentPool`,title:`Agent Pool`,size:`sm`,component:(0,J.jsx)(yt,{recentStats:y})},{key:`impact`,title:`Impact & Opening Duels`,size:`md`,component:(0,J.jsx)(ht,{recentStats:y})},{key:`mapPerformance`,title:`Map Performance`,size:`sm`,component:(0,J.jsx)(ft,{recentStats:y})},{key:`headToHead`,title:`Head to Head`,size:`sm`,component:(0,J.jsx)(bt,{recentStats:y})}),r.push({key:`reputation`,title:`Community Reputation`,size:`sm`,component:(0,J.jsx)(Mt,{gameSlug:e,playerSlug:t})});let i=P(`playerAgentPool`);i&&r.push({key:i.id,title:i.title,size:i.size??`sm`,component:(0,J.jsx)(De,{def:i,ctx:x})});let o=P(`playerRatingTrend`);return o&&r.push({key:o.id,title:o.title,size:o.size??`sm`,component:(0,J.jsx)(De,{def:o,ctx:x})}),!a?.isStaff&&g&&g.length>1&&r.push({key:`ratingHistory`,title:`Rating History`,size:`lg`,component:(0,J.jsx)(Ie,{history:g,currentRank:a?.rating?.rank})}),y.length>0&&r.push({key:`matchLog`,title:`Match Log (${y.length})`,size:`lg`,component:(0,J.jsx)(lt,{recentStats:y,gameSlug:e})}),r},[y,g,a?.rating?.rank,a?.isStaff,n,e,t,x]),C=`playerProfile`,T=m(C,{order:(0,q.useMemo)(()=>S.map(e=>e.key),[S]),sizes:{}}),E=(0,q.useMemo)(()=>{let e=new Map(S.map(e=>[e.key,e])),t=new Set(T.hidden),n=T.order.map(t=>e.get(t)).filter(e=>!!e&&!t.has(e.key)),r=new Set(n.map(e=>e.key)),i=S.filter(e=>!r.has(e.key)&&!t.has(e.key));return[...n,...i]},[S,T.order,T.hidden]),D=e=>{h(C,{order:e})},O=e=>{h(C,{hidden:[...T.hidden,e]})};if(c&&l instanceof te)return(0,J.jsx)(Le,{entityType:`player`,gameSlug:e});if(o||c||!a)return(0,J.jsx)(se,{title:`Player`,breadcrumbs:[{label:`Players`,href:`/${e}/players`}],className:`flex h-full flex-col overflow-hidden`,loadingKind:`detail`,emptyMessage:`Player not found.`,status:{isLoading:o,isError:c,error:c?Error(`Failed to load player`):null,isEmpty:!o&&!c&&!a,retry:()=>void u()},children:(0,J.jsx)(`div`,{})});let k=I(a.country),A=a.role?a.role.charAt(0).toUpperCase()+a.role.slice(1).toLowerCase():null,j=a.role?Ue(a.role):null,re=ye(e),ie=a.team?`${a.ign} — ${a.team.name}`:`${a.ign} — ${re} Player`,ae=[`${a.ign}${a.realName?` (${a.realName})`:``} — ${re} ${A??`player`}${a.team?` for ${a.team.name}`:``}.`,a.careerAvgAcs==null?null:`Career ACS ${Math.round(a.careerAvgAcs)}.`,`Stats, agent pool, and match log on Glicko.`].filter(Boolean).join(` `),de=le({name:a.ign,url:typeof window<`u`?window.location.href:`https://glicko.app/${e}/players/${a.slug}`,alternateName:a.realName??void 0,nationality:a.country??void 0,affiliation:a.team?{name:a.team.name,url:`https://glicko.app/${e}/teams/${a.team.slug}`}:void 0});return(0,J.jsxs)(se,{title:`${k?k+` `:``}${a.ign}`,breadcrumbs:[{label:`Players`,href:`/${e}/players`}],seo:{title:ie,description:ae,image:ve(e??`valorant`,`player`,a.slug),type:`profile`},actions:(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(Ce,{entry:{type:`player`,slug:a.slug,name:a.ign},isWatching:d(a.slug),onAdd:f,onRemove:p}),(0,J.jsx)(be,{editing:_,onToggle:()=>ee(e=>!e)})]}),tabs:_?(0,J.jsx)(Se,{}):void 0,className:`flex h-full flex-col overflow-hidden`,children:[(0,J.jsx)(ce,{data:de}),(0,J.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:(0,J.jsxs)(`div`,{className:`mx-auto max-w-5xl`,children:[(0,J.jsxs)(`div`,{className:`glk-card mb-6`,children:[(0,J.jsxs)(`div`,{className:`mb-4 flex gap-3 sm:gap-4`,children:[a.avatarUrl?(0,J.jsx)(`img`,{src:a.avatarUrl.startsWith(`//`)?`https:${a.avatarUrl}`:a.avatarUrl,alt:a.ign,className:`h-16 w-16 rounded-full object-cover ring-2 ring-zinc-200 dark:ring-zinc-700 flex-shrink-0`}):(0,J.jsx)(`div`,{role:`img`,"aria-label":a.ign,className:`flex h-16 w-16 items-center justify-center rounded-full bg-zinc-200 text-xl font-bold text-zinc-500 ring-2 ring-zinc-200 dark:bg-zinc-800 dark:text-zinc-400 dark:ring-zinc-700 flex-shrink-0`,children:a.ign.charAt(0).toUpperCase()}),(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 sm:gap-2`,children:[(0,J.jsxs)(`h2`,{className:`text-xl sm:text-2xl font-black text-zinc-900 dark:text-zinc-100`,children:[k&&(0,J.jsx)(`span`,{className:`mr-1.5`,children:k}),a.ign]}),a.gcdVerified&&(0,J.jsx)(Pe,{}),A&&j&&(0,J.jsx)(Z,{variant:`secondary`,className:`${j} text-xs px-1.5 py-0 font-semibold`,children:A}),(0,J.jsx)(Nt,{status:a.status}),!a.isStaff&&a.rating&&(0,J.jsx)(F,{rating:Math.round(a.rating.rating),rd:Math.round(a.rating.rd)})]}),(0,J.jsxs)(`p`,{className:`mt-0.5 text-sm text-zinc-400`,children:[[a.realName,a.country].filter(Boolean).join(` · `),a.team&&(0,J.jsxs)(`span`,{children:[` · `,(0,J.jsx)(w,{to:`/${e}/teams/${a.team.slug}`,className:`text-[var(--glk-brand)] hover:underline`,children:a.team.name})]})]}),a.gcdVerified&&(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(`span`,{className:N(ne(`vct`),`rounded px-1.5 py-0 text-2xs font-bold uppercase tracking-widest`),children:oe(`vct`)}),a.residentStatus&&(0,J.jsx)(`span`,{className:`text-xs text-zinc-400`,children:a.residentStatus}),a.contractEndDate&&(0,J.jsxs)(`span`,{className:`text-xs text-zinc-500`,children:[`Contract through `,new Date(a.contractEndDate).getFullYear()]})]})]})]}),(0,J.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-2`,children:[(0,J.jsx)(`div`,{className:`flex gap-0.5 rounded-md bg-zinc-100 p-0.5 dark:bg-zinc-800`,children:Pt.map(e=>(0,J.jsxs)(`button`,{onClick:()=>r(e.id),"aria-pressed":n===e.id,className:N(`rounded px-2 py-1 text-xs sm:px-2.5 sm:text-xs font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--glk-brand)] focus-visible:ring-offset-1`,n===e.id?`bg-white text-zinc-900 shadow-sm dark:bg-zinc-700 dark:text-zinc-100`:`text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-300`),children:[e.label,e.id===n&&s&&!o&&(0,J.jsx)(`span`,{className:`ml-1 inline-block h-2 w-2 animate-pulse rounded-full bg-zinc-400`})]},e.id))}),b&&(0,J.jsxs)(`div`,{className:`flex items-center gap-1 sm:gap-1.5 text-2xs sm:text-xs text-zinc-500`,children:[(0,J.jsx)(`span`,{className:`font-semibold text-zinc-600 dark:text-zinc-300`,children:b.maps}),` `,Ge(b.maps,`map`,`maps`),typeof a.recentStatsTotal==`number`&&a.recentStatsTotal>b.maps&&(0,J.jsxs)(`span`,{className:`text-zinc-400`,children:[`of `,a.recentStatsTotal,` career`]}),(0,J.jsx)(`span`,{className:`text-zinc-400`,children:`·`}),(0,J.jsxs)(`span`,{className:N(`font-semibold`,b.winRate&&b.winRate>=.5?`text-emerald-600 dark:text-emerald-400`:`text-zinc-600 dark:text-zinc-300`),children:[b.wins,`W–`,b.losses,`L`]}),b.winRate!=null&&(0,J.jsxs)(`span`,{className:`text-zinc-400`,children:[`(`,Math.round(b.winRate*100),`%)`]})]})]}),(0,J.jsxs)(`div`,{className:N(`grid grid-cols-3 gap-2 sm:grid-cols-5 sm:gap-4 md:flex md:flex-wrap md:gap-6 transition-opacity`,s&&!o&&`opacity-50`),children:[(0,J.jsx)(Q,{label:`ACS`,value:$(b?b.avgAcs:a.careerAvgAcs)}),(0,J.jsx)(Q,{label:`K/D`,value:$(b?b.avgKd:a.careerAvgKd,2)}),(0,J.jsx)(Q,{label:`ADR`,value:$(b?b.avgAdr:a.careerAvgAdr)}),(0,J.jsx)(Q,{label:`KAST`,value:b?.avgKast==null?a.careerAvgKast==null?`—`:`${$(a.careerAvgKast*100)}%`:`${$(b.avgKast*100)}%`}),(0,J.jsx)(Q,{label:`HS%`,value:b?.avgHsPct==null?a.careerAvgHsPct==null?`—`:`${$(a.careerAvgHsPct*100)}%`:`${$(b.avgHsPct*100)}%`})]})]}),(0,J.jsx)(xe,{widgets:E,columns:3,editing:_,onReorder:D,onHide:O})]})})]})}function Lt(){ue(`Players`);let e=Te(`(max-width: 767px)`),{variant:t,isPinned:n,togglePin:r}=je(),{playerSlug:i}=v();return e?i?(0,J.jsx)(It,{}):(0,J.jsx)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:(0,J.jsx)(Ze,{selectedSlug:void 0})}):i?(0,J.jsxs)(`div`,{className:`flex h-full overflow-hidden`,children:[(0,J.jsx)(Ze,{selectedSlug:i,compact:t===`compact`,isPinned:n,onToggleVariant:r}),(0,J.jsx)(`div`,{className:`flex-1 min-w-0 overflow-hidden`,children:(0,J.jsx)(It,{})})]}):(0,J.jsx)(`div`,{className:`flex h-full justify-center overflow-hidden`,children:(0,J.jsx)(Ze,{selectedSlug:void 0,expanded:!0})})}export{Lt as default};