"use strict";exports.id=4260,exports.ids=[4260],exports.modules={94260:(e,a,r)=>{r.d(a,{processFileUploads:()=>n,saveUploadedFile:()=>l});var i=r(20629),o=r(55315);async function t(e){try{await (0,i.access)(e)}catch{await (0,i.mkdir)(e,{recursive:!0})}}async function l(e,a="general"){try{let r=(0,o.join)(process.cwd(),"uploads",a);await t(r);let l=function(e){let a=Date.now(),r=e.split(".").pop()||"jpg";return`${a}-${Math.floor(1e4*Math.random())}.${r}`}(e.name),n=await e.arrayBuffer(),s=Buffer.from(n),p=(0,o.join)(r,l);await (0,i.writeFile)(p,s);let m=`/api/uploads/${a}/${l}`;return{filename:l,originalName:e.name,size:e.size,mimeType:e.type,url:m}}catch(e){throw console.error("Error saving uploaded file:",e),Error("Failed to save uploaded file")}}async function n(e,a="general",r={}){let{maxFiles:i=10,maxSizeMB:o=10}=r,t=Array.from(e);if(t.length>i)throw Error(`Too many files. Maximum allowed: ${i}`);let n=[];for(let e of t){if(!["image/jpeg","image/jpg","image/png","image/gif","image/webp"].includes(e.type))throw Error(`Invalid file type: ${e.name}. Only images are allowed.`);if(!function(e,a=10){return e.size<=1048576*a}(e,o))throw Error(`File too large: ${e.name}. Maximum size: ${o}MB`);let r=await l(e,a);n.push(r)}return n}}};