(()=>{var e={};e.id=5899,e.ids=[5899],e.modules={3295:e=>{"use strict";e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},10846:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},24429:()=>{},29294:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},63033:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},64749:()=>{},78603:(e,t,r)=>{"use strict";r.r(t),r.d(t,{patchFetch:()=>g,routeModule:()=>l,serverHooks:()=>h,workAsyncStorage:()=>c,workUnitAsyncStorage:()=>d});var s={};r.r(s),r.d(s,{GET:()=>p,POST:()=>u});var o=r(30781),a=r(60554),n=r(31625),i=r(80129);let p=async e=>{let t=(0,i.UL)();if(!t.get("token")?.value)return new Response(JSON.stringify({error:"Unauthorized"}),{status:401});try{let{searchParams:t}=e.nextUrl,r=t.get("labId"),s=r?`http://localhost:3001/api/lab-tests/lab/${r}`:"http://localhost:3001/api/lab-tests",o=await fetch(s,{method:"GET",headers:{"Content-Type":"application/json",cookie:e.headers.get("cookie")||""}});if(!o.ok)throw Error("Failed to fetch lab tests");let a=await o.json();return new Response(JSON.stringify(a),{status:200})}catch(e){return console.error("Error fetching lab tests:",e),new Response(JSON.stringify({error:"Internal server error"}),{status:500})}},u=async e=>{let t=(0,i.UL)();if(!t.get("token")?.value)return new Response(JSON.stringify({error:"Unauthorized"}),{status:401});try{let t=await e.json(),r=await fetch("http://localhost:3001/api/lab-tests",{method:"POST",headers:{"Content-Type":"application/json",cookie:e.headers.get("cookie")||""},body:JSON.stringify(t)});if(!r.ok){let e=await r.json();throw Error(e.message||"Failed to submit lab test")}let s=await r.json();return new Response(JSON.stringify(s),{status:200})}catch(e){return console.error("Error submitting lab test:",e),new Response(JSON.stringify({error:"Internal server error"}),{status:500})}},l=new o.AppRouteRouteModule({definition:{kind:a.RouteKind.APP_ROUTE,page:"/api/lab-tests/route",pathname:"/api/lab-tests",filename:"route",bundlePath:"app/api/lab-tests/route"},resolvedPagePath:"/home/kencert/Desktop/Work/consultingsystem/frontend/app/api/lab-tests/route.js",nextConfigOutput:"",userland:s}),{workAsyncStorage:c,workUnitAsyncStorage:d,serverHooks:h}=l;function g(){return(0,n.patchFetch)({workAsyncStorage:c,workUnitAsyncStorage:d})}}};var t=require("../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),s=t.X(0,[1625,3197],()=>r(78603));module.exports=s})();