module.exports=[93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},2996,e=>{"use strict";var t=e.i(75225),r=e.i(77035),s=e.i(18612);let n="hostel_session",o=new TextEncoder;function i(e){let t="";for(let r of e)t+=String.fromCharCode(r);return btoa(t)}function a(e){let t=atob(e),r=new Uint8Array(t.length);for(let e=0;e<t.length;e+=1)r[e]=t.charCodeAt(e);return r}async function l(e,t,r){let s=await crypto.subtle.importKey("raw",o.encode(e),"PBKDF2",!1,["deriveBits"]);return new Uint8Array(await crypto.subtle.deriveBits({name:"PBKDF2",salt:t,iterations:r,hash:"SHA-256"},s,256))}async function p(e){let t=crypto.getRandomValues(new Uint8Array(16)),r=await l(e,t,1e5);return`pbkdf2$100000$${i(t)}$${i(r)}`}async function u(e,t){if(!t)return!1;let[r,s,n,o]=t.split("$");if("pbkdf2"!==r||!n||!o)return!1;let i=Number(s);if(!Number.isFinite(i)||i<1)return!1;let p=a(o);var u=await l(e,a(n),i);if(u.length!==p.length)return!1;let d=0;for(let e=0;e<u.length;e+=1)d|=u[e]^p[e];return 0===d}async function d(e){return i(new Uint8Array(await crypto.subtle.digest("SHA-256",o.encode(e))))}async function c(e){let n=i(crypto.getRandomValues(new Uint8Array(32))),o=new Date(Date.now()+6048e5).toISOString(),a=(0,r.getDb)();return await a.delete(s.userSessions).where((0,t.lt)(s.userSessions.expiresAt,new Date().toISOString())),await a.insert(s.userSessions).values({tokenHash:await d(n),userId:e,expiresAt:o}),{token:n,expiresAt:o}}async function w(e){e&&await (0,r.getDb)().delete(s.userSessions).where((0,t.eq)(s.userSessions.tokenHash,await d(e)))}function x(e){for(let t of(e.headers.get("cookie")||"").split(";")){let[e,...r]=t.trim().split("=");if(e===n)return decodeURIComponent(r.join("="))}return""}async function f(e){let n=x(e);if(!n)return null;let o=(0,r.getDb)(),i=(await o.select({id:s.appUsers.id,email:s.appUsers.email,displayName:s.appUsers.displayName,status:s.appUsers.status,studentId:s.appUsers.studentId,roleId:s.appRoles.id,roleKey:s.appRoles.roleKey,roleName:s.appRoles.name}).from(s.userSessions).innerJoin(s.appUsers,(0,t.eq)(s.userSessions.userId,s.appUsers.id)).innerJoin(s.appRoles,(0,t.eq)(s.appUsers.roleId,s.appRoles.id)).where((0,t.and)((0,t.eq)(s.userSessions.tokenHash,await d(n)),(0,t.gt)(s.userSessions.expiresAt,new Date().toISOString()))))[0];return i&&"active"===i.status?i:null}async function y(e){return(0,r.getDb)().select().from(s.rolePermissions).where((0,t.eq)(s.rolePermissions.roleId,e))}e.s(["SESSION_COOKIE",0,n,"createSession",0,c,"destroySession",0,w,"getSessionUser",0,f,"hashPassword",0,p,"permissionsForRole",0,y,"readSessionCookie",0,x,"sessionCookieHeader",0,function(e,t,r=604800){let s="https:"===new URL(t.url).protocol;return[`${n}=${encodeURIComponent(e)}`,"Path=/","HttpOnly","SameSite=Lax",`Max-Age=${r}`,s?"Secure":""].filter(Boolean).join("; ")},"verifyPassword",0,u])}];

//# sourceMappingURL=%5Broot-of-the-server%5D__0dogxld._.js.map