"use strict";(()=>{var e={};e.id=247,e.ids=[247],e.modules={28187:e=>{e.exports=require("@moduletrace/datasquirel")},76102:e=>{e.exports=require("@moduletrace/datasquirel/dist/client")},39383:e=>{e.exports=require("@moduletrace/datasquirel/dist/package-shared/actions/users/user-auth")},65967:e=>{e.exports=require("@moduletrace/datasquirel/dist/package-shared/utils/ejson")},93726:e=>{e.exports=require("@moduletrace/datasquirel/dist/package-shared/utils/numberfy")},30889:e=>{e.exports=require("@moduletrace/datasquirel/dist/package-shared/utils/slugify")},75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,a){return a in r?r[a]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,a)):"function"==typeof r&&"default"===a?r:void 0}}})},40734:(e,r,a)=>{a.r(r),a.d(r,{config:()=>_,default:()=>l,routeModule:()=>c});var t={};a.r(t),a.d(t,{default:()=>o});var s=a(89947),u=a(2706),n=a(96762),i=a(53982),d=a(69842);async function o(e,r){let{user:a,appData:t}=await (0,d.A)(e,r);if(!a)return r.json({success:!1,msg:"Unauthorized"});try{let t=e.query.id,{database:s}=await (0,i.A)({userId:a.id,dbID:t});if(!s?.id)throw Error("Database not Found!");if("GET"===e.method)return r.json({success:!0,payload:s});return r.json({success:!1,msg:"Not Handled!"})}catch(e){r.json({success:!1,msg:e.message})}}let l=(0,n.M)(t,"default"),_=(0,n.M)(t,"config"),c=new s.PagesAPIRouteModule({definition:{kind:u.A.PAGES_API,page:"/api/admin/databases/[id]",pathname:"/api/admin/databases/[id]",bundlePath:"",filename:""},userland:t})},55153:(e,r,a)=>{a.d(r,{On:()=>s.a,_n:()=>n}),a(76102);var t=a(65967),s=a.n(t);a(30889);var u=a(93726);let n=a.n(u)()},53982:(e,r,a)=>{a.d(r,{A:()=>u});var t=a(28187),s=a.n(t);async function u({dbFullName:e,dbID:r,dbSlug:a,userId:t,query:u}){let n={};t&&(n={...n,query:{...n.query,user_id:{value:String(t)}}}),a&&(n={...n,query:{...n.query,db_slug:{value:String(a)}}}),r&&(n={...n,query:{...n.query,id:{value:String(r)}}}),e&&(n={...n,query:{...n.query,db_full_name:{value:String(e)}}});let i={...u,...n},d=await s().crud({action:"get",table:"user_databases",query:i}),o=d?.payload;return{database:o?.[0],databases:o}}},69842:(e,r,a)=>{a.d(r,{A:()=>n});var t=a(39383),s=a.n(t),u=a(55153);async function n(e,r,a,t){let n=s()({req:e,level:a?"deep":void 0}),i={DSQL_REMOTE_SQL_HOST:process.env.DSQL_REMOTE_SQL_HOST,DSQL_SU_USER_ID:process.env.DSQL_SU_USER_ID,DSQL_HOST_ENV:process.env.DSQL_HOST_ENV,DSQL_HOST:process.env.DSQL_HOST,DSQL_STATIC_HOST:process.env.DSQL_STATIC_HOST,DSQL_GOOGLE_CLIENT_ID:process.env.DSQL_GOOGLE_CLIENT_ID,DSQL_TINY_MCE_API_KEY:process.env.DSQL_TINY_MCE_API_KEY};return t&&n.payload?.id&&(0,u._n)(process.env.DSQL_SU_USER_ID)!==n.payload.id?{user:null,appData:i}:{user:n.payload,appData:i}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return a}});var a=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,a)=>{e.exports=a(75600)}};var r=require("../../../../webpack-api-runtime.js");r.C(e);var a=r(r.s=40734);module.exports=a})();