(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,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)},729496,e=>{"use strict";let t=(0,e.i(514514).default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);e.s(["Check",0,t],729496)},163163,e=>{"use strict";let t=(0,e.i(514514).default)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);e.s(["Info",0,t],163163)},23071,e=>{"use strict";let t=(0,e.i(514514).default)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);e.s(["Loader2",0,t],23071)},539353,e=>{"use strict";e.i(288906);var t=e.i(247865),r=e.i(546446),i=e.i(540768),n=e.i(682142),a=e.i(782937),s=e.i(695881),l=e.i(333350),o=e.i(64412),u=e.i(950771),c=e.i(537989),d=e.i(695203),m=e.i(158662),p=e.i(358273),f=e.i(777638),g=e.i(727365),h=e.i(896363),v=e.i(924776),b=e.i(605781);let y=(0,s.createLogger)("useSignupComplete"),w=["SUN","MON","TUE","WED","THU","FRI","SAT"],x=new Set(["city","locality","neighborhood","airport","postal","poi","ski","geocode","locid"]),E=new Set(["mapbox","twc-poi","twc-v3-loc-search","twc-v3-loc-point"]),S=["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 s=(0,r.useAtomValue)(c.pageIdAtom),C=(0,r.useAtomValue)(u.pageLocaleAtom),I=(0,r.useAtomValue)(d.deviceClassAtom),{location:A}=(0,o.useLocation)(),k=(0,r.useAtomValue)(m.experimentJoinListAtom),P=(0,v.useIsHightouchReady)(),R=(0,t.useRef)(!1),{formVariant:N,url:j,loginMethod:O,newsletterOptedIn:_,marketingOptedIn:D,sourcePage:U,sourceModule:T,sourceElement:M,sourcePosition:L}=e,G=(0,t.useMemo)(()=>{if(!l.default)return null;let e=(0,n.getCICookie)(),t=e?.["TWC-GeoIP-Country"]??(0,i.getCookie)("twc-location-country"),r=e?.["TWC-GeoIP-Region"]??(0,i.getCookie)("twc-location-region"),o=e?.["TWC-Privacy"]??(0,i.getCookie)("twc-privacy"),u=window.DprSdk?.getGdprConsentOptInsString()??"",c=window.DprSdk?.getCcpaSaleOptInString()??"",d=window.navigator?.globalPrivacyControl??!1,m=u?.includes("functional-technology")??!1,v=window.DprSdk?.getUserConsent("geographically-relevant-advertising")!==!1,b=navigator?.cookieEnabled??!1,y=(0,i.getCookie)("partner")||"",S=(0,a.getPartnerByPattern)(y)??y,P=(0,p.getMetricsSession)(),R=P?.sessionId||"",G=P?.sessionStartTime||0,F=new Date,B=F.getHours(),V=w[F.getDay()]??"",W=-F.getTimezoneOffset()/60,K=document.referrer,Y=(0,g.normalizeWlocType)(A?.type),q=A?.featureSource??null;return{formVariant:N??"",url:j??"",loginMethod:O??"Regular",newsletterOptedIn:_??!1,marketingOptedIn:D??!1,genderFilled:!1,sourcePage:U??null,sourceModule:T??null,sourceElement:M??null,sourcePosition:L??null,pageId:s??"",locale:C,deviceClass:I,sessionId:R,sessionStartTime:G,partner:S,wlocCity:A?.city??null,wlocCountry:A?.countryCode??null,wlocState:A?.adminDistrictCode??null,wlocDMA:A?.dmaCd??null,wlocId:A?.placeId??null,wlocFeatureSource:null!=q&&E.has(q)?q:void 0,wlocTags:A?.tags?.length?(0,h.parseArrayToString)(A.tags):null,wlocType:null!==Y&&x.has(Y)?Y:void 0,wlocFeatureId:A?.featureId??null,dayOfWeek:V,regime:o??"",cookiesEnabled:b,gpcSignalOptOut:d,functionalTechnologies:m,geographicallyRelevantAds:v,priv:u,privProducts:c,referrer:K,deviceTimeZone:W,hourOfDay:B,physicalCountry:t??"",physicalState:r??"",interestBasedAds:window.DprSdk?.getUserConsent("interest-based-ads")!==!1,campaign:(0,f.getCampaign)()??void 0,tpcc:(0,f.getTpcc)(),linkReferral:(0,f.getLinkReferral)(),experimentJoinList:k,weatherMode:"normal",appVersion:"e1cd55ed42c3df4379a4f664aebccc293d503720".slice(0,10)}},[N,j,O,_,D,U,T,M,L,s,C,I,A,k]),F=P&&null!==G&&S.every(e=>void 0!==G[e]);return(0,t.useCallback)(()=>{G&&F&&!R.current&&((0,b.trackSignupComplete)(G),R.current=!0,y.info('Hightouch: Event "signup-complete" tracked'))},[G,F])}])},279887,e=>{"use strict";var t=e.i(947118),r=e.i(737801),i=e.i(247865);e.s(["useTrackEmailSubscription",0,()=>{let e="alert-subscription-changed",n=(0,t.useIsInitialized)(),a=(0,r.useEventAttributes)();return(0,i.useCallback)(({name:t,status:r})=>{let i={...a,name:t,status:r?"enabled":"disabled"};if(!n)return void console.warn("MParticle is not initialized");try{window.mParticle?.logEvent?.(e,window.mParticle?.EventType?.Other,i),console.debug(`MParticle: Event "${e}" tracked`,i)}catch(t){console.error(`MParticle: Event "${e}" failed`,t)}},[a,n])}])},658547,592188,e=>{"use strict";var t=e.i(247865),r=e.i(491240);let i=(e,t)=>{let r;return(r=!1,Promise.race([new Promise(e=>{let t=()=>{if(!r){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(()=>{r=!0})).then(()=>window.mParticle?.Identity?.[e]?.(t))};e.s(["useUserIdentity",0,()=>{let e=(0,t.useCallback)(e=>i("identify",{userIdentities:{customerid:e.customerid,email:e.email,other:(0,r.truncateIdentityValue)(e.other)}}),[]);return{identify:e,login:(0,t.useCallback)(e=>i("login",{userIdentities:{customerid:e.customerid,email:e.email,facebook:e.facebook,facebookcustomaudienceid:e.facebookcustomaudienceid,google:e.google,microsoft:e.microsoft,other:(0,r.truncateIdentityValue)(e.other),other2:(0,r.truncateIdentityValue)(e.other2),other3:(0,r.truncateIdentityValue)(e.other3),other4:(0,r.truncateIdentityValue)(e.other4),twitter:e.twitter,yahoo:e.yahoo}}),[]),logout:(0,t.useCallback)(()=>i("logout",{userIdentities:{}}),[])}}],658547);var n=e.i(546446),a=e.i(540768),s=e.i(682142),l=e.i(782937),o=e.i(695881),u=e.i(333350),c=e.i(64412),d=e.i(950771),m=e.i(537989),p=e.i(695203),f=e.i(358273),g=e.i(158662),h=e.i(777638),v=e.i(924776),b=e.i(409628),y=e.i(605781);let w=(0,o.createLogger)("useUserLoggedIn");e.s(["useUserLoggedIn",0,(e={})=>{let r=(0,n.useAtomValue)(m.pageIdAtom),i=(0,n.useAtomValue)(d.pageLocaleAtom),o=(0,n.useAtomValue)(p.deviceClassAtom),x=(0,n.useAtomValue)(g.experimentJoinListAtom),{location:E}=(0,c.useLocation)(),S=(0,v.useIsHightouchReady)(),{url:C}=e;return(0,t.useCallback)(()=>{if(!u.default||!S)return;let e=(0,s.getCICookie)(),t=e?.["TWC-GeoIP-Country"]??(0,a.getCookie)("twc-location-country"),n=e?.["TWC-GeoIP-Region"]??(0,a.getCookie)("twc-location-region"),c=e?.["TWC-Privacy"]??(0,a.getCookie)("twc-privacy"),d=window.DprSdk?.getGdprConsentOptInsString()??"",m=window.DprSdk?.getCcpaSaleOptInString()??"",p=window.navigator?.globalPrivacyControl??!1,g=d?.includes("functional-technology")??!1,v=window.DprSdk?.getUserConsent("geographically-relevant-advertising")!==!1,I=navigator?.cookieEnabled??!1,A=(0,a.getCookie)("partner")||"",k=(0,l.getPartnerByPattern)(A)??A,P=(0,f.getMetricsSession)(),R=P?.sessionId||"",N=P?.sessionStartTime||0,j=new Date,O=j.getHours(),_=b.WEEK_DAYS[j.getDay()]??"",D=-j.getTimezoneOffset()/60,U=document.referrer,T={url:C??window.location.pathname,referrer:U,privProducts:m,deviceTimeZone:D,pageId:r??"",locale:i,deviceClass:o,sessionId:R,sessionStartTime:N,partner:k,wlocCity:E?.city??null,wlocCountry:E?.countryCode??null,wlocState:E?.adminDistrictCode??null,wlocDMA:E?.dmaCd??null,dayOfWeek:_,regime:c??"",cookiesEnabled:I,gpcSignalOptOut:p,functionalTechnologies:g,geographicallyRelevantAds:v,priv:d,hourOfDay:O,physicalCountry:t??"",physicalState:n??"",campaign:(0,h.getCampaign)()??void 0,tpcc:(0,h.getTpcc)(),linkReferral:(0,h.getLinkReferral)(),experimentJoinList:x,weatherMode:"normal",appVersion:"e1cd55ed42c3df4379a4f664aebccc293d503720".slice(0,10)};(0,y.trackUserLoggedin)(T),w.info('Hightouch: Event "user-loggedin" tracked')},[C,r,i,o,x,E,S])}],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)}},r=t(),i=t(),n=r.suppressNext,a=r.consume,s=i.suppressNext,l=i.consume;e.s(["consumeHightouchPurchaseAbandonSuppression",0,l,"consumePurchaseAbandonSuppression",0,a,"suppressNextHightouchPurchaseAbandon",0,s,"suppressNextPurchaseAbandon",0,n])},952582,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.DEFAULT_SUBSCRIPTIONS=r.ON_YOUR_RADAR_GROUP=r.MARKETING_EMAILS_GROUP=r.WEEKLY_BRIEF_GROUP=r.DAILY_NEWSLETTERS_GROUP=void 0,r.DAILY_NEWSLETTERS_GROUP="daily-newsletters-1",r.WEEKLY_BRIEF_GROUP="weekly-brief",r.MARKETING_EMAILS_GROUP="marketing-emails-1",r.ON_YOUR_RADAR_GROUP="on-your-radar",r.DEFAULT_SUBSCRIPTIONS=[{subscriptionGroupName:r.DAILY_NEWSLETTERS_GROUP,subscriptionGroupId:"",isSubscribed:!1,attributes:{location:""}},{subscriptionGroupName:r.WEEKLY_BRIEF_GROUP,subscriptionGroupId:"",isSubscribed:!1},{subscriptionGroupName:r.MARKETING_EMAILS_GROUP,subscriptionGroupId:"",isSubscribed:!1},{subscriptionGroupName:r.ON_YOUR_RADAR_GROUP,subscriptionGroupId:"",isSubscribed:!1}]},370220,(e,t,r)=>{"use strict";e.i(288906),Object.defineProperty(r,"__esModule",{value:!0}),r.getEmailPreferencesStatusUrlConfig=function(){return{host:i,protocol:"https",pathname:"/api/v1/email-preferences/status"}},r.getEmailPreferencesSetUrlConfig=function(){return{host:i,protocol:"https",pathname:"/api/v1/email-preferences/set"}},r.getEmailPreferencesChangeEmailUrlConfig=function(){return{host:i,protocol:"https",pathname:"/api/v1/email-preferences/change-email"}};let i="weather.com"},454307,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.setEmailPreferences=s,r.updateSubscription=l;let i=e.r(678651),n=e.r(414655),a=e.r(370220);async function s(e){let t=(0,a.getEmailPreferencesSetUrlConfig)(),r=(0,i.urlFrom)(t),s=JSON.stringify(function(e){let{subscriptions:t,email:r,mParticleId:i}=e,n={};return t&&(n.subscriptions=t),r&&(n.email=r),i&&(n.mParticleId=i),n}(e)),l=await fetch(r,{method:"PUT",credentials:"include",headers:{"Content-Type":"application/json"},body:s});return 200===l.status||400===l.status?await l.json():(0,n.handleFetchResponse)(l)}async function l(e,t,r){return s({subscriptions:[{subscriptionGroupName:e,isSubscribed:t,...r&&{attributes:r}}]})}},451086,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.getEmailPreferencesStatus=s;let i=e.r(678651),n=e.r(414655),a=e.r(370220);async function s(){let e=(0,a.getEmailPreferencesStatusUrlConfig)(),t=(0,i.urlFrom)(e),r=await fetch(t,{method:"GET",credentials:"include",headers:{"Content-Type":"application/json"},next:{revalidate:60}});return(0,n.handleFetchResponse)(r)}},695478,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.findSubscriptionGroup=void 0,r.getMorningBriefAttrs=function(e){return{location:e.placeId,latitude:e.latitude,longitude:e.longitude,dmaCode:e.dmaCd||null,adminDistrict:e.adminDistrict,adminDistrictCode:e.adminDistrictCode||null,postalCode:e.postalCode}},r.findSubscriptionGroup=(e,t,r)=>e&&Array.isArray(e)?e.find(e=>e.subscriptionGroupName===t)||r||null:r||null},882684,e=>{"use strict";var t=e.i(902875),r=e.i(247865),i=e.i(729496),n=e.i(163163),a=e.i(23071),s=e.i(877957),l=e.i(546334),o=e.i(935331);function u({label:e,error:r,className:i,...n}){return(0,t.jsxs)("div",{className:"w-full",children:[e&&(0,t.jsx)("label",{className:"text-sm",children:e}),(0,t.jsx)(o.Input,{...n,className:r?`${i} border-red-500`:i})]})}var c=e.i(240058),d=e.i(730921),m=e.i(611540);function p(){let e=(0,d.useLocale)(),r=(0,m.interpolateUrl)(m.URLS.termsOfUse,{locale:e}),i=(0,m.interpolateUrl)(m.URLS.privacyPolicy,{locale:e});return(0,t.jsxs)("div",{className:"mt-4 text-xs",children:["By signing up you agree to the"," ",(0,t.jsx)(c.default,{href:r,className:"underline",children:"Terms"})," ","&"," ",(0,t.jsx)(c.default,{href:i,className:"underline",children:"Privacy Policy"}),". Unsubscribe at any time."]})}let f={src:e.i(15819).default,width:260,height:56,blurWidth:0,blurHeight:0},g={src:e.i(217817).default,width:211,height:210,blurWidth:8,blurHeight:8,blurDataURL:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAmElEQVR42n3KOwuCUACG4YNg2hAtRRcKotZIUmhpaAga+jlBe2sFDq0tTYEIgqOgm4uXP+DgJiiKg4OLyvEyOOnxhW/6HhCr+yg3mRw1YItbqxP8HqsvNBiIBOfD4OTLlIcEZA8j2NvilWp02gqqZiN8Irw3XNaCQN18jE8/9yUbKlRQHrABqvoERl6Pwwv/XP9daedkOp0Uh5SWl9jDjhIAAAAASUVORK5CYII="};var h=e.i(381477),v=e.i(66396),b=e.i(78160),y=e.i(354622),w=e.i(676037),x=e.i(582853),E=e.i(527983),S=e.i(895711);let C=b.IS_REACT_LEGACY?e=>{e()}:r.default.startTransition,I=(0,v.withMiddleware)(h.default,()=>(e,t,i={})=>{let{mutate:n}=(0,v.useSWRConfig)(),a=(0,r.useRef)(e),s=(0,r.useRef)(t),l=(0,r.useRef)(i),o=(0,r.useRef)(0),[u,c,d]=(e=>{let[,t]=(0,r.useState)({}),i=(0,r.useRef)(!1),n=(0,r.useRef)(e),a=(0,r.useRef)({data:!1,error:!1,isValidating:!1}),s=(0,r.useCallback)(e=>{let r=!1,s=n.current;for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&s[t]!==e[t]&&(s[t]=e[t],a.current[t]&&(r=!0));r&&!i.current&&t({})},[]);return(0,y.useIsomorphicLayoutEffect)(()=>(i.current=!1,()=>{i.current=!0})),[n,a.current,s]})({data:S.UNDEFINED,error:S.UNDEFINED,isMutating:!1}),m=u.current,p=(0,r.useCallback)(async(e,t)=>{let[r,i]=(0,w.serialize)(a.current);if(!s.current)throw Error("Can’t trigger the mutation: missing fetcher.");if(!r)throw Error("Can’t trigger the mutation: missing key.");let u=(0,x.mergeObjects)((0,x.mergeObjects)({populateCache:!1,throwOnError:!0},l.current),t),c=(0,E.getTimestamp)();o.current=c,d({isMutating:!0});try{let t=await n(r,s.current(i,{arg:e}),(0,x.mergeObjects)(u,{throwOnError:!0}));return o.currentd({data:t,isMutating:!1,error:void 0})),null==u.onSuccess||u.onSuccess.call(u,t,r,u)),t}catch(e){if(o.currentd({error:e,isMutating:!1})),null==u.onError||u.onError.call(u,e,r,u),u.throwOnError))throw e}},[]),f=(0,r.useCallback)(()=>{o.current=(0,E.getTimestamp)(),d({data:S.UNDEFINED,error:S.UNDEFINED,isMutating:!1})},[]);return(0,y.useIsomorphicLayoutEffect)(()=>{a.current=e,s.current=t,l.current=i}),{trigger:p,reset:f,get data(){return c.data=!0,m.data},get error(){return c.error=!0,m.error},get isMutating(){return c.isMutating=!0,m.isMutating}}});var A=e.i(279887),k=e.i(695478),P=e.i(422825),R=e.i(528600),N=e.i(790010),j=e.i(598513),O=e.i(37429),_=e.i(952582),D=e.i(725287),U=e.i(837879);let T=()=>{let e=(0,D.useSearchParams)(),{user:{isUserLoggedIn:o},userProfile:c}=(0,R.useUser)(),[d,m]=(0,r.useState)(""),h=o?c?.email??"":d,[v,b]=(0,r.useState)(null),[y,w]=(0,r.useState)(!1),{data:x,loading:E,onSubmit:S,error:C}=function(){let{updateEmailSubscriptions:e}=(0,P.useEmailPreferences)({skipStatus:!0}),t=(0,A.useTrackEmailSubscription)(),{signup:i}=(0,N.useUserSignup)(),{user:{isUserLoggedIn:n}}=(0,R.useUser)(),{isMutating:a,trigger:s,data:l,error:o,reset:u}=I("newsletter/signup/daily-newsletters-1",async(t,{arg:r})=>{let{email:a,newsletterAttr:s}=r;if(!n){if(!a)return Promise.reject({emailError:"Email is required for newsletter subscription"});let{success:e,error:t}=await i({email:a,password:null},!1);if(!e)return Promise.reject({emailError:936===t.messageCode||1027===t.messageCode?"An account with this email exists, please login to continue.":"We could not create an account for you, please try again"})}return e({newsletter:{isSubscribed:!0,attributes:s}})});return{loading:a,error:o,data:l,onSubmit:(0,r.useCallback)(async e=>{let{email:r,location:i}=e,n=(0,k.getMorningBriefAttrs)(i),a=await s({newsletterAttr:n,email:r});return"success"===a.status&&t({name:"newsletter",status:!0}),a},[t,s]),onReset:u}}(),T=(0,U.useSubscriptionsEnabled)(),M=e.get("cm_ven"),L=M?.startsWith("dnt_newsletter"),{emailSubscriptions:G}=(0,P.useEmailPreferences)(),F=(0,j.useSendInteractionEvent)(),B=(0,r.useMemo)(()=>(0,k.findSubscriptionGroup)(G,_.DAILY_NEWSLETTERS_GROUP),[G]),V=(0,r.useCallback)(async e=>{e.preventDefault(),!E&&h.trim()&&v&&(w(!0),F({interactionElement:"morningbrief signup",interactionType:"click",moduleId:"morning-brief-block"}),await S({email:h,location:v}))},[E,h,v,F,S]);return!y&&B?.isSubscribed||!T||L?null:(0,t.jsxs)("div",{"data-flatplan-id":"flatplan_signup_form",style:{backgroundImage:`url("${g.src}")`,backgroundPosition:"right top",backgroundRepeat:"no-repeat",backgroundSize:"70px"},className:"my-4 space-y-2 rounded-xl bg-white py-5 pr-[30px] pl-5 shadow-[0_3px_20px_0_rgba(181,171,162,0.5)]",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-end sm:gap-3",children:[(0,t.jsx)(O.default,{src:f.src,alt:"",className:"m-0 w-37.5",rounded:!1}),(0,t.jsx)("div",{className:"mb-1.5 hidden min-h-[24px] min-w-[2px] bg-black sm:block"}),(0,t.jsx)("div",{className:"text-lg font-semibold",children:"Weather in your inbox"})]}),x?.status==="success"?(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(i.Check,{className:"h-6 w-6 text-green-500"}),(0,t.jsx)("div",{className:"text-sm text-gray-700",children:(0,t.jsx)("p",{children:"You are subscribed to the Morning Brief newsletter."})})]}):(0,t.jsxs)("form",{onSubmit:V,className:"flex flex-1 flex-col items-end gap-4 pt-4 lg:flex-row",children:[(0,t.jsx)(u,{id:"email",required:!0,type:"email",placeholder:"Email",className:"h-12",value:h,onChange:e=>m(e.target.value),error:!!x?.emailError,disabled:o}),(0,t.jsx)(l.LocationInput,{label:"Forecast Location",placeholder:"Search City or Zip Code",className:"h-12 items-center text-sm",location:v,onChangeLocation:b}),(0,t.jsx)("div",{children:(0,t.jsxs)(s.Button,{type:"submit",className:"flex h-12 items-center gap-1 text-nowrap",disabled:E||!(h&&v),children:[(0,t.jsx)("span",{children:"Sign Up"}),E&&(0,t.jsx)(a.Loader2,{className:"animate-spin"})]})})]}),C&&(0,t.jsxs)("div",{className:"flex items-center gap-2 text-red-500",children:[(0,t.jsx)(n.Info,{className:"h-6 w-6 text-red-500"}),(0,t.jsx)("div",{className:"text-sm",children:C.emailError||"Failed to subscribe, please try again."})]}),x?.status==="error"&&(0,t.jsxs)("div",{className:"flex items-center gap-2 text-red-500",children:[(0,t.jsx)(n.Info,{className:"h-6 w-6 text-red-500"}),(0,t.jsx)("div",{className:"text-sm",children:x.emailError??x.error})]}),(0,t.jsx)(p,{})]})};T.displayName="MorningBriefBlock",e.s(["MorningBriefBlock",0,T,"default",0,T],882684)},278081,function(e){e.n(e.i(882684))},217817,e=>{e.q("/_next/static/immutable/media/ellipse.00degh2rgqa_6.png")},15819,e=>{e.q("/_next/static/immutable/media/morning-brief-logo.2w7o5r-sy8jah.svg")},546334,e=>{"use strict";var t=e.i(902875),r=e.i(247865),i=e.i(725287),n=e.i(381477),a=e.i(925209),s=e.i(564993),l=e.i(985542),o=e.i(612977),u=e.i(368847),c=e.i(877957),d=/[\\\/_+.#"@\[\(\{&]/,m=/[\\\/_+.#"@\[\(\{&]/g,p=/[\s-]/,f=/[\s-]/g;function g(e){return e.toLowerCase().replace(f," ")}var h=e.i(396817),v=e.i(942928),b=e.i(296994),y=e.i(271359),w='[cmdk-group=""]',x='[cmdk-group-items=""]',E='[cmdk-item=""]',S=`${E}:not([aria-disabled="true"])`,C="cmdk-item-select",I="data-value",A=(e,t,r)=>{var i;return i=e,function e(t,r,i,n,a,s,l){if(s===r.length)return a===t.length?1:.99;var o=`${a},${s}`;if(void 0!==l[o])return l[o];for(var u,c,g,h,v=n.charAt(s),b=i.indexOf(v,a),y=0;b>=0;)(u=e(t,r,i,n,b+1,s+1,l))>y&&(b===a?u*=1:d.test(t.charAt(b-1))?(u*=.8,(g=t.slice(a,b-1).match(m))&&a>0&&(u*=Math.pow(.999,g.length))):p.test(t.charAt(b-1))?(u*=.9,(h=t.slice(a,b-1).match(f))&&a>0&&(u*=Math.pow(.999,h.length))):(u*=.17,a>0&&(u*=Math.pow(.999,b-a))),t.charAt(b)!==r.charAt(s)&&(u*=.9999)),(u<.1>u&&(u=.1*c),u>y&&(y=u),b=i.indexOf(v,b+1);return l[o]=y,y}(i=r&&r.length>0?`${i+" "+r.join(" ")}`:i,t,g(i),g(t),0,0,{})},k=r.createContext(void 0),P=r.createContext(void 0),R=r.createContext(void 0),N=r.forwardRef((e,t)=>{let i=F(()=>{var t,r;return{search:"",value:null!=(r=null!=(t=e.value)?t:e.defaultValue)?r:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=F(()=>new Set),a=F(()=>new Map),s=F(()=>new Map),l=F(()=>new Set),o=L(e),{label:u,children:c,value:d,onValueChange:m,filter:p,shouldFilter:f,loop:g,disablePointerSelection:h=!1,vimBindings:y=!0,...R}=e,N=(0,b.useId)(),j=(0,b.useId)(),O=(0,b.useId)(),_=r.useRef(null),D=W();G(()=>{if(void 0!==d){let e=d.trim();i.current.value=e,U.emit()}},[d]),G(()=>{D(6,H)},[]);let U=r.useMemo(()=>({subscribe:e=>(l.current.add(e),()=>l.current.delete(e)),snapshot:()=>i.current,setState:(e,t,r)=>{var n,a,s,l;if(!Object.is(i.current[e],t)){if(i.current[e]=t,"search"===e)q(),B(),D(1,V);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(O);e?e.focus():null==(n=document.getElementById(N))||n.focus()}if(D(7,()=>{var e;i.current.selectedItemId=null==(e=$())?void 0:e.id,U.emit()}),r||D(5,H),(null==(a=o.current)?void 0:a.value)!==void 0){null==(l=(s=o.current).onValueChange)||l.call(s,null!=t?t:"");return}}U.emit()}},emit:()=>{l.current.forEach(e=>e())}}),[]),T=r.useMemo(()=>({value:(e,t,r)=>{var n;t!==(null==(n=s.current.get(e))?void 0:n.value)&&(s.current.set(e,{value:t,keywords:r}),i.current.filtered.items.set(e,M(t,r)),D(2,()=>{B(),U.emit()}))},item:(e,t)=>(n.current.add(e),t&&(a.current.has(t)?a.current.get(t).add(e):a.current.set(t,new Set([e]))),D(3,()=>{q(),B(),i.current.value||V(),U.emit()}),()=>{s.current.delete(e),n.current.delete(e),i.current.filtered.items.delete(e);let t=$();D(4,()=>{q(),(null==t?void 0:t.getAttribute("id"))===e&&V(),U.emit()})}),group:e=>(a.current.has(e)||a.current.set(e,new Set),()=>{s.current.delete(e),a.current.delete(e)}),filter:()=>o.current.shouldFilter,label:u||e["aria-label"],getDisablePointerSelection:()=>o.current.disablePointerSelection,listId:N,inputId:O,labelId:j,listInnerRef:_}),[]);function M(e,t){var r,n;let a=null!=(n=null==(r=o.current)?void 0:r.filter)?n:A;return e?a(e,i.current.search,t):0}function B(){if(!i.current.search||!1===o.current.shouldFilter)return;let e=i.current.filtered.items,t=[];i.current.filtered.groups.forEach(r=>{let i=a.current.get(r),n=0;i.forEach(t=>{n=Math.max(e.get(t),n)}),t.push([r,n])});let r=_.current;z().sort((t,r)=>{var i,n;let a=t.getAttribute("id"),s=r.getAttribute("id");return(null!=(i=e.get(s))?i:0)-(null!=(n=e.get(a))?n:0)}).forEach(e=>{let t=e.closest(x);t?t.appendChild(e.parentElement===t?e:e.closest(`${x} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${x} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let r=null==(t=_.current)?void 0:t.querySelector(`${w}[${I}="${encodeURIComponent(e[0])}"]`);null==r||r.parentElement.appendChild(r)})}function V(){let e=z().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(I);U.setState("value",t||void 0)}function q(){var e,t,r,l;if(!i.current.search||!1===o.current.shouldFilter){i.current.filtered.count=n.current.size;return}i.current.filtered.groups=new Set;let u=0;for(let a of n.current){let n=M(null!=(t=null==(e=s.current.get(a))?void 0:e.value)?t:"",null!=(l=null==(r=s.current.get(a))?void 0:r.keywords)?l:[]);i.current.filtered.items.set(a,n),n>0&&u++}for(let[e,t]of a.current)for(let r of t)if(i.current.filtered.items.get(r)>0){i.current.filtered.groups.add(e);break}i.current.filtered.count=u}function H(){var e,t,r;let i=$();i&&((null==(e=i.parentElement)?void 0:e.firstChild)===i&&(null==(r=null==(t=i.closest(w))?void 0:t.querySelector('[cmdk-group-heading=""]'))||r.scrollIntoView({block:"nearest"})),i.scrollIntoView({block:"nearest"}))}function $(){var e;return null==(e=_.current)?void 0:e.querySelector(`${E}[aria-selected="true"]`)}function z(){var e;return Array.from((null==(e=_.current)?void 0:e.querySelectorAll(S))||[])}function J(e){let t=z()[e];t&&U.setState("value",t.getAttribute(I))}function Q(e){var t;let r=$(),i=z(),n=i.findIndex(e=>e===r),a=i[n+e];null!=(t=o.current)&&t.loop&&(a=n+e0?function(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}(r,w):function(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}(r,w))?void 0:r.querySelector(S);i?U.setState("value",i.getAttribute(I)):Q(e)}let Z=()=>J(z().length-1),ee=e=>{e.preventDefault(),e.metaKey?Z():e.altKey?X(1):Q(1)},et=e=>{e.preventDefault(),e.metaKey?J(0):e.altKey?X(-1):Q(-1)};return r.createElement(v.Primitive.div,{ref:t,tabIndex:-1,...R,"cmdk-root":"",onKeyDown:e=>{var t;null==(t=R.onKeyDown)||t.call(R,e);let r=e.nativeEvent.isComposing||229===e.keyCode;if(!(e.defaultPrevented||r))switch(e.key){case"n":case"j":y&&e.ctrlKey&&ee(e);break;case"ArrowDown":ee(e);break;case"p":case"k":y&&e.ctrlKey&&et(e);break;case"ArrowUp":et(e);break;case"Home":e.preventDefault(),J(0);break;case"End":e.preventDefault(),Z();break;case"Enter":{e.preventDefault();let t=$();if(t){let e=new Event(C);t.dispatchEvent(e)}}}}},r.createElement("label",{"cmdk-label":"",htmlFor:T.inputId,id:T.labelId,style:Y},u),K(e,e=>r.createElement(P.Provider,{value:U},r.createElement(k.Provider,{value:T},e))))}),j=r.forwardRef((e,t)=>{var i,n;let a=(0,b.useId)(),s=r.useRef(null),l=r.useContext(R),o=r.useContext(k),u=L(e),c=null!=(n=null==(i=u.current)?void 0:i.forceMount)?n:null==l?void 0:l.forceMount;G(()=>{if(!c)return o.item(a,null==l?void 0:l.id)},[c]);let d=V(a,s,[e.value,e.children,s],e.keywords),m=r.useContext(P),p=B(e=>e.value&&e.value===d.current),f=B(e=>!!c||!1===o.filter()||!e.search||e.filtered.items.get(a)>0);function g(){var e,t;h(),null==(t=(e=u.current).onSelect)||t.call(e,d.current)}function h(){m.setState("value",d.current,!0)}if(r.useEffect(()=>{let t=s.current;if(!(!t||e.disabled))return t.addEventListener(C,g),()=>t.removeEventListener(C,g)},[f,e.onSelect,e.disabled]),!f)return null;let{disabled:w,value:x,onSelect:E,forceMount:S,keywords:I,...A}=e;return r.createElement(v.Primitive.div,{ref:(0,y.composeRefs)(s,t),...A,id:a,"cmdk-item":"",role:"option","aria-disabled":!!w,"aria-selected":!!p,"data-disabled":!!w,"data-selected":!!p,onPointerMove:w||o.getDisablePointerSelection()?void 0:h,onClick:w?void 0:g},e.children)}),O=r.forwardRef((e,t)=>{let{heading:i,children:n,forceMount:a,...s}=e,l=(0,b.useId)(),o=r.useRef(null),u=r.useRef(null),c=(0,b.useId)(),d=r.useContext(k),m=B(e=>!!a||!1===d.filter()||!e.search||e.filtered.groups.has(l));G(()=>d.group(l),[]),V(l,o,[e.value,e.heading,u]);let p=r.useMemo(()=>({id:l,forceMount:a}),[a]);return r.createElement(v.Primitive.div,{ref:(0,y.composeRefs)(o,t),...s,"cmdk-group":"",role:"presentation",hidden:!m||void 0},i&&r.createElement("div",{ref:u,"cmdk-group-heading":"","aria-hidden":!0,id:c},i),K(e,e=>r.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":i?c:void 0},r.createElement(R.Provider,{value:p},e))))}),_=r.forwardRef((e,t)=>{let{alwaysRender:i,...n}=e,a=r.useRef(null),s=B(e=>!e.search);return i||s?r.createElement(v.Primitive.div,{ref:(0,y.composeRefs)(a,t),...n,"cmdk-separator":"",role:"separator"}):null}),D=r.forwardRef((e,t)=>{let{onValueChange:i,...n}=e,a=null!=e.value,s=r.useContext(P),l=B(e=>e.search),o=B(e=>e.selectedItemId),u=r.useContext(k);return r.useEffect(()=>{null!=e.value&&s.setState("search",e.value)},[e.value]),r.createElement(v.Primitive.input,{ref:t,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":u.listId,"aria-labelledby":u.labelId,"aria-activedescendant":o,id:u.inputId,type:"text",value:a?e.value:l,onChange:e=>{a||s.setState("search",e.target.value),null==i||i(e.target.value)}})}),U=r.forwardRef((e,t)=>{let{children:i,label:n="Suggestions",...a}=e,s=r.useRef(null),l=r.useRef(null),o=B(e=>e.selectedItemId),u=r.useContext(k);return r.useEffect(()=>{if(l.current&&s.current){let e=l.current,t=s.current,r,i=new ResizeObserver(()=>{r=requestAnimationFrame(()=>{let r=e.offsetHeight;t.style.setProperty("--cmdk-list-height",r.toFixed(1)+"px")})});return i.observe(e),()=>{cancelAnimationFrame(r),i.unobserve(e)}}},[]),r.createElement(v.Primitive.div,{ref:(0,y.composeRefs)(s,t),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":o,"aria-label":n,id:u.listId},K(e,e=>r.createElement("div",{ref:(0,y.composeRefs)(l,u.listInnerRef),"cmdk-list-sizer":""},e)))}),T=r.forwardRef((e,t)=>{let{open:i,onOpenChange:n,overlayClassName:a,contentClassName:s,container:l,...o}=e;return r.createElement(h.Root,{open:i,onOpenChange:n},r.createElement(h.Portal,{container:l},r.createElement(h.Overlay,{"cmdk-overlay":"",className:a}),r.createElement(h.Content,{"aria-label":e.label,"cmdk-dialog":"",className:s},r.createElement(N,{ref:t,...o}))))}),M=Object.assign(N,{List:U,Item:j,Input:D,Group:O,Separator:_,Dialog:T,Empty:r.forwardRef((e,t)=>B(e=>0===e.filtered.count)?r.createElement(v.Primitive.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Loading:r.forwardRef((e,t)=>{let{progress:i,children:n,label:a="Loading...",...s}=e;return r.createElement(v.Primitive.div,{ref:t,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":i,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},K(e,e=>r.createElement("div",{"aria-hidden":!0},e)))})});function L(e){let t=r.useRef(e);return G(()=>{t.current=e}),t}var G="u"e(t.snapshot());return r.useSyncExternalStore(t.subscribe,i,i)}function V(e,t,i,n=[]){let a=r.useRef(),s=r.useContext(k);return G(()=>{var r;let l=(()=>{var e;for(let t of i){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():a.current}})(),o=n.map(e=>e.trim());s.value(e,l,o),null==(r=t.current)||r.setAttribute(I,l),a.current=l}),a}var W=()=>{let[e,t]=r.useState(),i=F(()=>new Map);return G(()=>{i.current.forEach(e=>e()),i.current=new Map},[e]),(e,r)=>{i.current.set(e,r),t({})}};function K({asChild:e,children:t},i){let n;return e&&r.isValidElement(t)?r.cloneElement("function"==typeof(n=t.type)?n(t.props):"render"in n?n.render(t.props):t,{ref:t.ref},i(t.props.children)):i(t)}var Y={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};let q=(0,e.i(514514).default)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);var H=e.i(632137);function $({className:e,...r}){return(0,t.jsx)(M,{"data-slot":"command",className:(0,H.cn)("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...r})}function z({className:e,...r}){return(0,t.jsxs)("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[(0,t.jsx)(q,{className:"size-4 shrink-0 opacity-50"}),(0,t.jsx)(M.Input,{"data-slot":"command-input",className:(0,H.cn)("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...r})]})}function J({className:e,...r}){return(0,t.jsx)(M.List,{"data-slot":"command-list",className:(0,H.cn)("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...r})}function Q({className:e,...r}){return(0,t.jsx)(M.Group,{"data-slot":"command-group",className:(0,H.cn)("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...r})}function X({className:e,...r}){return(0,t.jsx)(M.Item,{"data-slot":"command-item",className:(0,H.cn)("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r})}e.i(62544);var Z=e.i(809058);e.s(["LocationInput",0,function({location:e,onChangeLocation:d,label:m="Search for a location",placeholder:p="Search city or zip code",className:f,error:g,disabled:h=!1}){let v=(0,i.useParams)(),b=v?.locale,[y,w]=(0,r.useState)(!1),[x,E]=(0,r.useState)(""),S=(0,o.default)(x.trim(),300),C=e?`${e.city}, ${e.adminDistrictCode||e.adminDistrict||e.displayContext}`:null,{isLoading:I,data:A}=(0,n.default)(S?["location-search",S,b]:null,([,e,t])=>(0,l.getLocationsByQuery)(e,t));return(0,t.jsxs)("div",{className:"w-full min-w-0",children:[(0,t.jsxs)(Z.Popover,{open:y,onOpenChange:w,children:[(0,t.jsx)(Z.PopoverTrigger,{asChild:!0,children:(0,t.jsxs)(c.Button,{variant:"outline",role:"combobox",disabled:h,"aria-expanded":y,"aria-invalid":!!g,className:(0,H.cn)("flex w-full justify-start gap-2 bg-white px-3 text-left font-normal text-gray-900",f,!!e&&"border-black",g&&"border-alert-severe"),children:[I?(0,t.jsx)(s.LoaderCircle,{className:"size-4 shrink-0 animate-spin","aria-hidden":"true",title:""}):(0,t.jsx)(a.Location,{className:"size-4 shrink-0","aria-hidden":"true",title:""}),(0,t.jsx)("span",{className:"flex-1 truncate",children:C??m})]})}),(0,t.jsx)(Z.PopoverContent,{side:"bottom",align:"start",collisionPadding:8,className:"w-(--radix-popover-trigger-width) p-0",showArrow:!1,children:(0,t.jsxs)($,{shouldFilter:!1,children:[(0,t.jsx)(z,{placeholder:p,value:x,onValueChange:E}),(0,t.jsx)(J,{className:"max-h-[min(200px,46vh)] min-h-10",children:(0,t.jsx)(Q,{children:A?.map(e=>(0,t.jsx)(X,{value:e.locId,onSelect:()=>{d(e),w(!1)},children:e.address},e.locId))})})]})})]}),g&&(0,t.jsx)(u.Text,{variant:"Caption.S",color:"error",className:"mt-1",children:g})]})}],546334)},143851,e=>{"use strict";var t=e.i(546446),r=e.i(245943),i=e.i(45846),n=e.i(310847),a=e.i(776169),s=e.i(671525),l=e.i(658547),o=e.i(18358),u=e.i(592188),c=e.i(539353),d=e.i(521350),m=e.i(756227),p=e.i(553329),f=e.i(358273),g=e.i(459598);let h=(0,e.i(695881).createLogger)("useUserLogin");e.s(["useUserLogin",0,function(){let e=(0,t.useSetAtom)(n.userHasLoggedInBeforeAtom),v=(0,m.useResetAuthState)(),b=(0,t.useAtomValue)(n.wxuLoginRedirectPageAtom),y=(0,t.useAtomValue)(n.wxuUserAnonymousIdAtom),{syncPreferencesFromUpsx:w,updatePreferences:x}=(0,a.usePreferences)(),{navigate:E}=(0,s.default)(),{login:S}=(0,l.useUserIdentity)(),C=(0,o.useTrackEvent)(),I=(0,u.useUserLoggedIn)(),A=(0,c.useSignupComplete)({url:window.location.pathname}),k=e=>{(0,f.regenerateMetricsSession)(),(0,g.suppressNextPurchaseAbandon)(),(0,g.suppressNextHightouchPurchaseAbandon)();let t=new URLSearchParams(window.location.search).get("ref");E(e??(t&&`https://${t}`)??b)},P=async(t,r=!0,n={})=>{v(),(0,d.isLocalStorageAvailable)()&&localStorage.setItem("PARTNERS_SYNC","true"),e(!0),await w()||await x({});try{await i.upsxClient.purchase.getPurchaseToken()}catch(e){console.error("Failed to get UPSX token:",e)}if(t?.userID){let{error:e}=await (0,p.tryCatch)(S({email:t.email,customerid:t.userID,other:y}));e&&h.error("Failed to establish mParticle identity:",e);let r="signup"===t.type,i=r&&n.skipSignupCompleteEvent;i||C(r?"signup-complete":"user-loggedin",{url:window.location.pathname}),r&&!i&&A(),r||I()}r&&k()};return{login:async(e,t)=>{try{let r=await i.upsxClient.auth.login({email:e,password:t});if(!r)return{success:!1,error:{}};return await P({email:r.email,userID:r.userID,type:"login"}),{success:!0}}catch(e){if(console.error("Failed to login",e),e instanceof r.APIError){let t=e.data;return{success:!1,error:{code:e.code,...t}}}return{success:!1,error:{}}}},authSuccess:P,authRedirect:k}}])},790010,e=>{"use strict";var t=e.i(245943),r=e.i(45846),i=e.i(143851);e.s(["useUserSignup",0,function(){let{authSuccess:e,authRedirect:n}=(0,i.useUserLogin)();return{signup:async(i,n=!0,a={})=>{try{let t=await (i.password?r.upsxClient.auth.register({email:i.email,password:i.password,firstName:i.firstName}):r.upsxClient.auth.registerPasswordless({email:i.email,firstName:i.firstName}));return await e({email:t.email,userID:t.userID,type:"signup"},n,a),{success:!0,data:{email:t.email,userID:t.userID}}}catch(e){if(console.error("Failed to signup",e),e instanceof t.APIError){let t=e.data;return{success:!1,error:{code:e.code,...t}}}return{success:!1,error:{}}}},authRedirect:n}}])},422825,e=>{"use strict";var t=e.i(546446),r=e.i(381477),i=e.i(899507),n=e.i(449928),a=e.i(760430);function s(e){if((0,n.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),r=t.constructor;if(e instanceof Date||e instanceof Map||e instanceof Set)return new r(e);if(e instanceof RegExp){let t=new r(e);return t.lastIndex=e.lastIndex,t}if(e instanceof DataView)return new r(e.buffer.slice(0));if(e instanceof Error){let t=new r(e.message);return t.stack=e.stack,t.name=e.name,t.cause=e.cause,t}return"u">typeof File&&e instanceof File?new r([e],e.name,{type:e.type,lastModified:e.lastModified}):"object"==typeof e?Object.assign(Object.create(t),e):e}var l=e.i(355200);function o(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 u(e,t,r){let i=Object.keys(t);for(let n=0;n"boolean"==typeof e?{isSubscribed:e}:e;e.s(["useEmailPreferences",0,({forceSubs:e,skipStatus:n}={})=>{let[a,l]=(0,t.useAtom)(m.emailPreferencesAtom),{user:b}=(0,p.useUser)(),y=(0,h.useSubscriptionsEnabled)()||e,w=b?.userID||null,x=(0,g.useCallback)(e=>{if(w){var t;let r,i;l({userId:w,expiry:Date.now()+9e5,subscriptions:(t=a?.subscriptions,r=t?.length?t:f.DEFAULT_SUBSCRIPTIONS,i={},e?(r?.forEach(e=>{i[e.subscriptionGroupName]=e}),e.forEach(e=>{let t=i[e.subscriptionGroupName]||{};i[e.subscriptionGroupName]=u(s(t),e,function e(t,r){if(Array.isArray(r))if(Array.isArray(t))return u(s(t),r,e);else return u([],r,e);if(o(r))if(o(t))return u(s(t),r,e);else return u({},r,e)})}),Object.values(i)):r)})}},[w,l,a?.subscriptions]),E=a&&a.userId===w&&a.expiry&&a.expiry>Date.now(),S=y&&w&&!E,{isLoading:C}=(0,r.default)(!n&&S?`getEmailPreferencesStatus/${w}`:void 0,d.getEmailPreferencesStatus,{shouldRetryOnError:e=>!(e instanceof Error&&e.message.includes("401")),revalidateOnFocus:!1,revalidateOnReconnect:!1,refreshInterval:0,errorRetryCount:2,onSuccess:e=>{w&&e&&x(e.subscriptions)}}),I=(0,g.useCallback)(async e=>{if(!y)return{status:"error",error:"Subscription is not enabled!"};let t=await (0,c.setEmailPreferences)({subscriptions:e});return"success"===t.status&&x(e),t},[x,y,a?.subscriptions]),A=(0,g.useCallback)(async({newsletter:e,weekly:t,onYourRadar:r,marketing:n})=>{let a=[!(0,i.isNil)(e)&&{subscriptionGroupName:"daily-newsletters-1",...v(e)},!(0,i.isNil)(t)&&{subscriptionGroupName:"weekly-brief",...v(t)},!(0,i.isNil)(r)&&{subscriptionGroupName:"on-your-radar",...v(r)},!(0,i.isNil)(n)&&{subscriptionGroupName:"marketing-emails-1",...v(n)}].filter(Boolean);return await I(a)},[I]);return{emailSubscriptions:E?a.subscriptions:null,updateEmailSubscriptions:A,updateEmailPreference:I,isLoadingPreferences:C}}],422825)}]);