"use strict";(()=>{vare={};e.id=3812,e.ids=[3812],e.modules={43499:e=>{e.exports=require("@moduletrace/datasquirel/functions/hashPassword")},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")},21110:(e,s,t)=>{t.r(s),t.d(s,{config:()=>h,default:()=>g,routeModule:()=>E});vara={};t.r(a),t.d(a,{default:()=>S});varr=t(89947),i=t(2706),n=t(96762),l=t(59474),o=t.n(l),d=t(43499),u=t.n(d),c=t(6420),_=t.n(c),p=t(47670),m=t.n(p),f=t(51348),v=t.n(f);asyncfunctionS(e,s){if("POST"!==e.method)returns.json({msg:"Failed!"});lett=await_()(e,s,!0);if(!t)returns.json({success:!1,msg:"Unauthorized"});leta=e.body,r=a.paradigm;if(r?.match(/database/)){lete=awaitm()({dbFullName:"datasquirel",tableName:"user_users",data:(()=>{lete=Object.keys(a),s={};returne.forEach(e=>{e?.match(/paradigm|priviledge|database_access|databases|confirm/)||(s[e]=a[e])}),s.user_id=t.id,s.password=u()({encryptionKey:process.env.DSQL_ENCRYPTION_PASSWORD||"",password:a.password}),s.user_type="database",s.email=a.email_address,s.image="/images/user-preset.png",s.image_thumbnail="/images/user-preset-thumbnail.png",deletes.email_address,s})()});s.json({success:!!e?.insertId,msg:"New User User Added",newUserId:e.insertId})}else{if(t?.email===a.email_address)returns.json({success:!1,msg:"Can't Invite yourself"});lete=awaitv()("SELECT * FROM invitations WHERE invited_user_email=? AND inviting_user_id=?",[a.email_address,t.id]);if(e&&e[0])returns.json({success:!1,msg:"User Already Invited"});awaitm()({dbFullName:"datasquirel",tableName:"invitations",data:{inviting_user_id:t.id,invited_user_email:a.email_address,database_access:a.database_access,priviledge:a.priviledge,db_tables_data:a.db_tables}});letr=awaito()({to:a.email_address,subject:`${t.first_name}${t.last_name} Invited you`,text:`${t.first_name}${t.last_name} has invited you to manage a datasquirel account`,html:`