"use strict";(()=>{var e={};e.id=5919,e.ids=[5919],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")},65835:(e,t,a)=>{a.r(t),a.d(t,{originalPathname:()=>c,patchFetch:()=>x,requestAsyncStorage:()=>m,routeModule:()=>d,serverHooks:()=>f,staticGenerationAsyncStorage:()=>g});var s={};a.r(s),a.d(s,{GET:()=>u});var o=a(49303),r=a(88716),i=a(60670),n=a(87070);let p=process.env.API_FOOTBALL_KEY||"",l=process.env.API_FOOTBALL_URL||"https://v3.football.api-sports.io",h=new Map;async function u(e,{params:t}){let{searchParams:a}=new URL(e.url),s=a.get("h2h"),o=parseInt(a.get("last")||"10"),r=a.get("homeNama")||void 0,i=a.get("awayNama")||void 0,u=a.get("homeLogo")||void 0,d=a.get("awayLogo")||void 0;if(!s)return n.NextResponse.json({sukses:!1,pesan:"Parameter h2h diperlukan"},{status:400});let m=`h2h_${s}_${o}`,g=h.get(m);if(g&&Date.now()-g.ts<864e5)return n.NextResponse.json({sukses:!0,data:g.data,dariCache:!0});if(p)try{let e=await fetch(`${l}/fixtures/headtohead?h2h=${s}&last=${o}`,{headers:{"x-apisports-key":p}});if(e.ok){let t=(await e.json()).response||[];if(t.length>0)return h.set(m,{data:t,ts:Date.now()}),n.NextResponse.json({sukses:!0,data:t,total:t.length,dariCache:!1})}}catch(e){console.warn("H2H API error, using synthetic fallback:",e)}let f=function(e,t,a,s,o,r){let i=e.split("-"),n=parseInt(i[0])||1,p=parseInt(i[1])||2,l=n+p,h=[];for(let e=0;e<t;e++){let t=(e+1)*4,i=new Date;i.setMonth(i.getMonth()-t);let u=l*(e+1)*3%4,d=l*(e+1)*7%3,m=e%2==1,g=m?p:n,f=m?n:p,c=m?s||`Tim ${p}`:a||`Tim ${n}`,x=m?a||`Tim ${n}`:s||`Tim ${p}`,w=m?r||`https://media.api-sports.io/football/teams/${p}.png`:o||`https://media.api-sports.io/football/teams/${n}.png`,v=m?o||`https://media.api-sports.io/football/teams/${n}.png`:r||`https://media.api-sports.io/football/teams/${p}.png`,y=m?d:u,$=m?u:d,k=y>$||!(y<$)&&null,b=$>y||!($<y)&&null;h.push({fixture:{id:1e3*l+e,date:i.toISOString(),status:{short:"FT",elapsed:90}},league:{name:"Liga 1 Indonesia",country:"Indonesia",logo:"https://media.api-sports.io/football/leagues/274.png"},teams:{home:{id:g,name:c,logo:w,winner:k},away:{id:f,name:x,logo:v,winner:b}},goals:{home:y,away:$},score:{halftime:{home:Math.floor(y/2),away:Math.floor($/2)}}})}return h}(s,Math.min(o,5),r,i,u,d);return h.set(m,{data:f,ts:Date.now()}),n.NextResponse.json({sukses:!0,data:f,total:f.length,sumber:"synthetic"})}let d=new o.AppRouteRouteModule({definition:{kind:r.x.APP_ROUTE,page:"/api/fixtures/[id]/h2h/route",pathname:"/api/fixtures/[id]/h2h",filename:"route",bundlePath:"app/api/fixtures/[id]/h2h/route"},resolvedPagePath:"C:\\xampp\\htdocs\\Bolafest\\app\\api\\fixtures\\[id]\\h2h\\route.ts",nextConfigOutput:"standalone",userland:s}),{requestAsyncStorage:m,staticGenerationAsyncStorage:g,serverHooks:f}=d,c="/api/fixtures/[id]/h2h/route";function x(){return(0,i.patchFetch)({serverHooks:f,staticGenerationAsyncStorage:g})}}};var t=require("../../../../../webpack-runtime.js");t.C(e);var a=e=>t(t.s=e),s=t.X(0,[9276,5972],()=>a(65835));module.exports=s})();