(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7779],{32371:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/players/[slug]",function(){return n(19347)}])},79302:function(e,t,n){"use strict";n.d(t,{t:function(){return s}});var i=n(96486),r=n.n(i),a=n(79014),l=n(38751);let s=e=>{let{data:t,...n}=(0,l.J)(r().isNil(e)?null:"/team/".concat(e),()=>a.b$.cached.teams.fetchTeam.query({id:e}));return{...n,team:null==t?void 0:t.data}}},19347:function(e,t,n){"use strict";n.r(t),n.d(t,{__N_SSG:function(){return eH},default:function(){return eX}});var i=n(85893),r=n(67294),a=n(65984),l=n(39484),s=n(38878),d=n(70313),o=n(95429),c=n(8207),h=n(28008),x=n(54410),m=n(41664),p=n.n(m),u=n(19434),j=n(63991),g=n(78964),f=n(25675),w=n.n(f),y=n(64149),_=n(11714),b=n(2513),v=n(82922),k=n(36281);async function S(){return await k.OQ.from("positions").select("*")}async function D(){return await k.OQ.from("countries").select("*")}var z=n(79302),C=n(41123);let K=(0,v.k)(e=>({playerImage:{borderRadius:"10px",border:"1px solid ".concat(e.colors.dark[4])},playerInfoContainer:{width:"100%"},socialImage:{borderRadius:"30%"},playerCard:{position:"relative",width:"100%",aspectRatio:"1 / 1",overflow:"hidden",height:"auto"},cardBackground:{position:"absolute",aspectRatio:"1 / 1",top:0,left:0,right:0,bottom:0,backgroundColor:"dark"===e.colorScheme?"#25262be6":"#ffffffe6",zIndex:0}}));function Z(e){let{children:t,href:n}=e;return n?(0,i.jsx)("a",{href:n,rel:"noreferrer",target:"_blank",style:{color:"inherit",textDecoration:"inherit"},children:t}):(0,i.jsx)(i.Fragment,{children:t})}function F(e){return e.split("/").filter(e=>""!==e.trim()).pop()}function P(e){var t,n,l;let{player:d,roles:m}=e,{classes:f}=K(),v=(0,a.rZ)(),k=(0,g.a)("(max-width: ".concat(v.breakpoints.xs,")")),{team:P}=(0,z.t)(d.current_team_id),[I,O]=(0,r.useState)(null),[L,T]=(0,r.useState)(null);(0,r.useEffect)(()=>{S().then(e=>O(e.data)).catch(console.error),D().then(e=>T(e.data)).catch(console.error)},[]);let N=m?null===(t=m.find(e=>e.id===d.role_id))||void 0===t?void 0:t.role:"Unknown Role",E=I?null===(n=I.find(e=>e.id===d.position_id))||void 0===n?void 0:n.position:"Unknown Position",R=L?null===(l=L.find(e=>e.id===d.country_id))||void 0===l?void 0:l.iso2:"Unknown Country";return(0,i.jsxs)(o.k,{gap:"md",p:"md",direction:k?"column":"row",wrap:k?"wrap":"inherit",style:P&&P.color_hex?{background:"linear-gradient(to bottom left, ".concat(P.color_hex,"20,transparent)")}:{},children:[(0,i.jsxs)(s.Z,{className:f.playerCard,p:8,style:{aspectRatio:"1/1",boxShadow:"0px 0px 5px 0px rgba(0,0,0,0.25)",backgroundImage:"url('/bpLightLogo.png')",backgroundSize:"90%",backgroundPosition:"center",backgroundRepeat:"no-repeat",height:"100%"},children:[(0,i.jsx)("div",{className:f.cardBackground}),(0,i.jsx)(o.k,{direction:"column",style:{position:"relative",aspectRatio:"1/1",minWidth:"100%",bottom:-8,minHeight:"100%"},children:d.headshot&&(0,i.jsx)(w(),{src:d.headshot,alt:d.tag,fill:!0,style:{objectFit:"contain",aspectRatio:"1/1",minWidth:"100%",minHeight:"100%"}})})]}),(0,i.jsxs)(c.K,{className:f.playerInfoContainer,justify:"space-between",children:[(0,i.jsxs)(c.K,{gap:0,children:[(0,i.jsxs)(o.k,{justify:"space-between",align:"start",gap:16,children:[(0,i.jsx)(h.D,{children:d.tag}),(0,i.jsxs)(o.k,{gap:"xs",align:"center",justify:"end",wrap:"wrap",children:[d.twitter&&(0,i.jsx)(Z,{href:(0,C.po)(F(d.twitter)),children:(0,i.jsx)(u.Z,{})}),d.instagram&&(0,i.jsx)(Z,{href:(0,C.ML)(F(d.instagram)),children:(0,i.jsx)(j.u9g,{})}),d.youtube&&(0,i.jsx)(Z,{href:(0,C.zR)(F(d.youtube)),children:(0,i.jsx)(j.rDx,{})}),d.twitch&&(0,i.jsx)(Z,{href:(0,C.dn)(F(d.twitch)),children:(0,i.jsx)(j.mSR,{})}),d.tiktok&&(0,i.jsx)(Z,{href:d.tiktok,children:(0,i.jsx)(j.mQR,{})})]})]}),(0,i.jsxs)(o.k,{align:"center",gap:8,children:[(0,i.jsx)(o.k,{direction:"column",style:{position:"relative",width:20,height:15},children:R&&(0,i.jsx)(w(),{src:"https://dfpiiufxcciujugzjvgx.supabase.co/storage/v1/object/public/public-images/countryFlags/".concat(R.toLowerCase(),".svg"),alt:R,fill:!0,style:{objectFit:"contain"}})}),(0,i.jsxs)(x.x,{fw:"bold",children:[d.first_name," ",d.last_name]})]})]}),(0,i.jsxs)(o.k,{direction:"column",gap:16,children:[d.current_team_id&&P&&(0,i.jsx)(p(),{href:"/teams/".concat(d.current_team_id),style:{color:"inherit",textDecoration:"inherit",overflow:"visible"},children:(0,i.jsx)(s.Z,{style:{boxShadow:"0px 0px 5px 0px rgba(0,0,0,0.25)"},children:(0,i.jsxs)(o.k,{justify:"space-between",gap:8,align:"center",children:[(0,i.jsx)(x.x,{fw:"bold",fz:"sm",children:"Team"}),(0,i.jsx)(p(),{style:{color:"inherit",textDecoration:"inherit"},href:"/teams/".concat(P.id),children:(0,i.jsxs)(o.k,{align:"center",gap:8,children:[(0,i.jsx)(x.x,{fw:"bold",fz:"sm",children:P.name}),P.logo_main&&(0,i.jsx)(w(),{src:P.logo_main,alt:P.name,height:24,width:24,style:{objectFit:"contain"}})]})})]})})}),(0,i.jsx)(s.Z,{style:{boxShadow:"0px 0px 5px 0px rgba(0,0,0,0.25)"},children:(0,i.jsxs)(o.k,{direction:"column",gap:4,children:[d.role_id&&(0,i.jsxs)(o.k,{justify:"space-between",children:[(0,i.jsx)(x.x,{fw:"bold",fz:"sm",children:"Role"}),(0,i.jsx)(x.x,{fw:"bold",fz:"sm",children:N})]}),d.position_id&&(0,i.jsxs)(o.k,{justify:"space-between",children:[(0,i.jsx)(x.x,{fw:"bold",fz:"sm",children:"Position"}),(0,i.jsx)(x.x,{fw:"bold",fz:"sm",children:E})]}),d.date_of_birth&&(0,i.jsxs)(o.k,{justify:"space-between",children:[(0,i.jsx)(x.x,{fw:"bold",fz:"sm",children:"D.O.B"}),(0,i.jsxs)(x.x,{fw:"bold",fz:"sm",children:[(0,y.Z)((0,_.Z)(d.date_of_birth),"MMMM d, y")," (",(0,b.Z)(new Date,(0,_.Z)(d.date_of_birth)),")"]})]}),d.nickname&&(0,i.jsxs)(o.k,{justify:"space-between",children:[(0,i.jsx)(x.x,{fw:"bold",fz:"sm",children:"Nickname"}),(0,i.jsx)(x.x,{fw:"bold",fz:"sm",children:d.nickname})]})]})})]})]})]})}var I=n(86641),O=n(51906),L=n(24920),T=n(18673);let N=(0,v.k)(e=>({middleColumn:{textAlign:"center"},progressBar:{height:e.spacing.md},rightColumn:{textAlign:"right"},statsContent:{flexGrow:1},statsWrapper:{width:"100%"},verticalLine:{borderLeft:"2px solid ".concat(e.colors.dark[0]),height:"23px",marginTop:"-3px",position:"absolute",left:"50%",top:0}}));function E(e){let{classes:t,title:n,playerStats:r}=e;if(!r||null===r.playerRank)return null;let{playerKD:a,playerRank:l,middleKD:s}=r;if(null===a)return null;let d=(1-(l-1)/r.length)*100,c=null==s?void 0:s.toFixed(2);return(0,i.jsxs)("div",{children:[(0,i.jsxs)(o.k,{className:t.statsWrapper,align:"end",children:[(0,i.jsx)(o.k,{className:t.statsContent,justify:"left",children:(0,i.jsx)(x.x,{fw:"bold",fz:"xl",children:a.toFixed(2)})}),(0,i.jsx)(o.k,{className:t.statsContent,justify:"center",children:(0,i.jsx)(x.x,{tt:"uppercase",children:n})}),(0,i.jsx)(o.k,{className:t.statsContent,justify:"right",children:(0,i.jsxs)(x.x,{fw:1===l?700:400,children:["#",l]})})]}),(0,i.jsxs)("div",{style:{position:"relative"},children:[(0,i.jsx)(I.E,{className:t.progressBar,value:d,color:1===l?"#7b38ab":d<33?"red":d>=33&&d<=66?"yellow":d>66?"green":void 0,style:1===l?{boxShadow:"0px 0px 10px 3px #7b38ab"}:{}}),(0,i.jsx)("div",{className:t.verticalLine})]}),(0,i.jsx)(x.x,{className:t.middleColumn,fz:"xs",fw:"bold",mt:3,children:c})]})}function R(e){let{overallKDData:t,hpKDData:n,sndKDData:r,ctlKDData:a}=e,{classes:d}=N(),c=(0,l.X)();return(0,i.jsxs)(s.Z,{m:16,style:{boxShadow:"0px 0px 5px 0px rgba(0,0,0,0.25)"},children:[(0,i.jsxs)(x.x,{mb:8,fs:"italic",size:"xs",children:[T.mM," Season"]}),(0,i.jsxs)(O.r,{children:[(0,i.jsx)(O.r.Col,{span:{base:12,lg:6},children:(0,i.jsx)(E,{classes:d,title:"Overall KD",playerStats:t})}),(0,i.jsx)(O.r.Col,{span:{base:12,lg:6},children:(0,i.jsx)(E,{classes:d,title:"Hardpoint KD",playerStats:n})}),(0,i.jsx)(O.r.Col,{span:{base:12,lg:6},children:(0,i.jsx)(E,{classes:d,title:"S&D KD",playerStats:r})}),(0,i.jsx)(O.r.Col,{span:{base:12,lg:6},children:(0,i.jsx)(E,{classes:d,title:"Control KD",playerStats:a})})]}),(0,i.jsx)(o.k,{children:(0,i.jsx)(p(),{href:"/stats/advanced",style:{width:"max-content",marginLeft:"auto",marginTop:8},children:(0,i.jsx)(L.z,{w:"max-content",variant:"light",color:"gray",style:{boxShadow:"0px 0px 5px 0px rgba(0,0,0,0.25)",color:"dark"===c.colorScheme?"white":"black"},children:"Leaderboards"})})})]})}var M=n(68660),A=n(96486),W=n.n(A),H=n(66352);function X(e){let{player:t}=e,n=(0,l.X)(),[a,s]=(0,r.useState)([]),[d,c]=(0,r.useState)([]);return(0,r.useEffect)(()=>{(0,H.QW)(T.mM).then(e=>{e.data&&s(W().sortBy(e.data,"start_date"))})},[t]),(0,r.useEffect)(()=>{a&&Promise.all(a.map(async e=>{let n={seasonId:T.mM,playerId:t.id,eventId:e.id},i=await fetch("/api/playerStats",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}),r=await i.json();return r?r.map(t=>({eventName:e.name,eventId:e.id,overallKd:(t.kills/(t.deaths>0?t.deaths:1)).toFixed(2),hardpointKd:t.hp_kd.toFixed(2),hardpointKillsPer10:t.hp_k_10m.toFixed(2),hardpointHillTimePer10:t.hp_obj_10m.toFixed(2),sndKd:t.snd_kd.toFixed(2),sndKillsPerRound:t.snd_kpr.toFixed(2),controlKd:t.ctl_kd.toFixed(2),controlKillsPer10:t.ctl_k_10m.toFixed(2),controlDamagePer10:t.ctl_dmg_10m.toFixed(2)})):null})).then(e=>{c(e.flat().filter(e=>null!==e))})},[a,t.id]),(0,i.jsxs)(o.k,{direction:"column",gap:8,style:{padding:16,borderRadius:4},children:[(0,i.jsxs)(x.x,{mb:8,fs:"italic",size:"xs",children:[T.mM," Season"]}),(0,i.jsx)(M.wQ,{style:{boxShadow:"0px 0px 5px 0px rgba(0,0,0,0.25)",borderRadius:4},columns:[{accessor:"eventName",title:"Event name",render:e=>(0,i.jsx)(p(),{href:"/events/".concat(e.eventId),passHref:!0,style:{color:"inherit",width:"max-content"},children:e.eventName})},{accessor:"overallKd",title:"Ovr K/D"},{accessor:"hardpointKd",title:"HP K/D"},{accessor:"hardpointKillsPer10",title:"HP K/10"},{accessor:"hardpointHillTimePer10",title:"HP OBJ/10"},{accessor:"sndKd",title:"S&D K/D"},{accessor:"sndKillsPerRound",title:"S&D K/R"},{accessor:"controlKd",title:"CTL K/D"},{accessor:"controlKillsPer10",title:"CTL K/10"},{accessor:"controlDamagePer10",title:"CTL DM/10"}],records:d.map(e=>({...e,eventId:e.eventId})),striped:!0}),(0,i.jsx)(p(),{href:"/stats/players",style:{width:"max-content",marginLeft:"auto"},children:(0,i.jsx)(L.z,{w:"max-content",variant:"light",color:"gray",style:{boxShadow:"0px 0px 5px 0px rgba(0,0,0,0.25)",color:"dark"===n.colorScheme?"white":"black"},children:"Player Stats"})})]})}var B=n(59734),q=n(75472),Q=n.n(q),U=n(79014),J=n(90167),G=n(43259),V=n(1506);function $(e){let{playerStats:t}=e,n=(0,g.a)("(min-width: 900px)"),r=(0,g.a)("(min-width: 667px)");return(0,i.jsx)(i.Fragment,{children:n?(0,i.jsxs)(o.k,{gap:16,ml:"auto",children:[(0,i.jsx)(x.x,{w:48,children:t.kd.toFixed(2)}),(0,i.jsx)(x.x,{w:40,children:t.kills}),(0,i.jsx)(x.x,{w:40,children:t.deaths}),(0,i.jsx)(x.x,{w:56,children:t.hp_kd.toFixed(2)}),(0,i.jsx)(x.x,{w:64,children:t.snd_kd.toFixed(2)}),(0,i.jsx)(x.x,{w:64,children:t.ctl_kd.toFixed(2)}),(0,i.jsx)(x.x,{w:80,children:t.slayer_rating.toFixed(2)})]}):r?(0,i.jsxs)(o.k,{gap:16,ml:"auto",children:[(0,i.jsx)(x.x,{fz:14,w:40,children:t.kd.toFixed(2)}),(0,i.jsx)(x.x,{fz:14,w:32,children:t.kills}),(0,i.jsx)(x.x,{fz:14,w:32,children:t.deaths}),(0,i.jsx)(x.x,{fz:14,w:48,children:t.hp_kd.toFixed(2)}),(0,i.jsx)(x.x,{fz:14,w:56,children:t.snd_kd.toFixed(2)}),(0,i.jsx)(x.x,{fz:14,w:56,children:t.ctl_kd.toFixed(2)})]}):(0,i.jsxs)(o.k,{gap:10,ml:"auto",w:96,children:[(0,i.jsx)(x.x,{fz:14,w:32,children:t.kd.toFixed(2)}),(0,i.jsx)(x.x,{fz:14,w:20,children:t.kills}),(0,i.jsx)(x.x,{fz:14,w:20,children:t.deaths})]})})}function Y(e){let{teamMatch:t,index:n,team1:r,team2:a,playerStats:d}=e,c=(0,l.X)(),h=(0,g.a)("(min-width: 900px)");return r&&a?(0,i.jsx)(o.k,{direction:"column",w:"100%",children:(0,i.jsx)(p(),{href:"/match/".concat(t.id),style:{textDecoration:"inherit",color:"inherit"},children:h?(0,i.jsx)(s.Z,{radius:0,py:4,style:{background:n%2!=0?"rgba(0,0,0,.1)":"none"},children:(0,i.jsxs)(o.k,{w:"100%",align:"center",children:[(0,i.jsx)(x.x,{w:56,children:t.datetime&&(0,y.Z)((0,_.Z)(t.datetime),"M/d")}),(0,i.jsx)(x.x,{w:96,children:(0,i.jsxs)(o.k,{align:"center",gap:4,td:"underline",children:[(0,i.jsx)(w(),{src:"dark"===c.colorScheme?(null==a?void 0:a.logo_darkmode)||"/bpDarkLogo.png":(null==a?void 0:a.logo_lightmode)||"/bpLightLogo.png",width:32,height:32,alt:"".concat(null==a?void 0:a.name," logo"),style:{objectFit:"contain"}}),a.name_short]})}),"upcoming"!==t.status&&(0,i.jsxs)(o.k,{gap:8,w:112,children:[t.winner_id===r.id?(0,i.jsx)(x.x,{color:"green",fw:700,children:"W"}):(0,i.jsx)(x.x,{color:"red",fw:700,children:"L"}),(0,i.jsxs)(x.x,{children:[r.id===t.team_1_id?(0,i.jsx)(x.x,{span:!0,fw:r.id===t.team_1_id&&t.team_1_score&&t.team_2_score&&t.team_1_score>t.team_2_score?900:500,children:t.team_1_score}):(0,i.jsx)(x.x,{span:!0,fw:r.id===t.team_2_id&&t.team_1_score&&t.team_2_score&&t.team_2_score>t.team_1_score?900:500,children:t.team_2_score})," ",":"," ",r.id!==t.team_1_id?(0,i.jsx)(x.x,{span:!0,children:t.team_1_score}):(0,i.jsx)(x.x,{span:!0,children:t.team_2_score})]})]}),d&&(0,i.jsx)($,{playerStats:d})]})}):(0,i.jsx)(s.Z,{radius:0,py:4,style:{background:n%2!=0?"rgba(0,0,0,.1)":"none"},children:(0,i.jsxs)(o.k,{w:"100%",align:"center",children:[(0,i.jsx)(x.x,{w:36,fz:14,children:t.datetime&&(0,y.Z)((0,_.Z)(t.datetime),"M/d")}),(0,i.jsx)(x.x,{w:72,fz:14,children:(0,i.jsxs)(o.k,{align:"center",gap:4,fz:13,td:"underline",children:[(0,i.jsx)(w(),{src:"dark"===c.colorScheme?(null==a?void 0:a.logo_darkmode)||"/bpDarkLogo.png":(null==a?void 0:a.logo_lightmode)||"/bpLightLogo.png",width:32,height:32,alt:"".concat(null==a?void 0:a.name," logo"),style:{objectFit:"contain"}}),a.name_short]})}),"upcoming"!==t.status&&(0,i.jsxs)(o.k,{gap:4,fz:14,w:56,children:[t.winner_id===r.id?(0,i.jsx)(x.x,{color:"green",w:12,fw:700,fz:14,children:"W"}):(0,i.jsx)(x.x,{color:"red",w:12,fw:700,fz:14,children:"L"}),(0,i.jsxs)(x.x,{fz:14,lts:-1,children:[r.id===t.team_1_id?(0,i.jsx)(x.x,{fz:14,span:!0,fw:r.id===t.team_1_id&&null!==t.team_1_score&&null!==t.team_2_score&&t.team_1_score>t.team_2_score?900:500,children:t.team_1_score}):(0,i.jsx)(x.x,{fz:14,span:!0,fw:r.id===t.team_2_id&&null!==t.team_1_score&&null!==t.team_2_score&&t.team_2_score>t.team_1_score?900:500,children:t.team_2_score})," ",":"," ",r.id!==t.team_1_id?(0,i.jsx)(x.x,{fz:14,span:!0,children:t.team_1_score}):(0,i.jsx)(x.x,{fz:14,span:!0,children:t.team_2_score})]})]}),d&&(0,i.jsx)($,{playerStats:d})]})})})}):(0,i.jsx)(V.O,{width:"100%",height:40})}async function ee(e){return(await (0,H.xo)(e)).data}function et(e){let{playerId:t,teamId:n,teams:r}=e,a=(0,g.a)("(min-width: 900px)"),l=(0,g.a)("(min-width: 667px)"),{data:d,error:m,isLoading:u}=(0,B.ZP)("/api/player-recent-matches/".concat(t),()=>ee(t));if(u||!d)return(0,i.jsx)(G.Z,{});if(m)return(0,i.jsx)(x.x,{children:"Sorry, there was an error loading the matches"});let j=d?d.flatMap(e=>e.matches.map(e=>e.id)):[],{data:f,error:w}=U.SX.playerStats.getAggregatedOrderedPlayerStatsArray.useQuery({playerId:t,matchId:j});return(console.log(w),w||!f)?(0,i.jsx)(i.Fragment,{}):(0,i.jsx)(c.K,{p:16,pt:0,children:a?(0,i.jsx)(i.Fragment,{children:d.map(e=>{let t=0,a=0;e.matches.forEach(e=>{e.winner_id===n?t+=1:a+=1});let l="(".concat(t,"-").concat(a,")");return(0,i.jsx)(s.Z,{style:{background:"rgba(0,0,0,.1)"},children:(0,i.jsxs)(o.k,{direction:"column",style:{overflow:"visible"},children:[(0,i.jsxs)(o.k,{gap:1,direction:"column",style:{overflow:"visible"},children:[(0,i.jsx)(p(),{href:"/events/".concat(e.id),style:{color:"inherit",textDecoration:"inherit",display:"flex",alignItems:"end",gap:8},children:(0,i.jsx)(h.D,{td:"underline",order:3,children:e.name})}),(0,i.jsx)(x.x,{span:!0,size:"xs",children:e.season_id})]}),(0,i.jsxs)(s.Z,{p:0,children:[(0,i.jsxs)(o.k,{w:"100%",align:"center",px:16,py:8,bg:"rgba(0,0,0,.1)",style:{fontWeight:700},children:[(0,i.jsx)(x.x,{w:56,fw:700,children:"Date"}),(0,i.jsx)(x.x,{w:96,fw:700,children:"Opponent"}),(0,i.jsx)(x.x,{w:56,fw:700,children:"Result"}),(0,i.jsx)(x.x,{span:!0,w:56,fw:500,children:l}),(0,i.jsxs)(o.k,{gap:16,ml:"auto",children:[(0,i.jsx)(x.x,{w:48,fw:700,children:"KD"}),(0,i.jsx)(x.x,{w:40,fw:700,children:"K"}),(0,i.jsx)(x.x,{w:40,fw:700,children:"D"}),(0,i.jsx)(x.x,{w:56,fw:700,children:"HP KD"}),(0,i.jsx)(x.x,{w:64,fw:700,children:"SND KD"}),(0,i.jsx)(x.x,{w:64,fw:700,children:"CTL KD"}),(0,i.jsx)(x.x,{w:80,fw:700,children:"Slayer Rtg"})]})]}),Q()(e.matches,"datetime","desc").map((e,t)=>{let a=e.team_1_id===n,l=null==r?void 0:r.find(e=>e.id===n),s=a?e.team_2_id:e.team_1_id,d=null==r?void 0:r.find(e=>e.id===s);return l&&d?(0,i.jsx)(Y,{team1:l,team2:d,teamMatch:e,index:t,playerStats:null==f?void 0:f.find(t=>t.match_id===e.id)},"matchcard=".concat(t)):null})]})]})},e.id)})}):l?(0,i.jsx)(i.Fragment,{children:d.map(e=>{let t=0,a=0;e.matches.forEach(e=>{e.winner_id===n?t+=1:a+=1});let l="(".concat(t,"-").concat(a,")");return(0,i.jsx)(s.Z,{style:{background:"rgba(0,0,0,.1)"},children:(0,i.jsxs)(o.k,{direction:"column",style:{overflow:"visible"},children:[(0,i.jsxs)(o.k,{gap:1,direction:"column",style:{overflow:"visible"},children:[(0,i.jsx)(p(),{href:"/events/".concat(e.id),style:{color:"inherit",textDecoration:"inherit",display:"flex",alignItems:"end",gap:8},children:(0,i.jsx)(h.D,{td:"underline",order:3,children:e.name})}),(0,i.jsx)(x.x,{span:!0,size:"xs",children:e.season_id})]}),(0,i.jsxs)(s.Z,{p:0,children:[(0,i.jsxs)(o.k,{w:"100%",align:"center",px:16,py:8,bg:"rgba(0,0,0,.1)",style:{fontWeight:700},children:[(0,i.jsx)(x.x,{w:44,fz:14,fw:700,children:"Date"}),(0,i.jsx)(x.x,{w:64,fz:14,fw:700,children:"Opp"}),(0,i.jsx)(x.x,{w:32,fz:14,fw:700,children:"Res"}),(0,i.jsx)(x.x,{span:!0,w:80,fz:14,fw:500,children:l}),(0,i.jsxs)(o.k,{gap:16,ml:"auto",children:[(0,i.jsx)(x.x,{fz:14,w:40,fw:700,children:"KD"}),(0,i.jsx)(x.x,{fz:14,w:32,fw:700,children:"K"}),(0,i.jsx)(x.x,{fz:14,w:32,fw:700,children:"D"}),(0,i.jsx)(x.x,{w:48,fz:14,fw:700,children:"HP KD"}),(0,i.jsx)(x.x,{w:56,fz:14,fw:700,children:"SND KD"}),(0,i.jsx)(x.x,{w:56,fz:14,fw:700,children:"CTL KD"})]})]}),Q()(e.matches,"datetime","desc").map((e,t)=>{let a=e.team_1_id===n,l=null==r?void 0:r.find(e=>e.id===n),s=a?e.team_2_id:e.team_1_id,d=null==r?void 0:r.find(e=>e.id===s);return l&&d?(0,i.jsx)(Y,{team1:l,team2:d,teamMatch:e,index:t,playerStats:f.find(t=>t.match_id===e.id)},"matchcard=".concat(t)):null})]})]})},e.id)})}):(0,i.jsx)(i.Fragment,{children:d.map(e=>(0,i.jsx)(s.Z,{style:{background:"rgba(0,0,0,.1)"},children:(0,i.jsxs)(o.k,{direction:"column",style:{overflow:"visible"},children:[(0,i.jsxs)(o.k,{gap:1,direction:"column",style:{overflow:"visible"},children:[(0,i.jsx)(p(),{href:"/events/".concat(e.id),style:{color:"inherit",textDecoration:"inherit",display:"flex",alignItems:"end",gap:8},children:(0,i.jsx)(h.D,{td:"underline",order:3,children:e.name})}),(0,i.jsx)(x.x,{span:!0,size:"xs",children:e.season_id})]}),(0,i.jsxs)(s.Z,{p:0,children:[(0,i.jsxs)(o.k,{w:"100%",align:"center",px:16,py:8,bg:"rgba(0,0,0,.1)",style:{fontWeight:700},children:[(0,i.jsx)(x.x,{w:44,fz:14,fw:700,children:"Date"}),(0,i.jsx)(x.x,{w:64,fz:14,fw:700,children:"Opp"}),(0,i.jsx)(x.x,{w:56,fz:14,fw:700,children:"Res"}),(0,i.jsxs)(o.k,{gap:12,ml:"auto",w:96,children:[(0,i.jsx)(x.x,{fz:14,w:32,fw:700,children:"KD"}),(0,i.jsx)(x.x,{fz:14,w:20,fw:700,children:"K"}),(0,i.jsx)(x.x,{fz:14,w:20,fw:700,children:"D"})]})]}),Q()(e.matches,"datetime","desc").map((e,t)=>{let a=e.team_1_id===n,l=null==r?void 0:r.find(e=>e.id===n),s=a?e.team_2_id:e.team_1_id,d=null==r?void 0:r.find(e=>e.id===s);return l&&d?(0,i.jsx)(Y,{team1:l,team2:d,teamMatch:e,index:t,playerStats:f.find(t=>t.match_id===e.id)},"matchcard=".concat(t)):null})]})]})},e.id))})})}async function en(e){return(await (0,H.o7)(e)).data}function ei(e){let{teamId:t,teams:n}=e,{data:r,error:a,isLoading:l}=(0,B.ZP)("/api/team-upcoming-matches/".concat(t),()=>en(t));return l||!r?(0,i.jsx)(G.Z,{}):a?(0,i.jsx)(x.x,{children:"Sorry, there was an error loading the matches"}):(0,i.jsx)(c.K,{p:16,pt:0,children:r.map(e=>(0,i.jsx)(s.Z,{style:{background:"rgba(0,0,0,.1)"},children:(0,i.jsxs)(o.k,{direction:"column",style:{overflow:"visible"},children:[(0,i.jsxs)(o.k,{gap:1,direction:"column",style:{overflow:"visible"},children:[(0,i.jsx)(p(),{href:"/events/".concat(e.id),style:{color:"inherit",textDecoration:"inherit",display:"flex",alignItems:"end",gap:8},children:(0,i.jsx)(h.D,{td:"underline",order:3,children:e.name})}),(0,i.jsx)(x.x,{span:!0,size:"xs",children:e.season_id})]}),(0,i.jsxs)(s.Z,{p:0,children:[(0,i.jsxs)(o.k,{w:"100%",align:"center",px:16,py:8,bg:"rgba(0,0,0,.1)",style:{fontWeight:700},children:[(0,i.jsx)(x.x,{w:"15%",children:"Date"}),(0,i.jsx)(x.x,{w:"15%",mr:"auto",children:"Opponent"})]}),Q()(e.matches,"datetime","asc").map((e,r)=>{let a=e.team_1_id===t,l=null==n?void 0:n.find(e=>e.id===t),s=a?e.team_2_id:e.team_1_id,d=null==n?void 0:n.find(e=>e.id===s);return l&&d?(0,i.jsx)(Y,{team1:l,team2:d,teamMatch:e,index:r},"matchcard=".concat(r)):null})]})]})},e.id))})}let er={completed:"Completed",upcoming:"Upcoming"};function ea(e){let{playerId:t,teamId:n}=e,a=(0,l.X)(),[s,d]=(0,r.useState)(er.upcoming),{teams:c}=(0,J.y)(),{data:h,error:m,isLoading:p}=(0,B.ZP)(n?"/api/team-upcoming-matches/".concat(n):null,()=>en(n));(0,r.useEffect)(()=>{if(h&&!p&&!m){let e=new Date,t=new Date;t.setDate(e.getDate()+14);let n=!1;h.forEach(i=>{i.matches.forEach(i=>{if(i.datetime){let r=new Date(i.datetime);r>=e&&r<=t&&(n=!0)}})}),n||d(er.completed)}},[h,p,m]);let u=(0,r.useCallback)(e=>{switch(e){case er.completed:return(0,i.jsx)(i.Fragment,{children:c&&n&&(0,i.jsx)(et,{playerId:t,teamId:n,teams:c})});case er.upcoming:return n?(0,i.jsx)(i.Fragment,{children:c&&(0,i.jsx)(ei,{teamId:n,teams:c})}):(0,i.jsx)(x.x,{children:"There are no upcoming matches for this player"});default:return(0,i.jsx)(x.x,{children:"There are no matches for this criteria"})}},[t,n,c]);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(o.k,{m:16,gap:8,justify:"left",wrap:"wrap",direction:"row",children:[(0,i.jsx)(L.z,{w:"100%",variant:s===er.upcoming?"filled":"light",color:s===er.upcoming?"":"gray",style:{boxShadow:"0px 0px 5px 0px rgba(0,0,0,0.25)",color:"dark"===a.colorScheme?"white":"black",flex:1},onClick:()=>d(er.upcoming),children:"Upcoming / Live Matches"}),(0,i.jsx)(L.z,{variant:s===er.completed?"filled":"light",color:s===er.completed?"":"gray",style:{boxShadow:"0px 0px 5px 0px rgba(0,0,0,0.25)",color:"dark"===a.colorScheme?"white":"black",flex:1},onClick:()=>d(er.completed),children:"Completed Matches"})]}),u(s)]})}var el=n(58278),es=n(45578),ed=n.n(es),eo=n(89383),ec=n(43019);let eh=e=>(0,eo.$Q)(e).then(e=>e.data),ex=e=>{let t=e.map(e=>e.event.season.title),n=Q()(t,["release_date"],["desc"]);return ed()(n,"id")},em=(e,t)=>Q()(e.filter(e=>e.event.season.title.id===t.id),e=>new Date(e.event.start_date),"desc");function ep(e){let{playerId:t,teamId:n}=e,{data:r,error:a}=(0,B.ZP)("/api/team-events/".concat(t),()=>eh(n)),{team:d}=(0,z.t)(n),x=(0,l.X)();if(a)return(0,i.jsx)("div",{children:"Failed to load"});if(!r)return(0,i.jsx)(G.Z,{});let m=ex(r);return(0,i.jsx)(c.K,{p:16,children:m.map(e=>(0,i.jsx)(s.Z,{style:{background:"rgba(0,0,0,.1)"},children:(0,i.jsxs)(o.k,{direction:"column",gap:16,children:[(0,i.jsxs)(o.k,{gap:"sm",align:"center",justify:"space-between",children:[(0,i.jsx)(h.D,{order:3,children:e.name_medium}),"dark"!==x.colorScheme&&e.logo_lightmode&&(0,i.jsx)(el.x,{style:{height:32,position:"relative",width:128},children:(0,i.jsx)(w(),{alt:e.name,src:e.logo_lightmode,style:{objectFit:"contain"},quality:100,fill:!0})}),"dark"===x.colorScheme&&e.logo_darkmode&&(0,i.jsx)("div",{style:{height:32,position:"relative",width:128},children:(0,i.jsx)(w(),{alt:e.name,src:e.logo_darkmode,style:{objectFit:"contain"},quality:100,fill:!0})})]}),d&&(0,i.jsx)(i.Fragment,{children:em(r,e).map(e=>(0,i.jsx)(ec.u,{eventPlacement:e,team:d},e.id))})]})},e.id))})}var eu=n(69572),ej=n.n(eu);function eg(e){let{teamId:t,data:n,playerId:r}=e,a=(0,g.a)("(min-width: 900px)"),l=(0,g.a)("(min-width: 667px)"),{teams:d}=(0,J.y)(),m=Q()(n.flatMap(e=>e.matches),"datetime","desc"),u=ej()(m,5),j=u.map(e=>e.id),{data:f,error:w}=U.SX.playerStats.getAggregatedOrderedPlayerStatsArray.useQuery({playerId:r,matchId:j});if(w||!f)return(0,i.jsx)(i.Fragment,{});let y=u.reduce((e,t)=>{let i=n.find(e=>e.matches.some(e=>e.id===t.id));return i&&(e[i.id]||(e[i.id]={...i,matches:[]}),e[i.id].matches.push(t)),e},{}),_=Q()(Object.values(y),"start_date","desc");return(0,i.jsx)(c.K,{p:16,children:a?(0,i.jsx)(i.Fragment,{children:_.map(e=>{let n=0,r=0;e.matches.forEach(e=>{e.winner_id===t?n+=1:r+=1});let a="(".concat(n,"-").concat(r,")");return(0,i.jsx)(s.Z,{style:{background:"rgba(0,0,0,.1)"},children:(0,i.jsxs)(o.k,{direction:"column",style:{overflow:"visible"},children:[(0,i.jsxs)(o.k,{gap:1,direction:"column",style:{overflow:"visible"},children:[(0,i.jsx)(p(),{href:"/events/".concat(e.id),style:{color:"inherit",textDecoration:"inherit",display:"flex",alignItems:"end",gap:8},children:(0,i.jsx)(h.D,{td:"underline",order:3,children:e.name})}),(0,i.jsx)(x.x,{span:!0,size:"xs",children:e.season_id})]}),(0,i.jsxs)(s.Z,{p:0,children:[(0,i.jsxs)(o.k,{w:"100%",align:"center",px:16,py:8,bg:"rgba(0,0,0,.1)",style:{fontWeight:700},children:[(0,i.jsx)(x.x,{w:56,fw:700,children:"Date"}),(0,i.jsx)(x.x,{w:96,fw:700,children:"Opponent"}),(0,i.jsx)(x.x,{w:56,fw:700,children:"Result"}),(0,i.jsx)(x.x,{span:!0,w:56,fw:500,children:a}),(0,i.jsxs)(o.k,{gap:16,ml:"auto",children:[(0,i.jsx)(x.x,{w:48,fw:700,children:"KD"}),(0,i.jsx)(x.x,{w:40,fw:700,children:"K"}),(0,i.jsx)(x.x,{w:40,fw:700,children:"D"}),(0,i.jsx)(x.x,{w:56,fw:700,children:"HP KD"}),(0,i.jsx)(x.x,{w:64,fw:700,children:"SND KD"}),(0,i.jsx)(x.x,{w:64,fw:700,children:"CTL KD"}),(0,i.jsx)(x.x,{w:80,fw:700,children:"Slayer Rtg"})]})]}),Q()(e.matches,"datetime","desc").map((e,n)=>{let r=e.team_1_id===t,a=null==d?void 0:d.find(e=>e.id===t),l=r?e.team_2_id:e.team_1_id,s=null==d?void 0:d.find(e=>e.id===l);return a&&s?(0,i.jsx)(Y,{team1:a,team2:s,teamMatch:e,index:n,playerStats:null==f?void 0:f.find(t=>t.match_id===e.id)},"matchcard=".concat(n)):null})]})]})},e.id)})}):l?(0,i.jsx)(i.Fragment,{children:Object.values(y).map(e=>{let n=0,r=0;e.matches.forEach(e=>{e.winner_id===t?n+=1:r+=1});let a="(".concat(n,"-").concat(r,")");return(0,i.jsx)(s.Z,{style:{background:"rgba(0,0,0,.1)"},children:(0,i.jsxs)(o.k,{direction:"column",style:{overflow:"visible"},children:[(0,i.jsxs)(o.k,{gap:1,direction:"column",style:{overflow:"visible"},children:[(0,i.jsx)(p(),{href:"/events/".concat(e.id),style:{color:"inherit",textDecoration:"inherit",display:"flex",alignItems:"end",gap:8},children:(0,i.jsx)(h.D,{td:"underline",order:3,children:e.name})}),(0,i.jsx)(x.x,{span:!0,size:"xs",children:e.season_id})]}),(0,i.jsxs)(s.Z,{p:0,children:[(0,i.jsxs)(o.k,{w:"100%",align:"center",px:16,py:8,bg:"rgba(0,0,0,.1)",style:{fontWeight:700},children:[(0,i.jsx)(x.x,{w:44,fz:14,fw:700,children:"Date"}),(0,i.jsx)(x.x,{w:64,fz:14,fw:700,children:"Opp"}),(0,i.jsx)(x.x,{w:32,fz:14,fw:700,children:"Res"}),(0,i.jsx)(x.x,{span:!0,w:80,fz:14,fw:500,children:a}),(0,i.jsxs)(o.k,{gap:16,ml:"auto",children:[(0,i.jsx)(x.x,{fz:14,w:40,fw:700,children:"KD"}),(0,i.jsx)(x.x,{fz:14,w:32,fw:700,children:"K"}),(0,i.jsx)(x.x,{fz:14,w:32,fw:700,children:"D"}),(0,i.jsx)(x.x,{w:48,fz:14,fw:700,children:"HP KD"}),(0,i.jsx)(x.x,{w:56,fz:14,fw:700,children:"SND KD"}),(0,i.jsx)(x.x,{w:56,fz:14,fw:700,children:"CTL KD"})]})]}),Q()(e.matches,"datetime","desc").map((e,n)=>{let r=e.team_1_id===t,a=null==d?void 0:d.find(e=>e.id===t),l=r?e.team_2_id:e.team_1_id,s=null==d?void 0:d.find(e=>e.id===l);return a&&s?(0,i.jsx)(Y,{team1:a,team2:s,teamMatch:e,index:n,playerStats:f.find(t=>t.match_id===e.id)},"matchcard=".concat(n)):null})]})]})},e.id)})}):(0,i.jsx)(i.Fragment,{children:Object.values(y).map(e=>(0,i.jsx)(s.Z,{style:{background:"rgba(0,0,0,.1)"},children:(0,i.jsxs)(o.k,{direction:"column",style:{overflow:"visible"},children:[(0,i.jsxs)(o.k,{gap:1,direction:"column",style:{overflow:"visible"},children:[(0,i.jsx)(p(),{href:"/events/".concat(e.id),style:{color:"inherit",textDecoration:"inherit",display:"flex",alignItems:"end",gap:8},children:(0,i.jsx)(h.D,{td:"underline",order:3,children:e.name})}),(0,i.jsx)(x.x,{span:!0,size:"xs",children:e.season_id})]}),(0,i.jsxs)(s.Z,{p:0,children:[(0,i.jsxs)(o.k,{w:"100%",align:"center",px:16,py:8,bg:"rgba(0,0,0,.1)",style:{fontWeight:700},children:[(0,i.jsx)(x.x,{w:44,fz:14,fw:700,children:"Date"}),(0,i.jsx)(x.x,{w:64,fz:14,fw:700,children:"Opp"}),(0,i.jsx)(x.x,{w:56,fz:14,fw:700,children:"Res"}),(0,i.jsxs)(o.k,{gap:12,ml:"auto",w:96,children:[(0,i.jsx)(x.x,{fz:14,w:32,fw:700,children:"KD"}),(0,i.jsx)(x.x,{fz:14,w:20,fw:700,children:"K"}),(0,i.jsx)(x.x,{fz:14,w:20,fw:700,children:"D"})]})]}),Q()(e.matches,"datetime","desc").map((e,n)=>{let r=e.team_1_id===t,a=null==d?void 0:d.find(e=>e.id===t),l=r?e.team_2_id:e.team_1_id,s=null==d?void 0:d.find(e=>e.id===l);return a&&s?(0,i.jsx)(Y,{team1:a,team2:s,teamMatch:e,index:n,playerStats:f.find(t=>t.match_id===e.id)},"matchcard=".concat(n)):null})]})]})},e.id))})})}async function ef(e){return(await (0,H.xo)(e)).data}function ew(e){let{teamId:t,playerId:n}=e,{data:r,error:a,isLoading:l}=(0,B.ZP)("/api/player-recent-matches/".concat(n),()=>ef(n));return l||!r?(0,i.jsx)(G.Z,{}):a?(0,i.jsx)(x.x,{children:"Sorry, there was an error loading the matches"}):(0,i.jsx)(eg,{teamId:t,data:r,playerId:n})}var ey=n(11163),e_=n(69111),eb=n(37141);let ev=(0,v.k)(()=>({logoContainer:{maxHeight:"50px",maxWidth:"50px",minHeight:"50px",minWidth:"50px",position:"relative",height:"50px",width:"50px"},logoImage:{flexShrink:0,flexGrow:1,padding:8}}));function ek(){let{classes:e}=ev(),t=(0,l.X)(),{asPath:n}=(0,ey.useRouter)(),[a,d]=(0,r.useState)(),[c,h]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{(async()=>{h(!0);try{let e=await (0,eb.y3)(n);e.data&&d(e.data)}catch(e){console.error("Error during search:",e)}finally{h(!1)}})()},[n]),(0,i.jsx)(o.k,{direction:"column",gap:12,align:"center",p:16,children:!a||c?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(V.O,{height:58,w:"100%"}),(0,i.jsx)(V.O,{height:58,w:"100%"}),(0,i.jsx)(V.O,{height:58,w:"100%"}),(0,i.jsx)(V.O,{height:58,w:"100%"}),(0,i.jsx)(V.O,{height:58,w:"100%"})]}):(0,i.jsx)(i.Fragment,{children:a.map(n=>(0,i.jsxs)(o.k,{direction:"column",w:"100%",gap:4,children:[(0,i.jsx)(o.k,{align:"end",justify:"space-between",w:"100%",children:(0,i.jsx)(x.x,{ta:"right",size:"xs",fs:"italic",children:new Date(null==n?void 0:n.published_at).toLocaleDateString()})}),(0,i.jsx)(p(),{href:"/posts/".concat(n.slug),passHref:!0,style:{width:"100%",color:"inherit",textDecoration:"inherit"},children:(0,i.jsx)(s.Z,{radius:"md",p:4,style:{display:"block",boxShadow:"0px 0px 5px 0px rgba(0,0,0,0.25)",width:"100%"},children:(0,i.jsxs)(o.k,{align:"center",gap:"sm",children:[n.icon_image?(0,i.jsx)("div",{className:e.logoContainer,children:(0,i.jsx)(w(),{alt:n.title,height:50,src:n.icon_image,width:50})}):(0,i.jsx)("div",{className:e.logoContainer,children:(0,i.jsx)(w(),{alt:"bp logo",className:e.logoImage,src:"dark"===t.colorScheme?"/bpLightLogo.png":"/bpDarkLogo.png"})}),(0,i.jsx)(x.x,{fw:"bold",mr:"xs",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(0,e_.decode)(n.title)})]})})},n.id)]}))})})}var eS=n(66520),eD=n(43252),ez=n(76518),eC=n(76599);function eK(e){let{playerTag:t}=e,[n,a]=(0,r.useState)([]),[l,d]=(0,r.useState)(!1);return((0,r.useEffect)(()=>{let e=async e=>{d(!0);try{let t=await fetch("/api/filter-major-and-season-cards-by-player?playerTag=".concat(e)),n=await t.json();a(n)}catch(e){console.error("Failed to fetch card images:",e)}d(!1)};t&&e(t)},[t]),t)?(0,i.jsxs)(i.Fragment,{children:[l&&(0,i.jsx)(s.Z,{style:{background:"rgba(0,0,0,.1)"},children:(0,i.jsxs)(o.k,{direction:"column",gap:8,w:"100%",children:[(0,i.jsx)(h.D,{order:3,children:"Player Cards"}),(0,i.jsx)(eC.Z,{children:(0,i.jsxs)(o.k,{justify:"flex-start",gap:"sm",children:[(0,i.jsx)(V.O,{width:192,height:254}),(0,i.jsx)(V.O,{width:192,height:254}),(0,i.jsx)(V.O,{width:192,height:254}),(0,i.jsx)(V.O,{width:192,height:254})]})})]})}),!l&&0===n.length&&(0,i.jsx)(s.Z,{style:{background:"rgba(0,0,0,.1)"},children:(0,i.jsxs)(o.k,{direction:"column",gap:8,w:"100%",children:[(0,i.jsx)(h.D,{order:3,children:"Player Cards"}),"No cards available"]})}),n.length>0&&(0,i.jsx)(s.Z,{style:{background:"rgba(0,0,0,.1)"},children:(0,i.jsxs)(o.k,{direction:"column",gap:8,w:"100%",children:[(0,i.jsx)(h.D,{order:3,children:"Player Cards"}),(0,i.jsx)(eC.Z,{children:(0,i.jsx)(o.k,{justify:"flex-start",gap:"sm",children:n.slice(0,4).map(e=>(0,i.jsx)(eD.Z,{card:e,isEventShown:!0},e.name))})}),(0,i.jsx)(ez.Z,{modalTitle:"".concat(t,"'s cards"),cards:n,isEventShown:!0})]})})]}):null}var eZ=n(2687),eF=n(24710),eP=n(37113),eI=n(92795),eO=n(69084),eL=n(86414),eT=n(38751);let eN=()=>{let{data:e,...t}=(0,eT.J)("/events",()=>U.b$.cached.events.fetchAll.query());return{...t,events:null==e?void 0:e.data}};var eE=e=>{let{trophy:t}=e,[n,{open:l,close:d}]=(0,eP.q)(!1),c=(0,a.rZ)(),[m,u]=(0,r.useState)(!1),[f,y]=(0,r.useState)(!1),_=(0,g.a)("(max-width: ".concat(440,"px)"));return t&&t.image&&t.name?(0,i.jsxs)(o.k,{direction:"column",pt:8,pb:8,align:"center",style:{border:"".concat(t.border_hex," 1px solid"),borderRadius:8,position:"relative"},children:[(0,i.jsx)(s.Z,{p:0,style:{background:"none"},w:_?192/1.35:192,children:(0,i.jsxs)("div",{style:{position:"relative",width:_?192/1.35:192,height:"auto",minHeight:25},children:[!m&&(0,i.jsx)(V.O,{radius:"md",height:254,width:192,animate:!0}),(0,i.jsx)(w(),{onClick:l,priority:!0,src:t.image,alt:t.name,width:_?192/1.35:192,height:_?254/1.35:254,quality:75,style:{objectFit:"contain",borderRadius:20,cursor:"pointer",display:m?"block":"none",padding:3},onLoadingComplete:()=>u(!0)})]})}),(0,i.jsx)(eI.u,{opened:n,onClose:d,centered:!0,title:(0,i.jsx)(h.D,{order:4,children:t.name}),children:(0,i.jsxs)(o.k,{direction:"column",gap:8,align:"center",children:[(0,i.jsxs)("div",{style:{position:"relative",width:"100%",height:"auto",minHeight:25,border:"".concat(t.border_hex," 1px solid"),borderRadius:8},children:[!f&&(0,i.jsx)(V.O,{radius:"md",height:"58vh",animate:!0}),(0,i.jsx)(w(),{priority:!0,src:t.image,alt:t.name,width:0,height:0,sizes:"100vw",style:{width:"100%",height:"auto",borderRadius:20,padding:"8px 1px",cursor:"pointer",display:f?"block":"none"},onLoadingComplete:()=>y(!0),quality:100}),t.placement&&(0,i.jsx)(eF.C,{size:"xs",style:{position:"absolute",bottom:-8,left:"50%",transform:"translateX(-50%)",backgroundColor:"".concat(t.border_hex),width:"max-content",color:"black",fontWeight:700,fontSize:11,zIndex:3},children:t.placement})]}),(0,i.jsx)(x.x,{p:4,size:20,weight:700,children:(0,i.jsx)(p(),{href:t.event_id?"/events/".concat(t.event_id):"/posts/".concat(t.post_id),style:{color:"inherit"},children:t.name})}),(0,i.jsx)("a",{href:t.image,download:t.name,style:{textDecoration:"none"},children:(0,i.jsxs)(L.z,{variant:"filled",color:"gray",style:{backgroundColor:"dark"===c.colorScheme?"rgba(52, 58, 64, 0.35)":"rgba(255, 255, 255, 0.35)",color:"dark"===c.colorScheme?"white":"black",width:"100%",boxShadow:"0px 0px 5px 0px rgba(0,0,0,0.25)"},children:["Download Trophy"," ",(0,i.jsx)(j.DjJ,{style:{marginLeft:8},size:16})]})})]})}),(0,i.jsx)(x.x,{p:4,size:12,weight:700,maw:_?192/1.35:192,truncate:!0,children:t.name}),t.placement&&(0,i.jsx)(eF.C,{size:"xs",style:{position:"absolute",bottom:-8,left:"50%",transform:"translateX(-50%)",backgroundColor:"".concat(t.border_hex),width:"max-content",color:"black",fontWeight:700,fontSize:11,zIndex:3},children:t.placement})]}):(0,i.jsx)(i.Fragment,{})},eR=e=>{let{trophies:t,modalTitle:n}=e,[a,{open:s,close:d}]=(0,eP.q)(!1),c=(0,l.X)(),[x,m]=(0,r.useState)({method:"time",order:"descending"}),[p,u]=(0,r.useState)([]),[g,f]=(0,r.useState)(""),[w,y]=(0,r.useState)(null),[_,b]=(0,r.useState)(null),[v,k]=(0,r.useState)([]),{events:S}=eN(),D=Array.from(new Set(t.map(e=>{var t;return(null===(t=e.season_id)||void 0===t?void 0:t.toString())||"Unknown"}))).sort((e,t)=>parseInt(t,10)-parseInt(e,10));return((0,r.useEffect)(()=>{let e=[...t.map(e=>{let t=null==S?void 0:S.find(t=>t.id===e.event_id);return{...e,event_name:t?t.name:null}})];w&&"All"!==w&&(e=e.filter(e=>{var t;return(null===(t=e.season_id)||void 0===t?void 0:t.toString())===w})),_&&"All"!==_&&(e=e.filter(e=>{var t;return(null===(t=e.event_id)||void 0===t?void 0:t.toString())===_})),g&&(e=e.filter(e=>e.name.toLowerCase().includes(g.toLowerCase()))),"time"===x.method&&e.sort((e,t)=>e.date_awarded&&t.date_awarded?"descending"===x.order?new Date(t.date_awarded).getTime()-new Date(e.date_awarded).getTime():new Date(e.date_awarded).getTime()-new Date(t.date_awarded).getTime():0),u(e)},[x,t,g,_,w,S]),(0,r.useEffect)(()=>{b(null)},[w]),(0,r.useEffect)(()=>{w?k(Array.from(new Set(t.filter(e=>{var t;return(null===(t=e.season_id)||void 0===t?void 0:t.toString())===w}).filter(e=>null!==e.event_id).map(e=>{var t;let n=null==S?void 0:S.find(t=>t.id===e.event_id);return{value:null===(t=e.event_id)||void 0===t?void 0:t.toString(),label:"".concat(n?n.name:"Unknown Event"," (").concat(e.season_id,")")}}).map(e=>JSON.stringify(e)))).map(e=>JSON.parse(e)).sort((e,t)=>parseInt(t.label,10)-parseInt(e.label,10))):k([])},[w,t,S]),t.length<0)?null:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(L.z,{onClick:s,variant:"light",color:"gray",style:{boxShadow:"0px 0px 5px 0px rgba(0,0,0,0.25)",color:"dark"===c.colorScheme?"white":"black"},styles:{root:{backgroundColor:"rgba(0,0,0,.5)"}},size:"xs",children:"View All"}),(0,i.jsxs)(eI.u,{opened:a,onClose:d,centered:!0,fullScreen:!0,title:(0,i.jsx)(h.D,{order:4,children:n}),children:[(0,i.jsxs)(o.k,{gap:"sm",wrap:"wrap",mb:16,pt:2,children:[(0,i.jsx)(eO.P,{miw:240,data:["All",...D],value:w||"",onChange:e=>y("All"===e?null:e),placeholder:"Filter by season",clearable:!0,style:{flex:1}}),(0,i.jsx)(eO.P,{data:[{value:"All",label:"All"},...v],value:_||"",onChange:e=>b("All"===e?null:e),placeholder:"Filter by event",clearable:!0,style:{flex:1}}),(0,i.jsxs)(L.z,{miw:240,onClick:()=>{m(e=>({method:"time",order:"time"===e.method&&"descending"===e.order?"ascending":"descending"}))},variant:"filled",color:"gray",style:{backgroundColor:"dark"===c.colorScheme?"rgb(46, 46, 46)":"rgba(255, 255, 255, 0.35)",color:"dark"===c.colorScheme?"white":"black",boxShadow:"time"===x.method?"0px 0px 5px 0px rgb(123, 56, 171)":"0px 0px 5px 0px rgba(0,0,0,0.25)",width:"max-content",flex:1},children:["Sort Time"," ","time"===x.method&&"descending"===x.order?"Newest <> Oldest":"Oldest <> Newest"]}),(0,i.jsx)(eL.o,{miw:240,leftSection:(0,i.jsx)(j.jVj,{size:14}),placeholder:"Search by trophy name",value:g,onChange:e=>f(e.currentTarget.value),style:{flex:1}})]}),(0,i.jsx)(o.k,{justify:"center",gap:"sm",wrap:"wrap",children:p.map(e=>(0,i.jsx)(eE,{trophy:e},e.id))})]})]})};let eM=(0,v.k)(()=>({hoverCard:{opacity:0,transition:"250ms",":hover":{opacity:1}}}));function eA(e){let{playerId:t,playerName:n}=e,r=(0,a.rZ)(),d=(0,l.X)(),{classes:c}=eM(),{data:m}=U.SX.trophyAwards.fetchTrophyAwardsData.useQuery({playerId:t});return m?(console.log(m),(0,i.jsxs)(o.k,{direction:"column",mx:16,my:8,gap:4,children:[(0,i.jsx)(h.D,{order:3,size:16,children:"Trophy Cabinet"}),(0,i.jsx)(s.Z,{style:{boxShadow:"0px 0px 5px 0px rgba(0,0,0,0.25)",backgroundColor:"dark"===d.colorScheme?r.colors.dark[7]:r.colors.gray[1]},p:0,children:(0,i.jsxs)(o.k,{w:"100%",align:"center",justify:"center",children:[(0,i.jsx)(o.k,{w:"calc(100% - 112px)",maw:"calc(100% - 112px)",children:(0,i.jsx)(eZ.x,{scrollbarSize:8,children:(0,i.jsx)(o.k,{justify:"flex-start",gap:"sm",m:12,children:m.map(e=>(0,i.jsxs)(s.Z,{p:8,w:86,h:86,style:{position:"relative",border:"".concat(e.border_hex," 1px solid"),overflow:"visible"},children:[(0,i.jsx)(s.Z,{className:c.hoverCard,p:0,w:84,h:84,style:{position:"absolute",top:0,left:0,zIndex:2},children:e.event_id||e.post_id?(0,i.jsx)(p(),{style:{textDecoration:"inherit",color:"inherit"},href:e.event_id?"/events/".concat(e.event_id):"/posts/".concat(e.post_id),children:(0,i.jsx)(o.k,{align:"center",justify:"center",w:86,h:86,p:8,children:(0,i.jsx)(x.x,{ta:"center",fz:12,lineClamp:3,children:e.name})})}):(0,i.jsx)(o.k,{align:"center",justify:"center",w:86,h:86,p:8,children:(0,i.jsx)(x.x,{ta:"center",fz:12,lineClamp:3,children:e.name})})}),(0,i.jsx)(w(),{src:e.image,alt:e.name,quality:100,width:70,height:70,style:{objectFit:"contain"}}),e.placement&&(0,i.jsx)(eF.C,{size:"xs",style:{position:"absolute",bottom:-8,left:"50%",transform:"translateX(-50%)",backgroundColor:"".concat(e.border_hex),width:"max-content",color:"black",fontWeight:700,fontSize:11,zIndex:3},children:e.placement})]},e.id))})})}),(0,i.jsx)(s.Z,{w:112,h:112,p:0,radius:0,children:(0,i.jsxs)(o.k,{w:112,h:112,align:"center",justify:"center",children:[(0,i.jsx)(eR,{trophies:m,modalTitle:"".concat(n,"'s Trophy Case")}),(0,i.jsxs)(x.x,{style:{position:"absolute",bottom:12},fw:700,fz:12,fs:"italic",children:["x",m.length]})]})})]})})]})):null}var eW=n(27896),eH=!0;function eX(e){let{player:t,playerStatRanks:n,roles:o,aggregatedStats:c}=e,h=(0,a.rZ)(),x=(0,l.X)(),[m,p]=(0,r.useState)(null),[u,j]=(0,r.useState)(null),[g,f]=(0,r.useState)(null),[w,y]=(0,r.useState)(null);(0,r.useEffect)(()=>{if(c&&t){let e=(e,n)=>{let i=c.map(t=>({...t,kd:t[n]>0?t[e]/t[n]:t[e]})).sort((e,t)=>t.kd-e.kd),r=i.find(e=>e.player_tag===t.tag),a=r?i.indexOf(r)+1:null,l=i.length>0?i[0].kd:null,s=i.length>0?i[Math.floor(i.length/2)].kd:null;return{playerKD:r?r.kd:null,playerRank:a,middleKD:s,highestKD:l,length:i.length}},n=e("kills","deaths"),i=e("hp_kills","hp_deaths"),r=e("snd_kills","snd_deaths"),a=e("ctl_kills","ctl_deaths");p(n),j(i),f(r),y(a)}},[c,t]);let _=U.SX.homepage.incrementPlayerVisitCount.useMutation({onSuccess:e=>{console.log("Incremented visit count:",e)},onError:e=>{console.log("Failed to increment visit count:",e)}});return((0,r.useEffect)(()=>{(null==t?void 0:t.id)&&_.mutate({playerId:t.id})},[null==t?void 0:t.id]),t)?(0,i.jsxs)(s.Z,{p:0,style:{backgroundColor:"dark"===x.colorScheme?h.colors.dark[8]:h.colors.gray[1]},children:[(0,i.jsx)(eS.Z,{title:"".concat(t.tag," Player Page | Breaking Point"),description:"Scout latest ".concat(t.tag," info and stats on Breaking Point. Explore the most comprehensive Call of Duty League stats on Breaking Point. Delve into detailed player performance, team rankings and advanced analytics designed to give fans, players, and analysts unprecedented insights into the game. Whether you're strategizing for fantasy COD League, researching your favorite teams, or just love diving deep into data, our stats page is your ultimate destination for all things COD League. Get up-to-the-minute updates and dive into the heart of COD esports with Breaking Point."),keywords:"".concat(t.tag,", ").concat(t.first_name," ").concat(t.last_name,", Call of Duty League, COD League Stats, Player Performance, Team Rankings, COD Analytics, Esports Data, Fantasy COD League, Breaking Point"),imageUrl:t.headshot?t.headshot:"/bpDarkLogo.png",url:t.headshot?"https://www.breakingpoint.gg/players/".concat(t.tag):"https://www.breakingpoint.gg"}),(0,i.jsx)(P,{player:t,roles:o}),(0,i.jsx)(eA,{playerId:t.id,playerName:t.tag}),(0,i.jsx)(eW.default,{placementId:"657186fe4ecfa2596a09d57d",hybridBanner:!0}),n&&(0,i.jsx)(R,{overallKDData:m,hpKDData:u,sndKDData:g,ctlKDData:w}),(0,i.jsxs)(d.m,{defaultValue:"last_5_matches",keepMounted:!1,children:[(0,i.jsxs)(d.m.List,{justify:"center",children:[(0,i.jsx)(d.m.Tab,{value:"last_5_matches",children:"Last 5 Matches"}),(0,i.jsx)(d.m.Tab,{value:"matches",children:"Matches"}),(0,i.jsx)(d.m.Tab,{value:"stats",children:"Event Stats"}),(0,i.jsx)(d.m.Tab,{value:"events",children:"Events"}),(null==t?void 0:t.tag)&&(0,i.jsx)(d.m.Tab,{value:"cards",children:"Cards"}),(0,i.jsx)(d.m.Tab,{value:"news",children:"News"})]}),(0,i.jsx)(d.m.Panel,{value:"last_5_matches",children:(0,i.jsx)(ew,{playerId:t.id,teamId:t.current_team_id})}),(0,i.jsx)(d.m.Panel,{value:"matches",children:(0,i.jsx)(ea,{playerId:t.id,teamId:t.current_team_id})}),(0,i.jsx)(d.m.Panel,{value:"stats",children:(0,i.jsx)(X,{player:t})}),(0,i.jsx)(d.m.Panel,{value:"events",children:(0,i.jsx)(ep,{playerId:t.id,teamId:t.current_team_id})}),(null==t?void 0:t.tag)&&(0,i.jsx)(d.m.Panel,{value:"cards",children:(0,i.jsx)(eK,{playerTag:t.tag})}),(0,i.jsx)(d.m.Panel,{value:"news",children:(0,i.jsx)(ek,{})})]})]}):(0,i.jsx)("div",{children:"Sorry, that player was not found"})}}},function(e){e.O(0,[2331,1959,8660,9111,3376,819,9801,3109,2888,9774,179],function(){return e(e.s=32371)}),_N_E=e.O()}]);