"use strict";(()=>{var e={};e.id=9118,e.ids=[9118,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")},61282:e=>{e.exports=require("child_process")},84770:e=>{e.exports=require("crypto")},80665:e=>{e.exports=require("dns")},17702:e=>{e.exports=require("events")},92048:e=>{e.exports=require("fs")},32615:e=>{e.exports=require("http")},35240:e=>{e.exports=require("https")},98216:e=>{e.exports=require("net")},19801:e=>{e.exports=require("os")},55315:e=>{e.exports=require("path")},76162:e=>{e.exports=require("stream")},82452:e=>{e.exports=require("tls")},17360:e=>{e.exports=require("url")},21764:e=>{e.exports=require("util")},71568:e=>{e.exports=require("zlib")},88497:(e,r,t)=>{t.r(r),t.d(r,{originalPathname:()=>h,patchFetch:()=>f,requestAsyncStorage:()=>m,routeModule:()=>g,serverHooks:()=>x,staticGenerationAsyncStorage:()=>b});var a={};t.r(a),t.d(a,{POST:()=>c});var o=t(49303),n=t(88716),s=t(60670),i=t(87070),d=t(72331),p=t(84770),l=t.n(p),u=t(36119);async function c(e){try{let{email:r}=await e.json();if(!r)return i.NextResponse.json({error:"Email wajib diisi"},{status:400});let t=await d.default.user.findUnique({where:{email:r}});if(!t)return i.NextResponse.json({success:!0});let a=l().randomBytes(32).toString("hex"),o=new Date(Date.now()+36e5);await d.default.user.update({where:{id:t.id},data:{resetToken:a,resetTokenExp:o}});let n=process.env.APP_URL||"http://localhost:3000",s=`${n}/auth/reset-password?token=${a}`;return await (0,u.LS)(t.email,{name:t.name,resetUrl:s}),i.NextResponse.json({success:!0})}catch(e){return console.error("[FORGOT PASSWORD]",e),i.NextResponse.json({error:"Terjadi kesalahan internal"},{status:500})}}let g=new o.AppRouteRouteModule({definition:{kind:n.x.APP_ROUTE,page:"/api/auth/forgot-password/route",pathname:"/api/auth/forgot-password",filename:"route",bundlePath:"app/api/auth/forgot-password/route"},resolvedPagePath:"C:\\Users\\akmal\\OneDrive\\Documents\\AmaneNime Topup\\amanenime-topup\\app\\api\\auth\\forgot-password\\route.ts",nextConfigOutput:"standalone",userland:a}),{requestAsyncStorage:m,staticGenerationAsyncStorage:b,serverHooks:x}=g,h="/api/auth/forgot-password/route";function f(){return(0,s.patchFetch)({serverHooks:x,staticGenerationAsyncStorage:b})}},36119:(e,r,t)=>{t.d(r,{LS:()=>l,ZU:()=>d,ci:()=>u,mt:()=>p});let a=t(55245).createTransport({host:process.env.SMTP_HOST,port:Number(process.env.SMTP_PORT)||587,secure:!1,auth:{user:process.env.SMTP_USER,pass:process.env.SMTP_PASS}}),o=process.env.SMTP_FROM||"AmaneNime Store <noreply@amanenime.my.id>",n=process.env.APP_NAME||"AmaneNime Store",s=process.env.APP_URL||"https://store.amanenime.my.id";function i(e){return`
    <!DOCTYPE html>
    <html>
    <head>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>${n}</title>
    </head>
    <body style="font-family: 'Segoe UI', Arial, sans-serif; background: #0a0a0f; margin: 0; padding: 20px;">
      <div style="max-width: 600px; margin: 0 auto; background: #1a1a2e; border-radius: 16px; overflow: hidden; border: 1px solid rgba(245,158,11,0.2);">
        <!-- Header -->
        <div style="background: linear-gradient(135deg, #f59e0b, #d97706); padding: 30px; text-align: center;">
          <h1 style="color: #000; margin: 0; font-size: 24px; font-weight: 800; letter-spacing: 1px;">
            ⚡ ${n}
          </h1>
          <p style="color: rgba(0,0,0,0.7); margin: 5px 0 0;">Top Up Game & Digital Products</p>
        </div>
        <!-- Content -->
        <div style="padding: 30px; color: #e2e8f0;">
          ${e}
        </div>
        <!-- Footer -->
        <div style="background: rgba(0,0,0,0.3); padding: 20px; text-align: center; border-top: 1px solid rgba(245,158,11,0.1);">
          <p style="color: #64748b; margin: 0; font-size: 12px;">
            \xa9 2026 ${n}. All rights reserved.<br>
            <a href="${s}" style="color: #f59e0b; text-decoration: none;">${s}</a>
          </p>
        </div>
      </div>
    </body>
    </html>
  `}async function d(e,r){let t=`
    <h2 style="color: #f59e0b; margin-top: 0;">✅ Pesanan Berhasil!</h2>
    <p>Hai <strong>${r.name}</strong>,</p>
    <p>Pesanan kamu telah berhasil diproses!</p>
    <div style="background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); border-radius: 12px; padding: 20px; margin: 20px 0;">
      <table style="width: 100%; border-collapse: collapse;">
        <tr><td style="color: #94a3b8; padding: 6px 0;">Order ID</td><td style="color: #e2e8f0; font-weight: 600;">#${r.orderId.toUpperCase()}</td></tr>
        <tr><td style="color: #94a3b8; padding: 6px 0;">Produk</td><td style="color: #e2e8f0;">${r.productName}</td></tr>
        ${r.targetId?`<tr><td style="color: #94a3b8; padding: 6px 0;">ID Tujuan</td><td style="color: #e2e8f0;">${r.targetId}${r.zone?` (${r.zone})`:""}</td></tr>`:""}
        <tr><td style="color: #94a3b8; padding: 6px 0;">Total</td><td style="color: #f59e0b; font-weight: 700;">Rp ${r.price.toLocaleString("id-ID")}</td></tr>
      </table>
    </div>
    <a href="${s}/dashboard/orders" style="display: inline-block; background: linear-gradient(135deg, #f59e0b, #d97706); color: #000; padding: 12px 24px; border-radius: 8px; text-decoration: none; font-weight: 700; margin-top: 10px;">
      Lihat Detail Order →
    </a>
  `;await a.sendMail({from:o,to:e,subject:`✅ Order Berhasil - ${r.productName} | ${n}`,html:i(t)})}async function p(e,r){let t=`
    <h2 style="color: #f59e0b; margin-top: 0;">📦 Akun Premium Kamu Sudah Siap!</h2>
    <p>Hai <strong>${r.name}</strong>,</p>
    <p>Terima kasih sudah berbelanja di ${n}. Berikut detail akun premium kamu:</p>
    <div style="background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); border-radius: 12px; padding: 20px; margin: 20px 0;">
      <h3 style="color: #f59e0b; margin-top: 0;">🔐 ${r.productName}</h3>
      <table style="width: 100%; border-collapse: collapse;">
        <tr>
          <td style="color: #94a3b8; padding: 8px 0; width: 100px;">Email</td>
          <td style="color: #e2e8f0; font-family: monospace; background: rgba(0,0,0,0.3); padding: 6px 10px; border-radius: 6px; font-weight: 600;">${r.email}</td>
        </tr>
        <tr>
          <td style="color: #94a3b8; padding: 8px 0;">Password</td>
          <td style="color: #e2e8f0; font-family: monospace; background: rgba(0,0,0,0.3); padding: 6px 10px; border-radius: 6px; font-weight: 600;">${r.password}</td>
        </tr>
        ${r.extra?`<tr><td style="color: #94a3b8; padding: 8px 0;">Info</td><td style="color: #e2e8f0;">${r.extra}</td></tr>`:""}
      </table>
    </div>
    <p style="color: #f87171; font-size: 13px;">⚠️ Jangan share akun ini kepada siapapun. Segera ganti password setelah login.</p>
    <a href="${s}/dashboard/orders" style="display: inline-block; background: linear-gradient(135deg, #f59e0b, #d97706); color: #000; padding: 12px 24px; border-radius: 8px; text-decoration: none; font-weight: 700; margin-top: 10px;">
      Lihat Produk Saya →
    </a>
  `;await a.sendMail({from:o,to:e,subject:`📦 Akun ${r.productName} Siap Digunakan | ${n}`,html:i(t)})}async function l(e,r){let t=`
    <h2 style="color: #f59e0b; margin-top: 0;">🔑 Reset Password</h2>
    <p>Hai <strong>${r.name}</strong>,</p>
    <p>Kamu meminta reset password untuk akun ${n}. Klik tombol di bawah untuk melanjutkan:</p>
    <a href="${r.resetUrl}" style="display: inline-block; background: linear-gradient(135deg, #f59e0b, #d97706); color: #000; padding: 14px 28px; border-radius: 8px; text-decoration: none; font-weight: 700; margin: 20px 0;">
      Reset Password →
    </a>
    <p style="color: #64748b; font-size: 13px;">Link ini akan expired dalam <strong>1 jam</strong>. Jika kamu tidak meminta reset password, abaikan email ini.</p>
  `;await a.sendMail({from:o,to:e,subject:`🔑 Reset Password | ${n}`,html:i(t)})}async function u(e,r){let t=`
    <h2 style="color: #f59e0b; margin-top: 0;">💰 Pembayaran Berhasil!</h2>
    <p>Hai <strong>${r.name}</strong>,</p>
    <p>Pembayaran kamu telah berhasil dikonfirmasi.</p>
    <div style="background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); border-radius: 12px; padding: 20px; margin: 20px 0; text-align: center;">
      <p style="color: #94a3b8; margin: 0 0 8px;">Total Pembayaran</p>
      <p style="color: #f59e0b; font-size: 32px; font-weight: 800; margin: 0;">Rp ${r.amount.toLocaleString("id-ID")}</p>
      <p style="color: #94a3b8; margin: 8px 0 0; font-size: 14px;">${r.description}</p>
    </div>
    <a href="${s}/dashboard" style="display: inline-block; background: linear-gradient(135deg, #f59e0b, #d97706); color: #000; padding: 12px 24px; border-radius: 8px; text-decoration: none; font-weight: 700;">
      Buka Dashboard →
    </a>
  `;await a.sendMail({from:o,to:e,subject:`💰 Pembayaran Berhasil - Rp ${r.amount.toLocaleString("id-ID")} | ${n}`,html:i(t)})}},72331:(e,r,t)=>{t.r(r),t.d(r,{default:()=>n,prisma:()=>o});var a=t(53524);let o=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",o=process.env.DB_NAME||"amanenime_topup";return`mysql://${e}:${r}@${t}:${a}/${o}`})()}},log:["error"]}),n=o}};var r=require("../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),a=r.X(0,[8948,5972,5245],()=>t(88497));module.exports=a})();