!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]="a67f7183-34e2-4718-93e4-e154da0ba736",e._sentryDebugIdIdentifier="sentry-dbid-a67f7183-34e2-4718-93e4-e154da0ba736")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5635],{14352:(e,t,r)=>{r.d(t,{s:()=>x});var n=r(42330),i=r(55094),s=r(43479);function a(e,t){[...t].reverse().forEach(r=>{let n=e.getVariant(r);n&&(0,i.U)(e,n),e.variantChildren&&e.variantChildren.forEach(e=>{a(e,t)})})}function o(){let e=!1,t=new Set,r={subscribe:e=>(t.add(e),()=>void t.delete(e)),start(r,i){(0,n.V)(e,"controls.start() should only be called after a component has mounted. Consider calling within a useEffect hook.");let a=[];return t.forEach(e=>{a.push((0,s._)(e,r,{transitionOverride:i}))}),Promise.all(a)},set:r=>((0,n.V)(e,"controls.set() should only be called after a component has mounted. Consider calling within a useEffect hook."),t.forEach(e=>{var t,n;t=e,Array.isArray(n=r)?a(t,n):"string"==typeof n?a(t,[n]):(0,i.U)(t,n)})),stop(){t.forEach(e=>{e.values.forEach(e=>e.stop())})},mount:()=>(e=!0,()=>{e=!1,r.stop()})};return r}var l=r(44033),c=r(2274);let x=function(){let e=(0,l.M)(o);return(0,c.E)(e.mount,[]),e}},85635:(e,t,r)=>{r.r(t),r.d(t,{default:()=>B});var n=r(6029),i=r(21377),s=r(21501),a=r(41249),o=r(55729),l=r(90248),c=r(41735),x=r(62859),d=r(28446),u=r(98516),h=r(26331),f=r(19168);let m=e=>Math.floor(e.inningNumber/2)+e.inningNumber%2,v=e=>{let{event:t,leftTeam:r}=(0,o.useContext)(x.y$);return(0,o.useMemo)(()=>{let n={};if(e.forEach(e=>{if("ball"!==e.incidentType||e.superOver)return;let t=m(e);n[t]||(n[t]={maxOver:0,overs:{},totalRuns:{[i.cxP.Left]:0,[i.cxP.Right]:0},teamMaxOver:{[i.cxP.Left]:0,[i.cxP.Right]:0}});let s=e.battingTeamId===r.id?i.cxP.Left:i.cxP.Right;n[t].overs[e.over]||(n[t].overs[e.over]={}),n[t].overs[e.over][s]||(n[t].overs[e.over][s]={runs:0,wickets:0}),"wickets"===e.incidentClassColor&&(n[t].overs[e.over][s].wickets+=1),n[t].overs[e.over][s].runs+=e.totalRuns,n[t].totalRuns[s]=(n[t].totalRuns[s]||0)+e.totalRuns,n[t].maxOver=Math.max(n[t].maxOver,e.over),n[t].teamMaxOver[s]=Math.max(n[t].teamMaxOver[s],e.over)}),t.status.type===i.XUj.InProgress){for(let t of e)if("ball"===t.incidentType){n[m(t)].liveOver=t.over;break}}return n},[e,t.status.type])},p=e=>e<=20?4:e<=50?5:e<=100?10:e<=200?20:40,g=e=>e<=150?30:e<=350?40:e<=450?50:e<=750?75:100,j=(e,t)=>{let r=t(e),n=Math.ceil(Math.max(e,5*r)/r)*r;return{max:n,segment:r,buckets:n/r}},y=e=>{let t=Math.max(e.totalRuns[i.cxP.Left]||0,e.totalRuns[i.cxP.Right]||0);return{x:j(e.maxOver,p),y:j(t,g)}},b=e=>{let t=(0,h.A)(),r=(0,f.Jx)(t),n=e-36-14;return r?{dir:"rtl",initialX:n,finalX:0,viewBox:"-14 -24 ".concat(e," 220")}:{dir:"ltr",initialX:0,finalX:n,viewBox:"-36 -24 ".concat(e," 220")}},w=(e,t,r)=>{let{precision:n,direction:s}=t,a=(0,d.A)([s.initialX,s.finalX],[0,n.x.max]),o=(0,d.A)([160,0],[0,n.y.max]),l={[i.cxP.Left]:0,[i.cxP.Right]:0},c={};return Object.keys(e).forEach(t=>{let r=e[t];r[i.cxP.Left]&&(l[i.cxP.Left]+=r[i.cxP.Left].runs),r[i.cxP.Right]&&(l[i.cxP.Right]+=r[i.cxP.Right].runs),[i.cxP.Left,i.cxP.Right].forEach(e=>{if(!r[e])return;let n=c[e]||{svgPath:"M ".concat(s.initialX,",").concat(160),wickets:[]},x=l[e===i.cxP.Left?i.cxP.Right:i.cxP.Left],d=e===i.cxP.Left?"top":"bottom",h=(0,u.M)(a.invert(Number(t)),2),f=(0,u.M)(o.invert(l[e]),2);n.svgPath+=" L ".concat(h,",").concat(f),r[e].wickets&&n.wickets.push({over:t,x:h,y:f,num:r[e].wickets,position:l[e]>x?"top":l[e]e.theme.typography.font.assistive.micro,e=>e.theme.colors.onSurface.nLv1,e=>e.theme.colors.onSurface.nLv3),P=c.default.line.withConfig({componentId:"sc-62317dbb-1"})(["stroke:",";stroke-width:0.5;stroke-dasharray:4;"],e=>e.theme.colors.onSurface.nLv3);function L(e){let{layout:t}=e,{direction:r,precision:i}=t,s=(0,d.A)([r.initialX,r.finalX],[0,i.x.max]),a=(0,d.A)([160,0],[0,i.y.max]),l=i.y.max.toString().length*("rtl"===r.dir?4:-4);return(0,n.jsxs)("g",{children:[Array.from({length:i.x.buckets+1}).map((e,t)=>{let r=i.x.segment*t,a=(0,u.M)(s.invert(r),2);return(0,n.jsxs)(o.Fragment,{children:[(0,n.jsx)(k,{x:a,y:174,children:r}),(0,n.jsx)(P,{x1:a,x2:a,y1:0,y2:160})]},t)}),Array.from({length:i.y.buckets+1}).map((e,t)=>{let s=i.y.segment*t,c=(0,u.M)(a.invert(s),2);return(0,n.jsxs)(o.Fragment,{children:[(0,n.jsx)(k,{x:r.initialX+l,y:Number(c)+3,children:s}),(0,n.jsx)(P,{x1:r.initialX,x2:r.finalX,y1:c,y2:c},t)]},t)})]})}var _=r(947),R=r(94604);function E(e){let{team:t,color:r,...i}=e;return(0,n.jsxs)(a.so,{align:"center",gap:"sm",...i,children:[(0,n.jsx)(a.az,{h:"8px",w:"8px",border:"2px solid ".concat(r),br:"50%",bg:"surface.s1"}),(0,n.jsxs)(a.EY,{as:"div",font:"assistive.default",color:r,children:[(0,n.jsx)(R.Rm,{team:t}),"\xa0-\xa0",(0,n.jsx)(l.A,{id:"wickets"})]})]})}function M(e){let{leftColor:t,rightColor:r}=e,[i,s]=(0,o.useState)(!1),c=(0,_.A)(),{leftTeam:d,rightTeam:u}=(0,o.useContext)(x.y$);return(0,n.jsx)(a.AM,{closeOnOutsideClick:!0,controls:[i,s],children:(0,n.jsxs)(a.AM.Content,{w:"312px",right:[-8,0,-20,0],elevation:3,children:[(0,n.jsx)(a.EY,{as:"div",color:"onSurface.nLv1",font:"display.large",children:(0,n.jsx)(l.A,{id:"cricket_runs_per_over_graph"})}),(0,n.jsx)(a.EY,{as:"div",color:"onSurface.nLv1",font:"body.mediumParagraph",mt:"sm",children:(0,n.jsx)(l.A,{id:"cricket_runs_per_over_info_text"})}),(0,n.jsxs)(a.az,{mt:"lg",children:[(0,n.jsx)(a.EY,{as:"div",mx:"43px",color:"onSurface.nLv3",font:"assistive.default",children:(0,n.jsx)(l.A,{id:"runs"})}),(0,n.jsxs)(a.so,{children:[(0,n.jsx)(a.az,{h:"160px",w:"172px",children:(0,n.jsx)(a._V,{src:"/static/images/performance-graph/runs-per-over-graphic.svg",alt:c.formatMessage({id:"cricket_runs_per_over_graph"}),w:"172",h:"160"})}),(0,n.jsxs)(a.az,{mt:"36px",overflow:"hidden",children:[(0,n.jsx)(a.EY,{as:"div",font:"assistive.default",color:t,ellipsis:!0,children:(0,n.jsx)(R.Rm,{team:d})}),(0,n.jsx)(a.EY,{as:"div",font:"assistive.default",color:r,ellipsis:!0,children:(0,n.jsx)(R.Rm,{team:u})})]})]}),(0,n.jsx)(a.EY,{as:"div",mx:"62px",color:"onSurface.nLv3",font:"assistive.default",children:(0,n.jsx)(l.A,{id:"cricket.overs"})})]}),(0,n.jsx)(E,{team:d,color:t,mt:"lg"}),(0,n.jsx)(E,{team:u,color:r,mt:"sm"}),(0,n.jsx)(a.so,{mt:"xl",h:"36px",justify:"flex-end",children:(0,n.jsx)(a.$n,{h:"36px",w:"77px",variant:"unshielded",onClick:()=>s(!1),children:(0,n.jsx)(l.A,{id:"close_window_button"})})})]})})}var C=r(14352),X=r(9127);function A(e){let{x:t,direction:r}=e,i=(0,c.useTheme)(),s=(0,C.s)(),a=(0,o.useRef)(!0);return(0,o.useEffect)(()=>{(async()=>{await s.start({translateX:t-r.initialX,opacity:1},{duration:a.current?.7:.25,delay:.15*!!a.current})})().catch(),a.current=!1},[t]),(0,n.jsxs)(X.m.g,{animate:s,initial:{opacity:.5},children:[(0,n.jsx)("line",{y1:3,y2:160,x1:r.initialX,x2:r.initialX,stroke:i.colors.error.default}),(0,n.jsx)("circle",{cx:r.initialX,cy:0,stroke:i.colors.error.default,strokeWidth:2,r:3,fill:"none"})]})}function O(e){let{color:t,team:r}=e;return(0,n.jsxs)(a.so,{h:"24px",align:"center",gap:"sm",px:"lg",children:[(0,n.jsx)(a.az,{h:"4px",w:"16px",bg:t}),(0,n.jsx)(a.EY,{font:"assistive.default",color:"onSurface.nLv3",children:(0,n.jsx)(R.Rm,{team:r})})]})}function S(e){let{data:t,stroke:r}=e,{svgPath:i}=t,s=(0,C.s)();return(0,o.useEffect)(()=>{(async()=>{await s.start({pathLength:1,opacity:1,d:i},{duration:1,delay:.15,type:"spring",bounce:0})})().catch()},[i]),(0,n.jsx)(X.m.path,{strokeWidth:2,stroke:r,fill:"none",initial:{pathLength:0,opacity:.5},animate:s})}let I=c.default.text.withConfig({componentId:"sc-4d136ea8-0"})(["font:",";text-anchor:middle;"],e=>e.theme.typography.font.table.micro);function N(e){let{w:t,stroke:r}=e,i="top"===t.position?-6:12;return t.num>1?(0,n.jsx)(I,{x:t.x,y:Number(t.y)+i,stroke:r,children:t.num}):null}function Y(e){let{w:t,color:r,perc:i}=e,s=(0,c.useTheme)();return(0,n.jsxs)(X.m.g,{initial:{opacity:0,transitionDuration:"0.4s"},animate:{opacity:1},transition:{delay:Number(t.x)/i/500},children:[(0,n.jsx)(X.m.circle,{cx:t.x,cy:t.y,stroke:r,strokeWidth:2,r:3,fill:s.colors.surface.s1}),(0,n.jsx)(N,{w:t,stroke:r})]},t.over)}function z(e){let{data:t,color:r,xMaxPerc:i}=e,{wickets:s}=t;return(null==s?void 0:s.length)&&0!==i?(0,n.jsx)(n.Fragment,{children:s.map(e=>(0,n.jsx)(Y,{w:e,color:r,perc:i},e.over))}):null}function T(e){let{data:t,inningNumber:r,svgWidth:s}=e,a=y(t),l=b(s),x=(0,c.useTheme)(),d=w(t.overs,{precision:a,direction:l},t.liveOver),[u,h]=[x.colors.secondary.default,x.colors.primary.default],[f,m]=[t.teamMaxOver[i.cxP.Left]/a.x.max,t.teamMaxOver[i.cxP.Right]/a.x.max];return(0,n.jsxs)("svg",{height:"100%",width:"100%",viewBox:l.viewBox,children:[(0,n.jsx)(L,{layout:{precision:a,direction:l}}),(0,n.jsxs)(o.Fragment,{children:[d[i.cxP.Left]&&(0,n.jsx)(S,{data:d[i.cxP.Left],precision:a,stroke:u}),d[i.cxP.Right]&&(0,n.jsx)(S,{data:d[i.cxP.Right],precision:a,stroke:h}),d[i.cxP.Left]&&(0,n.jsx)(z,{data:d[i.cxP.Left],color:u,xMaxPerc:f}),d[i.cxP.Right]&&(0,n.jsx)(z,{data:d[i.cxP.Right],color:h,xMaxPerc:m}),void 0!==d.liveIndicatorX&&(0,n.jsx)(A,{x:d.liveIndicatorX,direction:l})]},r)]})}function B(e){let{incidents:t}=e,r=v(t),i=Object.keys(r).sort((e,t)=>e-t),[c,d]=(0,o.useState)(i[0]),{leftTeam:u,rightTeam:h}=(0,o.useContext)(x.y$),f=(0,o.useRef)(null),[m,p]=(0,o.useState)(void 0);return((0,s.st)(()=>{var e;return p(null==(e=f.current)?void 0:e.getBoundingClientRect().width)}),i.length)?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(a.so,{justify:"space-between",px:"lg",h:"40px",children:[(0,n.jsx)(a.EY,{font:"display.medium",color:"onSurface.nLv1",mt:"14px",children:(0,n.jsx)(l.A,{id:"cricket_runs_per_over"})}),(0,n.jsx)(a.az,{h:"24px",w:"24px",mt:"lg",children:(0,n.jsx)(M,{leftColor:"secondary.default",rightColor:"primary.default"})})]}),(0,n.jsx)(a.tU,{variant:"tertiary",initialValue:c,onChange:e=>d(e),children:(0,n.jsx)(a.tU.List,{scroll:!0,h:"48px",px:"lg",w:"100%",children:i.map(e=>(0,n.jsx)(a.tU.Tab,{tabKey:e,hoverBg:"surface.s2",children:(0,n.jsx)(l.A,{id:"cricket_ordinal_innings",values:{n:e}})},e))})}),(0,n.jsx)(a.az,{ref:f,h:220,w:"100%",children:m&&(0,n.jsx)(T,{data:r[c],inningNumber:c,svgWidth:m})}),(0,n.jsx)(O,{team:u,color:"secondary.default"}),(0,n.jsx)(O,{team:h,color:"primary.default"})]}):null}}}]);