1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./CRUtD73w.js","./BgDflU_i.js","./D00poqEh.js"])))=>i.map(i=>d[i]); 2(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{};e.SENTRY_RELEASE={id:`metacritic.prod.092bc9`}}catch{}})();try{(function(){var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`f54a5885-1be8-4cbb-a852-13a1d5c996fa`,e._sentryDebugIdIdentifier=`sentry-dbid-f54a5885-1be8-4cbb-a852-13a1d5c996fa`)})()}catch{}import{o as e,s as t}from"./D3ADMIvf.js";import{Ht as n,g as r,tt as i,vn as a}from"./BIXMZLRU.js";import"./CD4zXYAk.js";import{t as o}from"./DLDt7Qoa.js";import{a as s,n as c}from"./B26sCsIF.js";import{n as l}from"./CGqjeeCk.js";import{n as u}from"./BneDnwz22.js";import{t as d}from"./DGVxtgFz.js";import"./BytXKvaz.js";var f=function(e){return e.ANONYMOUS=`ANONYMOUS`,e.AUTHENTICATED=`AUTHENTICATED`,e.UNAUTHENTICATED=`UNAUTHENTICATED`,e}({}),p=null,m=()=>{try{let e=`__indexeddb_test__`;return indexedDB.open(e,1).onsuccess=t=>{t.target.result.close(),indexedDB.deleteDatabase(e)},!0}catch{return!1}},h=e=>new Promise(t=>{let n=e.onAuthStateChanged(()=>{n(),t()})}),g=e=>{try{let t=e.split(`.`)[1];if(!t)return null;let n=t.replace(/-/g,`+`).replace(/_/g,`/`),r=n.padEnd(Math.ceil(n.length/4)*4,`=`),i=JSON.parse(atob(r));return typeof i.uid==`string`?i.uid:null}catch{return null}},_=(e,t)=>
2{if(!t)return!1;let n=g(t);return n===null||n===e},v=async t=>{let n=await e().$firebase?.ensure();if(!n.initialized||!n.auth)throw Error(`[UDS] Firebase not initialized`);let r=n.auth;return p||(p=(async()=>{let{browserSessionPersistence:e,setPersistence:n,signInWithCustomToken:i,signOut:a}=await o(async()=>{let{browserSessionPersistence:e,setPersistence:t,signInWithCustomToken:n,signOut:r}=await import(`./CRUtD73w.js`);return{browserSessionPersistence:e,setPersistence:t,signInWithCustomToken:n,signOut:r}},__vite__mapDeps([0,1]),import.meta.url);try{await h(r);let o=T(),s=t||o.udsToken;if(r.currentUser){if(_(r.currentUser.uid,s))return;l.warn(`[UDS] Restored Firebase session belongs to another user - signing out`),await a(r)}if(!s||typeof s!=`string`)throw Error(`[UDS] Invalid or missing UDS token. User must be authenticated with a valid UDS token.`);if(!m()){l.info(`[UDS] Private browsing detected - using session-only persistence`);try{await n(r,e)}catch(e){l.warn(`[UDS] Failed to set session persistence:`,e)}}await i(r,s)}finally{p=null}})(),p)},y=async()=>{await i();let e=T();return e.isAuthenticated?await v():await b(),e},b=async()=>{let t=await e().$firebase?.ensure();if(!t?.initialized||!t.auth||(await h(t.auth),!t.auth.currentUser))return;l.warn(`[UDS] Firebase session present for anonymous user - signing out`);let{signOut:n}=await o(async()=>{let{signOut:e}=await import(`./CRUtD73w.js`);return{signOut:e}},__vite__mapDeps([0,1]),import.meta.url);await n(t.auth)},x=async(n,r)=>{let i=await e().$firebase?.ensure(),a=t();if(!i.initialized||!i.functions)throw Error(`[UDS] Firebase not initialized`);let s=await y(),{httpsCallable:c}=await o(async()=>{let{httpsCallable:e}=await import(`./D00poqEh.js`);return{httpsCallable:e}},__vite__mapDeps([2,1]),import.meta.url),l=c(i.functions,n),u=a.public.uds?.site;if(!u)throw Error(`[UDS] Site configuration is required. Add "site" to runtimeConfig.public.uds in nuxt.config.ts`);let d={edition:a.public.edition??`us`,environment:a.public.environment??`prod`,platform:`web`,site:u};!s.isAuthenticated&&s.anonId&&(d.anon_id=s.anonId);let f={...d,...r};return await l(JSON.stringify(f))},S=async()=>{let t=await e().$firebase?.ensure();if(!t?.firestore)throw Error(`[UDS] Firebase Firestore not initialized`);return await y(),t.firestore},C=`uds_anon_id`,w=()=>{if(globalThis.localStorage===void 0)return d();try{let e=globalThis.localStorage.getItem(C);return(!e||e===`null`)&&(e=d(),globalThis.localStorage.setItem(C,e)),e}catch(e){return l.warn(`Failed to access localStorage for anonId:`,e),d()}},T=c(`udsUser`,()=>{let e=a(null),i=a(null),o=a(null),c=a(f.ANONYMOUS),d=a(!1),p=t(),m=p.public.uds?.site,h=String(p.public.edition||`us`);if(!m)throw Error(`[UDS] Site configuration is required. Add "site" to runtimeConfig.public.uds in nuxt.config.ts`);let g=r(()=>c.value===f.AUTHENTICATED),_=r(()=>c.value===f.ANONYMOUS),v=r(()=>e.value||i.value),y=async()=>{if(!d.value){b();try{let e=u(),{user:t,isAuthenticated:r}=s(e);n([t,r],([e,t])=>{t&&e?T({userId:e.regId,udsToken:e.udsToken||null}):E()},{immediate:!0})}catch(e){l.warn(`Auth store not available:`,e)}d.value=!0}},b=()=>{i.value||(i.value=w(),e.value||=i.value)},S=async e=>{try{let t=e?`login`:`logout`;await x(e?`loginNotify`:`logoutNotify`,{data:{action:t,edition:h,site:m,anon_id:i.value||void 0},event:t,environment:String(p.public.environment||`prod`),platform:m})}catch(e){l.warn(`Failed to notify user status change:`,e)}},T=async t=>{e.value=t.userId,o.value=t.udsToken,c.value=f.AUTHENTICATED,await S(!0)},E=async()=>{let t=c.value===f.AUTHENTICATED;e.value=null,o.value=null,c.value=f.ANONYMOUS,b(),e.value=i.value,t&&await S(!1)};return{userId:e,anonId:i,udsToken:o,userState:c,isInitialized:d,isAuthenticated:g,isAnonymous:_,currentUserId:v,initialize:y,ensureAnonId:b,syncFromAuth:T,handleUnauthenticated:E,reset:()=>{if(e.value=null,i.value=null,o.value=null,c.value=f.ANONYMOUS,d.value=!1,globalThis.localStorage!==void 0)try{globalThis.localStorage.removeItem(C)}catch(e){l.warn(`Failed to clear anonId from localStorage:`,e)}}}});
2export{x as n,S as r,T as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.