(self.webpackChunk=self.webpackChunk||[]).push([[1995],{25846:(e,t,n)=>{"use strict";n.d(t,{_:()=>u,w:()=>p});var i=n(12139),r=n(94953),o=n(99054),l=n(82762),s=n(35104),a=n(58061),d=n(85782);function c(e,t){return void 0!==t.marketCount&&e.marketCount!==t.marketCount&&(e.marketCount=t.marketCount,!0)}let u;!function(e){e.Inplay="Inplay",e.VirtualSport="VirtualSport",e.VirtualRacing="VirtualRacing"}(u||(u={}));const v="v1"===s.NZ.apiVersion;function p({sportId:e,sportZoomId:t,marketId:n,setStateFunction:s,pageType:p,hasEvents:m,eventIds:g,onSportEventsCountChange:h,TVsports:f,eventsNumber:b,onReconnected:I,sportsEventsIds:T}){const[y,k]=(0,i.eJ)(null),E=(0,a.bx)(I);function S(e){const t=t=>{const n={EVENT_UPDATE:Z,MARKET_UPDATE:N,SCORE_UPDATE:_}[e.type];let i=!1;return n&&t&&(i=n(e,t)),i};switch(p){case u.Inplay:s((n=>{const i=function(e,t){const{competitionId:n,eventId:i}=e;for(const e of t)for(const t of e.categories){const e=t.competitions||[];if(n){const t=e.find((0,d.TY)({id:n})),r=null==t?void 0:t.events.find((0,d.TY)({id:i}));if(r)return r}for(let t=0;t<e.length;++t){const n=e[t].events.find((0,d.TY)({id:i}));if(n)return n}}return null}(e,n);return t(i)?[...n]:n}));break;case u.VirtualSport:s((n=>{const i=function(e,t){const{eventId:n}=e,i=t.groupedEvents.map((e=>e.events.find((0,d.TY)({id:n}))));return i&&i[0]}(e,n);return t(i)?Object.assign({},n):n}));break;case u.VirtualRacing:s((n=>{const i=function(e,t){const{eventId:n}=e;return t.find((0,d.TY)({id:n}))}(e,n);return t(i)?[...n]:n}))}}function Z(e,t){const n=e.data;let i=!1;return i=c(t,e),t.state!==n.state&&(t.state=n.state,i=!0),i}function N(e,t){var n;const i=e.data,r=t.markets.find((0,d.TY)({id:i.id}));if(!r)return console.warn(`NOT FOUND MARKET e.id:${t.id} m.ids: ${t.markets.map((e=>e.id)).join(",")}; update: m.id:${i.id}`),!1;let o=!1;return o=c(t,e),r.active!==i.active&&(r.active=i.active,o=!0),r.state!==i.state&&(r.state=i.state,o=!0),null==(n=i.outcomes)||n.forEach((e=>{const n=r.outcomes.find(v?(0,d.TY)({id:e.id}):(0,d.TY)({entityId:e.entityId}));var i;n?(v?(void 0!==e.change&&n.change!==e.change&&(n.change=e.change,o=!0),n.value!==e.value&&(n.value=null!=(i=e.value)?i:null,o=!0)):void 0!==e.value&&n.value!==e.value&&(n.change=Number(e.value)-Number(n.value),n.value=e.value,o=!0),void 0!==e.priceId&&n.priceId!==e.priceId&&(n.priceId=e.priceId,o=!0),n.active!==e.active&&(n.active=e.active,o=!0)):console.warn(`NOT FOUND OUTCOME e.id:${t.id} m.id: ${r.id} o.id: ${r.outcomes.map((e=>e.id)).join(",")}; update: o.id:${e[v?"id":"entityId"]}`)})),o}function _(e,t){const n=e.data,i=t.scoreboard;let r=!1;return r=c(t,e),Object.keys(n).some((e=>n[e]!==i[e]))&&(t.scoreboard=Object.assign({},t.scoreboard,n),r=!0),r}(0,i.d4)((()=>{if(e&&m){let i;if(k(null),f)i=E.sportTVSubscription({sports:f}).subscribe(S);else if(n&&e!==l.SportProviderId.TV)if(g)i=E.eventListSubscription(g,n).subscribe(S);else{const o=[E.sportSubscription(e,n)];t&&o.push(E.sportSubscription(t,n)),i=(0,r.T)(...o).subscribe(S)}return()=>{var e;return null==(e=i)?void 0:e.unsubscribe()}}}),[e,n,p,m,g,f]),(0,i.d4)((()=>{if(e){let n;if(e===l.SportProviderId.TV)n=E.liveEventsCountSubscription().subscribe((e=>{var t;h&&h(null!=(t=e.data.premierBetTvEventsCount)?t:0)}));else{const i=[E.sportEventsIdsSubscription(e).pipe((0,o.h)((t=>t.sportId===e)))];t&&i.push(E.sportEventsIdsSubscription(t).pipe((0,o.h)((e=>e.sportId===t)))),n=(0,r.T)(...i).subscribe((n=>{let i=[];var r,o;n.sportId===e&&(i=[...n.data.eventIds,...null!=(r=null==T?void 0:T[t])?r:[]]),n.sportId===t&&(i=[...null!=(o=null==T?void 0:T[e])?o:[],...n.data.eventIds]),k(i)}))}return()=>n.unsubscribe()}}),[e]),(0,i.d4)((()=>{h&&y&&(g?function(e,t,n){if(n&&e.length<n&&e.length<t.length)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!0;return!1}(g,y,b)&&h(y.length):h(y.length))}),[y,g])}},81995:(e,t,n)=>{"use strict";n.r(t),n.d(t,{VirtualsPage:()=>ne,default:()=>ie});var i=n(12139),r=n(56747),o=n(58059),l=n(82762),s=n(58061),a=n(96e3),d=n(16575),c=n(85782),u=n(72709),v=n(44955),p=n(25846),m=n(85573),g=n(46062),h=n.n(g),f=n(44036),b=n.n(f),I=n(96793),T=n.n(I),y=n(17892),k=n.n(y),E=n(11173),S=n.n(E),Z=n(42464),N=n.n(Z),_=n(49283),x=n.n(_),A={};A.styleTagTransform=N(),A.setAttributes=k(),A.insert=T().bind(null,"head"),A.domAPI=b(),A.insertStyleElement=S(),h()(x(),A),x()&&x().locals&&x().locals;var U=n(56753);const O="virtual-rules",V=(0,c.dG)(O),C=function(){return(0,U.tZ)("div",{className:O,children:(0,U.BX)("div",{className:V("button"),onClick:()=>m.PT.open(l.ModalType.VirtualRules),children:[(0,U.tZ)(d.le,{className:V("icon"),name:"info-menu"}),(0,U.tZ)(d.vN,{tkey:"VIRTUAL.RULES"})]})})};var P=n(35104),R=n(26197),L=n.n(R),$={};$.styleTagTransform=N(),$.setAttributes=k(),$.insert=T().bind(null,"head"),$.domAPI=b(),$.insertStyleElement=S(),h()(L(),$),L()&&L().locals&&L().locals;const w="virtual-silk",M=(0,c.dG)(w),J=function({name:e,defaultPath:t}){const{userLanguage:n}=(0,i.qp)(a.AZ),[r,o]=(0,i.eJ)(`${P.NZ.cmsApiEndpoint}/images/media-items/${n}/${e}`),l=()=>{o(`${P.NZ.cmsApiEndpoint}${t}`)};return e||l(),(0,U.tZ)("div",{className:w,children:(0,U.tZ)("img",{src:r,onError:l,className:M("image")})})};var B=n(90496),j=n.n(B),D={};D.styleTagTransform=N(),D.setAttributes=k(),D.insert=T().bind(null,"head"),D.domAPI=b(),D.insertStyleElement=S(),h()(j(),D),j()&&j().locals&&j().locals;const Y=function({streamingUrl:e,isLoading:t}){return(0,U.tZ)(d.Od,{visible:t,type:l.SkeletonType.Stream,autoHeight:!0,children:!t&&e&&(0,U.tZ)("div",{className:"virtual-stream",children:(0,U.tZ)("iframe",{src:e,allowFullScreen:!0})})})};var X=n(69704),H=n.n(X),F={};F.styleTagTransform=N(),F.setAttributes=k(),F.insert=T().bind(null,"head"),F.domAPI=b(),F.insertStyleElement=S(),h()(H(),F),H()&&H().locals&&H().locals;const K="virtual-racing",z=(0,c.dG)(K),G=function({virtual:e}){var t;(0,s.TK)();const[n,r]=(0,i.eJ)(),[a,m]=(0,i.eJ)(),[g,h]=(0,i.eJ)(),[f,b,I]=(0,s.CU)(!0,l.LoaderMode.Skeleton);(0,p.w)({sportId:"VIRTUAL",marketId:null==a?void 0:a.markets[0].name,setStateFunction:r,pageType:p._.VirtualRacing,hasEvents:!!a}),(0,i.d4)((()=>{const t=e.competitions[0];h(t);const n=o.jV.getVirtualEvents({competitionId:t.competitionId},{mode:I.current,connector:b}).subscribe((({data:e})=>{var t,n;const i=(null==e||null==(t=e.categories[0])||null==(n=t.competitions[0])?void 0:n.events)||[];r(i),m(i[0])}));return()=>n.unsubscribe()}),[e]),(0,i.d4)((()=>{if("COMPLETED"===(null==a?void 0:a.state)){const e=n.slice(1);r(e),m(e[0])}}),[null==a?void 0:a.state]),(0,i.d4)((()=>{const e=null==n?void 0:n.filter((e=>"COMPLETED"!==e.state));null!=n&&n.length&&n.length!==e.length&&r(e)}),[n]);const T=e=>{(0,v.Ul)({type:l.BetType.PRE_MATCH,event:a,market:a.markets[0],outcome:e,competitionId:g.competitionId,sportId:"VIRTUAL"})};null==n||n.forEach(u.se);const y=null==a?void 0:a.eventNames.join(" - ");return(0,U.BX)("div",{className:K,children:[(0,U.tZ)(Y,{streamingUrl:null==g?void 0:g.streamingUrl,isLoading:f}),(0,U.tZ)(d.Od,{visible:!n&&f,type:l.SkeletonType.Selector,fixedHeight:38,children:n&&(0,U.tZ)(d.cO,{options:n,selected:a,onChange:e=>m(e),type:"eventTime"})}),(0,U.tZ)(d.Od,{visible:f,type:l.SkeletonType.RacingEventsModule,children:a?(0,U.BX)("div",{className:z("event"),children:[(0,U.BX)("div",{className:z("event-header"),children:[(0,U.tZ)("div",{className:z("event-name"),children:y}),(0,U.BX)("div",{className:z("event-details"),children:[(0,U.tZ)("div",{className:z("event-time"),children:`${a.formattedDate} | ${a.formattedTime}`}),(0,U.tZ)(C,{})]})]}),(0,U.tZ)("div",{className:z("event-outcomes"),children:null==a||null==(t=a.markets[0])?void 0:t.outcomes.map((t=>{var n;const i=!(null!=t&&t.active),r=!(null!=a&&null!=(n=a.markets[0])&&n.active),o=i||r;return(0,U.BX)("div",{className:(0,c.O5)(z("event-outcome"),{selected:t.selected,suspended:o}),onClick:()=>!o&&T(t),children:[(0,U.tZ)(J,{name:t.silk,defaultPath:e.defaultSilkUri}),(0,U.tZ)("div",{className:"event__outcome-name",children:t.name}),(0,U.tZ)(d.uD,{id:t.entityId||t.id,value:t.value,selected:null==t?void 0:t.selected,suspended:o,onClick:()=>T(t)})]},null==t?void 0:t.priceId)}))})]}):(0,U.tZ)(d.$J,{messageKey:"VIRTUAL.NO_EVENTS"})})]})};var q=n(12335),Q=n(45038),W=n.n(Q),ee={};ee.styleTagTransform=N(),ee.setAttributes=k(),ee.insert=T().bind(null,"head"),ee.domAPI=b(),ee.insertStyleElement=S(),h()(W(),ee),W()&&W().locals&&W().locals;const te=function({virtual:e}){var t;(0,s.TK)();const[n,r]=(0,i.eJ)(),[a,c]=(0,i.eJ)(),[g,h]=(0,i.eJ)(null),[f,b]=(0,i.eJ)(),[I,T]=(0,i.eJ)(),[y,k,E]=(0,s.CU)(!0,l.LoaderMode.Skeleton),[S,Z]=(0,i.eJ)(!1),[N,_]=(0,i.eJ)(10),x=(0,s.VP)({limit:10});(0,p.w)({sportId:"VIRTUAL",marketId:null==g?void 0:g.id,setStateFunction:r,pageType:p._.VirtualSport,hasEvents:!!n}),(0,i.d4)((()=>{null!=n&&n.groupedEvents&&r((e=>{let t=!1;return e.groupedEvents.forEach((e=>{const n=e.events.findIndex((e=>"COMPLETED"===e.state));n>=0?(e.events.splice(n,1),t=!0):t=!1})),t&&e.groupedEvents.some((e=>!e.events.length))&&O({limit:N}),t?Object.assign({},e):e}))}),[n]),(0,i.d4)((()=>{const t=e.competitions[0],n=t.competitionId;b(t),T(n),c(e.competitions);const i=x.pipe((0,q.w)((t=>{var i;return E.current=t.limit?l.LoaderMode.Skeleton:l.LoaderMode.Spinner,o.jV.getGroupedVirtualEvents({competitionId:t.competitionId||n,limit:t.limit,marketId:null==e||null==(i=e.markets[0])?void 0:i.id},{mode:E.current,connector:k})}))).subscribe(A);return()=>i.unsubscribe()}),[e]);const A=t=>{var n,i;r(null==t||null==(n=t.data)||null==(i=n.categories[0])?void 0:i.competitions[0]),h(null==e?void 0:e.markets[0]),Z(null==t?void 0:t.pagination.hasMore)},O=({limit:e=N,competitionId:t=I})=>{e!==N&&_(e),T(t),x.next({limit:e,competitionId:t})},V=(e,t,n)=>{(0,v.Ul)({type:l.BetType.PRE_MATCH,event:e,market:t,outcome:n,competitionId:I,sportId:"VIRTUAL"})},P=e=>{m.PT.open(l.ModalType.VirtualSportEDP,{eventId:e.id,mainMarketIds:e.markets[0].id})};return(0,u._p)(n),(0,U.BX)("div",{className:"virtual-sport",children:[(0,U.tZ)(Y,{streamingUrl:null==f?void 0:f.streamingUrl,isLoading:y}),(0,U.tZ)(d.Od,{visible:y,fixedHeight:38,type:l.SkeletonType.Selector,children:!(null==a||!a.length)&&(0,U.BX)(U.HY,{children:[(0,U.tZ)("hr",{className:"horizontal-line"}),(0,U.tZ)(d.cO,{options:a,selected:{competitionId:I},onChange:t=>{b(e.competitions.find((e=>e.competitionId===t.competitionId))),O({limit:10,competitionId:t.competitionId})},type:"virtual-sports"}),(0,U.tZ)("hr",{className:"horizontal-line"})]})}),(0,U.tZ)(d.Od,{visible:y,type:l.SkeletonType.LeagueMatches,children:null!=n&&null!=(t=n.groupedEvents)&&t.length?(0,U.BX)(U.HY,{children:[(0,U.tZ)(C,{}),n.groupedEvents.map((e=>(0,U.tZ)(d.Lj,{title:e.formattedDate,events:e.events,market:g,onEventClick:P,onOddsClick:V},e.date))),S&&(0,U.tZ)(d.og,{onClick:()=>O({limit:null})})]}):!y&&!n&&(0,U.tZ)(d.$J,{messageKey:"VIRTUAL.NO_EVENTS"})})]})};function ne(){const e=(0,r.k6)(),t=(0,i.qp)(a.AZ),n=(0,r.UO)(),[c,u]=(0,i.eJ)(null),[v,p,m]=(0,s.CU)(!0,l.LoaderMode.Skeleton),[g]=(0,i.eJ)(0),[h,f]=(0,i.eJ)();(0,i.d4)((()=>{const e=o.JA.getVirtuals({mode:m.current,connector:p}).subscribe(u);return()=>e.unsubscribe()}),[t.userLanguage]),(0,i.d4)((()=>{if(null!=c&&c.length)if(n.sportName){const t=c.find((e=>e.targetUri.indexOf(n.sportName)>-1));t?f(t):e.replace(`${l.APP_ROUTES.virtuals}${c[0].targetUri}`)}else e.replace(`${l.APP_ROUTES.virtuals}${c[0].targetUri}`)}),[null==n?void 0:n.sportName,c]);const b=(0,i.Ye)((()=>null==c?void 0:c.map((e=>(0,U.tZ)(d.O9,{item:e,appRoute:l.APP_ROUTES.virtuals},e.targetUri)))),[c]);if(h)return(0,U.BX)("div",{className:"virtuals",children:[(0,U.tZ)(d.Od,{visible:v,type:l.SkeletonType.LiveSportsRibbon,children:(0,U.tZ)(d.rf,{selectedIndex:g,children:b})}),"RACING"===(null==h?void 0:h.type)?(0,U.tZ)(G,{virtual:h}):(0,U.tZ)(te,{virtual:h})]})}const ie=ne},69704:e=>{e.exports=[[e.id,".virtual-racing__event-outcome{display:flex;border-bottom:1px solid var(--color-secondary-background);align-items:center;padding-left:16px}.virtual-racing__event-outcome--selected{background-color:var(--color-selected)}.virtual-racing__event-outcome--selected .odds-button__price{color:var(--color-primary-text)}.virtual-racing__event-outcome--suspended{background-color:var(--color-secondary-background)}.virtual-racing__event-header{padding:16px;border-bottom:1px solid var(--color-secondary-background);border-top:1px solid var(--color-secondary-background)}.virtual-racing__event-name{font-size:28px;font-weight:700;line-height:32px}.virtual-racing__event-time{color:var(--color-neutral-520)}.virtual-racing__event-details{display:flex;justify-content:space-between;align-items:center;font-size:12px;line-height:16px}.virtual-racing .odds-button{width:80px;height:47px;border-left:none;margin-left:auto}","",""]]},49283:e=>{e.exports=[[e.id,".virtual-rules{display:flex}.virtual-rules__button{display:flex;align-items:center;margin-left:auto;font-weight:700;color:var(--color-neutral-520);font-size:12px;cursor:pointer}.virtual-rules__icon{fill:var(--color-primary-text);height:16px;width:16px;margin-right:5px}","",""]]},26197:e=>{e.exports=[[e.id,".virtual-silk__image{width:35px;margin-right:10px}","",""]]},45038:e=>{e.exports=[[e.id,".virtual-sport .virtual-rules{justify-content:flex-end;margin:6px 16px}","",""]]},90496:e=>{e.exports=[[e.id,".virtual-stream{width:100%;padding-bottom:56.25%;position:relative}.virtual-stream iframe{position:absolute;height:100%;width:0;min-width:100%}","",""]]}}]);