"use strict";(()=>{var e={};e.id=3002,e.ids=[3002,2331],e.modules={53524:e=>{e.exports=require("@prisma/client")},20399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},30517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},84770:e=>{e.exports=require("crypto")},68419:(e,r,t)=>{t.r(r),t.d(r,{originalPathname:()=>f,patchFetch:()=>A,requestAsyncStorage:()=>g,routeModule:()=>v,serverHooks:()=>x,staticGenerationAsyncStorage:()=>R});var a={};t.r(a),t.d(a,{POST:()=>h});var s=t(49303),i=t(88716),n=t(60670),o=t(87070),u=t(42023),p=t.n(u),l=t(91585),m=t(26033),d=t(72331);let c=l.Ry({name:l.Z_().min(2,"Nama minimal 2 karakter"),email:l.Z_().email("Email tidak valid"),password:l.Z_().min(8,"Password minimal 8 karakter")});async function h(e){try{let r=await e.json(),{name:t,email:a,password:s}=c.parse(r);if(await d.default.user.findUnique({where:{email:a}}))return o.NextResponse.json({error:"Email sudah terdaftar"},{status:400});let i=await p().hash(s,12),n=await d.default.user.create({data:{name:t,email:a,password:i,role:"USER"},select:{id:!0,name:!0,email:!0,role:!0,createdAt:!0}});return o.NextResponse.json({user:n,message:"Registrasi berhasil"},{status:201})}catch(e){if(e instanceof m.jm)return o.NextResponse.json({error:e.errors[0].message},{status:400});return console.error("[REGISTER]",e),o.NextResponse.json({error:"Terjadi kesalahan server"},{status:500})}}let v=new s.AppRouteRouteModule({definition:{kind:i.x.APP_ROUTE,page:"/api/auth/register/route",pathname:"/api/auth/register",filename:"route",bundlePath:"app/api/auth/register/route"},resolvedPagePath:"C:\\Users\\akmal\\OneDrive\\Documents\\AmaneNime Topup\\amanenime-topup\\app\\api\\auth\\register\\route.ts",nextConfigOutput:"standalone",userland:a}),{requestAsyncStorage:g,staticGenerationAsyncStorage:R,serverHooks:x}=v,f="/api/auth/register/route";function A(){return(0,n.patchFetch)({serverHooks:x,staticGenerationAsyncStorage:R})}},72331:(e,r,t)=>{t.r(r),t.d(r,{default:()=>i,prisma:()=>s});var a=t(53524);let s=globalThis.prisma??new a.PrismaClient({datasources:{db:{url:(()=>{if(process.env.DATABASE_URL)return process.env.DATABASE_URL;let e=process.env.DB_USER||"root",r=process.env.DB_PASSWORD||"",t=process.env.DB_HOST||"127.0.0.1",a=process.env.DB_PORT||"3306",s=process.env.DB_NAME||"amanenime_topup";return`mysql://${e}:${r}@${t}:${a}/${s}`})()}},log:["error"]}),i=s}};var r=require("../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),a=r.X(0,[8948,5972,2023,1585],()=>t(68419));module.exports=a})();