| Server IP : 159.203.156.69 / Your IP : 216.73.217.172 Web Server : nginx/1.24.0 System : Linux main-ubuntu 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/tanviranik.com/node_modules/vinext/dist/shims/ |
Upload File : |
{"version":3,"file":"server.js","names":[],"sources":["../../src/shims/server.ts"],"sourcesContent":["/**\n * next/server shim\n *\n * Provides NextRequest, NextResponse, and related types that work with\n * standard Web APIs (Request/Response). This means they work on Node,\n * Cloudflare Workers, Deno, and any WinterCG-compatible runtime.\n *\n * This is a pragmatic subset — we implement the most commonly used APIs\n * rather than bug-for-bug parity with Next.js internals.\n */\n\nimport {\n MIDDLEWARE_NEXT_HEADER,\n MIDDLEWARE_REWRITE_HEADER,\n MIDDLEWARE_SET_COOKIE_HEADER,\n} from \"../server/headers.js\";\nimport { encodeMiddlewareRequestHeaders } from \"../server/middleware-request-headers.js\";\nimport { serializeSetCookie, validateCookieName } from \"./internal/cookie-serialize.js\";\nimport { parseCookieHeader } from \"./internal/parse-cookie-header.js\";\nimport { getRequestExecutionContext } from \"./request-context.js\";\nimport { assertSafeNavigationUrl } from \"./url-safety.js\";\nimport { stripBasePath } from \"../utils/base-path.js\";\n\n// ---------------------------------------------------------------------------\n// Inlined cache-scope guard for after()\n//\n// We cannot statically import throwIfInsideCacheScope from headers.ts here\n// because headers.ts contains the \"use cache\" directive string in its error\n// message, which causes Vite's use-cache transform to include it in the module\n// graph. If headers.ts is pulled in via static import from server.ts, the\n// transform fires on it in Pages Router fixtures that lack @vitejs/plugin-rsc.\n//\n// The connection() function in this file avoids the same problem by using\n// `await import(\"./headers.js\")` (dynamic import, async function). after()\n// must remain synchronous, so we inline the check using the same Symbol.for\n// keys that cache-runtime.ts and cache.ts register their ALS instances with.\n// ---------------------------------------------------------------------------\n\nconst _USE_CACHE_ALS_KEY = Symbol.for(\"vinext.cacheRuntime.contextAls\");\nconst _UNSTABLE_CACHE_ALS_KEY = Symbol.for(\"vinext.unstableCache.als\");\nconst _g = globalThis as unknown as Record<PropertyKey, unknown>;\n\n/**\n * Record an invalid dynamic usage error on the request context so it survives\n * user try/catch and can be forwarded to the dev overlay on client-side navigations.\n */\nfunction _recordInvalidDynamicUsageError(error: Error): void {\n try {\n const _unifiedAls = _g[Symbol.for(\"vinext.unifiedRequestContext.als\")] as\n | { getStore(): unknown }\n | undefined;\n const ctx = _unifiedAls?.getStore() as Record<string, unknown> | undefined;\n if (ctx) ctx.invalidDynamicUsageError = error;\n } catch {\n // Ignore — best-effort recording for dev diagnostics\n }\n}\n\nfunction _throwIfInsideCacheScope(apiName: string): void {\n const cacheAls = _g[_USE_CACHE_ALS_KEY] as { getStore(): unknown } | undefined;\n if (cacheAls?.getStore() != null) {\n const error = new Error(\n `\\`${apiName}\\` cannot be called inside \"use cache\". ` +\n `If you need this data inside a cached function, call \\`${apiName}\\` ` +\n \"outside and pass the required data as an argument.\",\n );\n _recordInvalidDynamicUsageError(error);\n throw error;\n }\n const unstableAls = _g[_UNSTABLE_CACHE_ALS_KEY] as { getStore(): unknown } | undefined;\n if (unstableAls?.getStore() === true) {\n const error = new Error(\n `\\`${apiName}\\` cannot be called inside a function cached with \\`unstable_cache()\\`. ` +\n `If you need this data inside a cached function, call \\`${apiName}\\` ` +\n \"outside and pass the required data as an argument.\",\n );\n _recordInvalidDynamicUsageError(error);\n throw error;\n }\n}\n\n// ---------------------------------------------------------------------------\n// NextRequest\n// ---------------------------------------------------------------------------\n\nexport class NextRequest extends Request {\n private _nextUrl: NextURL;\n private _url: string;\n private _cookies: RequestCookies;\n\n constructor(\n input: URL | RequestInfo,\n init?: RequestInit & {\n nextConfig?: {\n basePath?: string;\n i18n?: { locales: string[]; defaultLocale: string };\n };\n },\n ) {\n // Strip nextConfig before passing to super() — it's vinext-internal,\n // not a valid RequestInit property.\n const { nextConfig: _nextConfig, ...requestInit } = init ?? {};\n if (input instanceof Request) {\n // Keep caller-owned request bodies readable after wrapping. Middleware and\n // route-handler plumbing may need the source Request after this wrapper runs.\n const requestInput =\n requestInit.body === undefined && input.body && !input.bodyUsed ? input.clone() : input;\n super(requestInput, requestInit);\n } else {\n super(input, requestInit);\n }\n const url =\n typeof input === \"string\"\n ? new URL(input, \"http://localhost\")\n : input instanceof URL\n ? input\n : new URL(input.url, \"http://localhost\");\n const urlConfig: NextURLConfig | undefined = _nextConfig\n ? { basePath: _nextConfig.basePath, nextConfig: { i18n: _nextConfig.i18n } }\n : undefined;\n this._nextUrl = new NextURL(url, undefined, urlConfig);\n this._url = process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE\n ? url.toString()\n : this._nextUrl.toString();\n this._cookies = new RequestCookies(this.headers);\n }\n\n get nextUrl(): NextURL {\n return this._nextUrl;\n }\n\n get url(): string {\n return this._url;\n }\n\n get cookies(): RequestCookies {\n return this._cookies;\n }\n\n /**\n * Client IP address. Prefers Cloudflare's trusted CF-Connecting-IP header\n * over the spoofable X-Forwarded-For. Returns undefined if unavailable.\n */\n get ip(): string | undefined {\n return (\n this.headers.get(\"cf-connecting-ip\") ??\n this.headers.get(\"x-real-ip\") ??\n this.headers.get(\"x-forwarded-for\")?.split(\",\")[0]?.trim() ??\n undefined\n );\n }\n\n /**\n * Geolocation data. Platform-dependent (e.g., Cloudflare, Vercel).\n * Returns undefined if not available.\n */\n get geo():\n | { city?: string; country?: string; region?: string; latitude?: string; longitude?: string }\n | undefined {\n // Check Cloudflare-style headers, Vercel-style headers\n const country =\n this.headers.get(\"cf-ipcountry\") ?? this.headers.get(\"x-vercel-ip-country\") ?? undefined;\n if (!country) return undefined;\n return {\n country,\n city: this.headers.get(\"cf-ipcity\") ?? this.headers.get(\"x-vercel-ip-city\") ?? undefined,\n region:\n this.headers.get(\"cf-region\") ??\n this.headers.get(\"x-vercel-ip-country-region\") ??\n undefined,\n latitude:\n this.headers.get(\"cf-iplatitude\") ?? this.headers.get(\"x-vercel-ip-latitude\") ?? undefined,\n longitude:\n this.headers.get(\"cf-iplongitude\") ??\n this.headers.get(\"x-vercel-ip-longitude\") ??\n undefined,\n };\n }\n\n /**\n * The build ID of the Next.js application.\n * Delegates to `nextUrl.buildId` to match Next.js API surface.\n * Can be used in middleware to detect deployment skew between client and server.\n */\n get buildId(): string | undefined {\n return this._nextUrl.buildId;\n }\n}\n\n// ---------------------------------------------------------------------------\n// NextResponse\n// ---------------------------------------------------------------------------\n\n/** Valid HTTP redirect status codes, matching Next.js's REDIRECTS set. */\nconst REDIRECT_STATUSES = new Set([301, 302, 303, 307, 308]);\n\nfunction validateURL(url: string | URL): string {\n assertSafeNavigationUrl(String(url));\n try {\n return String(new URL(String(url)));\n } catch (error) {\n throw new Error(\n `URL is malformed \"${String(\n url,\n )}\". Please use only absolute URLs - https://nextjs.org/docs/messages/middleware-relative-urls`,\n { cause: error },\n );\n }\n}\n\nexport class NextResponse<_Body = unknown> extends Response {\n private _cookies: ResponseCookies;\n\n constructor(body?: BodyInit | null, init?: ResponseInit) {\n super(body, init);\n this._cookies = new MiddlewareResponseCookies(this.headers);\n }\n\n get cookies(): ResponseCookies {\n return this._cookies;\n }\n\n /**\n * Create a JSON response.\n */\n static json<JsonBody>(body: JsonBody, init?: ResponseInit): NextResponse<JsonBody> {\n const headers = new Headers(init?.headers);\n if (!headers.has(\"content-type\")) {\n headers.set(\"content-type\", \"application/json\");\n }\n return new NextResponse(JSON.stringify(body), {\n ...init,\n headers,\n }) as NextResponse<JsonBody>;\n }\n\n /**\n * Create a redirect response.\n */\n static redirect(url: string | URL, init?: number | ResponseInit): NextResponse {\n const status = typeof init === \"number\" ? init : (init?.status ?? 307);\n if (!REDIRECT_STATUSES.has(status)) {\n throw new RangeError(`Failed to execute \"redirect\" on \"response\": Invalid status code`);\n }\n const headers = new Headers(typeof init === \"object\" ? init?.headers : undefined);\n headers.set(\"Location\", validateURL(url));\n return new NextResponse(null, { status, headers });\n }\n\n /**\n * Create a rewrite response (middleware pattern).\n * Sets the x-middleware-rewrite header.\n */\n static rewrite(destination: string | URL, init?: MiddlewareResponseInit): NextResponse {\n const headers = new Headers(init?.headers);\n headers.set(MIDDLEWARE_REWRITE_HEADER, validateURL(destination));\n if (init?.request?.headers) {\n encodeMiddlewareRequestHeaders(headers, init.request.headers);\n }\n return new NextResponse(null, { ...init, headers });\n }\n\n /**\n * Continue to the next handler (middleware pattern).\n * Sets the x-middleware-next header.\n */\n static next(init?: MiddlewareResponseInit): NextResponse {\n const headers = new Headers(init?.headers);\n headers.set(MIDDLEWARE_NEXT_HEADER, \"1\");\n if (init?.request?.headers) {\n encodeMiddlewareRequestHeaders(headers, init.request.headers);\n }\n return new NextResponse(null, { ...init, headers });\n }\n}\n\n// ---------------------------------------------------------------------------\n// NextURL — lightweight URL wrapper with pathname helpers\n// ---------------------------------------------------------------------------\n\nexport type NextURLConfig = {\n basePath?: string;\n nextConfig?: {\n i18n?: {\n locales: string[];\n defaultLocale: string;\n };\n };\n};\n\nexport class NextURL {\n /** Internal URL stores the pathname WITHOUT basePath or locale prefix. */\n private _url: URL;\n private _basePath: string;\n private _locale: string | undefined;\n private _defaultLocale: string | undefined;\n private _locales: string[] | undefined;\n\n constructor(input: string | URL, base?: string | URL, config?: NextURLConfig) {\n this._url = new URL(input.toString(), base);\n this._basePath = config?.basePath ?? \"\";\n this._stripBasePath();\n const i18n = config?.nextConfig?.i18n;\n if (i18n) {\n this._locales = [...i18n.locales];\n this._defaultLocale = i18n.defaultLocale;\n this._analyzeLocale(this._locales);\n }\n }\n\n /** Strip basePath prefix from the internal pathname. */\n private _stripBasePath(): void {\n if (!this._basePath) return;\n this._url.pathname = stripBasePath(this._url.pathname, this._basePath);\n }\n\n /** Extract locale from pathname, stripping it from the internal URL. */\n private _analyzeLocale(locales: string[]): void {\n const segments = this._url.pathname.split(\"/\");\n const candidate = segments[1]?.toLowerCase();\n const match = locales.find((l) => l.toLowerCase() === candidate);\n if (match) {\n this._locale = match;\n this._url.pathname = \"/\" + segments.slice(2).join(\"/\");\n } else {\n this._locale = this._defaultLocale;\n }\n }\n\n /**\n * Reconstruct the full pathname with basePath + locale prefix.\n * Mirrors Next.js's internal formatPathname().\n */\n private _formatPathname(): string {\n // Build prefix: basePath + locale (skip defaultLocale — Next.js omits it)\n let prefix = this._basePath;\n if (this._locale && this._locale !== this._defaultLocale) {\n prefix += \"/\" + this._locale;\n }\n if (!prefix) return this._url.pathname;\n const inner = this._url.pathname;\n return inner === \"/\" ? prefix : prefix + inner;\n }\n\n get href(): string {\n const formatted = this._formatPathname();\n if (formatted === this._url.pathname) return this._url.href;\n // Replace pathname in href via string slicing — avoids URL allocation.\n // URL.href is always <origin+auth><pathname><search><hash>.\n const { href, pathname, search, hash } = this._url;\n const baseEnd = href.length - pathname.length - search.length - hash.length;\n return href.slice(0, baseEnd) + formatted + search + hash;\n }\n set href(value: string) {\n this._url.href = value;\n this._stripBasePath();\n if (this._locales) this._analyzeLocale(this._locales);\n }\n\n get origin(): string {\n return this._url.origin;\n }\n\n get protocol(): string {\n return this._url.protocol;\n }\n set protocol(value: string) {\n this._url.protocol = value;\n }\n\n get username(): string {\n return this._url.username;\n }\n set username(value: string) {\n this._url.username = value;\n }\n\n get password(): string {\n return this._url.password;\n }\n set password(value: string) {\n this._url.password = value;\n }\n\n get host(): string {\n return this._url.host;\n }\n set host(value: string) {\n this._url.host = value;\n }\n\n get hostname(): string {\n return this._url.hostname;\n }\n set hostname(value: string) {\n this._url.hostname = value;\n }\n\n get port(): string {\n return this._url.port;\n }\n set port(value: string) {\n this._url.port = value;\n }\n\n /** Returns the pathname WITHOUT basePath or locale prefix. */\n get pathname(): string {\n return this._url.pathname;\n }\n set pathname(value: string) {\n this._url.pathname = value;\n }\n\n get search(): string {\n return this._url.search;\n }\n set search(value: string) {\n this._url.search = value;\n }\n\n get searchParams(): URLSearchParams {\n return this._url.searchParams;\n }\n\n get hash(): string {\n return this._url.hash;\n }\n set hash(value: string) {\n this._url.hash = value;\n }\n\n get basePath(): string {\n return this._basePath;\n }\n set basePath(value: string) {\n this._basePath = value === \"\" ? \"\" : value.startsWith(\"/\") ? value : \"/\" + value;\n }\n\n get locale(): string {\n return this._locale ?? \"\";\n }\n set locale(value: string | undefined) {\n if (this._locales) {\n if (!value) {\n this._locale = this._defaultLocale;\n return;\n }\n if (!this._locales.includes(value)) {\n throw new TypeError(\n `The locale \"${value}\" is not in the configured locales: ${this._locales.join(\", \")}`,\n );\n }\n }\n this._locale = this._locales ? value : this._locale;\n }\n\n get defaultLocale(): string | undefined {\n return this._defaultLocale;\n }\n\n get locales(): string[] | undefined {\n return this._locales ? [...this._locales] : undefined;\n }\n\n clone(): NextURL {\n const config: NextURLConfig = {\n basePath: this._basePath,\n nextConfig: this._locales\n ? { i18n: { locales: [...this._locales], defaultLocale: this._defaultLocale! } }\n : undefined,\n };\n // Pass the full href (with locale/basePath re-added) so the constructor\n // can re-analyze and extract locale correctly.\n return new NextURL(this.href, undefined, config);\n }\n\n toString(): string {\n return this.href;\n }\n\n /**\n * The build ID of the Next.js application.\n * Set from `generateBuildId` in next.config.js, or a random UUID if not configured.\n * Can be used in middleware to detect deployment skew between client and server.\n * Matches the Next.js API: `request.nextUrl.buildId`.\n */\n get buildId(): string | undefined {\n return process.env.__VINEXT_BUILD_ID ?? undefined;\n }\n}\n\n// ---------------------------------------------------------------------------\n// Cookie helpers (minimal implementations)\n// ---------------------------------------------------------------------------\n\ntype CookieEntry = {\n name: string;\n value: string;\n};\n\nexport class RequestCookies {\n private _headers: Headers;\n private _parsed: Map<string, string>;\n\n constructor(headers: Headers) {\n this._headers = headers;\n this._parsed = parseCookieHeader(headers.get(\"cookie\") ?? \"\");\n }\n\n get(name: string): CookieEntry | undefined {\n const value = this._parsed.get(name);\n return value !== undefined ? { name, value } : undefined;\n }\n\n getAll(nameOrOptions?: string | CookieEntry): CookieEntry[] {\n const name = typeof nameOrOptions === \"string\" ? nameOrOptions : nameOrOptions?.name;\n return [...this._parsed.entries()]\n .filter(([cookieName]) => name === undefined || cookieName === name)\n .map(([cookieName, value]) => ({ name: cookieName, value }));\n }\n\n has(name: string): boolean {\n return this._parsed.has(name);\n }\n\n set(nameOrOptions: string | CookieEntry, value?: string): this {\n let cookieName: string;\n let cookieValue: string;\n if (typeof nameOrOptions === \"string\") {\n cookieName = nameOrOptions;\n cookieValue = value ?? \"\";\n } else {\n cookieName = nameOrOptions.name;\n cookieValue = nameOrOptions.value;\n }\n validateCookieName(cookieName);\n this._parsed.set(cookieName, cookieValue);\n this._syncHeader();\n return this;\n }\n\n delete(names: string | string[]): boolean | boolean[] {\n if (Array.isArray(names)) {\n const results = names.map((name) => {\n validateCookieName(name);\n return this._parsed.delete(name);\n });\n this._syncHeader();\n return results;\n }\n validateCookieName(names);\n const result = this._parsed.delete(names);\n this._syncHeader();\n return result;\n }\n\n clear(): this {\n this._parsed.clear();\n this._syncHeader();\n return this;\n }\n\n get size(): number {\n return this._parsed.size;\n }\n\n toString(): string {\n return this._serialize();\n }\n\n private _serialize(): string {\n return [...this._parsed.entries()].map(([n, v]) => `${n}=${encodeURIComponent(v)}`).join(\"; \");\n }\n\n private _syncHeader(): void {\n if (this._parsed.size === 0) {\n this._headers.delete(\"cookie\");\n } else {\n this._headers.set(\"cookie\", this._serialize());\n }\n }\n\n [Symbol.iterator](): IterableIterator<[string, CookieEntry]> {\n const entries = this.getAll().map((c) => [c.name, c] as [string, CookieEntry]);\n return entries[Symbol.iterator]();\n }\n}\n\n// Keep this error message in sync with headers.ts. This adapter backs\n// NextRequest cookies, while headers.ts owns the next/headers cookies object.\nclass ReadonlyRequestCookiesError extends Error {\n constructor() {\n super(\n \"Cookies can only be modified in a Server Action or Route Handler. Read more: https://nextjs.org/docs/app/api-reference/functions/cookies#options\",\n );\n }\n\n static callable(this: void): never {\n throw new ReadonlyRequestCookiesError();\n }\n}\n\nconst REQUEST_HEADERS_MUTATING_METHODS = new Set([\"set\", \"delete\", \"append\"]);\n\n// Keep this error message in sync with headers.ts. This adapter backs\n// NextRequest headers in force-static route handlers, while headers.ts owns the\n// next/headers object.\nclass ReadonlyRequestHeadersError extends Error {\n constructor() {\n super(\n \"Headers cannot be modified. Read more: https://nextjs.org/docs/app/api-reference/functions/headers\",\n );\n }\n\n static callable(this: void): never {\n throw new ReadonlyRequestHeadersError();\n }\n}\n\nexport function sealRequestHeaders(headers: Headers): Headers {\n return new Proxy<Headers>(headers, {\n get(target, prop) {\n if (typeof prop === \"string\" && REQUEST_HEADERS_MUTATING_METHODS.has(prop)) {\n return ReadonlyRequestHeadersError.callable;\n }\n\n const value = Reflect.get(target, prop, target);\n return typeof value === \"function\" ? value.bind(target) : value;\n },\n });\n}\n\nexport function sealRequestCookies(cookies: RequestCookies): RequestCookies {\n return new Proxy<RequestCookies>(cookies, {\n get(target, prop) {\n if (prop === \"set\" || prop === \"delete\" || prop === \"clear\") {\n return ReadonlyRequestCookiesError.callable;\n }\n\n const value = Reflect.get(target, prop, target);\n return typeof value === \"function\" ? value.bind(target) : value;\n },\n });\n}\n\nexport class ResponseCookies {\n private _headers: Headers;\n /** Internal map keyed by cookie name — single source of truth. */\n private _parsed: Map<string, { serialized: string; entry: CookieEntry }> = new Map();\n\n constructor(headers: Headers) {\n this._headers = headers;\n\n // Hydrate internal map from any existing Set-Cookie headers\n for (const header of headers.getSetCookie()) {\n const eq = header.indexOf(\"=\");\n if (eq === -1) continue;\n const cookieName = header.slice(0, eq);\n const semi = header.indexOf(\";\", eq);\n const raw = header.slice(eq + 1, semi === -1 ? undefined : semi);\n let value: string;\n try {\n value = decodeURIComponent(raw);\n } catch {\n value = raw;\n }\n this._parsed.set(cookieName, { serialized: header, entry: { name: cookieName, value } });\n }\n }\n\n set(\n ...args:\n | [name: string, value: string, options?: CookieOptions]\n | [options: CookieOptions & { name: string; value: string }]\n ): this {\n const [name, value, opts] = parseCookieSetArgs(args);\n validateCookieName(name);\n\n const serialized = serializeSetCookie(name, value, opts);\n this._parsed.set(name, { serialized, entry: { name, value } });\n this._syncHeaders();\n return this;\n }\n\n get(...args: [name: string] | [options: { name: string }]): CookieEntry | undefined {\n const key = typeof args[0] === \"string\" ? args[0] : args[0].name;\n return this._parsed.get(key)?.entry;\n }\n\n has(name: string): boolean {\n return this._parsed.has(name);\n }\n\n getAll(...args: [name: string] | [options: { name: string }] | []): CookieEntry[] {\n const all = [...this._parsed.values()].map((v) => v.entry);\n if (args.length === 0) return all;\n const key = typeof args[0] === \"string\" ? args[0] : args[0].name;\n return all.filter((c) => c.name === key);\n }\n\n delete(\n ...args:\n | [name: string]\n | [options: Omit<CookieOptions & { name: string }, \"maxAge\" | \"expires\">]\n ): this {\n const [name, opts] =\n typeof args[0] === \"string\" ? [args[0], undefined] : [args[0].name, args[0]];\n return this.set({\n name,\n value: \"\",\n expires: new Date(0),\n path: opts?.path,\n domain: opts?.domain,\n httpOnly: opts?.httpOnly,\n secure: opts?.secure,\n sameSite: opts?.sameSite,\n });\n }\n\n [Symbol.iterator](): IterableIterator<[string, CookieEntry]> {\n const entries: [string, CookieEntry][] = [...this._parsed.values()].map((v) => [\n v.entry.name,\n v.entry,\n ]);\n return entries[Symbol.iterator]();\n }\n\n /** Delete all Set-Cookie headers and re-append from the internal map. */\n private _syncHeaders(): void {\n this._headers.delete(\"Set-Cookie\");\n for (const { serialized } of this._parsed.values()) {\n this._headers.append(\"Set-Cookie\", serialized);\n }\n }\n}\n\nclass MiddlewareResponseCookies extends ResponseCookies {\n private _responseHeaders: Headers;\n\n constructor(headers: Headers) {\n super(headers);\n this._responseHeaders = headers;\n }\n\n override set(\n ...args:\n | [name: string, value: string, options?: CookieOptions]\n | [options: CookieOptions & { name: string; value: string }]\n ): this {\n super.set(...args);\n this._syncMiddlewareCookieHeader();\n return this;\n }\n\n override delete(\n ...args:\n | [name: string]\n | [options: Omit<CookieOptions & { name: string }, \"maxAge\" | \"expires\">]\n ): this {\n super.delete(...args);\n this._syncMiddlewareCookieHeader();\n return this;\n }\n\n private _syncMiddlewareCookieHeader(): void {\n const cookies = this._responseHeaders.getSetCookie();\n if (cookies.length === 0) {\n this._responseHeaders.delete(MIDDLEWARE_SET_COOKIE_HEADER);\n return;\n }\n\n this._responseHeaders.set(MIDDLEWARE_SET_COOKIE_HEADER, cookies.join(\",\"));\n }\n}\n\ntype CookieOptions = {\n path?: string;\n domain?: string;\n maxAge?: number;\n expires?: Date;\n httpOnly?: boolean;\n secure?: boolean;\n sameSite?: \"Strict\" | \"Lax\" | \"None\";\n};\n\n/**\n * Parse the overloaded arguments for ResponseCookies.set():\n * - (name, value, options?) — positional form\n * - ({ name, value, ...options }) — object form\n */\nfunction parseCookieSetArgs(\n args:\n | [name: string, value: string, options?: CookieOptions]\n | [options: CookieOptions & { name: string; value: string }],\n): [string, string, CookieOptions | undefined] {\n if (typeof args[0] === \"string\") {\n return [args[0], args[1] as string, args[2] as CookieOptions | undefined];\n }\n const { name, value, ...opts } = args[0];\n return [name, value, opts as CookieOptions];\n}\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport type MiddlewareResponseInit = {\n request?: {\n headers?: Headers;\n };\n} & ResponseInit;\n\nexport type NextMiddlewareResult = NextResponse | Response | null | undefined | void;\n\nexport type NextMiddleware = (\n request: NextRequest,\n event: NextFetchEvent,\n) => NextMiddlewareResult | Promise<NextMiddlewareResult>;\n\n/**\n * Minimal NextFetchEvent — extends FetchEvent where available,\n * otherwise provides the waitUntil pattern standalone.\n */\nexport class NextFetchEvent {\n sourcePage: string;\n private _waitUntilPromises: Promise<unknown>[] = [];\n\n constructor(params: { page: string }) {\n this.sourcePage = params.page;\n }\n\n waitUntil(promise: Promise<unknown>): void {\n this._waitUntilPromises.push(promise);\n }\n\n get waitUntilPromises(): Promise<unknown>[] {\n return this._waitUntilPromises;\n }\n\n /** Drain all waitUntil promises. Returns a single promise that settles when all are done. */\n drainWaitUntil(): Promise<PromiseSettledResult<unknown>[]> {\n return Promise.allSettled(this._waitUntilPromises);\n }\n}\n\n// ---------------------------------------------------------------------------\n// Utility exports\n// ---------------------------------------------------------------------------\n\n/**\n * Parse user agent string. Minimal implementation — for full UA parsing,\n * apps should use a dedicated library like `ua-parser-js`.\n */\nexport function userAgentFromString(ua: string | undefined): UserAgent {\n const input = ua ?? \"\";\n return {\n isBot: /bot|crawler|spider|crawling/i.test(input),\n ua: input,\n browser: {},\n device: {},\n engine: {},\n os: {},\n cpu: {},\n };\n}\n\nexport function userAgent({ headers }: { headers: Headers }): UserAgent {\n return userAgentFromString(headers.get(\"user-agent\") ?? undefined);\n}\n\nexport type UserAgent = {\n isBot: boolean;\n ua: string;\n browser: { name?: string; version?: string; major?: string };\n device: { model?: string; type?: string; vendor?: string };\n engine: { name?: string; version?: string };\n os: { name?: string; version?: string };\n cpu: { architecture?: string };\n};\n\n/**\n * after() — schedule work after the response is sent.\n *\n * Uses the platform's `waitUntil` (via the per-request ExecutionContext) when\n * available so the task survives past the response on Cloudflare Workers.\n * Falls back to a fire-and-forget microtask on runtimes without an execution\n * context (e.g. Node.js dev server).\n *\n * Throws when called inside a cached scope — request-specific\n * side-effects must not leak into cached results.\n */\nexport function after<T>(task: Promise<T> | (() => T | Promise<T>)): void {\n _throwIfInsideCacheScope(\"after()\");\n\n const promise = typeof task === \"function\" ? Promise.resolve().then(task) : task;\n // NOTE: vinext runs function tasks concurrently with response streaming (next microtask),\n // whereas Next.js queues them to run strictly after the response is sent via onClose.\n // This is a known simplification — function tasks here are not guaranteed to run\n // after the response completes, only after the current synchronous execution.\n //\n // `.catch()` is attached synchronously in the same tick as `promise` is created, so\n // there is no window where a pre-rejected `task` promise could trigger an\n // `unhandledrejection` event before the handler is in place.\n const guarded = promise.catch((err) => {\n console.error(\"[vinext] after() task failed:\", err);\n });\n\n // TODO: Next.js throws when after() is called outside a request context or when\n // waitUntil is unavailable, preventing silent task loss. vinext falls back to\n // fire-and-forget here, which is correct for the Node.js dev server (where\n // getRequestExecutionContext() always returns null). On Workers, a misconfigured\n // entry that omits runWithExecutionContext would silently drop tasks — consider\n // a one-time console.warn on the fallback path, gated to production only (e.g.\n // `process.env.NODE_ENV === 'production'` or `typeof caches !== 'undefined'` for\n // a Workers runtime check) with a module-level `let _warned = false` guard so it\n // fires at most once and doesn't spam the dev-server console.\n getRequestExecutionContext()?.waitUntil(guarded);\n}\n\n/**\n * connection() — signals that the response requires a live connection\n * (not a static/cached response). Opts the page out of ISR caching\n * and sets Cache-Control: no-store on the response.\n */\nexport async function connection(): Promise<void> {\n const { markDynamicUsage, throwIfInsideCacheScope } = await import(\"./headers.js\");\n throwIfInsideCacheScope(\"connection()\");\n markDynamicUsage();\n}\n\n/**\n * URLPattern re-export — used in middleware for route matching.\n * Available natively in Node 20+, Cloudflare Workers, Deno.\n * Falls back to urlpattern-polyfill if the global is not available.\n */\nexport const URLPattern: typeof globalThis.URLPattern =\n globalThis.URLPattern ??\n (() => {\n throw new Error(\n \"URLPattern is not available in this runtime. \" +\n \"Install the `urlpattern-polyfill` package or upgrade to Node 20+.\",\n );\n });\n"],"mappings":";;;;;;;;;;;;;;;;;;AAsCA,MAAM,qBAAqB,OAAO,IAAI,iCAAiC;AACvE,MAAM,0BAA0B,OAAO,IAAI,2BAA2B;AACtE,MAAM,KAAK;;;;;AAMX,SAAS,gCAAgC,OAAoB;CAC3D,IAAI;EAIF,MAAM,MAHc,GAAG,OAAO,IAAI,mCAAmC,GAG5C,UAAU;EACnC,IAAI,KAAK,IAAI,2BAA2B;SAClC;;AAKV,SAAS,yBAAyB,SAAuB;CAEvD,IADiB,GAAG,qBACN,UAAU,IAAI,MAAM;EAChC,MAAM,wBAAQ,IAAI,MAChB,KAAK,QAAQ,iGAC+C,QAAQ,uDAErE;EACD,gCAAgC,MAAM;EACtC,MAAM;;CAGR,IADoB,GAAG,0BACN,UAAU,KAAK,MAAM;EACpC,MAAM,wBAAQ,IAAI,MAChB,KAAK,QAAQ,iIAC+C,QAAQ,uDAErE;EACD,gCAAgC,MAAM;E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