(self.webpackChunk=self.webpackChunk||[]).push([[9454],{79454:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>m});var n=r(12139),o=r(56747),s=r(77984),i=r(58059),a=r(82762),d=r(58061),l=r(16575),u=r(10042),c=r(80787),v=r(97717),p=r(44955),g=r(56753);const m=function(){var e,t;(0,d.TK)();const r=(0,d.qM)()("_LIVE_NOW"),[m,b]=(0,n.eJ)(),[I,f,k]=(0,d.CU)(!0,a.LoaderMode.Skeleton),[T,h]=(0,n.eJ)(),{name:S,providerId:E}=T||{},y=(0,o.UO)(),O=(0,o.k6)(),V=(null==y?void 0:y.sportName)&&`/${y[0]}/${y.sportName}`,N=(0,v.W)();(0,d.jr)(S?`${r} | ${S}`:r);const{eventsBySports:C,changeMarketHandler:L,restore:M,selectedMarket:U,showMarketSelector:Z,loading:w}=(0,c.Z)({history:O,selectedSport:T,setSelectedSport:h,sports:m,targetUri:V});return(0,n.d4)((()=>{if(N.isLoaded){const e=i.JA.getSports({mode:k.current,connector:f}).pipe((0,s.U)((e=>(N.enableStreamingTV&&e[0].providerId!==u.w.providerId&&e.unshift(u.w),e)))).subscribe(b);return()=>e.unsubscribe()}}),[N]),(null==T?void 0:T.providerId)===u.w.providerId?(0,g.tZ)(u.R,{eventsBySports:C,isLoading:!E||I||w}):(0,g.tZ)(l.OY,{showMarketSelector:Z,matches:{categories:null==C||null==(e=C[0])?void 0:e.categories,markets:null==C||null==(t=C[0])?void 0:t.markets},sportRef:E,onOddsClick:e=>{(0,p.Ul)(Object.assign({},e,{type:a.BetType.LIVE,sportId:E}))},onMarketChange:L,selectedMarket:U,isLoading:!E||I||w,noEventsMessageKey:"LIVE.NONE",restore:M,isLive:!0})}},10042:(e,t,r)=>{"use strict";r.d(t,{R:()=>N,w:()=>V});var n=r(82762),o=r(35104),s=r(58061),i=r(16575),a=r(85782),d=r(44955),l=r(46062),u=r.n(l),c=r(44036),v=r.n(c),p=r(96793),g=r.n(p),m=r(17892),b=r.n(m),I=r(11173),f=r.n(I),k=r(42464),T=r.n(k),h=r(57090),S=r.n(h),E={};E.styleTagTransform=T(),E.setAttributes=b(),E.insert=g().bind(null,"head"),E.domAPI=v(),E.insertStyleElement=f(),u()(S(),E),S()&&S().locals&&S().locals;var y=r(56753);const O=(0,a.dG)("premierbet-tv"),V={name:o.NZ.tv.name,mediaItemId:"tv-icon",providerId:n.SportProviderId.TV,targetUri:o.NZ.tv.targetUri,tabs:[],modules:[]},N=({eventsBySports:e,isLoading:t})=>{var r,l,u;const{isLoaded:c,layout:v}=(0,s.$Y)(),p=(null==v||null==(r=v.sportRibbon)?void 0:r.inPlay)||[];return(null==(l=(0,s.aF)().user)||null==(u=l.account)?void 0:u.id)?c&&e.length?(0,y.tZ)("div",{className:O("sports"),children:e.map((e=>{const{categories:r,markets:o}=e,s=null==o?void 0:o[0],{name:l}=p.find((0,a.TY)({providerId:e.sportId}));return(0,y.tZ)(i.OY,{showMarketSelector:!1,matches:{categories:r,markets:o},sportRef:e.sportId,onOddsClick:t=>{(0,d.Ul)(Object.assign({},t,{type:n.BetType.LIVE,sportId:e.sportId}))},isLoading:t,selectedMarket:s,restore:!0,isLive:!0,title:l},e.sportId)}))}):(0,y.tZ)(i.$J,{messageKey:"TV.NONE",params:{name:o.NZ.tv.name}}):(0,y.tZ)("div",{className:O("unlogged"),children:(0,y.tZ)(i.vN,{tkey:"TV.LOGIN_MESSAGE",name:o.NZ.tv.name})})}},80787:(e,t,r)=>{"use strict";r.d(t,{Z:()=>c});var n=r(12139),o=r(58059),s=r(82762),i=r(58061),a=r(96e3),d=r(85782),l=r(72709),u=r(25846);const c=({history:e,selectedSport:t,setSelectedSport:r,sports:c,targetUri:v,pageId:p,isModule:g,providerId:m,eventsNumber:b})=>{var I,f,k;const[T,h]=(0,n.eJ)([]),[S,E]=(0,n.eJ)(null),[y,O]=(0,n.eJ)(!1),[V,N]=(0,n.eJ)(!1),C=(0,n.sO)(null),[L,M]=(0,n.eJ)(),[U,Z]=(0,n.eJ)(),[w,P]=(0,n.eJ)([]),_=(0,n.sO)({}),[J,R]=(0,n.eJ)(null),Y=(0,n.sO)(null),{userLanguage:$}=(0,n.qp)(a.AZ),{id:j}=L||{id:null},{providerId:A}=U||{providerId:null},x=null==(I=(0,i.aF)().user)||null==(f=I.account)?void 0:f.id,B=()=>{const{sport:e,market:t}=_.current;r(e),Z(e),E(t||null),M(t||null),O(!0),R(null),Y.current=null,C.current=null},F=(e=!0)=>(O(!1),N(e),o.jV.getLiveEvents({locale:$,sportId:A,marketId:j,pageId:p},A===s.SportProviderId.TV).subscribe({next:e=>{var t;const n=null==(t=e.data[0])?void 0:t.markets[0];if(N(!1),h(e.data),r(U),E(L||n||null),C.current=n||null,A===s.SportProviderId.TV&&(Y.current=e.data.filter((e=>e.markets[0])).map((e=>({sportId:e.sportId,marketId:e.markets[0].id})))),R(null),b){const t=e.data.reduce(((e,t)=>[...e,...K(t.categories)]),[]);P(t)}},error:B})),K=e=>e.reduce(((e,t)=>(t.competitions.forEach((t=>{t.events.forEach((t=>e.push(t.id)))})),e)),[]);return(0,n.d4)((()=>{if((v||m)&&c){let r;_.current.sport=t,_.current.market=L,M(void 0),r=g?c.find((e=>e.providerId===m)):c.find((0,d.TY)({targetUri:v})),r?(Z(r),R(null),Y.current=null,C.current=null):g||e.replace(s.APP_ROUTES.live)}else h([]),M(void 0),Z(void 0),R(null),E(null),Y.current=null,C.current=null}),[v,c,m]),(0,n.d4)((()=>{if(null!==J){if(0!==J){const e=F(!1);return()=>e.unsubscribe()}h([])}}),[J]),(0,n.d4)((()=>{if(null!=U&&U.providerId&&(x||(null==U?void 0:U.providerId)!==s.SportProviderId.TV)){const e=F();return()=>e.unsubscribe()}x||(null==U?void 0:U.providerId)!==s.SportProviderId.TV||(h([]),r(U),Y.current=null)}),[$,j,null==U?void 0:U.providerId,x]),T.forEach((e=>{(0,l._A)(e.categories)})),(0,u.w)({sportId:null==t?void 0:t.providerId,marketId:(null==S?void 0:S.id)||(null==(k=C.current)?void 0:k.id),setStateFunction:h,pageType:u._.Inplay,hasEvents:!!T,eventIds:b?w:null,onSportEventsCountChange:R,TVsports:Y.current,eventsNumber:b,onReconnected:()=>F(!1)}),{showMarketSelector:!!S||!!C.current,eventsBySports:T,selectedMarket:S||C.current,changeMarketHandler:e=>{e.id!==(null==L?void 0:L.id)&&(_.current.market=L,M(e))},restore:y,loading:V}}},97717:(e,t,r)=>{"use strict";r.d(t,{W:()=>c});var n=r(12139),o=r(64763),s=r(82762),i=r(35104),a=r(85573);const d={enableStreamingTV:i.NZ.tv.enabled},l={enableStreamingTV:{type:o.FeatureConfigurationsDataType.Boolean}},u=(0,a._i)({fallbackConfig:d,validations:l}),c=()=>{const[e,t]=(0,n.eJ)(Object.assign({},d,{isLoaded:!1}));return(0,n.d4)((()=>{const e=a.PK.getKey(s.FeatureToggleKeys.LiveSportsConfig,{validator:u}).subscribe({next:e=>{t(Object.assign({},e.composedConfig,{isLoaded:!0}))},error:()=>{t((e=>Object.assign({},e,{isLoaded:!0})))}});return()=>e.unsubscribe()}),[]),e}},25846:(e,t,r)=>{"use strict";r.d(t,{_:()=>l,w:()=>c});var n=r(12139),o=r(82762),s=r(35104),i=r(58061),a=r(85782);function d(e,t){return void 0!==t.marketCount&&e.marketCount!==t.marketCount&&(e.marketCount=t.marketCount,!0)}let l;!function(e){e.Inplay="Inplay",e.VirtualSport="VirtualSport",e.VirtualRacing="VirtualRacing"}(l||(l={}));const u="v1"===s.NZ.apiVersion;function c({sportId:e,marketId:t,setStateFunction:r,pageType:s,hasEvents:c,eventIds:v,onSportEventsCountChange:p,TVsports:g,eventsNumber:m,onReconnected:b}){const[I,f]=(0,n.eJ)(null),k=(0,i.bx)(b);function T(e){const t=t=>{const r={EVENT_UPDATE:h,MARKET_UPDATE:S,SCORE_UPDATE:E}[e.type];let n=!1;return r&&t&&(n=r(e,t)),n};switch(s){case l.Inplay:r((r=>{const n=function(e,t){const{competitionId:r,eventId:n}=e;for(const e of t)for(const t of e.categories){const e=t.competitions||[];if(r){const t=e.find((0,a.TY)({id:r})),o=null==t?void 0:t.events.find((0,a.TY)({id:n}));if(o)return o}for(let t=0;t<e.length;++t){const r=e[t].events.find((0,a.TY)({id:n}));if(r)return r}}return null}(e,r);return t(n)?[...r]:r}));break;case l.VirtualSport:r((r=>{const n=function(e,t){const{eventId:r}=e,n=t.groupedEvents.map((e=>e.events.find((0,a.TY)({id:r}))));return n&&n[0]}(e,r);return t(n)?Object.assign({},r):r}));break;case l.VirtualRacing:r((r=>{const n=function(e,t){const{eventId:r}=e;return t.find((0,a.TY)({id:r}))}(e,r);return t(n)?[...r]:r}))}}function h(e,t){const r=e.data;let n=!1;return n=d(t,e),t.state!==r.state&&(t.state=r.state,n=!0),n}function S(e,t){var r;const n=e.data,o=t.markets.find((0,a.TY)({id:n.id}));if(!o)return console.warn(`NOT FOUND MARKET e.id:${t.id} m.ids: ${t.markets.map((e=>e.id)).join(",")}; update: m.id:${n.id}`),!1;let s=!1;return s=d(t,e),o.active!==n.active&&(o.active=n.active,s=!0),o.state!==n.state&&(o.state=n.state,s=!0),null==(r=n.outcomes)||r.forEach((e=>{const r=o.outcomes.find(u?(0,a.TY)({id:e.id}):(0,a.TY)({entityId:e.entityId}));var n;r?(u?(void 0!==e.change&&r.change!==e.change&&(r.change=e.change,s=!0),r.value!==e.value&&(r.value=null!=(n=e.value)?n:null,s=!0)):void 0!==e.value&&r.value!==e.value&&(r.change=Number(e.value)-Number(r.value),r.value=e.value,s=!0),void 0!==e.priceId&&r.priceId!==e.priceId&&(r.priceId=e.priceId,s=!0),r.active!==e.active&&(r.active=e.active,s=!0)):console.warn(`NOT FOUND OUTCOME e.id:${t.id} m.id: ${o.id} o.id: ${o.outcomes.map((e=>e.id)).join(",")}; update: o.id:${e[u?"id":"entityId"]}`)})),s}function E(e,t){const r=e.data,n=t.scoreboard;let o=!1;return o=d(t,e),Object.keys(r).some((e=>r[e]!==n[e]))&&(t.scoreboard=Object.assign({},t.scoreboard,r),o=!0),o}(0,n.d4)((()=>{if(e&&c){let r;return f(null),g?r=k.sportTVSubscription({sports:g}).subscribe(T):t&&e!==o.SportProviderId.TV&&(r=v?k.eventListSubscription(v,t).subscribe(T):k.sportSubscription(e,t).subscribe(T)),()=>{var e;return null==(e=r)?void 0:e.unsubscribe()}}}),[e,t,s,c,v,g]),(0,n.d4)((()=>{if(e){let t;return t=e===o.SportProviderId.TV?k.liveEventsCountSubscription().subscribe((e=>{var t;p&&p(null!=(t=e.data.premierBetTvEventsCount)?t:0)})):k.sportEventsIdsSubscription(e).subscribe((e=>{f(e.data.eventIds)})),()=>t.unsubscribe()}}),[e]),(0,n.d4)((()=>{p&&I&&(v?function(e,t,r){if(r&&e.length<r&&e.length<t.length)return!0;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!0;return!1}(v,I,m)&&p(I.length):p(I.length))}),[I,v])}},57090:e=>{e.exports=[[e.id,".premierbet-tv__unlogged{padding:32px 16px;font-size:14px;text-align:center}.premierbet-tv__sports .events-module:first-child .page-header{border-top:none}","",""]]}}]);