"use strict";(()=>{var e={};e.id=37,e.ids=[37],e.modules={3524:e=>{e.exports=require("@prisma/client")},7096:e=>{e.exports=require("bcrypt")},9344:e=>{e.exports=require("jsonwebtoken")},145:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},7732:(e,r,t)=>{t.r(r),t.d(r,{config:()=>c,default:()=>d,routeModule:()=>p});var s={};t.r(s),t.d(s,{default:()=>l});var a=t(1802),i=t(7153),o=t(6249),u=t(8103),n=t(432);async function l(e,r){if("POST"!==e.method)return r.status(405).json({success:!1,error:"Method not allowed"});if(!await (0,u.m)(e,r))return;let{id:t}=e.query;if("string"!=typeof t)return r.status(400).json({success:!1,error:"Invalid material ID"});try{let s=await n.U.toggleFavorite(t,e.user.id);return r.status(200).json({success:!0,data:{favorites:s}})}catch(e){return console.error("Error toggling favorite:",e),r.status(500).json({success:!1,error:"Failed to toggle favorite"})}}let d=(0,o.l)(s,"default"),c=(0,o.l)(s,"config"),p=new a.PagesAPIRouteModule({definition:{kind:i.x.PAGES_API,page:"/api/v1/materials/[id]/favorite",pathname:"/api/v1/materials/[id]/favorite",bundlePath:"",filename:""},userland:s})}};var r=require("../../../../../webpack-api-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[876],()=>t(7732));module.exports=s})();