"use strict";(()=>{vare={};e.id=8935,e.ids=[8935],e.modules={27825:e=>{e.exports=require("lodash")},75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},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")},27118:(e,t,r)=>{r.r(t),r.d(t,{config:()=>S,default:()=>v,routeModule:()=>h});vari={};r.r(i),r.d(i,{default:()=>E});vara=r(89947),s=r(2706),n=r(96762),l=r(6420),u=r.n(l),o=r(77538),d=r.n(o),c=r(27825),_=r.n(c),m=r(51348),p=r.n(m),f=r(47670),g=r.n(f);asyncfunctionE(e,t){if("POST"!==e.method)returnt.json({user:null,msg:"Registration Failed!"});letr=awaitu()(e,t,!0);if(!r)returnt.json({success:!1,msg:"Unauthorized"});leti=_().cloneDeep(e.body),a=i.inviting_user_id,s=i.invited_user_email,n=i.database_access,l=i.priviledge;try{lete=awaitp()("SELECT email FROM user_users WHERE user_id=? AND invited_user_id=? AND user_type='admin' AND email=?",[a,r.id,r.email]);if(e&&e[0])returnt.json({success:!1});leti=awaitg()({dbFullName:"datasquirel",tableName:"user_users",data:{user_id:a,invited_user_id:r.id,database_access:n,user_priviledge:l,user_type:"admin",first_name:r.first_name,last_name:r.last_name,email:r.email,username:r.first_name,image:r.image,image_thumbnail:r.image_thumbnail}});awaitp()("UPDATE invitations SET invitation_status='Accepted' WHERE inviting_user_id=? AND invited_user_email=?",[a,s]);letu=awaitp()("SELECT db_tables_data FROM invitations WHERE inviting_user_id=?",[a]);if(awaitp()(`DELETE FROM delegated_user_tables WHERE root_user_id='${a}' AND delegated_user_id='${r.id}'`),u&&u[0]){lete=u[0].db_tables_data.split("|");for(lett=0;t<e.length;t++){let[i,s]=e[t].split("-");awaitg()({dbFullName:"datasquirel",tableName:"delegated_user_tables",data:{delegated_user_id:r.id,root_user_id:a,database:i,table:s,priviledge:l}})}}t.json({success:!!i?.insertId})}catch(i){d()({component:"/api/acceptUserInvitation/catch-error",message:i.message,user:r,req:e}),t.json({success:!1})}}r(29021);letv=(0,n.M)(i,"default"),S=(0,n.M)(i,"config"),h=newa.PagesAPIRouteModule({definition:{kind:s.A.PAGES_API,page:"/api/acceptUserInvitation",pathname:"/api/acceptUserInvitation",bundlePath:"",filename:""},userland:i})},77538:(e,t,r)=>{leti=r(29021),{IncomingMessage:a}=r(81630);e.exports=asyncfunction({user:e,message:t,component:r,noMail:a,req:s}){letn=newDate,l=(()=>{if(!s)returnnull;try{lete=s.headers["x-forwarded-for"],t=s.headers["x-real-ip"],r=s.headers["cf-connecting-ip"],i=Array.isArray(e)?e[0]:e?.split(",")[0],a=r||i||t||s.socket.remoteAddress;if(!a)returnnull;returnString(a)}catch(e){returnnull}})();try{leta=`🚀 SERVER ERROR ===========================