| 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/server/ |
Upload File : |
{"version":3,"file":"app-browser-entry.js","names":["_exhaustive"],"sources":["../../src/server/app-browser-entry.ts"],"sourcesContent":["/// <reference types=\"vite/client\" />\n\nimport { createElement, use, useLayoutEffect, useRef, useState } from \"react\";\nimport {\n createFromFetch,\n createFromReadableStream,\n createTemporaryReferenceSet,\n encodeReply,\n setServerCallback,\n} from \"@vitejs/plugin-rsc/browser\";\nimport { hydrateRoot } from \"react-dom/client\";\nimport \"../client/instrumentation-client.js\";\nimport { notifyAppRouterTransitionStart } from \"../client/instrumentation-client-state.js\";\nimport {\n __basePath,\n appRouterInstance,\n commitClientNavigationState,\n consumePrefetchResponse,\n createClientNavigationRenderSnapshot,\n getCurrentNextUrl,\n getCurrentInterceptionContext,\n getClientNavigationRenderContext,\n getPrefetchCache,\n getPrefetchedUrls,\n pushHistoryStateWithoutNotify,\n replaceClientParamsWithoutNotify,\n replaceHistoryStateWithoutNotify,\n restoreRscResponse,\n setClientParams,\n setPendingPathname,\n setMountedSlotsHeader,\n setNavigationContext,\n type CachedRscResponse,\n type ClientNavigationRenderSnapshot,\n} from \"vinext/shims/navigation\";\nimport { installWindowNext } from \"../client/window-next.js\";\nimport {\n chunksToReadableStream,\n createProgressiveRscStream,\n getVinextBrowserGlobal,\n} from \"./app-browser-stream.js\";\nimport {\n createAppBrowserNavigationController,\n clearHardNavigationLoopGuard,\n type HistoryUpdateMode,\n type NavigationPayloadOutcome,\n type PendingBrowserRouterState,\n} from \"./app-browser-navigation-controller.js\";\nimport {\n isServerActionResult,\n shouldClearClientNavigationCachesForServerActionResult,\n type AppBrowserServerActionResult,\n} from \"./app-browser-action-result.js\";\nimport {\n consumeInitialFormState,\n createVinextHydrateRootOptions,\n} from \"./app-browser-hydration.js\";\nimport {\n AppElementsWire,\n getMountedSlotIdsHeader,\n resolveVisitedResponseInterceptionContext,\n type AppElements,\n type AppWireElements,\n} from \"./app-elements.js\";\nimport {\n createHistoryStateWithPreviousNextUrl,\n readHistoryStatePreviousNextUrl,\n resolveInterceptionContextFromPreviousNextUrl,\n resolveServerActionRequestState,\n type AppRouterState,\n type OperationLane,\n} from \"./app-browser-state.js\";\nimport { DevRecoveryBoundary, RedirectBoundary } from \"vinext/shims/error-boundary\";\nimport { ElementsContext, Slot } from \"vinext/shims/slot\";\nimport { createOnUncaughtError } from \"./app-browser-error.js\";\nimport {\n devOnCaughtError,\n devOnUncaughtError,\n dismissOverlay,\n installDevErrorOverlay,\n} from \"./dev-error-overlay.js\";\nimport { DANGEROUS_URL_BLOCK_MESSAGE, isDangerousScheme } from \"vinext/shims/url-safety\";\nimport {\n getServerActionNotFoundClientMessage,\n isServerActionNotFoundResponse,\n} from \"./server-action-not-found.js\";\nimport {\n createRscRequestHeaders,\n createRscRequestUrl,\n stripRscCacheBustingSearchParam,\n stripRscSuffix,\n VINEXT_RSC_CONTENT_TYPE,\n} from \"./app-rsc-cache-busting.js\";\nimport { APP_RSC_RENDER_MODE_REFRESH_PRESERVE_UI } from \"./app-rsc-render-mode.js\";\nimport {\n ACTION_REDIRECT_HEADER,\n ACTION_REDIRECT_TYPE_HEADER,\n VINEXT_MOUNTED_SLOTS_HEADER,\n VINEXT_PARAMS_HEADER,\n} from \"./headers.js\";\n\ntype SearchParamInput = ConstructorParameters<typeof URLSearchParams>[0];\n\ntype ServerActionResult = AppBrowserServerActionResult<AppWireElements>;\n\ntype NavigationKind = \"navigate\" | \"traverse\" | \"refresh\";\n\n// Maps NavigationKind to the AppRouterAction type used by the reducer.\n// \"refresh\" is intentionally treated as \"navigate\" (merge, preserve absent slots).\n// Both call sites must stay in sync — update here if NavigationKind gains new values.\nfunction toActionType(kind: NavigationKind): \"navigate\" | \"traverse\" {\n return kind === \"traverse\" ? \"traverse\" : \"navigate\";\n}\n\nfunction toOperationLane(kind: NavigationKind): OperationLane {\n switch (kind) {\n case \"navigate\":\n return \"navigation\";\n case \"refresh\":\n return \"refresh\";\n case \"traverse\":\n return \"traverse\";\n default: {\n const _exhaustive: never = kind;\n throw new Error(\"[vinext] Unknown navigation kind: \" + String(_exhaustive));\n }\n }\n}\n\ntype VisitedResponseCacheEntry = {\n params: Record<string, string | string[]>;\n expiresAt: number;\n response: CachedRscResponse;\n};\n\nconst MAX_VISITED_RESPONSE_CACHE_SIZE = 50;\nconst VISITED_RESPONSE_CACHE_TTL = 5 * 60_000;\nconst MAX_TRAVERSAL_CACHE_TTL = 30 * 60_000;\nconst browserNavigationController = createAppBrowserNavigationController();\nconst NavigationCommitSignal = browserNavigationController.NavigationCommitSignal;\n\n// Parses a URI-encoded JSON value carried in a response header (e.g.\n// `X-Vinext-Params`). Returns `null` on missing or malformed input so callers\n// can fall back to their own defaults. Silent by design — these headers are\n// best-effort hydration data and a parse failure should not break navigation.\nfunction parseEncodedJsonHeader<T>(value: string | null): T | null {\n if (!value) return null;\n try {\n return JSON.parse(decodeURIComponent(value)) as T;\n } catch {\n return null;\n }\n}\n\nfunction isRouterStatePromise(\n value: AppRouterState | Promise<AppRouterState>,\n): value is Promise<AppRouterState> {\n return value instanceof Promise;\n}\n\nlet latestClientParams: Record<string, string | string[]> = {};\nconst visitedResponseCache = new Map<string, VisitedResponseCacheEntry>();\n// Sticky bit: stays true once BrowserRoot has committed at least once. Used by\n// the HMR handler to distinguish \"still hydrating\" (wait) from \"was up, then\n// torn down by a render error\" (full reload to recover).\nlet browserRouterStateHasEverCommitted = false;\n// Most recent navigation target that has been dispatched but not yet committed.\n// Read by the onUncaughtError handler so a render error tearing down the tree\n// can land the browser on the URL the user was actually navigating to, instead\n// of stranding them on the previous URL with a blank page. Cleared once the\n// commit effect runs (URL update succeeded) or the navigation is superseded.\nlet pendingNavigationRecoveryHref: string | null = null;\n\nfunction getBrowserRouterState(): AppRouterState {\n return browserNavigationController.getBrowserRouterState();\n}\n\nfunction hasBrowserRouterState(): boolean {\n return browserNavigationController.hasBrowserRouterState();\n}\n\nfunction waitForBrowserRouterStateReady(): Promise<void> {\n return browserNavigationController.waitForBrowserRouterStateReady();\n}\n\nfunction beginPendingBrowserRouterState(): PendingBrowserRouterState {\n return browserNavigationController.beginPendingBrowserRouterState();\n}\n\nfunction applyClientParams(params: Record<string, string | string[]>): void {\n latestClientParams = params;\n setClientParams(params);\n}\n\nfunction stageClientParams(params: Record<string, string | string[]>): void {\n // NB: latestClientParams diverges from ClientNavigationState.clientParams\n // between staging and commit. Server action snapshots (same-URL\n // commitSameUrlNavigatePayload() calls inside registerServerActionCallback)\n // read latestClientParams, so a\n // server action fired during this window would get the pending (not yet\n // committed) params. This is acceptable because the commit effect fires\n // before hooks observe the new URL state, keeping the window vanishingly small.\n latestClientParams = params;\n replaceClientParamsWithoutNotify(params);\n}\n\nfunction clearVisitedResponseCache(): void {\n visitedResponseCache.clear();\n}\n\nfunction clearPrefetchState(): void {\n getPrefetchCache().clear();\n getPrefetchedUrls().clear();\n}\n\nfunction clearClientNavigationCaches(): void {\n clearVisitedResponseCache();\n clearPrefetchState();\n}\n\nfunction createNavigationCommitEffect(options: {\n href: string;\n historyUpdateMode: HistoryUpdateMode | undefined;\n navId: number;\n params: Record<string, string | string[]>;\n previousNextUrl: string | null;\n}): () => void {\n const { href, historyUpdateMode, navId, params, previousNextUrl } = options;\n\n return () => {\n // Only update URL if this is still the active navigation.\n // A newer navigation would have superseded this navigation id.\n if (!browserNavigationController.isCurrentNavigation(navId)) {\n // This transition was superseded before commit; balance the active\n // snapshot counter without clearing pendingPathname ownership.\n commitClientNavigationState(undefined, { releaseSnapshot: true });\n return;\n }\n\n const targetHref = new URL(href, window.location.origin).href;\n stageClientParams(params);\n const preserveExistingState = historyUpdateMode === \"replace\";\n const historyState = createHistoryStateWithPreviousNextUrl(\n preserveExistingState ? window.history.state : null,\n previousNextUrl,\n );\n\n if (historyUpdateMode === \"replace\" && window.location.href !== targetHref) {\n replaceHistoryStateWithoutNotify(historyState, \"\", href);\n } else if (historyUpdateMode === \"push\" && window.location.href !== targetHref) {\n pushHistoryStateWithoutNotify(historyState, \"\", href);\n }\n\n // URL has been updated; the recovery hard-nav target is no longer needed.\n pendingNavigationRecoveryHref = null;\n commitClientNavigationState(navId);\n };\n}\n\nasync function renderNavigationPayload(\n payload: Promise<AppElements>,\n navigationSnapshot: ClientNavigationRenderSnapshot,\n targetHref: string,\n navId: number,\n historyUpdateMode: HistoryUpdateMode | undefined,\n params: Record<string, string | string[]>,\n previousNextUrl: string | null,\n pendingRouterState: PendingBrowserRouterState | null,\n actionType: \"navigate\" | \"replace\" | \"traverse\" = \"navigate\",\n operationLane: OperationLane = \"navigation\",\n): Promise<NavigationPayloadOutcome> {\n try {\n return await browserNavigationController.renderNavigationPayload({\n actionType,\n createNavigationCommitEffect: (options) => {\n pendingNavigationRecoveryHref = options.href;\n return createNavigationCommitEffect(options);\n },\n historyUpdateMode,\n navigationSnapshot,\n nextElements: payload,\n operationLane,\n params,\n pendingRouterState,\n previousNextUrl,\n targetHref,\n navId,\n });\n } catch (error) {\n pendingNavigationRecoveryHref = null;\n throw error;\n }\n}\n\nasync function commitSameUrlNavigatePayload(\n nextElements: Promise<AppElements>,\n returnValue?: ServerActionResult[\"returnValue\"],\n actionInitiationState?: AppRouterState,\n): Promise<unknown> {\n const navigationSnapshot = createClientNavigationRenderSnapshot(\n window.location.href,\n latestClientParams,\n );\n return browserNavigationController.commitSameUrlNavigatePayload(\n nextElements,\n navigationSnapshot,\n returnValue,\n actionInitiationState,\n );\n}\n\nfunction evictVisitedResponseCacheIfNeeded(): void {\n while (visitedResponseCache.size >= MAX_VISITED_RESPONSE_CACHE_SIZE) {\n const oldest = visitedResponseCache.keys().next().value;\n if (oldest === undefined) {\n return;\n }\n visitedResponseCache.delete(oldest);\n }\n}\n\nfunction getVisitedResponse(\n rscUrl: string,\n interceptionContext: string | null,\n mountedSlotsHeader: string | null,\n navigationKind: NavigationKind,\n): VisitedResponseCacheEntry | null {\n const cacheKey = AppElementsWire.encodeCacheKey(rscUrl, interceptionContext);\n const cached = visitedResponseCache.get(cacheKey);\n if (!cached) {\n return null;\n }\n\n if ((cached.response.mountedSlotsHeader ?? null) !== mountedSlotsHeader) {\n visitedResponseCache.delete(cacheKey);\n return null;\n }\n\n if (navigationKind === \"refresh\") {\n return null;\n }\n\n if (navigationKind === \"traverse\") {\n const createdAt = cached.expiresAt - VISITED_RESPONSE_CACHE_TTL;\n if (Date.now() - createdAt >= MAX_TRAVERSAL_CACHE_TTL) {\n visitedResponseCache.delete(cacheKey);\n return null;\n }\n // LRU: promote to most-recently-used (delete + re-insert moves to end of Map)\n visitedResponseCache.delete(cacheKey);\n visitedResponseCache.set(cacheKey, cached);\n return cached;\n }\n\n if (cached.expiresAt > Date.now()) {\n // LRU: promote to most-recently-used\n visitedResponseCache.delete(cacheKey);\n visitedResponseCache.set(cacheKey, cached);\n return cached;\n }\n\n visitedResponseCache.delete(cacheKey);\n return null;\n}\n\nfunction storeVisitedResponseSnapshot(\n rscUrl: string,\n interceptionContext: string | null,\n snapshot: CachedRscResponse,\n params: Record<string, string | string[]>,\n): void {\n const cacheKey = AppElementsWire.encodeCacheKey(rscUrl, interceptionContext);\n visitedResponseCache.delete(cacheKey);\n evictVisitedResponseCacheIfNeeded();\n const now = Date.now();\n visitedResponseCache.set(cacheKey, {\n params,\n expiresAt: now + VISITED_RESPONSE_CACHE_TTL,\n response: snapshot,\n });\n}\n\ntype NavigationRequestState = {\n interceptionContext: string | null;\n previousNextUrl: string | null;\n};\n\nfunction getRequestState(\n navigationKind: NavigationKind,\n previousNextUrlOverride?: string | null,\n): NavigationRequestState {\n if (previousNextUrlOverride !== undefined) {\n return {\n interceptionContext: resolveInterceptionContextFromPreviousNextUrl(\n previousNextUrlOverride,\n __basePath,\n ),\n previousNextUrl: previousNextUrlOverride,\n };\n }\n\n switch (navigationKind) {\n case \"navigate\":\n return {\n interceptionContext: getCurrentInterceptionContext(),\n previousNextUrl: getCurrentNextUrl(),\n };\n case \"traverse\": {\n const previousNextUrl = readHistoryStatePreviousNextUrl(window.history.state);\n return {\n interceptionContext: resolveInterceptionContextFromPreviousNextUrl(\n previousNextUrl,\n __basePath,\n ),\n previousNextUrl,\n };\n }\n case \"refresh\": {\n const currentPreviousNextUrl = getBrowserRouterState().previousNextUrl;\n return {\n interceptionContext: resolveInterceptionContextFromPreviousNextUrl(\n currentPreviousNextUrl,\n __basePath,\n ),\n previousNextUrl: currentPreviousNextUrl,\n };\n }\n default: {\n const _exhaustive: never = navigationKind;\n throw new Error(\"[vinext] Unknown navigation kind: \" + String(_exhaustive));\n }\n }\n}\n\n// Dev-only callback invoked when DevRecoveryBoundary catches. The replaced\n// subtree means NavigationCommitSignal's useLayoutEffect never fires, so the\n// URL update for the in-flight navigation would otherwise be lost. Force-drain\n// the queued pre-paint effect for this renderId so the URL still moves to the\n// navigation target, the dev overlay shows which URL is broken, and HMR's\n// rsc:update fetches the right payload after the bug is fixed.\nfunction handleDevRecoveryBoundaryCatch(resetKey: number): void {\n // React's onCaughtError option already routes the error to the dev overlay.\n // Our job here is purely to drive the URL update for the in-flight\n // navigation that this failed render belonged to.\n browserNavigationController.drainPrePaintEffects(resetKey);\n}\n\nfunction decodeAppElementsPromise(payload: Promise<AppWireElements>): Promise<AppElements> {\n // Wrap in Promise.resolve() because createFromReadableStream() returns a\n // React Flight thenable whose .then() returns undefined (not a new Promise).\n // Without the wrap, chaining .then() produces undefined → use() crashes.\n return Promise.resolve(payload).then((elements) => AppElementsWire.decode(elements));\n}\n\nfunction BrowserRoot({\n initialElements,\n initialNavigationSnapshot,\n}: {\n initialElements: Promise<AppElements>;\n initialNavigationSnapshot: ClientNavigationRenderSnapshot;\n}) {\n const resolvedElements = use(initialElements);\n const initialMetadata = AppElementsWire.readMetadata(resolvedElements);\n const [treeStateValue, setTreeStateValue] = useState<AppRouterState | Promise<AppRouterState>>({\n activeOperation: null,\n elements: resolvedElements,\n interceptionContext: initialMetadata.interceptionContext,\n layoutIds: initialMetadata.layoutIds,\n layoutFlags: initialMetadata.layoutFlags,\n navigationSnapshot: initialNavigationSnapshot,\n previousNextUrl: null,\n renderId: 0,\n rootLayoutTreePath: initialMetadata.rootLayoutTreePath,\n routeId: initialMetadata.routeId,\n visibleCommitVersion: 0,\n });\n const treeState = isRouterStatePromise(treeStateValue) ? use(treeStateValue) : treeStateValue;\n\n // Keep the latest router state in a ref so external callers (navigate(),\n // server actions, HMR) always read the current state. Safe: those readers\n // run from events/effects, never from React render itself.\n // Note: stateRef.current is written during render, not in an effect, to\n // avoid a stale-read window between commit and layout effects. This mirrors\n // the same render-phase ref update pattern used by Next.js's own router.\n const stateRef = useRef(treeState);\n stateRef.current = treeState;\n\n // Publish the stable ref object and dispatch during layout commit. This keeps\n // the module-level escape hatches aligned with React's committed tree without\n // performing module writes during render. __VINEXT_RSC_NAVIGATE__ is assigned\n // after hydrateRoot() returns; by then this layout effect has already run for\n // the hydration commit, so getBrowserRouterState() never observes a null ref.\n useLayoutEffect(() => {\n const detach = browserNavigationController.attachBrowserRouterState(\n setTreeStateValue,\n stateRef,\n );\n browserRouterStateHasEverCommitted = true;\n return () => {\n detach();\n setMountedSlotsHeader(null);\n };\n }, [setTreeStateValue]);\n\n useLayoutEffect(() => {\n setMountedSlotsHeader(getMountedSlotIdsHeader(stateRef.current.elements));\n }, [treeState.elements]);\n\n useLayoutEffect(() => {\n if (treeState.renderId !== 0) {\n return;\n }\n\n replaceHistoryStateWithoutNotify(\n createHistoryStateWithPreviousNextUrl(window.history.state, treeState.previousNextUrl),\n \"\",\n window.location.href,\n );\n }, [treeState.previousNextUrl, treeState.renderId]);\n\n const innerTree = createElement(\n RedirectBoundary,\n null,\n createElement(\n NavigationCommitSignal,\n { renderId: treeState.renderId },\n createElement(\n ElementsContext.Provider,\n { value: treeState.elements },\n createElement(Slot, { id: treeState.routeId }),\n ),\n ),\n );\n\n // In dev, wrap the route tree in a top-level recovery boundary. A render\n // error (e.g. a slot's RSC reference rejects) is caught here instead of\n // tearing down BrowserRoot, so HMR can dispatch the next payload —\n // identified by an incremented renderId, which doubles as the boundary's\n // reset key — without a full page reload. The dev overlay (a separate\n // React root) shows the error itself.\n //\n // onCatch drains the pending pre-paint effect for the failed render so\n // the URL update bound to that navigation still runs. Without this, a\n // soft-nav whose target throws would leave the browser on the previous\n // URL, hiding which route is broken and mis-targeting the next HMR\n // payload (which fetches RSC for window.location.pathname).\n //\n // This file is .ts, not .tsx — children are passed positionally to satisfy\n // both the createElement overload and eslint's no-children-prop rule.\n const committedTree = import.meta.env.DEV\n ? createElement(\n DevRecoveryBoundary,\n {\n resetKey: treeState.renderId,\n onCatch: handleDevRecoveryBoundaryCatch,\n },\n innerTree,\n )\n : innerTree;\n\n const ClientNavigationRenderContext = getClientNavigationRenderContext();\n if (!ClientNavigationRenderContext) {\n return committedTree;\n }\n\n return createElement(\n ClientNavigationRenderContext.Provider,\n { value: treeState.navigationSnapshot },\n committedTree,\n );\n}\n\nfunction restoreHydrationNavigationContext(\n pathname: string,\n searchParams: SearchParamInput,\n params: Record<string, string | string[]>,\n): void {\n setNavigationContext({\n pathname,\n searchParams: new URLSearchParams(searchParams),\n params,\n });\n}\n\nfunction decodeHashFragment(fragment: string): string {\n try {\n return decodeURIComponent(fragment);\n } catch {\n return fragment;\n }\n}\n\nfunction scrollToHashTarget(hash: string): void {\n const fragment = decodeHashFragment(hash.startsWith(\"#\") ? hash.slice(1) : hash);\n\n requestAnimationFrame(() => {\n if (fragment === \"\" || fragment === \"top\") {\n window.scrollTo(0, 0);\n return;\n }\n\n const idElement = document.getElementById(fragment);\n if (idElement) {\n idElement.scrollIntoView({ behavior: \"auto\" });\n return;\n }\n\n document.getElementsByName(fragment)[0]?.scrollIntoView({ behavior: \"auto\" });\n });\n}\n\nfunction restorePopstateScrollPosition(state: unknown): void {\n if (!(state && typeof state === \"object\" && \"__vinext_scrollY\" in state)) {\n if (window.location.hash) {\n scrollToHashTarget(window.location.hash);\n }\n return;\n }\n\n const y = Number(state.__vinext_scrollY);\n const x = \"__vinext_scrollX\" in state ? Number(state.__vinext_scrollX) : 0;\n\n requestAnimationFrame(() => {\n window.scrollTo(x, y);\n });\n}\n\n// Set on pagehide so the RSC navigation catch block can distinguish expected\n// fetch aborts (triggered by the unload itself) from real errors worth logging.\nlet isPageUnloading = false;\n\nconst RSC_RELOAD_KEY = \"__vinext_rsc_initial_reload__\";\n\n// sessionStorage can throw SecurityError in strict-mode iframes, storage-\n// disabled browsers, and some Safari private-browsing configurations. Wrap\n// every access so a recovery path for one error does not crash hydration.\nfunction readReloadFlag(): string | null {\n try {\n return sessionStorage.getItem(RSC_RELOAD_KEY);\n } catch {\n return null;\n }\n}\nfunction writeReloadFlag(path: string): void {\n try {\n sessionStorage.setItem(RSC_RELOAD_KEY, path);\n } catch {}\n}\nfunction clearReloadFlag(): void {\n try {\n sessionStorage.removeItem(RSC_RELOAD_KEY);\n } catch {}\n}\n\n// A non-ok or wrong-content-type RSC response during initial hydration means\n// the server cannot deliver a valid RSC payload for this URL. Parsing the\n// response as RSC causes an opaque parse failure. On the first attempt,\n// reload once so the server has a chance to render the correct error page\n// as HTML. On the second attempt (detected via the sessionStorage flag), the\n// endpoint is persistently broken. Returns null so main() aborts the\n// hydration bootstrap without registering `__VINEXT_RSC_*` globals —\n// including during the brief window between reload() firing and the page\n// actually unloading — so external probes never see a half-hydrated page.\nfunction recoverFromBadInitialRscResponse(reason: string): null {\n const currentPath = window.location.pathname + window.location.search;\n if (readReloadFlag() === currentPath) {\n clearReloadFlag();\n console.error(\n `[vinext] Initial RSC fetch ${reason} after reload; aborting hydration. ` +\n \"Server-rendered HTML remains visible; client components will not hydrate.\",\n );\n return null;\n }\n writeReloadFlag(currentPath);\n // Verify the write persisted. In storage-denied environments (strict-mode\n // iframes, locked-down enterprise policies), every getItem returns null and\n // every setItem silently no-ops, so the reload-loop guard cannot survive\n // the reload — the page would loop forever. Abort instead so the user at\n // least sees the server-rendered HTML.\n if (readReloadFlag() !== currentPath) {\n console.error(\n `[vinext] Initial RSC fetch ${reason}; sessionStorage unavailable so the ` +\n \"reload-loop guard cannot persist — aborting hydration. \" +\n \"Server-rendered HTML remains visible; client components will not hydrate.\",\n );\n return null;\n }\n // One-shot diagnostic so a production reload is traceable. Only fires once\n // per broken path thanks to the sessionStorage flag above; not noisy.\n console.warn(\n `[vinext] Initial RSC fetch ${reason}; reloading once to let the server render the HTML error page`,\n );\n window.location.reload();\n return null;\n}\n\nasync function readInitialRscStream(): Promise<ReadableStream<Uint8Array> | null> {\n const vinext = getVinextBrowserGlobal();\n\n if (vinext.__VINEXT_RSC__ || vinext.__VINEXT_RSC_CHUNKS__ || vinext.__VINEXT_RSC_DONE__) {\n // Reaching the embedded-RSC branch means the server successfully rendered\n // the page — any prior reload flag for this path is stale and must be\n // cleared so a future failure gets its own fresh recovery attempt.\n clearReloadFlag();\n clearHardNavigationLoopGuard();\n\n if (vinext.__VINEXT_RSC__) {\n const embedData = vinext.__VINEXT_RSC__;\n delete vinext.__VINEXT_RSC__;\n\n const params = embedData.params ?? {};\n if (embedData.params) {\n applyClientParams(embedData.params);\n }\n if (embedData.nav) {\n restoreHydrationNavigationContext(\n embedData.nav.pathname,\n embedData.nav.searchParams,\n params,\n );\n }\n\n return chunksToReadableStream(embedData.rsc);\n }\n\n const params = vinext.__VINEXT_RSC_PARAMS__ ?? {};\n if (vinext.__VINEXT_RSC_PARAMS__) {\n applyClientParams(vinext.__VINEXT_RSC_PARAMS__);\n }\n if (vinext.__VINEXT_RSC_NAV__) {\n restoreHydrationNavigationContext(\n vinext.__VINEXT_RSC_NAV__.pathname,\n vinext.__VINEXT_RSC_NAV__.searchParams,\n params,\n );\n }\n\n return createProgressiveRscStream();\n }\n\n const rscHeaders = createRscRequestHeaders();\n const rscResponse = await fetch(\n await createRscRequestUrl(window.location.pathname + window.location.search, rscHeaders),\n { credentials: \"include\", headers: rscHeaders },\n );\n\n if (!rscResponse.ok) {\n return recoverFromBadInitialRscResponse(`returned ${rscResponse.status}`);\n }\n // Guard against proxies/CDNs that return 200 with a rewritten Content-Type\n // (e.g. text/html instead of text/x-component). Such responses cannot be\n // parsed as RSC and would throw the same opaque parse error this fallback\n // exists to prevent.\n const contentType = rscResponse.headers.get(\"content-type\") ?? \"\";\n if (!contentType.startsWith(VINEXT_RSC_CONTENT_TYPE)) {\n return recoverFromBadInitialRscResponse(\n `returned non-RSC content-type \"${contentType || \"(missing)\"}\"`,\n );\n }\n // Missing body (e.g. 204 No Content, or an edge worker that returned ok\n // headers without piping the stream) fails the same way downstream.\n // Matches Next.js' `!res.body` branch in fetch-server-response.ts.\n if (!rscResponse.body) {\n return recoverFromBadInitialRscResponse(\"returned empty body\");\n }\n // Successful RSC response clears the guard so a subsequent reload of the\n // same path after a transient failure still gets one recovery attempt.\n clearReloadFlag();\n clearHardNavigationLoopGuard();\n\n // Ignore malformed param headers and continue with hydration. The original\n // try/catch also swallowed errors from applyClientParams; preserve that.\n const parsedParams = parseEncodedJsonHeader<Record<string, string | string[]>>(\n rscResponse.headers.get(VINEXT_PARAMS_HEADER),\n );\n const params: Record<string, string | string[]> = parsedParams ?? {};\n if (parsedParams) {\n try {\n applyClientParams(parsedParams);\n } catch {\n // Ignore — matches the previous combined try/catch behavior.\n }\n }\n\n restoreHydrationNavigationContext(window.location.pathname, window.location.search, params);\n\n return rscResponse.body;\n}\n\nfunction registerServerActionCallback(): void {\n setServerCallback(async (id, args) => {\n const temporaryReferences = createTemporaryReferenceSet();\n const body = await encodeReply(args, { temporaryReferences });\n\n // Carry the interception context + mounted slots from the current router\n // state so the server-action re-render rebuilds the intercepted tree\n // instead of replacing it with the direct page. Parity with Next.js,\n // which sends `Next-URL` on action POSTs when the current tree contains\n // an interception route.\n const currentState = getBrowserRouterState();\n const { headers } = resolveServerActionRequestState({\n actionId: id,\n basePath: __basePath,\n elements: currentState.elements,\n previousNextUrl: currentState.previousNextUrl,\n });\n\n const fetchResponse = await fetch(\n await createRscRequestUrl(window.location.pathname + window.location.search, headers),\n {\n method: \"POST\",\n headers,\n body,\n },\n );\n\n if (isServerActionNotFoundResponse(fetchResponse)) {\n throw new Error(getServerActionNotFoundClientMessage(id));\n }\n\n const actionRedirect = fetchResponse.headers.get(ACTION_REDIRECT_HEADER);\n if (actionRedirect) {\n if (isDangerousScheme(actionRedirect)) {\n console.error(DANGEROUS_URL_BLOCK_MESSAGE);\n return undefined;\n }\n\n // Check for external URLs that need a hard redirect.\n try {\n const redirectUrl = new URL(actionRedirect, window.location.origin);\n if (redirectUrl.origin !== window.location.origin) {\n window.location.href = actionRedirect;\n return undefined;\n }\n } catch {\n // Fall through to hard redirect below if URL parsing fails.\n }\n\n // Use hard redirect for all action redirects because vinext's server\n // currently returns an empty body for redirect responses. RSC navigation\n // requires a valid RSC payload. This is a known parity gap with Next.js,\n // which pre-renders the redirect target's RSC payload.\n clearClientNavigationCaches();\n const redirectType = fetchResponse.headers.get(ACTION_REDIRECT_TYPE_HEADER) ?? \"replace\";\n if (redirectType === \"push\") {\n window.location.assign(actionRedirect);\n } else {\n window.location.replace(actionRedirect);\n }\n return undefined;\n }\n\n const result = await createFromFetch<ServerActionResult | AppWireElements>(\n Promise.resolve(fetchResponse),\n { temporaryReferences },\n );\n if (shouldClearClientNavigationCachesForServerActionResult(result)) {\n clearClientNavigationCaches();\n }\n\n // Server actions stay on the same URL and use commitSameUrlNavigatePayload()\n // for merge-based dispatch. This path does not call\n // activateNavigationSnapshot() because there is no URL change to commit, so\n // hooks continue reading the live external-store values directly. If server\n // actions ever trigger URL changes via RSC payload (instead of hard\n // redirects), this would need renderNavigationPayload().\n if (isServerActionResult(result)) {\n if (result.root !== undefined) {\n return commitSameUrlNavigatePayload(\n Promise.resolve(AppElementsWire.decode(result.root)),\n result.returnValue,\n currentState,\n );\n }\n\n if (result.returnValue) {\n if (!result.returnValue.ok) {\n throw result.returnValue.data;\n }\n return result.returnValue.data;\n }\n\n return undefined;\n }\n\n return commitSameUrlNavigatePayload(\n Promise.resolve(AppElementsWire.decode(result)),\n undefined,\n currentState,\n );\n });\n}\n\nasync function main(): Promise<void> {\n registerServerActionCallback();\n\n const rscStream = await readInitialRscStream();\n // null signals that readInitialRscStream aborted hydration — either because\n // a reload is in flight (first-attempt recovery) or the endpoint is\n // persistently broken (post-reload). Bootstrap is a separate synchronous\n // helper so the null-branch structurally cannot reach any __VINEXT_RSC_*\n // global assignment, even if a future refactor interposes async work here.\n if (rscStream === null) return;\n bootstrapHydration(rscStream);\n}\n\nfunction bootstrapHydration(rscStream: ReadableStream<Uint8Array>): void {\n if (import.meta.env.DEV) {\n installDevErrorOverlay();\n }\n\n const root = decodeAppElementsPromise(createFromReadableStream<AppWireElements>(rscStream));\n const initialNavigationSnapshot = createClientNavigationRenderSnapshot(\n window.location.href,\n latestClientParams,\n );\n replaceHistoryStateWithoutNotify(\n createHistoryStateWithPreviousNextUrl(window.history.state, null),\n \"\",\n window.location.href,\n );\n\n // In dev we route uncaught errors into the dev overlay rather than the\n // hard-nav recovery: the overlay is what the developer needs to see, and a\n // recovery nav would wipe it. In prod we keep the recovery hard-nav so the\n // user lands on a renderable URL with the actual error UI.\n const onUncaughtError = import.meta.env.DEV\n ? devOnUncaughtError\n : createOnUncaughtError(() => pendingNavigationRecoveryHref);\n const formState = consumeInitialFormState(getVinextBrowserGlobal());\n const hydrateRootOptions = import.meta.env.DEV\n ? createVinextHydrateRootOptions({\n formState,\n onCaughtError: devOnCaughtError,\n onUncaughtError,\n })\n : createVinextHydrateRootOptions({\n formState,\n onUncaughtError,\n });\n window.__VINEXT_RSC_ROOT__ = hydrateRoot(\n document,\n createElement(BrowserRoot, {\n initialElements: root,\n initialNavigationSnapshot,\n }),\n hydrateRootOptions,\n );\n window.__VINEXT_HYDRATED_AT = performance.now();\n\n // Exposed so the navigation shim's `router.refresh()` can invalidate the\n // entire client navigation cache (visited-response + prefetch) before\n // re-fetching, matching Next.js refresh semantics — see refresh-reducer.ts\n // header comment: \"the segment cache contains the actual RSC data which\n // needs to be re-fetched.\"\n window.__VINEXT_CLEAR_NAV_CACHES__ = clearClientNavigationCaches;\n\n window.__VINEXT_RSC_NAVIGATE__ = async function navigateRsc(\n href: string,\n redirectDepth = 0,\n navigationKind: NavigationKind = \"navigate\",\n historyUpdateMode?: HistoryUpdateMode,\n previousNextUrlOverride?: string | null,\n programmaticTransition = false,\n ): Promise<void> {\n let pendingRouterState: PendingBrowserRouterState | null = null;\n // Hoist navId above try so the catch and finally blocks can reference it.\n const navId = browserNavigationController.beginNavigation();\n\n // Loop variables for inline redirect following. On a redirect, these are\n // updated and the loop continues without returning or re-entering navigateRsc,\n // so a single pendingRouterState spans all hops and isPending never flashes.\n let currentHref = href;\n let currentHistoryMode = historyUpdateMode;\n let currentPrevNextUrl = previousNextUrlOverride;\n let redirectCount = redirectDepth;\n\n try {\n const shouldUsePendingRouterState = programmaticTransition && navigationKind !== \"refresh\";\n if (shouldUsePendingRouterState && hasBrowserRouterState()) {\n pendingRouterState = beginPendingBrowserRouterState();\n } else {\n await waitForBrowserRouterStateReady();\n if (!browserNavigationController.isCurrentNavigation(navId)) return;\n\n if (shouldUsePendingRouterState) {\n pendingRouterState = beginPendingBrowserRouterState();\n }\n }\n\n while (true) {\n if (redirectCount > 10) {\n console.error(\n \"[vinext] Too many RSC redirects — aborting navigation to prevent infinite loop.\",\n );\n window.location.href = currentHref;\n return;\n }\n\n const url = new URL(currentHref, window.location.origin);\n const requestState = getRequestState(navigationKind, currentPrevNextUrl);\n const requestInterceptionContext = requestState.interceptionContext;\n const requestPreviousNextUrl = requestState.previousNextUrl;\n\n // Set this navigation as the pending pathname, overwriting any previous.\n // Pass navId so only this navigation (or a newer one) can clear it later.\n setPendingPathname(url.pathname, navId);\n\n const elementsAtNavStart = getBrowserRouterState().elements;\n const mountedSlotsHeader = getMountedSlotIdsHeader(elementsAtNavStart);\n const requestHeaders = createRscRequestHeaders({\n interceptionContext: requestInterceptionContext,\n renderMode:\n navigationKind === \"refresh\" ? APP_RSC_RENDER_MODE_REFRESH_PRESERVE_UI : undefined,\n });\n if (mountedSlotsHeader) {\n requestHeaders.set(VINEXT_MOUNTED_SLOTS_HEADER, mountedSlotsHeader);\n }\n const rscUrl = await createRscRequestUrl(url.pathname + url.search, requestHeaders);\n const cachedRoute = getVisitedResponse(\n rscUrl,\n requestInterceptionContext,\n mountedSlotsHeader,\n navigationKind,\n );\n if (cachedRoute) {\n // Check stale-navigation before and after createFromFetch. The pre-check\n // avoids wasted parse work; the post-check catches supersessions that\n // occur during the await. createFromFetch on a buffered response is fast\n // but still async, so the window exists. The non-cached path (below) places\n // its heavyweight async steps (fetch, body.tee + createFromFetch on the\n // live RSC branch) between navId checks consistently; the cached path omits\n // the check between createClientNavigationRenderSnapshot (synchronous) and\n // createFromFetch because there is no await in that gap.\n if (!browserNavigationController.isCurrentNavigation(navId)) return;\n const cachedParams = cachedRoute.params;\n // createClientNavigationRenderSnapshot is synchronous (URL parsing + param\n // wrapping only) — no stale-navigation recheck needed between here and the\n // next await.\n const cachedNavigationSnapshot = createClientNavigationRenderSnapshot(\n currentHref,\n cachedParams,\n );\n const cachedPayload = decodeAppElementsPromise(\n createFromFetch<AppWireElements>(\n Promise.resolve(restoreRscResponse(cachedRoute.response)),\n ),\n );\n if (!browserNavigationController.isCurrentNavigation(navId)) return;\n await renderNavigationPayload(\n cachedPayload,\n cachedNavigationSnapshot,\n currentHref,\n navId,\n currentHistoryMode,\n cachedParams,\n requestPreviousNextUrl,\n pendingRouterState,\n toActionType(navigationKind),\n toOperationLane(navigationKind),\n );\n return;\n }\n\n // Continue using the slot state captured at navigation start for fetches\n // and prefetch compatibility decisions.\n\n let navResponse: Response | undefined;\n let navResponseUrl: string | null = null;\n if (navigationKind !== \"refresh\") {\n const prefetchedResponse = consumePrefetchResponse(\n rscUrl,\n requestInterceptionContext,\n mountedSlotsHeader,\n );\n if (prefetchedResponse) {\n navResponse = restoreRscResponse(prefetchedResponse, false);\n navResponseUrl = prefetchedResponse.url;\n }\n }\n\n if (!navResponse) {\n navResponse = await fetch(rscUrl, {\n headers: requestHeaders,\n credentials: \"include\",\n });\n }\n\n if (!browserNavigationController.isCurrentNavigation(navId)) return;\n\n // Any response that isn't a valid RSC payload (non-ok status,\n // missing/rewritten Content-Type, or missing body) means the server\n // returned something we cannot parse — typically an HTML error page\n // or a proxy-rewritten response. Parsing such a body as an RSC stream\n // throws a cryptic \"Connection closed\" error. Match Next.js behavior\n // (fetch-server-response.ts:211, `!isFlightResponse || !res.ok || !res.body`):\n // hard-navigate to the response URL so the server can render the correct\n // error page as HTML. The outer finally handles\n // settlePendingBrowserRouterState and clearPendingPathname on this\n // return path.\n //\n // Prefer the post-redirect response URL over `currentHref`: on a\n // redirect chain like `/old` → 307 → `/new` → 500, the browser's\n // fetch already followed the redirect, so `navResponse.url` is the\n // failing `/new` destination. Hard-navigating there directly avoids\n // bouncing off `/old` just to re-follow the same 307, which would\n // flash the wrong URL in the address bar and mis-key analytics.\n // Matches Next.js' `doMpaNavigation(responseUrl.toString())`. Falls\n // back to `currentHref` when no response URL is available.\n const navContentType = navResponse.headers.get(\"content-type\") ?? \"\";\n const isRscResponse = navContentType.startsWith(\"text/x-component\");\n if (!navResponse.ok || !isRscResponse || !navResponse.body) {\n const responseUrl = navResponseUrl ?? navResponse.url;\n let hardNavTarget = currentHref;\n if (responseUrl) {\n const parsed = new URL(responseUrl, window.location.origin);\n stripRscCacheBustingSearchParam(parsed);\n const origUrl = new URL(currentHref, window.location.origin);\n let pathname = stripRscSuffix(parsed.pathname);\n // createRscRequestUrl strips trailing slash before appending .rsc,\n // so the response URL loses it on the round-trip. Restore it when\n // the original href had one so sites with trailingSlash:true don't\n // incur an extra 308 to the canonical form on the error path.\n if (\n origUrl.pathname.length > 1 &&\n origUrl.pathname.endsWith(\"/\") &&\n !pathname.endsWith(\"/\")\n ) {\n pathname += \"/\";\n }\n hardNavTarget = pathname + parsed.search;\n // Preserve the hash from the user's clicked href — a .rsc response\n // URL never carries a fragment, so dropping it would silently strip\n // `/foo#section` down to `/foo`.\n if (origUrl.hash) hardNavTarget += origUrl.hash;\n }\n window.location.href = hardNavTarget;\n return;\n }\n\n const finalUrl = new URL(navResponseUrl ?? navResponse.url, window.location.origin);\n stripRscCacheBustingSearchParam(finalUrl);\n const requestedUrl = new URL(rscUrl, window.location.origin);\n\n if (finalUrl.pathname !== requestedUrl.pathname) {\n // Server-side redirect: update the URL in history and loop to fetch\n // the destination without settling pendingRouterState. This keeps\n // isPending true across all redirect hops instead of flashing false.\n const destinationPath = stripRscSuffix(finalUrl.pathname) + finalUrl.search;\n replaceHistoryStateWithoutNotify(\n createHistoryStateWithPreviousNextUrl(null, requestPreviousNextUrl),\n \"\",\n destinationPath,\n );\n\n currentHref = destinationPath;\n // URL already written above; the commit effect must not push/replace again.\n currentHistoryMode = undefined;\n currentPrevNextUrl = requestPreviousNextUrl;\n redirectCount += 1;\n continue;\n }\n\n // navParams falls back to {} on a missing or malformed header.\n const navParams: Record<string, string | string[]> =\n parseEncodedJsonHeader<Record<string, string | string[]>>(\n navResponse.headers.get(VINEXT_PARAMS_HEADER),\n ) ?? {};\n // Build snapshot from local params, not latestClientParams\n const navigationSnapshot = createClientNavigationRenderSnapshot(currentHref, navParams);\n\n // Tee the response body so React can consume it incrementally —\n // shell parses fast, and any Suspense boundary inside (e.g. the\n // route's loading.tsx) shows its fallback while the rest of the\n // RSC stream resolves. Buffering with `await response.arrayBuffer()`\n // here would block the commit until the page's slowest server\n // promise resolved, hiding the loading state entirely.\n //\n // The cache branch is read in the background so the visited-\n // response snapshot lands as soon as the full stream completes,\n // without holding up React's commit.\n const navBody = navResponse.body;\n if (!navBody) {\n // Already validated above (`!navResponse.body` triggers a hard\n // navigation), so this branch is unreachable — kept for type\n // narrowing only.\n return;\n }\n const [reactBranch, cacheBranch] = navBody.tee();\n const reactResponse = new Response(reactBranch, {\n status: navResponse.status,\n headers: navResponse.headers,\n });\n const cacheBufferPromise = new Response(cacheBranch).arrayBuffer();\n\n if (!browserNavigationController.isCurrentNavigation(navId)) return;\n\n const rscPayload = decodeAppElementsPromise(\n createFromFetch<AppWireElements>(Promise.resolve(reactResponse)),\n );\n\n if (!browserNavigationController.isCurrentNavigation(navId)) return;\n\n const renderOutcome = await renderNavigationPayload(\n rscPayload,\n navigationSnapshot,\n currentHref,\n navId,\n currentHistoryMode,\n navParams,\n requestPreviousNextUrl,\n pendingRouterState,\n toActionType(navigationKind),\n toOperationLane(navigationKind),\n );\n if (renderOutcome !== \"committed\") return;\n // Don't cache the response if this navigation was superseded during\n // renderNavigationPayload's await — the elements were never dispatched.\n if (!browserNavigationController.isCurrentNavigation(navId)) return;\n // Store the visited response only after renderNavigationPayload succeeds.\n // If we stored it before and renderNavigationPayload threw, a future\n // back/forward navigation could replay a snapshot from a navigation that\n // never actually rendered successfully.\n const resolvedElements = await rscPayload;\n const metadata = AppElementsWire.readMetadata(resolvedElements);\n const cacheBuffer = await cacheBufferPromise;\n storeVisitedResponseSnapshot(\n rscUrl,\n resolveVisitedResponseInterceptionContext(\n requestInterceptionContext,\n metadata.interceptionContext,\n ),\n {\n buffer: cacheBuffer,\n contentType: navResponse.headers.get(\"content-type\") ?? \"text/x-component\",\n mountedSlotsHeader: navResponse.headers.get(VINEXT_MOUNTED_SLOTS_HEADER),\n paramsHeader: navResponse.headers.get(VINEXT_PARAMS_HEADER),\n url: navResponse.url,\n },\n navParams,\n );\n return;\n }\n } catch (error) {\n // Don't hard-navigate to a stale URL if this navigation was superseded by\n // a newer one — the newer navigation is already in flight and would be clobbered.\n if (!browserNavigationController.isCurrentNavigation(navId)) return;\n // Suppress the diagnostic when the page is unloading: a hard-nav or anchor\n // click tears down the document and aborts any in-flight RSC fetch, which\n // surfaces here as an error. The page is already going away, so the log\n // is just noise. Mirrors Next.js' isPageUnloading pattern.\n if (!isPageUnloading) {\n console.error(\"[vinext] RSC navigation error:\", error);\n }\n window.location.href = currentHref;\n } finally {\n // Single settlement site: covers normal return, early returns on stale-id\n // checks, and error paths. The finally runs even when the catch returns.\n // settlePendingBrowserRouterState is idempotent via the settled flag.\n browserNavigationController.finalizeNavigation(navId, pendingRouterState);\n }\n };\n\n if (\"scrollRestoration\" in history) {\n history.scrollRestoration = \"manual\";\n }\n\n // Note: This popstate handler runs for App Router (RSC navigation available).\n // It coordinates scroll restoration with the pending RSC navigation.\n // Pages Router scroll restoration is handled in shims/navigation.ts:1289 with\n // microtask-based deferral for compatibility with non-RSC navigation.\n // See: https://github.com/vercel/next.js/discussions/41934#discussioncomment-4602607\n window.addEventListener(\"popstate\", (event) => {\n notifyAppRouterTransitionStart(window.location.href, \"traverse\");\n const pendingNavigation =\n window.__VINEXT_RSC_NAVIGATE__?.(window.location.href, 0, \"traverse\") ?? Promise.resolve();\n window.__VINEXT_RSC_PENDING__ = pendingNavigation;\n void pendingNavigation.finally(() => {\n restorePopstateScrollPosition(event.state);\n if (window.__VINEXT_RSC_PENDING__ === pendingNavigation) {\n window.__VINEXT_RSC_PENDING__ = null;\n }\n });\n });\n\n if (import.meta.hot) {\n const handleRscUpdate = async (): Promise<void> => {\n try {\n // If BrowserRoot has been mounted before but isn't now, a render\n // error tore down the tree (e.g. a server route threw). HMR can't\n // dispatch into a missing setter, and waitForBrowserRouterStateReady\n // would block forever — the tree won't remount until the page reloads.\n // Trigger that reload so the user's fix actually lands without a\n // manual refresh. Cleared after a successful mount, so this only\n // fires once per teardown.\n if (\n browserRouterStateHasEverCommitted &&\n !browserNavigationController.hasBrowserRouterState()\n ) {\n window.location.reload();\n return;\n }\n // HMR can also fire before BrowserRoot's layout effect publishes\n // the browser router state (e.g. saving a file while the initial RSC\n // stream is still suspended). Wait for readiness, then re-check the\n // mounted state — readiness can race with cleanup, which nulls it again.\n // Skip silently when the tree is not currently mounted; the next\n // HMR push or full reload will reconcile.\n await waitForBrowserRouterStateReady();\n if (!browserNavigationController.hasBrowserRouterState()) {\n return;\n }\n clearClientNavigationCaches();\n const navigationSnapshot = createClientNavigationRenderSnapshot(\n window.location.href,\n latestClientParams,\n );\n // Clear stale errors from the dev overlay before dispatching the\n // fresh tree. If the new tree renders cleanly, the overlay stays\n // empty; if it throws again, devOnCaughtError/devOnUncaughtError\n // re-populates it. Without this, an old \"DropZone is not defined\"\n // error would linger after the developer fixed the bug.\n dismissOverlay();\n // Interception context on HMR re-renders is intentionally deferred:\n // preserving intercepted modal state across HMR reloads is out of scope\n // for the previousNextUrl mechanism.\n const hmrHeaders = createRscRequestHeaders();\n await browserNavigationController.hmrReplaceTree(\n decodeAppElementsPromise(\n createFromFetch<AppWireElements>(\n fetch(\n await createRscRequestUrl(\n window.location.pathname + window.location.search,\n hmrHeaders,\n ),\n { headers: hmrHeaders },\n ),\n ),\n ),\n navigationSnapshot,\n );\n } catch (error) {\n console.error(\"[vinext] RSC HMR error:\", error);\n }\n };\n\n import.meta.hot.on(\"rsc:update\", () => {\n void handleRscUpdate();\n });\n }\n}\n\nif (typeof document !== \"undefined\") {\n // Install `window.next` as early as possible so any client component that\n // synchronously dereferences it during hydration (or any third-party\n // library script tag that loads before the React tree mounts) sees the\n // expected shape. Mirrors Next.js's app-bootstrap.ts (line 13) which sets\n // `window.next = { version, appDir: true }` before the React runtime\n // initializes, and `app-router-instance.ts` (line 510) which assigns\n // `router: publicAppRouterInstance` at module load.\n installWindowNext({ appDir: true, router: appRouterInstance });\n\n window.addEventListener(\"pagehide\", () => {\n isPageUnloading = true;\n });\n // Reset on pageshow so a bfcache-restored document does not resume with\n // the flag stuck at true, which would silently swallow every subsequent\n // RSC navigation error for the lifetime of that tab. Matches Next.js'\n // fetch-server-response.ts handler pair.\n window.addEventListener(\"pageshow\", () => {\n isPageUnloading = false;\n });\n void main();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA8GA,SAAS,aAAa,MAA+C;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