!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]="5ec7c89a-aea2-45dd-b751-67ca0c157ab1",e._sentryDebugIdIdentifier="sentry-dbid-5ec7c89a-aea2-45dd-b751-67ca0c157ab1")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[14675],{22977:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>Q});var s=n(6029),r=n(95669),i=n.n(r),l=n(31830),a=n(88715),d=n(4917),o=n(55729),c=n(494),u=n(90438),x=n(52763),j=n(25246),h=n(78767),m=n(18153),p=n(46787),g=n(51569),v=n(20325),f=n(71024),y=n.n(f),_=n(90248),b=n(88658),w=n(46222),E=n(52466),k=n(56494),T=n(20945),A=n(55152),C=n(20953);function S(){return(0,s.jsxs)(w.Zp,{children:[(0,s.jsx)(w.Zp.Header,{titleId:"trending_header_1"}),(0,s.jsxs)(v.so,{direction:"column",gap:"lg",pt:"sm",pb:"lg",px:"lg",children:[(0,s.jsx)(g.EY,{textStyle:"body.mediumParagraph",children:(0,s.jsx)(_.A,{id:"trending_about_1"})}),(0,s.jsx)(g.EY,{textStyle:"body.mediumParagraph",children:(0,s.jsx)(_.A,{id:"trending_about_2"})}),(0,s.jsx)(g.EY,{textStyle:"body.mediumParagraph",children:(0,s.jsx)(_.A,{id:"trending_about_3"})}),(0,s.jsx)(g.EY,{textStyle:"body.mediumParagraph",children:(0,s.jsx)(_.A,{id:"trending_about_4"})}),(0,s.jsx)(g.EY,{textStyle:"body.mediumParagraph",children:(0,s.jsx)(_.A,{id:"trending_about_5"})})]})]})}var P=n(13731),z=n.n(P),I=n(22375),Y=n(90510),D=n(36678),B=n(3074),N=n(36882),H=n(67087);let R=e=>{let{event:t}=(0,H.mJ)(e.event.id,{event:e.event});return(0,s.jsx)(D.gY,{...e,event:t||e.event})};function O(e){let{events:t,tournament:n,lastClickedEvent:r,onClick:i}=e,l=(0,o.useRef)(t.length),{isMobile:a}=(0,g.$c)();return(0,o.useEffect)(()=>{l.current=t.length},[t.length]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(B.UP,{tournament:n,hasFollowOption:!0}),(0,s.jsx)(v.az,{mb:"sm",children:t.map(e=>(0,s.jsx)(R,{event:e,onClick:i,isMobile:a,isSelected:r===e.id,location:N.y.Trending},e.id))})]})}function X(e){let{events:t,lastClickedEvent:n,onClick:r}=e;if(!(null==t?void 0:t.length))return null;let i=function(e){let t=-1,n=[];return e.forEach(e=>{var s,r;let i=e.tournament,l=null!=(r=null==(s=e.tournament.uniqueTournament)?void 0:s.id)?r:i.id;l!==t&&(t=l,n.push({tournament:i,events:[],type:p.bq7.Events})),n[n.length-1].events.push(e)}),n}(t);return(0,s.jsx)(D.MC,{value:{statusTimeOnly:!0,location:N.y.Trending},children:i.map((e,t)=>(0,s.jsx)(O,{...e,lastClickedEvent:n,onClick:r},"".concat(e.tournament.id,"-").concat(t)))})}let Z=(e,t)=>1e3*e.startTimestamp-1e3*t.startTimestamp,q=e=>{let t=new Date(1e3*e.startTimestamp);return t.setHours(0,0,0),t.getTime()},G=function(e){let{events:t,onClick:n,lastClickedEvent:r}=e,i=1e3*t[0].startTimestamp,l=(0,I.cK)(i),a=(0,I.ef)(i),d=(0,o.useMemo)(()=>t.sort((e,t)=>1e3*e.startTimestamp-1e3*t.startTimestamp),[t.map(e=>e.id)]);return(0,s.jsx)(w.WC,{variant:"inverse-desktop",children:(0,s.jsx)(w.Zp,{children:(0,s.jsxs)(v.az,{pb:"sm",children:[(0,s.jsx)(v.so,{px:"lg",pt:"lg",pb:"sm",children:(0,s.jsxs)(g.EY,{textStyle:"display.small",children:[l?(0,s.jsx)(_.A,{id:"today"}):a?(0,s.jsx)(_.A,{id:"tomorrow"}):(0,s.jsx)(Y.XU,{weekday:"short",value:i})," \xb7 ",(0,s.jsx)(Y.XU,{day:"numeric",month:"short",year:(0,I.ND)(i)?void 0:"numeric",value:i})]})}),(0,s.jsx)(X,{events:d,onClick:n,lastClickedEvent:r})]})})})},M=e=>{let{setActiveEventId:t,events:n,isReverse:r=!1,onClick:i,lastClickedEvent:l,showPrevious:a}=e,d=z()(n,q),c=(0,o.useMemo)(()=>{let e=((e,t)=>{let n=Object.keys(e).sort();return t?n.reverse():n})(d,r);if(a)return e;let t=new Date;t.setHours(0,0,0,0);let n=t.getTime();return e.filter(e=>Number(e)>=n)},[d,r,a]);return(0,o.useEffect)(()=>{if(!n.length)return;let e=d[c[0]].sort(Z).find(e=>void 0!==e.startTimestamp);e&&t&&t(e.id)},[n,t]),(0,s.jsx)(v.so,{direction:"column",gap:"sm",children:c.map(e=>(0,s.jsx)(G,{events:d[e],onClick:i,lastClickedEvent:l},e))})};var U=n(45860),$=n(72753);let F=()=>{let e=(0,c.d4)($.LQ),{data:t,error:n,isLoading:s}=(0,U.Ay)(e?p.aX4.trendingEvents(e):null);return{events:(null==t?void 0:t.events)||[],error:n,isLoading:s}},K=y()(()=>Promise.all([n.e(28446),n.e(54246),n.e(24649),n.e(93785),n.e(97672),n.e(54820),n.e(46560),n.e(88620),n.e(79002),n.e(15361),n.e(10533),n.e(39800),n.e(81826),n.e(82489),n.e(54946),n.e(28105),n.e(86795),n.e(66022),n.e(68349),n.e(73240),n.e(34565),n.e(19288),n.e(33937)]).then(n.bind(n,59625)),{loadableGenerated:{webpack:()=>[59625]},loading:()=>(0,s.jsx)(v.so,{w:"100%",h:"1/2",children:(0,s.jsx)(k.a,{})}),ssr:!1});function W(){let e=(0,o.useRef)(null),[t,n]=(0,o.useState)(!0),[r,i]=(0,o.useState)(),[l,a]=(0,o.useState)(!1),{events:d,isLoading:c}=F(),u=(0,o.useCallback)((e,s,l)=>{!l&&(e.preventDefault(),r===s?n(e=>!e):(i(s),t||n(!0)))},[t,r]),x=(0,o.useCallback)(()=>n(!1),[]),j=t?r:void 0;return(0,s.jsxs)(v.az,{pt:"md",children:[(0,s.jsx)(b.B,{children:(0,s.jsx)(b.B.Item,{children:(0,s.jsx)(_.A,{id:"trending_page_title"})})}),(0,s.jsxs)(T.xA,{py:"md",children:[(0,s.jsx)(T.fv,{flexGrow:1,ref:e,children:(0,s.jsx)(w.Zp,{children:(0,s.jsxs)(w.BU,{children:[!l&&(0,s.jsx)(g.$n,{size:"secondary",variant:"clear",onClick:()=>a(!0),children:(0,s.jsxs)(v.so,{w:"100%",justify:"center",gap:"xs",py:"sm",children:[(0,s.jsx)(g.EY,{textStyle:"display.small",color:"primary.default",textTransform:"initial",children:(0,s.jsx)(_.A,{id:"show_previous_events"})}),(0,s.jsx)(v.az,{w:"lg",h:"lg",children:(0,s.jsx)(E.t8v,{color:"primary.default"})})]})}),(0,s.jsx)(v.az,{minH:"[100vh]",w:"100%",children:c?(0,s.jsx)(k.a,{}):(0,s.jsx)(M,{setActiveEventId:i,events:d,isReverse:!1,onClick:u,lastClickedEvent:j,showPrevious:l})})]})})}),t&&r?(0,s.jsx)(T.fv,{flexGrow:1,style:{top:124,height:"fit-content",position:"sticky"},children:(0,s.jsx)(K,{eventId:r,onClose:x})}):(0,s.jsxs)(T.fv,{flexGrow:1,children:[(0,s.jsx)(C.A,{entity:p.bq7.Teams}),(0,s.jsx)(C.A,{entity:p.bq7.Tournaments}),(0,s.jsx)(w.Zp,{children:(0,s.jsx)(A.s,{})}),(0,s.jsx)(S,{})]})]})]})}function J(){let[e,t]=(0,o.useState)(!1),{events:n,isLoading:r}=F();return(0,s.jsxs)(v.so,{direction:"column",gap:"sm",minH:"[100vh]",p:"sm",children:[(0,s.jsx)(b.B,{noBg:!0,children:(0,s.jsx)(b.B.Item,{children:(0,s.jsx)(_.A,{id:"trending_page_title"})})}),!e&&(0,s.jsx)(g.$n,{size:"secondary",variant:"clear",onClick:()=>t(!0),children:(0,s.jsxs)(v.so,{w:"100%",justify:"center",cursor:"pointer",gap:"xs",py:"sm",children:[(0,s.jsx)(g.EY,{textStyle:"display.small",color:"primary.default",textTransform:"initial",children:(0,s.jsx)(_.A,{id:"show_previous_events"})}),(0,s.jsx)(v.az,{w:"lg",h:"lg",children:(0,s.jsx)(E.t8v,{color:"primary.default"})})]})}),(0,s.jsx)(v.az,{minH:"[100vh]",w:"100%",children:r?(0,s.jsx)(k.a,{}):(0,s.jsx)(M,{events:n,isReverse:!1,showPrevious:e})}),(0,s.jsx)(S,{})]})}function L(){let e=(0,c.wA)();return(0,o.useEffect)(()=>{e((0,m.Vy)(null))},[]),(0,s.jsxs)(j.YW,{children:[(0,s.jsx)(h.$B,{children:(0,s.jsx)(J,{})}),(0,s.jsx)(h.h6,{children:(0,s.jsx)(x.JR,{route:u.xW.Trending,children:(0,s.jsx)(W,{})})})]})}let Q=()=>{let e=(0,l.A)();return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(i(),{children:[(0,s.jsx)("link",{rel:"canonical",href:"https://www.sofascore.com".concat(a.z.getTranslatedCanonicalRoute(e,"trending").route)}),(0,s.jsx)("meta",{name:"robots",content:"noindex, nofollow"})]}),(0,s.jsx)(d.A,{titleKey:"trending_page_title",descriptionKey:"trending_meta_description"}),(0,s.jsx)(L,{})]})}},66583:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/trending",function(){return n(22977)}])}},e=>{e.O(0,[33854,66430,56587,61392,31702,36678,3074,64277,90636,46593,38792],()=>e(e.s=66583)),_N_E=e.O()}]);