(globalThis["TURBOPACK_remote_chunk_loading_global_wx-next-web"]||(globalThis["TURBOPACK_remote_chunk_loading_global_wx-next-web"]=[])).push(["object"==typeof document?document.currentScript:void 0,145473,e=>{"use strict";var t=e.i(902875),i=e.i(247865),o=e.i(533760),r=e.i(546446),a=e.i(581014),n=e.i(671525),s=e.i(901351),l=e.i(310847),c=e.i(776169),u=e.i(422825),d=e.i(837879),p=e.i(576816),g=e.i(539353),m=e.i(553329),f=e.i(695881),y=e.i(143851),h=e.i(703123),b=e.i(61284);let w=(0,f.createLogger)("useGoogleLogin");var S=e.i(404893),C=e.i(62544),A=e.i(792461);e.s(["GoogleAuthScriptClient",0,function({onLoad:e,prompt:f=!0,isUserLoggedIn:P,redirectToCheckoutOnSignup:v}){let I=(0,a.useTranslations)("GoogleLogin"),E=(0,r.useSetAtom)(S.googleLoginInitilizedAtom),{loginWithGoogle:k,error:O,clearError:T}=function(e=!1){let t=(0,a.useTranslations)("GoogleLogin"),[o,f]=(0,i.useState)(null),S=(0,r.useSetAtom)(l.userHasLoggedInBeforeAtom),C=(0,r.useAtomValue)(h.gsiEmailStatesAtom),{updateEmailSubscriptions:A}=(0,u.useEmailPreferences)({skipStatus:!0}),{refresh:P}=(0,n.usePageNavigation)(),{syncPreferencesFromUpsx:v}=(0,c.usePreferences)(),{authSuccess:I,authRedirect:E}=(0,y.useUserLogin)(),k=(0,d.useSubscriptionsEnabled)(),O=(0,p.useSignupComplete)({formVariant:"account page google",sensitiveDataAuthorization:!0,deviceTimeZone:"u">typeof Intl?Intl.DateTimeFormat().resolvedOptions().timeZone:void 0}),T=(0,g.useSignupComplete)({formVariant:"account page google",loginMethod:"Google"});return{loginWithGoogle:(0,i.useCallback)(async i=>{let{credential:o}=i;f(null);try{let t=await s.upsxClient.auth.loginWithGoogle({google_id_token:o}),i=t?.isFirstLogin;if(await I({email:t.email,userID:t.userID,type:i?"signup":"login"},!1,{skipSignupCompleteEvent:!!i}),i){let{error:e}=await (0,m.tryCatch)(O());e&&w.warn("Failed to track signup-complete for Google signup",e),T()}let{newsletter:r,weekly:a,onYourRadar:n,marketing:l,alwaysSubscribe:c}=C||{};return(i||c)&&await A({newsletter:r,weekly:a,onYourRadar:n,marketing:l}).catch(e=>{console.error("Failed to update email subscriptions",e)}),i&&e&&k?E(b.PROMO_CHECKOUT_URL):E(),!0}catch(e){console.error("Failed to login with Google",e);try{let i=e?.data,o=i?.messageCode;if(!o)throw Error("No Error Message");switch(o){case 1e3:case 1026:case 1033:f({header:t("emailAlreadyUsedGoogleHeader"),body:t.raw("emailAlreadyUsedGoogleBody")});break;case 1027:case 1030:f({header:t("emailAlreadyRegisteredGoogleHeader"),body:t("emailAlreadyRegisteredGoogleBody")});break;default:throw Error("No Specific Error")}}catch(e){f({header:t("somethingWentWrong")})}return!1}},[S,v,P,I,E,A,C,e,k,O,T]),error:o,clearError:(0,i.useCallback)(()=>{f(null)},[])}}(v),_=(0,A.useRefMemo)(k),R=(0,i.useRef)(null);O&&(R.current=O);let U=R.current;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.default,{src:"https://accounts.google.com/gsi/client",onLoad:()=>{let t=window.google?.accounts?.id;t&&(t.initialize({client_id:"797231885346-rai9vgnvf4u38enai8bhginnnrh5uvch.apps.googleusercontent.com",context:"signin",ux_mode:"popup",use_fedcm_for_prompt:!0,callback:e=>{_.current?.(e)}}),E(!0)),e?.(),!P&&f&&t?.prompt()},id:"google-gsi-script"}),U&&(0,t.jsx)(C.Dialog,{open:!!O,onOpenChange:e=>!e&&T(),children:(0,t.jsx)(C.BasicDialog,{showCloseButton:!1,title:U.header||"",description:(0,t.jsx)("span",{dangerouslySetInnerHTML:{__html:U.body||""}}),primaryAction:{label:I("cancel"),onClick:T}})})]})}],145473)},355200,e=>{"use strict";e.s(["isUnsafeProperty",0,function(e){return"__proto__"===e}])},899507,e=>{"use strict";e.s(["isNil",0,function(e){return null==e}])},449928,760430,e=>{"use strict";e.s(["isPrimitive",0,function(e){return null==e||"object"!=typeof e&&"function"!=typeof e}],449928),e.s(["isTypedArray",0,function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}],760430)},539353,e=>{"use strict";e.i(288906);var t=e.i(247865),i=e.i(546446),o=e.i(540768),r=e.i(682142),a=e.i(782937),n=e.i(695881),s=e.i(333350),l=e.i(64412),c=e.i(950771),u=e.i(537989),d=e.i(695203),p=e.i(158662),g=e.i(358273),m=e.i(777638),f=e.i(727365),y=e.i(896363),h=e.i(924776),b=e.i(605781);let w=(0,n.createLogger)("useSignupComplete"),S=["SUN","MON","TUE","WED","THU","FRI","SAT"],C=new Set(["city","locality","neighborhood","airport","postal","poi","ski","geocode","locid"]),A=new Set(["mapbox","twc-poi","twc-v3-loc-search","twc-v3-loc-point"]),P=["appVersion","cookiesEnabled","dayOfWeek","deviceClass","formVariant","functionalTechnologies","genderFilled","geographicallyRelevantAds","gpcSignalOptOut","hourOfDay","locale","loginMethod","marketingOptedIn","newsletterOptedIn","pageId","partner","physicalCountry","physicalState","priv","regime","sessionId","sessionStartTime","url","wlocCity","wlocCountry","wlocDMA","wlocState"];e.s(["useSignupComplete",0,(e={})=>{let n=(0,i.useAtomValue)(u.pageIdAtom),v=(0,i.useAtomValue)(c.pageLocaleAtom),I=(0,i.useAtomValue)(d.deviceClassAtom),{location:E}=(0,l.useLocation)(),k=(0,i.useAtomValue)(p.experimentJoinListAtom),O=(0,h.useIsHightouchReady)(),T=(0,t.useRef)(!1),{formVariant:_,url:R,loginMethod:U,newsletterOptedIn:D,marketingOptedIn:L,sourcePage:N,sourceModule:G,sourceElement:M,sourcePosition:j}=e,x=(0,t.useMemo)(()=>{if(!s.default)return null;let e=(0,r.getCICookie)(),t=e?.["TWC-GeoIP-Country"]??(0,o.getCookie)("twc-location-country"),i=e?.["TWC-GeoIP-Region"]??(0,o.getCookie)("twc-location-region"),l=e?.["TWC-Privacy"]??(0,o.getCookie)("twc-privacy"),c=window.DprSdk?.getGdprConsentOptInsString()??"",u=window.DprSdk?.getCcpaSaleOptInString()??"",d=window.navigator?.globalPrivacyControl??!1,p=c?.includes("functional-technology")??!1,h=window.DprSdk?.getUserConsent("geographically-relevant-advertising")!==!1,b=navigator?.cookieEnabled??!1,w=(0,o.getCookie)("partner")||"",P=(0,a.getPartnerByPattern)(w)??w,O=(0,g.getMetricsSession)(),T=O?.sessionId||"",x=O?.sessionStartTime||0,B=new Date,F=B.getHours(),V=S[B.getDay()]??"",W=-B.getTimezoneOffset()/60,H=document.referrer,z=(0,f.normalizeWlocType)(E?.type),$=E?.featureSource??null;return{formVariant:_??"",url:R??"",loginMethod:U??"Regular",newsletterOptedIn:D??!1,marketingOptedIn:L??!1,genderFilled:!1,sourcePage:N??null,sourceModule:G??null,sourceElement:M??null,sourcePosition:j??null,pageId:n??"",locale:v,deviceClass:I,sessionId:T,sessionStartTime:x,partner:P,wlocCity:E?.city??null,wlocCountry:E?.countryCode??null,wlocState:E?.adminDistrictCode??null,wlocDMA:E?.dmaCd??null,wlocId:E?.placeId??null,wlocFeatureSource:null!=$&&A.has($)?$:void 0,wlocTags:E?.tags?.length?(0,y.parseArrayToString)(E.tags):null,wlocType:null!==z&&C.has(z)?z:void 0,wlocFeatureId:E?.featureId??null,dayOfWeek:V,regime:l??"",cookiesEnabled:b,gpcSignalOptOut:d,functionalTechnologies:p,geographicallyRelevantAds:h,priv:c,privProducts:u,referrer:H,deviceTimeZone:W,hourOfDay:F,physicalCountry:t??"",physicalState:i??"",interestBasedAds:window.DprSdk?.getUserConsent("interest-based-ads")!==!1,campaign:(0,m.getCampaign)()??void 0,tpcc:(0,m.getTpcc)(),linkReferral:(0,m.getLinkReferral)(),experimentJoinList:k,weatherMode:"normal",appVersion:"e1cd55ed42c3df4379a4f664aebccc293d503720".slice(0,10)}},[_,R,U,D,L,N,G,M,j,n,v,I,E,k]),B=O&&null!==x&&P.every(e=>void 0!==x[e]);return(0,t.useCallback)(()=>{x&&B&&!T.current&&((0,b.trackSignupComplete)(x),T.current=!0,w.info('Hightouch: Event "signup-complete" tracked'))},[x,B])}])},576816,703123,e=>{"use strict";var t=e.i(247865),i=e.i(959194),o=e.i(947118),r=e.i(737801);e.s(["useSignupComplete",0,(e={})=>{let a=(0,o.useIsInitialized)(),n=(0,r.useEventAttributes)(),[s,l]=(0,t.useState)(!1),c=(0,t.useRef)(!1),u=(0,t.useMemo)(()=>{let t={...n,formVariant:e.formVariant,sensitiveDataAuthorization:e.sensitiveDataAuthorization,deviceTimeZone:e.deviceTimeZone,sourcePage:e.sourcePage,sourceModule:e.sourceModule,sourceElement:e.sourceElement,sourcePosition:e.sourcePosition,mParticleGranted:e.mParticleGranted??!0};return void 0!==e.url&&(t.url=e.url),void 0===t.formVariant&&delete t.formVariant,void 0===t.sensitiveDataAuthorization&&delete t.sensitiveDataAuthorization,void 0===t.deviceTimeZone&&delete t.deviceTimeZone,void 0===t.sourcePage&&delete t.sourcePage,void 0===t.sourceModule&&delete t.sourceModule,void 0===t.sourceElement&&delete t.sourceElement,void 0===t.sourcePosition&&delete t.sourcePosition,t},[n,e.formVariant,e.url,e.sensitiveDataAuthorization,e.deviceTimeZone,e.sourcePage,e.sourceModule,e.sourceElement,e.sourcePosition,e.mParticleGranted]);return(0,t.useEffect)(()=>{(0,i.areObjectValuesDefined)(u)&&!s&&l(!0)},[u,s]),(0,t.useCallback)(async()=>{if(a&&s&&!c.current)try{window.mParticle?.logEvent?.("signup-complete",window.mParticle?.EventType?.Other,u),c.current=!0,console.debug(`MParticle: Event "signup-complete" tracked - ${u.pageId}`)}catch(e){console.error('MParticle: Event "signup-complete" failed',e)}},[a,u,s])}],576816);let a=(0,e.i(981030).atom)({});e.s(["gsiEmailStatesAtom",0,a],703123)},658547,592188,e=>{"use strict";var t=e.i(247865),i=e.i(491240);let o=(e,t)=>{let i;return(i=!1,Promise.race([new Promise(e=>{let t=()=>{if(!i){if(window.mParticle?.ready)return void window.mParticle.ready(()=>e());setTimeout(t,50)}};t()}),new Promise((e,t)=>{setTimeout(()=>{t(Error("MParticle did not become ready in time"))},2e3)})]).finally(()=>{i=!0})).then(()=>window.mParticle?.Identity?.[e]?.(t))};e.s(["useUserIdentity",0,()=>{let e=(0,t.useCallback)(e=>o("identify",{userIdentities:{customerid:e.customerid,email:e.email,other:(0,i.truncateIdentityValue)(e.other)}}),[]);return{identify:e,login:(0,t.useCallback)(e=>o("login",{userIdentities:{customerid:e.customerid,email:e.email,facebook:e.facebook,facebookcustomaudienceid:e.facebookcustomaudienceid,google:e.google,microsoft:e.microsoft,other:(0,i.truncateIdentityValue)(e.other),other2:(0,i.truncateIdentityValue)(e.other2),other3:(0,i.truncateIdentityValue)(e.other3),other4:(0,i.truncateIdentityValue)(e.other4),twitter:e.twitter,yahoo:e.yahoo}}),[]),logout:(0,t.useCallback)(()=>o("logout",{userIdentities:{}}),[])}}],658547);var r=e.i(546446),a=e.i(540768),n=e.i(682142),s=e.i(782937),l=e.i(695881),c=e.i(333350),u=e.i(64412),d=e.i(950771),p=e.i(537989),g=e.i(695203),m=e.i(358273),f=e.i(158662),y=e.i(777638),h=e.i(924776),b=e.i(409628),w=e.i(605781);let S=(0,l.createLogger)("useUserLoggedIn");e.s(["useUserLoggedIn",0,(e={})=>{let i=(0,r.useAtomValue)(p.pageIdAtom),o=(0,r.useAtomValue)(d.pageLocaleAtom),l=(0,r.useAtomValue)(g.deviceClassAtom),C=(0,r.useAtomValue)(f.experimentJoinListAtom),{location:A}=(0,u.useLocation)(),P=(0,h.useIsHightouchReady)(),{url:v}=e;return(0,t.useCallback)(()=>{if(!c.default||!P)return;let e=(0,n.getCICookie)(),t=e?.["TWC-GeoIP-Country"]??(0,a.getCookie)("twc-location-country"),r=e?.["TWC-GeoIP-Region"]??(0,a.getCookie)("twc-location-region"),u=e?.["TWC-Privacy"]??(0,a.getCookie)("twc-privacy"),d=window.DprSdk?.getGdprConsentOptInsString()??"",p=window.DprSdk?.getCcpaSaleOptInString()??"",g=window.navigator?.globalPrivacyControl??!1,f=d?.includes("functional-technology")??!1,h=window.DprSdk?.getUserConsent("geographically-relevant-advertising")!==!1,I=navigator?.cookieEnabled??!1,E=(0,a.getCookie)("partner")||"",k=(0,s.getPartnerByPattern)(E)??E,O=(0,m.getMetricsSession)(),T=O?.sessionId||"",_=O?.sessionStartTime||0,R=new Date,U=R.getHours(),D=b.WEEK_DAYS[R.getDay()]??"",L=-R.getTimezoneOffset()/60,N=document.referrer,G={url:v??window.location.pathname,referrer:N,privProducts:p,deviceTimeZone:L,pageId:i??"",locale:o,deviceClass:l,sessionId:T,sessionStartTime:_,partner:k,wlocCity:A?.city??null,wlocCountry:A?.countryCode??null,wlocState:A?.adminDistrictCode??null,wlocDMA:A?.dmaCd??null,dayOfWeek:D,regime:u??"",cookiesEnabled:I,gpcSignalOptOut:g,functionalTechnologies:f,geographicallyRelevantAds:h,priv:d,hourOfDay:U,physicalCountry:t??"",physicalState:r??"",campaign:(0,y.getCampaign)()??void 0,tpcc:(0,y.getTpcc)(),linkReferral:(0,y.getLinkReferral)(),experimentJoinList:C,weatherMode:"normal",appVersion:"e1cd55ed42c3df4379a4f664aebccc293d503720".slice(0,10)};(0,w.trackUserLoggedin)(G),S.info('Hightouch: Event "user-loggedin" tracked')},[v,i,o,l,C,A,P])}],592188)},459598,e=>{"use strict";let t=()=>{let e,t=!1;return{suppressNext:()=>{t=!0,clearTimeout(e),e=setTimeout(()=>{t=!1},2e3)},consume:()=>!!t&&(t=!1,clearTimeout(e),!0)}},i=t(),o=t(),r=i.suppressNext,a=i.consume,n=o.suppressNext,s=o.consume;e.s(["consumeHightouchPurchaseAbandonSuppression",0,s,"consumePurchaseAbandonSuppression",0,a,"suppressNextHightouchPurchaseAbandon",0,n,"suppressNextPurchaseAbandon",0,r])},952582,(e,t,i)=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.DEFAULT_SUBSCRIPTIONS=i.ON_YOUR_RADAR_GROUP=i.MARKETING_EMAILS_GROUP=i.WEEKLY_BRIEF_GROUP=i.DAILY_NEWSLETTERS_GROUP=void 0,i.DAILY_NEWSLETTERS_GROUP="daily-newsletters-1",i.WEEKLY_BRIEF_GROUP="weekly-brief",i.MARKETING_EMAILS_GROUP="marketing-emails-1",i.ON_YOUR_RADAR_GROUP="on-your-radar",i.DEFAULT_SUBSCRIPTIONS=[{subscriptionGroupName:i.DAILY_NEWSLETTERS_GROUP,subscriptionGroupId:"",isSubscribed:!1,attributes:{location:""}},{subscriptionGroupName:i.WEEKLY_BRIEF_GROUP,subscriptionGroupId:"",isSubscribed:!1},{subscriptionGroupName:i.MARKETING_EMAILS_GROUP,subscriptionGroupId:"",isSubscribed:!1},{subscriptionGroupName:i.ON_YOUR_RADAR_GROUP,subscriptionGroupId:"",isSubscribed:!1}]},370220,(e,t,i)=>{"use strict";e.i(288906),Object.defineProperty(i,"__esModule",{value:!0}),i.getEmailPreferencesStatusUrlConfig=function(){return{host:o,protocol:"https",pathname:"/api/v1/email-preferences/status"}},i.getEmailPreferencesSetUrlConfig=function(){return{host:o,protocol:"https",pathname:"/api/v1/email-preferences/set"}},i.getEmailPreferencesChangeEmailUrlConfig=function(){return{host:o,protocol:"https",pathname:"/api/v1/email-preferences/change-email"}};let o="weather.com"},454307,(e,t,i)=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.setEmailPreferences=n,i.updateSubscription=s;let o=e.r(678651),r=e.r(414655),a=e.r(370220);async function n(e){let t=(0,a.getEmailPreferencesSetUrlConfig)(),i=(0,o.urlFrom)(t),n=JSON.stringify(function(e){let{subscriptions:t,email:i,mParticleId:o}=e,r={};return t&&(r.subscriptions=t),i&&(r.email=i),o&&(r.mParticleId=o),r}(e)),s=await fetch(i,{method:"PUT",credentials:"include",headers:{"Content-Type":"application/json"},body:n});return 200===s.status||400===s.status?await s.json():(0,r.handleFetchResponse)(s)}async function s(e,t,i){return n({subscriptions:[{subscriptionGroupName:e,isSubscribed:t,...i&&{attributes:i}}]})}},451086,(e,t,i)=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.getEmailPreferencesStatus=n;let o=e.r(678651),r=e.r(414655),a=e.r(370220);async function n(){let e=(0,a.getEmailPreferencesStatusUrlConfig)(),t=(0,o.urlFrom)(e),i=await fetch(t,{method:"GET",credentials:"include",headers:{"Content-Type":"application/json"},next:{revalidate:60}});return(0,r.handleFetchResponse)(i)}},935807,e=>{"use strict";function t(e,i=[],r=!1,a="US",n){let s,l=i.find(t=>t.placeID===e.placeId);if(l&&r){let t=l.userTag||l.name;if(t&&"Other"!==t){let i=e.displayName,r=o(e,a,""),n="address"===e.type?e.address:void 0;if(t!==i&&t!==r&&t!==n)return t}}if(e?.disputedCountries)s=e.displayName||"";else{switch(e?.type){case"address":s=e?.address?.split(",")[0]?.trim()||"";break;case"city":s=e?.locale?.locale2||"";break;case"locality":s=e?.locale?.locale3||"";break;case"neighborhood":s=e?.locale?.locale4||"";break;case"airport":s=e?.airportName||"";break;case"postal":{let t=e?.locale?.locale4||e?.locale?.locale3||e?.locale?.locale2||"",i=e?.postalCode||"";s=n?`${t} ${i}`.trim():`${t}`.trim();break}default:s=e?.displayName||""}0===s.length&&(s=e?.displayName||"")}return s}function i(e,t=[],r=!1,a="US",n){let s,l=t.find(t=>t.placeID===e.placeId);if(l&&r){let t=l.userTag||l.name;if(t&&"Other"!==t){let i=e.displayName,r=o(e,a,"");if(t!==i&&t!==r)return function(e,t="US"){if(e?.disputedCountries)return e?.displayName||"";let i=t===e?.countryCode?"":e?.country||"";switch(e?.type){case"city":{let t=e?.adminDistrict||"";return[e?.locale?.locale2||"",t,i].filter(Boolean).join(", ")}case"locality":{let t=e?.adminDistrict||e?.locale?.locale2||"";return[e.locale?.locale3||"",t,i].filter(Boolean).join(", ")}case"neighborhood":{let t=e?.adminDistrict||"";return[e?.locale?.locale4||"",e?.locale?.locale3||e?.locale?.locale2||"",t,i].filter(Boolean).join(", ")}case"postal":{let t=e?.adminDistrict||"",o=e?.postalCode||"";return[e?.locale?.locale4||e?.locale?.locale3||e?.locale?.locale2||"",`${t} ${o}`.trim(),i].filter(Boolean).join(", ")}default:{let t=e?.adminDistrict||"";return[e?.locale?.locale2||"",t,i].filter(Boolean).join(", ")}}}(e,a)}}if(e?.disputedCountries)s=e?.displayName||"";else{let t=a===e?.countryCode?"":e?.country||"",i=e?.adminDistrict||"",o=e?.postalCode||"",r=e.city||"";switch(e?.type){case"address":s=[r,i,t].filter(Boolean).join(", ");break;case"city":default:s=[i,t].filter(Boolean).join(", ");break;case"locality":s=[e?.locale?.locale2||"",i,t].filter(Boolean).join(", ");break;case"neighborhood":s=[e?.locale?.locale3||e?.locale?.locale2||"",i,t].filter(Boolean).join(", ");break;case"postal":{let r=i||e?.locale?.locale2||"";s=[n?`${r} ${o}`.trim():r,t].filter(Boolean).join(", ")}}}return s}function o(e,t,i){let{displayName:o,adminDistrictCode:r,adminDistrict:a,countryCode:n,disputedArea:s,country:l}=e,c=[];return o&&c.push(o),"IL"!==t&&(r?c.push(r):a&&c.push(a)),n!==t&&!1===s&&l&&c.push(l),c.join(i)}e.s(["getLocationContext",0,i,"getLocationName",0,t,"getLocationPresentationName",0,function(e,o=[],r=!1,a="US"){let n=t(e,o,r,a,!1),s=i(e,o,r,a,!0),l=e?.separator?e?.separator:n&&s?", ":"";return`${n}${l}${s}`.trim()}])},919101,e=>{"use strict";e.s(["getAddressForLocationData",0,(e,t)=>{if(!e||!Array.isArray(t))return e;let i=t.find(t=>t.placeId===e.placeId);return i?{...e,displayName:i.address,address:i.address}:e}])},404893,e=>{"use strict";let t=(0,e.i(981030).atom)(!1);e.s(["googleLoginInitilizedAtom",0,t])},143851,e=>{"use strict";var t=e.i(546446),i=e.i(245943),o=e.i(45846),r=e.i(310847),a=e.i(776169),n=e.i(671525),s=e.i(658547),l=e.i(18358),c=e.i(592188),u=e.i(539353),d=e.i(521350),p=e.i(756227),g=e.i(553329),m=e.i(358273),f=e.i(459598);let y=(0,e.i(695881).createLogger)("useUserLogin");e.s(["useUserLogin",0,function(){let e=(0,t.useSetAtom)(r.userHasLoggedInBeforeAtom),h=(0,p.useResetAuthState)(),b=(0,t.useAtomValue)(r.wxuLoginRedirectPageAtom),w=(0,t.useAtomValue)(r.wxuUserAnonymousIdAtom),{syncPreferencesFromUpsx:S,updatePreferences:C}=(0,a.usePreferences)(),{navigate:A}=(0,n.default)(),{login:P}=(0,s.useUserIdentity)(),v=(0,l.useTrackEvent)(),I=(0,c.useUserLoggedIn)(),E=(0,u.useSignupComplete)({url:window.location.pathname}),k=e=>{(0,m.regenerateMetricsSession)(),(0,f.suppressNextPurchaseAbandon)(),(0,f.suppressNextHightouchPurchaseAbandon)();let t=new URLSearchParams(window.location.search).get("ref");A(e??(t&&`https://${t}`)??b)},O=async(t,i=!0,r={})=>{h(),(0,d.isLocalStorageAvailable)()&&localStorage.setItem("PARTNERS_SYNC","true"),e(!0),await S()||await C({});try{await o.upsxClient.purchase.getPurchaseToken()}catch(e){console.error("Failed to get UPSX token:",e)}if(t?.userID){let{error:e}=await (0,g.tryCatch)(P({email:t.email,customerid:t.userID,other:w}));e&&y.error("Failed to establish mParticle identity:",e);let i="signup"===t.type,o=i&&r.skipSignupCompleteEvent;o||v(i?"signup-complete":"user-loggedin",{url:window.location.pathname}),i&&!o&&E(),i||I()}i&&k()};return{login:async(e,t)=>{try{let i=await o.upsxClient.auth.login({email:e,password:t});if(!i)return{success:!1,error:{}};return await O({email:i.email,userID:i.userID,type:"login"}),{success:!0}}catch(e){if(console.error("Failed to login",e),e instanceof i.APIError){let t=e.data;return{success:!1,error:{code:e.code,...t}}}return{success:!1,error:{}}}},authSuccess:O,authRedirect:k}}])},61284,e=>{"use strict";e.s(["PROMO_CHECKOUT_URL",0,"/subscribe/checkout?products=e251f39b-afd7-4ad9-9c87-5e2a8ed63fbb&promoCode=5OFF&tpcc=mktg-5OFF-reg"])},422825,e=>{"use strict";var t=e.i(546446),i=e.i(381477),o=e.i(899507),r=e.i(449928),a=e.i(760430);function n(e){if((0,r.isPrimitive)(e))return e;if(Array.isArray(e)||(0,a.isTypedArray)(e)||e instanceof ArrayBuffer||"u">typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer)return e.slice(0);let t=Object.getPrototypeOf(e),i=t.constructor;if(e instanceof Date||e instanceof Map||e instanceof Set)return new i(e);if(e instanceof RegExp){let t=new i(e);return t.lastIndex=e.lastIndex,t}if(e instanceof DataView)return new i(e.buffer.slice(0));if(e instanceof Error){let t=new i(e.message);return t.stack=e.stack,t.name=e.name,t.cause=e.cause,t}return"u">typeof File&&e instanceof File?new i([e],e.name,{type:e.type,lastModified:e.lastModified}):"object"==typeof e?Object.assign(Object.create(t),e):e}var s=e.i(355200);function l(e){if(!e||"object"!=typeof e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&"[object Object]"===Object.prototype.toString.call(e)}function c(e,t,i){let o=Object.keys(t);for(let r=0;r"boolean"==typeof e?{isSubscribed:e}:e;e.s(["useEmailPreferences",0,({forceSubs:e,skipStatus:r}={})=>{let[a,s]=(0,t.useAtom)(p.emailPreferencesAtom),{user:b}=(0,g.useUser)(),w=(0,y.useSubscriptionsEnabled)()||e,S=b?.userID||null,C=(0,f.useCallback)(e=>{if(S){var t;let i,o;s({userId:S,expiry:Date.now()+9e5,subscriptions:(t=a?.subscriptions,i=t?.length?t:m.DEFAULT_SUBSCRIPTIONS,o={},e?(i?.forEach(e=>{o[e.subscriptionGroupName]=e}),e.forEach(e=>{let t=o[e.subscriptionGroupName]||{};o[e.subscriptionGroupName]=c(n(t),e,function e(t,i){if(Array.isArray(i))if(Array.isArray(t))return c(n(t),i,e);else return c([],i,e);if(l(i))if(l(t))return c(n(t),i,e);else return c({},i,e)})}),Object.values(o)):i)})}},[S,s,a?.subscriptions]),A=a&&a.userId===S&&a.expiry&&a.expiry>Date.now(),P=w&&S&&!A,{isLoading:v}=(0,i.default)(!r&&P?`getEmailPreferencesStatus/${S}`:void 0,d.getEmailPreferencesStatus,{shouldRetryOnError:e=>!(e instanceof Error&&e.message.includes("401")),revalidateOnFocus:!1,revalidateOnReconnect:!1,refreshInterval:0,errorRetryCount:2,onSuccess:e=>{S&&e&&C(e.subscriptions)}}),I=(0,f.useCallback)(async e=>{if(!w)return{status:"error",error:"Subscription is not enabled!"};let t=await (0,u.setEmailPreferences)({subscriptions:e});return"success"===t.status&&C(e),t},[C,w,a?.subscriptions]),E=(0,f.useCallback)(async({newsletter:e,weekly:t,onYourRadar:i,marketing:r})=>{let a=[!(0,o.isNil)(e)&&{subscriptionGroupName:"daily-newsletters-1",...h(e)},!(0,o.isNil)(t)&&{subscriptionGroupName:"weekly-brief",...h(t)},!(0,o.isNil)(i)&&{subscriptionGroupName:"on-your-radar",...h(i)},!(0,o.isNil)(r)&&{subscriptionGroupName:"marketing-emails-1",...h(r)}].filter(Boolean);return await I(a)},[I]);return{emailSubscriptions:A?a.subscriptions:null,updateEmailSubscriptions:E,updateEmailPreference:I,isLoadingPreferences:v}}],422825)}]);