(()=>{var e={};e.id=823,e.ids=[823],e.modules={3295:e=>{"use strict";e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},10846:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},13166:(e,t,r)=>{"use strict";r.r(t),r.d(t,{patchFetch:()=>g,routeModule:()=>d,serverHooks:()=>l,workAsyncStorage:()=>c,workUnitAsyncStorage:()=>u});var o={};r.r(o),r.d(o,{GET:()=>p});var s=r(96559),n=r(48088),i=r(37719),a=r(32190);async function p(e){try{let{searchParams:t}=new URL(e.url),r=t.get("url");if(!r)return a.NextResponse.json({error:"Video URL is required"},{status:400});if(!r.startsWith("http://")&&!r.startsWith("https://"))return a.NextResponse.json({error:"Invalid video URL format"},{status:400});console.log("Proxying video from:",r);let o=await fetch(r,{headers:{"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",Referer:"https://www.tiktok.com/",Accept:"video/webm,video/ogg,video/*;q=0.9,application/ogg;q=0.7,audio/*;q=0.6,*/*;q=0.5","Accept-Language":"en-US,en;q=0.5","Accept-Encoding":"identity",Range:"bytes=0-"}});if(!o.ok)return console.error("Failed to fetch video:",o.status,o.statusText),a.NextResponse.json({error:`Failed to fetch video: ${o.status}`},{status:o.status});let s=await o.arrayBuffer();console.log("Video buffer size:",s.byteLength);let n=o.headers.get("content-type")||"video/mp4",i=new Date().toISOString().replace(/[:.]/g,"-"),p=`savefrominternet.com-tiktok-video${i}.mp4`;return new a.NextResponse(s,{headers:{"Content-Type":n,"Content-Disposition":`attachment; filename="${p}"; filename*=UTF-8''${encodeURIComponent(p)}`,"Content-Length":s.byteLength.toString(),"Cache-Control":"no-cache","Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET","Access-Control-Allow-Headers":"Content-Type","Access-Control-Expose-Headers":"Content-Disposition"}})}catch(e){return console.error("Video proxy error:",e),a.NextResponse.json({error:"Failed to fetch video: "+(e instanceof Error?e.message:"Unknown error")},{status:500})}}let d=new s.AppRouteRouteModule({definition:{kind:n.RouteKind.APP_ROUTE,page:"/api/video/route",pathname:"/api/video",filename:"route",bundlePath:"app/api/video/route"},resolvedPagePath:"C:\\Users\\sande\\Desktop\\Save From Internet\\tiktok-downloader\\src\\app\\api\\video\\route.ts",nextConfigOutput:"",userland:o}),{workAsyncStorage:c,workUnitAsyncStorage:u,serverHooks:l}=d;function g(){return(0,i.patchFetch)({workAsyncStorage:c,workUnitAsyncStorage:u})}},29294:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},63033:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},78335:()=>{},96487:()=>{}};var t=require("../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),o=t.X(0,[447,580],()=>r(13166));module.exports=o})();