"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,a)=>{a.r(s),a.d(s,{config:()=>g,default:()=>S,routeModule:()=>b});vart={};a.r(t),a.d(t,{default:()=>h});varr=a(89947),i=a(2706),n=a(96762),l=a(79531),d=a.n(l),u=a(43499),o=a.n(u),c=a(6420),_=a.n(c),p=a(47670),m=a.n(p),f=a(51348),v=a.n(f);asyncfunctionh(e,s){if("POST"!==e.method)returns.json({msg:"Failed!"});leta=await_()(e,s,!0);if(!a)returns.json({success:!1,msg:"Unauthorized"});lett=e.body,r=t.paradigm;if(r?.match(/database/)){lete=awaitm()({dbFullName:"datasquirel",tableName:"user_users",data:(()=>{lete=Object.keys(t),s={};returne.forEach(e=>{e?.match(/paradigm|priviledge|database_access|databases|confirm/)||(s[e]=t[e])}),s.user_id=a.id,s.password=o()({encryptionKey:process.env.DSQL_ENCRYPTION_PASSWORD||"",password:t.password}),s.user_type="database",s.email=t.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(a?.email===t.email_address)returns.json({success:!1,msg:"Can't Invite yourself"});lete=awaitv()("SELECT * FROM invitations WHERE invited_user_email=? AND inviting_user_id=?",[t.email_address,a.id]);if(e&&e[0])returns.json({success:!1,msg:"User Already Invited"});awaitm()({dbFullName:"datasquirel",tableName:"invitations",data:{inviting_user_id:a.id,invited_user_email:t.email_address,database_access:t.database_access,priviledge:t.priviledge,db_tables_data:t.db_tables}});letr=awaitd()({to:t.email_address,subject:`${a.first_name}${a.last_name} Invited you`,text:`${a.first_name}${a.last_name} has invited you to manage a datasquirel account`,html:`