!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]="649a90ce-b363-41f0-9410-5e6582f6cc2f",e._sentryDebugIdIdentifier="sentry-dbid-649a90ce-b363-41f0-9410-5e6582f6cc2f")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8711],{3881:(e,t,r)=>{r.d(t,{E:()=>s});var n=r(64082),a=r(6029),i=r(99064),l=r(43451);function s(e){var{height:t=800,width:r="100%",rowHeight:s=45,wrapperStyle:d={},rows:o,animate:g=!1,rowGap:u=8,uniqueKey:h}=e,c=(0,n.T)(e,["height","width","rowHeight","wrapperStyle","rows","animate","rowGap","uniqueKey"]);return 0===t?null:(0,a.jsx)(i.az,Object.assign({maxW:"100%",bg:"surface.s1",overflow:"hidden"},c,{style:d},{children:(0,a.jsx)(l.D,Object.assign({animate:g,width:r,height:o&&s?o*(s+u):t,uniqueKey:h},{children:(0,a.jsx)(a.Fragment,{children:o?Array(o).fill(null).map((e,t)=>(0,a.jsx)("rect",{x:0,y:t*(s+u),width:"100%",height:s},t)):(0,a.jsx)("rect",{x:0,y:0,width:"100%",height:t})})}))}))}},32523:(e,t,r)=>{r.d(t,{E:()=>n.E});var n=r(3881)},58711:(e,t,r)=>{r.d(t,{A:()=>I});var n=r(6029),a=r(32523),i=r(21377),l=r(4967),s=r(37071),d=r(21501),o=r(76356),g=r(55729),u=r(75261),h=r(947),c=r(90248),m=r(494),f=r(45860),y=r(93338),p=r(26995);let v=e=>{let{date:t,sport:r,isSelected:a,hasEvents:i,hasFavorites:l}=e,d=(0,p.NA)(r,a,i,l);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(s.EY,{textStyle:"display.small",style:{color:y.S.var(d.color)},children:t.getDate()}),d.hasDot&&(0,n.jsx)(o.az,{position:"absolute",bottom:"0",br:"2xs",bg:"primary.default",w:"sm",h:"xs"})]})},x=(0,r(62042).AH)({minHeight:"[296px]","& button":{outline:"none","& .highlighted":{bg:"primary.highlight"},"& .highlighted.left":{borderRadius:"[16px 0 0 16px]"},"& .highlighted.right":{borderRadius:"[0 16px 16px 0]"},"& .highlighted.right.left":{br:"lg"}},"& .react-calendar__navigation":{display:"flex",padding:"[10px 5px]"},"& .react-calendar__month-view__weekdays":{bg:"surface.s2",py:"sm"},"& .react-calendar__month-view__weekdays__weekday":{textAlign:"center",textStyle:"body.small",color:"neutrals.nLv3","& > abbr":{textDecoration:"none"}},"& .react-calendar__month-view__days":{p:"0"},"& .react-calendar__month-view__days__day":{p:"0"}});var b=r(54409),w=r(90536),_=r(42440),D=r(10794),j=r(59018),T=r.n(j),C=r(85397),M=r(88530);let S=(e,t)=>(0,l._M)(e.getTime(),t.getTime()-C.v,t.getTime()+C.v),A=(e,t)=>(0,l._M)(e.getTime(),(0,M.IQ)(t).getTime(),(0,M.CP)(t).getTime()),k=(e,t)=>{let r=(0,l.VM)(new Date(e.getTime()-C.v),new Date(e.getTime()+C.v)).filter(e=>e.getMonth()===t);return[r[0],r[r.length-1]]},E=(e,t)=>{let r=(0,l.VM)((0,M.IQ)(e),(0,M.CP)(e)).filter(e=>e.getMonth()===t);return[r[0],r[r.length-1]]};var Q=function(e){return e.Highlighted="highlighted",e.Left="left",e.Right="right",e}(Q||{});let q={gregory:[0,6],hebrew:[0,6],islamic:[6,5],iso8601:[1,0]},R=(e,t,r,n)=>{let a=["highlighted"],i=e.getDay();return i===q[t][0]&&a.push(n?"right":"left"),i===q[t][1]&&a.push(n?"left":"right"),(0,l.yk)(r[0].getTime(),e.getTime())&&a.push(n?"right":"left"),(0,l.yk)(r[1].getTime(),e.getTime())&&a.push(n?"left":"right"),T()(a).join(" ")},z=(e,t,r,n,a,l)=>{if(e===i.QCR.MMA){if(!S(t,r))return;return R(t,a,k(r,n.getMonth()),l)}if([i.QCR.Motorsport,i.QCR.Cycling].includes(e)){if(!A(t,r))return;return R(t,a,E(r,n.getMonth()),l)}},I=function(e){var t,r;let{onChange:y,date:p,sport:j}=e,{textDirection:T}=(0,s.$c)(),C="rtl"===T,M=(0,d.hX)(),[S,A]=(0,g.useState)(new Date),k=(0,h.A)().locale;"pt-pt"===k&&(k="pt");let{data:E}=(0,f.Ay)((t=j,r=(0,w.Ve)(S),[i.QCR.Motorsport,i.QCR.Cycling].includes(t)?i.tI9.dailyUniqueStages(r,3600*(0,l.UW)(),t):i.tI9.dailyUniqueTournaments(r,3600*(0,l.UW)(),t))),Q=(0,_.C)(),q=(0,m.d4)(D.JU),R=(0,m.d4)(D.ZF),I=Object.values(Q).filter(e=>{var t;return(null==(t=e.tournament.uniqueTournament)?void 0:t.category.sport.slug)===j}),F=Object.values(q).filter(e=>{var t;return(null==(t=e.uniqueStage)?void 0:t.category.sport.slug)===j});return((0,g.useEffect)(()=>{A(p)},[p]),M)?(0,n.jsx)(a.E,{br:"lg",h:352,uniqueKey:"calendar-cl"}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(u.Ay,{className:x,showNeighboringMonth:!1,activeStartDate:S,calendarType:R,formatDay:()=>"",navigationLabel:e=>{let{label:t}=e;return(0,n.jsx)(s.EY,{textStyle:"display.medium",children:t})},locale:k,nextLabel:(0,n.jsx)(s.$n,{variant:"clear",children:(0,n.jsx)(b.zQC,{icon:"chevron-right",fill:"primary.default"})}),next2Label:null,prevLabel:(0,n.jsx)(s.$n,{variant:"clear",children:(0,n.jsx)(b.zQC,{icon:"chevron-left",fill:"primary.default"})}),prev2Label:null,minDetail:"month",value:p,onChange:y,onActiveStartDateChange:e=>{let{activeStartDate:t}=e;t&&A(t)},tileContent:e=>{var t;let r=(0,l.cK)(e.date),a=(0,l.yk)(p.getTime(),e.date.getTime()),i=(0,l.UG)(e.date),s=((t=E)?"dailyUniqueTournaments"in t?t.dailyUniqueTournaments.map(e=>e.date):"dailyStages"in t?t.dailyStages.map(e=>e.date):[]:[]).filter(e=>e===i),d=!!s&&!!s.length,g=I.some(t=>(0,l.yk)(new Date(t.startTimestamp).getTime(),e.date.getTime()))||F.some(t=>t.startDateTimestamp&&(0,l.yk)(new Date(t.startDateTimestamp).getTime(),e.date.getTime()));return(0,n.jsx)(o.so,{className:z(j,e.date,p,S,R,C),justify:"center",align:"center",w:"100%",children:(0,n.jsx)(o.so,{position:"relative",justify:"center",align:"center",bg:{base:a?"primary.default":r?"primary.highlight":void 0,_hover:a?void 0:r?"surface.s0":"primary.highlight"},w:{base:"2xl"},h:{base:"2xl"},grow:0,shrink:0,cursor:"pointer",br:"lg",my:"2xs",children:(0,n.jsx)(v,{date:e.date,sport:j,isSelected:a,hasEvents:d,hasFavorites:g})})})}}),(0,n.jsxs)(o.so,{h:"4xl",px:"lg",align:"center",children:[(0,n.jsx)(o.az,{br:"2xs",bg:"primary.default",w:"sm",h:"xs",mr:"sm"}),(0,n.jsx)(s.EY,{textStyle:"body.small",color:"neutrals.nLv3",children:[i.QCR.MMA,i.QCR.Motorsport,i.QCR.Cycling].includes(j)?(0,n.jsx)(c.A,{id:"calendar_scheduled_events"}):(0,n.jsx)(c.A,{id:"calendar_favourites_explainer"})})]}),(0,n.jsx)(o.az,{borderTop:"1px solid {colors.neutrals.nLv4}",p:"sm",textAlign:"center",children:(0,n.jsx)(s.$n,{onClick:()=>{let e=new Date;y(e),A(e)},children:(0,n.jsx)(c.A,{id:"today"})})})]})}},85397:(e,t,r)=>{r.d(t,{S:()=>i,v:()=>a});var n=r(4967);let a=3*n.d_,i=7*n.d_},88530:(e,t,r)=>{r.d(t,{CP:()=>l,Hk:()=>a,IQ:()=>s,NW:()=>i});var n=r(70764);let a=(e,t,r)=>{let n=[],a=[],i=new Set(r.map(e=>{var t;return null==(t=e.stageParent)?void 0:t.id}));t.forEach(t=>{let r=e.find(e=>{var r;return e.id===(null==(r=t.uniqueStage)?void 0:r.id)});void 0!==r&&(i.has(t.id)?n.push(r):a.push(r))});let l=t.map(e=>{var t;return null==(t=e.uniqueStage)?void 0:t.id}),s=e.filter(e=>!l.includes(e.id));return[...o(d(n)),...o(d(a)),...d(s)]},i=(e,t)=>[...t.filter(t=>{var r;return(null==(r=t.uniqueStage)?void 0:r.id)===e.id})],l=e=>{let t=new Date(e),r=t.getDay(),n=new Date(t);n.setDate(t.getDate()-(r-2+7)%7);let a=new Date(n);return a.setDate(n.getDate()+6),a},s=e=>{let t=new Date(e),r=t.getDay();return t.setDate(t.getDate()-(r-2+7)%7),t};function d(e){return e.sort((e,t)=>{let r=n.z.indexOf(e.id),a=n.z.indexOf(t.id);return(-1===r?n.z.length:r)-(-1===a?n.z.length:a)})}function o(e){let t=new Map;return e.forEach(e=>t.set(e.id,e)),Array.from(t.values())}},90536:(e,t,r)=>{r.d(t,{AG:()=>l,Ve:()=>s,aQ:()=>g,mR:()=>d,o5:()=>o});var n=r(21377),a=r(13731),i=r.n(a);let l=e=>e.reduce((e,t)=>e+Number(t),0)/e.length,s=e=>"".concat(e.getFullYear(),"-").concat(9>e.getMonth()?"0":"").concat(e.getMonth()+1);function d(e){let t=e.filter(e=>e.type===n.XFZ.Event);return i()(t,e=>s(new Date(1e3*e.timestamp)))}function o(){let e={},t=new Date;for(let r=0;r<12;r++)e[s(t)]=void 0,t.setMonth(t.getMonth()-1);return e}function g(){let e=new Date;return[new Date(e.getFullYear(),e.getMonth()-11,1).getTime(),new Date(e.getFullYear(),e.getMonth()+1,0).getTime()]}}}]);