!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="811d7cc3-e38f-4aab-836b-e960b7ca3c3b",e._sentryDebugIdIdentifier="sentry-dbid-811d7cc3-e38f-4aab-836b-e960b7ca3c3b")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[37640],{37640:(e,t,s)=>{s.r(t),s.d(t,{SurveyBanner:()=>k,default:()=>_});var n=s(6029),r=s(28349),a=s(21501),i=s(76356),l=s(55729),d=s(90248),o=s(52466),u=s(74610),p=s(15341),c=s(44900),m=function(e){return e.Started="started",e.Rejected="rejected",e.Postponed="postponed",e.Impression="impression",e}({}),f=s(21377),h=s(4967),v=s(81278),y=s(494),g=s(90438),S=s(72753),w=s(14831),C=s(75040),b=s(69660);let x=(e,t)=>({type:b.D.UPDATE_SURVEY,payload:{surveyId:e,survey:t}}),E=()=>({type:b.D.ADD_PAGEVIEW}),j=()=>({type:b.D.SET_LAST_VISIT});var D=s(31830);function k(){let{isOpen:e,hideForever:t,hideUntilTomorrow:s}=function(e){var t,s,n;let r,a=(0,y.d4)(S.LQ),i=(0,D.A)(),d=(0,v.useRouter)(),{surveys:o,rehydrated:u}=(0,y.d4)(e=>{var t;let{uicontrols:s}=e;return{surveys:s.surveys,rehydrated:null==(t=s._persist)?void 0:t.rehydrated}}),p=(0,y.wA)(),[c,k]=(0,l.useState)(!1),[A,_]=(0,l.useState)(!1),[T,R]=(0,l.useState)(!1),I=o[e.id];(0,l.useEffect)(()=>{u&&p(E())},[u]),(0,l.useEffect)(()=>{let e=()=>{p(E())};return v.Router.events.on("routeChangeComplete",e),()=>{v.Router.events.off("routeChangeComplete",e)}},[]),(0,l.useEffect)(()=>{let t=(0,C.a)(d,d.asPath);return e.showOnSelectedSport&&t!==e.showOnSelectedSport?void _(!1):e.pages?void _(e.pages.includes(d.pathname)):void _(e.showOnSelectedSport&&e.showOnSelectedSport===t||!e.showOnSelectedSport&&(!t||t===f.QCR.Football)&&d.pathname===g.xW.EventList)},[d.asPath]),(0,l.useEffect)(()=>{let t;if(u&&!o[e.id]&&p((t=e.id,{type:b.D.ADD_SURVEY,payload:{id:t}})),!T&&o[e.id]){let t=(0,h.Ui)(o[e.id].lastVisit,(0,h.ZV)(),"minute");1===t?(p({type:b.D.INCREASE_DAY_STREAK}),p(j())):t>=2&&(p({type:b.D.RESET_DAY_STREAK}),p(j())),R(!0)}},[o,u]);let U=(0,l.useCallback)(t=>{let s={...I,hiddenUntil:-1};t===m.Started&&(s.started=!0),p(x(e.id,s))},[]),P=(0,l.useCallback)(()=>{p(x(e.id,{...I,hiddenUntil:Date.now()+864e5}))},[]),V=!!a&&(e.supportedCountries?e.supportedCountries.includes(a.toUpperCase()):!e.unsupportedCountries||!e.unsupportedCountries.includes(a.toUpperCase()))&&!!i&&(e.supportedLanguages?e.supportedLanguages.includes(i.toUpperCase()):!e.unsupportedLanguages||!e.unsupportedLanguages.includes(i.toUpperCase())),L=-1===(r=(null==I?void 0:I.hiddenUntil)||0)||r>=Date.now(),O=!!e.minRequiredPageviews&&(null==I?void 0:I.pageViewCount)!==void 0&&(null==I?void 0:I.pageViewCount)>=e.minRequiredPageviews,Y=null==(t=e.andPreconditions)?void 0:t.every(e=>{var t;return null==(t=o[e])?void 0:t.started}),B=null==(s=e.orPreconditions)?void 0:s.some(e=>{var t;return null==(t=o[e])?void 0:t.started}),K=function(e){let t=(0,h.ZV)();return e.startTimestamp&&e.endTimestamp?e.startTimestamp<=t&&e.endTimestamp>t:e.startTimestamp&&!e.endTimestamp?e.startTimestamp<=t:!!e.startTimestamp||!e.endTimestamp||e.endTimestamp>t}(e),M=!e.mustBeLoggedIn||(0,w.x3)(),N=!e.usageStreakMinDays||e.usageStreakMinDays===(null==(n=o[e.id])?void 0:n.dayStreak);return(0,l.useEffect)(()=>{let t=V&&!L&&O&&!Y&&!B&&K&&M&&A&&N;e.showAfterXSeconds&&!c?setTimeout(()=>{k(t)},1e3*e.showAfterXSeconds):k(t)},[V,L,O,Y,B,K,M,A,N]),{isOpen:c,hideForever:U,hideUntilTomorrow:P}}(c.r),a=(0,l.useCallback)(()=>{t(m.Started)},[t]),u=(0,l.useCallback)(()=>{t(m.Rejected)},[t]),p=(0,l.useCallback)(()=>{s()},[s]);return e?(0,n.jsxs)(r.aF,{isOpen:e,maxW:"[380px]",p:"lg",children:[(0,n.jsxs)(i.so,{justify:"space-between",align:"flex-start",gap:"sm",children:[(0,n.jsxs)(i.so,{direction:"column",gap:"sm",pb:"xl",children:[(0,n.jsx)(r.EY,{textStyle:"display.medium",children:(0,n.jsx)(d.A,{id:"help.us.improve"})}),(0,n.jsx)(r.EY,{children:(0,n.jsx)(d.A,{id:"short.survey"})})]}),(0,n.jsx)(r.K0,{size:"primary",variant:"clear",onClick:u,children:(0,n.jsx)(o.zQC,{icon:"close",fill:"primary.default"})})]}),(0,n.jsxs)(i.so,{justify:"flex-end",gap:"lg",children:[(0,n.jsx)(r.$n,{variant:"clear",onClick:p,children:(0,n.jsx)(d.A,{id:"ask.me.later"})}),(0,n.jsx)("a",{href:c.r.url,target:"_blank",rel:"noreferrer nofollow noopener",onClick:a,children:(0,n.jsx)(r.$n,{onClick:a,children:(0,n.jsx)(d.A,{id:"yes"})})})]})]}):null}function A(){let[e,t,s]=(0,p.A)("showSurvey".concat(c.r.id),void 0);return(0,l.useEffect)(()=>{if(null==e||!e.show)if(c.r.sample){let s=e&&e.sample!==c.r.sample&&!e.show;(!e||s)&&t({show:Math.random()<=c.r.sample,sample:c.r.sample})}else t({show:!0,sample:void 0})},[e]),s&&(null==e?void 0:e.show)?(0,n.jsx)(k,{}):null}function _(){return(0,a.hX)()||c.r.disabled?null:(0,n.jsx)(u.t,{tag:"SurveyBanner",children:(0,n.jsx)(A,{})})}}}]);