"use strict";(()=>{var e={};e.id=8919,e.ids=[8919],e.modules={53524:e=>{e.exports=require("@prisma/client")},72934:e=>{e.exports=require("next/dist/client/components/action-async-storage.external.js")},54580:e=>{e.exports=require("next/dist/client/components/request-async-storage.external.js")},45869:e=>{e.exports=require("next/dist/client/components/static-generation-async-storage.external.js")},20399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},30517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},6113:e=>{e.exports=require("crypto")},6005:e=>{e.exports=require("node:crypto")},96258:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>x,patchFetch:()=>g,requestAsyncStorage:()=>h,routeModule:()=>p,serverHooks:()=>v,staticGenerationAsyncStorage:()=>m});var s={};r.r(s),r.d(s,{GET:()=>d,dynamic:()=>u});var a=r(49303),n=r(88716),o=r(60670),i=r(13538),c=r(87070),l=r(26501);let u="force-dynamic";async function d(){try{let{userId:e,isBuildPhase:t}=(0,l.d)();if(t||!e)return c.NextResponse.json({leaves:[]},{status:401});let r=await i.Z.leave.findMany({where:{student:{class:{OR:[{classTeacherId:e},{lessons:{some:{teacherId:e}}}]}}},include:{student:{include:{class:!0}}},orderBy:{createdAt:"desc"}});return c.NextResponse.json({leaves:r})}catch(e){return console.error("Failed to fetch teacher leaves:",e),c.NextResponse.json({leaves:[]},{status:500})}}let p=new a.AppRouteRouteModule({definition:{kind:n.x.APP_ROUTE,page:"/api/v1/attendance/teacher-leaves/route",pathname:"/api/v1/attendance/teacher-leaves",filename:"route",bundlePath:"app/api/v1/attendance/teacher-leaves/route"},resolvedPagePath:"C:\\School Management System\\Working\\V2\\src\\app\\api\\v1\\attendance\\teacher-leaves\\route.ts",nextConfigOutput:"standalone",userland:s}),{requestAsyncStorage:h,staticGenerationAsyncStorage:m,serverHooks:v}=p,x="/api/v1/attendance/teacher-leaves/route";function g(){return(0,o.patchFetch)({serverHooks:v,staticGenerationAsyncStorage:m})}},49303:(e,t,r)=>{e.exports=r(30517)},26501:(e,t,r)=>{r.d(t,{d:()=>a});var s=r(78459);function a(){try{let{userId:e,sessionClaims:t}=(0,s.I)();return{userId:e,sessionClaims:t,isBuildPhase:!1}}catch(e){if(e instanceof Error&&(e.message.includes("DYNAMIC_SERVER_USAGE")||e.message.includes("Dynamic server usage")||e.message.includes("headers")))return console.warn("[DeploymentGuard] Build-phase detected — auth() skipped."),{userId:null,sessionClaims:null,isBuildPhase:!0};throw e}}},13538:(e,t,r)=>{r.d(t,{Z:()=>a});var s=r(53524);let a=globalThis.prisma??new s.PrismaClient({log:["error"],datasources:{db:{url:process.env.DATABASE_URL}}})}};var t=require("../../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),s=t.X(0,[8948,7070,8459],()=>r(96258));module.exports=s})();