1import{aT as e,B as t,J as o,aD as r}from"./index-CISo_XeK.js";import{r as s}from"./vendor-otp-DeHKHJpu.js";import{f as n,A as i,G as a}from"./vendor-firebase-auth-qgdoq94z.js";import"./vendor-firebase-core-CwSaPZDt.js";import"./vendor-firebase-firestore-C4Zu1D6e.js";import"./vendor-firebase-storage-DSigtlRg.js";import"./vendor-storage--vAQPbvM.js";import"./vendor-query-BfBaFe-V.js";const l=new Set(["https://useapollo.app","https://www.useapollo.app","https://apollo-37628.web.app","https://apollo-37628.firebaseapp.com"]),c="apollo:auth-bridge:target-origin",d="attempt",u=()=>{const[u,p]=s.useState("working"),[g,h]=s.useState("Connecting you to Googleâ¦"),w=s.useRef(!1);return s.useEffect(()=>{if(w.current)return;w.current=!0;const e=new URLSearchParams(window.location.search),s=e.get("origin"),u=s&&l.has(s)?s:null;u&&(e=>{try{sessionStorage.setItem(c,e)}catch{}})(u);const g=u??(()=>{try{return sessionStorage.getItem(c)}catch{return null}})(),m=e=>{if(!g)return!1;const o=window.opener;return!(!o||o.closed||(o.postMessage({type:t,...e},g),0))},f=e=>{p("error"),h(e),m({error:e})};g?(async()=>{var t;try{const s=await n(o);if(!s){if(e.get(d))return void f("Your browser is blocking the storage Google sign-in needs. Allow cookies for this site, then try again.");const t=new URL(window.location.href);return t.searchParams.set(d,"1"),window.history.replaceState(null,"",t.toString()),void(await i(o,r))}const l=null==(t=a.credentialFromResult(s))?void 0:t.idToken;if(!l)return void f("Google did not return a usable sign-in token. Please try again.");if((()=>{try{sessionStorage.removeItem(c)}catch{}})(),!m({idToken:l}))return p("error"),void h("Signed in, but the Apollo tab was closed. Please reopen useapollo.app.");p("done"),h("Signed in. Returning you to Apolloâ¦"),setTimeout(()=>window.close(),600)}catch(s){const e=null==s?void 0:s.code;if("auth/user-cancelled"===e||"auth/popup-closed-by-user"===e)return void f("You cancelled Google sign-in in this tab. Close it and try again.");f("Google sign-in failed. Please close this tab and try again.")}})():f("This page is only used to complete sign-in. Please return to useapollo.app and sign in from there.")},[]),e.jsxs("div",{className:"flex min-h-screen w-full flex-col items-center justify-center gap-4 bg-black px-6 text-center text-white",children:["working"===u&&e.jsx("span",{className:"h-8 w-8 animate-spin rounded-full border-2 border-white/30 border-t-white",role:"status","aria-label":"Signing in"}),e.jsx("p",{className:"max-w-sm text-sm text-white/80",children:g}),"error"===u&&e.jsx("button",{onClick:()=>window.close(),className:"rounded-full border border-white/20 px-4 py-2 text-sm text-white/80 transition hover:bg-white/10",children:"Close this tab"})]})};export{u as default};
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.