1"use strict";(self.webpackChunkweb=self.webpackChunkweb||[]).push([[541],{93092(e,t,o){o.r(t),o.d(t,{LeaderboardPage:()=>Se});var r=o(50016),n=o(33651),a=o(25694),i=o(61449),l=o(1948),s=o(11750),d=o(44296),c=o(15546),u=o(73272),m=o(26444),p=o(43633),g=o(7214),y=o(29038),v=o(82880),f=o(66776),b=o(57417),h=o(67284),C=o(94807);const x=e=>(t,o,r,n)=>{const a=r>0?n[r-1]:void 0;if(void 0===a||a.data.player.s>o.data.player.s){const n=e.shift();n&&t.push({type:"level",id:`level-${r}`,props:{...n,id:`level-${r}`,compStatus:v.ClientStatus.OPEN,score:o.data.player.s,onPress:()=>{}}})}return t.push(o),t},S=e=>{let t=(e=[...e].reverse()).length-1;return(o,r,n,a)=>{const i=n>0?a[n-1]:void 0;if((void 0===i||i.data.player.s>r.data.player.s)&&r.data.player.s<=t)for(;t>=r.data.player.s;t--)o.push({type:"level",id:`level-${n}-${t}`,props:{...e[t],id:`level-${n}-${t}`,score:t,compStatus:v.ClientStatus.OPEN,onPress:()=>{}}}),r.data.player.s!==t&&o.push({type:"empty",id:`empty-${n}-${t}`,props:{message:"Nobody has reached this level... yet."}});return o.push(r),o}};var L=o(22513),j=o(44277),A=o(1841),w=o(77429),k=o(90076);const F=e=>(0,k.jsx)(w.j,{style:[I.container,e.style],labelStyle:I.label,disabledStyle:I.disabled,disabled:e.disabled,label:"Find Me",icon:(0,k.jsx)(A.e,{highlightWidth:0,imageUrl:e.imageUrl,size:24}),iconStyle:I.iconStyle,iconSpacingOnRight:!1,onPress:e.onPress}),I=y.A.create({container:{height:36,borderRadius:8,paddingRight:12,paddingLeft:12,backgroundColor:b.nE,alignSelf:"baseline"},disabled:{opacity:.6},label:{fontFamily:b.Ov,fontSize:16,color:b.Ze},iconStyle:{marginRight:8}});var P=o(55108),R=o(59457),E=o(23028),M=o(20203);const T=e=>{var t,o;const{onUserPress:n}=e,a=null!==(t=e.isMultiGame)&&void 0!==t&&t,i=(0,r.useCallback)((()=>{n&&n(!0)}),[n]),l=(0,r.useCallback)((()=>{n&&n(!1)}),[n]);return(0,k.jsxs)(m.A,{style:[O.container,e.style],children:[e.useFindMeState?(0,k.jsx)(F,{style:O.findMe,imageUrl:e.userImageUrl,onPress:i}):(0,k.jsx)(j.A,{onPress:l,children:(0,k.jsx)(A.e,{style:O.avatar,imageUrl:e.userImageUrl,size:36})}),(0,k.jsxs)(m.A,{style:O.detailsContainer,children:[a?(0,k.jsx)(g.A,{style:O.multiGameStatus,numberOfLines:1,ellipsizeMode:"tail",children:null!==(o=e.multiGameStatusLabel)&&void 0!==o?o:"Your Ranking"}):(0,k.jsx)(m.A,{style:O.statusContainer,children:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(P.c,{style:O.statusBadge,label:"LIVE"}),(0,k.jsx)(R.l,{correctCount:e.correctCount,incorrectCount:e.incorrectCount,pendingCount:e.pendingCount})]})}),(0,k.jsxs)(g.A,{style:O.playersCount,children:[e.userPosition," of ",e.totalPlayers]})]}),a?(0,k.jsx)(M.k,{size:"large",score:e.userScore}):(0,k.jsx)(E.$,{score:e.userScore})]})},O=y.A.create({container:{flexDirection:"row",alignItems:"flex-start",paddingHorizontal:16,paddingTop:24,backgroundColor:b.bL,pointerEvents:"box-none"},findMe:{marginLeft:0},avatar:{marginLeft:16},detailsContainer:{pointerEvents:"none",flexGrow:1,marginLeft:16},statusContainer:{pointerEvents:"none",flexDirection:"row",alignItems:"center"},statusBadge:{marginRight:8,marginTop:2},playersCount:{marginTop:2,fontFamily:b.kh,fontSize:14,color:b.Z7},multiGameStatus:{fontFamily:b.kh,fontSize:14,color:b.Z7,textTransform:"capitalize"}});var z=o(57218),D=o(66057),U=o(31661),_=o(82872);const G=e=>(0,k.jsx)(g.A,{style:[N.container,e.style],children:e.title}),N=y.A.create({container:{flexGrow:1,width:"100%",color:b.DO,fontFamily:b.UR,fontSize:b.Dh,textAlign:"center",userSelect:"none",pointerEvents:"none"}}),H=e=>{const{primaryColor:t}=e,o=(0,f.getColorConfiguration)(t),n=(0,r.useMemo)((()=>$(e.appPlatform,e.safeAreaTopPadding)),[e.appPlatform,e.safeAreaTopPadding]),a=B(e.leaderboard);return(0,k.jsxs)(_.d,{containerStyle:n.container,media:a.media,backgroundColor:o.leaderboardHeaderBackground,MediaComponent:e.MediaComponent,children:[(0,k.jsx)(U.d,{liveScore:e.liveScore,style:n.liveScore}),(0,k.jsx)(G,{style:n.title,title:a.name}),(0,k.jsx)(g.A,{style:n.info,children:a.caption}),e.onRules&&(0,k.jsx)(D.t,{style:n.button,size:"medium",label:a.buttonLabel,onPress:e.onRules})]})},$=(e,t)=>y.A.create({container:{alignItems:"center",paddingBottom:24},liveScore:{position:"absolute",top:null!==t&&void 0!==t?t:0,marginTop:14,marginBottom:16,paddingLeft:e===z.AppPlatform.ANDROID?96:72,paddingRight:104+(e===z.AppPlatform.ANDROID?96:72)},title:{flexGrow:0,marginTop:8,marginBottom:16},info:{color:b.Ze,fontFamily:b.Ov,textAlign:"center",fontSize:b.Tr,marginBottom:16,userSelect:"none",pointerEvents:"none"},button:{flexGrow:0,backgroundColor:b._j}}),B=e=>{var t;let o;var r,n;return e.prizes.length>0?(o=e.prizes[0],{name:e.name,media:o.media,caption:null!==(r=null!==(n=o.media.caption)&&void 0!==n?n:e.media.caption)&&void 0!==r?r:"",buttonLabel:"string"===typeof o.details?o.details:"Prize, rules & more"}):{name:e.name,media:e.media,caption:null!==(t=e.media.caption)&&void 0!==t?t:"",buttonLabel:e.type===s.LeaderboardType.CHANCER?"How does ranking work?":"Game rules & more"}};var V=o(43055),Z=o(57440),W=o(78200),Q=o(81210);const Y=e=>{const{id:t,color:o,onPress:n}=e,a=(0,r.useCallback)((()=>{n(t)}),[t,n]),i=(0,r.useMemo)((()=>o?{backgroundColor:o}:void 0),[o]);return(0,k.jsx)(j.A,{style:[q.container,e.style,i],onPress:a,children:(0,k.jsxs)(m.A,{style:q.copyContainer,children:[(0,k.jsx)(g.A,{style:q.label,numberOfLines:1,ellipsizeMode:"tail",children:e.title}),(0,k.jsx)(g.A,{style:q.description,children:(0,W.getLeaderboardLevelDescription)(e.compStatus,e.details)})]})})},q=y.A.create({container:{minHeight:64,alignItems:"center",backgroundColor:"#FFFFFF33",paddingVertical:(0,Q.V)(10,{ios:12}),paddingLeft:32,paddingRight:16,flexDirection:"row"},copyContainer:{flex:1,flexDirection:"column"},label:{fontFamily:b.UR,color:b.DO,fontSize:16},thresholdDescription:{fontFamily:b.mF,color:b.Ze,fontSize:14},description:{fontFamily:b.mF,color:b.Z7,fontSize:14}}),J=e=>(0,k.jsx)(m.A,{style:[K.container,e.style],children:(0,k.jsx)(g.A,{style:K.description,children:e.message})}),K=y.A.create({container:{flexDirection:"column",minHeight:64,alignItems:"center",justifyContent:"center",backgroundColor:"#FFFFFF33",paddingLeft:32,paddingRight:16},description:{color:b.Z7,fontFamily:b.Ov,fontSize:14}}),X=e=>{var t,o,n,a,i,l,c,y,j,A;
1const{user:w,users:F,vendor:I,isMultiGame:P,isLeadersLoading:R,leaderboardConfig:E,isLeaderboardConfigLoading:M,leaderboardListData:O,leaderboardComps:z,usersResults:D,onTrackSelectContent:U,onCompSelected:_,onUserSelected:G}=e,N=(0,r.useRef)(new u.A.Value(0)).current,$=(0,r.useRef)(),B=null!==(t=null===w||void 0===w?void 0:w.id)&&void 0!==t?t:null,W=null!==(o=null===(n=z[z.length-1])||void 0===n?void 0:n.summary.logo)&&void 0!==o?o:{},Q=null!==(a=null===(i=z[z.length-1])||void 0===i?void 0:i.summary.primaryColor)&&void 0!==a?a:b.hO,q=(0,f.getColorConfiguration)(Q),[K,X]=(0,r.useState)(0),{listData:te,userItem:oe}=((e,t,o,n)=>{const[a,i]=(0,r.useState)(null),[l,d]=(0,r.useState)([]),[c,u]=(0,r.useState)([]);return(0,r.useEffect)((()=>{let t=o;if(void 0!==n){const e=(0,h.filter)(t.map((e=>e.data.player)),(e=>n.includes(e.u)));t=t.filter((e=>n.includes(e.data.player.u))).map(((t,o)=>{const r=e.find((e=>e.u===t.data.player.u));return t.type,{...t,data:(0,C.assertType)({...t.data,player:r,winner:!0===t.data.player.w,position:o+1})}}))}var r;i(e&&null!==(r=t.find((t=>t.data.player.u===e)))&&void 0!==r?r:null),d(t)}),[o,e,n]),(0,r.useEffect)((()=>{if(t&&t.levels&&t.levels.length>0){const e=[...t.levels],o=l.reduce(t.type===s.LeaderboardType.INGAME?x(e):S(e),[]);u(o)}else u(l)}),[l,t]),{listData:c,userItem:a}})(B,E,O,F),re=(0,r.useMemo)((()=>D.reduce(((e,t,o)=>(t===v.QuestionResolutionStatus.CORRECT?e.correct++:t===v.QuestionResolutionStatus.INCORRECT?e.incorrect++:e.open++,e)),{correct:0,incorrect:0,open:0})),[D]),ne=e.topMargin+50,ae=Math.max(K-ne,0);let ie=N.interpolate({inputRange:[0,ae],outputRange:[0,-ae],extrapolate:"clamp"}),le=N.interpolate({inputRange:[0,ae+100],outputRange:[1,0],extrapolate:"clamp"});const se=(0,r.useMemo)((()=>{let e=0;return z.length>0&&P&&(e+=100),w&&oe&&(e+=60),{height:e}}),[P,z,w,oe]),de=null===(l=e.leaderboardConfig)||void 0===l||null===(c=l.type)||void 0===c?void 0:c.startsWith("allstar_");return(0,k.jsxs)(m.A,{style:[ee.container,e.style],children:[!R&&e.leaderboardListData.length>0?(0,k.jsx)(u.A.FlatList,{ref:$,scrollEventThrottle:1,ListHeaderComponent:(0,k.jsx)(u.A.View,{style:{opacity:le},children:(0,k.jsxs)(m.A,{style:se,children:[z.length>0&&P?(0,k.jsx)(L.O,{style:ee.gamesList,competitions:z,enableHighlight:!1,display:"mini",onSelected:_}):null,w&&oe&&(0,k.jsx)(T,{style:ee.userScoreHeader,userImageUrl:null===(y=w.media)||void 0===y||null===(j=y.image)||void 0===j?void 0:j.url,correctCount:re.correct,incorrectCount:re.incorrect,pendingCount:re.open,isMultiGame:P,multiGameStatusLabel:`${I} ranking`,totalPlayers:te.length,userPosition:oe.data.position,userScore:de?null!==(A=oe.data.player.t)&&void 0!==A?A:0:oe.data.player.s,useFindMeState:!0,onUserPress:()=>{if(U("vendor_leaderboard_screen_find_me"),B&&oe){var e;const t=te.findIndex((e=>e.id===B));null===(e=$.current)||void 0===e||e.scrollToIndex({animated:!0,index:t})}}})]})}),style:ee.leadersList,data:te,keyExtractor:e=>e.id,getItemLayout:(e,t)=>({length:Z.a,offset:Z.a*t,index:t}),scrollIndicatorInsets:{right:1},contentContainerStyle:{paddingTop:K},onScroll:u.A.event([{nativeEvent:{contentOffset:{y:N}}}],{useNativeDriver:!0}),renderItem:e=>"ingame"===e.item.type?(0,k.jsx)(V.C,{...e.item.data,colorConfig:q,onPress:G},e.item.id):"multigame"===e.item.type?(0,k.jsx)(Z.z,{...e.item.data,colorConfig:q,onPress:G},e.item.id):"level"===e.item.type?(0,k.jsx)(Y,{...e.item.props,color:q.color},e.item.id):"empty"===e.item.type?(0,k.jsx)(J,{...e.item.props},e.item.id):null}):R?(0,k.jsx)(p.A,{style:{marginTop:K+50},size:"large",color:b.DO}):(0,k.jsxs)(g.A,{style:[ee.errorCopy,{marginTop:K+50}],numberOfLines:2,children:["We have had a problem loading this leaderboard.","\n","Please try again shortly."]}),(0,k.jsx)(u.A.View,{pointerEvents:"box-none",onLayout:e=>{X(e.nativeEvent.layout.height)},style:[ee.leaderboardHeaderContainer,{transform:[{translateY:ie}]}],children:(0,k.jsx)(m.A,{style:ee.blackContainer,pointerEvents:"box-none",children:(0,k.jsx)(u.A.View,{style:[ee.fadingHeader,{opacity:le}],pointerEvents:"box-none",children:null!==E&&!M&&(0,k.jsx)(H,{logo:W,primaryColor:q.color,leaderboard:E,MediaComponent:e.MediaComponent,liveScore:P||1!==z.length?void 0:z[0].summary.liveScore,onRules:()=>{e.leaderboardConfig&&(U("vendor_leaderboard_screen_find_out_more"),e.onAddOverlay((0,d.getLeaderboardDetail
1sOverlay)(e.leaderboardConfig)))}})})})})]})},ee=y.A.create({container:{flex:1,flexDirection:"column",alignItems:"center",backgroundColor:b.bL},blackContainer:{backgroundColor:b.bL},errorCopy:{textAlign:"center",fontFamily:b.kh,fontSize:14,color:b.DO},leaderboardHeaderContainer:{position:"absolute",width:"100%"},fadingHeader:{backgroundColor:b.bL},userScoreHeader:{paddingTop:0},leadersList:{width:"100%",backgroundColor:b.bL},gamesList:{marginTop:8,marginHorizontal:8,backgroundColor:b.bL}});var te=o(64327),oe=o(56667),re=o(78682),ne=o(78598),ae=o(6580),ie=o(38671),le=o(57610);const se=(0,oe.createSelector)(l.getUser,ae.getLeaderboardConfig,ae.getCompetitionLeaderboardRequest,ae.getCompetitionLeaderboard,i.getFilteredCompSummariesAndEntries,l.getUserIsFollowingAsMap,re.getConfig,((e,t,o,r,n,a,i)=>{if(!o||!t||!r)return[];const l=r.leaders.some((e=>e.s>0)),d=(0,le.getUserByIdStream)(i.gameUrl);if(t.type===s.LeaderboardType.INGAME){const t=n.find((e=>e.summary.id===o));if(!t)return[];const i=(0,W.getCompetitionClientStatus)(t.summary.starts,t.summary.status);return r.leaders.map((e=>te.WT.Cast(s.TLeader,e))).map(((o,r)=>({type:"ingame",id:o.u,data:{position:r+1,player:o,isFollowing:!0===a[o.u],compStatus:i,compVendor:t.summary.vendor,showScoreInPrelive:l,isCurrentUser:o.u===(null===e||void 0===e?void 0:e.id),user:o.u===(null===e||void 0===e?void 0:e.id)?e:null,winner:!0===o.w,isSummary:!1,getUserById:d}})))}return r.leaders.map((e=>te.WT.Cast(s.TMultiGameLeader,e))).map(((o,r)=>({type:"multigame",id:o.u,data:{type:t.type,position:r+1,player:o,average:o.n>0?Math.round(100*(o.t/o.n+Number.EPSILON))/100:0,isFollowing:!0===a[o.u],currentUser:o.u===(null===e||void 0===e?void 0:e.id)?e:null,winner:!0===o.w,getUserById:d}})))})),de=(0,oe.createSelector)(ae.getLeaderboardConfig,i.getFilteredCompSummariesAndEntries,((e,t)=>t.filter((t=>null===e||void 0===e?void 0:e.comps.find((e=>t.summary.id===e)))).sort(((e,t)=>e.summary.starts.seconds-t.summary.starts.seconds)))),ce=(0,oe.createSelector)(ae.getLeaderboardConfig,i.getFilteredCompSummariesAndEntries,ie.getVendorCompCounts,ie.getVendorQuestions,ne.getGroupCompCounts,ne.getGroupQuestions,((e,t,o,r,n,a)=>{var i,l;if(!e||e.type!==s.LeaderboardType.INGAME)return[];const d=e.id,c=t.find((e=>e.summary.id===d));if(!c)return[];const u=null!==(i=null===r||void 0===r?void 0:r[c.summary.id])&&void 0!==i?i:null===a||void 0===a?void 0:a[c.summary.id],m=null!==(l=null===o||void 0===o?void 0:o[d])&&void 0!==l?l:null===n||void 0===n?void 0:n[d];return u&&m?(0,W.usersCompetitionResults)(c.entry,m,c.summary.status,u):[]}));var ue=o(96239),me=o(13403),pe=o(97206),ge=o(96720),ye=o(58665),ve=o(47192),fe=o(9101),be=o(62296),he=o(17116);const Ce=new be.Parser,xe=e=>{const t=Ce.parse((0,he.yD)(!1,e.leaderboard,e.config.appUrl,e.config.cdnUrl,`${window.location.pathname}${window.location.search}`,e.config.facebookConfig.appId,e.config.appleAppStoreId,e.config.package,e.config.appName,e.config.appLaunchProtocol,e.config.environment));return(0,k.jsx)(fe.mg,{children:t})},Se=e=>{var t;console.log("LeaderboardScreen");const o=(0,n.wA)(),u=(0,me.Zp)(),{leaderboardId:m}=(0,me.g)(),p=(0,n.d4)(i.getFilteredCompSummariesAndEntries),g=(0,n.d4)(ge.z),y=p.find((e=>e.summary.leaderboards.find((e=>e.id===m)))),v=null===y||void 0===y?void 0:y.summary.leaderboards.find((e=>e.id===m)),f=null===y||void 0===y?void 0:y.vendor,b=(null===v||void 0===v?void 0:v.type)!==s.LeaderboardType.INGAME,{isLeadersLoading:h,leaderboardConfig:C,isLeaderboardConfigLoading:x}=(0,c.ZL)(null!==m&&void 0!==m?m:"",b,!0),S=(0,n.d4)(de),L=(0,n.d4)(l.getUser),j=(0,n.d4)(se),A=(0,n.d4)(ce),w=(0,r.useCallback)((e=>o((0,a.addOverlay)(e))),[o]),F=(0,r.useCallback)((e=>{(0,pe.d4)("vendor_leaderboard_screen_comp_tile"),u({pathname:`/${e.summary.vendor}/${e.summary.key}`,search:window.location.search})}),[u]),I=(0,r.useCallback)((e=>{var t;(0,pe.d4)("vendor_leaderboard_screen_user_selected"),w((0,d.getPlayerProfileOverlay)(e,null!==(t=null===f||void 0===f?void 0:f.vendor)&&void 0!==t?t:""))}),[f,w]);return(0,k.jsxs)(ve.L,{children:[C?(0,k.jsx)(xe,{config:g,leaderboard:C}):null,y?(0,k.jsx)(X,{...e,style:Le.container,topMargin:50,user:L,users:void 0,vendor:null!==(t=null===f||void 0===f?void 0:f.vendor)&&void 0!==t?t:"",isMultiGame:b,isLeadersLoading:h,leaderboardConfig:C,isLeaderboardConfigLoading:x,leaderboardListData:j,leaderboardComps:S,usersResults:A,onAddOverlay:w,MediaComponent:ye.U,onTrackSelectContent:pe.d4,onCompSelected:F,onUserSelected:I}):(0,k.jsx)("div",{style:{height:"100vh",width:"100vw",color:"white"},children:"No leaderboard"}),(0,k.jsx)("div",{className:"leaderboard-page__top-icons-container",children:(0,k.jsx)("div",{className:"leaderboard-page__back-container",children:(0,k.jsx)("div",{className:"leaderboard-page__back",onClick:()=>{u.length>1?u(-1):u({pathname:"/",search:window.location.search})},children:(0,k.jsx)(ue.mj,{})})})})]})},Le={container:{height:"100%"}}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.