@streamlayer/react 0.32.10 → 0.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),i=require("./index4.js"),L=require("@nanostores/react"),b=require("./masters2.js"),f=require("@streamlayer/sdk-web-types"),T=require("react"),ge=require("./index3.js");require("react-countup");const Oe=require("react-countdown-circle-timer"),E=require("./index2.js");require("@streamlayer/sdk-web-interfaces");require("@streamlayer/sdk-web-notifications");require("./useStreamLayerApp.js");require("@streamlayer/sdk-web");const be=i.styled_default("div")({name:"Container",class:"c1vwopgc",propsAsIs:!1}),_e=i.styled_default("div")({name:"QuestionTypeWrap",class:"qyktpt0",propsAsIs:!1}),ke=()=>i.o1,Ce=i.styled_default(ke())({name:"QuestionTypeIcon",class:"q951jdx",propsAsIs:!0}),we=i.styled_default("span")({name:"QuestionTypeTitle",class:"qss5f0e",propsAsIs:!1}),Ee=i.styled_default("button")({name:"CloseButton",class:"c1ao1jtv",propsAsIs:!1}),Le=()=>i.o1,Qe=i.styled_default(Le())({name:"CloseIcon",class:"cvsl7l3",propsAsIs:!0}),ve=({type:e,close:s,label:n})=>{const o=e?b.o[e]:{label:n,iconName:void 0};return t.jsxs(be,{children:[t.jsxs(_e,{children:[(o==null?void 0:o.iconName)&&t.jsx(Ce,{"data-type-trivia":e===f.QuestionType.TRIVIA,"data-type-poll":e===f.QuestionType.POLL,name:o.iconName}),(o==null?void 0:o.label)&&t.jsx(we,{children:o.label})]}),t.jsx(Ee,{onClick:s,children:t.jsx(Qe,{name:"icon-cross"})})]})},Me=e=>e.split(/\s+/).map(s=>s[0]).join("").toUpperCase(),Te=e=>e?e.toLocaleString("en-US"):"0",se=e=>e.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"}),ne=e=>e.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),ie=e=>!isNaN(e.getTime()),Re=i.styled_default("div")({name:"Container",class:"c1zy8a",propsAsIs:!1}),$e=i.styled_default("div")({name:"Title",class:"t1vih9p5",propsAsIs:!1}),qe=i.styled_default("div")({name:"Indicator",class:"i1fbnvpb",propsAsIs:!1}),le=({indicator:e,title:s})=>t.jsxs(Re,{children:[t.jsx($e,{children:s}),t.jsx(qe,{children:e})]}),Ue=i.styled_default("div")({name:"Container",class:"ctmhwyc",propsAsIs:!1}),Pe=i.styled_default("div")({name:"Indicator",class:"i1jri200",propsAsIs:!1}),Ye=i.styled_default("div")({name:"Title",class:"t8s05oq",propsAsIs:!1}),V=({indicator:e,title:s})=>t.jsxs(Ue,{children:[t.jsx(Pe,{children:e}),t.jsx(Ye,{children:s})]}),Ve=i.styled_default("div")({name:"Container",class:"c1yrpn9o",propsAsIs:!1}),We=i.styled_default("div")({name:"TopInfo",class:"t17fwahh",propsAsIs:!1}),Fe=i.styled_default("div")({name:"BottomInfo",class:"by6w7e9",propsAsIs:!1}),Be=i.styled_default("div")({name:"User",class:"u1g7arbm",propsAsIs:!1}),He=i.styled_default("img")({name:"Avatar",class:"a1ldeata",propsAsIs:!1}),Ge=i.styled_default("div")({name:"UserInfo",class:"u10d4koz",propsAsIs:!1}),Ze=i.styled_default("div")({name:"UserName",class:"u1q6roj0",propsAsIs:!1}),Je=i.styled_default("div")({name:"UserRating",class:"ui0m425",propsAsIs:!1}),Ke=i.styled_default("img")({name:"TrophyIcon",class:"t1el3mrn",propsAsIs:!1}),Xe=i.styled_default("div")({name:"Rts",class:"r2vgnxv",propsAsIs:!1}),et=i.styled_default("div")({name:"RtsIndicator",class:"roqn06j",propsAsIs:!1}),tt=i.styled_default("div")({name:"RtsLabel",class:"r15adx7c",propsAsIs:!1}),st=i.styled_default("div")({name:"Divider",class:"dv59lta",propsAsIs:!1}),nt=i.styled_default("div")({name:"Ranks",class:"r55lotb",propsAsIs:!1}),it=i.styled_default("div")({name:"Statistics",class:"s1knfgqt",propsAsIs:!1}),ot=i.styled_default("div")({name:"AvatarPlaceholder",class:"a1mqo824",propsAsIs:!1}),rt=i.styled_default("button")({name:"UserAccountBtn",class:"uxareh6",propsAsIs:!1}),at="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgaWQ9IlRyb3BoeSI+CjxwYXRoIGlkPSJDb21iaW5lZCBTaGFwZSIgZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0zLjY5MTk3IDQuNjY2NjJDMy42OTE5NyA1Ljk5NzA1IDMuOTI5MTQgNy4xNzc4NyA0LjQwMzUgOC4yMDkxMkMzLjQ5OTY2IDguMDI0NTEgMi43NDQ4NyA3LjY2NDg2IDIuMTM5MSA3LjEzMDE0QzEuNTMzMzMgNi41OTU0MiAxLjIzMDQ2IDYuMDc5OCAxLjIzMDQ2IDUuNTgzMjhWNC42NjY2MkgzLjY5MTk3Wk0xNC43Njg2IDQuNjY2NjJWNS41ODMyOEMxNC43Njg2IDYuMDc5OCAxNC40NjU4IDYuNTk1NDIgMTMuODYgNy4xMzAxNEMxMy4yNTQyIDcuNjY0ODYgMTIuNDk5NCA4LjAyNDUxIDExLjU5NTYgOC4yMDkxMkMxMi4wNjk5IDcuMTc3ODcgMTIuMzA3MSA1Ljk5NzA1IDEyLjMwNzEgNC42NjY2MkgxNC43Njg2Wk0xNS45OTk4IDUuNTgzMjlWNC4zNjEwOEMxNS45OTk4IDQuMTA2NDUgMTUuOTEwMSAzLjg5MDAyIDE1LjczMDYgMy43MTE3OEMxNS41NTExIDMuNTMzNTQgMTUuMzMzMiAzLjQ0NDQyIDE1LjA3NjggMy40NDQ0MkgxMi4zMDc2VjIuNTI3NzZDMTIuMzA3NiAyLjEwNzYzIDEyLjE1NjkgMS43NDc5NyAxMS44NTU2IDEuNDQ4NzhDMTEuNTU0NCAxLjE0OTU5IDExLjE5MjIgMSAxMC43NjkxIDFINS4yMzA3MkM0LjgwNzY0IDEgNC40NDU0NyAxLjE0OTU5IDQuMTQ0MTkgMS40NDg3OEMzLjg0MjkxIDEuNzQ3OTcgMy42OTIyNyAyLjEwNzYzIDMuNjkyMjcgMi41Mjc3NlYzLjQ0NDQySDAuOTIzMDY4QzAuNjY2NjU5IDMuNDQ0NDIgMC40NDg3MTQgMy41MzM1NCAwLjI2OTIyOCAzLjcxMTc4QzAuMDg5NzQxOCAzLjg5MDAyIDAgNC4xMDY0NSAwIDQuMzYxMDhWNS41ODMyOUMwIDYuMDM1MjUgMC4xMzMwMSA2LjQ5MDM5IDAuMzk5MDM0IDYuOTQ4NzJDMC42NjUwNTkgNy40MDcwNSAxLjAyNDAzIDcuODIwODIgMS40NzU5NSA4LjE5MDAzQzEuOTI3ODcgOC41NTkyNCAyLjQ4MjM0IDguODY5NTcgMy4xMzkzOSA5LjEyMTAxQzMuNzk2NDQgOS4zNzI0NiA0LjQ4NzEzIDkuNTE0MDkgNS4yMTE0OSA5LjU0NTkyQzUuNDgwNzEgOS44ODk2NyA1Ljc4NTIgMTAuMTkyIDYuMTI0OTQgMTAuNDUzQzYuMzY4NTMgMTAuNjY5NSA2LjUzNjc5IDEwLjkwMDIgNi42Mjk3NCAxMS4xNDUzQzYuNzIyNjkgMTEuMzkwNCA2Ljc2OTE2IDExLjY3NTIgNi43NjkxNiAxMS45OTk5QzYuNzY5MTYgMTIuMzQzNiA2LjY3MTQxIDEyLjYzMzMgNi40NzU5IDEyLjg2ODhDNi4yODAzOCAxMy4xMDQzIDUuOTY3ODkgMTMuMjIyMSA1LjUzODQxIDEzLjIyMjFDNS4wNTc2NCAxMy4yMjIxIDQuNjI5NzYgMTMuMzY2OSA0LjI1NDc2IDEzLjY1NjZDMy44Nzk3NyAxMy45NDYyIDMuNjkyMjcgMTQuMzEwNiAzLjY5MjI3IDE0Ljc0OTlWMTUuMzYxQzMuNjkyMjcgMTUuNDUwMSAzLjcyMTEyIDE1LjUyMzMgMy43Nzg4MSAxNS41ODA2QzMuODM2NSAxNS42Mzc5IDMuOTEwMjIgMTUuNjY2NSAzLjk5OTk2IDE1LjY2NjVIMTEuOTk5OUMxMi4wODk2IDE1LjY2NjUgMTIuMTYzMyAxNS42Mzc5IDEyLjIyMSAxNS41ODA2QzEyLjI3ODcgMTUuNTIzMyAxMi4zMDc2IDE1LjQ1MDEgMTIuMzA3NiAxNS4zNjFWMTQuNzQ5OUMxMi4zMDc2IDE0LjMxMDYgMTIuMTIwMSAxMy45NDYyIDExLjc0NTEgMTMuNjU2NkMxMS4zNzAxIDEzLjM2NjkgMTAuOTQyMiAxMy4yMjIxIDEwLjQ2MTQgMTMuMjIyMUMxMC4wMzE5IDEzLjIyMjEgOS43MTk0NSAxMy4xMDQzIDkuNTIzOTQgMTIuODY4OEM5LjMyODQzIDEyLjYzMzMgOS4yMzA2OCAxMi4zNDM2IDkuMjMwNjggMTEuOTk5OUM5LjIzMDY4IDExLjY3NTIgOS4yNzcxNSAxMS4zOTA0IDkuMzcwMSAxMS4xNDUzQzkuNDYzMDUgMTAuOTAwMiA5LjYzMTMxIDEwLjY2OTUgOS44NzQ5IDEwLjQ1M0MxMC4yMTQ2IDEwLjE5MiAxMC41MTkxIDkuODg5NjcgMTAuNzg4NCA5LjU0NTkyQzExLjUxMjcgOS41MTQwOSAxMi4yMDM0IDkuMzcyNDYgMTIuODYwNCA5LjEyMTAxQzEzLjUxNzUgOC44Njk1NyAxNC4wNzIgOC41NTkyNCAxNC41MjM5IDguMTkwMDNDMTQuOTc1OCA3LjgyMDgyIDE1LjMzNDggNy40MDcwNSAxNS42MDA4IDYuOTQ4NzJDMTUuODY2OCA2LjQ5MDM5IDE1Ljk5OTggNi4wMzUyNSAxNS45OTk4IDUuNTgzMjlaTTYuNzYwNDcgNy4xNzk4TDguMDUxMDkgNi40OTk5N0w5LjM0MTcgNy4xNzk4TDkuMDk1MjEgNS43Mzk4OUwxMC4xMzkzIDQuNzIwMTVMOC42OTYzOSA0LjUxMDA3TDguMDUxMDkgMy4yTDcuNDA1NzggNC41MTAwN0w1Ljk2MjgzIDQuNzIwMTVMNy4wMDY5NiA1LjczOTg5TDYuNzYwNDcgNy4xNzk4WiIgZmlsbD0iI0YyQzk0QyIvPgo8L2c+Cjwvc3ZnPgo=",Ae=({avatar:e,name:s,points:n,friendsRank:o,rank:r,streak:m,correct:d,incorrect:u,inTop:c,successRate:I})=>t.jsxs(Ve,{children:[t.jsx(We,{children:t.jsxs(Be,{children:[t.jsxs(rt,{children:[e&&t.jsx(He,{alt:"avatar",src:e}),!e&&t.jsx(ot,{children:Me(s||"")})]}),t.jsxs(Ge,{children:[t.jsx(Ze,{children:s}),t.jsxs(Je,{children:[t.jsxs(Xe,{children:[t.jsx(Ke,{alt:"rank-icon",src:at}),t.jsxs(et,{children:[Te(n),t.jsx(tt,{children:"PTS"})]})]}),t.jsx(st,{}),t.jsxs("div",{children:["TOP ",c||0,"%"]})]})]})]})}),t.jsxs(Fe,{children:[t.jsxs(nt,{children:[t.jsx(le,{indicator:o||0,title:"Friends rank"}),t.jsx(le,{indicator:r||0,title:"Global rank"})]}),t.jsxs(it,{children:[t.jsx(V,{indicator:m||0,title:"Win streak"}),t.jsx(V,{indicator:d||0,title:"Correct"}),t.jsx(V,{indicator:u||0,title:"Incorrect"}),t.jsx(V,{indicator:`${I||0}%`,title:"Succ. rate"})]})]})]}),lt=i.styled_default("div")({name:"SponsorLogoWrap",class:"s8p5v5z",propsAsIs:!1}),ct=()=>i.o1,dt=i.styled_default(ct())({name:"SponsorLogo",class:"s755yti",propsAsIs:!0}),ut=()=>t.jsx(lt,{children:t.jsx(dt,{name:"mastersLogo"})}),pt=i.styled_default("div")({name:"Container",class:"c38csyt",propsAsIs:!1}),mt=i.styled_default("div")({name:"Title",class:"ty221rx",propsAsIs:!1}),ht=i.styled_default("div")({name:"Description",class:"dlaj9xp",propsAsIs:!1}),ft=({title:e,description:s})=>t.jsxs(pt,{children:[t.jsx(i.o1,{name:"icon-check-circle"}),t.jsx(mt,{children:e}),t.jsx(ht,{children:s})]}),It=i.styled_default("div")({name:"Container",class:"c16sbdnm",propsAsIs:!1}),xt=()=>i.o1,yt=i.styled_default(xt())({name:"IconPrediction",class:"ibhorgl",propsAsIs:!0}),U=i.styled_default("div")({name:"FeedbackIconWrap",class:"f1g20ja7",propsAsIs:!1}),W=i.styled_default("div")({name:"FeedbackHeader",class:"f455ozj",propsAsIs:!1}),jt=i.styled_default("span")({name:"FeedbackTitle",class:"f1913njx",propsAsIs:!1}),R=i.styled_default("span")({name:"FeedbackDescription",class:"fzfk69z",propsAsIs:!1}),J=i.styled_default("div")({name:"FeedbackText",class:"fx87qaj",propsAsIs:!1}),gt=({feedbackMessages:e,questionVotedCorrectly:s,questionVoted:n,questionType:o,hasCorrectAnswer:r,questionStatus:m,showExpiredNotification:d,showClosedNotificationTrivia:u,votedInCurrentRender:c,votedAfterQuestionClosed:I,enteredAnActiveQuestion:v})=>{const N=n&&(o===f.QuestionType.TRIVIA||o===f.QuestionType.PREDICTION)&&c&&m!==f.QuestionStatus.RESOLVED,j=o===f.QuestionType.PREDICTION&&!r,S=m===f.QuestionStatus.RESOLVED&&o===f.QuestionType.PREDICTION&&!n&&!v||o===f.QuestionType.PREDICTION&&I&&c&&v,g=N&&j,a=N&&r,l=n&&o===f.QuestionType.POLL&&c;if(!d&&!u&&!g&&!a&&!S&&!l)return null;const p=s?"correct":"incorrect",h=s?e==null?void 0:e.correctFeedback:e==null?void 0:e.incorrectFeedback;return t.jsxs(It,{"data-isPrediction":j,children:[d&&t.jsxs(t.Fragment,{children:[t.jsx(U,{children:t.jsx(i.o1,{name:"questionExpired"})}),t.jsxs("div",{children:[t.jsx(W,{children:t.jsx(R,{children:"Question Expired"})}),t.jsx(J,{children:"You can still answer to see if you're correct, but no points are awarded for expired questions."})]})]}),u&&t.jsxs(t.Fragment,{children:[t.jsx(U,{children:t.jsx(i.o1,{name:"questionExpired"})}),t.jsxs("div",{children:[t.jsx(W,{children:t.jsx(R,{children:"Question Closed"})}),t.jsx(J,{children:"This question was answered after the moderator closed the question. So the points for this answer won’t tally."})]})]}),S&&t.jsxs(t.Fragment,{children:[t.jsx(U,{children:t.jsx(i.o1,{name:"questionExpired"})}),t.jsxs("div",{children:[t.jsx(W,{children:t.jsx(R,{children:"Question Closed"})}),t.jsx(J,{children:"This event has already taken place, so the ability to make a prediction on its outcome is no longer available."})]})]}),g&&t.jsxs(t.Fragment,{children:[t.jsx(yt,{name:"icon-prediction"}),t.jsx(R,{children:"Stay tuned to see if your prediction was correct."})]}),l&&t.jsxs(t.Fragment,{children:[t.jsx(U,{"data-feedbackType":"correct",children:t.jsx(i.o1,{name:"correct"})}),t.jsx(R,{children:"That's for answering. Please stay tuned for the next question."})]}),a&&t.jsxs(t.Fragment,{children:[t.jsx(U,{"data-feedbackType":p,children:t.jsx(i.o1,{name:p})}),t.jsx("div",{children:t.jsxs(W,{children:[t.jsx(jt,{"data-feedbackType":p,children:h==null?void 0:h.title}),t.jsx(R,{children:h==null?void 0:h.description})]})})]})]})},vt=i.styled_default("div")({name:"Container",class:"c14ielyq",propsAsIs:!1}),Mt=i.styled_default("div")({name:"Content",class:"c1tlqx57",propsAsIs:!1}),Tt=i.styled_default("div")({name:"Title",class:"t1hq58md",propsAsIs:!1}),At=i.styled_default("div")({name:"Options",class:"o1c8nxcx",propsAsIs:!1}),Nt=i.styled_default("button")({name:"ButtonContainer",class:"b1b6dl8t",propsAsIs:!1}),St=i.styled_default("div")({name:"ButtonPct",class:"b4iik8i",propsAsIs:!1}),Dt=i.styled_default("span")({name:"ButtonBody",class:"b1gq1lnf",propsAsIs:!1}),zt=i.styled_default("div")({name:"IconContainer",class:"i1j65z51",propsAsIs:!1}),Ot=i.styled_default("div")({name:"IconWrap",class:"i19tpfua",propsAsIs:!1}),Ne=i.styled_default("img")({name:"Icon",class:"i1tubmma",propsAsIs:!1}),bt=()=>Ne,_t=i.styled_default(bt())({name:"IconDefault",class:"i1grrgwj",propsAsIs:!0}),kt=()=>Ne,Ct=i.styled_default(kt())({name:"IconCircle",class:"ibemyq8",propsAsIs:!0}),wt=i.styled_default("span")({name:"Title",class:"t1dceht",propsAsIs:!1}),Et=i.styled_default("span")({name:"Indicators",class:"i116q4vq",propsAsIs:!1}),Lt=i.styled_default("span")({name:"Percentage",class:"p17ajcu2",propsAsIs:!1}),Qt=()=>i.o1,Rt=i.styled_default(Qt())({name:"CheckIcon",class:"cu9kmlb",propsAsIs:!0}),ce={[f.QuestionImages.CENTERED]:e=>t.jsx(_t,{alt:"option-icon",src:e}),[f.QuestionImages.TRANSPARENT]:e=>t.jsx(zt,{children:t.jsx(Ot,{style:{backgroundImage:`url(${e})`}})}),[f.QuestionImages.ROUNDED]:e=>t.jsx(Ct,{alt:"option-icon",src:e}),[f.QuestionImages.NONE]:()=>null,[f.QuestionImages.UNSET]:()=>null},$t=({questionType:e,hasCorrectAnswer:s,correct:n,youVoted:o,questionVoted:r})=>{if(e===f.QuestionType.POLL&&o)return"correct";if(e===f.QuestionType.PREDICTION){if(s&&r)return o?n?"correct":"incorrect":"unset";if(o)return"correct"}return e===f.QuestionType.TRIVIA&&r&&o?n?"correct":"incorrect":"unset"},qt=({questionType:e,questionVoted:s,correct:n,hasCorrectAnswer:o,questionStatus:r})=>e===f.QuestionType.TRIVIA?s&&n:e===f.QuestionType.PREDICTION?s&&n&&o||r===f.QuestionStatus.RESOLVED&&n:!1,Ut=e=>{var s;const{id:n,icon:o,text:r,percentageDecimal:m,onVote:d,markThatVoted:u,youSelected:c,questionVoted:I,imageMode:v,answerTimeExpired:N,questionStatus:j,isLoading:S,questionType:g,correct:a,hasCorrectAnswer:l,votedAfterQuestionClosed:p,enteredAnActiveQuestion:h}=e,x=$t(e),A=qt({questionType:g,questionVoted:I,correct:a,hasCorrectAnswer:l,questionStatus:j}),y=j===f.QuestionStatus.RESOLVED&&g===f.QuestionType.PREDICTION,M=I||y;return t.jsxs(Nt,{value:n,"data-selected":c,"data-answerState":x,disabled:I||S||N||y&&!h||y&&h&&p,"data-isNotChecked":I&&!c&&x!=="incorrect",onClick:z=>{u(j===f.QuestionStatus.RESOLVED),d(z)},children:[t.jsx(St,{"data-answerState":x,style:{width:`${M?m:0}%`}}),t.jsxs(Dt,{children:[o&&v&&((s=ce[v])==null?void 0:s.call(ce,o)),t.jsx(wt,{children:r}),M&&t.jsxs(Et,{children:[A&&t.jsx(Rt,{name:"selected"}),t.jsx(Lt,{children:t.jsx(ge.d,{value:m,suffix:"%"})})]})]})]})},Pt=[E.E.PRIMARY_GREEN1,E.E.SECONDARY_RED1,E.E.SECONDARY_RED1,E.E.NEUTRALS_GRAY3],Yt=[10,10,1,0],Vt=i.styled_default("div")({name:"RemainingTime",class:"r165427",propsAsIs:!1}),Wt=E.E.SECONDARY_GREEN6,de=E.E.SECONDARY_RED3,Ft=E.E.NEUTRALS_GRAY3,Bt=({isPlaying:e=!0,duration:s=30,onTimerExpired:n})=>{const[o,r]=T.useState(s>10?Wt:de),m=({remainingTime:c})=>t.jsx(Vt,{children:c}),d=T.useCallback(()=>{n==null||n(),r(Ft)},[n,r]),u=T.useCallback(c=>{c===10&&r(de)},[r]);return t.jsx(Oe.CountdownCircleTimer,{isPlaying:e,duration:s,colors:Pt,colorsTime:Yt,size:32,strokeWidth:2,trailStrokeWidth:2,trailColor:o,onComplete:d,onUpdate:u,children:m})},Ht=i.styled_default("div")({name:"WinBarContainer",class:"wie6cqo",propsAsIs:!1}),Gt=i.styled_default("div")({name:"Content",class:"cgizw4u",propsAsIs:!1}),Zt=i.styled_default("div")({name:"Title",class:"t1l3ucjp",propsAsIs:!1}),Jt=()=>i.o1,Kt=i.styled_default(Jt())({name:"WinIcon",class:"wx7j799",propsAsIs:!0}),Xt=i.styled_default("div")({name:"Points",class:"p4lwuj0",propsAsIs:!1}),es=i.styled_default("span")({name:"PointsCount",class:"po9i64o",propsAsIs:!1}),ts=i.styled_default("span")({name:"PointsUnits",class:"pe5g05h",propsAsIs:!1}),ss=({title:e,points:s,isPlayingTimer:n,isTimer:o,questionType:r,timerDuration:m,onTimerExpired:d})=>t.jsxs(Ht,{children:[t.jsxs(Gt,{children:[e&&t.jsx(Zt,{children:e}),s!==void 0&&r!==f.QuestionType.POLL&&t.jsxs(t.Fragment,{children:[t.jsx(Kt,{name:"icon-trophy"}),t.jsxs(Xt,{children:[t.jsx(es,{children:t.jsx(ge.d,{value:s})}),t.jsx(ts,{children:"PTS"})]})]})]}),o&&t.jsx(Bt,{isPlaying:n,onTimerExpired:d,duration:m})]}),ns=({openedQuestion:e,isLoading:s,vote:n,close:o})=>{var r,m;const d=e.subject,u=e.type,c=e.status,I=(r=e.options)==null?void 0:r.options,[v,N]=T.useState(!1),[j,S]=T.useState(!1),[g,a]=T.useState(!0),[l,p]=T.useState(!1),[h,x]=T.useState(""),A=e==null?void 0:e.id;T.useEffect(()=>{c===f.QuestionStatus.RESOLVED&&a(!1)},[]);const y=T.useCallback(O=>{S(O),N(!0)},[]),M=T.useCallback(async O=>{if(A){const w=O.currentTarget.value;x(w),await n(A,w)}},[A,x,n]),z=T.useCallback(()=>{p(!0),setTimeout(o,3e3)},[o]),D=T.useMemo(()=>e==null?void 0:e.answers.find(O=>O.youVoted===!0),[e]),_=T.useMemo(()=>!!(e!=null&&e.answers.find(O=>O.correct===!0)),[e]),k=T.useMemo(()=>e==null?void 0:e.answers.find(O=>O.correct===!0),[e]),Q=T.useMemo(()=>e?e.answers.map(O=>{var w;return{...O,questionVoted:!!D,youSelected:h===O.id,isLoading:s,hasCorrectAnswer:_,questionType:e.type,answerTimeExpired:l,questionStatus:c,imageMode:(w=e.appearance)==null?void 0:w.images,onVote:M}}):[],[_,l,s,e,D,c,M,h]),H=I&&(I.case==="trivia"||I.case==="prediction")?I.value:void 0,C=c===f.QuestionStatus.RESOLVED&&u===f.QuestionType.TRIVIA&&!D&&!g,P=u===f.QuestionType.TRIVIA&&j&&v&&g,G=T.useMemo(()=>{if(!(C||l))return c===f.QuestionStatus.RESOLVED?0:D?D.correct?D.points:0:k==null?void 0:k.points},[l,D,k,c,C]),Z=T.useMemo(()=>C||l?"Time expired":e.type===f.QuestionType.POLL?"Time remaining":D?"You won":"To win",[l,e.type,D,C]),Y=D||C||P||u===f.QuestionType.TRIVIA&&c===f.QuestionStatus.RESOLVED&&g;return t.jsx(b.r,{"data-question-header":"true",children:t.jsx(vt,{children:t.jsxs(Mt,{children:[t.jsx(gt,{feedbackMessages:H,questionVoted:!!D,questionVotedCorrectly:D==null?void 0:D.correct,questionType:u,hasCorrectAnswer:_,questionStatus:c,showExpiredNotification:C,showClosedNotificationTrivia:P,votedInCurrentRender:v,votedAfterQuestionClosed:j,enteredAnActiveQuestion:g}),e.type!==f.QuestionType.PREDICTION&&t.jsx(ss,{title:Z,points:G,onTimerExpired:z,questionType:e.type,isTimer:!s,isPlayingTimer:!D,timerDuration:Y?0:Number(((m=e==null?void 0:e.appearance)==null?void 0:m.autoHideInterval)||"30")}),l?t.jsx(ft,{title:"More to come...",description:"Watch for additional enhanced stream interactive experience."}):t.jsxs(t.Fragment,{children:[t.jsx(Tt,{"data-isPrediction":e.type===f.QuestionType.PREDICTION,children:d}),t.jsx(At,{children:Q.map(O=>t.jsx(Ut,{...O,markThatVoted:y,votedAfterQuestionClosed:j,enteredAnActiveQuestion:g},O.id))})]})]})})})},is=i.styled_default("div")({name:"Container",class:"cgn5uen",propsAsIs:!1}),os=i.styled_default("div")({name:"Content",class:"c1px8nt6",propsAsIs:!1}),rs=i.styled_default("h3")({name:"Title",class:"t5et2jt",propsAsIs:!1}),as=i.styled_default("div")({name:"Description",class:"d1i2kpk2",propsAsIs:!1}),ls=i.styled_default("div")({name:"DateWrap",class:"dd3lh3p",propsAsIs:!1}),cs=i.styled_default("img")({name:"Image",class:"i1gfjeu5",propsAsIs:!1}),Se=({created:e,image:s,title:n,isPickHistory:o,instantView:r})=>{const m=T.useMemo(()=>{if(e){const u=new Date(e);if(ie(u))return{date:se(u),time:ne(u)}}return null},[e]),d=(r==null?void 0:r.image)||s;return t.jsxs(is,{children:[m&&t.jsxs(ls,{children:[m.date," · ",m.time]}),(r==null?void 0:r.video)&&t.jsx(b.w,{source:r.video.url,poster:r.video.thumbnailUrl}),d&&!(r!=null&&r.video)&&t.jsx(cs,{src:d}),t.jsxs(os,{children:[t.jsx(rs,{children:o?n:r==null?void 0:r.heading}),!o&&t.jsx(as,{children:r==null?void 0:r.body})]})]})},ds=i.styled_default("div")({name:"Container",class:"c1euiow",propsAsIs:!1}),us=i.styled_default("a")({name:"WebLinkBtn",class:"w19zie3h",propsAsIs:!1}),ps=({instantView:e,...s})=>t.jsxs(ds,{children:[t.jsx(Se,{instantView:e,...s}),(e==null?void 0:e.webLink)&&t.jsxs(us,{href:e==null?void 0:e.webLink.url,target:"_blank",children:["Explore more of the Masters History",t.jsx(i.o1,{name:"icon-external-link"})]})]}),ms=i.styled_default("div")({name:"Container",class:"c1dcxmvf",propsAsIs:!1}),hs=i.styled_default("div")({name:"DateTime",class:"db4q22c",propsAsIs:!1}),fs=i.styled_default("blockquote")({name:"Quote",class:"q111mmic",propsAsIs:!1}),Is=({created:e,...s})=>{const n=T.useMemo(()=>{if(e){const o=new Date(e);if(ie(o))return{date:se(o),time:ne(o)}}return null},[e]);return t.jsxs(ms,{children:[n&&t.jsxs(hs,{children:[n.date," · ",n.time]}),s.title&&t.jsx(fs,{children:s.title}),t.jsx(b.u,{...s})]})},xs=i.styled_default("div")({name:"QuestionContainer",class:"qdri6g3",propsAsIs:!1}),ys=({openedQuestion:e})=>{var s,n;return((s=e==null?void 0:e.attributes)==null?void 0:s.attributes.case)==="insight"?t.jsx(ps,{created:e.attributes.created,...e.attributes.attributes.value}):((n=e==null?void 0:e.attributes)==null?void 0:n.attributes.case)==="tweet"?t.jsx(Is,{created:e.attributes.created,...e.attributes.attributes.value}):null},js=({extendedQuestion:e,vote:s,close:n})=>{const{loading:o,data:r}=e;return r?t.jsx(ns,{vote:s,close:n,openedQuestion:r,isLoading:!!o}):null},gs=({gamification:e})=>{var s;const n=L.useStore(e.openedQuestion.$store),o=L.useStore(e.openedQuestion.$extendedStore);if(!n)return null;const r=n.type;return t.jsxs(xs,{children:[t.jsx(ve,{close:e.closeQuestion,type:((s=n.attributes)==null?void 0:s.type)||f.QuestionType.UNSET}),r==="question"&&t.jsx(js,{vote:e.submitAnswer,close:e.closeQuestion,extendedQuestion:o}),r!=="question"&&t.jsx(ys,{openedQuestion:n}),t.jsx(ut,{sponsorLogo:""})]})},vs=i.styled_default("div")({name:"Container",class:"c115qtkr",propsAsIs:!1}),Ms=i.styled_default("div")({name:"STabs",class:"sxnslc8",propsAsIs:!1}),Ts=i.styled_default("button")({name:"Button",class:"b1umzux0",propsAsIs:!1}),As=i.styled_default("span")({name:"Title",class:"tspsaas",propsAsIs:!1});var B=(e=>(e.HOME="home",e.LEADERBOARD="leaderboard",e))(B||{});const ue=({title:e,active:s,onClick:n})=>t.jsx(Ts,{onClick:n,"data-selected":s,children:t.jsx(As,{children:e})}),Ns=({activePage:e="home",toggleActivePage:s})=>t.jsx(vs,{children:t.jsxs(Ms,{"data-position":e==="home"?"left":"right",children:[t.jsx(ue,{title:"Home",active:e==="home",onClick:()=>s("home")}),t.jsx(ue,{title:"Leader Board",active:e==="leaderboard",onClick:()=>s("leaderboard")})]})});function ee(){return ee=Object.assign?Object.assign.bind():function(e){for(var s=1;s<arguments.length;s++){var n=arguments[s];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},ee.apply(this,arguments)}function pe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function te(e,s){return te=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,r){return o.__proto__=r,o},te(e,s)}function Ss(e,s){e.prototype=Object.create(s.prototype),e.prototype.constructor=e,te(e,s)}var me=Number.isNaN||function(s){return typeof s=="number"&&s!==s};function Ds(e,s){return!!(e===s||me(e)&&me(s))}function zs(e,s){if(e.length!==s.length)return!1;for(var n=0;n<e.length;n++)if(!Ds(e[n],s[n]))return!1;return!0}function K(e,s){s===void 0&&(s=zs);var n,o=[],r,m=!1;function d(){for(var u=[],c=0;c<arguments.length;c++)u[c]=arguments[c];return m&&n===this&&s(u,o)||(r=e.apply(this,u),m=!0,n=this,o=u),r}return d}var Os=typeof performance=="object"&&typeof performance.now=="function",he=Os?function(){return performance.now()}:function(){return Date.now()};function fe(e){cancelAnimationFrame(e.id)}function bs(e,s){var n=he();function o(){he()-n>=s?e.call(null):r.id=requestAnimationFrame(o)}var r={id:requestAnimationFrame(o)};return r}var X=-1;function Ie(e){if(e===void 0&&(e=!1),X===-1||e){var s=document.createElement("div"),n=s.style;n.width="50px",n.height="50px",n.overflow="scroll",document.body.appendChild(s),X=s.offsetWidth-s.clientWidth,document.body.removeChild(s)}return X}var $=null;function xe(e){if(e===void 0&&(e=!1),$===null||e){var s=document.createElement("div"),n=s.style;n.width="50px",n.height="50px",n.overflow="scroll",n.direction="rtl";var o=document.createElement("div"),r=o.style;return r.width="100px",r.height="100px",s.appendChild(o),document.body.appendChild(s),s.scrollLeft>0?$="positive-descending":(s.scrollLeft=1,s.scrollLeft===0?$="negative":$="positive-ascending"),document.body.removeChild(s),$}return $}var _s=150,ks=function(s,n){return s};function Cs(e){var s,n=e.getItemOffset,o=e.getEstimatedTotalSize,r=e.getItemSize,m=e.getOffsetForIndexAndAlignment,d=e.getStartIndexForOffset,u=e.getStopIndexForStartIndex,c=e.initInstanceProps,I=e.shouldResetStyleCacheOnItemSizeChange,v=e.validateProps;return s=function(N){Ss(j,N);function j(g){var a;return a=N.call(this,g)||this,a._instanceProps=c(a.props,pe(a)),a._outerRef=void 0,a._resetIsScrollingTimeoutId=null,a.state={instance:pe(a),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof a.props.initialScrollOffset=="number"?a.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},a._callOnItemsRendered=void 0,a._callOnItemsRendered=K(function(l,p,h,x){return a.props.onItemsRendered({overscanStartIndex:l,overscanStopIndex:p,visibleStartIndex:h,visibleStopIndex:x})}),a._callOnScroll=void 0,a._callOnScroll=K(function(l,p,h){return a.props.onScroll({scrollDirection:l,scrollOffset:p,scrollUpdateWasRequested:h})}),a._getItemStyle=void 0,a._getItemStyle=function(l){var p=a.props,h=p.direction,x=p.itemSize,A=p.layout,y=a._getItemStyleCache(I&&x,I&&A,I&&h),M;if(y.hasOwnProperty(l))M=y[l];else{var z=n(a.props,l,a._instanceProps),D=r(a.props,l,a._instanceProps),_=h==="horizontal"||A==="horizontal",k=h==="rtl",Q=_?z:0;y[l]=M={position:"absolute",left:k?void 0:Q,right:k?Q:void 0,top:_?0:z,height:_?"100%":D,width:_?D:"100%"}}return M},a._getItemStyleCache=void 0,a._getItemStyleCache=K(function(l,p,h){return{}}),a._onScrollHorizontal=function(l){var p=l.currentTarget,h=p.clientWidth,x=p.scrollLeft,A=p.scrollWidth;a.setState(function(y){if(y.scrollOffset===x)return null;var M=a.props.direction,z=x;if(M==="rtl")switch(xe()){case"negative":z=-x;break;case"positive-descending":z=A-h-x;break}return z=Math.max(0,Math.min(z,A-h)),{isScrolling:!0,scrollDirection:y.scrollOffset<x?"forward":"backward",scrollOffset:z,scrollUpdateWasRequested:!1}},a._resetIsScrollingDebounced)},a._onScrollVertical=function(l){var p=l.currentTarget,h=p.clientHeight,x=p.scrollHeight,A=p.scrollTop;a.setState(function(y){if(y.scrollOffset===A)return null;var M=Math.max(0,Math.min(A,x-h));return{isScrolling:!0,scrollDirection:y.scrollOffset<M?"forward":"backward",scrollOffset:M,scrollUpdateWasRequested:!1}},a._resetIsScrollingDebounced)},a._outerRefSetter=function(l){var p=a.props.outerRef;a._outerRef=l,typeof p=="function"?p(l):p!=null&&typeof p=="object"&&p.hasOwnProperty("current")&&(p.current=l)},a._resetIsScrollingDebounced=function(){a._resetIsScrollingTimeoutId!==null&&fe(a._resetIsScrollingTimeoutId),a._resetIsScrollingTimeoutId=bs(a._resetIsScrolling,_s)},a._resetIsScrolling=function(){a._resetIsScrollingTimeoutId=null,a.setState({isScrolling:!1},function(){a._getItemStyleCache(-1,null)})},a}j.getDerivedStateFromProps=function(a,l){return ws(a,l),v(a),null};var S=j.prototype;return S.scrollTo=function(a){a=Math.max(0,a),this.setState(function(l){return l.scrollOffset===a?null:{scrollDirection:l.scrollOffset<a?"forward":"backward",scrollOffset:a,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},S.scrollToItem=function(a,l){l===void 0&&(l="auto");var p=this.props,h=p.itemCount,x=p.layout,A=this.state.scrollOffset;a=Math.max(0,Math.min(a,h-1));var y=0;if(this._outerRef){var M=this._outerRef;x==="vertical"?y=M.scrollWidth>M.clientWidth?Ie():0:y=M.scrollHeight>M.clientHeight?Ie():0}this.scrollTo(m(this.props,a,l,A,this._instanceProps,y))},S.componentDidMount=function(){var a=this.props,l=a.direction,p=a.initialScrollOffset,h=a.layout;if(typeof p=="number"&&this._outerRef!=null){var x=this._outerRef;l==="horizontal"||h==="horizontal"?x.scrollLeft=p:x.scrollTop=p}this._callPropsCallbacks()},S.componentDidUpdate=function(){var a=this.props,l=a.direction,p=a.layout,h=this.state,x=h.scrollOffset,A=h.scrollUpdateWasRequested;if(A&&this._outerRef!=null){var y=this._outerRef;if(l==="horizontal"||p==="horizontal")if(l==="rtl")switch(xe()){case"negative":y.scrollLeft=-x;break;case"positive-ascending":y.scrollLeft=x;break;default:var M=y.clientWidth,z=y.scrollWidth;y.scrollLeft=z-M-x;break}else y.scrollLeft=x;else y.scrollTop=x}this._callPropsCallbacks()},S.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&fe(this._resetIsScrollingTimeoutId)},S.render=function(){var a=this.props,l=a.children,p=a.className,h=a.direction,x=a.height,A=a.innerRef,y=a.innerElementType,M=a.innerTagName,z=a.itemCount,D=a.itemData,_=a.itemKey,k=_===void 0?ks:_,Q=a.layout,H=a.outerElementType,C=a.outerTagName,P=a.style,G=a.useIsScrolling,Z=a.width,Y=this.state.isScrolling,O=h==="horizontal"||Q==="horizontal",w=O?this._onScrollHorizontal:this._onScrollVertical,oe=this._getRangeToRender(),De=oe[0],ze=oe[1],re=[];if(z>0)for(var q=De;q<=ze;q++)re.push(T.createElement(l,{data:D,key:k(q,D),index:q,isScrolling:G?Y:void 0,style:this._getItemStyle(q)}));var ae=o(this.props,this._instanceProps);return T.createElement(H||C||"div",{className:p,onScroll:w,ref:this._outerRefSetter,style:ee({position:"relative",height:x,width:Z,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:h},P)},T.createElement(y||M||"div",{children:re,ref:A,style:{height:O?"100%":ae,pointerEvents:Y?"none":void 0,width:O?ae:"100%"}}))},S._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var a=this.props.itemCount;if(a>0){var l=this._getRangeToRender(),p=l[0],h=l[1],x=l[2],A=l[3];this._callOnItemsRendered(p,h,x,A)}}if(typeof this.props.onScroll=="function"){var y=this.state,M=y.scrollDirection,z=y.scrollOffset,D=y.scrollUpdateWasRequested;this._callOnScroll(M,z,D)}},S._getRangeToRender=function(){var a=this.props,l=a.itemCount,p=a.overscanCount,h=this.state,x=h.isScrolling,A=h.scrollDirection,y=h.scrollOffset;if(l===0)return[0,0,0,0];var M=d(this.props,y,this._instanceProps),z=u(this.props,M,y,this._instanceProps),D=!x||A==="backward"?Math.max(1,p):1,_=!x||A==="forward"?Math.max(1,p):1;return[Math.max(0,M-D),Math.max(0,Math.min(l-1,z+_)),M,z]},j}(T.PureComponent),s.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},s}var ws=function(s,n){s.children,s.direction,s.height,s.layout,s.innerTagName,s.outerTagName,s.width,n.instance},Es=Cs({getItemOffset:function(s,n){var o=s.itemSize;return n*o},getItemSize:function(s,n){var o=s.itemSize;return o},getEstimatedTotalSize:function(s){var n=s.itemCount,o=s.itemSize;return o*n},getOffsetForIndexAndAlignment:function(s,n,o,r,m,d){var u=s.direction,c=s.height,I=s.itemCount,v=s.itemSize,N=s.layout,j=s.width,S=u==="horizontal"||N==="horizontal",g=S?j:c,a=Math.max(0,I*v-g),l=Math.min(a,n*v),p=Math.max(0,n*v-g+v+d);switch(o==="smart"&&(r>=p-g&&r<=l+g?o="auto":o="center"),o){case"start":return l;case"end":return p;case"center":{var h=Math.round(p+(l-p)/2);return h<Math.ceil(g/2)?0:h>a+Math.floor(g/2)?a:h}case"auto":default:return r>=p&&r<=l?r:r<p?p:l}},getStartIndexForOffset:function(s,n){var o=s.itemCount,r=s.itemSize;return Math.max(0,Math.min(o-1,Math.floor(n/r)))},getStopIndexForStartIndex:function(s,n,o){var r=s.direction,m=s.height,d=s.itemCount,u=s.itemSize,c=s.layout,I=s.width,v=r==="horizontal"||c==="horizontal",N=n*u,j=v?I:m,S=Math.ceil((j+o-N)/u);return Math.max(0,Math.min(d-1,n+S-1))},initInstanceProps:function(s){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(s){s.itemSize}});function Ls(e){var s=e.lastRenderedStartIndex,n=e.lastRenderedStopIndex,o=e.startIndex,r=e.stopIndex;return!(o>n||r<s)}function Qs(e){for(var s=e.isItemLoaded,n=e.itemCount,o=e.minimumBatchSize,r=e.startIndex,m=e.stopIndex,d=[],u=null,c=null,I=r;I<=m;I++){var v=s(I);v?c!==null&&(d.push(u,c),u=c=null):(c=I,u===null&&(u=I))}if(c!==null){for(var N=Math.min(Math.max(c,u+o-1),n-1),j=c+1;j<=N&&!s(j);j++)c=j;d.push(u,c)}if(d.length)for(;d[1]-d[0]+1<o&&d[0]>0;){var S=d[0]-1;if(!s(S))d[0]=S;else break}return d}var Rs=function(e,s){if(!(e instanceof s))throw new TypeError("Cannot call a class as a function")},$s=function(){function e(s,n){for(var o=0;o<n.length;o++){var r=n[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(s,r.key,r)}}return function(s,n,o){return n&&e(s.prototype,n),o&&e(s,o),s}}(),qs=function(e,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof s);e.prototype=Object.create(s&&s.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),s&&(Object.setPrototypeOf?Object.setPrototypeOf(e,s):e.__proto__=s)},ye=function(e,s){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s&&(typeof s=="object"||typeof s=="function")?s:e},Us=function(e){qs(s,e);function s(){var n,o,r,m;Rs(this,s);for(var d=arguments.length,u=Array(d),c=0;c<d;c++)u[c]=arguments[c];return m=(o=(r=ye(this,(n=s.__proto__||Object.getPrototypeOf(s)).call.apply(n,[this].concat(u))),r),r._lastRenderedStartIndex=-1,r._lastRenderedStopIndex=-1,r._memoizedUnloadedRanges=[],r._onItemsRendered=function(I){var v=I.visibleStartIndex,N=I.visibleStopIndex;r._lastRenderedStartIndex=v,r._lastRenderedStopIndex=N,r._ensureRowsLoaded(v,N)},r._setRef=function(I){r._listRef=I},o),ye(r,m)}return $s(s,[{key:"resetloadMoreItemsCache",value:function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this._memoizedUnloadedRanges=[],o&&this._ensureRowsLoaded(this._lastRenderedStartIndex,this._lastRenderedStopIndex)}},{key:"componentDidMount",value:function(){}},{key:"render",value:function(){var o=this.props.children;return o({onItemsRendered:this._onItemsRendered,ref:this._setRef})}},{key:"_ensureRowsLoaded",value:function(o,r){var m=this.props,d=m.isItemLoaded,u=m.itemCount,c=m.minimumBatchSize,I=c===void 0?10:c,v=m.threshold,N=v===void 0?15:v,j=Qs({isItemLoaded:d,itemCount:u,minimumBatchSize:I,startIndex:Math.max(0,o-N),stopIndex:Math.min(u-1,r+N)});(this._memoizedUnloadedRanges.length!==j.length||this._memoizedUnloadedRanges.some(function(S,g){return j[g]!==S}))&&(this._memoizedUnloadedRanges=j,this._loadUnloadedRanges(j))}},{key:"_loadUnloadedRanges",value:function(o){for(var r=this,m=this.props.loadMoreItems||this.props.loadMoreRows,d=function(I){var v=o[I],N=o[I+1],j=m(v,N);j!=null&&j.then(function(){if(Ls({lastRenderedStartIndex:r._lastRenderedStartIndex,lastRenderedStopIndex:r._lastRenderedStopIndex,startIndex:v,stopIndex:N})){if(r._listRef==null)return;typeof r._listRef.resetAfterIndex=="function"?r._listRef.resetAfterIndex(v,!0):(typeof r._listRef._getItemStyleCache=="function"&&r._listRef._getItemStyleCache(-1),r._listRef.forceUpdate())}})},u=0;u<o.length;u+=2)d(u)}}]),s}(T.PureComponent);const Ps=i.styled_default("div")({name:"Container",class:"culdu4a",propsAsIs:!1}),Ys=i.styled_default("div")({name:"Position",class:"pwf8e69",propsAsIs:!1}),Vs=i.styled_default("img")({name:"Avatar",class:"atf4yh4",propsAsIs:!1}),Ws=i.styled_default("div")({name:"AvatarPlaceholder",class:"a1dg29ja",propsAsIs:!1}),Fs=i.styled_default("div")({name:"Content",class:"c10a68rc",propsAsIs:!1}),Bs=i.styled_default("div")({name:"NameContainer",class:"nc4kck5",propsAsIs:!1}),Hs=i.styled_default("span")({name:"Name",class:"njsrqgr",propsAsIs:!1}),Gs=()=>i.o1,Zs=i.styled_default(Gs())({name:"CurrentUserBadge",class:"c17uc4zr",propsAsIs:!0}),Js=({rank:e,avatar:s,name:n,points:o,isCurrentUser:r,openItemDetail:m,style:d})=>t.jsxs(Ps,{onClick:m,style:d,children:[t.jsx(Ys,{children:e||0}),t.jsxs(Fs,{children:[s?t.jsx(Vs,{alt:"leaderboard-item-avatar",src:s}):t.jsx(Ws,{children:Me(n||"")}),t.jsxs(Bs,{children:[t.jsx(Hs,{children:n||""}),r&&t.jsx(Zs,{name:"icon-star"})]})]}),t.jsx("div",{children:Te(o)})]}),Ks=i.styled_default("div")({name:"ScrollContainer",class:"s13d8sg6",propsAsIs:!1}),Xs=({items:e,currentUserId:s,openItemDetail:n,fetchMore:o})=>t.jsx(b.AutoSizer,{children:({width:r,height:m})=>t.jsx(Us,{isItemLoaded:d=>d<e.length,itemCount:e.length+1,loadMoreItems:o,children:({onItemsRendered:d,ref:u})=>t.jsx(Ks,{children:t.jsx(Es,{itemSize:56,onItemsRendered:d,ref:u,itemCount:e.length,width:r,height:m,children:({index:c,style:I})=>t.jsx(Js,{style:{...I,maxHeight:48},...e[c],openItemDetail:()=>n(e[c].userId),isCurrentUser:!!s&&s===e[c].userId},e[c].userId)})})})}),en=({deepLink:e})=>{const{data:s}=L.useStore(e.$store),n=s==null?void 0:s.url,o=e.desktopLink;return t.jsx(b.O,{inviteLink:n||o,socialLinks:[{icon:"icon-facebook",link:"https://www.facebook.com/TheMasters",label:"Facebook"},{icon:"icon-twitter",link:"https://twitter.com/@TheMasters",label:"X"}],inviteCardTitle:"It’s more fun with friends",inviteCardSubtext:"Invite and compete against your friends for the top spot on the leaderboard."})},tn=({gamification:e})=>{const{data:s}=L.useStore(e.leaderboardList.$store);return s!=null&&s.length?t.jsx(Xs,{fetchMore:e.leaderboardList.fetchMore,items:s,openItemDetail:e.openUser,currentUserId:e.currentUserId.get()}):t.jsx(en,{deepLink:e.deepLink})},sn=i.styled_default("div")({name:"QuestionItem",class:"q1w97g3p",propsAsIs:!1}),nn=i.styled_default("div")({name:"QuestionCaption",class:"q2sl39u",propsAsIs:!1}),on=i.styled_default("div")({name:"QuestionBody",class:"qd5h0uc",propsAsIs:!1}),rn=i.styled_default("div")({name:"QuestionAction",class:"q105uluy",propsAsIs:!1}),an=()=>i.o1,F=i.styled_default(an())({name:"QuestionActionIcon",class:"q1fa0b9h",propsAsIs:!0}),ln=()=>i.o1,cn=i.styled_default(ln())({name:"QuestionTypeIcon",class:"qxlt78s",propsAsIs:!0}),dn=i.styled_default("div")({name:"QuestionTypeLabel",class:"qmg0vkx",propsAsIs:!1}),un=i.styled_default("div")({name:"QuestionContent",class:"q1uz5j1g",propsAsIs:!1}),pn=i.styled_default("button")({name:"PlayButton",class:"p1pba9p1",propsAsIs:!1}),mn={[f.PickHistoryStatus.LOST]:t.jsx(F,{name:"incorrectVoted"}),[f.PickHistoryStatus.WON]:t.jsx(F,{name:"icon-check"}),[f.PickHistoryStatus.UNSET]:t.jsx(F,{name:"icon-arrow"}),[f.PickHistoryStatus.DNP]:t.jsx(F,{name:"icon-arrow"})},hn=({questionId:e,questionType:s,questionStatus:n,subject:o,openForVoting:r,openQuestion:m,status:d})=>{const u=b.o[s],c=mn[d];return u?t.jsxs(sn,{onClick:()=>m==null?void 0:m(e),children:[t.jsxs(un,{children:[t.jsxs(nn,{children:[t.jsx(cn,{"data-type-trivia":s===f.QuestionType.TRIVIA,"data-type-poll":s===f.QuestionType.POLL,name:u.iconName}),t.jsxs(dn,{children:[u.label,s===f.QuestionType.TRIVIA&&n===f.QuestionStatus.RESOLVED&&" • Expired"]})]}),t.jsx(on,{children:o||""})]}),t.jsx(rn,{children:r?t.jsx(pn,{children:"Play"}):c})]}):null},fn=i.styled_default("div")({name:"Container",class:"cll3md7",propsAsIs:!1}),In=i.styled_default("button")({name:"ActionBtn",class:"a10g1iik",propsAsIs:!1}),xn=({openInsight:e,questionId:s,...n})=>t.jsxs(fn,{children:[t.jsx(Se,{questionId:s,...n,isPickHistory:!0}),e&&t.jsx(In,{onClick:()=>e(s),children:"View Insight"})]}),yn=i.styled_default("div")({name:"Container",class:"cl56x6b",propsAsIs:!1}),jn=()=>b.c,gn=i.styled_default(jn())({name:"ActionButton",class:"a11pzf92",propsAsIs:!0}),vn=i.styled_default("div")({name:"DateTime",class:"d1hbaleq",propsAsIs:!1}),Mn=i.styled_default("blockquote")({name:"Quote",class:"qvvgqjm",propsAsIs:!1}),Tn=({openTweet:e,created:s,...n})=>{const o=T.useMemo(()=>{if(s){const r=new Date(s);if(ie(r))return{date:se(r),time:ne(r)}}return null},[s]);return t.jsxs(yn,{children:[o&&t.jsxs(vn,{children:[o.date," · ",o.time]}),n.title&&t.jsx(Mn,{children:n.title}),t.jsx(b.u,{...n}),e&&t.jsx(gn,{onClick:()=>e(n.tweetId),children:"View Insight"})]})},An=i.styled_default("div")({name:"QuestionsContainer",class:"qvghv3l",propsAsIs:!1}),Nn=({questions:e,openQuestion:s})=>t.jsx(An,{children:e==null?void 0:e.map(n=>{var o,r,m;if(n.type==="question"&&((o=n.attributes)==null?void 0:o.attributes.case)==="question"){const d=n.attributes.attributes.value;return t.jsx(hn,{openQuestion:s,...d},d.questionId)}if(n.type==="insight"&&((r=n.attributes)==null?void 0:r.attributes.case)==="insight"){const d=n.attributes.attributes.value;return t.jsx(xn,{openInsight:s,...d},d.questionId)}if(n.type==="tweet"&&((m=n.attributes)==null?void 0:m.attributes.case)==="tweet"){const d=n.attributes.attributes.value,u=n.attributes.id,c=n.attributes.created;return t.jsx(Tn,{openTweet:s,...d,tweetId:u,created:c},u)}return null})}),Sn=({store:e,openQuestion:s})=>{const n=L.useStore(e);return n!=null&&n.data?t.jsx(Nn,{openQuestion:s,questions:n.data}):t.jsx("div",{children:"wait questions..."})},Dn=({userSummary:e})=>{var s;const[n,o]=T.useState(void 0);return T.useEffect(()=>{const r=e.subscribe(m=>{m!=null&&m.data&&o(m.data)});return()=>{r()}},[e]),n!=null&&n.summary?t.jsx(Ae,{...n.summary,successRate:(s=n.percentage)==null?void 0:s.correct}):t.jsx("div",{children:"wait user..."})},zn=({gamification:e})=>{const[s,n]=T.useState(B.HOME);return t.jsxs("div",{style:{height:"100%",display:"flex",flexDirection:"column",overflow:"hidden"},children:[t.jsx(b.a,{style:{paddingBottom:"4px"},children:t.jsx(Ns,{activePage:s,toggleActivePage:n})}),s===B.HOME&&t.jsxs(b.r,{children:[t.jsx(b.a,{style:{paddingTop:"12px"},children:t.jsx(Dn,{userSummary:e.userSummary})}),t.jsx(b.n,{children:t.jsx(Sn,{openQuestion:e.openQuestion,store:e.feedList.getStore()})})]}),s===B.LEADERBOARD&&t.jsx("div",{className:"c1bp9dj2",children:t.jsx(tn,{gamification:e})})]})},On=()=>b.f,je=i.styled_default(On())({name:"OpenedContainer",class:"oar61gl",propsAsIs:!0}),bn=i.styled_default("div")({name:"UserContainer",class:"u14zaal4",propsAsIs:!1}),_n=({correct:e,incorrect:s})=>{const n=e+s;return n===0?0:Math.round(e/n*100)},kn=({gamification:e,className:s})=>{const n=L.useStore(e.openedQuestion.$store),o=L.useStore(e.openedUser);return t.jsxs(t.Fragment,{children:[n&&t.jsx(je,{className:s,children:t.jsx(gs,{gamification:e})}),o&&t.jsx(je,{className:s,children:t.jsxs(bn,{children:[t.jsx(ve,{label:"Friend's Rank",close:e.closeUser}),t.jsx(b.a,{children:t.jsx(Ae,{...o,successRate:_n(o)})})]})}),t.jsx(b.r,{className:s,"data-nav":"true",children:t.jsx(zn,{gamification:e})})]})};exports.default=kn;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),r=require("./index4.js"),L=require("@nanostores/react"),b=require("./masters2.js"),I=require("@streamlayer/sdk-web-types"),y=require("react"),ge=require("./index3.js");require("react-countup");const be=require("react-countdown-circle-timer"),E=require("./index2.js"),ve=require("lodash.throttle");require("@streamlayer/sdk-web-interfaces");require("@streamlayer/sdk-web-notifications");require("./useStreamLayerApp.js");require("@streamlayer/sdk-web");const ke=r.styled_default("div")({name:"Container",class:"c1vwopgc",propsAsIs:!1}),Ce=r.styled_default("div")({name:"QuestionTypeWrap",class:"qyktpt0",propsAsIs:!1}),_e=()=>r.r1,we=r.styled_default(_e())({name:"QuestionTypeIcon",class:"q951jdx",propsAsIs:!0}),Ee=r.styled_default("span")({name:"QuestionTypeTitle",class:"qss5f0e",propsAsIs:!1}),Le=r.styled_default("button")({name:"CloseButton",class:"c1ao1jtv",propsAsIs:!1}),Qe=()=>r.r1,Re=r.styled_default(Qe())({name:"CloseIcon",class:"cvsl7l3",propsAsIs:!0}),Me=({type:e,close:s,label:n})=>{const i=e?b.o[e]:{label:n,iconName:void 0};return t.jsxs(ke,{children:[t.jsxs(Ce,{children:[(i==null?void 0:i.iconName)&&t.jsx(we,{"data-type-trivia":e===I.QuestionType.TRIVIA,"data-type-poll":e===I.QuestionType.POLL,name:i.iconName}),(i==null?void 0:i.label)&&t.jsx(Ee,{children:i.label})]}),t.jsx(Le,{onClick:s,children:t.jsx(Re,{name:"icon-cross"})})]})},Te=e=>e.split(/\s+/).map(s=>s[0]).join("").toUpperCase(),Ae=e=>e?e.toLocaleString("en-US"):"0",se=e=>e.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"}),ne=e=>e.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),ie=e=>!isNaN(e.getTime()),$e=r.styled_default("div")({name:"Container",class:"c1zy8a",propsAsIs:!1}),qe=r.styled_default("div")({name:"Title",class:"t1vih9p5",propsAsIs:!1}),Ue=r.styled_default("div")({name:"Indicator",class:"i1fbnvpb",propsAsIs:!1}),le=({indicator:e,title:s})=>t.jsxs($e,{children:[t.jsx(qe,{children:s}),t.jsx(Ue,{children:e})]}),Pe=r.styled_default("div")({name:"Container",class:"ctmhwyc",propsAsIs:!1}),Ye=r.styled_default("div")({name:"Indicator",class:"i1jri200",propsAsIs:!1}),Ve=r.styled_default("div")({name:"Title",class:"t8s05oq",propsAsIs:!1}),W=({indicator:e,title:s})=>t.jsxs(Pe,{children:[t.jsx(Ye,{children:e}),t.jsx(Ve,{children:s})]}),We=r.styled_default("div")({name:"Container",class:"c1yrpn9o",propsAsIs:!1}),Fe=r.styled_default("div")({name:"TopInfo",class:"t17fwahh",propsAsIs:!1}),Be=r.styled_default("div")({name:"BottomInfo",class:"by6w7e9",propsAsIs:!1}),He=r.styled_default("div")({name:"User",class:"u1g7arbm",propsAsIs:!1}),Ge=r.styled_default("img")({name:"Avatar",class:"a1ldeata",propsAsIs:!1}),Ze=r.styled_default("div")({name:"UserInfo",class:"u10d4koz",propsAsIs:!1}),Je=r.styled_default("div")({name:"UserName",class:"u1q6roj0",propsAsIs:!1}),Ke=r.styled_default("div")({name:"UserRating",class:"ui0m425",propsAsIs:!1}),Xe=r.styled_default("img")({name:"TrophyIcon",class:"t1el3mrn",propsAsIs:!1}),et=r.styled_default("div")({name:"Rts",class:"r2vgnxv",propsAsIs:!1}),tt=r.styled_default("div")({name:"RtsIndicator",class:"roqn06j",propsAsIs:!1}),st=r.styled_default("div")({name:"RtsLabel",class:"r15adx7c",propsAsIs:!1}),nt=r.styled_default("div")({name:"Divider",class:"dv59lta",propsAsIs:!1}),it=r.styled_default("div")({name:"Ranks",class:"r55lotb",propsAsIs:!1}),rt=r.styled_default("div")({name:"Statistics",class:"s1knfgqt",propsAsIs:!1}),ot=r.styled_default("div")({name:"AvatarPlaceholder",class:"a1mqo824",propsAsIs:!1}),at=r.styled_default("button")({name:"UserAccountBtn",class:"uxareh6",propsAsIs:!1}),lt="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgaWQ9IlRyb3BoeSI+CjxwYXRoIGlkPSJDb21iaW5lZCBTaGFwZSIgZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0zLjY5MTk3IDQuNjY2NjJDMy42OTE5NyA1Ljk5NzA1IDMuOTI5MTQgNy4xNzc4NyA0LjQwMzUgOC4yMDkxMkMzLjQ5OTY2IDguMDI0NTEgMi43NDQ4NyA3LjY2NDg2IDIuMTM5MSA3LjEzMDE0QzEuNTMzMzMgNi41OTU0MiAxLjIzMDQ2IDYuMDc5OCAxLjIzMDQ2IDUuNTgzMjhWNC42NjY2MkgzLjY5MTk3Wk0xNC43Njg2IDQuNjY2NjJWNS41ODMyOEMxNC43Njg2IDYuMDc5OCAxNC40NjU4IDYuNTk1NDIgMTMuODYgNy4xMzAxNEMxMy4yNTQyIDcuNjY0ODYgMTIuNDk5NCA4LjAyNDUxIDExLjU5NTYgOC4yMDkxMkMxMi4wNjk5IDcuMTc3ODcgMTIuMzA3MSA1Ljk5NzA1IDEyLjMwNzEgNC42NjY2MkgxNC43Njg2Wk0xNS45OTk4IDUuNTgzMjlWNC4zNjEwOEMxNS45OTk4IDQuMTA2NDUgMTUuOTEwMSAzLjg5MDAyIDE1LjczMDYgMy43MTE3OEMxNS41NTExIDMuNTMzNTQgMTUuMzMzMiAzLjQ0NDQyIDE1LjA3NjggMy40NDQ0MkgxMi4zMDc2VjIuNTI3NzZDMTIuMzA3NiAyLjEwNzYzIDEyLjE1NjkgMS43NDc5NyAxMS44NTU2IDEuNDQ4NzhDMTEuNTU0NCAxLjE0OTU5IDExLjE5MjIgMSAxMC43NjkxIDFINS4yMzA3MkM0LjgwNzY0IDEgNC40NDU0NyAxLjE0OTU5IDQuMTQ0MTkgMS40NDg3OEMzLjg0MjkxIDEuNzQ3OTcgMy42OTIyNyAyLjEwNzYzIDMuNjkyMjcgMi41Mjc3NlYzLjQ0NDQySDAuOTIzMDY4QzAuNjY2NjU5IDMuNDQ0NDIgMC40NDg3MTQgMy41MzM1NCAwLjI2OTIyOCAzLjcxMTc4QzAuMDg5NzQxOCAzLjg5MDAyIDAgNC4xMDY0NSAwIDQuMzYxMDhWNS41ODMyOUMwIDYuMDM1MjUgMC4xMzMwMSA2LjQ5MDM5IDAuMzk5MDM0IDYuOTQ4NzJDMC42NjUwNTkgNy40MDcwNSAxLjAyNDAzIDcuODIwODIgMS40NzU5NSA4LjE5MDAzQzEuOTI3ODcgOC41NTkyNCAyLjQ4MjM0IDguODY5NTcgMy4xMzkzOSA5LjEyMTAxQzMuNzk2NDQgOS4zNzI0NiA0LjQ4NzEzIDkuNTE0MDkgNS4yMTE0OSA5LjU0NTkyQzUuNDgwNzEgOS44ODk2NyA1Ljc4NTIgMTAuMTkyIDYuMTI0OTQgMTAuNDUzQzYuMzY4NTMgMTAuNjY5NSA2LjUzNjc5IDEwLjkwMDIgNi42Mjk3NCAxMS4xNDUzQzYuNzIyNjkgMTEuMzkwNCA2Ljc2OTE2IDExLjY3NTIgNi43NjkxNiAxMS45OTk5QzYuNzY5MTYgMTIuMzQzNiA2LjY3MTQxIDEyLjYzMzMgNi40NzU5IDEyLjg2ODhDNi4yODAzOCAxMy4xMDQzIDUuOTY3ODkgMTMuMjIyMSA1LjUzODQxIDEzLjIyMjFDNS4wNTc2NCAxMy4yMjIxIDQuNjI5NzYgMTMuMzY2OSA0LjI1NDc2IDEzLjY1NjZDMy44Nzk3NyAxMy45NDYyIDMuNjkyMjcgMTQuMzEwNiAzLjY5MjI3IDE0Ljc0OTlWMTUuMzYxQzMuNjkyMjcgMTUuNDUwMSAzLjcyMTEyIDE1LjUyMzMgMy43Nzg4MSAxNS41ODA2QzMuODM2NSAxNS42Mzc5IDMuOTEwMjIgMTUuNjY2NSAzLjk5OTk2IDE1LjY2NjVIMTEuOTk5OUMxMi4wODk2IDE1LjY2NjUgMTIuMTYzMyAxNS42Mzc5IDEyLjIyMSAxNS41ODA2QzEyLjI3ODcgMTUuNTIzMyAxMi4zMDc2IDE1LjQ1MDEgMTIuMzA3NiAxNS4zNjFWMTQuNzQ5OUMxMi4zMDc2IDE0LjMxMDYgMTIuMTIwMSAxMy45NDYyIDExLjc0NTEgMTMuNjU2NkMxMS4zNzAxIDEzLjM2NjkgMTAuOTQyMiAxMy4yMjIxIDEwLjQ2MTQgMTMuMjIyMUMxMC4wMzE5IDEzLjIyMjEgOS43MTk0NSAxMy4xMDQzIDkuNTIzOTQgMTIuODY4OEM5LjMyODQzIDEyLjYzMzMgOS4yMzA2OCAxMi4zNDM2IDkuMjMwNjggMTEuOTk5OUM5LjIzMDY4IDExLjY3NTIgOS4yNzcxNSAxMS4zOTA0IDkuMzcwMSAxMS4xNDUzQzkuNDYzMDUgMTAuOTAwMiA5LjYzMTMxIDEwLjY2OTUgOS44NzQ5IDEwLjQ1M0MxMC4yMTQ2IDEwLjE5MiAxMC41MTkxIDkuODg5NjcgMTAuNzg4NCA5LjU0NTkyQzExLjUxMjcgOS41MTQwOSAxMi4yMDM0IDkuMzcyNDYgMTIuODYwNCA5LjEyMTAxQzEzLjUxNzUgOC44Njk1NyAxNC4wNzIgOC41NTkyNCAxNC41MjM5IDguMTkwMDNDMTQuOTc1OCA3LjgyMDgyIDE1LjMzNDggNy40MDcwNSAxNS42MDA4IDYuOTQ4NzJDMTUuODY2OCA2LjQ5MDM5IDE1Ljk5OTggNi4wMzUyNSAxNS45OTk4IDUuNTgzMjlaTTYuNzYwNDcgNy4xNzk4TDguMDUxMDkgNi40OTk5N0w5LjM0MTcgNy4xNzk4TDkuMDk1MjEgNS43Mzk4OUwxMC4xMzkzIDQuNzIwMTVMOC42OTYzOSA0LjUxMDA3TDguMDUxMDkgMy4yTDcuNDA1NzggNC41MTAwN0w1Ljk2MjgzIDQuNzIwMTVMNy4wMDY5NiA1LjczOTg5TDYuNzYwNDcgNy4xNzk4WiIgZmlsbD0iI0YyQzk0QyIvPgo8L2c+Cjwvc3ZnPgo=",Ne=({avatar:e,name:s,points:n,friendsRank:i,rank:o,streak:l,correct:p,incorrect:c,inTop:u,successRate:f})=>t.jsxs(We,{children:[t.jsx(Fe,{children:t.jsxs(He,{children:[t.jsxs(at,{children:[e&&t.jsx(Ge,{alt:"avatar",src:e}),!e&&t.jsx(ot,{children:Te(s||"")})]}),t.jsxs(Ze,{children:[t.jsx(Je,{children:s}),t.jsxs(Ke,{children:[t.jsxs(et,{children:[t.jsx(Xe,{alt:"rank-icon",src:lt}),t.jsxs(tt,{children:[Ae(n),t.jsx(st,{children:"PTS"})]})]}),t.jsx(nt,{}),t.jsxs("div",{children:["TOP ",u||0,"%"]})]})]})]})}),t.jsxs(Be,{children:[t.jsxs(it,{children:[t.jsx(le,{indicator:i||0,title:"Friends rank"}),t.jsx(le,{indicator:o||0,title:"Global rank"})]}),t.jsxs(rt,{children:[t.jsx(W,{indicator:l||0,title:"Win streak"}),t.jsx(W,{indicator:p||0,title:"Correct"}),t.jsx(W,{indicator:c||0,title:"Incorrect"}),t.jsx(W,{indicator:`${f||0}%`,title:"Succ. rate"})]})]})]}),ct=r.styled_default("div")({name:"SponsorLogoWrap",class:"s8p5v5z",propsAsIs:!1}),dt=()=>r.r1,ut=r.styled_default(dt())({name:"SponsorLogo",class:"s755yti",propsAsIs:!0}),pt=()=>t.jsx(ct,{children:t.jsx(ut,{name:"mastersLogo"})}),mt=r.styled_default("div")({name:"Container",class:"c38csyt",propsAsIs:!1}),ft=r.styled_default("div")({name:"Title",class:"ty221rx",propsAsIs:!1}),ht=r.styled_default("div")({name:"Description",class:"dlaj9xp",propsAsIs:!1}),It=({title:e,description:s})=>t.jsxs(mt,{children:[t.jsx(r.r1,{name:"icon-check-circle"}),t.jsx(ft,{children:e}),t.jsx(ht,{children:s})]}),xt=r.styled_default("div")({name:"Container",class:"c16sbdnm",propsAsIs:!1}),yt=()=>r.r1,jt=r.styled_default(yt())({name:"IconPrediction",class:"ibhorgl",propsAsIs:!0}),U=r.styled_default("div")({name:"FeedbackIconWrap",class:"f1g20ja7",propsAsIs:!1}),F=r.styled_default("div")({name:"FeedbackHeader",class:"f455ozj",propsAsIs:!1}),gt=r.styled_default("span")({name:"FeedbackTitle",class:"f1913njx",propsAsIs:!1}),R=r.styled_default("span")({name:"FeedbackDescription",class:"fzfk69z",propsAsIs:!1}),J=r.styled_default("div")({name:"FeedbackText",class:"fx87qaj",propsAsIs:!1}),vt=({feedbackMessages:e,questionVotedCorrectly:s,questionVoted:n,questionType:i,hasCorrectAnswer:o,questionStatus:l,showExpiredNotification:p,showClosedNotificationTrivia:c,votedInCurrentRender:u,votedAfterQuestionClosed:f,enteredAnActiveQuestion:v})=>{const N=n&&(i===I.QuestionType.TRIVIA||i===I.QuestionType.PREDICTION)&&u&&l!==I.QuestionStatus.RESOLVED,x=i===I.QuestionType.PREDICTION&&!o,T=l===I.QuestionStatus.RESOLVED&&i===I.QuestionType.PREDICTION&&!n&&!v||i===I.QuestionType.PREDICTION&&f&&u&&v,M=N&&x,a=N&&o,d=n&&i===I.QuestionType.POLL&&u;if(!p&&!c&&!M&&!a&&!T&&!d)return null;const m=s?"correct":"incorrect",h=s?e==null?void 0:e.correctFeedback:e==null?void 0:e.incorrectFeedback;return t.jsxs(xt,{"data-isPrediction":x,children:[p&&t.jsxs(t.Fragment,{children:[t.jsx(U,{children:t.jsx(r.r1,{name:"questionExpired"})}),t.jsxs("div",{children:[t.jsx(F,{children:t.jsx(R,{children:"Question Expired"})}),t.jsx(J,{children:"You can still answer to see if you're correct, but no points are awarded for expired questions."})]})]}),c&&t.jsxs(t.Fragment,{children:[t.jsx(U,{children:t.jsx(r.r1,{name:"questionExpired"})}),t.jsxs("div",{children:[t.jsx(F,{children:t.jsx(R,{children:"Question Closed"})}),t.jsx(J,{children:"This question was answered after the moderator closed the question. So the points for this answer won’t tally."})]})]}),T&&t.jsxs(t.Fragment,{children:[t.jsx(U,{children:t.jsx(r.r1,{name:"questionExpired"})}),t.jsxs("div",{children:[t.jsx(F,{children:t.jsx(R,{children:"Question Closed"})}),t.jsx(J,{children:"This event has already taken place, so the ability to make a prediction on its outcome is no longer available."})]})]}),M&&t.jsxs(t.Fragment,{children:[t.jsx(jt,{name:"icon-prediction"}),t.jsx(R,{children:"Stay tuned to see if your prediction was correct."})]}),d&&t.jsxs(t.Fragment,{children:[t.jsx(U,{"data-feedbackType":"correct",children:t.jsx(r.r1,{name:"correct"})}),t.jsx(R,{children:"That's for answering. Please stay tuned for the next question."})]}),a&&t.jsxs(t.Fragment,{children:[t.jsx(U,{"data-feedbackType":m,children:t.jsx(r.r1,{name:m})}),t.jsx("div",{children:t.jsxs(F,{children:[t.jsx(gt,{"data-feedbackType":m,children:h==null?void 0:h.title}),t.jsx(R,{children:h==null?void 0:h.description})]})})]})]})},Mt=r.styled_default("div")({name:"Container",class:"c14ielyq",propsAsIs:!1}),Tt=r.styled_default("div")({name:"Content",class:"c1tlqx57",propsAsIs:!1}),At=r.styled_default("div")({name:"Title",class:"t1hq58md",propsAsIs:!1}),Nt=r.styled_default("div")({name:"Options",class:"o1c8nxcx",propsAsIs:!1}),St=r.styled_default("button")({name:"ButtonContainer",class:"b1b6dl8t",propsAsIs:!1}),Dt=r.styled_default("div")({name:"ButtonPct",class:"b4iik8i",propsAsIs:!1}),zt=r.styled_default("span")({name:"ButtonBody",class:"b1gq1lnf",propsAsIs:!1}),Ot=r.styled_default("div")({name:"IconContainer",class:"i1j65z51",propsAsIs:!1}),bt=r.styled_default("div")({name:"IconWrap",class:"i19tpfua",propsAsIs:!1}),Se=r.styled_default("img")({name:"Icon",class:"i1tubmma",propsAsIs:!1}),kt=()=>Se,Ct=r.styled_default(kt())({name:"IconDefault",class:"i1grrgwj",propsAsIs:!0}),_t=()=>Se,wt=r.styled_default(_t())({name:"IconCircle",class:"ibemyq8",propsAsIs:!0}),Et=r.styled_default("span")({name:"Title",class:"t1dceht",propsAsIs:!1}),Lt=r.styled_default("span")({name:"Indicators",class:"i116q4vq",propsAsIs:!1}),Qt=r.styled_default("span")({name:"Percentage",class:"p17ajcu2",propsAsIs:!1}),Rt=()=>r.r1,$t=r.styled_default(Rt())({name:"CheckIcon",class:"cu9kmlb",propsAsIs:!0}),ce={[I.QuestionImages.CENTERED]:e=>t.jsx(Ct,{alt:"option-icon",src:e}),[I.QuestionImages.TRANSPARENT]:e=>t.jsx(Ot,{children:t.jsx(bt,{style:{backgroundImage:`url(${e})`}})}),[I.QuestionImages.ROUNDED]:e=>t.jsx(wt,{alt:"option-icon",src:e}),[I.QuestionImages.NONE]:()=>null,[I.QuestionImages.UNSET]:()=>null},qt=({questionType:e,hasCorrectAnswer:s,correct:n,youVoted:i,questionVoted:o})=>{if(e===I.QuestionType.POLL&&i)return"correct";if(e===I.QuestionType.PREDICTION){if(s&&o)return i?n?"correct":"incorrect":"unset";if(i)return"correct"}return e===I.QuestionType.TRIVIA&&o&&i?n?"correct":"incorrect":"unset"},Ut=({questionType:e,questionVoted:s,correct:n,hasCorrectAnswer:i,questionStatus:o})=>e===I.QuestionType.TRIVIA?s&&n:e===I.QuestionType.PREDICTION?s&&n&&i||o===I.QuestionStatus.RESOLVED&&n:!1,Pt=e=>{var s;const{id:n,icon:i,text:o,percentageDecimal:l,onVote:p,markThatVoted:c,youSelected:u,questionVoted:f,imageMode:v,answerTimeExpired:N,questionStatus:x,isLoading:T,questionType:M,correct:a,hasCorrectAnswer:d,votedAfterQuestionClosed:m,enteredAnActiveQuestion:h}=e,j=qt(e),S=Ut({questionType:M,questionVoted:f,correct:a,hasCorrectAnswer:d,questionStatus:x}),g=x===I.QuestionStatus.RESOLVED&&M===I.QuestionType.PREDICTION,A=f||g;return t.jsxs(St,{value:n,"data-selected":u,"data-answerState":j,disabled:f||T||N||g&&!h||g&&h&&m,"data-isNotChecked":f&&!u&&j!=="incorrect",onClick:z=>{c(x===I.QuestionStatus.RESOLVED),p(z)},children:[t.jsx(Dt,{"data-answerState":j,style:{width:`${A?l:0}%`}}),t.jsxs(zt,{children:[i&&v&&((s=ce[v])==null?void 0:s.call(ce,i)),t.jsx(Et,{children:o}),A&&t.jsxs(Lt,{children:[S&&t.jsx($t,{name:"selected"}),t.jsx(Qt,{children:t.jsx(ge.d,{value:l,suffix:"%"})})]})]})]})},Yt=[E.E.PRIMARY_GREEN1,E.E.SECONDARY_RED1,E.E.SECONDARY_RED1,E.E.NEUTRALS_GRAY3],Vt=[10,10,1,0],Wt=r.styled_default("div")({name:"RemainingTime",class:"r165427",propsAsIs:!1}),Ft=E.E.SECONDARY_GREEN6,de=E.E.SECONDARY_RED3,Bt=E.E.NEUTRALS_GRAY3,Ht=({isPlaying:e=!0,duration:s=30,onTimerExpired:n})=>{const[i,o]=y.useState(s>10?Ft:de),l=({remainingTime:u})=>t.jsx(Wt,{children:u}),p=y.useCallback(()=>{n==null||n(),o(Bt)},[n,o]),c=y.useCallback(u=>{u===10&&o(de)},[o]);return t.jsx(be.CountdownCircleTimer,{isPlaying:e,duration:s,colors:Yt,colorsTime:Vt,size:32,strokeWidth:2,trailStrokeWidth:2,trailColor:i,onComplete:p,onUpdate:c,children:l})},Gt=r.styled_default("div")({name:"WinBarContainer",class:"wie6cqo",propsAsIs:!1}),Zt=r.styled_default("div")({name:"Content",class:"cgizw4u",propsAsIs:!1}),Jt=r.styled_default("div")({name:"Title",class:"t1l3ucjp",propsAsIs:!1}),Kt=()=>r.r1,Xt=r.styled_default(Kt())({name:"WinIcon",class:"wx7j799",propsAsIs:!0}),es=r.styled_default("div")({name:"Points",class:"p4lwuj0",propsAsIs:!1}),ts=r.styled_default("span")({name:"PointsCount",class:"po9i64o",propsAsIs:!1}),ss=r.styled_default("span")({name:"PointsUnits",class:"pe5g05h",propsAsIs:!1}),ns=({title:e,points:s,isPlayingTimer:n,isTimer:i,questionType:o,timerDuration:l,onTimerExpired:p})=>t.jsxs(Gt,{children:[t.jsxs(Zt,{children:[e&&t.jsx(Jt,{children:e}),s!==void 0&&o!==I.QuestionType.POLL&&t.jsxs(t.Fragment,{children:[t.jsx(Xt,{name:"icon-trophy"}),t.jsxs(es,{children:[t.jsx(ts,{children:t.jsx(ge.d,{value:s})}),t.jsx(ss,{children:"PTS"})]})]})]}),i&&t.jsx(Ht,{isPlaying:n,onTimerExpired:p,duration:l})]}),is=({openedQuestion:e,isLoading:s,vote:n,close:i})=>{var o,l;const p=e.subject,c=e.type,u=e.status,f=(o=e.options)==null?void 0:o.options,[v,N]=y.useState(!1),[x,T]=y.useState(!1),[M,a]=y.useState(!0),[d,m]=y.useState(!1),[h,j]=y.useState(""),S=e==null?void 0:e.id;y.useEffect(()=>{u===I.QuestionStatus.RESOLVED&&a(!1)},[]);const g=y.useCallback(O=>{T(O),N(!0)},[]),A=y.useCallback(async O=>{if(S){const w=O.currentTarget.value;j(w),await n(S,w)}},[S,j,n]),z=y.useCallback(()=>{m(!0),setTimeout(i,3e3)},[i]),D=y.useMemo(()=>e==null?void 0:e.answers.find(O=>O.youVoted===!0),[e]),k=y.useMemo(()=>!!(e!=null&&e.answers.find(O=>O.correct===!0)),[e]),C=y.useMemo(()=>e==null?void 0:e.answers.find(O=>O.correct===!0),[e]),Q=y.useMemo(()=>e?e.answers.map(O=>{var w;return{...O,questionVoted:!!D,youSelected:h===O.id,isLoading:s,hasCorrectAnswer:k,questionType:e.type,answerTimeExpired:d,questionStatus:u,imageMode:(w=e.appearance)==null?void 0:w.images,onVote:A}}):[],[k,d,s,e,D,u,A,h]),H=f&&(f.case==="trivia"||f.case==="prediction")?f.value:void 0,_=u===I.QuestionStatus.RESOLVED&&c===I.QuestionType.TRIVIA&&!D&&!M,Y=c===I.QuestionType.TRIVIA&&x&&v&&M,G=y.useMemo(()=>{if(!(_||d))return u===I.QuestionStatus.RESOLVED?0:D?D.correct?D.points:0:C==null?void 0:C.points},[d,D,C,u,_]),Z=y.useMemo(()=>_||d?"Time expired":e.type===I.QuestionType.POLL?"Time remaining":D?"You won":"To win",[d,e.type,D,_]),V=D||_||Y||c===I.QuestionType.TRIVIA&&u===I.QuestionStatus.RESOLVED&&M;return t.jsx(b.r,{"data-question-header":"true",children:t.jsx(Mt,{children:t.jsxs(Tt,{children:[t.jsx(vt,{feedbackMessages:H,questionVoted:!!D,questionVotedCorrectly:D==null?void 0:D.correct,questionType:c,hasCorrectAnswer:k,questionStatus:u,showExpiredNotification:_,showClosedNotificationTrivia:Y,votedInCurrentRender:v,votedAfterQuestionClosed:x,enteredAnActiveQuestion:M}),e.type!==I.QuestionType.PREDICTION&&t.jsx(ns,{title:Z,points:G,onTimerExpired:z,questionType:e.type,isTimer:!s,isPlayingTimer:!D,timerDuration:V?0:Number(((l=e==null?void 0:e.appearance)==null?void 0:l.autoHideInterval)||"30")}),d?t.jsx(It,{title:"More to come...",description:"Watch for additional enhanced stream interactive experience."}):t.jsxs(t.Fragment,{children:[t.jsx(At,{"data-isPrediction":e.type===I.QuestionType.PREDICTION,children:p}),t.jsx(Nt,{children:Q.map(O=>t.jsx(Pt,{...O,markThatVoted:g,votedAfterQuestionClosed:x,enteredAnActiveQuestion:M},O.id))})]})]})})})},rs=r.styled_default("div")({name:"Container",class:"cgn5uen",propsAsIs:!1}),os=r.styled_default("div")({name:"Content",class:"c1px8nt6",propsAsIs:!1}),as=r.styled_default("h3")({name:"Title",class:"t5et2jt",propsAsIs:!1}),ls=r.styled_default("div")({name:"Description",class:"d1i2kpk2",propsAsIs:!1}),cs=r.styled_default("div")({name:"DateWrap",class:"dd3lh3p",propsAsIs:!1}),ds=r.styled_default("img")({name:"Image",class:"i1gfjeu5",propsAsIs:!1}),De=({created:e,image:s,title:n,isPickHistory:i,instantView:o})=>{const l=y.useMemo(()=>{if(e){const c=new Date(e);if(ie(c))return{date:se(c),time:ne(c)}}return null},[e]),p=(o==null?void 0:o.image)||s;return t.jsxs(rs,{children:[l&&t.jsxs(cs,{children:[l.date," · ",l.time]}),(o==null?void 0:o.video)&&t.jsx(b.w,{source:o.video.url,poster:o.video.thumbnailUrl}),p&&!(o!=null&&o.video)&&t.jsx(ds,{src:p}),t.jsxs(os,{children:[t.jsx(as,{children:i?n:o==null?void 0:o.heading}),!i&&t.jsx(ls,{children:o==null?void 0:o.body})]})]})},us=r.styled_default("div")({name:"Container",class:"c1euiow",propsAsIs:!1}),ps=r.styled_default("a")({name:"WebLinkBtn",class:"w19zie3h",propsAsIs:!1}),ms=({instantView:e,...s})=>t.jsxs(us,{children:[t.jsx(De,{instantView:e,...s}),(e==null?void 0:e.webLink)&&t.jsxs(ps,{href:e==null?void 0:e.webLink.url,target:"_blank",children:[e==null?void 0:e.webLink.label,t.jsx(r.r1,{name:"icon-external-link"})]})]}),fs=r.styled_default("div")({name:"Container",class:"c1dcxmvf",propsAsIs:!1}),hs=r.styled_default("div")({name:"DateTime",class:"db4q22c",propsAsIs:!1}),Is=r.styled_default("blockquote")({name:"Quote",class:"q111mmic",propsAsIs:!1}),xs=({created:e,...s})=>{const n=y.useMemo(()=>{if(e){const i=new Date(e);if(ie(i))return{date:se(i),time:ne(i)}}return null},[e]);return t.jsxs(fs,{children:[n&&t.jsxs(hs,{children:[n.date," · ",n.time]}),s.title&&t.jsx(Is,{children:s.title}),t.jsx(b.u,{...s})]})},ys=r.styled_default("div")({name:"QuestionContainer",class:"qdri6g3",propsAsIs:!1}),js=({openedQuestion:e})=>{var s,n;return((s=e==null?void 0:e.attributes)==null?void 0:s.attributes.case)==="insight"?t.jsx(ms,{created:e.attributes.created,...e.attributes.attributes.value}):((n=e==null?void 0:e.attributes)==null?void 0:n.attributes.case)==="tweet"?t.jsx(xs,{created:e.attributes.created,...e.attributes.attributes.value}):null},gs=({extendedQuestion:e,vote:s,close:n})=>{const{loading:i,data:o}=e;return o?t.jsx(is,{vote:s,close:n,openedQuestion:o,isLoading:!!i}):null},vs=({gamification:e})=>{var s;const n=L.useStore(e.openedQuestion.$store),i=L.useStore(e.openedQuestion.$extendedStore);if(!n)return null;const o=n.type;return t.jsxs(ys,{children:[t.jsx(Me,{close:e.closeQuestion,type:((s=n.attributes)==null?void 0:s.type)||I.QuestionType.UNSET}),o==="question"&&t.jsx(gs,{vote:e.submitAnswer,close:e.closeQuestion,extendedQuestion:i}),o!=="question"&&t.jsx(js,{openedQuestion:n}),t.jsx(pt,{sponsorLogo:""})]})},Ms=r.styled_default("div")({name:"Container",class:"c115qtkr",propsAsIs:!1}),Ts=r.styled_default("div")({name:"STabs",class:"sxnslc8",propsAsIs:!1}),As=r.styled_default("button")({name:"Button",class:"b1umzux0",propsAsIs:!1}),Ns=r.styled_default("span")({name:"Title",class:"tspsaas",propsAsIs:!1});var P=(e=>(e.HOME="home",e.LEADERBOARD="leaderboard",e))(P||{});const ue=({title:e,active:s,onClick:n})=>t.jsx(As,{onClick:n,"data-selected":s,children:t.jsx(Ns,{children:e})}),Ss=({activePage:e="home",toggleActivePage:s})=>t.jsx(Ms,{children:t.jsxs(Ts,{"data-position":e==="home"?"left":"right",children:[t.jsx(ue,{title:"Home",active:e==="home",onClick:()=>s("home")}),t.jsx(ue,{title:"Friends",active:e==="leaderboard",onClick:()=>s("leaderboard")})]})});function ee(){return ee=Object.assign?Object.assign.bind():function(e){for(var s=1;s<arguments.length;s++){var n=arguments[s];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},ee.apply(this,arguments)}function pe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function te(e,s){return te=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,o){return i.__proto__=o,i},te(e,s)}function Ds(e,s){e.prototype=Object.create(s.prototype),e.prototype.constructor=e,te(e,s)}var me=Number.isNaN||function(s){return typeof s=="number"&&s!==s};function zs(e,s){return!!(e===s||me(e)&&me(s))}function Os(e,s){if(e.length!==s.length)return!1;for(var n=0;n<e.length;n++)if(!zs(e[n],s[n]))return!1;return!0}function K(e,s){s===void 0&&(s=Os);var n,i=[],o,l=!1;function p(){for(var c=[],u=0;u<arguments.length;u++)c[u]=arguments[u];return l&&n===this&&s(c,i)||(o=e.apply(this,c),l=!0,n=this,i=c),o}return p}var bs=typeof performance=="object"&&typeof performance.now=="function",fe=bs?function(){return performance.now()}:function(){return Date.now()};function he(e){cancelAnimationFrame(e.id)}function ks(e,s){var n=fe();function i(){fe()-n>=s?e.call(null):o.id=requestAnimationFrame(i)}var o={id:requestAnimationFrame(i)};return o}var X=-1;function Ie(e){if(e===void 0&&(e=!1),X===-1||e){var s=document.createElement("div"),n=s.style;n.width="50px",n.height="50px",n.overflow="scroll",document.body.appendChild(s),X=s.offsetWidth-s.clientWidth,document.body.removeChild(s)}return X}var $=null;function xe(e){if(e===void 0&&(e=!1),$===null||e){var s=document.createElement("div"),n=s.style;n.width="50px",n.height="50px",n.overflow="scroll",n.direction="rtl";var i=document.createElement("div"),o=i.style;return o.width="100px",o.height="100px",s.appendChild(i),document.body.appendChild(s),s.scrollLeft>0?$="positive-descending":(s.scrollLeft=1,s.scrollLeft===0?$="negative":$="positive-ascending"),document.body.removeChild(s),$}return $}var Cs=150,_s=function(s,n){return s};function ws(e){var s,n=e.getItemOffset,i=e.getEstimatedTotalSize,o=e.getItemSize,l=e.getOffsetForIndexAndAlignment,p=e.getStartIndexForOffset,c=e.getStopIndexForStartIndex,u=e.initInstanceProps,f=e.shouldResetStyleCacheOnItemSizeChange,v=e.validateProps;return s=function(N){Ds(x,N);function x(M){var a;return a=N.call(this,M)||this,a._instanceProps=u(a.props,pe(a)),a._outerRef=void 0,a._resetIsScrollingTimeoutId=null,a.state={instance:pe(a),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof a.props.initialScrollOffset=="number"?a.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},a._callOnItemsRendered=void 0,a._callOnItemsRendered=K(function(d,m,h,j){return a.props.onItemsRendered({overscanStartIndex:d,overscanStopIndex:m,visibleStartIndex:h,visibleStopIndex:j})}),a._callOnScroll=void 0,a._callOnScroll=K(function(d,m,h){return a.props.onScroll({scrollDirection:d,scrollOffset:m,scrollUpdateWasRequested:h})}),a._getItemStyle=void 0,a._getItemStyle=function(d){var m=a.props,h=m.direction,j=m.itemSize,S=m.layout,g=a._getItemStyleCache(f&&j,f&&S,f&&h),A;if(g.hasOwnProperty(d))A=g[d];else{var z=n(a.props,d,a._instanceProps),D=o(a.props,d,a._instanceProps),k=h==="horizontal"||S==="horizontal",C=h==="rtl",Q=k?z:0;g[d]=A={position:"absolute",left:C?void 0:Q,right:C?Q:void 0,top:k?0:z,height:k?"100%":D,width:k?D:"100%"}}return A},a._getItemStyleCache=void 0,a._getItemStyleCache=K(function(d,m,h){return{}}),a._onScrollHorizontal=function(d){var m=d.currentTarget,h=m.clientWidth,j=m.scrollLeft,S=m.scrollWidth;a.setState(function(g){if(g.scrollOffset===j)return null;var A=a.props.direction,z=j;if(A==="rtl")switch(xe()){case"negative":z=-j;break;case"positive-descending":z=S-h-j;break}return z=Math.max(0,Math.min(z,S-h)),{isScrolling:!0,scrollDirection:g.scrollOffset<j?"forward":"backward",scrollOffset:z,scrollUpdateWasRequested:!1}},a._resetIsScrollingDebounced)},a._onScrollVertical=function(d){var m=d.currentTarget,h=m.clientHeight,j=m.scrollHeight,S=m.scrollTop;a.setState(function(g){if(g.scrollOffset===S)return null;var A=Math.max(0,Math.min(S,j-h));return{isScrolling:!0,scrollDirection:g.scrollOffset<A?"forward":"backward",scrollOffset:A,scrollUpdateWasRequested:!1}},a._resetIsScrollingDebounced)},a._outerRefSetter=function(d){var m=a.props.outerRef;a._outerRef=d,typeof m=="function"?m(d):m!=null&&typeof m=="object"&&m.hasOwnProperty("current")&&(m.current=d)},a._resetIsScrollingDebounced=function(){a._resetIsScrollingTimeoutId!==null&&he(a._resetIsScrollingTimeoutId),a._resetIsScrollingTimeoutId=ks(a._resetIsScrolling,Cs)},a._resetIsScrolling=function(){a._resetIsScrollingTimeoutId=null,a.setState({isScrolling:!1},function(){a._getItemStyleCache(-1,null)})},a}x.getDerivedStateFromProps=function(a,d){return Es(a,d),v(a),null};var T=x.prototype;return T.scrollTo=function(a){a=Math.max(0,a),this.setState(function(d){return d.scrollOffset===a?null:{scrollDirection:d.scrollOffset<a?"forward":"backward",scrollOffset:a,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},T.scrollToItem=function(a,d){d===void 0&&(d="auto");var m=this.props,h=m.itemCount,j=m.layout,S=this.state.scrollOffset;a=Math.max(0,Math.min(a,h-1));var g=0;if(this._outerRef){var A=this._outerRef;j==="vertical"?g=A.scrollWidth>A.clientWidth?Ie():0:g=A.scrollHeight>A.clientHeight?Ie():0}this.scrollTo(l(this.props,a,d,S,this._instanceProps,g))},T.componentDidMount=function(){var a=this.props,d=a.direction,m=a.initialScrollOffset,h=a.layout;if(typeof m=="number"&&this._outerRef!=null){var j=this._outerRef;d==="horizontal"||h==="horizontal"?j.scrollLeft=m:j.scrollTop=m}this._callPropsCallbacks()},T.componentDidUpdate=function(){var a=this.props,d=a.direction,m=a.layout,h=this.state,j=h.scrollOffset,S=h.scrollUpdateWasRequested;if(S&&this._outerRef!=null){var g=this._outerRef;if(d==="horizontal"||m==="horizontal")if(d==="rtl")switch(xe()){case"negative":g.scrollLeft=-j;break;case"positive-ascending":g.scrollLeft=j;break;default:var A=g.clientWidth,z=g.scrollWidth;g.scrollLeft=z-A-j;break}else g.scrollLeft=j;else g.scrollTop=j}this._callPropsCallbacks()},T.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&he(this._resetIsScrollingTimeoutId)},T.render=function(){var a=this.props,d=a.children,m=a.className,h=a.direction,j=a.height,S=a.innerRef,g=a.innerElementType,A=a.innerTagName,z=a.itemCount,D=a.itemData,k=a.itemKey,C=k===void 0?_s:k,Q=a.layout,H=a.outerElementType,_=a.outerTagName,Y=a.style,G=a.useIsScrolling,Z=a.width,V=this.state.isScrolling,O=h==="horizontal"||Q==="horizontal",w=O?this._onScrollHorizontal:this._onScrollVertical,re=this._getRangeToRender(),ze=re[0],Oe=re[1],oe=[];if(z>0)for(var q=ze;q<=Oe;q++)oe.push(y.createElement(d,{data:D,key:C(q,D),index:q,isScrolling:G?V:void 0,style:this._getItemStyle(q)}));var ae=i(this.props,this._instanceProps);return y.createElement(H||_||"div",{className:m,onScroll:w,ref:this._outerRefSetter,style:ee({position:"relative",height:j,width:Z,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:h},Y)},y.createElement(g||A||"div",{children:oe,ref:S,style:{height:O?"100%":ae,pointerEvents:V?"none":void 0,width:O?ae:"100%"}}))},T._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var a=this.props.itemCount;if(a>0){var d=this._getRangeToRender(),m=d[0],h=d[1],j=d[2],S=d[3];this._callOnItemsRendered(m,h,j,S)}}if(typeof this.props.onScroll=="function"){var g=this.state,A=g.scrollDirection,z=g.scrollOffset,D=g.scrollUpdateWasRequested;this._callOnScroll(A,z,D)}},T._getRangeToRender=function(){var a=this.props,d=a.itemCount,m=a.overscanCount,h=this.state,j=h.isScrolling,S=h.scrollDirection,g=h.scrollOffset;if(d===0)return[0,0,0,0];var A=p(this.props,g,this._instanceProps),z=c(this.props,A,g,this._instanceProps),D=!j||S==="backward"?Math.max(1,m):1,k=!j||S==="forward"?Math.max(1,m):1;return[Math.max(0,A-D),Math.max(0,Math.min(d-1,z+k)),A,z]},x}(y.PureComponent),s.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},s}var Es=function(s,n){s.children,s.direction,s.height,s.layout,s.innerTagName,s.outerTagName,s.width,n.instance},Ls=ws({getItemOffset:function(s,n){var i=s.itemSize;return n*i},getItemSize:function(s,n){var i=s.itemSize;return i},getEstimatedTotalSize:function(s){var n=s.itemCount,i=s.itemSize;return i*n},getOffsetForIndexAndAlignment:function(s,n,i,o,l,p){var c=s.direction,u=s.height,f=s.itemCount,v=s.itemSize,N=s.layout,x=s.width,T=c==="horizontal"||N==="horizontal",M=T?x:u,a=Math.max(0,f*v-M),d=Math.min(a,n*v),m=Math.max(0,n*v-M+v+p);switch(i==="smart"&&(o>=m-M&&o<=d+M?i="auto":i="center"),i){case"start":return d;case"end":return m;case"center":{var h=Math.round(m+(d-m)/2);return h<Math.ceil(M/2)?0:h>a+Math.floor(M/2)?a:h}case"auto":default:return o>=m&&o<=d?o:o<m?m:d}},getStartIndexForOffset:function(s,n){var i=s.itemCount,o=s.itemSize;return Math.max(0,Math.min(i-1,Math.floor(n/o)))},getStopIndexForStartIndex:function(s,n,i){var o=s.direction,l=s.height,p=s.itemCount,c=s.itemSize,u=s.layout,f=s.width,v=o==="horizontal"||u==="horizontal",N=n*c,x=v?f:l,T=Math.ceil((x+i-N)/c);return Math.max(0,Math.min(p-1,n+T-1))},initInstanceProps:function(s){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(s){s.itemSize}});function Qs(e){var s=e.lastRenderedStartIndex,n=e.lastRenderedStopIndex,i=e.startIndex,o=e.stopIndex;return!(i>n||o<s)}function Rs(e){for(var s=e.isItemLoaded,n=e.itemCount,i=e.minimumBatchSize,o=e.startIndex,l=e.stopIndex,p=[],c=null,u=null,f=o;f<=l;f++){var v=s(f);v?u!==null&&(p.push(c,u),c=u=null):(u=f,c===null&&(c=f))}if(u!==null){for(var N=Math.min(Math.max(u,c+i-1),n-1),x=u+1;x<=N&&!s(x);x++)u=x;p.push(c,u)}if(p.length)for(;p[1]-p[0]+1<i&&p[0]>0;){var T=p[0]-1;if(!s(T))p[0]=T;else break}return p}var $s=function(e,s){if(!(e instanceof s))throw new TypeError("Cannot call a class as a function")},qs=function(){function e(s,n){for(var i=0;i<n.length;i++){var o=n[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(s,o.key,o)}}return function(s,n,i){return n&&e(s.prototype,n),i&&e(s,i),s}}(),Us=function(e,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof s);e.prototype=Object.create(s&&s.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),s&&(Object.setPrototypeOf?Object.setPrototypeOf(e,s):e.__proto__=s)},ye=function(e,s){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s&&(typeof s=="object"||typeof s=="function")?s:e},Ps=function(e){Us(s,e);function s(){var n,i,o,l;$s(this,s);for(var p=arguments.length,c=Array(p),u=0;u<p;u++)c[u]=arguments[u];return l=(i=(o=ye(this,(n=s.__proto__||Object.getPrototypeOf(s)).call.apply(n,[this].concat(c))),o),o._lastRenderedStartIndex=-1,o._lastRenderedStopIndex=-1,o._memoizedUnloadedRanges=[],o._onItemsRendered=function(f){var v=f.visibleStartIndex,N=f.visibleStopIndex;o._lastRenderedStartIndex=v,o._lastRenderedStopIndex=N,o._ensureRowsLoaded(v,N)},o._setRef=function(f){o._listRef=f},i),ye(o,l)}return qs(s,[{key:"resetloadMoreItemsCache",value:function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this._memoizedUnloadedRanges=[],i&&this._ensureRowsLoaded(this._lastRenderedStartIndex,this._lastRenderedStopIndex)}},{key:"componentDidMount",value:function(){}},{key:"render",value:function(){var i=this.props.children;return i({onItemsRendered:this._onItemsRendered,ref:this._setRef})}},{key:"_ensureRowsLoaded",value:function(i,o){var l=this.props,p=l.isItemLoaded,c=l.itemCount,u=l.minimumBatchSize,f=u===void 0?10:u,v=l.threshold,N=v===void 0?15:v,x=Rs({isItemLoaded:p,itemCount:c,minimumBatchSize:f,startIndex:Math.max(0,i-N),stopIndex:Math.min(c-1,o+N)});(this._memoizedUnloadedRanges.length!==x.length||this._memoizedUnloadedRanges.some(function(T,M){return x[M]!==T}))&&(this._memoizedUnloadedRanges=x,this._loadUnloadedRanges(x))}},{key:"_loadUnloadedRanges",value:function(i){for(var o=this,l=this.props.loadMoreItems||this.props.loadMoreRows,p=function(f){var v=i[f],N=i[f+1],x=l(v,N);x!=null&&x.then(function(){if(Qs({lastRenderedStartIndex:o._lastRenderedStartIndex,lastRenderedStopIndex:o._lastRenderedStopIndex,startIndex:v,stopIndex:N})){if(o._listRef==null)return;typeof o._listRef.resetAfterIndex=="function"?o._listRef.resetAfterIndex(v,!0):(typeof o._listRef._getItemStyleCache=="function"&&o._listRef._getItemStyleCache(-1),o._listRef.forceUpdate())}})},c=0;c<i.length;c+=2)p(c)}}]),s}(y.PureComponent);const Ys=r.styled_default("div")({name:"Container",class:"culdu4a",propsAsIs:!1}),Vs=r.styled_default("div")({name:"Position",class:"pwf8e69",propsAsIs:!1}),Ws=r.styled_default("img")({name:"Avatar",class:"atf4yh4",propsAsIs:!1}),Fs=r.styled_default("div")({name:"AvatarPlaceholder",class:"a1dg29ja",propsAsIs:!1}),Bs=r.styled_default("div")({name:"Content",class:"c10a68rc",propsAsIs:!1}),Hs=r.styled_default("div")({name:"NameContainer",class:"nc4kck5",propsAsIs:!1}),Gs=r.styled_default("span")({name:"Name",class:"njsrqgr",propsAsIs:!1}),Zs=()=>r.r1,Js=r.styled_default(Zs())({name:"CurrentUserBadge",class:"c17uc4zr",propsAsIs:!0}),Ks=({rank:e,avatar:s,name:n,points:i,isCurrentUser:o,openItemDetail:l,style:p})=>t.jsxs(Ys,{onClick:l,style:p,children:[t.jsx(Vs,{children:e||0}),t.jsxs(Bs,{children:[s?t.jsx(Ws,{alt:"leaderboard-item-avatar",src:s}):t.jsx(Fs,{children:Te(n||"")}),t.jsxs(Hs,{children:[t.jsx(Gs,{children:n||""}),o&&t.jsx(Js,{name:"icon-star"})]})]}),t.jsx("div",{children:Ae(i)})]}),Xs=r.styled_default("div")({name:"ScrollContainer",class:"s13d8sg6",propsAsIs:!1}),en=({items:e,currentUserId:s,openItemDetail:n,fetchMore:i,onScroll:o})=>t.jsx(b.AutoSizer,{children:({width:l,height:p})=>t.jsx(Ps,{isItemLoaded:c=>c<e.length,itemCount:e.length+1,loadMoreItems:i,children:({onItemsRendered:c,ref:u})=>t.jsx(Xs,{children:t.jsx(Ls,{itemSize:56,onScroll:o,onItemsRendered:c,ref:u,itemCount:e.length,width:l,height:p,children:({index:f,style:v})=>t.jsx(Ks,{style:{...v,maxHeight:48},...e[f],openItemDetail:()=>n(e[f].userId),isCurrentUser:!!s&&s===e[f].userId},e[f].userId)})})})}),tn=({deepLink:e})=>{const{data:s}=L.useStore(e.$store),n=s==null?void 0:s.url,i=e.desktopLink;return t.jsx(b.O,{inviteLink:n||i,socialLinks:[{icon:"icon-facebook",link:"https://www.facebook.com/TheMasters",label:"Facebook"},{icon:"icon-twitter",link:"https://twitter.com/@TheMasters",label:"X"}],inviteCardTitle:"It’s More Fun With Friends",inviteCardSubtext:"Invite and compete against your friends for the top spot on the leaderboard."})},sn=({gamification:e,hideTabs:s})=>{const{data:n}=L.useStore(e.leaderboardList.$store),i=y.useRef(0),o=y.useCallback(ve(l=>{Math.abs(i.current-l.scrollOffset)<112||(i.current=l.scrollOffset,s(l.scrollOffset!==0&&l.scrollDirection==="forward"))},200),[s]);return n!=null&&n.length?t.jsx(en,{fetchMore:e.leaderboardList.fetchMore,items:n,onScroll:o,openItemDetail:e.openUser,currentUserId:e.currentUserId.get()}):t.jsx(tn,{deepLink:e.deepLink})},nn=r.styled_default("div")({name:"QuestionItem",class:"q1w97g3p",propsAsIs:!1}),rn=r.styled_default("div")({name:"QuestionCaption",class:"q2sl39u",propsAsIs:!1}),on=r.styled_default("div")({name:"QuestionBody",class:"qd5h0uc",propsAsIs:!1}),an=r.styled_default("div")({name:"QuestionAction",class:"q105uluy",propsAsIs:!1}),ln=()=>r.r1,B=r.styled_default(ln())({name:"QuestionActionIcon",class:"q1fa0b9h",propsAsIs:!0}),cn=()=>r.r1,dn=r.styled_default(cn())({name:"QuestionTypeIcon",class:"qxlt78s",propsAsIs:!0}),un=r.styled_default("div")({name:"QuestionTypeLabel",class:"qmg0vkx",propsAsIs:!1}),pn=r.styled_default("div")({name:"QuestionContent",class:"q1uz5j1g",propsAsIs:!1}),mn=r.styled_default("button")({name:"PlayButton",class:"p1pba9p1",propsAsIs:!1}),fn={[I.PickHistoryStatus.LOST]:t.jsx(B,{name:"incorrectVoted"}),[I.PickHistoryStatus.WON]:t.jsx(B,{name:"icon-check"}),[I.PickHistoryStatus.UNSET]:t.jsx(B,{name:"icon-arrow"}),[I.PickHistoryStatus.DNP]:t.jsx(B,{name:"icon-arrow"})},hn=({questionId:e,questionType:s,questionStatus:n,subject:i,openForVoting:o,openQuestion:l,status:p})=>{const c=b.o[s],u=fn[p];return c?t.jsxs(nn,{onClick:()=>l==null?void 0:l(e),children:[t.jsxs(pn,{children:[t.jsxs(rn,{children:[t.jsx(dn,{"data-type-trivia":s===I.QuestionType.TRIVIA,"data-type-poll":s===I.QuestionType.POLL,name:c.iconName}),t.jsxs(un,{children:[c.label,s===I.QuestionType.TRIVIA&&n===I.QuestionStatus.RESOLVED&&" • Expired"]})]}),t.jsx(on,{children:i||""})]}),t.jsx(an,{children:o?t.jsx(mn,{children:"Play"}):u})]}):null},In=r.styled_default("div")({name:"Container",class:"cll3md7",propsAsIs:!1}),xn=r.styled_default("button")({name:"ActionBtn",class:"a10g1iik",propsAsIs:!1}),yn=({openInsight:e,questionId:s,...n})=>t.jsxs(In,{children:[t.jsx(De,{questionId:s,...n,isPickHistory:!0}),e&&t.jsx(xn,{onClick:()=>e(s),children:"View Insight"})]}),jn=r.styled_default("div")({name:"Container",class:"cl56x6b",propsAsIs:!1}),gn=()=>b.c,vn=r.styled_default(gn())({name:"ActionButton",class:"a11pzf92",propsAsIs:!0}),Mn=r.styled_default("div")({name:"DateTime",class:"d1hbaleq",propsAsIs:!1}),Tn=r.styled_default("blockquote")({name:"Quote",class:"qvvgqjm",propsAsIs:!1}),An=({openTweet:e,created:s,...n})=>{const i=y.useMemo(()=>{if(s){const o=new Date(s);if(ie(o))return{date:se(o),time:ne(o)}}return null},[s]);return t.jsxs(jn,{children:[i&&t.jsxs(Mn,{children:[i.date," · ",i.time]}),n.title&&t.jsx(Tn,{children:n.title}),t.jsx(b.u,{...n}),e&&t.jsx(vn,{onClick:()=>e(n.tweetId),children:"View Insight"})]})},Nn=r.styled_default("div")({name:"QuestionsContainer",class:"qvghv3l",propsAsIs:!1}),Sn=({questions:e,openQuestion:s})=>t.jsx(Nn,{children:e==null?void 0:e.map(n=>{var i,o,l;if(n.type==="question"&&((i=n.attributes)==null?void 0:i.attributes.case)==="question"){const p=n.attributes.attributes.value;return t.jsx(hn,{openQuestion:s,...p},p.questionId)}if(n.type==="insight"&&((o=n.attributes)==null?void 0:o.attributes.case)==="insight"){const p=n.attributes.attributes.value,c=n.attributes.created;return t.jsx(yn,{openInsight:s,...p,created:c},p.questionId)}if(n.type==="tweet"&&((l=n.attributes)==null?void 0:l.attributes.case)==="tweet"){const p=n.attributes.attributes.value,c=n.attributes.id,u=n.attributes.created;return t.jsx(An,{openTweet:s,...p,tweetId:c,created:u},c)}return null})}),Dn=({store:e,openQuestion:s})=>{const n=L.useStore(e);return n!=null&&n.data?t.jsx(Sn,{openQuestion:s,questions:n.data}):t.jsx("div",{children:"wait questions..."})},zn=({userSummary:e})=>{var s;const[n,i]=y.useState(void 0);return y.useEffect(()=>{const o=e.subscribe(l=>{l!=null&&l.data&&i(l.data)});return()=>{o()}},[e]),n!=null&&n.summary?t.jsx(Ne,{...n.summary,successRate:(s=n.percentage)==null?void 0:s.correct}):t.jsx("div",{children:"wait user..."})},On=({gamification:e})=>{const[s,n]=y.useState(!1),[i,o]=y.useState(P.HOME),l=y.useRef(null),p=y.useRef(0),[c,u]=y.useTransition(),f=x=>{u(()=>o(x))},v=x=>{u(()=>n(x))},N=y.useCallback(ve(()=>{const x=l.current;if(!x)return;const{scrollTop:T}=x;if(T===0){p.current=0,v(!1);return}if(Math.abs(p.current-T)<112)return;const M=p.current<T?"forward":"backward";p.current=T,v(M==="forward")},200),[]);return y.useEffect(()=>{const x=l.current;return x?(i===P.HOME&&x.addEventListener("scroll",N),()=>{x.removeEventListener("scroll",N)}):()=>{}},[i,N]),t.jsxs("div",{style:{height:"100%",display:"flex",flexDirection:"column",overflow:"hidden"},children:[c,t.jsx(b.a,{style:{paddingBottom:"4px",transition:"margin-top 0.2s ease-in-out",marginTop:s?"-56px":"0px"},children:t.jsx(Ss,{activePage:i,toggleActivePage:f})}),i===P.HOME&&t.jsxs(b.r,{ref:l,children:[t.jsx(b.a,{style:{paddingTop:"12px"},children:t.jsx(zn,{userSummary:e.userSummary})}),t.jsx(b.n,{children:t.jsx(Dn,{openQuestion:e.openQuestion,store:e.feedList.getStore()})})]}),i===P.LEADERBOARD&&t.jsx("div",{className:"c1bp9dj2",children:t.jsx(sn,{gamification:e,hideTabs:v})})]})},bn=()=>b.f,je=r.styled_default(bn())({name:"OpenedContainer",class:"oar61gl",propsAsIs:!0}),kn=r.styled_default("div")({name:"UserContainer",class:"u14zaal4",propsAsIs:!1}),Cn=({correct:e,incorrect:s})=>{const n=e+s;return n===0?0:Math.round(e/n*100)},_n=({gamification:e,className:s})=>{const n=L.useStore(e.openedQuestion.$store),i=L.useStore(e.openedUser);return t.jsxs(t.Fragment,{children:[n&&t.jsx(je,{className:s,children:t.jsx(vs,{gamification:e})}),i&&t.jsx(je,{className:s,children:t.jsxs(kn,{children:[t.jsx(Me,{label:"Friend's Rank",close:e.closeUser}),t.jsx(b.a,{children:t.jsx(Ne,{...i,successRate:Cn(i)})})]})}),t.jsx(b.r,{className:s,"data-nav":"true",children:t.jsx(On,{gamification:e})})]})};exports.default=_n;