"use strict";(()=>{var e={};e.id=86,e.ids=[86],e.modules={145:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},6249:(e,r)=>{Object.defineProperty(r,"l",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},8575:(e,r,t)=>{t.r(r),t.d(r,{config:()=>u,default:()=>f,routeModule:()=>c});var o={};t.r(o),t.d(o,{default:()=>l});var n=t(1802),a=t(7153),i=t(6249),s=t(9842);async function l(e,r){if("POST"===e.method){let{imageData:t,width:o,height:n}=e.body;try{let e=await (0,s.p)(t,o,n);r.status(200).json(e)}catch(e){console.error("Error processing frame:",e),r.status(500).json({error:"Error processing frame"})}}else r.status(405).json({error:"Method not allowed"})}let f=(0,i.l)(o,"default"),u=(0,i.l)(o,"config"),c=new n.PagesAPIRouteModule({definition:{kind:a.x.PAGES_API,page:"/api/process-frame",pathname:"/api/process-frame",bundlePath:"",filename:""},userland:o})},9842:(e,r,t)=>{t.d(r,{p:()=>a});let o=require("sharp");var n=t.n(o);async function a(e,r,t){try{let o;if(console.log("Processing frame:",r,"x",t),"string"==typeof e){let r=e.replace(/^data:image\/\w+;base64,/,"");o=Buffer.from(r,"base64")}else if(Buffer.isBuffer(e))o=e;else throw Error("Invalid imageData format");let a=await n()(o).resize({width:640,height:360,fit:"inside"}).jpeg({quality:80}).toBuffer(),i=`data:image/jpeg;base64,${a.toString("base64")}`;console.log("Image compressed, new size:",i.length);let s=`Frame size ${r}x${t}`;return console.log("Generated frame description:",s),{frameDescription:s,encodedImage:i}}catch(e){throw console.error("Error in processFrame:",e),e}}},7153:(e,r)=>{var t;Object.defineProperty(r,"x",{enumerable:!0,get:function(){return t}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE"}(t||(t={}))},1802:(e,r,t)=>{e.exports=t(145)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=8575);module.exports=t})();