!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6f44bf40-26a5-4c88-aeac-00d8c009513d",e._sentryDebugIdIdentifier="sentry-dbid-6f44bf40-26a5-4c88-aeac-00d8c009513d")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3699],{23699:(e,t,r)=>{r.r(t),r.d(t,{default:()=>Y});var a=r(6029),n=r(41249),s=r(55729),o=r(65789),l=r(23727),i=r(75751),c=r(70591),d=r(21377),u=r(4967),f=r(21501),p=r(28446),m=r(41735),y=r(85685);r(19168);let h="js-transfers-duration-graph-id",x="js-transfer-fees-graph-id";var g=r(95342);r(14632);var v=r(98516);function j(e,t){let r=0;for(let a=0;a<=t;a++)r+=e[a].duration;return r}let w=(e,t,r,a,n,s)=>{if(e===a.length-1&&!n&&s){let e=0;for(let r=0;r{t+="".concat(e.x,",").concat(e.y," ")}),t}let k=e=>{let{playerTransfers:t,biggestMoney:r,height:a}=e,n=(null==r?void 0:r.value)||0,s=[...t],o=[],l=s[s.length-1].type===d.uDD.EndOfCareer?s.length:s.length-1;for(let e=0;e{if(t===e.length-1)return!1;let r=e[t+1],a=j(e,t);return a+r.duration-a>20},T=m.default.svg.withConfig({componentId:"sc-4b7118d6-0"})(["position:absolute;top:0;left:0;width:100%;height:100%;transform:scale(",",-1);overflow:visible;"],e=>"rtl"===e.theme.settings.textDirection?-1:1);function E(e){let{sport:t,playerId:r,transfers:o,highestTransfer:l,proposedMarketValueRaw:i}=e,c=(0,s.useRef)(null),E=(0,s.useContext)(m.ThemeContext),[L,D]=(0,s.useState)(0),I=((null==l?void 0:l.value)||0)<((null==i?void 0:i.value)||0)?i:l,F=e=>{let a=function(e,t){let r=Date.now(),a=t.map(t=>{let a=1e3*t.transferDateTimestamp;return a>r&&(r=a),{timestamp:a,teamId:t.transferFrom?t.transferFrom.id:0,transferFeeRaw:t.transferFeeRaw,type:t.type,playerId:e}});return t[0].type!==d.uDD.EndOfCareer&&a.push({timestamp:r,teamId:t[0].transferTo?t[0].transferTo.id:0,transferFeeRaw:t[0].transferFeeRaw,type:t[0].type,playerId:e}),a.sort((e,t)=>e.timestamp-t.timestamp)}(r,o),n=(0,p.A)();n.range([0,e]),n.domain([a[0].timestamp,a[a.length-1].timestamp]);let s=a.length>2&&n(a[a.length-1].timestamp)-n(a[a.length-2].timestamp)>24,l=(0,u.ND)(o[0].transferDateTimestamp),c=a.map((t,r,a)=>({timestamp:t.timestamp,duration:w(r,n,e,a,s,l),teamId:t.teamId,transferFeeRaw:t.transferFeeRaw,type:t.type,playerId:t.playerId,index:r}));l&&!s&&(n.range([0,e-24]),c.forEach((t,r)=>{c[r].duration=w(r,n,e,c,s,l)})),function(e,t){let r=(0,g.A)("#".concat(h)),a=e.playerTransfers,n=r.selectAll("div").data(a,(e,t)=>e?"".concat(e.playerId,"-").concat(t):"".concat(t));n.selectAll("img").remove(),n.exit().remove();let s="rtl"===document.dir;n.enter().append("div").merge(n).style("position","relative").style("display","inline-block").style("padding-top","8px").style("height","".concat(144,"px")).style("text-align","center").style("width",e=>"".concat((0,v.M)(e.duration,2),"px")).append("img").attr("src",e=>d.cWY.image(e.teamId)).attr("onerror",'this.src="/static/images/placeholders/team.svg"').style("margin-bottom","16px").style("display",e=>e.duration>=24?"initial":"none").style("min-width","".concat(24,"px")).style("height","".concat(24,"px"));let o=r.selectAll("span").data(a);o.exit().remove(),o.enter().append("span").merge(o).text(e=>"'".concat(new Date(e.timestamp).getFullYear().toString().slice(-2))).style("position","absolute").style("bottom","-".concat(30,"px")).style("padding-bottom","8px").style("left",(e,t)=>s?"auto":"".concat(j(a,t),"px")).style("right",(e,t)=>s?"".concat(j(a,t),"px"):"auto").style("font-size","12px").style("color",t.colors.onSurface.nLv3).style("transform","translateX(".concat("rtl"===document.dir?50:-50,"%)")).style("display",(e,t)=>S(a,t)?"block":"none")}({sport:t,playerTransfers:c},E),!function(e,t,r,a,n){let s=[...r,{x:e,y:r[r.length-1].y}],o=(0,g.A)("#".concat(x)),l=o.append("defs").append("linearGradient").attr("id","gradient").attr("gradientTransform","rotate(90)");l.append("stop").attr("offset","0").attr("stop-color","rgba(20, 172, 35, 0)"),l.append("stop").attr("offset","1").attr("stop-color","rgba(20, 172, 35, 0.1)");let i={y:(0,v.M)(96),color:n.colors.onSurface.nLv4,stroke:"0"},c={y:(0,v.M)(a||0),color:n.colors.sofaSingles.value,stroke:"3.3"},d=[{y:(0,v.M)(64),color:n.colors.onSurface.nLv4,stroke:"0"},{y:(0,v.M)(t/3),color:n.colors.onSurface.nLv4,stroke:"0"},{y:0,color:n.colors.onSurface.nLv4,stroke:"0"}];c.y===i.y?d.push(c):c.y?(d.push(i),d.push(c)):d.push(i);let u=o.selectAll("line").data(d);u.exit().remove(),u.enter().append("line").merge(u).attr("x1",-16).attr("y1",e=>e.y).attr("x2",e+16).attr("y2",e=>e.y).attr("stroke",e=>e.color).attr("stroke-dasharray",e=>e.stroke).attr("shape-rendering","crispEdges");let f=o.selectAll("polyline").data([s]);f.exit().remove(),f.enter().append("polyline").merge(f).attr("points",b(s.map(e=>({x:e.x,y:0})))).transition().duration(300).attr("points",b(s)).attr("fill","none").attr("stroke",n.colors.secondary.default).attr("stroke-width",3).attr("stroke-linecap","round").attr("stroke-linejoin","round");let p=[...s,{x:e,y:0}],m=o.selectAll("polygon").data(p);m.exit().remove(),m.enter().append("polygon").merge(m).attr("points",b(p.map(e=>({x:e.x,y:0})))).transition().duration(300).attr("points",b(p)).attr("fill","url(#gradient)");let y=o.selectAll("circle.year").data(r.filter(e=>e.y>4));y.exit().remove(),y.enter().append("circle").classed("year",!0).merge(y).attr("cx",e=>e.x).attr("r",3).attr("stroke",n.colors.onSurface.nLv3).attr("stroke-width",2).attr("fill",n.colors.surface.s1).attr("cy",0).attr("opacity",0).transition().delay(300).duration(300).attr("opacity",1);let h=o.selectAll("circle.point").data(r);h.exit().remove(),h.enter().append("circle").classed("point",!0).merge(h).attr("cx",e=>e.x).attr("r",3).attr("fill",n.colors.surface.s1).attr("stroke",n.colors.secondary.default).attr("stroke-width",2).attr("cy",e=>e.y).attr("opacity",0).transition().delay(300).duration(300).attr("opacity",1)}(e,96,k({playerTransfers:c,biggestMoney:I,height:96}),i&&I?i.value/I.value*96:null,E)},z=()=>{var e;let t=null==c||null==(e=c.current)?void 0:e.getBoundingClientRect().width;t&&F(t)};return(0,s.useEffect)(()=>{z()},[r,E,L]),(0,f.st)(()=>{var e;let t=null==c||null==(e=c.current)?void 0:e.getBoundingClientRect().width;t&&t!==L&&D(t)},200),(0,a.jsxs)(n.az,{position:"relative",br:"lg",bg:"surface.s2",m:"sm",pb:30,pl:24,pr:(null==I?void 0:I.value)?80:24,children:[(0,a.jsxs)(n.az,{ref:c,position:"relative",children:[(0,a.jsx)(n.so,{id:h}),(0,a.jsx)(T,{id:x})]}),!!(null==I?void 0:I.value)&&(0,a.jsxs)(n.so,{h:112,w:80,position:"absolute",bottom:30,right:0,direction:"column",justify:"space-between",align:"flex-end",pr:8,children:[(0,a.jsx)(n.EY,{style:{transform:"translateY(50%)"},font:"assistive.default",color:"onSurface.nLv3",children:(0,a.jsx)(y.o,{parsedMoney:(0,d.oaz)(I)})}),(0,a.jsx)(n.EY,{style:{transform:"translateY(50%)"},font:"assistive.default",color:"onSurface.nLv3",children:(0,a.jsx)(y.o,{parsedMoney:(0,d.oaz)({...I,value:2*I.value/3})})}),(0,a.jsx)(n.EY,{style:{transform:"translateY(50%)"},font:"assistive.default",color:"onSurface.nLv3",children:(0,a.jsx)(y.o,{parsedMoney:(0,d.oaz)({...I,value:Math.round(I.value/3)})})}),(0,a.jsx)(n.EY,{style:{transform:"translateY(50%)"},font:"assistive.default",color:"transparent",children:"0"})]})]})}var L=r(90248);function D(e){let{proposedMarketValueRaw:t,highestTransfer:r}=e;return(0,a.jsxs)(n.az,{pt:"xl",children:[(0,a.jsxs)(n.so,{align:"center",h:32,justify:"space-between",px:"lg",children:[(0,a.jsxs)(n.so,{align:"center",children:[(0,a.jsx)(n.az,{h:4,w:11,bg:"sofaSingles.value",mr:2}),(0,a.jsx)(n.az,{h:4,w:11,bg:"sofaSingles.value",mr:"sm"}),(0,a.jsx)(n.EY,{font:"assistive.default",color:"onSurface.nLv3",children:(0,a.jsx)(L.A,{id:"market_value"})})]}),!!(null==t?void 0:t.value)&&(0,a.jsx)(n.EY,{font:"assistive.default",color:"onSurface.nLv3",children:(0,a.jsx)(y.o,{parsedMoney:(0,d.oaz)(t)})})]}),(0,a.jsxs)(n.so,{align:"center",h:32,justify:"space-between",px:"lg",children:[(0,a.jsxs)(n.so,{align:"center",children:[(0,a.jsx)(n.az,{h:4,w:24,bg:"secondary.default",mr:"sm"}),(0,a.jsx)(n.EY,{font:"assistive.default",color:"onSurface.nLv3",children:(0,a.jsx)(L.A,{id:"transfer_fee"})})]}),!!(null==r?void 0:r.value)&&(0,a.jsxs)(n.EY,{font:"assistive.default",color:"onSurface.nLv3",children:[(0,a.jsx)(L.A,{id:"highestHint"})," ",(0,a.jsx)(y.o,{parsedMoney:(0,d.oaz)(r)})]})]})]})}var I=r(33144),F=r(90510),z=r(24159),A=r(82967);let R=(0,s.memo)(e=>{let{teamLinks:t,index:r,transfers:s,Link:o}=e,l=s[r],i=l.transferTo?l.transferTo.id:null,c=l.transferTo?(0,a.jsx)(z.c,{entity:l.transferTo}):l.toTeamName,f=l.transferFrom?(0,a.jsx)(z.c,{entity:l.transferFrom}):l.fromTeamName;return(0,a.jsx)(o,{"data-testid":"transfer_history_row",children:(0,a.jsxs)(n.so,{h:56,pl:"lg",align:"center",hoverBg:"surface.s2",children:[(0,a.jsx)(I.p,{id:i||-1,size:40,name:c}),(0,a.jsxs)(n.so,{grow:1,borderBottom:r===t.length-1?void 0:"onSurface.nLv4",h:"100%",align:"center",justify:"space-between",ml:"lg",pr:"lg",children:[(0,a.jsxs)(n.az,{children:[(0,a.jsx)(n.EY,{mb:"xs",font:"body.medium",color:"onSurface.nLv1",as:"div",children:c}),(0,a.jsxs)(n.EY,{font:"assistive.default",color:"onSurface.nLv3",as:"div",children:[(0,a.jsx)(F.XU,{value:1e3*l.transferDateTimestamp,...u.or.dateWithShortMonth})," ",r===s.length-1&&f&&l.type!==d.uDD.Draft&&(0,a.jsx)(L.A,{id:"player.from",values:{fromTeam:f}}),l.round&&l.pick&&(0,a.jsx)(L.A,{id:"player.draftInfo",values:{round:l.round,pick:l.pick}})]})]}),(0,a.jsxs)(n.az,{children:[(0,a.jsx)(n.EY,{font:"body.medium",color:"secondary.default",mb:"xs",align:"right",as:"div",children:l.transferFeeDescription}),l.type!==d.uDD.Transfer&&(0,a.jsx)(n.EY,{font:"body.small",color:"secondary.default",align:"right",as:"div",children:(0,a.jsx)(A.u,{transfer:l})})]})]})]})})},function(e,t){let r=e.index===t.index,a=e.playerId===t.playerId,n=e.teamLinks.length===t.teamLinks.length;return r&&a&&n}),Y=e=>{let{playerId:t,transfers:r,sport:d,proposedMarketValueRaw:u}=e,[f,p]=(0,s.useState)(!1),m=(0,s.useMemo)(()=>(r||[]).map(e=>e.transferTo&&e.transferTo.id&&!e.transferTo.disabled?t=>(0,a.jsx)(c.gT,{team:e.transferTo,sport:d,...t}):e=>(0,a.jsx)(n.az,{...e,children:e.children})),[r,d]),y=(0,s.useMemo)(()=>{let e=(r||[]).filter(e=>!!e.transferFeeRaw&&!isNaN(e.transferFeeRaw.value));return e.length?e.sort((e,t)=>t.transferFeeRaw.value-e.transferFeeRaw.value)[0].transferFeeRaw:{value:0,currency:"",description:"-"}},[r]),h=m.length>5,x=f?m:m.slice(0,5);return((0,s.useEffect)(()=>{p(!1)},[t]),null==r?void 0:r.length)?(0,a.jsx)(i.t,{tag:"transfers",children:(0,a.jsxs)(o.Zp,{"data-testid":"transfer_history",children:[(0,a.jsx)(o.Zp.Header,{titleId:"transfer_history"}),(0,a.jsxs)(n.so,{direction:["column","row"],children:[(0,a.jsxs)(n.az,{w:["100%","50%"],children:[(0,a.jsx)(E,{sport:d,playerId:t,transfers:r,highestTransfer:y,proposedMarketValueRaw:u}),(0,a.jsx)(D,{highestTransfer:y,proposedMarketValueRaw:u})]}),(0,a.jsxs)(n.az,{w:["100%","50%"],borderTop:["onSurface.nLv4",void 0],mt:["sm",0],pt:["sm",0],children:[x.map((e,n)=>(0,a.jsx)(R,{Link:e,index:n,teamLinks:x,playerId:t,transfers:r},"".concat(t,"-").concat(n))),(0,a.jsx)(o.Zp.Footer,{ctaParams:h?{messageId:f?"show_less":"show_more",icon:f?l.X.Up:l.X.Down,onClick:()=>p(e=>!e)}:void 0})]})]})]})}):null}},95342:(e,t,r)=>{r.d(t,{A:()=>s});var a=r(86352),n=r(59371);function s(e){return"string"==typeof e?new n.LN([document.querySelectorAll(e)],[document.documentElement]):new n.LN([(0,a.A)(e)],n.zr)}}}]);