"use strict";(()=>{var e={};e.id=7716,e.ids=[7716],e.modules={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")},84770:e=>{e.exports=require("crypto")},88098:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>h,patchFetch:()=>f,requestAsyncStorage:()=>p,routeModule:()=>c,serverHooks:()=>m,staticGenerationAsyncStorage:()=>d});var n={};r.r(n),r.d(n,{POST:()=>s});var o=r(49303),a=r(88716),u=r(60670),l=r(87070),i=r(23402);async function s(){let e=l.NextResponse.json({success:!0});return e.cookies.set(i.HI,"",(0,i.Gn)(0)),e}let c=new o.AppRouteRouteModule({definition:{kind:a.x.APP_ROUTE,page:"/api/auth/logout/route",pathname:"/api/auth/logout",filename:"route",bundlePath:"app/api/auth/logout/route"},resolvedPagePath:"/home/runner/work/CommandMate/CommandMate/src/app/api/auth/logout/route.ts",nextConfigOutput:"",userland:n}),{requestAsyncStorage:p,staticGenerationAsyncStorage:d,serverHooks:m}=c,h="/api/auth/logout/route";function f(){return(0,u.patchFetch)({serverHooks:m,staticGenerationAsyncStorage:d})}},23402:(e,t,r)=>{r.d(t,{HI:()=>a,pC:()=>i,Gn:()=>h,H2:()=>f,n8:()=>m,KL:()=>d,WX:()=>p});var n=r(84770),o=r.n(n);let a="cm_auth_token",u=/^[0-9a-f]{64}$/,l={maxAttempts:5,lockoutDuration:9e5,cleanupInterval:36e5},i=86400,s=(()=>{let e=process.env.CM_AUTH_TOKEN_HASH||void 0;if(e){if(!function(e){return!!e&&u.test(e)}(e)){console.error("[auth] CM_AUTH_TOKEN_HASH is not a valid SHA-256 hash");return}return e}})(),c=function(){let e=process.env.CM_AUTH_EXPIRE,t=Date.now();if(e)try{return t+function(e){let t=e.match(/^(\d+)([hdm])$/);if(!t)throw Error(`Invalid duration format: "${e}". Use Nh, Nd, or Nm (e.g., "24h", "7d", "90m")`);let r=parseInt(t[1],10),n=t[2],o={h:36e5,d:864e5,m:6e4}[n];if(void 0===o)throw Error(`Invalid duration unit: "${n}"`);let a=r*o;if(a<36e5)throw Error(`Duration too short: minimum is 1h (60m). Got: "${e}"`);if(a>2592e6)throw Error(`Duration too long: maximum is 30d (720h). Got: "${e}"`);return a}(e)}catch{return t+864e5}return process.env.CM_AUTH_TOKEN_HASH?t+864e5:null}();function p(e){if(!s||!e||"string"!=typeof e||null!==c&&Date.now()>c)return!1;let t=o().createHash("sha256").update(e).digest("hex"),r=Buffer.from(t,"hex"),n=Buffer.from(s,"hex");return r.length===n.length&&o().timingSafeEqual(r,n)}function d(){return!!s}function m(){if(null===c)return 0;let e=c-Date.now();return e<=0?0:Math.floor(e/1e3)}function h(e){return{httpOnly:!0,sameSite:"strict",secure:!!process.env.CM_HTTPS_CERT,maxAge:e,path:"/"}}function f(){let e=new Map,t=setInterval(()=>{let t=Date.now();for(let[r,n]of e){let o=null===n.lockedUntil||t>n.lockedUntil,a=t-n.lastAttempt>l.lockoutDuration;o&&a&&e.delete(r)}},l.cleanupInterval);return t.unref&&t.unref(),{checkLimit(t){let r=e.get(t);if(!r)return{allowed:!0};if(null!==r.lockedUntil){let e=Date.now();if(e<r.lockedUntil)return{allowed:!1,retryAfter:Math.ceil((r.lockedUntil-e)/1e3)};r.attempts=0,r.lockedUntil=null}return{allowed:!0}},recordFailure(t){let r=Date.now(),n=e.get(t)||{attempts:0,lockedUntil:null,lastAttempt:r};n.attempts++,n.lastAttempt=r,n.attempts>=l.maxAttempts&&(n.lockedUntil=r+l.lockoutDuration),e.set(t,n)},recordSuccess(t){e.delete(t)},destroy(){clearInterval(t),e.clear()}}}}};var t=require("../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),n=t.X(0,[8948,5972],()=>r(88098));module.exports=n})();