"use strict";(()=>{var e={};e.id=5548,e.ids=[5548,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")},27790:e=>{e.exports=require("assert")},84770:e=>{e.exports=require("crypto")},17702:e=>{e.exports=require("events")},92048:e=>{e.exports=require("fs")},32615:e=>{e.exports=require("http")},32694:e=>{e.exports=require("http2")},35240:e=>{e.exports=require("https")},19801:e=>{e.exports=require("os")},55315:e=>{e.exports=require("path")},76162:e=>{e.exports=require("stream")},74175:e=>{e.exports=require("tty")},17360:e=>{e.exports=require("url")},21764:e=>{e.exports=require("util")},71568:e=>{e.exports=require("zlib")},54574:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>v,patchFetch:()=>x,requestAsyncStorage:()=>m,routeModule:()=>l,serverHooks:()=>f,staticGenerationAsyncStorage:()=>g});var a={};r.r(a),r.d(a,{GET:()=>d,POST:()=>c});var s=r(49303),n=r(88716),o=r(60670),i=r(87070),u=r(72331),p=r(43702);async function d(e,{params:t}){try{let e=await u.default.gameCategory.findUnique({where:{slug:t.slug,isActive:!0}});if(!e)return i.NextResponse.json({error:"Game tidak ditemukan"},{status:404});let r=await u.default.vipProduct.findMany({where:{categoryId:e.id,isActive:!0,status:!0},orderBy:{sellPrice:"asc"}});return i.NextResponse.json({category:e,products:r})}catch(e){return console.error("[GAME PRODUCTS]",e),i.NextResponse.json({error:"Gagal memuat produk"},{status:500})}}async function c(e,{params:t}){try{let{code:t,targetId:r,zone:a}=await e.json();if(!t||!r)return i.NextResponse.json({error:"Kode produk dan ID tujuan diperlukan"},{status:400});let s=await (0,p.E4)(t,r,a);return i.NextResponse.json({nickname:s.nickname,country:s.country})}catch(e){return i.NextResponse.json({error:e.message||"ID tidak valid"},{status:400})}}let l=new s.AppRouteRouteModule({definition:{kind:n.x.APP_ROUTE,page:"/api/games/[slug]/route",pathname:"/api/games/[slug]",filename:"route",bundlePath:"app/api/games/[slug]/route"},resolvedPagePath:"C:\\Users\\akmal\\OneDrive\\Documents\\AmaneNime Topup\\amanenime-topup\\app\\api\\games\\[slug]\\route.ts",nextConfigOutput:"standalone",userland:a}),{requestAsyncStorage:m,staticGenerationAsyncStorage:g,serverHooks:f}=l,v="/api/games/[slug]/route";function x(){return(0,o.patchFetch)({serverHooks:f,staticGenerationAsyncStorage:g})}},72331:(e,t,r)=>{r.r(t),r.d(t,{default:()=>n,prisma:()=>s});var a=r(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",t=process.env.DB_PASSWORD||"",r=process.env.DB_HOST||"127.0.0.1",a=process.env.DB_PORT||"3306",s=process.env.DB_NAME||"amanenime_topup";return`mysql://${e}:${t}@${r}:${a}/${s}`})()}},log:["error"]}),n=s},43702:(e,t,r)=>{r.d(t,{A6:()=>h,E4:()=>y,U5:()=>x,WI:()=>A,checkVipOrderStatus:()=>w});var a=r(63759),s=r(84770),n=r.n(s),o=r(32615),i=r.n(o),u=r(35240),p=r.n(u);let d=new(i()).Agent({family:4}),c=new(p()).Agent({family:4}),l=process.env.VIP_API_URL,m=process.env.VIP_API_KEY,g=process.env.VIP_API_ID;function f(){return n().createHash("md5").update(g+m).digest("hex")}async function v(e){let t=new URLSearchParams;for(let[r,a]of(t.append("key",m),t.append("sign",f()),Object.entries(e)))void 0!==a&&t.append(r,String(a));return(await a.Z.post(l,t.toString(),{headers:{"Content-Type":"application/x-www-form-urlencoded"},timeout:3e4,httpAgent:d,httpsAgent:c})).data}async function x(e,t){let r={type:"services"};e&&(r.filter_game=e),t&&(r.filter_status=t);let a=await v(r);if(!a.result)throw Error(a.message||"Failed to fetch VIP services");return a.data}async function y(e,t,r){let a={type:"get-nickname",code:e,target:t};r&&(a.additional_target=r);let s=await v(a);if(!s.result)throw Error(s.message||"Invalid game ID");return{nickname:s.data,country:s.country}}async function h(e){let t={type:"order",service:e.service,data_no:e.dataNo};e.dataZone&&(t.data_zone=e.dataZone),e.additionalData&&(t.additional_data=e.additionalData);let r=await v(t);if(!r.result)throw Error(r.message||"Failed to create VIP order");return r.data}async function w(e){let t=await v({type:"status",trxid:e});if(!t.result)throw Error(t.message||"Failed to check order status");return Array.isArray(t.data)?t.data[0]:t.data}function A(e){return e===f()}}};var t=require("../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),a=t.X(0,[8948,5972,3759],()=>r(54574));module.exports=a})();