import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{Bn as t,Fr as n,Lr as r,Rt as i,Sr as a,Un as o,Ur as s,Xn as c,Xt as l,Yt as u,Zn as d,Zr as f,an as p,bi as m,ei as h,en as g,gi as _,gn as v,hi as y,mi as b,or as x,qn as S,qt as C,ri as w,rn as T,si as E,sr as D,zn as O}from"./vendor-DU4C2Mru.js";import{n as k,t as A}from"./api--bJYSUUx.js";import{E as j,J as M,M as N,Q as P,R as ee,S as te,T as ne,X as F,Y as re,Z as I,a as ie,d as ae,f as oe,i as L,k as R,o as se,r as z,u as ce,v as le,vt as B,w as ue}from"./index-B7s3VjPV.js";import{n as de}from"./timeAgo-CW0kOQxJ.js";import{a as fe,o as pe,r as me,s as he,t as ge}from"./sheet-Dyvwhlcv.js";import{r as _e}from"./time-DscUFrit.js";import{n as V,t as H}from"./flags-DiQ3rOp9.js";import{t as ve}from"./SparkLine-BycqV2pL.js";import{t as ye}from"./useLeaderboardV2-CizIzwf6.js";import{t as be}from"./rank-medal-DUujkT4g.js";import{t as xe}from"./PrefetchLink-D9TYVdFs.js";import{t as Se}from"./MapImage-wRd7latf.js";import{n as Ce,t as we}from"./useTeams-Cv8Sb92s.js";import{n as Te,t as U}from"./seo-helpers-D-XcFZDv.js";import{n as Ee,r as De,t as Oe}from"./EditWidgetsButton-B9CBpCjw.js";import{t as ke}from"./WatchButton-_J6pIOBL.js";import{n as Ae,r as je,t as Me}from"./FilterBar-vmNBx3Ut.js";import{t as Ne}from"./useTeam-B35kLwGV.js";import{a as Pe,i as Fe,n as Ie,o as Le,r as Re,t as ze}from"./RailPeek-hYr-LMGf.js";import{n as Be,r as W,t as Ve}from"./RatingChartWidget-CaaCwBHz.js";import{t as He}from"./EntityNotFound-DmD02JKj.js";var G=e(m(),1),K=w(),Ue={t1:!0,t2:!0,gc:!0,t3:!1};function We({selectedSlug:e,expanded:t,compact:r,isPinned:i=!1,onToggleVariant:a}){let{gameSlug:o}=y(),c=b(),[l,u]=_(),d=ze(),{filters:f}=te(),p=l.get(`q`)||``,[m,h]=(0,G.useState)(p),g=(0,G.useRef)(void 0),v=(0,G.useCallback)(e=>{u(t=>(e?t.set(`q`,e):t.delete(`q`),t),{replace:!0}),clearTimeout(g.current),g.current=setTimeout(()=>h(e),300)},[u]),{teams:x,total:C,isLoading:w,hasNextPage:T,fetchNextPage:E,isFetchingNextPage:D}=Ce(o,{canonicalTier:f.tier,region:f.region,subRegion:f.subRegion,q:m||void 0}),O=(0,G.useRef)(null);return(0,G.useEffect)(()=>{let e=O.current;if(!e)return;let t=new IntersectionObserver(e=>{e[0].isIntersecting&&T&&!D&&E()},{threshold:0});return t.observe(e),()=>t.disconnect()},[T,D,E]),r?(0,K.jsxs)(Ie,{label:`Teams`,isPinned:i,onExpand:()=>a?.(),children:[w&&(0,K.jsx)(`div`,{className:`space-y-1`,children:Array.from({length:10}).map((e,t)=>(0,K.jsx)(`div`,{className:`mx-auto h-10 w-10 animate-pulse rounded-lg bg-zinc-100 dark:bg-zinc-800`},t))}),(0,K.jsxs)(`div`,{className:`space-y-0.5`,children:[x.map(t=>{let n=t.tier??`t3`,r=Ue[n]??!1;return(0,K.jsx)(Re,{selected:e===t.slug,onClick:()=>c({pathname:`/${o}/teams/${t.slug}`,search:l.toString()}),rank:t.rank==null?null:`#${t.rank}`,main:(0,K.jsx)(N,{name:t.name,slug:t.slug,abbreviation:t.abbreviation,logoUrl:t.logoUrl,size:`sm`,className:`flex-shrink-0`}),peek:t.name,onPeek:e=>d.show((0,K.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(`span`,{className:`text-sm font-bold text-zinc-900 dark:text-zinc-100`,children:t.name}),(0,K.jsxs)(`span`,{className:B(`inline-flex items-center gap-0.5 rounded px-1 py-px text-[9px] font-bold uppercase leading-tight`,I(n)),children:[r&&(0,K.jsx)(s,{size:8,"aria-hidden":`true`}),P(n)]})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-zinc-500 dark:text-zinc-400`,children:[t.rank!=null&&(0,K.jsxs)(`span`,{className:`font-semibold tabular-nums`,children:[`#`,t.rank]}),t.rating!=null&&(0,K.jsx)(`span`,{className:`font-mono font-semibold text-zinc-700 dark:text-zinc-300`,children:Math.round(t.rating)}),t.region&&(0,K.jsx)(`span`,{children:t.region})]}),t.disbanded&&(0,K.jsx)(`span`,{className:`inline-flex w-fit rounded border border-red-300 bg-red-50 px-1 py-px text-[9px] font-bold uppercase leading-tight text-red-600 dark:border-red-800/50 dark:bg-red-950/30 dark:text-red-400`,children:`Disbanded`})]}),e),onPeekEnd:d.hide},t.id)}),(0,K.jsx)(`div`,{ref:O,className:`h-1`}),D&&(0,K.jsx)(`div`,{className:`flex justify-center py-2`,children:(0,K.jsx)(S,{size:14,className:`animate-spin text-zinc-400`})})]}),!w&&x.length===0&&(0,K.jsx)(`div`,{className:`py-6 text-center text-2xs text-zinc-500`,children:`Empty`}),d.portal]}):(0,K.jsxs)(Pe,{title:`Teams`,width:t?`w-full max-w-5xl`:`w-80`,className:t?`border-r-0`:void 0,contentClassName:t?`p-4 md:p-6`:void 0,actions:!t&&a?(0,K.jsx)(Fe,{isPinned:i,variant:`full`,onClick:a}):void 0,children:[t?(0,K.jsx)(K.Fragment,{children:(0,K.jsx)(`div`,{className:`mb-3`,children:(0,K.jsx)(`input`,{value:p,onChange:e=>v(e.target.value),placeholder:`Search teams...`,"aria-label":`Search teams`,className:`w-full rounded-md border border-zinc-200 bg-zinc-50 px-3 py-2 text-sm 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`})})}):(0,K.jsx)(K.Fragment,{children:(0,K.jsx)(`div`,{className:`mb-2`,children:(0,K.jsx)(`input`,{value:p,onChange:e=>v(e.target.value),placeholder:`Search...`,"aria-label":`Search teams`,className:`min-w-0 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&&C>0&&(0,K.jsxs)(`div`,{className:`mb-1.5 glk-eyebrow`,children:[(0,K.jsx)(`span`,{className:`glk-tabular normal-case`,children:x.length}),(0,K.jsx)(`span`,{className:`lowercase`,children:` of `}),(0,K.jsx)(`span`,{className:`glk-tabular normal-case`,children:C}),(0,K.jsx)(`span`,{children:` teams`})]}),w&&(0,K.jsx)(`div`,{className:`space-y-1`,children:Array.from({length:6}).map((e,t)=>(0,K.jsx)(`div`,{className:`skeleton-shimmer rounded-lg h-12`,style:{opacity:1-t*.1}},t))}),(0,K.jsxs)(`div`,{role:`list`,className:`space-y-0.5`,children:[x.map(t=>{let r=e===t.slug;return(0,K.jsxs)(`button`,{role:`listitem`,"aria-label":`${t.name}${t.rank==null?``:`, rank #${t.rank}`}${t.rating==null?``:`, rating ${Math.round(t.rating)}`}`,"aria-current":r?`page`:void 0,onClick:()=>c({pathname:`/${o}/teams/${t.slug}`,search:l.toString()}),className:B(`group flex w-full items-center gap-2.5 rounded-lg px-2 py-2 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--glk-brand)] focus-visible:ring-inset`,r?`bg-[var(--glk-brand)]/10`:`hover:bg-zinc-100 dark:hover:bg-zinc-800/60`),children:[(0,K.jsx)(`span`,{className:`shrink-0 w-6 text-right glk-tabular text-xs font-bold text-zinc-400 dark:text-zinc-500`,children:t.rank==null?``:`#${t.rank}`}),(0,K.jsx)(N,{name:t.name,slug:t.slug,abbreviation:t.abbreviation,logoUrl:t.logoUrl,size:`md`,className:`flex-shrink-0`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 truncate`,children:[(0,K.jsx)(`span`,{className:B(`truncate text-xs font-semibold transition-colors`,r?`text-[var(--glk-brand)]`:`text-zinc-900 group-hover:text-[var(--glk-brand)] dark:text-zinc-100`),children:t.name}),(()=>{let e=t.tier??`t3`,n=Ue[e]??!1;return(0,K.jsxs)(`span`,{className:B(`inline-flex shrink-0 items-center gap-0.5 rounded px-1 py-px text-[9px] font-bold uppercase leading-tight`,I(e)),children:[n&&(0,K.jsx)(s,{size:8,"aria-hidden":`true`}),P(e)]})})(),t.disbanded&&(0,K.jsx)(`span`,{className:`inline-flex shrink-0 rounded border border-red-300 bg-red-50 px-1 py-px text-[9px] font-bold uppercase leading-tight text-red-600 dark:border-red-800/50 dark:bg-red-950/30 dark:text-red-400`,children:`Disbanded`})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-zinc-500 dark:text-zinc-400`,children:[t.rating!=null&&(0,K.jsx)(`span`,{className:`glk-metric glk-metric-sm font-bold text-zinc-700 dark:text-zinc-300`,children:Math.round(t.rating)}),t.region&&(0,K.jsxs)(K.Fragment,{children:[t.rating!=null&&(0,K.jsx)(`span`,{className:`text-zinc-400 dark:text-zinc-600`,children:`·`}),(0,K.jsx)(`span`,{children:t.region})]})]})]}),(0,K.jsx)(n,{size:14,"aria-hidden":`true`,className:B(`shrink-0 transition-colors`,r?`text-[var(--glk-brand)]`:`text-zinc-300 group-hover:text-[var(--glk-brand)] dark:text-zinc-600`)})]},t.id)}),(0,K.jsx)(`div`,{ref:O,className:`h-1`}),D&&(0,K.jsx)(`div`,{className:`flex justify-center py-2`,children:(0,K.jsx)(S,{size:16,className:`animate-spin text-zinc-400`})})]}),!w&&x.length===0&&(0,K.jsx)(`div`,{className:`py-8 text-center text-xs text-zinc-500`,children:`No teams found`})]})}function Ge(e,t){return ue(ne.teamRatingHistory,{gameSlug:e,teamId:t},{enabled:!!t})}var Ke=1440*60*1e3*7;function qe(e){let t=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())),n=(t.getUTCDay()+6)%7;return t.setUTCDate(t.getUTCDate()-n),t}function Je(e,t){if(e.winner?.id)return e.winner.id===t?`W`:`L`;let n=e.team1Maps??e.stats?.team1Maps??null,r=e.team2Maps??e.stats?.team2Maps??null;if(n==null||r==null)return null;let i=e.team1?.id===t,a=e.team2?.id===t;if(!i&&!a||n===r)return null;let o=n>r;return i?o?`W`:`L`:o?`L`:`W`}function Ye(e,t,n,r){let i=qe(r),a=[];for(let e=n-1;e>=0;e--){let t=new Date(i.getTime()-e*Ke);a.push({weekStart:t.toISOString().slice(0,10),results:[]})}for(let r of e){let e=r.playedAt?new Date(r.playedAt):null;if(!e||Number.isNaN(e.getTime()))continue;let o=qe(e),s=Math.round((i.getTime()-o.getTime())/Ke);if(s<0||s>n-1)continue;let c=n-1-s,l=Je(r,t);l&&a[c].results.push(l)}return a}function q(e){return new Date(`${e}T00:00:00Z`).toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,timeZone:`UTC`})}function Xe({recentMatches:e,teamId:t,weeks:n=8,className:r,now:i=new Date}){let a=(0,G.useMemo)(()=>Ye(e,t,n,i),[e,t,n,i]),o=(0,G.useMemo)(()=>{let e=0,t=0;for(let n of a)for(let r of n.results)r===`W`?e++:t++;return{w:e,l:t}},[a]),s=n*16+(n-1)*8+8;return(0,K.jsxs)(`div`,{className:B(`flex flex-col gap-1`,r),"data-testid":`team-form-timeline`,children:[(0,K.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,K.jsxs)(`span`,{className:`glk-eyebrow`,children:[`Last `,n,` Weeks`]}),(0,K.jsxs)(`span`,{className:`glk-tabular text-xs text-zinc-500 dark:text-zinc-400`,children:[o.w,`W–`,o.l,`L`]})]}),(0,K.jsx)(`svg`,{role:`img`,"aria-label":`Form over the last ${n} weeks: ${o.w} wins, ${o.l} losses`,viewBox:`0 0 ${s} 68`,className:`block w-full max-w-[240px]`,preserveAspectRatio:`xMinYMid meet`,children:a.map((e,t)=>{let n=4+t*24,r=e.results.length;if(r===0)return(0,K.jsxs)(`g`,{children:[(0,K.jsx)(`title`,{children:`Week of ${q(e.weekStart)} — no matches`}),(0,K.jsx)(`rect`,{"data-form-week":!0,"data-week":e.weekStart,"data-result":`none`,"aria-label":`Week of ${q(e.weekStart)}: no matches`,x:n,y:4,width:16,height:60,rx:3,className:`fill-zinc-200/70 dark:fill-zinc-800/60`})]},e.weekStart);let i=60/r,a=e.results.filter(e=>e===`W`).length,o=r-a,s=`Week of ${q(e.weekStart)}: ${a}W ${o}L`;return(0,K.jsxs)(`g`,{children:[(0,K.jsx)(`title`,{children:s}),e.results.map((t,r)=>{let a=4+r*i,o=t===`W`;return(0,K.jsx)(`rect`,{"data-form-week":e.weekStart,"data-result":t,"aria-label":`${s} — ${o?`win`:`loss`} ${r+1}`,x:n,y:a,width:16,height:Math.max(i-1.5,1),rx:2,className:B(o?`fill-[var(--glk-win,theme(colors.emerald.500))]`:`fill-[var(--glk-brand,theme(colors.red.500))]`)},`${e.weekStart}-${r}`)})]},e.weekStart)})}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between text-2xs text-zinc-400 dark:text-zinc-500`,children:[(0,K.jsx)(`span`,{children:q(a[0]?.weekStart??new Date().toISOString().slice(0,10))}),(0,K.jsxs)(`span`,{className:`flex items-center gap-2`,"aria-hidden":`true`,children:[(0,K.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-sm bg-[var(--glk-win,theme(colors.emerald.500))]`}),`Win`]}),(0,K.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-sm bg-[var(--glk-brand,theme(colors.red.500))]`}),`Loss`]})]}),(0,K.jsx)(`span`,{children:q(a[a.length-1]?.weekStart??new Date().toISOString().slice(0,10))})]})]})}function Ze(e,t,n){let r=Ne(e,t),i=Ne(e,n);return{team1:r.data,team2:i.data,isLoading:r.isLoading&&i.isLoading,isError:r.isError||i.isError}}function Qe({gameSlug:e,team:t,open:n,onOpenChange:r}){let[i,a]=(0,G.useState)(null),[o,s]=(0,G.useState)(``),{data:c}=we(e),{team2:l}=Ze(e,t.slug,i??void 0);(0,G.useEffect)(()=>{n||(a(null),s(``))},[n]);let u=(0,G.useMemo)(()=>{let e=c??[],n=o.trim().toLowerCase(),r=e.filter(e=>e.slug!==t.slug);return n?r.filter(e=>e.name.toLowerCase().includes(n)||(e.abbreviation??``).toLowerCase().includes(n)).slice(0,25):r.slice(0,25)},[c,o,t.slug]);return(0,K.jsx)(ge,{open:n,onOpenChange:r,children:(0,K.jsxs)(me,{side:`right`,className:`w-full !max-w-2xl overflow-y-auto p-0 sm:!max-w-2xl`,children:[(0,K.jsxs)(fe,{className:`border-b border-zinc-200 px-5 py-4 dark:border-zinc-800`,children:[(0,K.jsx)(pe,{className:`glk-eyebrow !text-xs !tracking-widest`,children:`Head-to-head`}),(0,K.jsxs)(`h2`,{className:`font-display text-xl font-bold text-zinc-900 dark:text-zinc-100`,children:[`Compare `,t.name]})]}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-5 px-5 py-4`,children:[!l&&(0,K.jsx)($e,{query:o,onQueryChange:s,teams:u,onSelect:e=>a(e.slug)}),l&&(0,K.jsx)(et,{team1:t,team2:l,onClear:()=>a(null)})]})]})})}function $e({query:e,onQueryChange:t,teams:n,onSelect:r}){return(0,K.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,K.jsxs)(`label`,{className:`relative block`,children:[(0,K.jsx)(v,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-3 h-4 w-4 -translate-y-1/2 text-zinc-400`}),(0,K.jsx)(`input`,{type:`search`,autoFocus:!0,"aria-label":`Search opponent teams`,placeholder:`Search teams`,value:e,onChange:e=>t(e.target.value),className:`w-full rounded-xl border border-zinc-200 bg-white py-2 pr-3 pl-9 text-sm text-zinc-900 placeholder:text-zinc-400 focus:border-[var(--glk-brand)] focus:outline-none dark:border-zinc-700 dark:bg-zinc-900 dark:text-zinc-100`})]}),n.length===0?(0,K.jsxs)(`div`,{role:`status`,className:`rounded-xl border border-dashed border-zinc-200 px-4 py-6 text-center text-sm text-zinc-500 dark:border-zinc-700 dark:text-zinc-400`,children:[`No teams matched "`,e,`".`]}):(0,K.jsx)(`ul`,{role:`listbox`,"aria-label":`Opponent teams`,className:`flex max-h-[60vh] flex-col gap-1 overflow-y-auto`,children:n.map(e=>(0,K.jsx)(`li`,{children:(0,K.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":`false`,onClick:()=>r(e),className:`flex w-full items-center gap-3 rounded-xl border border-transparent px-3 py-2 text-left text-sm transition-colors hover:border-zinc-200 hover:bg-zinc-50 dark:hover:border-zinc-700 dark:hover:bg-zinc-800/50`,children:[(0,K.jsx)(N,{name:e.name,slug:e.slug,abbreviation:e.abbreviation,logoUrl:e.logoUrl,size:`sm`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`truncate font-medium text-zinc-900 dark:text-zinc-100`,children:e.name}),(0,K.jsxs)(`div`,{className:`text-xs text-zinc-400`,children:[e.region,e.rank==null?``:` · #${e.rank}`]})]}),e.tier&&(0,K.jsx)(`span`,{className:B(`rounded px-1.5 py-0.5 text-2xs font-bold uppercase tracking-wider`,M(e.tier)),children:F(e.tier)??e.tier})]})},e.slug))})]})}function et({team1:e,team2:t,onClear:n}){return(0,K.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsx)(`span`,{className:`glk-eyebrow`,children:`Side-by-side`}),(0,K.jsx)(`button`,{type:`button`,onClick:n,className:`text-xs text-zinc-500 underline-offset-2 hover:underline dark:text-zinc-400`,children:`Pick a different team`})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,K.jsx)(tt,{team:e}),(0,K.jsx)(tt,{team:t})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,K.jsx)(J,{label:`Glicko Rating`,v1:it(e.rating),v2:it(t.rating)}),(0,K.jsx)(J,{label:`Rank`,v1:e.rank==null?`—`:`#${e.rank}`,v2:t.rank==null?`—`:`#${t.rank}`}),(0,K.jsx)(J,{label:`Win Rate`,v1:e.stats?.winRate==null?`—`:`${Math.round(e.stats.winRate*100)}%`,v2:t.stats?.winRate==null?`—`:`${Math.round(t.stats.winRate*100)}%`}),(0,K.jsx)(J,{label:`Map WR`,v1:e.stats?.mapWinRate==null?`—`:`${Math.round(e.stats.mapWinRate*100)}%`,v2:t.stats?.mapWinRate==null?`—`:`${Math.round(t.stats.mapWinRate*100)}%`})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,K.jsx)(nt,{team:e}),(0,K.jsx)(nt,{team:t})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,K.jsx)(rt,{team:e}),(0,K.jsx)(rt,{team:t})]})]})}function tt({team:e}){return(0,K.jsxs)(`div`,{className:`glk-card flex flex-col items-center gap-2 !rounded-xl !p-3 text-center`,children:[(0,K.jsx)(N,{name:e.name,slug:e.slug,abbreviation:e.abbreviation,logoUrl:e.logoUrl,size:`md`}),(0,K.jsx)(`div`,{className:`font-display text-base font-bold text-zinc-900 dark:text-zinc-100`,children:e.name}),e.tier&&(0,K.jsx)(`span`,{className:B(`rounded px-1.5 py-0.5 text-2xs font-bold uppercase tracking-wider`,M(e.tier)),children:F(e.tier)??e.tier})]})}function J({label:e,v1:t,v2:n}){return(0,K.jsxs)(`div`,{className:`rounded-xl border border-zinc-200 px-3 py-2 dark:border-zinc-800`,children:[(0,K.jsx)(`div`,{className:`glk-eyebrow !text-2xs`,children:e}),(0,K.jsxs)(`div`,{className:`mt-1 flex items-baseline justify-between`,children:[(0,K.jsx)(`span`,{className:`glk-metric glk-metric-md`,children:t}),(0,K.jsx)(`span`,{className:`text-zinc-300 dark:text-zinc-600`,children:`vs`}),(0,K.jsx)(`span`,{className:`glk-metric glk-metric-md`,children:n})]})]})}function nt({team:e}){let t=(e.activeRoster??[]).slice(0,5);return(0,K.jsxs)(`div`,{className:`rounded-xl border border-zinc-200 px-3 py-2 dark:border-zinc-800`,children:[(0,K.jsx)(`div`,{className:`glk-eyebrow !text-2xs`,children:`Top Roster`}),t.length===0?(0,K.jsx)(`p`,{className:`mt-1 text-xs text-zinc-400`,children:`No active roster on file.`}):(0,K.jsx)(`ul`,{className:`mt-1 flex flex-col gap-0.5 text-xs text-zinc-700 dark:text-zinc-300`,children:t.map(e=>(0,K.jsxs)(`li`,{className:`flex items-baseline justify-between gap-2`,children:[(0,K.jsx)(`span`,{className:`truncate`,children:e.ign}),(0,K.jsx)(`span`,{className:`glk-tabular text-xs text-zinc-400`,children:e.careerAvgAcs==null?`—`:Math.round(e.careerAvgAcs)})]},e.vlrId))})]})}function rt({team:e}){let t=(e.stats?.form??[]).slice(-5);return(0,K.jsxs)(`div`,{className:`rounded-xl border border-zinc-200 px-3 py-2 dark:border-zinc-800`,children:[(0,K.jsx)(`div`,{className:`glk-eyebrow !text-2xs`,children:`Recent Form`}),t.length===0?(0,K.jsx)(`p`,{className:`mt-1 text-xs text-zinc-400`,children:`—`}):(0,K.jsx)(`div`,{className:`mt-1 flex items-center gap-1`,children:t.map((e,t)=>(0,K.jsx)(`span`,{"aria-label":e===`W`?`Win`:`Loss`,className:B(`inline-flex h-4 w-4 items-center justify-center rounded text-2xs font-bold`,e===`W`?`bg-[var(--glk-win,theme(colors.emerald.500))]/15 text-[var(--glk-win,theme(colors.emerald.500))]`:`bg-[var(--glk-brand,theme(colors.red.500))]/15 text-[var(--glk-brand,theme(colors.red.500))]`),children:e},t))})]})}function it(e){return e==null?`—`:Math.round(e).toString()}function at(){let[e,t]=(0,G.useState)(!1),[n,r]=(0,G.useState)(!0);return(0,G.useEffect)(()=>{let e=!1;return fetch(`/api/auth/me`,{credentials:`include`}).then(e=>e.ok?e.json():null).then(n=>{e||(t(!!n?.user),r(!1))}).catch(()=>{e||(t(!1),r(!1))}),()=>{e=!0}},[]),{isAdmin:e,loading:n}}function ot({to:e,className:t,children:n}){return e?(0,K.jsx)(E,{to:e,className:t,children:n}):(0,K.jsx)(`div`,{"aria-disabled":`true`,className:B(t,`cursor-default`),children:n})}var st={igl:`var(--glk-role-igl, #a855f7)`,controller:`var(--glk-role-controller, #3b82f6)`,initiator:`var(--glk-role-initiator, #f59e0b)`,duelist:`var(--glk-role-duelist, #ef4444)`,sentinel:`var(--glk-role-sentinel, #22c55e)`,flex:`var(--glk-role-flex, #06b6d4)`,sub:`var(--glk-role-sub, #71717a)`},ct={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`};function lt(e){return e?ct[e.toLowerCase()]??`bg-zinc-500/10 text-zinc-600 border-zinc-500/20 dark:text-zinc-400`:`bg-zinc-500/10 text-zinc-600 border-zinc-500/20 dark:text-zinc-400`}function ut(e){return e?st[e.toLowerCase()]??`var(--glk-role-sub, #71717a)`:`var(--glk-role-sub, #71717a)`}function dt(e){let t=e.toLowerCase();return t.includes(`manager`)?`Mgr`:t.includes(`assistant`)&&t.includes(`coach`)?`A.Coach`:t.includes(`head`)&&t.includes(`coach`)?`Coach`:t.includes(`performance`)?`Perf`:t.includes(`analyst`)?`Anlst`:t.includes(`coach`)?`Coach`:t.includes(`strategy`)||t.includes(`strat`)?`Strat`:t.includes(`psych`)?`Psych`:t.includes(`physio`)||t.includes(`therapist`)?`Phys`:e.length>6?`${e.slice(0,5)}…`:e}function ft({src:e,ign:t,size:n=`md`}){let r=n===`sm`?`h-8 w-8`:`h-11 w-11`,i=n===`sm`?`text-xs`:`text-sm`,a=n===`sm`?32:44;return e?(0,K.jsx)(`img`,{src:e.startsWith(`//`)?`https:${e}`:e,alt:t,width:a,height:a,className:B(r,`rounded-lg object-cover bg-zinc-200 dark:bg-zinc-800`),loading:`lazy`}):(0,K.jsx)(`div`,{className:B(r,`flex items-center justify-center rounded-lg bg-gradient-to-br from-zinc-200 to-zinc-300 dark:from-zinc-700 dark:to-zinc-800`,i,`font-bold text-zinc-600 dark:text-zinc-400 select-none`),children:t.charAt(0).toUpperCase()})}function pt(e,t){if(e.role?.toLowerCase()===`sub`)return!1;let n=t.map(e=>e.mapsPlayed).sort((e,t)=>e-t),r=n[Math.floor(n.length/2)];return r<=0?!0:e.mapsPlayed>=r*.3}function mt({roster:e}){let t=e.filter(t=>pt(t,e)),n=[...t.length>=3?t:e].sort((e,t)=>(t.careerAvgAcs??0)-(e.careerAvgAcs??0)),r=n.map(e=>e.careerAvgAcs??0).filter(e=>e>0),i=n.map(e=>e.careerAvgKd??0).filter(e=>e>0),a=Math.max(...r,1),o=Math.min(...r,0),s=Math.max(...i,1),c=n.map(e=>e.mapsPlayed).filter(e=>e>0),l=r.length>0?r.reduce((e,t)=>e+t,0)/r.length:0,u=i.length>0?i.reduce((e,t)=>e+t,0)/i.length:0,d=c.reduce((e,t)=>e+t,0);return n.length===0?null:(0,K.jsxs)(`div`,{className:`rounded-lg bg-zinc-50/80 p-2 sm:p-3 dark:bg-zinc-800/20`,children:[(0,K.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center justify-between gap-1`,children:[(0,K.jsxs)(`span`,{className:`glk-eyebrow`,children:[`Team Stats`,(0,K.jsx)(W,{text:`Career averages across all maps played. Bars show relative performance within the roster.`})]}),(0,K.jsxs)(`div`,{className:`flex gap-2 sm:gap-3 text-xs tabular-nums text-zinc-500`,children:[(0,K.jsxs)(`span`,{children:[`Avg `,(0,K.jsx)(`strong`,{className:`text-zinc-600 dark:text-zinc-300`,children:Math.round(l)}),` ACS`]}),(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`strong`,{className:`text-zinc-600 dark:text-zinc-300`,children:u.toFixed(2)}),` K/D`]}),(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`strong`,{className:`text-zinc-600 dark:text-zinc-300`,children:d}),` maps`]})]})]}),(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 px-1 glk-eyebrow @[280px]/widget:gap-2`,children:[(0,K.jsx)(`span`,{className:`w-14 @[280px]/widget:w-16 @[360px]/widget:w-20`,children:`Player`}),(0,K.jsx)(`span`,{className:`w-8 text-right @[280px]/widget:w-10`,children:`ACS`}),(0,K.jsx)(`span`,{className:`flex-1`}),(0,K.jsx)(`span`,{className:`hidden w-10 text-right @[280px]/widget:inline`,children:`K/D`}),(0,K.jsx)(`span`,{className:`hidden flex-1 @[280px]/widget:inline`}),(0,K.jsx)(`span`,{className:`w-8 text-right @[280px]/widget:w-10 @[360px]/widget:w-12`,children:`Maps`})]}),n.map(e=>{let t=e.careerAvgAcs??0,n=e.careerAvgKd??0,r=a>o?(t-o*.8)/(a-o*.8)*100:50,i=s>0?n/s*100:50,c=ut(e.role);return(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md px-1 py-0.5 @[280px]/widget:gap-2`,children:[(0,K.jsx)(`span`,{className:`w-14 truncate text-xs font-semibold text-zinc-700 dark:text-zinc-300 @[280px]/widget:w-16 @[360px]/widget:w-20`,children:e.ign}),(0,K.jsx)(`span`,{className:`w-8 text-right text-xs font-bold tabular-nums text-zinc-700 dark:text-zinc-200 @[280px]/widget:w-10`,children:t>0?Math.round(t):`—`}),(0,K.jsx)(`div`,{className:`flex-1 h-3 rounded-full bg-zinc-200/60 dark:bg-zinc-700/30 overflow-hidden`,children:(0,K.jsx)(`div`,{className:`h-full rounded-full transition-all`,style:{width:`${Math.max(r,4)}%`,backgroundColor:c,opacity:.7}})}),(0,K.jsx)(`span`,{className:`hidden w-10 text-right text-xs font-bold tabular-nums text-zinc-700 dark:text-zinc-200 @[280px]/widget:inline`,children:n>0?n.toFixed(2):`—`}),(0,K.jsx)(`div`,{className:`hidden flex-1 h-3 rounded-full bg-zinc-200/60 dark:bg-zinc-700/30 overflow-hidden @[280px]/widget:block`,children:(0,K.jsx)(`div`,{className:`h-full rounded-full transition-all`,style:{width:`${Math.max(i,4)}%`,backgroundColor:n>=1?`var(--glk-win)`:`var(--glk-loss)`,opacity:.6}})}),(0,K.jsx)(`span`,{className:`w-8 text-right text-xs tabular-nums text-zinc-500 @[280px]/widget:w-10 @[360px]/widget:w-12`,children:e.mapsPlayed>0?e.mapsPlayed:`—`})]},e.vlrId)})]})]})}function ht({activeRoster:e,staff:t,inactivePlayers:n,legacyPlayers:r,gameSlug:i,teamSlug:o}){let[s,c]=(0,G.useState)(!1),l=e.length>0;return(0,K.jsxs)(`div`,{children:[l&&(0,K.jsx)(`div`,{className:`mb-4`,children:(0,K.jsx)(mt,{roster:e})}),n.length>0&&(0,K.jsxs)(`div`,{className:`mb-3 flex gap-1`,role:`group`,"aria-label":`Roster view`,children:[(0,K.jsxs)(`button`,{onClick:()=>c(!1),"aria-pressed":!s,className:B(`rounded-md px-2.5 py-1 text-2xs font-bold uppercase tracking-wider transition-colors`,s?`bg-zinc-100 text-zinc-500 hover:bg-zinc-200 dark:bg-zinc-800 dark:text-zinc-400 dark:hover:bg-zinc-700/70`:`bg-[var(--glk-brand)] text-white`),children:[`Current (`,e.length,`)`]}),(0,K.jsxs)(`button`,{onClick:()=>c(!0),"aria-pressed":s,className:B(`rounded-md px-2.5 py-1 text-2xs font-bold uppercase tracking-wider transition-colors`,s?`bg-[var(--glk-brand)] text-white`:`bg-zinc-100 text-zinc-500 hover:bg-zinc-200 dark:bg-zinc-800 dark:text-zinc-400 dark:hover:bg-zinc-700/70`),children:[`Past (`,n.length,`)`]})]}),s?n.length>0?(0,K.jsx)(`div`,{className:`space-y-0.5`,children:n.map(e=>{let t=H(e.country),n=e.slug?`/${i}/players/${e.slug}`:null;return(0,K.jsxs)(ot,{to:n,className:B(`flex items-center gap-2 rounded-lg px-3 py-1.5`,n&&`transition-colors hover:bg-zinc-100 dark:hover:bg-zinc-800/40`),children:[(0,K.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[t&&(0,K.jsx)(`span`,{className:`text-xs`,children:t}),(0,K.jsx)(`span`,{className:`text-xs text-zinc-400`,children:e.ign}),(0,K.jsx)(`span`,{className:`text-xs uppercase text-zinc-500`,children:e.status===`inactive`?`INACTIVE`:`FORMER`})]})}),e.careerAvgAcs!=null&&(0,K.jsxs)(`span`,{className:`text-xs text-zinc-500`,children:[Math.round(e.careerAvgAcs),` ACS`]})]},e.vlrId)})}):(0,K.jsx)(`div`,{className:`py-6 text-center text-xs text-zinc-500 dark:text-zinc-400`,children:`No former players`}):(0,K.jsxs)(K.Fragment,{children:[l?(0,K.jsx)(`div`,{className:`space-y-0.5`,children:e.map(e=>{let t=H(e.country),n=e.slug?`/${i}/players/${e.slug}`:null;return(0,K.jsxs)(ot,{to:n,className:B(`group flex items-center gap-2.5 rounded-xl px-2 py-2 @[260px]/widget:gap-3 @[260px]/widget:px-3 @[260px]/widget:py-2.5`,n&&`transition-all hover:bg-zinc-100 dark:hover:bg-zinc-800/60`),children:[(0,K.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,K.jsx)(`div`,{className:`absolute -inset-0.5 rounded-xl opacity-40`,style:{border:`2px solid ${ut(e.role)}`}}),(0,K.jsx)(ft,{src:e.avatarUrl,ign:e.ign,size:`sm`}),e.isCaptain&&(0,K.jsx)(`div`,{className:`absolute -top-1 -right-1 flex h-4 w-4 items-center justify-center rounded-full bg-amber-500 text-black`,title:`Captain`,children:(0,K.jsx)(a,{size:9,"aria-hidden":`true`})})]}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[t&&(0,K.jsx)(`span`,{className:`text-sm`,children:t}),(0,K.jsx)(`span`,{className:`truncate text-sm font-semibold text-zinc-900 dark:text-zinc-100`,children:e.ign}),e.role&&(0,K.jsx)(`span`,{className:B(`shrink-0 rounded border px-1 py-px text-[9px] font-semibold uppercase leading-none @[260px]/widget:hidden`,lt(e.role)),children:e.role.slice(0,4)})]}),e.realName&&(0,K.jsx)(`div`,{className:`hidden truncate text-xs text-zinc-500 @[240px]/widget:block`,children:e.realName})]}),(0,K.jsxs)(`div`,{className:`hidden shrink-0 items-center gap-2 @[260px]/widget:flex`,children:[e.role&&(0,K.jsx)(`span`,{className:B(`rounded-md border px-1.5 py-0.5 text-xs font-semibold uppercase tracking-wider`,lt(e.role)),children:e.role}),e.careerAvgAcs!=null&&(0,K.jsxs)(`div`,{className:`text-right`,children:[(0,K.jsx)(`div`,{className:`text-xs font-bold text-zinc-700 dark:text-zinc-300`,children:Math.round(e.careerAvgAcs)}),(0,K.jsx)(`div`,{className:`text-xs text-zinc-400`,children:`ACS`})]})]}),e.careerAvgAcs!=null&&(0,K.jsx)(`div`,{className:`shrink-0 text-right @[260px]/widget:hidden`,children:(0,K.jsx)(`div`,{className:`text-xs font-bold tabular-nums text-zinc-700 dark:text-zinc-300`,children:Math.round(e.careerAvgAcs)})})]},e.vlrId)})}):r.length>0?(0,K.jsx)(`div`,{className:`space-y-0.5`,children:r.map(e=>(0,K.jsxs)(E,{to:`/${i}/players/${e.slug}`,className:`flex items-center gap-3 rounded-xl px-3 py-2.5 transition-colors hover:bg-zinc-100 dark:hover:bg-zinc-800/60`,children:[(0,K.jsx)(`span`,{className:`text-sm font-semibold text-zinc-900 dark:text-zinc-100`,children:e.ign}),e.role&&(0,K.jsx)(`span`,{className:B(`rounded-md border px-1.5 py-0.5 text-xs font-semibold uppercase tracking-wider`,lt(e.role)),children:e.role}),e.careerAvgAcs!=null&&(0,K.jsxs)(`span`,{className:`ml-auto text-xs font-bold text-zinc-500`,children:[Math.round(e.careerAvgAcs),` ACS`]})]},e.id))}):(0,K.jsx)(`div`,{className:`py-6 text-center text-xs text-zinc-500 dark:text-zinc-400`,children:`No roster data available`}),t.length>0&&(0,K.jsxs)(`div`,{className:`mt-4`,children:[(0,K.jsx)(`div`,{className:`mb-1 px-1 glk-eyebrow`,children:`Staff`}),(0,K.jsx)(`div`,{className:`rounded-xl bg-zinc-50 py-0.5 dark:bg-zinc-800/20`,children:t.map(e=>{let t=H(e.country);return(0,K.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg px-2 py-1.5 @[260px]/widget:gap-2.5 @[260px]/widget:px-3 @[260px]/widget:py-2`,children:[(0,K.jsx)(ft,{src:e.avatarUrl,ign:e.ign,size:`sm`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[t&&(0,K.jsx)(`span`,{className:`text-xs`,children:t}),(0,K.jsx)(`span`,{className:`truncate text-xs font-medium text-zinc-700 dark:text-zinc-300`,children:e.ign})]}),e.realName&&(0,K.jsx)(`div`,{className:`hidden truncate text-xs text-zinc-500 @[260px]/widget:block`,children:e.realName})]}),e.role&&(0,K.jsxs)(`span`,{className:`shrink-0 rounded bg-zinc-100 px-1 py-0.5 text-2xs capitalize text-zinc-600 dark:bg-zinc-800 dark:text-zinc-400 @[260px]/widget:px-1.5 @[260px]/widget:text-xs`,children:[(0,K.jsx)(`span`,{className:`@[260px]/widget:hidden`,children:dt(e.role)}),(0,K.jsx)(`span`,{className:`hidden @[260px]/widget:inline`,children:e.role})]})]},e.vlrId)})})]})]})]})}function gt(e){if(!e)return`—`;let t=new Date(e),n=Date.now()-t.getTime(),r=Math.abs(n)/864e5,i=n>0;if(r<1){if(i){let e=Math.floor(n/36e5);return e<1?`Just now`:`${e}h ago`}return`Today`}return r<2?i?`Yesterday`:`Tomorrow`:r<7?t.toLocaleDateString(`en-US`,{weekday:`short`,month:`short`,day:`numeric`}):t.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`})}function _t({form:e}){let{points:t,width:n,height:r,areaAbove:i,areaBelow:a,linePath:o}=(0,G.useMemo)(()=>{let t=e.length,n=[],r=0;for(let i=0;i<t;i++)r=r*.6+(e[i]===`W`?1:-1)*.4,n.push(r);let i=Math.max(Math.abs(Math.min(...n)),Math.abs(Math.max(...n)),.5),a=n.map((n,r)=>({x:4+(t>1?r/(t-1)*272:272/2),y:20-n/i*14,result:e[r]})),o=`M${a[0].x},${a[0].y}`;for(let e=1;e<a.length;e++){let t=(a[e-1].x+a[e].x)/2;o+=` C${t},${a[e-1].y} ${t},${a[e].y} ${a[e].x},${a[e].y}`}let s=`M${a[0].x},20`;for(let e of a)s+=` L${e.x},${Math.min(e.y,20)}`;s+=` L${a[a.length-1].x},20 Z`;let c=`M${a[0].x},20`;for(let e of a)c+=` L${e.x},${Math.max(e.y,20)}`;return c+=` L${a[a.length-1].x},20 Z`,{points:a,width:280,height:40,areaAbove:s,areaBelow:c,linePath:o}},[e]);if(e.length<3)return null;let s=t[t.length-1].y<r/2;return(0,K.jsxs)(`svg`,{viewBox:`0 0 ${n} ${r}`,className:`w-full`,preserveAspectRatio:`xMidYMid meet`,children:[(0,K.jsxs)(`defs`,{children:[(0,K.jsxs)(`linearGradient`,{id:`fwg`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,K.jsx)(`stop`,{offset:`0%`,stopColor:`var(--glk-win)`,stopOpacity:`0.25`}),(0,K.jsx)(`stop`,{offset:`100%`,stopColor:`var(--glk-win)`,stopOpacity:`0`})]}),(0,K.jsxs)(`linearGradient`,{id:`flg`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,K.jsx)(`stop`,{offset:`0%`,stopColor:`var(--glk-loss)`,stopOpacity:`0`}),(0,K.jsx)(`stop`,{offset:`100%`,stopColor:`var(--glk-loss)`,stopOpacity:`0.25`})]})]}),(0,K.jsx)(`line`,{x1:4,y1:r/2,x2:n-4,y2:r/2,stroke:`currentColor`,strokeOpacity:`0.06`,strokeWidth:`1`,strokeDasharray:`3,3`}),(0,K.jsx)(`path`,{d:i,fill:`url(#fwg)`}),(0,K.jsx)(`path`,{d:a,fill:`url(#flg)`}),(0,K.jsx)(`path`,{d:o,fill:`none`,stroke:s?`var(--glk-win)`:`var(--glk-loss)`,strokeWidth:`2`,strokeLinecap:`round`}),t.map((e,n)=>(0,K.jsx)(`circle`,{cx:e.x,cy:e.y,r:n===t.length-1?3.5:2,fill:e.result===`W`?`var(--glk-win)`:`var(--glk-loss)`,stroke:n===t.length-1?`white`:`none`,strokeWidth:n===t.length-1?1.5:0,className:n===t.length-1?`dark:stroke-zinc-900`:``},n))]})}var vt={id:``,name:`TBD`,slug:void 0,abbreviation:null,logoUrl:null};function yt({match:e,teamId:t,gameSlug:n}){let r=e.team1?.id===t,i=r?e.team2??vt:e.team1??vt,a=e.winner?.id===t,o=e.team1Maps??e.stats?.team1Maps??null,s=e.team2Maps??e.stats?.team2Maps??null,c=r?o:s,l=r?s:o;if(c==null&&e.mapResults&&e.mapResults.length>0){let n=0,r=0;for(let i of e.mapResults)i.winnerId===t?n++:i.winnerId&&r++;c=n,l=r}return(0,K.jsxs)(E,{to:`/${n}/matches/${e.id}`,className:`group flex min-w-0 items-stretch gap-2 transition-colors hover:bg-zinc-50 dark:hover:bg-zinc-800/30`,children:[(0,K.jsx)(`div`,{className:B(`w-1 flex-shrink-0 rounded-l`,a?`bg-emerald-500`:`bg-rose-500`)}),(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2 py-2.5 pr-3 @[280px]/widget:gap-3`,children:[(0,K.jsx)(`span`,{className:B(`flex h-6 w-6 items-center justify-center rounded text-xs font-black`,a?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:`bg-rose-500/10 text-rose-600 dark:text-rose-400`),children:a?`W`:`L`}),(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,K.jsx)(N,{name:i.name,slug:i.slug,abbreviation:i.abbreviation,logoUrl:i.logoUrl,size:`xs`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`span`,{className:`block truncate text-xs font-semibold text-zinc-800 dark:text-zinc-200`,children:i.name}),e.tournament&&(0,K.jsx)(`div`,{className:`truncate text-xs text-zinc-400`,children:e.tournament.name})]})]}),(0,K.jsx)(`div`,{className:`flex shrink-0 items-center gap-0.5 rounded bg-zinc-100 px-2 py-1 dark:bg-zinc-800/60`,children:c!=null&&l!=null?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:B(`glk-metric glk-metric-sm`,a?`text-emerald-600 dark:text-emerald-400`:`text-zinc-500 dark:text-zinc-400`),children:c}),(0,K.jsx)(`span`,{className:`text-xs text-zinc-400 dark:text-zinc-500`,children:`–`}),(0,K.jsx)(`span`,{className:B(`glk-metric glk-metric-sm`,a?`text-zinc-500 dark:text-zinc-400`:`text-emerald-600 dark:text-emerald-400`),children:l})]}):(0,K.jsx)(`span`,{className:`text-xs text-zinc-400 dark:text-zinc-500`,children:`—`})}),(0,K.jsx)(`span`,{className:`shrink-0 whitespace-nowrap text-xs text-zinc-400 @[300px]/widget:text-xs`,children:gt(e.playedAt)})]})]})}function bt({recentMatches:e,form:t,teamId:n,gameSlug:r}){let i=(0,G.useMemo)(()=>t.length>0?t:e.filter(e=>e.winner).map(e=>e.winner?.id===n?`W`:`L`),[t,e,n]),a=i.filter(e=>e===`W`).length,o=i.filter(e=>e===`L`).length,s=i.length>0?Math.round(a/i.length*100):0,c=null,l=0;if(i.length>0){c=i[i.length-1];for(let e=i.length-1;e>=0&&i[e]===c;e--)l++}return(0,K.jsxs)(`div`,{children:[i.length>0&&(0,K.jsxs)(`div`,{className:`mb-4 rounded-lg bg-zinc-50/80 p-3 dark:bg-zinc-800/20`,children:[(0,K.jsxs)(`div`,{className:`mb-2 flex items-center justify-between`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`div`,{className:`flex gap-0.5`,role:`img`,"aria-label":`Last ${i.slice(-10).length} matches: ${a}W ${o}L`,children:i.slice(-10).map((e,t)=>(0,K.jsx)(`div`,{"aria-hidden":`true`,className:B(`h-4 w-2.5 rounded-sm`,e===`W`?`bg-emerald-500`:`bg-rose-500`)},t))}),(0,K.jsxs)(`span`,{className:`text-xs tabular-nums text-zinc-500`,children:[(0,K.jsxs)(`span`,{className:`text-2xs uppercase tracking-wider text-zinc-400 dark:text-zinc-500`,children:[`Last `,i.length,` series`]}),(0,K.jsx)(`span`,{className:`mx-1.5 text-zinc-300 dark:text-zinc-600`,children:`·`}),a,`W–`,o,`L`]}),(0,K.jsxs)(`span`,{className:`text-xs tabular-nums font-semibold text-zinc-600 dark:text-zinc-400`,children:[s,`%`,(0,K.jsx)(W,{text:`Win rate over recent series. The chart shows momentum — above the line means winning form, below means losing.`})]})]}),c&&l>=2&&(0,K.jsxs)(`span`,{className:B(`rounded-md px-2 py-0.5 text-xs font-bold`,c===`W`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:`bg-red-500/10 text-red-600 dark:text-red-400`),children:[l,c]})]}),(0,K.jsx)(_t,{form:i})]}),e.length>0?(0,K.jsx)(`div`,{className:`divide-y divide-zinc-100 rounded-lg border border-zinc-100 dark:divide-zinc-800/50 dark:border-zinc-800/50`,children:e.slice(0,6).map(e=>(0,K.jsx)(yt,{match:e,teamId:n,gameSlug:r},e.id))}):(0,K.jsx)(`div`,{className:`py-6 text-center text-xs text-zinc-500`,children:`No recent matches`}),e.length>6&&(0,K.jsx)(E,{to:`/${r}/matches`,className:`mt-2 block text-center text-xs font-medium text-[var(--glk-brand)] hover:underline`,children:`View all matches →`})]})}var xt={igl:`var(--glk-role-igl, #a855f7)`,controller:`var(--glk-role-controller, #3b82f6)`,initiator:`var(--glk-role-initiator, #f59e0b)`,duelist:`var(--glk-role-duelist, #ef4444)`,sentinel:`var(--glk-role-sentinel, #22c55e)`,flex:`var(--glk-role-flex, #06b6d4)`,sub:`var(--glk-role-sub, #71717a)`},St=[`var(--glk-loss)`,`var(--glk-role-initiator, #f59e0b)`,`var(--glk-win)`,`var(--glk-role-controller, #3b82f6)`,`var(--glk-role-igl, #a855f7)`,`var(--glk-role-flex, #06b6d4)`,`#ec4899`,`#8b5cf6`];function Ct(e){return e?xt[e.toLowerCase()]??`var(--glk-role-sub, #71717a)`:`var(--glk-role-sub, #71717a)`}function wt(e){let t=e.some(e=>e.role&&e.role.toLowerCase()!==`sub`),n=new Map;return e.forEach((e,r)=>{n.set(e.vlrId,t?Ct(e.role):St[r%St.length])}),n}function Tt(e){let t=e.map(e=>e.mapsPlayed).sort((e,t)=>e-t),n=t[Math.floor(t.length/2)],r=n>0?n*.3:0;return e.filter(e=>!(e.role?.toLowerCase()===`sub`||n>0&&e.mapsPlayed<r))}function Et({players:e,colors:t}){let n=e.filter(e=>(e.careerAvgAcs??0)>0);if(n.length===0)return null;let r=n.map(e=>e.careerAvgAcs??0),i=Math.floor(Math.min(...r)/10)*10-10,a=Math.ceil(Math.max(...r)/10)*10+10,o=a-i||1,s=[...n].sort((e,t)=>(t.careerAvgAcs??0)-(e.careerAvgAcs??0)),c=8+(Math.round(r.reduce((e,t)=>e+t,0)/r.length)-i)/o*304,l=o>60?20:10,u=[];for(let e=Math.ceil(i/l)*l;e<=a;e+=l)u.push(e);return(0,K.jsxs)(`svg`,{viewBox:`0 0 320 52`,className:`w-full`,preserveAspectRatio:`xMidYMid meet`,children:[(0,K.jsx)(`line`,{x1:8,y1:16,x2:312,y2:16,stroke:`currentColor`,strokeOpacity:`0.1`,strokeWidth:`1`}),u.map(e=>{let t=8+(e-i)/o*304;return(0,K.jsxs)(`g`,{children:[(0,K.jsx)(`line`,{x1:t,y1:13,x2:t,y2:19,stroke:`currentColor`,strokeOpacity:`0.1`,strokeWidth:`1`}),(0,K.jsx)(`text`,{x:t,y:28,textAnchor:`middle`,className:`fill-zinc-400 dark:fill-zinc-600`,fontSize:`7`,fontFamily:`var(--font-mono)`,children:e})]},e)}),(0,K.jsx)(`line`,{x1:c,y1:8,x2:c,y2:24,stroke:`currentColor`,strokeOpacity:`0.15`,strokeWidth:`1`,strokeDasharray:`2,2`}),(0,K.jsx)(`text`,{x:c,y:50,textAnchor:`middle`,className:`fill-zinc-400 dark:fill-zinc-500`,fontSize:`7`,fontFamily:`var(--font-mono)`,children:`avg`}),s.map((e,n)=>{let r=e.careerAvgAcs??0,a=8+(r-i)/o*304,s=t.get(e.vlrId)??`var(--glk-role-sub, #71717a)`,c=n===0;return(0,K.jsxs)(`g`,{children:[(0,K.jsx)(`circle`,{cx:a,cy:16,r:c?5:4,fill:s,opacity:c?.9:.65,stroke:`white`,strokeWidth:`1.5`,className:`dark:stroke-zinc-900`,children:(0,K.jsxs)(`title`,{children:[e.ign,`: `,Math.round(r),` ACS`]})}),(0,K.jsx)(`text`,{x:a,y:n%2==0?7:36,textAnchor:`middle`,className:`fill-zinc-500 dark:fill-zinc-400`,fontSize:`7`,fontWeight:c?`bold`:`normal`,fontFamily:`var(--font-mono)`,children:e.ign})]},e.vlrId)})]})}function Dt({roster:e,gameSlug:t}){let[n,r]=(0,G.useState)(`acs`),i=(0,G.useMemo)(()=>wt(e),[e]),a=(0,G.useMemo)(()=>{let t=Tt(e);return t.length>=3?t:e},[e]),o=[...a].sort((e,t)=>n===`acs`?(t.careerAvgAcs??0)-(e.careerAvgAcs??0):n===`kd`?(t.careerAvgKd??0)-(e.careerAvgKd??0):t.mapsPlayed-e.mapsPlayed),s=Math.max(...a.map(e=>e.careerAvgAcs??0),1),c=Math.max(...a.map(e=>e.careerAvgKd??0),.1),l=a.length>0?Math.round(a.reduce((e,t)=>e+(t.careerAvgAcs??0),0)/a.length):0;return(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`div`,{className:`mb-3 rounded-lg bg-zinc-50/80 p-3 dark:bg-zinc-800/20`,children:[(0,K.jsxs)(`div`,{className:`mb-1 flex items-baseline justify-between`,children:[(0,K.jsxs)(`span`,{className:`glk-eyebrow`,children:[`ACS Distribution`,(0,K.jsx)(W,{text:`Average Combat Score per round. Shows where each player sits relative to teammates.`})]}),(0,K.jsxs)(`span`,{className:`text-xs text-zinc-500 dark:text-zinc-400`,children:[(0,K.jsx)(`span`,{className:`glk-eyebrow mr-1`,children:`Team avg`}),(0,K.jsx)(`span`,{className:`glk-metric glk-metric-sm text-zinc-700 dark:text-zinc-200`,children:l})]})]}),(0,K.jsx)(Et,{players:a,colors:i})]}),a.some(e=>(e.careerAvgKd??0)>0)&&(0,K.jsxs)(`div`,{className:`mb-4 rounded-lg bg-zinc-50/80 p-3 dark:bg-zinc-800/20`,children:[(0,K.jsx)(`div`,{className:`mb-2`,children:(0,K.jsxs)(`span`,{className:`glk-eyebrow`,children:[`K/D Ratio`,(0,K.jsx)(W,{text:`Kills per death. Above 1.0 means more kills than deaths on average.`})]})}),(0,K.jsx)(`div`,{className:`flex items-end gap-1`,children:[...a].filter(e=>(e.careerAvgKd??0)>0).sort((e,t)=>(t.careerAvgKd??0)-(e.careerAvgKd??0)).map(e=>{let t=e.careerAvgKd??0,n=t/Math.max(...a.map(e=>e.careerAvgKd??0),.1)*100,r=i.get(e.vlrId)??`var(--glk-role-sub, #71717a)`;return(0,K.jsxs)(`div`,{className:`flex flex-1 flex-col items-center gap-0.5`,title:`${e.ign}: ${t.toFixed(2)} K/D`,children:[(0,K.jsx)(`span`,{className:`text-[8px] font-bold tabular-nums text-zinc-500 dark:text-zinc-400`,children:t.toFixed(2)}),(0,K.jsx)(`div`,{className:`w-full overflow-hidden rounded-t bg-zinc-100 dark:bg-zinc-800/40`,style:{height:`24px`},children:(0,K.jsx)(`div`,{className:`w-full rounded-t transition-all`,style:{height:`${n}%`,backgroundColor:r,opacity:.6,marginTop:`${100-n}%`}})}),(0,K.jsx)(`span`,{className:`max-w-full truncate text-[7px] text-zinc-400`,children:e.ign})]},e.vlrId)})})]}),(0,K.jsx)(`div`,{className:`glk-card !p-0 overflow-hidden`,children:(0,K.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,K.jsx)(`thead`,{children:(0,K.jsxs)(`tr`,{className:`border-b border-zinc-200 bg-zinc-50 dark:border-zinc-800 dark:bg-zinc-800/50`,children:[(0,K.jsx)(`th`,{className:`px-3 py-2.5 text-left font-medium text-zinc-500`,children:`Player`}),(0,K.jsx)(`th`,{className:`px-2 py-2.5 text-right font-medium text-zinc-500`,children:(0,K.jsx)(`button`,{onClick:()=>r(`acs`),"aria-label":`Sort by ACS`,"aria-pressed":n===`acs`,className:B(`transition-colors`,n===`acs`?`text-zinc-900 dark:text-zinc-100 font-bold`:`hover:text-zinc-700 dark:hover:text-zinc-300`),children:`ACS`})}),(0,K.jsx)(`th`,{className:`hidden px-2 py-2.5 text-right font-medium text-zinc-500 @[280px]/widget:table-cell`,children:(0,K.jsx)(`button`,{onClick:()=>r(`kd`),"aria-label":`Sort by K/D ratio`,"aria-pressed":n===`kd`,className:B(`transition-colors`,n===`kd`?`text-zinc-900 dark:text-zinc-100 font-bold`:`hover:text-zinc-700 dark:hover:text-zinc-300`),children:`K/D`})}),(0,K.jsx)(`th`,{className:`px-2 py-2.5 text-right font-medium text-zinc-500`,children:(0,K.jsx)(`button`,{onClick:()=>r(`maps`),"aria-label":`Sort by maps played`,"aria-pressed":n===`maps`,className:B(`transition-colors`,n===`maps`?`text-zinc-900 dark:text-zinc-100 font-bold`:`hover:text-zinc-700 dark:hover:text-zinc-300`),children:`Maps`})}),(0,K.jsx)(`th`,{className:`hidden w-20 px-2 py-2.5 @[360px]/widget:table-cell`})]})}),(0,K.jsx)(`tbody`,{className:`divide-y divide-zinc-100 dark:divide-zinc-800/50`,children:o.map((e,r)=>{let o=e.careerAvgAcs??0,l=e.careerAvgKd??0,u=n===`acs`?o/s*100:n===`kd`?l/c*100:e.mapsPlayed/Math.max(...a.map(e=>e.mapsPlayed),1)*100,d=r===0&&n===`acs`&&o>0,f=i.get(e.vlrId)??`var(--glk-role-sub, #71717a)`;return(0,K.jsxs)(`tr`,{className:B(`transition-colors hover:bg-zinc-50 dark:hover:bg-zinc-800/30`,d&&`bg-amber-50/50 dark:bg-amber-900/5`),children:[(0,K.jsx)(`td`,{className:`px-3 py-2.5`,children:e.slug?(0,K.jsxs)(E,{to:`/${t}/players/${e.slug}`,className:`flex items-center gap-1.5 font-semibold text-zinc-800 hover:text-zinc-900 dark:text-zinc-200 dark:hover:text-zinc-100`,children:[(0,K.jsx)(`div`,{className:`h-2 w-2 rounded-full flex-shrink-0`,style:{backgroundColor:f}}),d&&(0,K.jsx)(p,{size:11,className:`text-amber-500`,fill:`currentColor`,"aria-label":`Top performer`}),e.ign]}):(0,K.jsxs)(`span`,{"aria-disabled":`true`,className:`flex items-center gap-1.5 font-semibold text-zinc-800 dark:text-zinc-200 cursor-default`,children:[(0,K.jsx)(`div`,{className:`h-2 w-2 rounded-full flex-shrink-0`,style:{backgroundColor:f}}),d&&(0,K.jsx)(p,{size:11,className:`text-amber-500`,fill:`currentColor`,"aria-label":`Top performer`}),e.ign]})}),(0,K.jsx)(`td`,{className:`px-2 py-2.5 text-right tabular-nums font-bold text-zinc-700 dark:text-zinc-300`,children:o>0?Math.round(o):`—`}),(0,K.jsx)(`td`,{className:`hidden px-2 py-2.5 text-right tabular-nums text-zinc-700 dark:text-zinc-300 @[280px]/widget:table-cell`,children:l>0?l.toFixed(2):`—`}),(0,K.jsx)(`td`,{className:`px-2 py-2.5 text-right tabular-nums text-zinc-400`,children:e.mapsPlayed}),(0,K.jsx)(`td`,{className:`hidden w-20 px-2 py-2.5 @[360px]/widget:table-cell`,children:(0,K.jsx)(`div`,{className:`h-1.5 w-full overflow-hidden rounded-full bg-zinc-100 dark:bg-zinc-800`,children:(0,K.jsx)(`div`,{className:`h-full rounded-full transition-all`,style:{width:`${u}%`,backgroundColor:f,opacity:.6}})})})]},e.vlrId)})})]})})]})}function Ot({results:e}){return e.length===0?null:(0,K.jsx)(`div`,{className:`flex gap-px`,children:e.slice(-8).map((t,n)=>(0,K.jsx)(`div`,{className:`h-3 w-1.5 rounded-[1px] ${t===`W`?`bg-emerald-500`:`bg-rose-500`}`,style:{opacity:.4+n/e.length*.6}},n))})}function kt({winRate:e,size:t=32}){let n=(t-4)/2,r=t/2,i=t/2,a=2*Math.PI*n,o=a*e,s=Math.round(e*100);return(0,K.jsxs)(`svg`,{width:t,height:t,viewBox:`0 0 ${t} ${t}`,className:`flex-shrink-0`,children:[(0,K.jsx)(`circle`,{cx:r,cy:i,r:n,fill:`none`,stroke:`currentColor`,strokeOpacity:`0.08`,strokeWidth:`3`}),(0,K.jsx)(`circle`,{cx:r,cy:i,r:n,fill:`none`,stroke:s>=50?`var(--glk-win)`:`var(--glk-loss)`,strokeWidth:`3`,strokeLinecap:`round`,strokeDasharray:`${o} ${a}`,strokeDashoffset:a*.25,opacity:`0.7`}),(0,K.jsx)(`text`,{x:r,y:i+1,textAnchor:`middle`,dominantBaseline:`middle`,className:`fill-zinc-600 dark:fill-zinc-300`,fontSize:`8`,fontWeight:`bold`,fontFamily:`var(--font-mono)`,children:s})]})}function At({recentMatches:e,teamId:t}){let{mapStats:n,mapResults:r}=(0,G.useMemo)(()=>{let n=new Map;for(let r of e)if(r.mapResults)for(let e of r.mapResults){if(!e.winnerId)continue;let r=n.get(e.mapName)??{wins:0,losses:0,results:[]};e.winnerId===t?(r.wins++,r.results.push(`W`)):(r.losses++,r.results.push(`L`)),n.set(e.mapName,r)}let r=[],i=new Map;for(let[e,{wins:t,losses:a,results:o}]of n){let n=t+a;r.push({mapName:e,wins:t,losses:a,total:n,winRate:n>0?t/n:0}),i.set(e,o)}return{mapStats:r.sort((e,t)=>t.total-e.total),mapResults:i}},[e,t]);if(n.length===0)return(0,K.jsx)(`div`,{className:`py-6 text-center text-xs text-zinc-500 dark:text-zinc-400`,children:`No map data from recent matches`});let i=Math.max(...n.map(e=>e.total));return(0,K.jsx)(`div`,{className:`space-y-1.5`,children:n.map(e=>{let t=r.get(e.mapName)??[],n=e.total<=1&&i>=4,a=e.winRate>=.75&&e.total>=3;return(0,K.jsxs)(`div`,{className:`group relative overflow-hidden rounded-lg border transition-colors ${a?`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`}`,children:[(0,K.jsx)(`div`,{className:`absolute inset-0 opacity-[0.03] dark:opacity-[0.05]`,children:(0,K.jsx)(Se,{name:e.mapName,variant:`strip`,index:0,total:1})}),(0,K.jsxs)(`div`,{className:`relative flex items-center gap-3 px-3 py-2.5`,children:[(0,K.jsx)(kt,{winRate:e.winRate}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(`span`,{className:`glk-eyebrow text-zinc-700 dark:text-zinc-300`,children:e.mapName}),a&&(0,K.jsxs)(`span`,{className:`rounded bg-emerald-500/10 px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-wider text-emerald-700 dark:text-emerald-400`,children:[`Fortress`,(0,K.jsx)(W,{text:`75%+ win rate with 3+ maps played — a strong pick for this team.`})]}),n&&(0,K.jsxs)(`span`,{className:`rounded bg-rose-500/10 px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-wider text-rose-600 dark:text-rose-400`,children:[`Permaban`,(0,K.jsx)(W,{text:`Rarely or never played — likely banned every series.`})]})]}),(0,K.jsx)(`div`,{className:`mt-1`,children:(0,K.jsx)(Ot,{results:t})})]}),(0,K.jsxs)(`div`,{className:`flex flex-col items-end gap-0.5 text-right`,children:[(0,K.jsxs)(`span`,{className:`glk-tabular text-xs text-zinc-500 dark:text-zinc-400`,children:[(0,K.jsxs)(`span`,{className:`font-bold text-emerald-600 dark:text-emerald-400`,children:[e.wins,`W`]}),` `,(0,K.jsxs)(`span`,{className:`font-bold text-rose-500 dark:text-rose-400`,children:[e.losses,`L`]})]}),(0,K.jsxs)(`span`,{className:`glk-tabular text-2xs text-zinc-400 dark:text-zinc-500`,children:[e.total,` played`]})]})]})]},e.mapName)})})}var jt={id:``,name:`TBD`,slug:void 0,abbreviation:null,logoUrl:null};function Y(e){return e??jt}function Mt(e){let t=new Date(e).getTime()-Date.now(),n=Math.abs(t)/864e5;return n>=2&&n<7}function Nt(e,t){if(!e||!t)return e;let n=new Date(t).getUTCFullYear();return Number.isFinite(n)?e.replace(/\b(19[9]\d|20\d{2})\b/g,e=>Number(e)<n?``:e).replace(/\s{2,}/g,` `).replace(/\s+([·–-])\s+/g,` $1 `).trim():e}function Pt({match:e,gameSlug:t}){let n=Y(e.team1),r=Y(e.team2),i=e.scheduledAt?new Date(e.scheduledAt):null,a=F(e.tournament?.tier);return(0,K.jsxs)(E,{to:`/${t}/matches/${e.id}`,className:`glk-card glk-card-interactive group block bg-zinc-50 dark:bg-zinc-800/40`,children:[(0,K.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-2`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[a&&(0,K.jsx)(`span`,{className:B(`shrink-0 rounded px-1.5 py-0.5 text-2xs font-bold leading-none`,M(e.tournament?.tier)),children:a}),(0,K.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-zinc-600 dark:text-zinc-300`,children:e.tournament?.name?Nt(e.tournament.name,e.scheduledAt):null})]}),e.format&&(0,K.jsx)(`span`,{className:`shrink-0 rounded border border-zinc-200 px-1.5 py-0.5 text-2xs font-bold uppercase tracking-wider text-zinc-500 dark:border-white/10 dark:text-zinc-400`,children:e.format})]}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col items-center gap-1.5`,children:[(0,K.jsx)(N,{name:n.name,slug:n.slug,abbreviation:n.abbreviation,logoUrl:n.logoUrl,size:`md`}),(0,K.jsx)(`span`,{className:B(`max-w-full truncate text-xs font-bold text-zinc-800 dark:text-zinc-200`,!e.team1&&`opacity-40`),children:n.abbreviation??n.name})]}),(0,K.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,K.jsx)(`span`,{className:`glk-eyebrow text-zinc-400 dark:text-zinc-500`,children:`VS`}),i&&(0,K.jsxs)(`div`,{className:`text-center`,children:[(0,K.jsx)(`div`,{className:`text-xs font-bold text-[var(--glk-brand)]`,children:_e(e.scheduledAt)}),Mt(e.scheduledAt)&&(0,K.jsx)(`div`,{className:`glk-tabular hidden text-xs text-zinc-500 dark:text-zinc-400 @[260px]/widget:block`,children:i.toLocaleDateString(`en-US`,{weekday:`short`,month:`short`,day:`numeric`})}),(0,K.jsx)(`div`,{className:`glk-tabular hidden text-xs text-zinc-400 dark:text-zinc-500 @[260px]/widget:block`,children:i.toLocaleTimeString(`en-US`,{hour:`numeric`,minute:`2-digit`})})]})]}),(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col items-center gap-1.5`,children:[(0,K.jsx)(N,{name:r.name,slug:r.slug,abbreviation:r.abbreviation,logoUrl:r.logoUrl,size:`md`}),(0,K.jsx)(`span`,{className:B(`max-w-full truncate text-xs font-bold text-zinc-800 dark:text-zinc-200`,!e.team2&&`opacity-40`),children:r.abbreviation??r.name})]})]})]})}function Ft({match:e,gameSlug:t}){let n=Y(e.team1),r=Y(e.team2),i=e.scheduledAt?new Date(e.scheduledAt):null,a=n.abbreviation??n.name,o=r.abbreviation??r.name;return(0,K.jsxs)(E,{to:`/${t}/matches/${e.id}`,className:`flex items-center gap-2 px-3 py-2.5 transition-colors hover:bg-zinc-50 dark:hover:bg-zinc-800/40 @[340px]/widget:gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5 @[340px]/widget:gap-2`,children:[(0,K.jsx)(N,{name:n.name,slug:n.slug,abbreviation:n.abbreviation,logoUrl:n.logoUrl,size:`xs`}),(0,K.jsxs)(`span`,{className:B(`min-w-0 truncate text-xs font-semibold text-zinc-700 dark:text-zinc-300`,!e.team1&&`opacity-40`),children:[(0,K.jsx)(`span`,{className:`@[340px]/widget:hidden`,children:a}),(0,K.jsx)(`span`,{className:`hidden @[340px]/widget:inline`,children:n.name})]}),(0,K.jsx)(`span`,{className:`shrink-0 text-2xs text-zinc-400 @[340px]/widget:text-xs`,children:`vs`}),(0,K.jsx)(N,{name:r.name,slug:r.slug,abbreviation:r.abbreviation,logoUrl:r.logoUrl,size:`xs`}),(0,K.jsxs)(`span`,{className:B(`min-w-0 truncate text-xs font-semibold text-zinc-700 dark:text-zinc-300`,!e.team2&&`opacity-40`),children:[(0,K.jsx)(`span`,{className:`@[340px]/widget:hidden`,children:o}),(0,K.jsx)(`span`,{className:`hidden @[340px]/widget:inline`,children:r.name})]})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-0.5 text-right`,children:[(0,K.jsx)(`span`,{className:`text-xs font-medium text-zinc-500 dark:text-zinc-400 @[340px]/widget:text-xs`,children:i?_e(e.scheduledAt):`—`}),e.scheduledAt&&Mt(e.scheduledAt)&&(0,K.jsx)(`span`,{className:`hidden text-xs text-zinc-400 @[340px]/widget:inline`,children:i.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`})}),e.format&&(0,K.jsx)(`span`,{className:`hidden text-xs text-zinc-400 @[400px]/widget:inline`,children:e.format})]})]})}function It({upcomingMatches:e,gameSlug:t}){if(e.length===0)return(0,K.jsx)(`div`,{className:`py-6 text-center text-xs text-zinc-500`,children:`No upcoming matches`});let[n,...r]=e;return(0,K.jsxs)(`div`,{children:[(0,K.jsx)(Pt,{match:n,gameSlug:t}),r.length>0&&(0,K.jsx)(`div`,{className:`mt-3 divide-y divide-zinc-100 rounded-lg border border-zinc-100 dark:divide-zinc-800/50 dark:border-zinc-800/50`,children:r.slice(0,4).map(e=>(0,K.jsx)(Ft,{match:e,gameSlug:t},e.id))})]})}function Lt(e,t){return ue(ne.teamSentiment,{gameSlug:e,teamSlug:t},{enabled:!!t})}var Rt={up:`text-emerald-700 bg-emerald-50 border-emerald-200 dark:text-emerald-400 dark:bg-emerald-500/10 dark:border-emerald-500/20`,down:`text-rose-600 bg-rose-50 border-rose-200 dark:text-rose-400 dark:bg-rose-500/10 dark:border-rose-500/20`,neutral:`text-zinc-500 bg-zinc-50 border-zinc-200 dark:text-zinc-400 dark:bg-zinc-500/10 dark:border-zinc-500/20`},zt={up:u,down:l,neutral:O},Bt={xs:`gap-0.5 px-1.5 py-0.5 text-2xs`,sm:`gap-1 px-2 py-0.5 text-xs tracking-tight`},Vt={xs:9,sm:10};function Ht({tone:e,label:t,size:n=`sm`,className:r}){let i=zt[e];return(0,K.jsxs)(`span`,{className:B(`inline-flex items-center rounded-full border font-semibold whitespace-nowrap`,Bt[n],Rt[e],r),children:[(0,K.jsx)(i,{size:Vt[n],"aria-hidden":`true`}),t]})}function Ut(e){return e>=.15?`up`:e<=-.15?`down`:`neutral`}function Wt(e){return e>=.4?`On a tear`:e>=.15?`Trending up`:e>-.15?`Mixed signals`:e>-.4?`Under pressure`:`In crisis`}function Gt(e){return e>=.15?`emerald`:e>-.15?`zinc`:`rose`}function Kt({data:e,sentiment:t}){let n=Gt(t),{linePath:r,fillPath:i,dots:a}=(0,G.useMemo)(()=>{if(e.length<2)return{linePath:``,fillPath:``,dots:[]};let t=e=>36-(e+1)/2*32,n=e.length-1,r=e.map((e,r)=>({x:4+r/n*192,y:t(e.avgSentiment),sentiment:e.avgSentiment})),i=`M${r[0].x},${r[0].y}`;for(let e=1;e<r.length;e++){let t=(r[e-1].x+r[e].x)/2;i+=` C${t},${r[e-1].y} ${t},${r[e].y} ${r[e].x},${r[e].y}`}let a=t(0),o=`${i} L${r[r.length-1].x},${a} L${r[0].x},${a} Z`;return{linePath:i,fillPath:o,dots:r}},[e]);if(e.length<2)return null;let o=n===`emerald`?`#10b981`:n===`rose`?`#f43f5e`:`#71717a`;return(0,K.jsxs)(`svg`,{viewBox:`0 0 200 40`,className:`w-full h-10`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:[(0,K.jsx)(`line`,{x1:`0`,y1:`20`,x2:`200`,y2:`20`,stroke:`currentColor`,strokeWidth:`0.5`,strokeDasharray:`2 3`,className:`text-zinc-300 dark:text-zinc-700`}),i&&(0,K.jsx)(`path`,{d:i,fill:n===`emerald`?`rgba(16,185,129,0.12)`:n===`rose`?`rgba(244,63,94,0.12)`:`rgba(113,113,122,0.08)`}),r&&(0,K.jsx)(`path`,{d:r,fill:`none`,stroke:o,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`}),a.length>0&&(0,K.jsx)(`circle`,{cx:a[a.length-1].x,cy:a[a.length-1].y,r:`2.5`,fill:o,opacity:.9})]})}function qt(){return(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-baseline gap-3`,children:[(0,K.jsx)(`div`,{className:`h-8 w-16 animate-pulse rounded bg-zinc-100 dark:bg-zinc-800`}),(0,K.jsx)(`div`,{className:`h-5 w-24 animate-pulse rounded-full bg-zinc-100 dark:bg-zinc-800`}),(0,K.jsx)(`div`,{className:`ml-auto h-4 w-16 animate-pulse rounded bg-zinc-100 dark:bg-zinc-800`})]}),(0,K.jsx)(`div`,{className:`h-10 w-full animate-pulse rounded bg-zinc-100 dark:bg-zinc-800`}),(0,K.jsx)(`div`,{className:`flex gap-1.5`,children:[60,80,56,72].map((e,t)=>(0,K.jsx)(`div`,{className:`h-5 animate-pulse rounded-full bg-zinc-100 dark:bg-zinc-800`,style:{width:`${e}px`}},t))}),(0,K.jsx)(`div`,{className:`h-3 w-36 animate-pulse rounded bg-zinc-100 dark:bg-zinc-800`})]})}function Jt({gameSlug:e,teamSlug:n}){let{data:r,isLoading:i,isError:a}=Lt(e,n);if(i)return(0,K.jsx)(qt,{});if(a)return(0,K.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-6 text-zinc-400 dark:text-zinc-500`,children:[(0,K.jsx)(t,{size:20,strokeWidth:1.5}),(0,K.jsx)(`p`,{className:`text-sm font-medium`,children:`Couldn't load sentiment data`})]});if(!r||r.mentionCount===0)return(0,K.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-6 text-zinc-400 dark:text-zinc-500`,children:[(0,K.jsx)(t,{size:20,strokeWidth:1.5}),(0,K.jsx)(`p`,{className:`text-sm font-medium`,children:`No community signals for this team yet`}),(0,K.jsx)(`p`,{className:`text-xs text-zinc-400/70 dark:text-zinc-600`,children:`Check back once the community starts talking`})]});let{currentSentiment:o,delta:s,mentionCount:c,topThemes:d,sentimentSparkline:f}=r,p=Gt(o),m=Wt(o),h=Ut(o),g=f.length>=2,_=Math.abs(s)>=.03,v=(o>=0?`+`:``)+o.toFixed(2),y=(s>=0?`+`:``)+s.toFixed(2),b=_?s>0?u:l:O,x=p===`emerald`?`text-emerald-600 dark:text-emerald-400`:p===`rose`?`text-rose-500 dark:text-rose-400`:`text-zinc-500 dark:text-zinc-400`,S=_?s>0?`text-emerald-500 dark:text-emerald-400`:`text-rose-500 dark:text-rose-400`:`text-zinc-400 dark:text-zinc-500`,C=e=>e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase());return(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,K.jsx)(`span`,{className:`glk-eyebrow`,children:`Community sentiment · last 7d`})}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2.5 flex-wrap`,children:[(0,K.jsx)(`span`,{className:B(`glk-metric glk-metric-xl leading-none`,x),children:v}),(0,K.jsx)(Ht,{tone:h,label:m}),(0,K.jsxs)(`div`,{className:B(`ml-auto flex items-center gap-0.5 text-xs font-semibold tabular-nums`,S),children:[(0,K.jsx)(b,{size:12,"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:_?y:`—`}),(0,K.jsx)(`span`,{className:`ml-0.5 font-normal text-zinc-400 dark:text-zinc-600`,children:`vs last week`})]})]}),g?(0,K.jsx)(`div`,{className:`rounded-md bg-zinc-50 px-2 py-1 dark:bg-zinc-800/30`,children:(0,K.jsx)(Kt,{data:f,sentiment:o})}):(0,K.jsx)(`p`,{className:`text-xs text-zinc-400 dark:text-zinc-600`,children:`Not enough history for trend chart`}),d.length>0&&(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsx)(`span`,{className:`glk-eyebrow`,children:`Top Themes`}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:d.map(({theme:e})=>(0,K.jsx)(`span`,{className:`rounded-full bg-zinc-100 px-2 py-0.5 text-xs font-semibold text-zinc-600 dark:bg-zinc-800 dark:text-zinc-300`,children:C(e)},e))})]}),(0,K.jsxs)(`p`,{className:`glk-tabular text-2xs text-zinc-400 dark:text-zinc-500`,children:[c,` community signal`,c===1?``:`s`,` this week`]})]})}function Yt({championships:e,gameSlug:t}){let n=(0,G.useMemo)(()=>Xt(e),[e]);return e.length===0?null:(0,K.jsxs)(`section`,{className:`glk-card !p-3`,"aria-label":`Trophy case`,children:[(0,K.jsxs)(`header`,{className:`mb-2 flex items-center gap-1.5`,children:[(0,K.jsx)(C,{size:13,className:`text-[var(--glk-brand)]`,"aria-hidden":!0}),(0,K.jsx)(`h3`,{className:`glk-eyebrow text-zinc-700 dark:text-zinc-200`,children:`Trophy Case`}),(0,K.jsx)(`span`,{className:`glk-tabular text-2xs font-semibold text-zinc-700 dark:text-zinc-300`,children:e.length}),(0,K.jsx)(Qt,{grouped:n,className:`ml-auto`})]}),n.vct.length>0&&(0,K.jsx)(X,{label:`VCT International`,tier:`vct`,trophies:n.vct,gameSlug:t,collapseAfter:1/0}),n.vcl.length>0&&(0,K.jsx)(X,{label:`Challengers`,tier:`vcl`,trophies:n.vcl,gameSlug:t,collapseAfter:1/0}),n.gc.length>0&&(0,K.jsx)(X,{label:`Game Changers`,tier:`gc`,trophies:n.gc,gameSlug:t,collapseAfter:1/0}),n.other.length>0&&(0,K.jsx)(X,{label:`Open / Other`,tier:`t3`,trophies:n.other,gameSlug:t,collapseAfter:5})]})}function Xt(e){let t={vct:[],vcl:[],gc:[],other:[]};for(let n of e)n.tier===`vct`||n.tier===`t1`?t.vct.push(n):n.tier===`vcl`||n.tier===`t2`?t.vcl.push(n):n.tier===`game-changers`||n.tier===`gc`?t.gc.push(n):t.other.push(n);let n=(e,t)=>{let n=new Date(e.endDate??e.startDate??0).getTime();return new Date(t.endDate??t.startDate??0).getTime()-n};return t.vct.sort(n),t.vcl.sort(n),t.gc.sort(n),t.other.sort(n),t}function Zt(e){let t=e.endDate??e.startDate;return t?new Date(t).getFullYear():null}function Qt({grouped:e,className:t}){let n=[];return e.vct.length>0&&n.push({label:`VCT`,count:e.vct.length,tier:`vct`}),e.vcl.length>0&&n.push({label:`CHAL`,count:e.vcl.length,tier:`vcl`}),e.gc.length>0&&n.push({label:`GC`,count:e.gc.length,tier:`gc`}),e.other.length>0&&n.push({label:`OPEN`,count:e.other.length,tier:`t3`}),n.length===0?null:(0,K.jsx)(`span`,{className:B(`flex items-center gap-1.5`,t),children:n.map(e=>(0,K.jsxs)(`span`,{className:B(`inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-2xs font-bold leading-none`,M(e.tier)),children:[e.label,(0,K.jsx)(`span`,{className:`glk-tabular`,children:e.count})]},e.tier))})}function X({label:e,tier:t,trophies:n,gameSlug:i,collapseAfter:a}){let o=n.length>a,[s,c]=(0,G.useState)(!o),l=s?n:n.slice(0,a);return(0,K.jsxs)(`div`,{className:`mt-2 first:mt-0`,children:[(0,K.jsxs)(`header`,{className:`mb-1 flex items-center gap-1.5`,children:[(0,K.jsx)(`span`,{className:`glk-eyebrow text-zinc-700 dark:text-zinc-300`,children:e}),(0,K.jsx)(`span`,{className:`glk-tabular text-2xs font-semibold text-zinc-500 dark:text-zinc-400`,children:n.length})]}),(0,K.jsx)(`ul`,{className:`divide-y divide-zinc-200/70 dark:divide-zinc-800/70`,children:l.map(e=>(0,K.jsx)($t,{tournament:e,tier:t,gameSlug:i},e.id))}),o&&(0,K.jsxs)(`button`,{type:`button`,onClick:()=>c(e=>!e),className:`mt-1 inline-flex items-center gap-1 text-2xs font-semibold uppercase tracking-wide text-zinc-600 transition-colors hover:text-[var(--glk-brand)] dark:text-zinc-400`,children:[(0,K.jsx)(r,{size:10,className:B(`transition-transform`,s&&`rotate-180`),"aria-hidden":!0}),s?`Show fewer`:`Show all ${n.length}`]})]})}function $t({tournament:e,tier:t,gameSlug:n}){let r=F(t),i=Zt(e);return(0,K.jsxs)(`li`,{className:`flex items-center gap-1.5 py-1`,children:[(0,K.jsx)(xe,{to:`/${n}/tournaments/${e.slug}`,className:`flex-1 truncate text-xs font-medium text-zinc-900 hover:text-[var(--glk-brand)] dark:text-zinc-100`,title:e.name,children:e.name}),r&&(0,K.jsx)(`span`,{className:B(`flex-shrink-0 rounded px-1.5 py-0.5 text-2xs font-bold leading-none`,M(t)),children:r}),i&&(0,K.jsx)(`span`,{className:`glk-tabular w-9 flex-shrink-0 text-right text-2xs text-zinc-600 dark:text-zinc-400`,children:i})]})}function en({championships:e,anchorId:t=`trophy-case`,className:n}){if(e.length===0)return null;let r=tn(e),i=[];return r.vct>0&&i.push({key:`vct`,label:`VCT`,count:r.vct,marquee:!0}),r.vcl>0&&i.push({key:`vcl`,label:`CHAL`,count:r.vcl}),r.gc>0&&i.push({key:`gc`,label:`GC`,count:r.gc}),r.other>0&&i.push({key:`t3`,label:`OPEN`,count:r.other}),(0,K.jsx)(`div`,{className:B(`flex items-center gap-1`,n),"aria-label":`${e.length} tournament ${e.length===1?`win`:`wins`}`,children:i.map(e=>(0,K.jsxs)(`a`,{href:`#${t}`,title:`${e.count} ${e.label} ${e.count===1?`title`:`titles`} — view full trophy case`,className:B(`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-2xs font-bold leading-none transition-colors`,M(e.key),e.marquee&&`ring-1 ring-[var(--glk-brand)]/20`),children:[(0,K.jsx)(C,{size:10,"aria-hidden":!0}),(0,K.jsxs)(`span`,{className:`glk-tabular`,children:[`×`,e.count]}),(0,K.jsx)(`span`,{children:e.label})]},e.key))})}function tn(e){let t={vct:0,vcl:0,gc:0,other:0};for(let n of e)n.tier===`vct`||n.tier===`t1`?t.vct++:n.tier===`vcl`||n.tier===`t2`?t.vcl++:n.tier===`game-changers`||n.tier===`gc`?t.gc++:t.other++;return t}function nn({results:e,gameSlug:t}){let n=(0,G.useMemo)(()=>{let t=e.filter(e=>e.placement.kind!==`champion`);return t.sort((e,t)=>{let n=new Date(e.endDate??e.startDate??0).getTime();return new Date(t.endDate??t.startDate??0).getTime()-n}),t.slice(0,25)},[e]);return n.length===0?null:(0,K.jsxs)(`section`,{className:`glk-card !p-3`,"aria-label":`Notable finishes`,children:[(0,K.jsxs)(`header`,{className:`mb-2 flex items-center gap-1.5`,children:[(0,K.jsx)(o,{size:13,className:`text-zinc-500 dark:text-zinc-400`,"aria-hidden":!0}),(0,K.jsx)(`h3`,{className:`glk-eyebrow text-zinc-700 dark:text-zinc-200`,children:`Notable Finishes`}),(0,K.jsx)(`span`,{className:`glk-tabular text-2xs font-semibold text-zinc-700 dark:text-zinc-300`,children:n.length})]}),(0,K.jsx)(`ul`,{className:`divide-y divide-zinc-200/70 dark:divide-zinc-800/70`,children:n.map(e=>(0,K.jsx)(rn,{entry:e,gameSlug:t},e.tournamentId))})]})}function rn({entry:e,gameSlug:t}){let n=an(e),r=F(e.tier),{label:i,hint:a,color:s}=on(e.placement);return(0,K.jsxs)(`li`,{className:`flex items-center gap-1.5 py-1`,children:[(0,K.jsxs)(`span`,{className:B(`inline-flex h-5 w-10 flex-shrink-0 items-center justify-center gap-0.5 rounded text-2xs font-bold leading-none`,s),title:a,"aria-label":a,children:[e.placement.kind===`runner_up`||e.placement.kind===`semifinalist`?(0,K.jsx)(o,{size:10,"aria-hidden":!0}):null,(0,K.jsx)(`span`,{className:`glk-tabular`,children:i})]}),(0,K.jsx)(xe,{to:`/${t}/tournaments/${e.tournamentSlug}`,className:`flex-1 truncate text-xs font-medium text-zinc-900 hover:text-[var(--glk-brand)] dark:text-zinc-100`,title:`${e.tournamentName} — ${a}`,children:e.tournamentName}),r&&(0,K.jsx)(`span`,{className:B(`flex-shrink-0 rounded px-1.5 py-0.5 text-2xs font-bold leading-none`,M(e.tier)),children:r}),n&&(0,K.jsx)(`span`,{className:`glk-tabular w-9 flex-shrink-0 text-right text-2xs text-zinc-600 dark:text-zinc-400`,children:n})]})}function an(e){let t=e.endDate??e.startDate;return t?new Date(t).getFullYear():null}function on(e){switch(e.kind){case`runner_up`:return{label:`2nd`,hint:`Runner-up`,color:`bg-zinc-200 text-zinc-800 dark:bg-zinc-300/20 dark:text-zinc-200`};case`semifinalist`:return e.rank===3?{label:`3rd`,hint:`Semifinalist (3rd)`,color:`bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-300`}:{label:`4th`,hint:`Semifinalist (4th)`,color:`bg-zinc-100 text-zinc-700 dark:bg-zinc-800 dark:text-zinc-300`};case`quarterfinalist`:return{label:`Top 8`,hint:`Quarterfinalist`,color:`bg-zinc-100 text-zinc-700 dark:bg-zinc-800 dark:text-zinc-300`};case`top_16`:return{label:`Top 16`,hint:`Round of 16 exit`,color:`bg-zinc-100 text-zinc-600 dark:bg-zinc-800/70 dark:text-zinc-400`};case`top_32`:return{label:`Top 32`,hint:`Round of 32 exit`,color:`bg-zinc-100 text-zinc-600 dark:bg-zinc-800/70 dark:text-zinc-400`};case`group_top`:{let t=e.record?` (${e.record})`:``;return{label:e.rank>0?`#${e.rank}`:`Qual`,hint:`Qualified from group${t}`,color:`bg-emerald-100 text-emerald-800 dark:bg-emerald-900/30 dark:text-emerald-300`}}case`group_eliminated`:{let t=e.record?` (${e.record})`:``;return{label:e.rank>0?`#${e.rank}`:`Group`,hint:`Eliminated in group${t}`,color:`bg-zinc-100 text-zinc-500 dark:bg-zinc-800/70 dark:text-zinc-400`}}case`participant`:return{label:`—`,hint:`Attended`,color:`bg-zinc-100 text-zinc-500 dark:bg-zinc-800/70 dark:text-zinc-400`};case`champion`:return{label:`1st`,hint:`Champion`,color:`bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-300`}}}function sn({hideBreadcrumbs:e}={}){let{gameSlug:t,teamSlug:n}=y(),{data:r,isLoading:i,isError:a,error:o,refetch:s}=Ne(t,n),{data:c}=Ge(t,r?.id),{isWatching:l,addToWatchlist:u,removeFromWatchlist:d,getPageWidgetConfig:f,updatePageWidgetConfig:p}=ee(),{isAdmin:m}=at(),[h,g]=(0,G.useState)(!1),[_,v]=(0,G.useState)(!1);R(r?.name);let b=r?.tier??null,x=b===`t1`?`T1`:b===`t2`?`T2`:b===`gc`?`GC`:`T3`,S=(0,G.useMemo)(()=>{if(!r)return[];let e=[],i=r.activeRoster??[],a=r.staff??[],o=r.inactivePlayers??[];return(i.length>0||(r.players??[]).length>0)&&e.push({key:`roster`,title:`Roster`,size:`md`,component:(0,K.jsx)(ht,{activeRoster:i,staff:a,inactivePlayers:o,legacyPlayers:r.players??[],gameSlug:t,teamSlug:n})}),(r.upcomingMatches??[]).length>0&&e.push({key:`upcoming`,title:`Upcoming`,size:`sm`,component:(0,K.jsx)(It,{upcomingMatches:r.upcomingMatches??[],gameSlug:t})}),e.push({key:`recentForm`,title:`Recent Form`,size:`sm`,component:(0,K.jsx)(bt,{recentMatches:r.recentMatches??[],form:r.stats?.form??[],teamId:r.id,gameSlug:t})}),e.push({key:`mapPool`,title:`Map Pool`,size:`sm`,component:(0,K.jsx)(At,{recentMatches:r.recentMatches??[],teamId:r.id})}),e.push({key:`communitySentiment`,title:`Community Sentiment`,size:`sm`,component:(0,K.jsx)(Jt,{gameSlug:t,teamSlug:n})}),i.length>0&&e.push({key:`playerStats`,title:`Player Stats`,size:`md`,component:(0,K.jsx)(Dt,{roster:i,gameSlug:t,teamSlug:n})}),c&&c.length>1&&e.push({key:`ratingChart`,title:`Rating History`,size:`md`,component:(0,K.jsx)(Ve,{history:c,currentRank:r.rank})}),e},[r,c,t,n]),C=`teamDetail`,w=f(C,{order:(0,G.useMemo)(()=>S.map(e=>e.key),[S]),sizes:{}}),E=(0,G.useMemo)(()=>{let e=new Map(S.map(e=>[e.key,e])),t=new Set(w.hidden),n=w.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,w.order,w.hidden]),D=e=>{p(C,{order:e})},O=e=>{p(C,{hidden:[...w.hidden,e]})};if(a&&o instanceof A)return(0,K.jsx)(He,{entityType:`team`,gameSlug:t});if(i||a||!r)return(0,K.jsx)(ae,{title:`Team`,breadcrumbs:e?void 0:[{label:`Teams`,href:`/${t}/teams`}],className:`flex h-full flex-col overflow-hidden`,loadingKind:`detail`,emptyMessage:`Team not found.`,status:{isLoading:i,isError:a,error:a?Error(`Failed to load team`):null,isEmpty:!i&&!a&&!r,retry:()=>void s()},children:(0,K.jsx)(`div`,{})});let k=U(t),j=[`${r.name} — ${k} team${r.region?` from ${r.region}`:``}.`,r.rating==null?null:`Glicko rating ${Math.round(r.rating)}.`,r.rank==null?null:`Currently ranked #${r.rank}.`,`Roster, match history, stats, and community sentiment on Glicko.`].filter(Boolean).join(` `),M=le({name:r.name,url:typeof window<`u`?window.location.href:`https://glicko.app/${t}/teams/${r.slug}`,logo:r.logoUrl??void 0,sport:k,location:r.region??void 0}),P=r.activeRoster??[];return P.length>0&&(M.athlete=P.map(e=>{let n={"@type":`Person`,name:e.ign};return e.slug&&(n.url=`https://glicko.app/${t}/players/${e.slug}`),n})),(0,K.jsxs)(ae,{title:r.name,lightVignette:!0,breadcrumbs:e?void 0:[{label:`Teams`,href:`/${t}/teams`}],seo:{title:`${r.name} — ${k} Team`,description:j,image:Te(t??`valorant`,`team`,r.slug),type:`profile`},actions:(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(ke,{entry:{type:`team`,slug:r.slug,name:r.name},isWatching:l(r.slug),onAdd:u,onRemove:d}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>v(!0),"aria-label":`Compare ${r.name} to another team`,className:`inline-flex items-center gap-1.5 rounded-md border border-zinc-300 bg-white px-3 py-1.5 text-xs font-medium text-zinc-700 transition-colors hover:border-[var(--glk-brand)] hover:text-[var(--glk-brand)] dark:border-zinc-700 dark:bg-zinc-900 dark:text-zinc-200`,children:[(0,K.jsx)(T,{size:14,"aria-hidden":`true`}),`Compare`]}),m&&(0,K.jsx)(Ee,{editing:h,onToggle:()=>g(e=>!e)})]}),tabs:h?(0,K.jsx)(Oe,{}):void 0,className:`flex h-full flex-col overflow-hidden`,children:[(0,K.jsx)(oe,{data:M}),(0,K.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:(0,K.jsxs)(`div`,{className:`mx-auto max-w-6xl`,children:[(0,K.jsxs)(L,{variant:`team`,className:`relative mb-6 overflow-hidden`,children:[(0,K.jsxs)(`div`,{className:`flex items-start gap-3 sm:gap-4`,children:[(0,K.jsxs)(L.Identity,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(N,{name:r.name,slug:r.slug,abbreviation:r.abbreviation,logoUrl:r.logoUrl,size:`lg`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`h2`,{className:`text-xl font-black text-zinc-900 dark:text-zinc-100 sm:text-2xl`,children:r.name}),r.gcdVerified&&(0,K.jsx)(Be,{}),(0,K.jsx)(`span`,{className:B(`rounded px-1.5 py-0.5 text-xs font-bold leading-none`,I(b??`t3`)),children:x})]}),(0,K.jsxs)(L.Meta,{className:`mt-0.5`,children:[r.region&&(0,K.jsx)(`span`,{children:r.region}),b&&(0,K.jsx)(`span`,{className:`text-zinc-500 dark:text-zinc-400`,children:re(b)}),r.rank!=null&&(0,K.jsxs)(`span`,{children:[`Rank `,(0,K.jsxs)(`strong`,{className:`text-zinc-700 dark:text-zinc-200`,children:[`#`,r.rank]}),r.pool&&(0,K.jsx)(`span`,{className:`ml-1 text-zinc-500 dark:text-zinc-400`,children:cn(r.pool)})]}),r.championships&&r.championships.length>0&&(0,K.jsx)(en,{championships:r.championships,className:`ml-auto sm:ml-0`})]})]})]}),r.rating!=null&&(0,K.jsxs)(L.Actions,{className:`hidden sm:flex sm:flex-col sm:items-end`,children:[(0,K.jsx)(`span`,{className:`glk-eyebrow`,children:`Glicko Rating`}),(0,K.jsx)(V,{rating:Math.round(r.rating),rd:r.rd==null?0:Math.round(r.rd),className:`text-xl`,showRd:r.rd!=null})]})]}),(0,K.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-4 rounded-lg bg-white/60 p-3 dark:bg-zinc-800/40`,children:[(r.recentMatches?.length??0)>0&&(0,K.jsx)(Xe,{recentMatches:r.recentMatches??[],teamId:r.id,className:`flex-shrink-0`}),(0,K.jsxs)(z,{cols:3,className:`flex-1`,children:[r.stats?.winRate!=null&&(0,K.jsx)(z.Item,{label:`Win Rate`,value:`${Math.round(r.stats.winRate*100)}%`}),r.stats?.mapWinRate!=null&&(0,K.jsx)(z.Item,{label:`Map WR`,value:`${Math.round(r.stats.mapWinRate*100)}%`}),r.stats?.avgAcs!=null&&(0,K.jsx)(z.Item,{label:`Team ACS`,value:Math.round(r.stats.avgAcs)})]}),r.pool&&(r.globalRank!=null||r.isProvisional!=null)&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`text-center border-l border-zinc-200/80 pl-5 dark:border-zinc-700/60`,"data-testid":`rank-tile-pool`,children:[(0,K.jsx)(ln,{rank:r.poolRank,isProvisional:r.isProvisional??!1}),(0,K.jsx)(`div`,{className:`text-xs text-zinc-400`,children:cn(r.pool)})]}),(0,K.jsxs)(`div`,{className:`text-center`,"data-testid":`rank-tile-global`,children:[(0,K.jsx)(ln,{rank:r.globalRank,isProvisional:r.isProvisional??!1}),(0,K.jsx)(`div`,{className:`text-xs text-zinc-400`,children:`Global`})]})]}),r.rating!=null&&(0,K.jsx)(`div`,{className:`ml-auto sm:hidden`,children:(0,K.jsx)(V,{rating:Math.round(r.rating),rd:r.rd==null?0:Math.round(r.rd),showRd:r.rd!=null})})]})]}),r.pool&&r.crossPoolMatches90d!=null&&r.crossPoolMatches90d>0&&(0,K.jsx)(ie,{className:`mb-6`,"data-testid":`cross-pool-tile`,"aria-label":`Cross-pool matches in the last 90 days`,children:(0,K.jsxs)(se,{className:`!px-4 !py-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,K.jsx)(`span`,{className:`glk-eyebrow text-zinc-500 dark:text-zinc-400`,children:`Cross-pool matches (90d)`}),(0,K.jsx)(`span`,{className:`glk-metric glk-metric-md tabular-nums text-zinc-900 dark:text-zinc-100`,children:r.crossPoolMatches90d})]}),(0,K.jsxs)(`p`,{className:`mt-1 text-xs text-zinc-500 dark:text-zinc-400`,children:[r.crossPoolMatches90d===1?`1 match`:`${r.crossPoolMatches90d} matches`,` against teams in another pool over the last 90 days (Ascension / Masters quals signal).`]})]})}),(0,K.jsx)(De,{widgets:E,columns:3,editing:h,onReorder:D,onHide:O}),r.championships&&r.championships.length>0&&(0,K.jsx)(`div`,{id:`trophy-case`,className:`mt-6 scroll-mt-20`,children:(0,K.jsx)(Yt,{championships:r.championships,gameSlug:t})}),r.tournamentResults&&r.tournamentResults.length>0&&(0,K.jsx)(`div`,{className:`mt-4`,children:(0,K.jsx)(nn,{results:r.tournamentResults,gameSlug:t})})]})}),(0,K.jsx)(Qe,{gameSlug:t,team:r,open:_,onOpenChange:v})]})}function cn(e){return e===`vct`?`VCT`:e===`vcl`?`Challengers`:`Game Changers`}function ln({rank:e,isProvisional:t}){return t||e==null?(0,K.jsx)(`div`,{className:`text-xs font-bold text-zinc-500 dark:text-zinc-400`,children:`Provisional`}):(0,K.jsxs)(`div`,{className:`font-bold tabular-nums text-zinc-800 dark:text-zinc-200`,children:[(0,K.jsx)(`span`,{className:`text-xs text-zinc-400 dark:text-zinc-500`,children:`#`}),e]})}function un({delta:e,threshold:t=1,label:n,size:r=`sm`,hideValue:i=!1,className:a}){if(e==null||Number.isNaN(e))return(0,K.jsx)(`span`,{className:B(`glk-trend-flat inline-flex items-center`,a),title:n??`No baseline`,"aria-label":`No trend data`,children:`—`});let o=Math.abs(e)<=t?`flat`:e>0?`up`:`down`,s=o===`up`?`▲`:o===`down`?`▼`:`—`,c=o===`up`?`glk-trend-up`:o===`down`?`glk-trend-down`:`glk-trend-flat`,l=r===`md`?`text-sm`:`text-xs`,u=o===`up`?`+`:o===`down`?`-`:``,d=Math.abs(Math.round(e)),f=n??(o===`flat`?`No significant change`:`${o===`up`?`Up`:`Down`} ${d}`),p=o===`flat`?`Flat, no significant change`:`${o===`up`?`Up`:`Down`} ${d}`;return(0,K.jsxs)(`span`,{className:B(`glk-metric-sm inline-flex items-baseline gap-0.5 tabular-nums`,c,l,a),title:f,"aria-label":p,children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,children:s}),!i&&o!==`flat`&&(0,K.jsxs)(`span`,{children:[u,d]})]})}function dn({gameSlug:e}){let{data:t}=h({queryKey:[`rankings`,`methodology`,e],queryFn:()=>k(`/games/${e}/rankings/methodology`),staleTime:3600*1e3});return(0,K.jsxs)(ge,{children:[(0,K.jsxs)(he,{className:`flex items-center gap-1 rounded-md border border-zinc-200 bg-zinc-50 px-2 py-1 text-xs font-medium text-zinc-500 transition-all hover:border-zinc-300 hover:bg-zinc-100 hover:text-zinc-700 dark:border-zinc-700 dark:bg-zinc-800/50 dark:text-zinc-400 dark:hover:border-zinc-600 dark:hover:bg-zinc-700/50 dark:hover:text-zinc-300 cursor-pointer`,children:[(0,K.jsx)(d,{size:12}),(0,K.jsx)(`span`,{children:`How we rank`})]}),(0,K.jsxs)(me,{side:`right`,className:`overflow-y-auto data-[side=right]:sm:max-w-xl`,children:[(0,K.jsx)(fe,{className:`pb-2`,children:(0,K.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,K.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded-lg bg-[var(--glk-brand)]/10`,children:(0,K.jsx)(D,{size:16,className:`text-[var(--glk-brand)]`})}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(pe,{className:`text-base font-bold`,children:`The Glicko-2 Rating System`}),(0,K.jsxs)(`p`,{className:`text-xs text-zinc-400 mt-0.5`,children:[`The algorithm behind`,` `,(0,K.jsx)(`span`,{className:`font-semibold text-zinc-500 dark:text-zinc-300`,children:`glicko.app`})]})]})]})}),(0,K.jsxs)(`div`,{className:`space-y-6 px-4 pb-8 text-sm text-zinc-600 dark:text-zinc-400 leading-relaxed`,children:[(0,K.jsxs)(`div`,{className:`rounded-lg border border-[var(--glk-brand)]/20 bg-[var(--glk-brand)]/5 px-4 py-3.5`,children:[(0,K.jsx)(`p`,{className:`text-sm font-semibold leading-relaxed text-zinc-800 dark:text-zinc-100`,children:`Glicko-2 is the rating system at the heart of this site — it's literally why we're called Glicko.`}),(0,K.jsxs)(`p`,{className:`mt-2 text-[12.5px] leading-relaxed text-zinc-600 dark:text-zinc-400`,children:[`Developed by statistician `,(0,K.jsx)(`strong`,{children:`Mark Glickman`}),` as a successor to chess's Elo system, Glicko-2 is the most mathematically rigorous public rating algorithm there is. Where Elo gives you one number, Glicko-2 gives you three: a `,(0,K.jsx)(`strong`,{children:`rating`}),` (skill), a `,(0,K.jsx)(`strong`,{children:`±`}),` (how sure we are), and a `,(0,K.jsx)(`strong`,{children:`volatility`}),` (how consistent the team is).`]}),(0,K.jsx)(`p`,{className:`mt-2 text-[12.5px] leading-relaxed text-zinc-600 dark:text-zinc-400`,children:`Apply that to every official match — weighted by stake, margin of victory, and strength of schedule — and you get rankings that actually reflect performance. Not vibes.`})]}),(0,K.jsxs)(Z,{icon:x,title:`How Glicko works (and Glicko Pro)`,accent:`purple`,children:[(0,K.jsxs)(`p`,{className:`mb-3`,children:[(0,K.jsx)(`strong`,{children:`Glicko`}),` is THE public rating engine on this site — pure Glicko-2, pool-aware, no modifiers. Every team starts at 1500 / RD 350 / σ 0.06 and only sanctioned matches against teams in the same circuit move the needle. The engine is intentionally minimal: every rating change is one statistical update against one opponent, with no stack of multipliers to defend.`]}),(0,K.jsxs)(`p`,{className:`mb-3`,children:[(0,K.jsx)(`strong`,{children:`Glicko Pro`}),` is a second engine we run in parallel as an admin diagnostic. It keeps the original modifier suite — tier seeds, margin-of-victory boosts, recency dampeners, strength-of-schedule overlay, tier ceiling, GPR blend. Modifier weights are tunable via code constants. Glicko Pro lives at`,` `,(0,K.jsx)(`code`,{className:`font-mono text-xs`,children:`/admin/rating-compare`}),` only; users never see its numbers. We run both engines on every rating-compute and compare them so we can validate model decisions over time.`]}),(0,K.jsx)(`h5`,{className:`glk-eyebrow mb-1.5 mt-3`,children:`Three pools, three leaderboards`}),(0,K.jsxs)(`p`,{className:`mb-3`,children:[`Glicko can't meaningfully compare teams that rarely play each other. Rankings split into three within-pool ladders — `,(0,K.jsx)(`strong`,{children:`VCT`}),`,`,` `,(0,K.jsx)(`strong`,{children:`Challengers`}),`, and`,` `,(0,K.jsx)(`span`,{className:`font-semibold text-purple-600 dark:text-purple-400`,children:`Game Changers`}),` `,`— plus a fourth `,(0,K.jsx)(`strong`,{children:`Global`}),` view that cross-stitches the three.`]}),(0,K.jsxs)(`div`,{className:`mt-2 grid gap-2 text-xs`,children:[(0,K.jsxs)(`div`,{className:`rounded-lg border border-zinc-200/80 bg-zinc-50/50 p-2.5 dark:border-zinc-700/50 dark:bg-zinc-800/30`,children:[(0,K.jsx)(`p`,{className:`font-semibold text-zinc-800 dark:text-zinc-100`,children:`Per-pool rank`}),(0,K.jsx)(`p`,{className:`mt-0.5 leading-relaxed`,children:`The rank you see on the VCT, Challengers, or GC tab — “#3 in VCT”. This is the primary number on every team page. Within-pool comparisons are the ones we actually trust.`})]}),(0,K.jsxs)(`div`,{className:`rounded-lg border border-zinc-200/80 bg-zinc-50/50 p-2.5 dark:border-zinc-700/50 dark:bg-zinc-800/30`,children:[(0,K.jsx)(`p`,{className:`font-semibold text-zinc-800 dark:text-zinc-100`,children:`Global rank`}),(0,K.jsx)(`p`,{className:`mt-0.5 leading-relaxed`,children:`A best-effort ordering across all three pools. Use as a rough handle, not a precise ladder — a 30-point gap between a VCT and a Challengers team is noise. The Global tab carries a sticky disclaimer to that effect.`})]}),(0,K.jsxs)(`div`,{className:`rounded-lg border border-zinc-200/80 bg-zinc-50/50 p-2.5 dark:border-zinc-700/50 dark:bg-zinc-800/30`,children:[(0,K.jsx)(`p`,{className:`font-semibold text-zinc-800 dark:text-zinc-100`,children:`Calibrated / Uncalibrated`}),(0,K.jsx)(`p`,{className:`mt-0.5 leading-relaxed`,children:`The pill on each row reflects whether a team has played at least one cross-pool match (Ascension, Masters quals) in the last 90 days. Calibrated teams have a stronger anchor for cross-pool comparisons; uncalibrated teams haven't bridged out of their own circuit yet.`})]}),(0,K.jsxs)(`div`,{className:`rounded-lg border border-zinc-200/80 bg-zinc-50/50 p-2.5 dark:border-zinc-700/50 dark:bg-zinc-800/30`,children:[(0,K.jsx)(`p`,{className:`font-semibold text-zinc-800 dark:text-zinc-100`,children:`Provisional`}),(0,K.jsx)(`p`,{className:`mt-0.5 leading-relaxed`,children:`Hidden by default behind a “Show provisional (N)” toggle below the ranked list. A team is provisional when it has fewer than 5 sanctioned matches this season or its rating deviation is still above 200 — i.e. we don't yet know enough to give it a confident rank.`})]})]}),(0,K.jsxs)(`p`,{className:`mt-3 text-xs text-zinc-400`,children:[`Why two engines? Running both in parallel gives us a permanent A/B comparison between “pure” and “tuned” ratings. If a Glicko Pro modifier starts pulling the wrong direction, the divergence shows up in admin before it ever reaches the public surface. See the`,` `,(0,K.jsx)(`a`,{href:`https://github.com/aburt1/Glicko/blob/master/docs/superpowers/specs/2026-04-24-pure-glicko-three-pools-design.md`,target:`_blank`,rel:`noopener noreferrer`,className:`text-[var(--glk-brand)] hover:underline`,children:`full spec`}),` `,`for the dual-engine design.`]})]}),(0,K.jsxs)(Z,{icon:g,title:`The Three Pillars`,accent:`emerald`,children:[(0,K.jsx)(`p`,{className:`mb-3`,children:`Every team carries three values that update after each match:`}),(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsx)(mn,{symbol:`μ`,name:`Rating`,value:t?String(t.parameters.defaultRating):`1500`,unit:`default`,description:`The team's estimated skill. Higher = stronger.`,color:`violet`}),(0,K.jsx)(mn,{symbol:`φ`,name:`Rating Deviation (RD)`,value:t?String(t.parameters.defaultRd):`350`,unit:`default`,description:`How uncertain we are about the rating. Shrinks as a team plays more matches.`,color:`amber`}),(0,K.jsx)(mn,{symbol:`σ`,name:`Volatility`,value:t?String(t.parameters.defaultVolatility):`0.06`,unit:`default`,description:`How consistently the team performs. Upset specialists run high.`,color:`rose`})]})]}),(0,K.jsxs)(Z,{icon:c,title:`Tier-Seeded Starting Ratings`,accent:`emerald`,children:[(0,K.jsx)(`p`,{children:`Teams start at a rating that reflects their league context:`}),t?.tierSeeds&&(0,K.jsx)(`div`,{className:`mt-3 grid grid-cols-3 gap-1.5 sm:grid-cols-5`,children:Object.entries(t.tierSeeds).map(([e,t])=>(0,K.jsxs)(`div`,{className:`flex flex-col items-center rounded-lg bg-zinc-100 px-3 py-2.5 dark:bg-zinc-800/80`,children:[(0,K.jsx)(`span`,{className:`glk-eyebrow`,children:e===`tier1`?`T1`:e===`tier2`?`T2`:e===`tier3`?`T3`:e===`gameChangers`?`GC`:`Other`}),(0,K.jsx)(`span`,{className:`font-mono text-base font-bold text-zinc-900 dark:text-zinc-100`,children:t})]},e))}),t?.tierFloors&&(0,K.jsxs)(`p`,{className:`mt-2.5 text-xs text-zinc-400`,children:[`Each league also has a `,(0,K.jsx)(`strong`,{children:`competitive floor`}),` — when a team's rating dips below it, losses are dampened. T1 teams stay near T1 territory until promoted/relegated. Floors: T1\xA0`,t.tierFloors.tier1,` · T2\xA0`,t.tierFloors.tier2,` · GC\xA0`,t.tierFloors.gameChangers,` · T3\xA0`,t.tierFloors.tier3,`.`]})]}),(0,K.jsxs)(Z,{icon:f,title:`Reading the Numbers`,accent:`teal`,children:[(0,K.jsx)(`p`,{className:`mb-3`,children:`How to interpret the rating + RD pairs:`}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,K.jsx)($,{label:`High Rating, Low RD`,interpretation:`Proven elite`,example:`1900 ± 45`}),(0,K.jsx)($,{label:`High Rating, High RD`,interpretation:`Promising but unproven`,example:`1850 ± 180`}),(0,K.jsx)($,{label:`Low Rating, Low RD`,interpretation:`Consistently mid-tier`,example:`1400 ± 50`}),(0,K.jsx)($,{label:`Low Rating, High RD`,interpretation:`New or inactive team`,example:`1350 ± 250`})]})]}),(0,K.jsxs)(`details`,{className:`glk-card !px-4 !py-3 bg-zinc-50/50 dark:bg-zinc-900/50`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-sm font-bold text-zinc-700 dark:text-zinc-300`,children:`Show the math`}),(0,K.jsxs)(`div`,{className:`mt-3 space-y-4 text-xs text-zinc-600 dark:text-zinc-400`,children:[t&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h5`,{className:`glk-eyebrow mb-1.5`,children:`System Parameters`}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,K.jsx)(Q,{label:`Tau (τ)`,value:String(t.parameters.tau),description:`Constrains how much volatility can change per period.`}),(0,K.jsx)(Q,{label:`Default Rating`,value:String(t.parameters.defaultRating),description:`Universal Glicko-2 baseline.`}),(0,K.jsx)(Q,{label:`Default RD`,value:String(t.parameters.defaultRd),description:`Starting uncertainty for new teams.`}),(0,K.jsx)(Q,{label:`Default Volatility`,value:String(t.parameters.defaultVolatility),description:`Starting consistency assumption.`})]})]}),t&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h5`,{className:`glk-eyebrow mb-1.5`,children:`Match Stake Multipliers`}),(0,K.jsx)(`div`,{className:`grid grid-cols-2 gap-1.5`,children:Object.entries(t.stakeMultipliers).map(([e,t])=>(0,K.jsxs)(`div`,{className:`flex items-center justify-between rounded bg-zinc-100 px-2.5 py-1 dark:bg-zinc-800/80`,children:[(0,K.jsx)(`span`,{className:`capitalize`,children:e.replace(/([A-Z])/g,` $1`).trim()}),(0,K.jsxs)(`span`,{className:`font-mono font-bold`,children:[t,`×`]})]},e))})]}),t&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h5`,{className:`glk-eyebrow mb-1.5`,children:`Margin of Victory`}),(0,K.jsx)(`code`,{className:`block rounded bg-zinc-100 px-2.5 py-1.5 font-mono text-xs dark:bg-zinc-800/80`,children:`multiplier = √(mapDiff + 1)`}),(0,K.jsx)(`p`,{className:`mt-1.5`,children:`A 2-0 sweep counts ~1.73×. A 2-1 counts ~1.41×.`})]}),t?.strengthOfSchedule&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h5`,{className:`glk-eyebrow mb-1.5`,children:`Strength of Schedule`}),(0,K.jsxs)(`code`,{className:`block rounded bg-zinc-100 px-2.5 py-1.5 font-mono text-xs dark:bg-zinc-800/80`,children:[`adjusted = rating + (sosRatio − 1) × rating × `,t.strengthOfSchedule.factor]}),(0,K.jsx)(`p`,{className:`mt-1.5`,children:`Teams that face tougher opponents earn a bump. Padding stats against weaker teams costs you.`})]}),t?.inactivityDecay&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h5`,{className:`glk-eyebrow mb-1.5`,children:`Inactivity & Decay`}),(0,K.jsxs)(`p`,{children:[`RD increases by `,t.inactivityDecay.rdIncreasePerPeriod,` per period after `,t.inactivityDecay.thresholdDays,` days of inactivity. Rating doesn't drop — uncertainty grows.`]})]})]})]}),(0,K.jsx)(`div`,{className:`border-t border-zinc-200 pt-4 dark:border-zinc-800`,children:(0,K.jsx)(`p`,{className:`text-xs text-zinc-400 leading-relaxed`,children:`Based on the Glicko-2 system by Mark Glickman. Published as an improvement over the original Glicko (1995) and the Elo system (1960).`})})]})]})]})}var fn={blue:`bg-blue-100 text-blue-600 dark:bg-blue-500/10 dark:text-blue-400`,emerald:`bg-emerald-100 text-emerald-600 dark:bg-emerald-500/10 dark:text-emerald-400`,zinc:`bg-zinc-200 text-zinc-600 dark:bg-zinc-700 dark:text-zinc-300`,orange:`bg-orange-100 text-orange-600 dark:bg-orange-500/10 dark:text-orange-400`,purple:`bg-purple-100 text-purple-600 dark:bg-purple-500/10 dark:text-purple-400`,teal:`bg-teal-100 text-teal-600 dark:bg-teal-500/10 dark:text-teal-400`};function Z({icon:e,title:t,accent:n,children:r}){return(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,K.jsx)(`div`,{className:B(`flex h-6 w-6 items-center justify-center rounded-md`,fn[n]??fn.zinc),children:(0,K.jsx)(e,{size:13})}),(0,K.jsx)(`h4`,{className:`text-sm font-bold text-zinc-800 dark:text-zinc-100`,children:t})]}),(0,K.jsx)(`div`,{children:r})]})}var pn={violet:`bg-violet-100 text-violet-700 dark:bg-violet-500/10 dark:text-violet-400`,amber:`bg-amber-100 text-amber-700 dark:bg-amber-500/10 dark:text-amber-400`,rose:`bg-rose-100 text-rose-700 dark:bg-rose-500/10 dark:text-rose-400`};function mn({symbol:e,name:t,value:n,unit:r,description:i,color:a}){return(0,K.jsxs)(`div`,{className:`rounded-lg border border-zinc-200/80 bg-zinc-50/50 p-3 dark:border-zinc-700/50 dark:bg-zinc-800/30`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[(0,K.jsx)(`span`,{className:B(`inline-flex h-6 w-6 items-center justify-center rounded-md font-mono text-xs font-bold`,pn[a]??pn.violet),dangerouslySetInnerHTML:{__html:e}}),(0,K.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[(0,K.jsx)(`span`,{className:`text-sm font-semibold text-zinc-800 dark:text-zinc-100`,children:t}),(0,K.jsxs)(`span`,{className:`text-xs text-zinc-400`,children:[r,`:`,` `,(0,K.jsx)(`span`,{className:`font-mono`,children:n})]})]})]}),(0,K.jsx)(`p`,{className:`text-xs leading-relaxed text-zinc-500 dark:text-zinc-400`,children:i})]})}function Q({label:e,value:t,description:n}){return(0,K.jsxs)(`div`,{className:`rounded-lg bg-zinc-100 p-2.5 dark:bg-zinc-800/80`,children:[(0,K.jsxs)(`div`,{className:`flex items-baseline justify-between mb-1`,children:[(0,K.jsx)(`span`,{className:`text-xs font-medium text-zinc-500 dark:text-zinc-400`,dangerouslySetInnerHTML:{__html:e}}),(0,K.jsx)(`span`,{className:`font-mono text-sm font-bold text-zinc-900 dark:text-zinc-100`,children:t})]}),(0,K.jsx)(`p`,{className:`text-xs text-zinc-400 leading-relaxed`,children:n})]})}function $({label:e,interpretation:t,example:n}){return(0,K.jsxs)(`div`,{className:`rounded-lg bg-zinc-100 p-2.5 dark:bg-zinc-800/80`,children:[(0,K.jsx)(`p`,{className:`text-xs font-medium text-zinc-400 mb-0.5`,children:e}),(0,K.jsx)(`p`,{className:`font-mono text-xs font-semibold text-zinc-800 dark:text-zinc-100`,dangerouslySetInnerHTML:{__html:n}}),(0,K.jsx)(`p`,{className:`text-xs text-zinc-500 dark:text-zinc-400 mt-0.5`,children:t})]})}var hn=[{pool:`vct`,label:`VCT`,accent:`t1`},{pool:`vcl`,label:`Challengers`,accent:`t2`},{pool:`gc`,label:`Game Changers`,accent:`gc`},{pool:`all`,label:`Global`,accent:`all`}];function gn(e,t){if(!t)return`text-zinc-500 hover:text-zinc-800 dark:text-zinc-400 dark:hover:text-zinc-100`;switch(e){case`t1`:return`text-amber-700 border-amber-500 dark:text-amber-300 dark:border-amber-400`;case`t2`:return`text-blue-700 border-blue-500 dark:text-blue-300 dark:border-blue-400`;case`gc`:return`text-purple-700 border-purple-500 dark:text-purple-300 dark:border-purple-400`;case`all`:return`text-zinc-900 border-zinc-700 dark:text-zinc-100 dark:border-zinc-300`}}function _n({activePool:e,onPoolChange:t,panelId:n,tabs:r=hn,className:i}){let a=(0,G.useRef)(null);j({containerRef:a,orientation:`horizontal`});let o=(e,n)=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t(n))};return(0,K.jsx)(`div`,{ref:a,role:`tablist`,"aria-label":`Rankings pool`,className:B(`flex items-center gap-1 overflow-x-auto sm:gap-2`,`border-b border-zinc-200/80 dark:border-zinc-800/80`,i),children:r.map(r=>{let i=r.pool===e;return(0,K.jsx)(`button`,{type:`button`,role:`tab`,id:`pool-tab-${r.pool}`,"aria-selected":i,"aria-controls":n,"aria-current":i?`page`:void 0,tabIndex:i?0:-1,"data-pool":r.pool,onClick:()=>t(r.pool),onKeyDown:e=>o(e,r.pool),className:B(`glk-eyebrow whitespace-nowrap px-3 py-2 text-[11px] tracking-wider uppercase`,`border-b-2 border-transparent -mb-px`,`transition-colors duration-150`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--glk-brand)] focus-visible:ring-inset rounded-sm`,gn(r.accent,i)),children:r.label},r.pool)})})}function vn({teams:e,renderTeam:t,className:i}){let{preferences:a,updatePreference:o}=ee(),s=a.rankingsProvisionalCollapsed,c=(0,G.useCallback)(()=>{o(`rankingsProvisionalCollapsed`,!s)},[s,o]);if(e.length===0)return null;let l=`rankings-provisional-band-heading`,u=`rankings-provisional-band-panel`,d=e.length,f=`Show provisional (${d})`;return(0,K.jsxs)(`section`,{"aria-labelledby":l,className:B(`mt-4 border-t border-zinc-200 dark:border-zinc-800`,i),children:[(0,K.jsxs)(`button`,{type:`button`,onClick:c,"aria-expanded":!s,"aria-controls":u,id:l,"data-testid":`provisional-toggle`,className:B(`flex w-full items-center justify-between gap-2 px-3 py-2 text-left`,`glk-eyebrow text-zinc-500 hover:text-zinc-800 dark:text-zinc-400 dark:hover:text-zinc-100`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--glk-brand)] focus-visible:ring-inset`),children:[(0,K.jsxs)(`span`,{className:`flex items-center gap-2`,children:[s?(0,K.jsx)(n,{size:14,"aria-hidden":`true`}):(0,K.jsx)(r,{size:14,"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:s?f:`Hide provisional (${d})`})]}),(0,K.jsx)(`span`,{className:`text-[10px] font-normal normal-case tracking-normal text-zinc-400 dark:text-zinc-500`,children:`RD > 200 or fewer than 5 matches`})]}),(0,K.jsx)(`div`,{id:u,role:`region`,"aria-labelledby":l,hidden:s,className:B(`divide-y divide-zinc-100 dark:divide-zinc-800/50`,`text-zinc-500 dark:text-zinc-400`),children:!s&&e.map((e,n)=>(0,K.jsx)(`div`,{"data-testid":`provisional-row`,"data-team-slug":e.slug,className:`text-sm`,children:t(e,n)},e.teamId))})]})}var yn=`Teams are grouped by circuit — VCT, then Challengers, then Game Changers — not ranked head-to-head. Ratings across pools aren't directly comparable, since pools only meet through the handful of Ascension and international matches each year. Use the pool-specific tabs for within-circuit comparison.`;function bn({pool:e,message:t,className:n}){if(e!==`all`)return null;let r=t?.trim()||yn;return(0,K.jsxs)(`div`,{role:`note`,"aria-label":`Cross-pool comparison disclaimer`,"data-testid":`global-disclaimer`,className:B(`sticky top-0 z-20 flex items-start gap-2 border-b border-amber-200/70 bg-amber-50/95 px-3 py-2 text-xs text-amber-900 backdrop-blur-sm`,`dark:border-amber-900/30 dark:bg-amber-950/40 dark:text-amber-200`,n),children:[(0,K.jsx)(d,{size:14,"aria-hidden":`true`,className:`mt-0.5 flex-shrink-0`}),(0,K.jsx)(`p`,{className:`leading-snug`,children:r})]})}function xn(e,t=new Date){if(e===`ytd`)return new Date(Date.UTC(t.getUTCFullYear(),0,1));let n=new Date(t);return n.setUTCHours(0,0,0,0),n.setUTCDate(n.getUTCDate()-30),n}var Sn=1440*60*1e3;function Cn(e,t,n=new Date){if(e.length<2)return null;let r=xn(t,n).getTime(),i=e[e.length-1],a=-1;for(let t=0;t<e.length;t++)if(new Date(e[t].date).getTime()>=r){a=t;break}if(a===-1)return null;if(a===0&&a+1<e.length){let t=e[a],n=e[a+1],r=(new Date(n.date).getTime()-new Date(t.date).getTime())/Sn,o=Math.abs(n.rating-t.rating);r>=3&&o>=75&&e[a+1]!==i&&(a+=1)}let o=e[a];return o===i?null:{baseline:o,latest:i,delta:i.rating-o.rating}}function wn(e){return e===`ytd`?`YTD`:`30-day`}var Tn=`30d`,En=`rankings-pool-panel`;function Dn(e){switch(e){case`vct`:case`vcl`:case`gc`:case`all`:return e;case`challengers`:return`vcl`;case`game-changers`:case`gamechangers`:return`gc`;case`global`:return`all`;default:return`vct`}}function On(e){if(!e)return!1;switch(e){case`vct`:case`vcl`:case`gc`:case`all`:case`challengers`:case`game-changers`:case`gamechangers`:case`global`:return!0;default:return!1}}function kn(e){switch(e){case`t1`:return`vct`;case`t2`:return`vcl`;case`gc`:return`gc`;default:return null}}function An(e){switch(e){case`vct`:return`t1`;case`vcl`:return`t2`;case`gc`:return`gc`;default:return}}function jn(e){switch(e){case`vct`:return`vct`;case`vcl`:return`vcl`;case`gc`:return`gc`;default:return null}}function Mn(e){switch(e){case`vct`:return`vct`;case`vcl`:return`vcl`;case`gc`:return`gc`;default:return null}}function Nn(){R(`Rankings`);let[e,t]=(0,G.useState)(!1),{updatePreference:n}=ee(),{gameSlug:r}=y(),[i,a]=_(),o=(0,G.useRef)(null),{filters:s}=te(),c=(0,G.useRef)(!1);(0,G.useEffect)(()=>{if(c.current)return;let e=i.get(`tier`);if(i.get(`pool`)||!e){c.current=!0;return}if(!On(e)){c.current=!0;return}c.current=!0,a(t=>(t.set(`pool`,e),t.delete(`tier`),t),{replace:!0})},[i,a]);let l=Dn(i.get(`pool`)??i.get(`tier`)),u=(0,G.useRef)(!1),d=(0,G.useCallback)(e=>{u.current=!0;let t=jn(e),r=t!==s.tier;a(n=>(e===`vct`?n.delete(`pool`):n.set(`pool`,e),t?n.set(`tier`,t):n.delete(`tier`),r&&(n.delete(`region`),n.delete(`sub`)),n),{replace:!0}),n(`defaultTier`,t)},[a,s.tier,n]),f=(0,G.useRef)(!1);(0,G.useEffect)(()=>{if(!f.current){f.current=!0;return}if(u.current){u.current=!1;return}let e=Mn(s.tier);e!==null&&a(t=>(e===`vct`?t.delete(`pool`):t.set(`pool`,e),t),{replace:!0})},[s.tier]);let p=i.get(`q`)||``,[m,h]=(0,G.useState)(p),g=(0,G.useRef)(void 0),v=(0,G.useCallback)(e=>{a(t=>(e?t.set(`q`,e):t.delete(`q`),t),{replace:!0}),clearTimeout(g.current),g.current=setTimeout(()=>h(e),300)},[a]),b=An(l),{teams:x,total:w,isLoading:T,isError:E,refetch:D,fetchNextPage:O,hasNextPage:k,isFetchingNextPage:A}=Ce(r,{canonicalTier:s.tier,region:s.region,subRegion:s.subRegion,q:m||void 0,limit:50,...b?{tier:b}:{}}),j=ye(r,l).data,M=(0,G.useMemo)(()=>l===`all`?x.filter(e=>kn(e.tier)!==null):x.filter(e=>kn(e.tier)===l),[x,l]);(0,G.useEffect)(()=>{let e=o.current;if(!e)return;let t=new IntersectionObserver(e=>{e[0].isIntersecting&&k&&!A&&O()},{threshold:0});return t.observe(e),()=>t.disconnect()},[k,A,O]);let N=(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(In,{value:p,onChange:v,placeholder:`Search teams...`}),(0,K.jsx)(Ae,{open:e,onToggle:()=>t(e=>!e)}),(0,K.jsx)(dn,{gameSlug:r})]}),P=!T&&w>0?l===`all`?`${w} teams`:`${M.length} ${hn.find(e=>e.pool===l)?.label??``} teams`:void 0;return(0,K.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:[e&&(0,K.jsx)(Me,{onClose:()=>t(!1)}),(0,K.jsxs)(ae,{title:`Rankings`,subtitle:P,actions:N,className:`flex min-h-0 flex-1 flex-col overflow-hidden`,seo:{title:`Rankings — ${U(r)}`,description:`${U(r)} team rankings powered by Glicko-2 — live ratings, trend deltas, and regional strength.`,type:`website`},loadingKind:`table`,emptyIcon:(0,K.jsx)(C,{size:22,strokeWidth:1.75}),emptyMessage:s.tier!==null||m?`No teams match the selected filters.`:`Team data is computed after match data is synced.`,status:{isLoading:T,isError:E,error:E?Error(`Failed to load teams`):null,isEmpty:!T&&!E&&x.length===0,retry:()=>void D()},children:[x.length>0&&(0,K.jsx)(oe,{data:{"@context":`https://schema.org`,"@type":`ItemList`,name:`${U(r)} Rankings`,itemListElement:M.slice(0,10).map((e,t)=>({"@type":`ListItem`,position:t+1,item:{"@type":`SportsTeam`,name:e.name,url:`https://glicko.app/${r}/teams/${e.slug}`,sport:U(r)}}))}}),(0,K.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:(0,K.jsxs)(ce,{className:`mx-auto max-w-5xl`,children:[(0,K.jsx)(`div`,{className:`px-2 sm:px-3 pt-2`,children:(0,K.jsx)(_n,{activePool:l,onPoolChange:d,panelId:En})}),(0,K.jsx)(`div`,{children:x.length>0&&(0,K.jsxs)(K.Fragment,{children:[j?.meta.lastUpdatedAt&&(0,K.jsx)(`div`,{className:`mt-3 flex justify-end px-2 sm:px-3`,children:(0,K.jsxs)(`span`,{"data-testid":`ratings-updated-chip`,title:new Date(j.meta.lastUpdatedAt).toLocaleString(),className:`glk-eyebrow text-zinc-400 dark:text-zinc-500`,children:[`Updated `,de(j.meta.lastUpdatedAt)]})}),(0,K.jsxs)(`div`,{id:En,role:`tabpanel`,"aria-labelledby":`pool-tab-${l}`,"data-pool":l,className:B(`glk-card !p-0 overflow-hidden`,j?.meta.lastUpdatedAt?`mt-1`:`mt-3`),children:[(0,K.jsx)(bn,{pool:l,message:j?.meta.crossPoolDisclaimer}),(0,K.jsxs)(`div`,{role:`row`,"aria-hidden":`true`,className:`sticky top-0 z-10 flex items-center gap-2 sm:gap-3 border-b border-zinc-200/80 bg-zinc-50/95 px-2 sm:px-3 py-1.5 backdrop-blur-sm dark:border-zinc-800 dark:bg-zinc-900/95`,children:[(0,K.jsx)(`span`,{className:`w-7 sm:w-8 text-right glk-eyebrow`,children:`Rank`}),(0,K.jsx)(`span`,{className:`hidden sm:block w-9 flex-shrink-0`,"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`flex-1 glk-eyebrow`,children:`Team`}),(0,K.jsx)(`span`,{"data-testid":`rankings-delta-header`,className:`hidden sm:inline glk-eyebrow`,children:`Δ 30d`}),(0,K.jsx)(`span`,{className:`glk-eyebrow`,children:`Glicko Rating`})]}),(0,K.jsx)(`div`,{role:`list`,className:`divide-y divide-zinc-100 dark:divide-zinc-800/50`,children:M.length===0?(0,K.jsx)(`div`,{className:`px-4 py-8 text-center text-xs text-zinc-500 dark:text-zinc-400`,children:`No teams in this pool right now.`}):M.map((e,t)=>(0,K.jsx)(Pn,{team:e,rank:e.rank??t+1,gameSlug:r,searchParams:i,rankAccent:l===`gc`?`gc`:`gold`},e.id))}),j&&j.provisional.length>0&&(0,K.jsx)(vn,{teams:j.provisional,renderTeam:e=>(0,K.jsx)(Fn,{team:e,gameSlug:r,searchParams:i})}),(0,K.jsx)(`div`,{ref:o,className:`h-1`}),A&&(0,K.jsx)(`div`,{className:`flex justify-center py-3`,children:(0,K.jsx)(S,{size:16,className:`animate-spin text-zinc-400`})})]})]})})]})})]})]})}function Pn({team:e,rank:t,gameSlug:n,searchParams:r,rankAccent:i=`gold`}){let a=e.ratingSnapshots,o=a?Cn(a,Tn):null,s=o!=null&&o.delta>0,c=o!=null&&o.delta<0,l=o?.delta??0;return(0,K.jsxs)(E,{role:`listitem`,to:{pathname:`/${n}/teams/${e.slug}`,search:r.toString()},"aria-label":`#${t} ${e.name}${e.rating==null?``:`, rating ${Math.round(e.rating)}`}${l!==0&&o!=null?`, ${l>0?`up`:`down`} ${Math.abs(Math.round(l))} this month`:``}`,className:`group flex items-center gap-2 sm:gap-3 px-2 sm:px-3 py-2 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-[var(--glk-brand)] focus-visible:ring-inset`,children:[(0,K.jsx)(be,{rank:t,accent:i}),(0,K.jsx)(`div`,{className:`hidden sm:flex h-9 w-9 flex-shrink-0 items-center justify-center`,children:(0,K.jsx)(N,{name:e.name,slug:e.slug,abbreviation:e.abbreviation,logoUrl:e.logoUrl,size:`md`})}),(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`truncate text-sm font-semibold text-zinc-900 transition-colors group-hover:text-[var(--glk-brand)] dark:text-zinc-100`,children:e.name}),e.abbreviation&&(0,K.jsx)(`span`,{className:`hidden sm:inline text-xs text-zinc-400`,children:e.abbreviation}),e.tier&&(0,K.jsx)(`span`,{className:B(`flex-shrink-0 rounded px-1.5 py-0.5 text-xs font-bold leading-none`,I(e.tier)),children:P(e.tier)}),e.disbanded&&(0,K.jsx)(`span`,{className:`flex-shrink-0 rounded border border-red-300 bg-red-50 px-1.5 py-0.5 text-2xs font-bold uppercase leading-none text-red-600 dark:border-red-800/50 dark:bg-red-950/30 dark:text-red-400`,children:`Disbanded`})]}),e.vctRegion&&(0,K.jsx)(`span`,{className:`text-2xs text-zinc-400`,children:e.vctRegion.toUpperCase()})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 sm:gap-2`,children:[o==null?(0,K.jsx)(un,{delta:null,label:`No ${wn(Tn)} baseline yet`}):(0,K.jsx)(un,{delta:l,threshold:10,label:`${wn(Tn)} change: ${l>0?`+`:``}${Math.round(l)}`}),a&&a.length>=2&&(0,K.jsx)(ve,{data:a.map(e=>e.rating),width:48,height:16,color:s?`var(--glk-win)`:c?`var(--glk-loss)`:`currentColor`,"aria-hidden":!0,className:`hidden sm:block`}),e.rating!=null&&e.rd!=null&&(0,K.jsx)(V,{rating:Math.round(e.rating),rd:Math.round(e.rd)})]})]})}function Fn({team:e,gameSlug:t,searchParams:n}){return(0,K.jsxs)(E,{to:{pathname:`/${t}/teams/${e.slug}`,search:n.toString()},"aria-label":`Provisional team ${e.name}, rating ${e.rating} (uncertain)`,className:`group flex items-center gap-2 sm:gap-3 px-2 sm:px-3 py-1.5 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-[var(--glk-brand)] focus-visible:ring-inset`,children:[(0,K.jsx)(`span`,{className:`w-7 sm:w-8 text-right text-xs text-zinc-400 dark:text-zinc-500`,"aria-hidden":`true`,children:`–`}),(0,K.jsx)(`div`,{className:`hidden sm:flex h-7 w-7 flex-shrink-0 items-center justify-center opacity-80`,children:(0,K.jsx)(N,{name:e.name,slug:e.slug,abbreviation:e.abbreviation,logoUrl:e.logoUrl,size:`sm`})}),(0,K.jsxs)(`div`,{className:`flex flex-1 items-center gap-2 overflow-hidden`,children:[(0,K.jsx)(`span`,{className:`truncate text-xs font-medium text-zinc-700 transition-colors group-hover:text-[var(--glk-brand)] dark:text-zinc-300`,children:e.name}),e.currentTier&&(0,K.jsx)(`span`,{className:B(`flex-shrink-0 rounded px-1 py-0.5 text-2xs font-bold leading-none`,I(e.currentTier)),children:P(e.currentTier)})]}),(0,K.jsxs)(`span`,{className:`font-mono text-xs tabular-nums text-zinc-500 dark:text-zinc-400`,"aria-label":`Provisional rating ${e.rating} plus or minus ${e.rd}`,children:[e.rating,(0,K.jsxs)(`span`,{className:`ml-0.5 text-2xs text-zinc-400`,"aria-hidden":`true`,children:[`±`,e.rd,`*`]})]})]})}function In({value:e,onChange:t,placeholder:n}){let[r,a]=(0,G.useState)(e.length>0),o=(0,G.useRef)(null),s=(0,G.useCallback)(()=>{a(!0),setTimeout(()=>o.current?.focus(),0)},[]),c=(0,G.useCallback)(()=>{e||a(!1)},[e]),l=(0,G.useCallback)(()=>{t(``),setTimeout(()=>o.current?.focus(),0)},[t]);return r?(0,K.jsxs)(`div`,{className:`relative w-40 sm:w-48`,children:[(0,K.jsx)(v,{size:14,"aria-hidden":`true`,className:`absolute left-2.5 top-1/2 -translate-y-1/2 text-zinc-400`}),(0,K.jsx)(`input`,{ref:o,value:e,onChange:e=>t(e.target.value),onBlur:c,placeholder:n,"aria-label":`Search teams`,className:`w-full rounded-md border border-zinc-200 bg-zinc-50 py-1.5 pl-8 pr-7 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`}),e&&(0,K.jsx)(`button`,{type:`button`,onClick:l,"aria-label":`Clear search`,className:`absolute right-2 top-1/2 -translate-y-1/2 flex items-center justify-center rounded text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-300 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[var(--glk-brand)]`,children:(0,K.jsx)(i,{size:12,"aria-hidden":`true`})})]}):(0,K.jsx)(`button`,{onClick:s,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 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--glk-brand)]`,"aria-label":`Search teams`,children:(0,K.jsx)(v,{size:14,"aria-hidden":`true`})})}function Ln(){R(`Teams`);let e=je(`(max-width: 767px)`),{variant:t,isPinned:n,togglePin:r}=Le(),{teamSlug:i}=y();return e?i?(0,K.jsx)(sn,{}):(0,K.jsx)(Nn,{}):i?(0,K.jsxs)(`div`,{className:`flex h-full overflow-hidden`,children:[(0,K.jsx)(We,{selectedSlug:i,compact:t===`compact`,isPinned:n,onToggleVariant:r}),(0,K.jsx)(`div`,{className:`flex-1 min-w-0 overflow-hidden`,children:(0,K.jsx)(sn,{hideBreadcrumbs:!0})})]}):(0,K.jsx)(Nn,{})}export{Ln as default};