//#region node_modules/.nitro/vite/services/ssr/index.js var lastCapturedError; var TTL_MS = 5e3; function record(error) { lastCapturedError = { error, at: Date.now() }; } var CAUSE_DEPTH_LIMIT = 5; var DESCRIPTION_LENGTH_LIMIT = 8e3; function describeError(error) { const parts = []; let current = error; for (let depth = 0; depth < CAUSE_DEPTH_LIMIT && current != null; depth++) { if (!(current instanceof Error)) { parts.push(typeof current === "string" ? current : safeStringify(current)); break; } const label = depth === 0 ? "" : "caused by: "; const status = describeStatus(current); parts.push(`${label}${current.stack ?? `${current.name}: ${current.message}`}${status}`); current = current.cause; } return parts.join("\n").slice(0, DESCRIPTION_LENGTH_LIMIT); } function describeStatus(error) { const { status, statusCode } = error; const value = status ?? statusCode; return typeof value === "number" ? ` (status ${value})` : ""; } function safeStringify(value) { try { return JSON.stringify(value) ?? String(value); } catch { return String(value); } } function isErrorLike(value) { return value instanceof Error; } var originalConsoleError = console.error.bind(console); console.error = (...args) => { originalConsoleError(...args.map((arg) => { if (!isErrorLike(arg)) return arg; record(arg); return describeError(arg); })); }; if (typeof globalThis.addEventListener === "function") { globalThis.addEventListener("error", (event) => record(event.error ?? event)); globalThis.addEventListener("unhandledrejection", (event) => record(event.reason)); } function consumeLastCapturedError() { if (!lastCapturedError) return void 0; if (Date.now() - lastCapturedError.at > TTL_MS) { lastCapturedError = void 0; return; } const { error } = lastCapturedError; lastCapturedError = void 0; return error; } function renderErrorPage() { return ` This page didn't load

This page didn't load

Something went wrong on our end. You can try refreshing or head back home.

Go home
`; } var serverEntryPromise; async function getServerEntry() { if (!serverEntryPromise) serverEntryPromise = import("./server-CS0kg_WX.mjs").then((m) => m.default ?? m); return serverEntryPromise; } async function normalizeCatastrophicSsrResponse(response) { if (response.status < 500) return response; if (!(response.headers.get("content-type") ?? "").includes("application/json")) return response; const body = await response.clone().text(); if (!isH3SwallowedErrorBody(body)) return response; console.error(consumeLastCapturedError() ?? /* @__PURE__ */ new Error(`h3 swallowed SSR error: ${body}`)); return new Response(renderErrorPage(), { status: 500, headers: { "content-type": "text/html; charset=utf-8" } }); } function isH3SwallowedErrorBody(body) { try { const payload = JSON.parse(body); return payload.unhandled === true && payload.message === "HTTPError"; } catch { return false; } } var server_default = { async fetch(request, env, ctx) { try { return await normalizeCatastrophicSsrResponse(await (await getServerEntry()).fetch(request, env, ctx)); } catch (error) { console.error(error); return new Response(renderErrorPage(), { status: 500, headers: { "content-type": "text/html; charset=utf-8" } }); } } }; //#endregion export { server_default as default, renderErrorPage as t };