(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,253276,e=>{"use strict";var t=e.i(699173),s=e.i(592121);e.s(["default",0,function({candidate:e,failedMessage:i="Authentication failed. Please try again.",protectMessage:a="Remove your adblocker.",fetch:r,refresh:l,getCustomAccountInfo:n}){let[o,d]=(0,s.useState)(""),[c,A]=(0,s.useState)(!1),[u,m]=(0,s.useState)(!1),[g,h]=(0,s.useState)(!1),x=(0,s.useRef)([]);(0,s.useEffect)(()=>{e.id!==x.current[0]&&(x.current=[e.id],e.transactIDs&&x.current.push(...e.transactIDs))},[e.id,e.transactIDs]);let f=(0,s.useCallback)(()=>{try{r("/?adm_get_token=1").then(e=>{e.ok&&l()}).catch(()=>{d(i)})}catch{d(i)}},[r,i,l]),p=(0,s.useMemo)(()=>"u">typeof window?window:{admiral:{}},[]);return(0,s.useEffect)(()=>{typeof window>"u"||(p.admiral=p.admiral||function(...e){(p.admiral.q=p.admiral.q||[]).push(e)},p.admiral("after","measure.detected",function(t){if("abr"==e.requirement)t.adblocking?(d(a),A(!0)):h(!0);else if("account"==e.requirement||"benefits"==e.requirement){let t=!!n;p.admiral("after","visitor.latest",function(s){var i;if("account"===e.requirement)(t?n().registered:s.status.registered)||u||(d(a),A(!0));else if("benefits"===e.requirement){let s=[];if(t)s=n().benefits;else{let e=document.cookie.split(";");e&&(s=(null==(i=e.find(e=>e.startsWith("admbenefits=")))?void 0:i.split(","))??[])}if(s){let t=e.benefits??[];if(0==t.length)return void h(!0);let i=!1;for(let e of t)s.includes(e)&&(i=!0);i?h(!0):(d(a),A(!0))}else d(a),A(!0)}})}}))},[]),(0,s.useEffect)(()=>{g&&(h(!1),f())},[g,f]),(0,s.useEffect)(()=>{u||!c||(m(!0),p.admiral("targeting","force",{candidateIDs:x.current}))},[u,c,x,p]),(0,t.jsxs)("div",{children:[o||null," "]})}])},590238,e=>{"use strict";var t=e.i(537989);e.i(609717);var s=e.i(950771),i=e.i(695203),a=e.i(604323),r=e.i(797770),l=e.i(513539),n=e.i(991511);e.s(["AnalyticsBoundary",0,e=>((0,n.useRehydrateAtoms)([[t.pageIdAtom,e.pageId],[s.pageLocaleAtom,e.pageLocale],[i.deviceClassAtom,e.deviceClass],[a.metricsArticleDataAtom,e.metricsArticleData],[r.adsMetricsUnitAndZoneAtom,e.adsMetricsUnitAndZone??"non_monetized"],[l.layoutStateAtom,e.layoutState??null],[l.activeEventAtom,e.activeEvent??null]]),null)])},703123,e=>{"use strict";let t=(0,e.i(981030).atom)({});e.s(["gsiEmailStatesAtom",0,t])},404893,e=>{"use strict";let t=(0,e.i(981030).atom)(!1);e.s(["googleLoginInitilizedAtom",0,t])},874905,e=>{"use strict";e.i(546584);var t=e.i(699173),s=e.i(592121),i=e.i(185312),a=e.i(546446),r=e.i(683903),l=e.i(671525),n=e.i(901351),o=e.i(310847),d=e.i(776169),c=e.i(422825),A=e.i(143851),u=e.i(703123),m=e.i(404893),g=e.i(367810),h=e.i(792461);e.s(["GoogleAuthScript",0,function({onLoad:e,prompt:x=!0,isUserLoggedIn:f}){let p=(0,r.useTranslations)("GoogleLogin"),w=(0,a.useSetAtom)(m.googleLoginInitilizedAtom),{loginWithGoogle:y,error:b,clearError:E}=function(){let e=(0,r.useTranslations)("GoogleLogin"),[t,i]=(0,s.useState)(null),m=(0,a.useSetAtom)(o.userHasLoggedInBeforeAtom),g=(0,a.useAtomValue)(u.gsiEmailStatesAtom),{updateEmailSubscriptions:h}=(0,c.useEmailPreferences)({skipStatus:!0}),{refresh:x}=(0,l.usePageNavigation)(),{syncPreferencesFromUpsx:f}=(0,d.usePreferences)(),{authSuccess:p,authRedirect:w}=(0,A.useUserLogin)();return{loginWithGoogle:(0,s.useCallback)(async t=>{let{credential:s}=t;i(null);try{let e=await n.upsxClient.auth.loginWithGoogle({google_id_token:s}),t=e?.isFirstLogin;await p({email:e.email,userID:e.userID,type:t?"signup":"login"},!1);let{newsletter:i,weekly:a,onYourRadar:r,marketing:l,alwaysSubscribe:o}=g||{};return(t||o)&&await h({newsletter:i,weekly:a,onYourRadar:r,marketing:l}).catch(e=>{console.error("Failed to update email subscriptions",e)}),w(),!0}catch(t){console.error("Failed to login with Google",t);try{let s=t?.data,a=s?.messageCode;if(!a)throw Error("No Error Message");switch(a){case 1e3:case 1026:case 1033:i({header:e("emailAlreadyUsedGoogleHeader"),body:e.raw("emailAlreadyUsedGoogleBody")});break;case 1027:case 1030:i({header:e("emailAlreadyRegisteredGoogleHeader"),body:e("emailAlreadyRegisteredGoogleBody")});break;default:throw Error("No Specific Error")}}catch(t){i({header:e("somethingWentWrong")})}return!1}},[m,f,x,p,w,h,g]),error:t,clearError:(0,s.useCallback)(()=>{i(null)},[])}}(),j=(0,h.useRefMemo)(y),v=(0,s.useRef)(null);b&&(v.current=b);let B=v.current;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i.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=>{j.current?.(e)}}),w(!0)),e?.(),!f&&x&&t?.prompt()},id:"google-gsi-script"}),B&&(0,t.jsx)(g.Dialog,{open:!!b,onOpenChange:e=>!e&&E(),children:(0,t.jsx)(g.BasicDialog,{showCloseButton:!1,title:B.header||"",description:(0,t.jsx)("span",{dangerouslySetInnerHTML:{__html:B.body||""}}),primaryAction:{label:p("cancel"),onClick:E}})})]})}],874905)},499239,e=>{"use strict";var t=e.i(981030),s=e.i(284007);(0,t.atom)("auth");let i=(0,t.atom)(null);(0,t.atom)(null);let a=(0,t.atom)(!1),r=(0,t.atom)(null),l=(0,s.atomWithStorage)("wxu-web/keyval:cart","",void 0,{getOnInit:!0}),n=(0,t.atom)(""),o=(0,t.atom)(null),d=(0,s.atomWithStorage)("wxu-web/keyval:eventChainId","",void 0,{getOnInit:!0}),c=(0,t.atom)("idle");e.s(["addressDataAtom",0,i,"billingPreviewDataAtom",0,o,"cartProductIdAtom",0,l,"checkoutValidationAtom",0,c,"eventChainIdAtom",0,d,"promoCodeAtom",0,r,"showSuccessDialogAtom",0,a,"tpccAtom",0,n])},105335,e=>{"use strict";var t=e.i(699173),s=e.i(592121),i=e.i(747961);let a=(0,s.forwardRef)(({title:e,titleId:s,desc:i,descId:a,...r},l)=>(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",ref:l,"aria-labelledby":s,"aria-describedby":a,...r,children:[i?(0,t.jsx)("desc",{id:a,children:i}):null,void 0===e?(0,t.jsx)("title",{id:s,children:"Warning"}):e?(0,t.jsx)("title",{id:s,children:e}):null,(0,t.jsxs)("g",{fill:"currentColor",clipPath:"url(#a)",children:[(0,t.jsx)("path",{d:"M8.81 11.454a.8.8 0 1 1-1.6 0 .8.8 0 0 1 1.6 0M8.747 8.8V4.4a.75.75 0 1 0-1.5 0v4.4a.75.75 0 1 0 1.5 0"}),(0,t.jsx)("path",{fillRule:"evenodd",d:"M.83 8a7.167 7.167 0 1 1 14.333 0A7.167 7.167 0 0 1 .83 8m7.167-6.166a6.167 6.167 0 1 0 0 12.333 6.167 6.167 0 0 0 0-12.333",clipRule:"evenodd"})]}),(0,t.jsx)("defs",{children:(0,t.jsx)("clipPath",{id:"a",children:(0,t.jsx)("path",{fill:"currentColor",d:"M0 0h16v16H0z"})})})]})),r=s.default.forwardRef((e,s)=>(0,t.jsx)(i.BaseIcon,{ref:s,icon:a,...e}));r.displayName="Warning",e.s(["Warning",0,r])},983950,e=>{"use strict";var t=e.i(699173),s=e.i(592121),i=e.i(404893),a=e.i(546446);e.s(["default",0,function({type:e="standard",text:r="continue_with",theme:l="outline",size:n="large",shape:o="rectangular",logo_alignment:d="center",className:c=""}){let A=(0,a.useAtomValue)(i.googleLoginInitilizedAtom),u=(0,s.useRef)(null);return(0,s.useEffect)(()=>{let t=window?.google?.accounts?.id;t&&t?.renderButton(u.current,{type:e,shape:o,theme:l,text:r,size:n,logo_alignment:d})},[e,l,n,r,o,d,A]),(0,t.jsx)("div",{id:"google-login-button",ref:u,className:`google-login-button ${c}`,"data-testid":"google-login-button"})}])},118119,e=>{"use strict";var t=e.i(699173),s=e.i(592121),i=e.i(990420),a=e.i(666021),r=e.i(683903),l=e.i(924689),n=e.i(143851),o=e.i(269767),d=e.i(240058),c=e.i(825440),A=e.i(368847),u=e.i(677988),m=e.i(877957),g=e.i(609958),h=e.i(558802);let x=l.z.object({email:l.z.email({message:"Please enter a valid email address"}),password:l.z.string().min(8,{message:"Password must be at least 8 characters"})});e.s(["default",0,({loginBtnText:e})=>{let l=(0,r.useTranslations)("UserAuth"),{login:f}=(0,n.useUserLogin)(),[p,w]=(0,s.useState)(!1),[y,b]=(0,s.useState)(null),E=(0,i.useForm)({resolver:(0,a.zodResolver)(x),defaultValues:{email:"",password:""}}),j=async e=>{w(!0),b(null);try{await f(e.email,e.password)||(b("Invalid email or password. Please try again."),w(!1))}catch(e){b("An error occurred during login. Please try again."),w(!1),console.error("Login error:",e)}};return(0,t.jsxs)("div",{className:"@container/loginForm",children:[y&&(0,t.jsx)("div",{className:"rounded border border-red-200 bg-red-50 px-4 py-3 text-red-700",children:y}),(0,t.jsx)(o.Form,{...E,children:(0,t.jsxs)("form",{onSubmit:E.handleSubmit(j),children:[(0,t.jsx)(o.FormField,{control:E.control,name:"email",render:({field:e})=>(0,t.jsx)(o.FormItem,{children:(0,t.jsx)(o.FormControl,{children:(0,t.jsx)(c.Input,{...e,type:"email",label:l("email"),icon:g.Email})})})}),(0,t.jsx)(o.FormField,{control:E.control,name:"password",render:({field:e})=>(0,t.jsx)(o.FormItem,{children:(0,t.jsx)(o.FormControl,{children:(0,t.jsx)(u.PasswordInput,{...e,label:l("password"),icon:h.Locked})})})}),(0,t.jsxs)("div",{className:"prose mb-6 flex max-w-full flex-col justify-between gap-2 @lg/loginForm:flex-row-reverse @lg/loginForm:gap-6",children:[(0,t.jsx)("div",{className:"@max-lg/loginForm:text-right",children:(0,t.jsx)(d.default,{href:"/forgot-password",className:"text-sm whitespace-nowrap hover:underline",children:l("forgotPassword")})}),(0,t.jsx)(A.Text,{className:"m-0 @lg/loginForm:max-w-xl",dangerouslySetInnerHTML:{__html:l.raw("authenticationUniformityNote")}})]}),(0,t.jsx)(m.Button,{type:"submit",loading:p,disabled:p,children:e||l("signin")})]})})]})}])},81083,e=>{"use strict";var t=e.i(699173),s=e.i(592121),i=e.i(683903),a=e.i(118119),r=e.i(264268),l=e.i(877957),n=e.i(368847),o=e.i(983950),d=e.i(528600),c=e.i(731672),A=e.i(526824);e.s(["default",0,({initSignin:e})=>{let[u,m]=(0,s.useState)(e),g=(0,i.useTranslations)("UserAuth"),{user:h,userProfile:x}=(0,d.useUser)(),{email:f,firstName:p}=x||{},w=(0,c.useUserLogout)(),{userLastName:y}=(0,A.useUserLastName)();return h?.isUserLoggedIn?(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"mb-6 flex items-end justify-between gap-1",children:[(0,t.jsx)(n.Text,{variant:"Title.M",color:"secondary",className:"font-semibold",children:g("yourAccount")}),(0,t.jsx)(l.Button,{variant:"link",type:"button",className:(0,n.textVariants)({className:"h-[revert] p-0",variant:"Body.M"}),onClick:()=>w(),children:g("logout")})]}),(0,t.jsxs)(n.Text,{color:"secondary",children:[p," ",y]}),(0,t.jsx)(n.Text,{color:"secondary",children:f})]}):(0,t.jsx)("div",{children:u?(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"mb-4 flex justify-between",children:[(0,t.jsx)(n.Text,{variant:"Title.M",className:"font-semibold",children:g("signin")}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsxs)(n.Text,{color:"secondary",children:[g("noAccount")," "]}),(0,t.jsx)(l.Button,{variant:"link",type:"button",className:(0,n.textVariants)({className:"h-[revert] p-0",variant:"Body.M",color:"secondary"}),onClick:()=>m(!1),children:g("signup")})]})]}),(0,t.jsx)(a.default,{loginBtnText:g("signinAndContinue")})]}):(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)(n.Text,{className:"mb-2",children:g("haveAccount")}),(0,t.jsxs)("div",{className:"flex justify-center gap-4",children:[(0,t.jsx)(l.Button,{variant:"secondary",className:"bg-gray-100",onClick:()=>m(!0),children:g("signin")}),(0,t.jsx)(o.default,{text:"signin_with",shape:"pill"})]})]}),(0,t.jsxs)("div",{className:"relative my-6",children:[(0,t.jsx)("div",{className:"absolute inset-0 flex items-center",children:(0,t.jsx)("div",{className:"w-full border-t border-gray-300"})}),(0,t.jsx)("div",{className:"relative flex justify-center text-sm",children:(0,t.jsx)("span",{className:"bg-white px-2 text-gray-500 uppercase",children:g("or")})})]}),(0,t.jsx)(n.Text,{variant:"Title.M",className:"mb-4 font-semibold",children:g("signup")}),(0,t.jsx)(r.default,{signupBtnText:g("signupAndContinue")})]})})}])},448829,e=>{e.q("/_next/static/media/morning-brief.3m5sb25ar_gt_.jpg")},404916,e=>{e.q("/_next/static/media/weekly-brief.1w3o73yj6bssx.jpg")},583231,e=>{e.q("/_next/static/media/on-your-radar.2rtgy8b1b8699.jpg")},877095,e=>{e.q("/_next/static/media/ski-snow-report.0z452bmd17nfh.jpg")},499050,e=>{e.q("/_next/static/media/garden-report.132lziinbpp-z.jpg")},846413,e=>{e.q("/_next/static/media/fairway-forecast.0m_64_pnc37r-.jpg")},828615,e=>{"use strict";var t=e.i(699173),s=e.i(528600),i=e.i(592121),a=e.i(961123),r=e.i(381477),l=e.i(695478),n=e.i(343277),o=e.i(422825),d=e.i(790010),c=e.i(279887),A=e.i(553329),u=e.i(695881);let m={src:e.i(448829).default,width:960,height:640,blurWidth:8,blurHeight:5,blurDataURL:"data:image/jpeg;base64,/9j/4AAQSkZJRgABAgAAAQABAAD/wAARCAAFAAgDAREAAhEBAxEB/9sAQwAKBwcIBwYKCAgICwoKCw4YEA4NDQ4dFRYRGCMfJSQiHyIh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hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDXLQ3V7PcS20W4fLwCOK4Y5rXSTVrs5KmV4eppJaH/2Q=="},w=[{categoryName:"daily-newsletters-1",cadence:"Daily",name:"Morning Brief",description:"Your local forecast, plus daily trivia, stunning photos and our meteorologists' top picks. All in one place, every morning.",sampleUrl:"",imageSrc:m.src,bgColor:"#3A62CD"},{categoryName:"weekly-brief",cadence:"Weekly",name:"Weekly Brief",description:"Your week ahead, plus the biggest weather stories, what's brewing next and expert answers to your questions. All the weather that matters, every week.",sampleUrl:"",imageSrc:g.src,bgColor:"#0D132A"},{categoryName:"activity-snow-newsletter",cadence:"Weekly (Monthly during off-season)",name:"Weekly Snow Report",description:"Forecasts from every major ski region across the country, in one quick and easy roundup. Your mountain planning cheat sheet, delivered fresh.",sampleUrl:"",imageSrc:x.src},{categoryName:"on-your-radar",cadence:"Weekly",name:"On Your Radar",description:"New products, tools and features you need to know about, rounded up for you. The latest from our team, every week.",sampleUrl:"",imageSrc:h.src},{categoryName:"gardening-emails",cadence:"Weekly",name:"Garden Report",description:"Expert gardening insights and forecast-synced tips to help your home and garden thrive every week.",sampleUrl:"",imageSrc:f.src},{categoryName:"fairway-forecast",cadence:"Weekly",name:"Fairway Forecast",description:"A golf spotlight synced to the forecast, helping you find more time on the green to improve your swing.",sampleUrl:"",imageSrc:p.src}],y=(0,u.createLogger)("useNewsletterSignup");var b=e.i(897360),E=e.i(747961);let j=(0,i.forwardRef)(({title:e,titleId:s,desc:i,descId:a,...r},l)=>(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",ref:l,"aria-labelledby":s,"aria-describedby":a,...r,children:[i?(0,t.jsx)("desc",{id:a,children:i}):null,void 0===e?(0,t.jsx)("title",{id:s,children:"Checkmark"}):e?(0,t.jsx)("title",{id:s,children:e}):null,(0,t.jsx)("path",{fill:"currentColor",d:"M8 1a7 7 0 1 0 0 14A7 7 0 0 0 8 1m-1 9.795-2.5-2.5.795-.795L7 9.205 10.705 5.5l.798.793z"})]})),v=i.default.forwardRef((e,s)=>(0,t.jsx)(E.BaseIcon,{ref:s,icon:j,...e}));v.displayName="CheckmarkFilled";let B=(0,i.forwardRef)(({title:e,titleId:s,desc:i,descId:a,...r},l)=>(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",ref:l,"aria-labelledby":s,"aria-describedby":a,...r,children:[i?(0,t.jsx)("desc",{id:a,children:i}):null,void 0===e?(0,t.jsx)("title",{id:s,children:"Plus"}):e?(0,t.jsx)("title",{id:s,children:e}):null,(0,t.jsxs)("g",{fill:"currentColor",children:[(0,t.jsx)("path",{d:"M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14M8 2.273a5.727 5.727 0 1 0 0 11.454A5.727 5.727 0 0 0 8 2.273"}),(0,t.jsx)("path",{d:"M11.182 8a.636.636 0 0 0-.636-.636h-1.91v-1.91a.636.636 0 1 0-1.272 0v1.91h-1.91a.636.636 0 1 0 0 1.272h1.91v1.91a.636.636 0 0 0 1.272 0v-1.91h1.91A.636.636 0 0 0 11.182 8"})]})]})),Q=i.default.forwardRef((e,s)=>(0,t.jsx)(E.BaseIcon,{ref:s,icon:B,...e}));Q.displayName="PlusOutline";var O=e.i(368847),R=e.i(877957),z=e.i(846871),N=e.i(632137),C=e.i(367810),k=e.i(598513),I=e.i(37429),S=e.i(240058);function D({newsletter:e,selected:s,onToggle:i,priority:a=!1,disabled:r=!1}){let{imageSrc:l,cadence:n,name:o,description:d,sampleUrl:c,bgColor:A}=e;return(0,t.jsxs)("div",{className:(0,N.cn)("relative isolate flex h-full overflow-hidden rounded-2xl border-2 border-transparent transition-colors duration-200 sm:flex-col",!r&&"hover:border-blue-500",s&&"border-blue-500"),children:[(0,t.jsx)("button",{type:"button",onClick:i,disabled:r,"aria-pressed":s,"aria-label":`${s?"Unsubscribe from":"Subscribe to"} ${o}`,className:(0,N.cn)("absolute inset-0 z-10 rounded-2xl focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:outline-none focus-visible:ring-inset",r?"cursor-not-allowed":"cursor-pointer")}),(0,t.jsxs)("div",{className:(0,N.cn)("relative aspect-[3/2] w-2/5 shrink-0 transition-opacity sm:aspect-[3/2] sm:w-full",r&&"opacity-90"),children:[(0,t.jsx)(I.default,{src:l,alt:"",fill:!0,sizes:"(max-width: 640px) 40vw, (max-width: 1024px) 50vw, 33vw",objectFit:A?"contain":"cover",priority:a,isFetchPriority:a,rounded:!1,className:"max-sm:rounded-r-2xl sm:rounded-b-2xl",style:A?{backgroundColor:A}:void 0}),(0,t.jsx)("span",{"aria-hidden":"true",className:"pointer-events-none absolute top-0 right-0 flex size-11.5 items-center justify-center rounded-full",children:s?(0,t.jsx)(v,{className:"size-6.5 text-white"}):(0,t.jsx)(Q,{className:"size-6.5 text-white"})})]}),(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-2 p-4 sm:gap-4",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)(O.default,{variant:"Body.S.Bold",color:"secondary",children:n}),(0,t.jsx)(O.default,{variant:"Title.S",elementType:"h3",color:"primary",children:o}),(0,t.jsx)(O.default,{variant:"Body.S",color:"secondary",children:d})]}),c&&(0,t.jsx)(S.default,{href:c,className:"relative z-20 w-fit text-sm font-bold text-gray-900 underline underline-offset-2 focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:outline-none",children:"View Sample"})]})]})}var F=e.i(990420),K=e.i(546446),U=e.i(666021),P=e.i(336726),M=e.i(527207),L=e.i(825440),W=e.i(269767),T=e.i(697380),J=e.i(909232),Y=e.i(498076),Z=e.i(546334),V=e.i(983950),H=e.i(81083);let q=()=>{let[e,s]=(0,i.useState)(!1);return(0,t.jsxs)(C.Dialog,{open:e,onOpenChange:s,children:[(0,t.jsx)(C.DialogTrigger,{asChild:!0,children:(0,t.jsx)(R.Button,{variant:"link",type:"button",className:"h-[revert] p-0 font-bold text-gray-900 underline underline-offset-2",children:"Sign In."})}),(0,t.jsxs)(C.DialogContent,{className:"max-w-sm pt-10",onOpenAutoFocus:e=>{e.preventDefault(),e.currentTarget?.querySelector("input")?.focus()},children:[(0,t.jsx)(C.DialogTitle,{className:"sr-only",children:"Sign in"}),(0,t.jsx)(H.default,{initSignin:!0})]})]})};var G=e.i(924689);function X({isUserLoggedIn:e,selectedCount:s,defaultEmail:a,defaultLocation:r,saving:l,disabled:n=!1,success:o,serverError:d,onSubmit:c}){let[A,u]=(0,i.useState)(!1),m=(0,K.useAtomValue)(T.fixedBottomAdHeightAtom),g=(0,Y.useIsMobile)(),h=(0,J.useClientMobileMedia)(),x=(0,i.useMemo)(()=>G.z.object({email:e?G.z.string():G.z.email({error:"Enter a valid email address."}),location:G.z.custom().refine(Boolean,{error:"Add your location."}),selectedCount:e?G.z.number():G.z.number().gt(0,{error:"Select at least one newsletter to continue."})}),[e]),f=(0,F.useForm)({resolver:(0,U.zodResolver)(x),defaultValues:{email:"",location:null,selectedCount:s}}),{control:p,handleSubmit:w,setValue:y,setError:b,trigger:E,formState:{isSubmitted:j,errors:v}}=f;(0,i.useEffect)(()=>{a&&y("email",a)},[a,y]),(0,i.useEffect)(()=>{r&&y("location",r)},[r,y]);let B=j||!!v.selectedCount;(0,i.useEffect)(()=>{y("selectedCount",s,{shouldValidate:B})},[y,s,B]),(0,i.useEffect)(()=>{d&&b("email",{type:"server",message:d})},[d,b]),(0,i.useEffect)(()=>{o&&u(!1)},[o]),(0,i.useEffect)(()=>(document.body.style.overflow=A&&h?"hidden":"",()=>{document.body.style.overflow=""}),[A,h]);let Q=w(e=>c({email:e.email,location:e.location})),z=e||s>0,C=()=>{z?u(!0):E("selectedCount")},k=e=>{h&&(A||z?u(!0):(e.currentTarget.blur(),C()))},I=`calc(${3.5*!!g}rem + ${m}px)`,D=s>0?`${s} ${1===s?"Newsletter":"Newsletters"} Selected`:"Sign up for our newsletters";return(0,t.jsx)(W.Form,{...f,children:(0,t.jsxs)("form",{onSubmit:Q,noValidate:!0,className:"contents",children:[(0,t.jsx)("div",{style:{"--ad-bottom":`${m}px`,"--mobile-offset":I},className:(0,N.cn)("z-adOverlay md:z-sticky border-t border-gray-200 bg-white","md:sticky md:bottom-[var(--ad-bottom)]",A?"max-md:animate-in max-md:fade-in-0 max-md:fixed max-md:inset-0 max-md:overflow-y-auto max-md:pt-14 max-md:duration-200":"max-md:sticky max-md:bottom-[var(--mobile-offset)]"),children:(0,t.jsxs)("div",{className:"mx-auto flex w-full max-w-6xl flex-col gap-3 px-4 py-4",children:[(0,t.jsxs)(R.Button,{type:"button",variant:"ghostUI",size:"text",onClick:()=>A?u(!1):C(),"aria-expanded":A,className:"flex w-full items-center justify-between text-left focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:outline-none md:pointer-events-none",children:[(0,t.jsx)(O.default,{variant:"Body.L.Bold",children:D}),A?(0,t.jsx)(P.ChevronDown,{className:"size-5 text-gray-900 md:hidden","aria-hidden":"true"}):(0,t.jsx)(M.ChevronUp,{className:"size-5 text-gray-900 md:hidden","aria-hidden":"true"})]}),(0,t.jsx)(W.FormField,{control:p,name:"selectedCount",render:()=>(0,t.jsx)(W.FormMessage,{className:"text-xxs text-alert-severe -mt-1"})}),(0,t.jsxs)("div",{className:"flex flex-col gap-4 md:grid md:grid-cols-[minmax(0,2fr)_minmax(0,3fr)_auto] md:items-start md:gap-x-4 md:gap-y-1",children:[(0,t.jsx)(W.FormField,{control:p,name:"email",disabled:n||l,render:({field:s})=>(0,t.jsx)(W.FormItem,{className:"min-w-0 md:col-start-1 md:row-start-1",children:(0,t.jsx)(W.FormControl,{children:(0,t.jsx)(L.Input,{...s,label:"Email address",type:"email",variant:"rounded",autoComplete:"email",onFocus:k,required:!e,readOnly:e})})})}),!e&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:(0,N.cn)("flex flex-col items-start gap-2 max-md:-mt-4 md:col-start-1 md:row-start-2",!A&&"max-md:hidden"),children:[(0,t.jsxs)(O.default,{variant:"Body.S",color:"secondary",children:["Already have an account? ",(0,t.jsx)(q,{})]}),(0,t.jsx)(V.default,{text:"signin_with",shape:"pill"})]}),(0,t.jsxs)("div",{"aria-hidden":"true",className:(0,N.cn)("flex items-center gap-3 text-gray-500 md:hidden",!A&&"max-md:hidden"),children:[(0,t.jsx)("span",{className:"h-px flex-1 bg-gray-200"}),(0,t.jsx)(O.default,{variant:"Body.S",color:"secondary",children:"and"}),(0,t.jsx)("span",{className:"h-px flex-1 bg-gray-200"})]})]}),(0,t.jsx)(W.FormField,{control:p,name:"location",render:({field:e,fieldState:s})=>(0,t.jsx)(W.FormItem,{className:(0,N.cn)("min-w-0 md:col-start-2 md:row-start-1",!A&&"max-md:hidden"),children:(0,t.jsx)(Z.LocationInput,{location:e.value,onChangeLocation:e.onChange,label:"Add a city or zip code for your forecast",error:s.error?.message,disabled:n||l,className:"h-12 border-[#25242220]"})})}),(0,t.jsxs)(O.default,{variant:"Body.S",color:"secondary",className:(0,N.cn)("md:col-span-2 md:col-start-2 md:row-start-2",!A&&"max-md:hidden"),children:["By continuing, you're signing up to receive the selected email newsletters and confirm that you agree to the"," ",(0,t.jsx)(S.default,{href:"https://weather.com/termsofuse",className:"underline underline-offset-2",children:"Terms of Use"})," ","and"," ",(0,t.jsx)(S.default,{href:"https://weather.com/privacy",className:"underline underline-offset-2",children:"Privacy Policy"}),"."]}),(0,t.jsx)(R.Button,{type:"submit",size:"lg",loading:l,disabled:n,className:(0,N.cn)("h-12 self-start md:col-start-3 md:row-start-1",!A&&"max-md:hidden"),children:"Sign Up"})]})]})}),(0,t.jsx)("div",{"aria-hidden":"true",className:"hidden md:block",style:{height:m}}),(0,t.jsx)("div",{"aria-hidden":"true",className:"md:hidden",style:{height:56+m}})]})})}function _({isUserLoggedIn:e,userEmail:s,newsletterSignup:a}){let{submit:r,reset:l,status:n,error:o,initializing:d,defaultSelectedGroups:c,defaultLocation:A}=a,u=(0,k.useSendInteractionEvent)(),[m,g]=(0,i.useState)({}),h=(0,i.useRef)(!1);(0,i.useEffect)(()=>{!h.current&&c&&(h.current=!0,g(e=>({...c,...e})))},[c]);let x=w.filter(e=>m[e.categoryName]).length,f=x===w.length;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(C.Dialog,{open:"success"===n,onOpenChange:e=>{e||l()},children:(0,t.jsx)(C.DialogContent,{className:"max-w-md p-8",children:(0,t.jsxs)("div",{className:"flex flex-col items-center gap-4 text-center",children:[(0,t.jsx)("span",{className:"flex size-14 items-center justify-center rounded-full bg-green-100",children:(0,t.jsx)(b.Checkmark,{className:"size-7 text-green-600","aria-hidden":"true",title:""})}),(0,t.jsx)(C.DialogTitle,{asChild:!0,children:(0,t.jsx)(O.default,{variant:"Title.M",elementType:"h2",color:"primary",children:"You're all set"})}),(0,t.jsx)(C.DialogDescription,{asChild:!0,children:(0,t.jsx)(O.default,{variant:"Body.M",color:"secondary",children:"We've updated your newsletter preferences."})})]})})}),(0,t.jsxs)("div",{className:"container mx-auto max-w-6xl px-4 py-8",children:[(0,t.jsxs)("header",{className:"mb-6 flex flex-col gap-2",children:[(0,t.jsx)(O.default,{variant:"Title.XL",elementType:"h1",color:"primary",children:"Newsletters"}),(0,t.jsx)(O.default,{variant:"Body.M",color:"secondary",children:"Get the best of The Weather Channel straight to your inbox. Select from our newsletters below and enter your email to sign up."})]}),(0,t.jsx)("div",{className:"mb-4 flex justify-start",children:d?(0,t.jsxs)("span",{className:"inline-flex h-10 items-center gap-2 px-2 py-1",children:[(0,t.jsx)(z.Loader,{size:"sm",variant:"primary",label:"Loading your newsletter preferences"}),(0,t.jsx)(O.default,{variant:"Body.S",color:"secondary",children:"Getting your preferences…"})]}):(0,t.jsxs)(R.Button,{variant:"ghostUI",size:"text",onClick:()=>g(Object.fromEntries(w.map(e=>[e.categoryName,!f]))),"aria-pressed":f,className:(0,N.cn)("gap-2 rounded-full px-4 py-2.5 text-sm font-bold transition-colors focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 focus-visible:outline-none",f?"bg-blue-100 text-blue-700":"bg-gray-100 text-gray-900 hover:bg-gray-200"),children:[f?(0,t.jsx)(v,{className:"size-5 text-blue-600","aria-hidden":"true",title:""}):(0,t.jsx)(Q,{className:"size-5","aria-hidden":"true",title:""}),"Select All"]})}),(0,t.jsx)("ul",{className:"grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3",children:w.map((e,s)=>(0,t.jsx)("li",{className:"h-full",children:(0,t.jsx)(D,{newsletter:e,selected:!!m[e.categoryName],onToggle:()=>{let t;return t=e.categoryName,g(e=>({...e,[t]:!e[t]}))},priority:s{u({interactionElement:"newsletter signup",interactionType:"click",moduleId:"newsletter-page"}),r({email:e,location:t,selections:w.map(e=>({name:e.categoryName,isSubscribed:!!m[e.categoryName]}))})}})]})}e.s(["default",0,()=>{let{user:{isUserLoggedIn:e},userProfile:u}=(0,s.useUser)(),m=function(){let e=(0,a.useParams)(),t=e?.locale,{updateEmailPreference:u,emailSubscriptions:m,isLoadingPreferences:g}=(0,o.useEmailPreferences)({forceSubs:!0}),{user:{isUserLoggedIn:h,userID:x}}=(0,s.useUser)(),{signup:f}=(0,d.useUserSignup)(),p=(0,c.useTrackEmailSubscription)(),[b,E]=(0,i.useState)("idle"),[j,v]=(0,i.useState)(null),[B,Q]=(0,i.useState)(),[O,R]=(0,i.useState)(!1),z=(0,i.useMemo)(()=>{let e=h&&m?(0,l.findSubscriptionGroup)(m,"daily-newsletters-1")?.attributes?.location:void 0;return"string"==typeof e&&e?e:null},[m,h]),{data:N,isLoading:C}=(0,r.default)(z?["getLocationPointByPlaceId",z,t]:null,([e,t,s])=>(0,n.getLocationPointByPlaceId)(t,s));(0,i.useEffect)(()=>{if(O||!h||!m)return;R(!0);let e={};w.forEach(t=>{e[t.categoryName]=(0,l.findSubscriptionGroup)(m,t.categoryName)?.isSubscribed||!1}),Q(e)},[O,h,m]);let k=h&&!m&&(!x||g),I=h&&!!m&&(!O||C),S=(0,i.useCallback)(()=>{E("idle"),v(null)},[]);return{submit:(0,i.useCallback)(async({email:e,location:t,selections:s})=>{if(v(null),E("saving"),!h){let{success:t,error:s}=await f({email:e,password:null},!1);if(!t){v(936===s.messageCode||1027===s.messageCode?"An account with this email exists, please sign in to continue.":"We could not create an account for you, please try again."),E("error");return}}let i=t?(0,l.getMorningBriefAttrs)(t):void 0,a=s.map(({name:e,isSubscribed:t})=>({subscriptionGroupName:e,isSubscribed:t,...i&&"daily-newsletters-1"===e?{attributes:i}:void 0})),{data:r,error:n}=await (0,A.tryCatch)(u(a));return n||r?.status!=="success"?(n&&y.error("Email preferences request failed",{requestError:n}),v(r?.emailError??r?.error??"Failed to subscribe, please try again."),E("error"),r??void 0):(s.forEach(({name:e,isSubscribed:t})=>p({name:e,status:t})),E("success"),r)},[h,f,u,p]),reset:S,status:b,error:j,initializing:k||I,defaultSelectedGroups:B,defaultLocation:N?.location??null}}();return(0,t.jsx)(_,{isUserLoggedIn:e,userEmail:u?.email,newsletterSignup:m})}],828615)}]);