export declare const accessControlTemplate = "import { cookies } from \"next/headers\";\nimport {\n GATE_COOKIE_NAME,\n isGateUnlocked,\n timingSafeEqual,\n} from \"@/lib/siteGate\";\n\nfunction bearerToken(req: Request): string | null {\n const authorization = req.headers.get(\"authorization\");\n return authorization?.startsWith(\"Bearer \")\n ? authorization.slice(\"Bearer \".length)\n : null;\n}\n\n/**\n * Route-level authorization for site content. Middleware provides the fast\n * outer gate, while this check ensures direct route invocations are protected\n * too.\n */\nexport async function isSiteRequestAuthorized(): Promise {\n const password = process.env.SITE_PASSWORD;\n if (!password) return true;\n\n const cookieStore = await cookies();\n return isGateUnlocked(cookieStore.get(GATE_COOKIE_NAME)?.value, password);\n}\n\n/**\n * MCP clients may authenticate with DOCS_API_KEY. When no API key is configured,\n * a password-protected site requires the normal gate cookie instead of silently\n * exposing its documentation API.\n */\nexport async function isMcpRequestAuthorized(req: Request): Promise {\n const apiKey = process.env.DOCS_API_KEY;\n if (apiKey) {\n const token = bearerToken(req);\n return token !== null && timingSafeEqual(token, apiKey);\n }\n return isSiteRequestAuthorized();\n}\n";