1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5481],{19136:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/calculator",function(){return n(6650)}])},6650:function(e,t,n){"use strict";n.r(t),n.d(t,{__N_SSG:function(){return ew},default:function(){return eS}});var r=n(85893),a=n(67294),l=n(11163),i=n(18745),s=n(60990),o=n(96788),c=n(13589),d=n(15972),u=n(10980),x=n(21038),h=n(52857),m=n(51015),f=n(97182),p=n(23279),g=n.n(p),y=n(96182),j=n(61730),b=n(41664),v=n.n(b),Z=n(93454),w=n(95639),S=n(10794),C=e=>{let{position:t,customStyles:n,rank:a}=e;return(0,r.jsxs)(s.Z,{component:"span",sx:{display:"inline-flex",justifyContent:"center",alignItems:"flex-end",color:"text.secondary",fontSize:{xs:"0.65rem",sm:"0.65rem",md:"0.85rem"},whiteSpace:"nowrap",pb:{xs:.4,sm:.3,md:.2},...n},children:[(0,r.jsx)("span",{children:t}),a&&a<100&&(0,r.jsxs)("span",{style:{fontSize:"0.85em"},children:["/",a]})]})},A=n(14470),k=e=>{let{player:t,onDelete:n}=e,a={fontSize:{xs:"0.8rem",sm:"0.9rem"},fontFamily:"Avenir, Arial, sans-serif"},l=(e=>{if(!e||0===e.length)return;let t=e[0];for(let n=0;n<e.length;n++)"SP"===e[n]&&(t=e[n]);return t})(t.positions);return(0,r.jsxs)(s.Z,{sx:{position:"relative",mb:1.3,width:"100%"},children:[(0,r.jsx)(Z.Z,{elevation:1,sx:{width:"100%",border:"1px solid",borderColor:S.Z.secondary500,backgroundColor:S.Z.secondary100},children:(0,r.jsxs)(s.Z,{sx:{p:{xs:1.05,sm:1.25},display:"flex",alignItems:"center",width:"100%"},children:[(0,r.jsx)(s.Z,{sx:{flex:"1 0 auto",maxWidth:"50%",minWidth:0,display:"flex",justifyContent:"flex-start"},children:(0,r.jsx)(o.Z,{variant:"h6",component:v(),href:"/player/".concat((0,A.m)(t.name,t.id)),prefetch:!1,sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block",...a,textDecoration:"underline",color:"inherit",fontWeight:600},children:t.name})}),(0,r.jsx)(s.Z,{sx:{flex:"1 1 auto",minWidth:0,minHeight:24,display:"flex",alignItems:"center",justifyContent:"center",gap:.5,overflow:"hidden"},children:"PLAYER"===t.assetType?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s.Z,{sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(0,r.jsx)(C,{position:l,customStyles:a,rank:t.positionRanks[l]})}),(0,r.jsx)(o.Z,{variant:"body2",color:"text.secondary",sx:{...a,whiteSpace:"nowrap"},children:"\xb7"}),(0,r.jsxs)(o.Z,{variant:"body2",color:"text.secondary",sx:{...a,whiteSpace:"nowrap"},children:[t.age," y.o."]})]}):(0,r.jsx)(o.Z,{variant:"body2",color:"text.secondary",sx:{...a,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.assetType})}),(0,r.jsx)(s.Z,{sx:{flex:1.25,display:"flex",justifyContent:"flex-end",pr:1},children:(0,r.jsx)(o.Z,{variant:"body2",color:"text.secondary",sx:{...a,fontWeight:600},children:1e4===t.value?(0,r.jsx)(o.Z,{component:"span",sx:{...a,color:S.Z.secondary550,fontWeight:"bold"},children:t.value.toLocaleString()}):t.value.toLocaleString()})})]})}),(0,r.jsx)(h.Z,{onClick:()=>n(t),"aria-label":"delete",size:"small",sx:{position:"absolute",right:-9,top:-8,backgroundColor:"grey.300",color:"text.secondary",width:{xs:22,sm:20},height:{xs:22,sm:20},"&:hover":{backgroundColor:"grey.400"},"& .MuiSvgIcon-root":{fontSize:16}},children:(0,r.jsx)(w.Z,{})})]})},T=n(84166),z=n(73078),M=e=>{let{totalValue:t,depreciationValue:n,success:l=!1}=e,[i,c]=(0,a.useState)(!1),d=()=>{c(!1)},m={fontSize:{xs:"0.85rem",sm:"0.95rem"},fontFamily:"Avenir, Arial, sans-serif"},f={fontSize:{xs:"0.75rem",sm:"0.85rem"},fontFamily:"Avenir, Arial, sans-serif"};return(0,r.jsxs)(s.Z,{sx:{width:"100%",borderTop:"2px solid",borderColor:l?"rgba(0, 128, 0, 0.4)":"rgba(255, 0, 0, 0.3)",backgroundColor:l?"rgba(0, 128, 0, 0.05)":"rgba(255, 0, 0, 0.03)",borderRadius:"0 0 8px 8px",px:{xs:1.5,sm:2},py:{xs:1,sm:1.25}},children:[0!==n&&(0,r.jsxs)(T.Z,{direction:"row",spacing:2,alignItems:"center",sx:{width:"100%",pb:{xs:.5,sm:.75}},children:[(0,r.jsxs)(o.Z,{variant:"body1",color:"text.secondary",component:"div",sx:{flexGrow:1,...f},children:["Package adjustment",(0,r.jsx)(u.d,{onClickAway:d,children:(0,r.jsx)(x.Z,{title:(0,r.jsx)(o.Z,{sx:{fontSize:{xs:".7rem",sm:".8rem"},fontFamily:"Avenir, Arial, sans-serif"},children:"Applies a deduction when combining lower value players to acquire a high value player."}),placement:"top",open:i,onClose:d,disableFocusListener:!0,disableHoverListener:!0,disableTouchListener:!0,children:(0,r.jsx)(h.Z,{"aria-label":"Total value info",size:"small",onClick:()=>{c(e=>!e)},children:(0,r.jsx)(z.Z,{fontSize:"inherit"})})})})]}),(0,r.jsxs)(o.Z,{variant:"body1",color:"text.secondary",sx:f,children:["-",n.toLocaleStr
1ing()]})]}),(0,r.jsxs)(T.Z,{direction:"row",spacing:2,alignItems:"center",sx:{width:"100%"},children:[(0,r.jsx)(o.Z,{variant:"body1",component:"div",sx:{color:S.Z.greyDark,flexGrow:1,fontWeight:"bold",...m},children:"Total value"}),(0,r.jsx)(o.Z,{variant:"body1",sx:{color:l?"#2e7d32":"#c62828",fontWeight:"bold",...m},children:t.toLocaleString()})]})]})},F=n(82729),I=n(68573),P=n(82591),L=n(70917),R=n(45098);function W(){let e=(0,F._)(["\n from {\n opacity: 0;\n transform: translateY(-10%);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n"]);return W=function(){return e},e}let V={icon:{minWidth:{xs:"17px",sm:"20px"},width:"fit-content",padding:"0 1px",height:{xs:"17px",sm:"20px"},borderRadius:"20%",backgroundColor:S.Z.primary400,display:"flex",justifyContent:"center",alignItems:"center",fontSize:{xs:"0.6rem",sm:".75rem"},color:"white",fontWeight:600,flexShrink:0,zIndex:100,fontFamily:"Avenir, Arial, sans-serif",position:"relative"},row:{border:"1px solid",backgroundColor:S.Z.secondary100,borderColor:S.Z.secondary500,display:"flex",justifyContent:"space-between",alignItems:"center",flexGrow:1,marginLeft:{xs:"-10px",sm:"-12px"},position:"relative",zIndex:99,width:"100%",minWidth:0,cursor:"pointer",transition:"background-color 0.15s ease","&:hover":{backgroundColor:S.Z.secondary200||"#e8e8e8"}},rowText:{fontWeight:600,color:"black",fontSize:{xs:"0.8rem",sm:".9rem"},fontFamily:"Avenir, Arial, sans-serif",maxWidth:"100%",px:{xs:.7,sm:1},py:{xs:.5,sm:.75}},text:{fontWeight:600,color:"black",fontSize:{xs:"0.8rem",sm:".8rem"},fontFamily:"Avenir, Arial, sans-serif",maxWidth:"100%",px:{xs:.7,sm:1},py:{xs:.75,sm:.75}},toggleButton:{display:"flex",justifyContent:"center"}},D=(0,L.F4)(W()),B=(0,R.Z)(s.Z,{shouldForwardProp:e=>"fadeOpacity"!==e&&"delay"!==e})(e=>{let{delay:t}=e;return{animation:"".concat(D," 0.5s ease-out"),animationDelay:"".concat(t,"s"),animationFillMode:"forwards",opacity:0,display:"flex",alignItems:"center",justifyContent:"center",width:"100%"}});var E=e=>{let{players:t,addTeamPlayer:n}=e,[l,i]=(0,a.useState)(!1);return(0,r.jsxs)(s.Z,{sx:{mb:{xs:0,sm:0}},children:[(0,r.jsx)(s.Z,{sx:V.toggleButton,children:(0,r.jsx)(m.Z,{variant:"text",color:"primary",onClick:()=>{i(e=>!e)},sx:{fontFamily:"Avenir, Arial, sans-serif",fontWeight:600,fontSize:{xs:"0.7rem",sm:".8rem"}},children:l?"Hide suggestions":"Even this side?"})}),l&&(0,r.jsx)(I.ZP,{container:!0,spacing:{xs:1,sm:1.5},style:{margin:"0 auto",width:"90%"},justifyContent:"center",children:t.map((e,t)=>(0,r.jsx)(I.ZP,{item:!0,xs:12,sx:{display:"flex",alignItems:"stretch"},children:(0,r.jsx)(B,{delay:.2*t,children:(0,r.jsxs)(s.Z,{sx:{display:"flex",alignItems:"center",width:"100%"},children:[(0,r.jsx)(s.Z,{sx:{...V.icon,py:e.originalIndex+1>999?"1px":"0px"},children:e.originalIndex+1}),(0,r.jsx)(Z.Z,{onClick:()=>n(e),sx:{...V.row,height:"100%",width:"100%"},children:(0,r.jsxs)(I.ZP,{container:!0,alignItems:"center",children:[(0,r.jsx)(I.ZP,{item:!0,xs:9,sx:{display:"flex",alignItems:"center"},children:(0,r.jsx)(o.Z,{sx:{...V.rowText,marginLeft:{xs:"10px",sm:"12px"}},children:e.name})}),(0,r.jsx)(I.ZP,{item:!0,xs:2,sx:{display:"flex",justifyContent:"flex-end",alignItems:"center"},children:(0,r.jsx)(o.Z,{sx:{...V.text},children:e.value&&e.value.toLocaleString()})}),(0,r.jsx)(I.ZP,{item:!0,xs:1,sx:{display:"flex",justifyContent:"center",alignItems:"center"},children:(0,r.jsx)(P.Z,{sx:{fontSize:{xs:"1.1rem",sm:"1.3rem"},color:S.Z.secondary600,mr:1}})})]})})]})},e.id)},"".concat(e.id,"-").concat(t)))})]})},O=n(6486),_=n(92765),N=n(26541),U=n(95611),H=n(75527),q=n(47407),G=n(19304),K=n(32200),Y=n(35299),X=n(4145);let $=e=>e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),J=(e,t)=>{if(!t)return e;let n=$(e),a=$(t),l=n.indexOf(a);if(-1===l)return e;let i=e.slice(0,l),s=e.slice(l,l+t.length),o=e.slice(l+t.length);return(0,r.jsxs)(r.Fragment,{children:[i,(0,r.jsx)("strong",{style:{fontWeight:700},children:s}),o]})};var Q=e=>{var t;let{options:n,onSelect:l}=e,[i,c]=(0,a.useState)(""),d=(0,a.useRef)(null),u=n.filter(e=>$(e.name).includes($(i))).slice(0,5);return(0,r.jsxs)(s.Z,{sx:{width:"100%"},ref:d,children:[(0,r.jsx)(N.Z,{placeholder:"Search for a player or pick...",fullWidth:!0,onChange:e=>{c(e.target.value)},value:i,size:"small",InputProps:{startAdornment:(0,r.jsx)(U.Z,{position:"start",children:(0,r.jsx)(Y.Z,{sx:{color:S.Z.grey500}})}),endAdornment:i&&(0,r.jsx)(U.Z,{position:"end",children:(0,r.jsx)(X.Z,{sx:{cursor:"pointer",color:S.Z.grey500},onClick:()=>{c("")}})})},sx:{"& .MuiOutlinedInput-root":{fontFamily:"Avenir, Arial, sans-serif",height:"43px"},"& .MuiInputBase-input":{fontFamily:"Avenir, Arial, sans-serif",fontSize:"1rem",fontWeight:500}}}),(0,r.jsx)(H.Z,{open:i.length>0&&u.length>
10,anchorEl:d.current,style:{zIndex:1300,width:null===(t=d.current)||void 0===t?void 0:t.offsetWidth},children:(0,r.jsx)(Z.Z,{style:{maxHeight:300,overflow:"auto"},children:(0,r.jsx)(q.Z,{children:u.map(e=>(0,r.jsxs)(G.ZP,{button:!0,onClick:()=>{l(e),c("")},sx:{display:"flex",justifyContent:"space-between",py:.5},size:"small",children:[(0,r.jsx)(K.Z,{primary:J(e.name,i),primaryTypographyProps:{fontFamily:"Avenir, Arial, sans-serif",fontSize:".9rem",fontWeight:500}}),(0,r.jsx)(o.Z,{component:"span",sx:{marginLeft:2,fontWeight:500,fontFamily:"Avenir, Arial, sans-serif",fontSize:".9rem",color:S.Z.greyDark},children:e.value.toLocaleString()})]},e.id))})})})]})},ee=e=>{let{playerRankings:t,teamNumber:n,addTeamPlayer:l,deleteTeamPlayer:o,teamPlayers:c,teamValue:d,depreciationValue:u,success:x,closeTheGapValue:h,allUsedPlayers:m,showSuggestions:f}=e,[p,g]=(0,a.useState)(!0),y=(0,i.Z)(),b=(0,j.Z)(y.breakpoints.down("sm")),v=(0,a.useMemo)(()=>(0,O.$O)(t,h,5,m),[t,h,m]),Z=e=>{g(!p),l(e)};return(0,r.jsxs)(s.Z,{sx:{display:"flex",flexDirection:"column",flex:1,gap:1,width:"100%",minWidth:0},children:[(0,r.jsx)(_.Z,{title:"Team ".concat(n," receives"),size:b?"small":"medium"}),(0,r.jsx)(Q,{options:t,onSelect:e=>Z(e)}),c.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s.Z,{sx:{mt:1,width:"100%"},children:c.map((e,t)=>(0,r.jsx)(k,{player:e,onDelete:()=>o(t)},"".concat(e.name,"-").concat(n,"-").concat(t)))}),(0,r.jsx)(M,{totalValue:d,depreciationValue:u,success:x})]}),f&&m.length>0&&!x&&(0,r.jsx)(E,{players:v,addTeamPlayer:l})]})},et=n(98535),en=n(9126),er=n(89857),ea=n(77745),el=n(77267),ei=n(35774),es=n(48604),eo=n(34384),ec=n(85979),ed=n(76105);let eu={fontFamily:"Avenir, Arial, sans-serif",fontSize:{xs:".7rem",sm:".8rem"},fontWeight:500};var ex=e=>{let{tradeDifference:t,success:n}=e,[l,i]=(0,a.useState)(!1),[c,d]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{t<0&&!n?(i(!0),d(!1)):t>0&&!n?(d(!0),i(!1)):(i(!1),d(!1))},[t,n]),(0,r.jsxs)(s.Z,{sx:{display:"flex",alignItems:"flex-end",justifyContent:"center",gap:{xs:"2px",sm:"4px"},flexWrap:"nowrap"},children:[l&&(0,r.jsx)(ed.Z,{sx:{fontSize:{xs:"1.5rem",sm:"1.6rem"},color:"text.secondary"}}),(0,r.jsx)(o.Z,{color:n?"success.main":"text.secondary",sx:{...eu,textAlign:"center",ml:{xs:c?"24px":0,sm:c?"26px":0},mr:{xs:l?"24px":0,sm:l?"26px":0},display:"flex",alignItems:"center",fontStyle:"italic",pb:"3px"},children:n?(0,r.jsx)(r.Fragment,{}):"".concat(t>0?"Favors Team 2":"Favors Team 1")}),c&&(0,r.jsx)(ec.Z,{sx:{fontSize:{xs:"1.5rem",sm:"1.6rem"},color:"text.secondary"}})]})};let eh={labelText:{fontFamily:"Avenir, Arial, sans-serif",fontSize:{xs:"0.85rem",sm:"0.95rem"},fontWeight:"bold",color:S.Z.sectionTitle},valueText:{fontFamily:"Avenir, Arial, sans-serif",fontSize:{xs:"0.85rem",sm:"0.95rem"},fontWeight:"bold"}};var em=e=>{let{teamOneValue:t,teamTwoValue:n,tradeDifference:a,acceptanceThreshold:l,success:i}=e,c=(0,es.fF)(t,n),d=c<50,u=l?(()=>{let[e,r]=(0,es.fU)(t,n,l);return[{value:e,label:""},{value:r,label:""}]})():[],x=i?"rgba(46, 125, 50":"rgba(198, 40, 40",h=()=>{if(null===l)return null;if(i){let e="".concat(x,", ").concat(.7,")");return"linear-gradient(to right, ".concat(e,", ").concat(e,")")}let e=d?"".concat(x,", ").concat(.3,")"):"".concat(x,", ").concat(.7,")"),t=d?"".concat(x,", ").concat(.7,")"):"".concat(x,", ").concat(.3,")");return"linear-gradient(to right, ".concat(e," 0%, ").concat(e," ").concat(c,"%, ").concat(t," ").concat(c,"%, ").concat(t," 100%)")};return(0,r.jsxs)(Z.Z,{variant:"outlined",sx:{width:"100%",py:1.5,display:"flex",borderRadius:2,flexDirection:"column",justifyContent:"center",alignItems:"center",...null!==l&&{bgcolor:i?"rgba(0, 128, 0, 0.05)":"rgba(255, 0, 0, 0.03)",border:"2px solid",borderColor:i?"rgba(46, 125, 50, 0.5)":"rgba(198, 40, 40, 0.5)"}},children:[(0,r.jsx)(eo.ZP,{value:c,"aria-label":"Trade balance",marks:u,sx:{maxWidth:"85%","& .MuiSlider-track":{display:"none"},"& .MuiSlider-rail":{opacity:1,height:"6px",...h()?{background:h()}:{backgroundColor:"#bdbdbd"}},...null!==l&&{"& .MuiSlider-thumb":{color:i?"#2e7d32":"#c62828"}
1,"& .MuiSlider-mark, & .MuiSlider-markActive":{backgroundColor:i?"rgba(46, 125, 50, 1)":"rgba(198, 40, 40, 1)",width:"3px",height:"30px",borderRadius:2,opacity:1}}},disabled:!0}),(0,r.jsxs)(s.Z,{sx:{display:"flex",justifyContent:"space-between",width:"100%"},children:[(0,r.jsxs)(s.Z,{sx:{textAlign:"left",px:3},children:[(0,r.jsx)(o.Z,{sx:{...eh.labelText,fontWeight:500},children:"Team 1"}),(0,r.jsx)(o.Z,{sx:{...eh.valueText,color:S.Z.sectionTitle},children:t.toLocaleString()})]}),null!==l&&(0,r.jsx)(ex,{tradeDifference:a,success:i}),(0,r.jsxs)(s.Z,{sx:{textAlign:"right",px:3},children:[(0,r.jsx)(o.Z,{sx:{...eh.labelText,fontWeight:500},children:"Team 2"}),(0,r.jsx)(o.Z,{sx:{...eh.valueText,color:S.Z.sectionTitle},children:n.toLocaleString()})]})]})]})},ef=n(96902),ep=n(93182),eg=n(58490),ey=n(5152);let ej=n.n(ey)()(()=>Promise.all([n.e(7993),n.e(1933),n.e(581)]).then(n.bind(n,80581)),{loadableGenerated:{webpack:()=>[80581]},ssr:!1}),eb=Array.from({length:12},(e,t)=>8+2*t),ev={fontFamily:"Avenir, Arial, sans-serif",fontSize:{xs:".7rem",sm:".8rem"},fontWeight:500};var eZ=e=>{let{playerRankings:t,error:p,initialTrade:j}=e,[b,v]=(0,a.useState)((null==j?void 0:j.teamOne)||[]),[Z,w]=(0,a.useState)((null==j?void 0:j.teamTwo)||[]),[S,C]=(0,a.useState)(()=>{if(null==j?void 0:j.leagueSize){let e=parseInt(j.leagueSize,10);if(e>=8&&e<=30&&e%2==0)return e}{let e=parseInt(localStorage.getItem("hkb_leagueSize"),10);if(e>=8&&e<=30&&e%2==0)return e}return 12}),[A,k]=(0,a.useState)(!1),[T,M]=(0,a.useState)(!1),[F,I]=(0,a.useState)(!1),[P,L]=(0,a.useState)(!1);(0,a.useEffect)(()=>{localStorage.setItem("hkb_leagueSize",S)},[S]);let R=(0,a.useRef)(null),W=(0,i.Z)();(0,a.useEffect)(()=>{(async()=>{if("undefined"!=typeof navigator&&navigator.share&&navigator.canShare){let e=new File([new Blob(["test"],{type:"image/png"})],"test.png",{type:"image/png"});try{let t=navigator.canShare({files:[e]});L(t)}catch(e){L(!1)}}})()},[]);let V=(0,l.useRouter)(),D=(0,a.useMemo)(()=>(0,es.V1)(b,Z,S),[b,Z,S]),B=(0,a.useMemo)(()=>(0,es.V1)(Z,b,S),[Z,b,S]),{adjustedTeamOneDepreciation:E,adjustedTeamTwoDepreciation:O}=(0,a.useMemo)(()=>{let e=D.depreciationValue,t=B.depreciationValue;return e>t?(e-=t,t=0):(t-=e,e=0),{adjustedTeamOneDepreciation:e,adjustedTeamTwoDepreciation:t}},[D.depreciationValue,B.depreciationValue]),{teamOneValue:_,teamTwoValue:N}=(0,a.useMemo)(()=>({teamOneValue:D.teamValue-E,teamTwoValue:B.teamValue-O}),[D.teamValue,B.teamValue,E,O]),U=(0,a.useMemo)(()=>N-_,[N,_]),H=(0,a.useMemo)(()=>0!==_||0!==N?Math.max(20,Math.min(400,Math.max(_,N)/18)):null,[_,N]),q=(0,a.useMemo)(()=>b.length>0&&Z.length>0&&Math.abs(U)<H,[b.length,Z.length,U,H]),G=(0,a.useMemo)(()=>(0,es.VH)(b,Z,D.teamValue-D.depreciationValue,B.teamValue-B.depreciationValue,S),[b,Z,D,B,S]),K=(0,a.useMemo)(()=>b.concat(Z),[b,Z]),Y=(0,a.useRef)(g()((e,t,n)=>{let r=new URLSearchParams;if(e.length>0){let t=e.map(e=>e.id).filter(Boolean);t.length>0&&r.set("teamOne",t.join(","))}if(t.length>0){let e=t.map(e=>e.id).filter(Boolean);e.length>0&&r.set("teamTwo",e.join(","))}(e.length>0||t.length>0)&&n&&r.set("leagueSize",n);let a=r.toString();V.replace(a?"/calculator?".concat(a):"/calculator",void 0,{shallow:!0})},3e3)).current;(0,a.useEffect)(()=>()=>{Y.cancel()},[Y]);let X=(0,a.useCallback)((e,t,n)=>{Y(e,t,n)},[Y]),$=async()=>{if(R.current&&!F){I(!0);try{let e=(await n.e(5443).then(n.t.bind(n,61120,23))).default,t=await e(R.current,{backgroundColor:"#ffffff",scale:2,useCORS:!0,logging:!1,onclone:e=>{e.querySelectorAll("input").forEach(e=>{e.style.color="rgba(0, 0, 0, 0.6)",e.style.setProperty("--placeholder-color","rgba(0, 0, 0, 0.6)")}),e.querySelectorAll(".MuiInputBase-input, .MuiOutlinedInput-input").forEach(e=>{e.style.color="rgba(0, 0, 0, 0.6)"}),e.querySelectorAll("a").forEach(e=>{e.style.textDecoration="none"}),e.querySelectorAll(".MuiIconButton-root").forEach(e=>{e.style.display="none"}),e.querySelectorAll(".MuiSlider-thumb input, .MuiSlider-valueLabel").forEach(e=>{e.style.display="none"})}}),r=document.createElement("canvas"),a=r.getContext("2d");r.width=t.width+80,r.height=t.height+80+80,a.fillStyle="#ffffff",a.fillRect(0,0,r.width,r.height),a.drawImage(t,40,40);let l=t.height+40+20;a.fillStyle="#1a1a2e",a.fillRect(0,l-10,r.width,90),a.fillStyle="#ffffff",a.font="bold 28px Arial, sans-serif",a.textAlign="center",a.fillText("Build your own trades at harryknowsball.com/calculator",r.width/2,l+35);let i=await new Promise(e=>
1r.toBlob(e,"image/png")),s=new File([i],"trade-screenshot.png",{type:"image/png"});if(navigator.share&&navigator.canShare&&navigator.canShare({files:[s]}))await navigator.share({files:[s],text:"Check out this trade! Analyze dynasty baseball trades at HarryKnowsBall.com/calculator"});else{let e=URL.createObjectURL(i),t=document.createElement("a");t.href=e,t.download="trade-screenshot.png",document.body.appendChild(t),t.click(),document.body.removeChild(t),URL.revokeObjectURL(e)}}catch(e){"AbortError"!==e.name&&console.error("Failed to share:",e)}finally{I(!1)}}};return(0,r.jsxs)(s.Z,{sx:{p:1},children:[(0,r.jsx)(en.Z,{title:"Dynasty Baseball Trade Calculator",description:"HKB's dynasty fantasy baseball trade calculator offers crowdsourced player and pick values for precise, up-to-date trade analysis.",image:"/assets/Slide1.png",canonicalUrl:"https://harryknowsball.com/calculator"}),(0,r.jsx)(et.Z,{pageName:"Trade Calculator",extraText:"Crowdsourced dynasty baseball trade values. Select one or more players or picks for each side.",promotionType:"picker"}),(0,r.jsx)(ef.Z,{showOnMobile:!1,rightColumnContent:(0,r.jsx)(ep.Z,{page:"calculator",players:t,showValueRisers:!0,showValueFallers:!0,showRankRisers:!1,showRankFallers:!1,showMostViewed:!1,showArticles:!1,showQuickStats:!1,showAdSpace:!1}),children:(0,r.jsxs)(s.Z,{sx:{width:"100%",px:1},children:[p&&(0,r.jsx)(y.Z,{severity:"error",sx:{marginBottom:2},children:"We couldn't load the player data. Please check your internet connection or try refreshing the page."}),(0,r.jsxs)(s.Z,{sx:{my:4,mt:2,display:"flex",flexDirection:"column",alignItems:"center"},children:[(0,r.jsx)(s.Z,{sx:{display:"flex",justifyContent:"flex-end",alignItems:"center",width:"100%",mb:1.5,gap:1},children:(0,r.jsxs)(s.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,r.jsx)(eg.Z,{sx:{fontSize:18,color:W.palette.grey[600]}}),(0,r.jsx)(o.Z,{sx:{fontFamily:"Avenir, Arial, sans-serif",fontSize:".8rem",fontWeight:600,color:W.palette.grey[700]},children:"League Size"}),(0,r.jsx)(c.Z,{value:S,onChange:e=>{let t=e.target.value;C(t),(b.length>0||Z.length>0)&&X(b,Z,t)},size:"small",SelectDisplayProps:{"aria-label":"League Size"},sx:{fontFamily:"Avenir, Arial, sans-serif",fontSize:".8rem",fontWeight:600,height:32,minWidth:60,"& .MuiSelect-select":{py:.5}},MenuProps:{PaperProps:{sx:{maxHeight:280}}},children:eb.map(e=>(0,r.jsx)(d.Z,{value:e,sx:{fontFamily:"Avenir, Arial, sans-serif",fontSize:".85rem"},children:e},e))}),(0,r.jsx)(u.d,{onClickAway:()=>M(!1),children:(0,r.jsx)(x.Z,{title:(0,r.jsx)(o.Z,{sx:{fontSize:{xs:".7rem",sm:".8rem"},fontFamily:"Avenir, Arial, sans-serif"},children:"Adjusts the package adjustment penalty. Larger leagues reduce the penalty because depth is more valuable."}),placement:"top",open:T,onClose:()=>M(!1),disableFocusListener:!0,disableHoverListener:!0,disableTouchListener:!0,children:(0,r.jsx)(h.Z,{"aria-label":"League size info",size:"small",onClick:()=>M(e=>!e),sx:{p:.5},children:(0,r.jsx)(z.Z,{sx:{fontSize:16,color:W.palette.grey[500]}})})})})]})}),(0,r.jsxs)(s.Z,{ref:R,sx:{width:"100%",backgroundColor:"white",pb:2},children:[(0,r.jsxs)(s.Z,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:4,[W.breakpoints.down("sm")]:{flexDirection:"column"},backgroundColor:"white"},children:[(0,r.jsx)(ee,{playerRankings:t,teamNumber:1,teamPlayers:b,addTeamPlayer:e=>{if(e&&("PICK"===e.assetType||!b.some(t=>t.name===e.name))){let t=[...b,e];v(t),X(t,Z,S)}},deleteTeamPlayer:e=>{let t=b.filter((t,n)=>n!==e);v(t),X(t,Z,S)},teamValue:_,depreciationValue:E,success:q,closeTheGapValue:G,allUsedPlayers:K,showSuggestions:U>0}),(0,r.jsx)(ee,{playerRankings:t,teamNumber:2,teamPlayers:Z,addTeamPlayer:e=>{if(e&&("PICK"===e.assetType||!Z.some(t=>t.name===e.name))){let t=[...Z,e];w(t),X(b,t,S)}},deleteTeamPlayer:e=>{let t=Z.filter((t,n)=>n!==e);w(t),X(b,t,S)},teamValue:N,depreciationValue:O,success:q,closeTheGapValue:G,allUsedPlayers:K,showSuggestions:U<=0})]}),(0,r.jsx)(s.Z,{sx:{mt:4,width:"100%",display:"flex",flexDirection:"column",alignContent:"center",justifyContent:"center",gap:2},children:(0,r.jsx)(em,{teamOneValue:_,teamTwoValue:N,tradeDifference:U,acceptanceThreshold:H,success:q})})]}),(0,r.jsxs)(s.Z,{sx:{mt:{xs:1,sm:1.5},width:"100%",display:"flex",flexDirection:"column",alignContent:"center",justifyContent:"center",gap:2},children:[(0,r.jsxs)(s.Z,{sx:{display:"flex",justifyContent:"flex-end",width:"100%",gap:1,mb:1},children:[(0,r.jsxs)(m.Z,{variant:"outlined",size:"small",onClick:()=>{let e=new URLSearchParams;if(b.length>0){let t=b.map(e=>
1e.id).filter(Boolean);t.length>0&&e.set("teamOne",t.join(","))}if(Z.length>0){let t=Z.map(e=>e.id).filter(Boolean);t.length>0&&e.set("teamTwo",t.join(","))}(b.length>0||Z.length>0)&&e.set("leagueSize",S);let t=e.toString(),n=t?"".concat(window.location.origin,"/calculator?").concat(t):"".concat(window.location.origin,"/calculator");Y.flush(),navigator.clipboard.writeText(n).then(()=>{k(!0),setTimeout(()=>k(!1),3e3)}).catch(e=>console.error("Failed to copy URL:",e))},sx:{borderRadius:1,p:.9,display:"flex",alignItems:"center",gap:1,color:W.palette.grey[700],borderColor:W.palette.grey[400],"&:hover":{borderColor:W.palette.grey[500],backgroundColor:W.palette.grey[100]}},children:[A?(0,r.jsx)(ea.Z,{fontSize:"small",sx:{transition:"opacity 0.4s ease"}}):(0,r.jsx)(er.Z,{fontSize:"small",sx:{transition:"opacity 0.4s ease"}}),(0,r.jsx)(o.Z,{sx:{...ev,fontWeight:600},children:"Copy Trade URL"})]}),(0,r.jsxs)(m.Z,{variant:"outlined",size:"small",onClick:$,disabled:F,sx:{borderRadius:1,p:.9,display:"flex",alignItems:"center",gap:1,color:W.palette.grey[700],borderColor:W.palette.grey[400],"&:hover":{borderColor:W.palette.grey[500],backgroundColor:W.palette.grey[100]}},children:[F?(0,r.jsx)(f.Z,{size:18,color:"inherit"}):P?(0,r.jsx)(el.Z,{fontSize:"small",sx:{transition:"opacity 0.4s ease"}}):(0,r.jsx)(ei.Z,{fontSize:"small",sx:{transition:"opacity 0.4s ease"}}),(0,r.jsx)(o.Z,{sx:{...ev,fontWeight:600},children:"Screenshot"})]})]}),(0,r.jsx)(s.Z,{sx:{display:{xs:"none",md:"block"},width:"100%",alignSelf:"stretch",borderTop:"1px solid #e0e0e0",borderBottom:"1px solid #e0e0e0",borderLeft:"1px solid #e0e0e0",borderRight:"1px solid #e0e0e0",my:.5},children:(0,r.jsx)("div",{className:"raptive-content-placeholder-desktop",style:{height:110,overflow:"hidden",width:"100%",display:"flex",justifyContent:"center",alignItems:"center"}})}),b.length>0&&Z.length>0&&(0,r.jsx)(ej,{teamOnePlayers:b,teamTwoPlayers:Z,teamOneValue:_,teamTwoValue:N,success:q,adjustedTeamOneDepreciation:E,adjustedTeamTwoDepreciation:O})]})]})]})})]})},ew=!0;function eS(e){let{players:t,playersError:n}=e,i=(0,l.useRouter)(),[o,c]=(0,a.useState)({teamOne:[],teamTwo:[]}),[d,u]=(0,a.useState)(!1);return((0,a.useEffect)(()=>{if(i.isReady){if(t&&t.length>0){let{teamOne:e,teamTwo:n,leagueSize:r}=i.query,a=e?(Array.isArray(e)?e[0]:e).slice(0,500).split(",").slice(0,40).filter(Boolean):[],l=n?(Array.isArray(n)?n[0]:n).slice(0,500).split(",").slice(0,40).filter(Boolean):[];c({teamOne:a.map(e=>t.find(t=>{var n;return(null===(n=t.id)||void 0===n?void 0:n.toString())===e})).filter(Boolean),teamTwo:l.map(e=>t.find(t=>{var n;return(null===(n=t.id)||void 0===n?void 0:n.toString())===e})).filter(Boolean),leagueSize:r||null})}u(!0)}},[i.isReady,i.query,t]),d)?(0,r.jsx)(eZ,{playerRankings:t,error:n,initialTrade:o}):(0,r.jsx)(s.Z,{sx:{minHeight:"100vh"}})}},92765:function(e,t,n){"use strict";var r=n(85893);n(67294);var a=n(96788),l=n(10794);t.Z=e=>{let{title:t,size:n="medium"}=e,{fontSize:i,letterSpacing:s,mb:o}={small:{fontSize:"0.8rem",letterSpacing:1,mb:.75},medium:{fontSize:"0.9rem",letterSpacing:1.2,mb:.75},large:{fontSize:"1rem",letterSpacing:1.4,mb:2}}[n];return(0,r.jsx)(a.Z,{sx:{fontFamily:"Futura, Arial, sans-serif",fontWeight:600,fontSize:i,letterSpacing:s,color:l.Z.greyDark,textTransform:"uppercase",px:1,mb:o},children:t})}},6486:function(e,t,n){"use strict";n.d(t,{$O:function(){return r},cc:function(){return s},fJ:function(){return l},s0:function(){return i},zY:function(){return a}});let r=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(!(null==e?void 0:e.length)||e.length<n)return[];let a=e=>r.some(t=>t.id===e.id),l=e=>!(!e||a(e)||o.some(t=>t.id===e.id))&&(o.push(e),!0),i=0,s=Number.MAX_SAFE_INTEGER;for(let n=0;n<e.length;n++){let r=e[n];if(!a(r)){if(Math.abs(r.value-t)>s)break;i=n,s=Math.abs(r.value-t)}}let o=[];l(e[i]);let c=0,d=1,u=1;for(;o.length<n&&c<100;){let n,r;if(c++,i-d>=0)n=e[i-d];else{i+u<e.length&&l(e[i+u]),u++;continue}if(i+u<e.length)r=e[i+u];else{i-d>=0&&l(e[i-d]),d++;continue}Math.abs(n.value-t)>Math.abs(r.value-t)?(l(r),u++):(l(n),d++)}return o.sort((e,t)=>
1{let n=t.value-e.value;return 0===n?e.originalIndex-t.originalIndex:n})},a=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;if(!(null==e?void 0:e.length))return[];let r=e.findIndex(e=>e.id===t);if(-1===r)return[];let a=e.length-r-1,l=Math.min(n,r),i=Math.min(n,a),s=2*n+1-1;l<n?i=Math.min(s-l,a):i<n&&(l=Math.min(s-i,r));let o=r-l,c=r+i;return e.slice(o,c+1)},l=(e,t)=>t?e:"NR",i=e=>{if(!e)return"";let t=new Date(e);return isNaN(t.getTime())?"":t.toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric",timeZone:"UTC"})},s=e=>{if(!e)return"...";let t=new Date(e),n=Math.floor(Math.floor((new Date-t)/1e3)/60),r=Math.floor(n/60);return n<1?"now":r<1?"".concat(n," minute").concat(1!==n?"s":""," ago"):"".concat(r," hour").concat(1!==r?"s":""," ago")}},48604:function(e,t,n){"use strict";n.d(t,{$I:function(){return m},BZ:function(){return h},H5:function(){return x},Ms:function(){return u},V1:function(){return o},VH:function(){return c},fF:function(){return a},fU:function(){return l}});var r=n(10794);let a=(e,t)=>{let n=e+t;return s(n?t/n*100:50)},l=(e,t,n)=>{let r=e+t,a=Math.abs(s(r?(r/2-n/2)/r*100:50)-50);return[Math.max(0,50-a),Math.min(100,50+a)]},i=[[0,2.4],[15,2.2],[25,2.05],[34,1.9],[40.5,1.7],[45,1.5],[46,1.35],[47.2,1.2],[48.5,1.1],[49.5,1.05],[50,1]],s=e=>{let t=e>50?100-e:e,n=1;for(let e=0;e<i.length-1;e++){let[r,a]=i[e],[l,s]=i[e+1];if(t<=l){n=a+(t-r)/(l-r)*(s-a);break}}return t/=n,e>50?100-t:t},o=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:12,r=[...e].sort((e,t)=>t.value-e.value),a=r.reduce((e,t)=>e+t.value,0);return{teamValue:a,depreciationValue:Math.floor(a-r.map((e,t)=>{let r=d(t,n);return e.value*(1-r)}).reduce((e,t)=>e+t,0))}},c=function(e,t,n,r){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:12,l=(e,t)=>[...e,{value:t,excessValue:0}].sort((e,t)=>t.value-e.value).reduce((e,t,n)=>{let r=d(n,a);return e+t.value*(1-r)},0),i=r-n,s=i>0?e:t,o=i>0?r:n,c=0,u=2*o,x=Math.floor((0+u)/2);for(let e=0;e<12;e++){let e=Math.floor((c+u)/2);l(s,e)<o?c=e+1:u=e-1,x=e}return x},d=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:12;return 0===e?0:Math.min(.78,Math.max(0,.36-(t-12)*.01)+.02*e)};r.Z.primary400,r.Z.secondary550,r.Z.SP,r.Z.OF,r.Z["3B"],r.Z["2B"],r.Z.RP,r.Z.primary300,r.Z.secondary400,r.Z.SP_Lighter,r.Z.OF_Lighter,r.Z["3B_Lighter"],r.Z["2B_Lighter"],r.Z.RP_Lighter;let u=["#D36B6B","#E0C66D","#7AA77B","#5C8CCF","#D8B86D","#D9A178","#9A85C9"],x=["#D67884","#5CB8A0","#E7E28D","#6A9CCF","#A89BAE","#B97A68","#6DB7C1"],h=r.Z.primary400,m=r.Z.secondary550}},function(e){e.O(0,[8573,4166,1313,3965,6682,8422,1873,374,2266,8532,1844,9611,2888,9774,179],function(){return e(e.s=19136)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.