module.exports=[18622,(a,b,c)=>{b.exports=a.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},42602,(a,b,c)=>{"use strict";b.exports=a.r(18622)},87924,(a,b,c)=>{"use strict";b.exports=a.r(42602).vendored["react-ssr"].ReactJsxRuntime},72131,(a,b,c)=>{"use strict";b.exports=a.r(42602).vendored["react-ssr"].React},35112,(a,b,c)=>{"use strict";b.exports=a.r(42602).vendored["react-ssr"].ReactDOM},58145,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(46870),e=a.i(77634);a.i(97361);var f=a.i(29601),f=f,g=a.i(58426),h=a.i(49251),i=a.i(68450),i=i,j=a.i(24188),j=j,k=a.i(44054),k=k,l=a.i(74908),m=a.i(19470),n=a.i(19987);function o({params:a}){let o=(0,d.useMediaQuery)({maxWidth:600});(0,e.default)();let[p,q]=(0,c.useState)(),{playerid:r}=(0,c.use)(a),[s,t]=(0,c.useState)([]),[u,v]=(0,c.useState)([]),[w,x]=(0,c.useState)([]),[y,z]=(0,c.useState)(!0),[A,B]=(0,c.useState)(!1),[C,D]=(0,c.useState)("");async function E(){try{let a=await fetch(`https://localhost:7275/api/player/${r}`),b=await a.json();b.length>0?q(b[0]):(B(!0),D("Invalid Player ID - please choose another player from searchbar or a Team roster."))}catch(a){console.error("Error fetching player: ",a),B(!0),D(a)}}function F(a){return 1==a||11==a||12==a}async function G(){if(p?.position!=void 0&&p?.position!=0)try{let a=F(p?.position)?`https://localhost:7275/api/pitcher/${r}`:`https://localhost:7275/api/batter/${r}`,b=await fetch(a),c=await b.json(),d=[],e=[],f=0,g=!1;if(c.forEach((a,b)=>{d.includes(a.yearid)?(g=!0,f=b,e=c.filter(b=>b.yearid===a.yearid)):d.push(a.yearid)}),g){let a=0,b=0,d=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,q=0,r=0,s=0,t=0;e.forEach(c=>{a+=c.g,b+=c.b1,d+=c.b2,g+=c.b3,h+=c.hr,i+=c.so,j+=c.ibb,k+=c.ubb,F(p.position)?(l+=c.gs,m+=c.w,n+=c.l,o+=c.sv,q+=c.outs,r+=c.er):(s+=c.ab,t+=c.hbp)});let u={playerid:0,yearid:"",levelid:0,teamid:0,g:0,gs:0,w:0,l:0,sv:0,outs:0,b1:0,b2:0,b3:0,hr:0,so:0,er:0,ibb:0,ubb:0},v={playerid:0,yearid:"",levelid:0,teamid:0,g:0,ab:0,b1:0,b2:0,b3:0,hr:0,ubb:0,hbp:0,so:0,ci:0,ibb:0,sh:0,sf:0,sb:0,cs:0,pa:0,r:0,rbi:0};F(p.position)?(u.yearid=`${e[0]?.yearid} Total`,u.g=a,u.b1=b,u.b2=d,u.b3=g,u.hr=h,u.so=i,u.ibb=j,u.ubb=k,u.gs=l,u.w=m,u.l=n,u.sv=o,u.outs=q,u.er=r,c.splice(f+1,0,u)):(v.yearid=`${e[0]?.yearid} Total`,v.g=a,v.b1=b,v.b2=d,v.b3=g,v.hr=h,v.so=i,v.ibb=j,v.ubb=k,v.ab=s,v.hbp=t,c.splice(f+1,0,v))}F(p.position)?t(c):v(c)}catch(a){console.error("Error fetching player: ",a)}}async function H(){if(p?.position!=void 0&&p?.position!=0)try{let a=F(p?.position)?`https://localhost:7275/api/metrics/pitcher/${r}`:`https://localhost:7275/api/metrics/batter/${r}`,b=await fetch(a),c=await b.json();x(c),z(!1)}catch(a){console.error("Error fetching player: ",a)}}return(0,c.useEffect)(()=>{E()},[r]),(0,c.useEffect)(()=>{G(),H()},[p]),(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(g.NavBar,{}),(0,b.jsxs)("div",{className:`min-h-screen bg-gradient-to-br from-blue-50 to-indigo-100 ${o?"py-8 px-2":"p-8"} grid content-center`,style:{overflow:"auto"},children:[A?(0,b.jsx)("div",{className:"flex content-center",children:(0,b.jsx)(l.Card,{sx:{maxWidth:345},children:(0,b.jsx)(n.default,{className:"bg-red-100",children:(0,b.jsxs)(m.Typography,{children:[(0,b.jsx)("b",{children:"ERROR:"})," ",C]})})})}):(0,b.jsx)(b.Fragment,{}),A?(0,b.jsx)(b.Fragment,{}):o?(0,b.jsxs)("div",{className:"max-w-sm mx-auto",style:{marginTop:50},children:[(0,b.jsx)(f.default,{player:p}),(0,b.jsxs)("div",{className:"flex flex-col",children:[(0,b.jsx)("div",{style:{paddingTop:15,marginBottom:15},children:F(p?.position)?(0,b.jsx)(i.default,{rows:s}):(0,b.jsx)(j.default,{rows:u})}),(0,b.jsx)("div",{style:{marginBottom:30},children:(0,b.jsx)(k.default,{metrics:w,loadingMetrics:y,isPitcher:F(p?.position)})})]})]}):(0,b.jsxs)("div",{className:"max-w-6xl mx-auto flex",children:[(0,b.jsx)(f.default,{player:p}),(0,b.jsxs)("div",{className:"flex flex-col",children:[(0,b.jsx)("div",{style:{paddingLeft:15},children:F(p?.position)?(0,b.jsx)(i.default,{rows:s}):(0,b.jsx)(j.default,{rows:u})}),(0,b.jsx)("div",{style:{paddingLeft:15,paddingTop:30},children:(0,b.jsx)(k.default,{metrics:w,loadingMetrics:y,isPitcher:F(p?.position)})})]})]})]}),(0,b.jsx)(h.Footer,{})]})}a.s(["default",()=>o],58145)}];

//# sourceMappingURL=%5Broot-of-the-server%5D__44308b75._.js.map