"use strict";(()=>{var e={};e.id=7867,e.ids=[7867],e.modules={47795:e=>{e.exports=require("generate-password")},76154:e=>{e.exports=require("google-auth-library")},27825:e=>{e.exports=require("lodash")},75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},21572:e=>{e.exports=require("nodemailer")},72583:e=>{e.exports=require("sanitize-html")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")},50293:(e,r,t)=>{t.r(r),t.d(r,{config:()=>y,default:()=>f,routeModule:()=>h});var a={};t.r(a),t.d(a,{default:()=>c});var i=t(89947),o=t(2706),s=t(96762),l=t(20503),n=t.n(l),u=t(14385),d=t.n(u),p=t(31341),g=t.n(p);let{OAuth2Client:m}=t(76154);async function c(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=e.body,{invite:a}=e.query,{token:i}=t;try{let e=new m(""),t=(await e.verifyIdToken({idToken:i,audience:""})).getPayload();if(!t||!t.email_verified){r.json({user:null,msg:"Invalid Credentials"});return}let{given_name:o,family_name:s,email:l,sub:u,picture:p,email_verified:c}=t;if(!l)throw Error("No Email");let f=await d()({email:l,payload:{email:l,first_name:o,last_name:s,social_id:u,social_platform:"google",image:p,image_thumbnail:p,username:`google-user-${u}`},social_platform:"google",social_id:u,invitation:a});if(f.payload?.csrf_k){let e=n()({data:JSON.stringify(f.payload)}),{keyCookieName:t,csrfCookieName:a}=g()();r.setHeader("Set-Cookie",[`${t}=${e};samesite=strict;path=/;HttpOnly=true;Secure=true`,`${a}=${f.payload.csrf_k};samesite=strict;path=/;HttpOnly=true`])}r.json(f)}catch(e){console.log(e.message),r.json({success:!1,msg:"Failed!"})}}t(48225);let f=(0,s.M)(a,"default"),y=(0,s.M)(a,"config"),h=new i.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/social-login/google-auth",pathname:"/api/social-login/google-auth",bundlePath:"",filename:""},userland:a})}};var r=require("../../../webpack-api-runtime.js");r.C(e);var t=e=>r(r.s=e),a=r.X(0,[4050,4385],()=>t(50293));module.exports=a})();