"use strict";(()=>{var e={};e.id=4596,e.ids=[4596],e.modules={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")},66710:(e,t,a)=>{a.r(t),a.d(t,{originalPathname:()=>g,patchFetch:()=>x,requestAsyncStorage:()=>u,routeModule:()=>c,serverHooks:()=>h,staticGenerationAsyncStorage:()=>m});var r={};a.r(r),a.d(r,{POST:()=>f});var i=a(49303),n=a(88716),o=a(60670),s=a(87070),l=a(8194),d=a(6350),p=a(56811);async function f(e){try{let{email:t}=await e.json();if(!t)return s.NextResponse.json({error:"Email wajib diisi"},{status:400});let a=await (0,p.Km)("email_verification_enabled");if("true"!==a)return s.NextResponse.json({error:"Fitur verifikasi email tidak aktif"},{status:400});let r=await l._.user.findFirst({where:{email:t}});if(!r)return s.NextResponse.json({message:"Jika email terdaftar, link verifikasi telah dikirim."});if(r.emailVerified)return s.NextResponse.json({message:"Email sudah diverifikasi. Silakan login."});let i=(0,d.cl)(),n=new Date(Date.now()+864e5);await l._.user.update({where:{id:r.id},data:{verificationToken:i,verificationExpiry:n}});let o=`http://localhost:3000/verify-email?token=${i}`,f=(0,d.y5)(r.name,o);try{await (0,d.Yb)({to:r.email,subject:"Verifikasi Email Anda - RestoMenu",html:f})}catch(e){return console.error("Failed to send verification email:",e),s.NextResponse.json({error:"Gagal mengirim email verifikasi. Silakan coba lagi."},{status:500})}return s.NextResponse.json({message:"Jika email terdaftar, link verifikasi telah dikirim."})}catch(e){return console.error("Resend verification error:",e),s.NextResponse.json({error:"Terjadi kesalahan server"},{status:500})}}let c=new i.AppRouteRouteModule({definition:{kind:n.x.APP_ROUTE,page:"/api/auth/resend-verification/route",pathname:"/api/auth/resend-verification",filename:"route",bundlePath:"app/api/auth/resend-verification/route"},resolvedPagePath:"D:\\PROJECT\\resto-saas\\src\\app\\api\\auth\\resend-verification\\route.ts",nextConfigOutput:"",userland:r}),{requestAsyncStorage:u,staticGenerationAsyncStorage:m,serverHooks:h}=c,g="/api/auth/resend-verification/route";function x(){return(0,o.patchFetch)({serverHooks:h,staticGenerationAsyncStorage:m})}},8194:(e,t,a)=>{a.d(t,{_:()=>i});let r=require("@prisma/client"),i=globalThis.prisma??new r.PrismaClient},6350:(e,t,a)=>{a.d(t,{W:()=>s,Yb:()=>n,cl:()=>o,y5:()=>l});var r=a(55245),i=a(56811);async function n({to:e,subject:t,html:a}){let n=await (0,i.$X)(),o=r.createTransport({host:n.smtp_host,port:parseInt(n.smtp_port||"587"),secure:"true"===n.smtp_secure,auth:{user:n.smtp_user,pass:n.smtp_pass}}),s=n.smtp_from_name||"RestoMenu",l=n.smtp_from_email||n.smtp_user;await o.sendMail({from:`"${s}" <${l}>`,to:e,subject:t,html:a})}function o(){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t="";for(let a=0;a<64;a++)t+=e.charAt(Math.floor(Math.random()*e.length));return t}function s(e,t){return`
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Reset Password Anda</title>
</head>
<body style="margin: 0; padding: 0; background-color: #f9fafb; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;">
  <table width="100%" cellpadding="0" cellspacing="0" style="background-color: #f9fafb; padding: 40px 0;">
    <tr>
      <td align="center">
        <table width="600" cellpadding="0" cellspacing="0" style="background-color: #ffffff; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);">
          <!-- Header -->
          <tr>
            <td style="background-color: #ea580c; padding: 32px 40px; text-align: center;">
              <h1 style="margin: 0; color: #ffffff; font-size: 24px; font-weight: 700;">RestoMenu</h1>
            </td>
          </tr>
          <!-- Body -->
          <tr>
            <td style="padding: 40px;">
              <h2 style="margin: 0 0 16px; color: #111827; font-size: 22px; font-weight: 700;">Reset Password Anda</h2>
              <p style="margin: 0 0 24px; color: #374151; font-size: 16px; line-height: 1.6;">
                Halo ${e},
              </p>
              <p style="margin: 0 0 32px; color: #374151; font-size: 16px; line-height: 1.6;">
                Kami menerima permintaan untuk mengatur ulang password akun RestoMenu Anda. Klik tombol di bawah ini untuk membuat password baru.
              </p>
              <!-- Button -->
              <table width="100%" cellpadding="0" cellspacing="0">
                <tr>
                  <td align="center" style="padding-bottom: 32px;">
                    <a href="${t}" style="display: inline-block; background-color: #ea580c; color: #ffffff; text-decoration: none; padding: 14px 40px; border-radius: 8px; font-size: 16px; font-weight: 600;">
                      Reset Password
                    </a>
                  </td>
                </tr>
              </table>
              <p style="margin: 0 0 8px; color: #6b7280; font-size: 14px; line-height: 1.6;">
                Atau salin dan tempel link berikut di browser Anda:
              </p>
              <p style="margin: 0 0 24px; color: #ea580c; font-size: 14px; line-height: 1.6; word-break: break-all;">
                ${t}
              </p>
              <div style="border-top: 1px solid #e5e7eb; padding-top: 24px; margin-top: 8px;">
                <p style="margin: 0; color: #9ca3af; font-size: 13px; line-height: 1.6;">
                  Link berlaku 1 jam. Jika Anda tidak meminta reset password, abaikan email ini. Password Anda tidak akan berubah.
                </p>
              </div>
            </td>
          </tr>
          <!-- Footer -->
          <tr>
            <td style="background-color: #f9fafb; padding: 24px 40px; text-align: center; border-top: 1px solid #e5e7eb;">
              <p style="margin: 0; color: #9ca3af; font-size: 12px;">
                Powered by <a href="https://restomenu.id" style="color: #ea580c; text-decoration: none; font-weight: 600;">restomenu.id</a>
              </p>
            </td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
</body>
</html>
`}function l(e,t){return`
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Verifikasi Email Anda</title>
</head>
<body style="margin: 0; padding: 0; background-color: #f9fafb; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;">
  <table width="100%" cellpadding="0" cellspacing="0" style="background-color: #f9fafb; padding: 40px 0;">
    <tr>
      <td align="center">
        <table width="600" cellpadding="0" cellspacing="0" style="background-color: #ffffff; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);">
          <!-- Header -->
          <tr>
            <td style="background-color: #ea580c; padding: 32px 40px; text-align: center;">
              <h1 style="margin: 0; color: #ffffff; font-size: 24px; font-weight: 700;">RestoMenu</h1>
            </td>
          </tr>
          <!-- Body -->
          <tr>
            <td style="padding: 40px;">
              <h2 style="margin: 0 0 16px; color: #111827; font-size: 22px; font-weight: 700;">Verifikasi Email Anda</h2>
              <p style="margin: 0 0 24px; color: #374151; font-size: 16px; line-height: 1.6;">
                Halo ${e},
              </p>
              <p style="margin: 0 0 32px; color: #374151; font-size: 16px; line-height: 1.6;">
                Terima kasih telah mendaftar di RestoMenu. Silakan klik tombol di bawah ini untuk memverifikasi alamat email Anda.
              </p>
              <!-- Button -->
              <table width="100%" cellpadding="0" cellspacing="0">
                <tr>
                  <td align="center" style="padding-bottom: 32px;">
                    <a href="${t}" style="display: inline-block; background-color: #ea580c; color: #ffffff; text-decoration: none; padding: 14px 40px; border-radius: 8px; font-size: 16px; font-weight: 600;">
                      Verifikasi Email
                    </a>
                  </td>
                </tr>
              </table>
              <p style="margin: 0 0 8px; color: #6b7280; font-size: 14px; line-height: 1.6;">
                Atau salin dan tempel link berikut di browser Anda:
              </p>
              <p style="margin: 0 0 24px; color: #ea580c; font-size: 14px; line-height: 1.6; word-break: break-all;">
                ${t}
              </p>
              <div style="border-top: 1px solid #e5e7eb; padding-top: 24px; margin-top: 8px;">
                <p style="margin: 0; color: #9ca3af; font-size: 13px; line-height: 1.6;">
                  Link berlaku 24 jam. Jika Anda tidak merasa mendaftar di RestoMenu, abaikan email ini.
                </p>
              </div>
            </td>
          </tr>
          <!-- Footer -->
          <tr>
            <td style="background-color: #f9fafb; padding: 24px 40px; text-align: center; border-top: 1px solid #e5e7eb;">
              <p style="margin: 0; color: #9ca3af; font-size: 12px;">
                Powered by <a href="https://restomenu.id" style="color: #ea580c; text-decoration: none; font-weight: 600;">restomenu.id</a>
              </p>
            </td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
</body>
</html>
`}},56811:(e,t,a)=>{a.d(t,{$X:()=>o,Km:()=>n,Rx:()=>s,ks:()=>l});var r=a(8194);let i={payment_fee_mode:"percentage",payment_fee_amount:"2.5",payment_enabled:"true",min_withdrawal:"50000",affiliate_commission_rate:"10",affiliate_enabled:"true",affiliate_min_withdrawal:"50000",email_verification_enabled:"false",smtp_host:"",smtp_port:"587",smtp_user:"",smtp_pass:"",smtp_from_email:"",smtp_from_name:"RestoMenu",smtp_secure:"false"};async function n(e){let t=await r._.platformSetting.findUnique({where:{key:e}});return t?.value??i[e]??""}async function o(){let e=await r._.platformSetting.findMany(),t={...i};for(let a of e)t[a.key]=a.value;return t}async function s(e){let t=Object.entries(e).map(([e,t])=>r._.platformSetting.upsert({where:{key:e},update:{value:t},create:{key:e,value:t}}));await r._.$transaction(t)}function l(e,t,a){let r=parseFloat(a)||0,i=0;i=Math.min(i="percentage"===t?Math.round(e*r/100):Math.round(r),e);let n=e-i;return{fee:i,tenantAmount:n}}}};var t=require("../../../../webpack-runtime.js");t.C(e);var a=e=>t(t.s=e),r=t.X(0,[8948,5972,5245],()=>a(66710));module.exports=r})();