"use strict";(()=>{var e={};e.id=543,e.ids=[543],e.modules={517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},7147:e=>{e.exports=require("fs")},3292:e=>{e.exports=require("fs/promises")},1017:e=>{e.exports=require("path")},2579:(e,r,t)=>{t.r(r),t.d(r,{headerHooks:()=>j,originalPathname:()=>w,requestAsyncStorage:()=>h,routeModule:()=>g,serverHooks:()=>v,staticGenerationAsyncStorage:()=>y,staticGenerationBailout:()=>x});var a={};t.r(a),t.d(a,{POST:()=>m,dynamic:()=>l,maxDuration:()=>c,runtime:()=>d}),t(5655);var i=t(3323),o=t(4647),s=t(6886),n=t(3292),u=t(1017),p=t(7147);let d="nodejs",l="force-dynamic",c=30;async function m(e){try{let r=e.headers.get("content-type");if(!r?.includes("multipart/form-data"))return s.Z.json({error:"Content-Type must be multipart/form-data"},{status:415});let t=await e.formData(),a=t.get("file");if(!a)return s.Z.json({error:"No file provided"},{status:400});let i=["image/jpeg","image/jpg","image/png","image/gif","image/svg+xml"];if(!i.includes(a.type))return s.Z.json({error:"Invalid file type",allowedTypes:i,receivedType:a.type},{status:400});if(a.size>5242880)return s.Z.json({error:"File too large",maxSize:5242880,receivedSize:a.size},{status:400});let o=await a.arrayBuffer(),d=(0,u.join)(process.cwd(),"public","headers");(0,p.existsSync)(d)||await (0,n.mkdir)(d,{recursive:!0});let l=a.name.replace(/[^a-zA-Z0-9_.-]/g,"_"),c=l.split(".").pop()?.toLowerCase()||"bin",m=`header-${Date.now()}.${c}`,f=(0,u.join)(d,m);return await (0,n.writeFile)(f,new Uint8Array(o)),s.Z.json({success:!0,filename:m,path:`/headers/${m}`,size:a.size,type:a.type})}catch(e){return console.error("Upload error:",e),s.Z.json({error:"Internal server error",...!1},{status:500})}}let f=i.AppRouteRouteModule,g=new f({definition:{kind:o.x.APP_ROUTE,page:"/api/upload/headers/route",pathname:"/api/upload/headers",filename:"route",bundlePath:"app/api/upload/headers/route"},resolvedPagePath:"C:\\Users\\HP\\Downloads\\project\\app\\api\\upload\\headers\\route.ts",nextConfigOutput:"",userland:a}),{requestAsyncStorage:h,staticGenerationAsyncStorage:y,serverHooks:v,headerHooks:j,staticGenerationBailout:x}=g,w="/api/upload/headers/route"}};var r=require("../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),a=r.X(0,[303],()=>t(2579));module.exports=a})();