(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,855602,e=>{"use strict";var t=e.i(297647),i=e.i(477716),o=e.i(947118),r=e.i(737801),n=e.i(333350);e.s(["ModuleAnalytics",0,({moduleId:e,modulePosition:l,variant:a="frontend",children:s})=>{let c,u,d,g=(0,i.useRef)(null),[m,h]=(0,i.useState)(!1),p=(0,i.useRef)(null),f=(c="module-viewed",u=(0,o.useIsInitialized)(),d=(0,r.useEventAttributes)(),(0,i.useCallback)(({moduleId:e,modulePosition:t})=>{if(!u)return void console.warn("MParticle is not initialized");let i={module_id:e,module_position:t,...d};try{window.mParticle?.logEvent?.(c,window.mParticle?.EventType?.Other,i),console.debug(`MParticle: Event "${c}" tracked`,i)}catch(e){console.error(`MParticle: Event "${c}" failed`,e)}},[d,u]));return"admin"===a?(0,t.jsx)(t.Fragment,{children:s}):((0,i.useEffect)(()=>{if(m||!n.default||!g.current)return;let t=g.current,i=new IntersectionObserver(t=>{t.forEach(t=>{t.isIntersecting&&t.intersectionRatio>=1?p.current||(p.current=setTimeout(()=>{f({moduleId:e,modulePosition:l}),h(!0),p.current=null},2e3)):p.current&&(clearTimeout(p.current),p.current=null)})},{threshold:1});i.observe(t);let o=t.getBoundingClientRect(),r=window.innerHeight||document.documentElement.clientHeight,a=window.innerWidth||document.documentElement.clientWidth;return o.top>=0&&o.left>=0&&o.bottom{f({moduleId:e,modulePosition:l}),h(!0),p.current=null},2e3)),()=>{p.current&&clearTimeout(p.current),i.disconnect()}},[m,e,l,f]),(0,t.jsx)("div",{ref:g,className:"hide-empty","data-module-id":e,children:s}))}],855602)},590238,e=>{"use strict";var t=e.i(537989),i=e.i(827049),o=e.i(695203),r=e.i(604323),n=e.i(991511);e.s(["AnalyticsBoundary",0,e=>((0,n.useRehydrateAtoms)([[t.pageIdAtom,e.pageId],[i.pageLocaleAtom,e.pageLocale],[o.deviceClassAtom,e.deviceClass],[r.metricsArticleDataAtom,e.metricsArticleData]]),null)])},703123,e=>{"use strict";let t=(0,e.i(751931).atom)({});e.s(["gsiEmailStatesAtom",0,t])},404893,e=>{"use strict";let t=(0,e.i(751931).atom)(!1);e.s(["googleLoginInitilizedAtom",0,t])},874905,e=>{"use strict";e.i(694914);var t=e.i(297647),i=e.i(241722),o=e.i(477716),r=e.i(475566),n=e.i(352194),l=e.i(671525),a=e.i(901351),s=e.i(310847),c=e.i(776169),u=e.i(422825),d=e.i(143851),g=e.i(703123),m=e.i(404893),h=e.i(367810),p=e.i(251392);function f({onLoad:e,prompt:f=!0,isUserLoggedIn:A}){let y=(0,n.useTranslations)("GoogleLogin"),v=(0,r.useSetAtom)(m.googleLoginInitilizedAtom),{loginWithGoogle:w,error:b,clearError:E}=function(){let e=(0,n.useTranslations)("GoogleLogin"),[t,i]=(0,o.useState)(null),m=(0,r.useSetAtom)(s.userHasLoggedInBeforeAtom),h=(0,r.useAtomValue)(g.gsiEmailStatesAtom),{updateEmailSubscriptions:p}=(0,u.useEmailPreferences)(),{refresh:f}=(0,l.usePageNavigation)(),{syncPreferencesFromUpsx:A}=(0,c.usePreferences)(),{authSuccess:y,authRedirect:v}=(0,d.useUserLogin)();return{loginWithGoogle:(0,o.useCallback)(async t=>{let{credential:o}=t;i(null);try{let e=await a.upsxClient.auth.loginWithGoogle({google_id_token:o}),t=e?.isFirstLogin;await y({email:e.email,userID:e.userID,type:t?"signup":"login"},!1);let{newsletter:i,weekly:r,marketing:n,alwaysSubscribe:l}=h||{};return(t||l)&&await p({newsletter:i,weekly:r,marketing:n}).catch(e=>{console.error("Failed to update email subscriptions",e)}),v(),!0}catch(t){console.error("Failed to login with Google",t);try{let o=t?.data,r=o?.messageCode;if(!r)throw Error("No Error Message");switch(r){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,A,f,y,v,p,h]),error:t,clearError:(0,o.useCallback)(()=>{i(null)},[])}}(),C=(0,p.useRefMemo)(w);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=>{C.current?.(e)}}),v(!0)),e?.(),!A&&f&&t?.prompt()},id:"google-gsi-script"}),(0,t.jsx)(h.Dialog,{open:!!b,onOpenChange:e=>!e&&E(),children:(0,t.jsx)(h.BasicDialog,{showCloseButton:!1,title:b?.header||"",description:(0,t.jsx)("span",{dangerouslySetInnerHTML:{__html:b?.body||""}}),primaryAction:{label:y("cancel")}})})]})}e.s(["GoogleAuthScript",()=>f],874905)},711899,e=>{e.v(t=>Promise.all(["static/chunks/8198254d842f31ab.js"].map(t=>e.l(t))).then(()=>t(171714)))},137688,e=>{e.v(t=>Promise.all(["static/chunks/775f6992a5490e4c.js"].map(t=>e.l(t))).then(()=>t(72990)))}]);