1import{a as h,t as d}from"./DiBDg9sp.js";import{u,o as m,r as p,l as w,m as _,n as f,b as k,f as S,j as L}from"./BEdepSaR.js";const U="664349472036-ur7sr36t5djbomck1b2l3prqp5jp5rq9.apps.googleusercontent.com",G="openid email profile https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile",i=["error","error_description","error_uri","id_token","access_token","token_type","expires_in","scope","state"],O=()=>{const o=new URL(window.location.href),a=new URLSearchParams(o.search);i.forEach(t=>a.delete(t));let s=o.pathname;const e=a.toString();e&&(s+=`?${e}`),window.history.replaceState(null,"",s)},C=()=>{const{$toast:o}=u(),a=async e=>{const t=e?.credential;if(!t){o.error("Google Auth failed");return}const n=p();o.loading("Login...");const r=await $fetch("/gateway/user/user/google/login",{method:"POST",body:{token:t,invitationCode:n||void 0,source:f(),ag:_(),landingPageType:w()}}).catch(l=>{console.log(l)});o.dismiss(),r?.code===0?(r.data.isNewUser?(h("kcoZCMissu4aENSmhLE_"),d("sign_up_google")):d("login",{method:"google"}),o.success("Login success"),k(r.data.token),S(r.data),L()):o.error(r?.message||"Server error")},s=()=>{const e=`${window.location.origin}`,n=`https://accounts.google.com/o/oauth2/v2/auth?${new URLSearchParams({client_id:U,redirect_uri:e,response_type:"token id_token",response_mode:"fragment",scope:G,nonce:Math.random().toString(36).substring(2),prompt:"consent",access_type:"online"}).toString()}`;window.location.href=n};return m(()=>{window.handleGoogleLoginCallback=a;const e=new URLSearchParams(window.location.search),t=window.location.hash,n=t?new URLSearchParams(t.substring(1)):null;if((i.some(c=>e.has(c))||i.some(c=>n?.has(c)===!0))&&O(),e.get("error")||n?.get("error")){o.error("Google Auth failed");return}const g=n?.get("id_token")||n?.get("access_token")||e.get("id_token")||e.get("access_token");g&&a({credential:g})}),{handleGoogleLogin:a,handleGoogleOAuthLogin:s}};export{U as GOOGLE_OAUTH_CLIENT_ID,C as useGoogleLogin};
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.