From f1908dad17e915c544fdad1d88cb8794f05034f7 Mon Sep 17 00:00:00 2001 From: xusd320 Date: Tue, 20 Jan 2026 21:36:22 +0800 Subject: [PATCH 1/7] perf(turbopack): optimize resolve plugin handling (#88639) --- .../crates/turbopack-core/src/resolve/mod.rs | 69 ++++++++++++++----- 1 file changed, 52 insertions(+), 17 deletions(-) diff --git a/turbopack/crates/turbopack-core/src/resolve/mod.rs b/turbopack/crates/turbopack-core/src/resolve/mod.rs index 23027f9a58ad3c..cf522ece52dbf2 100644 --- a/turbopack/crates/turbopack-core/src/resolve/mod.rs +++ b/turbopack/crates/turbopack-core/src/resolve/mod.rs @@ -45,7 +45,7 @@ use crate::{ origin::ResolveOrigin, parse::{Request, stringify_data_uri}, pattern::{Pattern, PatternMatch, read_matches}, - plugin::{AfterResolvePlugin, BeforeResolvePlugin}, + plugin::{AfterResolvePlugin, AfterResolvePluginCondition, BeforeResolvePlugin}, remap::{ExportsField, ImportsField, ReplacedSubpathValueResult}, }, source::{OptionSource, Source, Sources}, @@ -67,6 +67,12 @@ pub use remap::{ResolveAliasMap, SubpathValue}; use crate::{error::PrettyPrintError, issue::IssueSeverity}; +/// Type alias for a resolved after-resolve plugin paired with its condition. +type AfterResolvePluginWithCondition = ( + ResolvedVc>, + Vc, +); + #[turbo_tasks::value(shared)] #[derive(Clone, Debug)] pub enum ModuleResolveResultItem { @@ -1180,7 +1186,8 @@ enum ImportsFieldResult { #[turbo_tasks::function] async fn imports_field(lookup_path: FileSystemPath) -> Result> { // We don't need to collect affecting sources here because we don't use them - let package_json_context = find_context_file(lookup_path, package_json(), false).await?; + let package_json_context = + find_context_file(lookup_path, package_json().resolve().await?, false).await?; let FindContextFileResult::Found(package_json_path, _refs) = &*package_json_context else { return Ok(ImportsFieldResult::None.cell()); }; @@ -1598,13 +1605,24 @@ pub async fn resolve_inline( } async { - let before_plugins_result = handle_before_resolve_plugins( - lookup_path.clone(), - reference_type.clone(), - request, - options, - ) - .await?; + // Pre-fetch options once to avoid repeated await calls + let options_value = options.await?; + + // Fast path: skip plugin handling if no plugins are configured + let has_before_plugins = !options_value.before_resolve_plugins.is_empty(); + let has_after_plugins = !options_value.after_resolve_plugins.is_empty(); + + let before_plugins_result = if has_before_plugins { + handle_before_resolve_plugins( + lookup_path.clone(), + reference_type.clone(), + request, + options, + ) + .await? + } else { + None + }; let raw_result = match before_plugins_result { Some(result) => result, @@ -1615,9 +1633,13 @@ pub async fn resolve_inline( } }; - let result = + let result = if has_after_plugins { handle_after_resolve_plugins(lookup_path, reference_type, request, options, raw_result) - .await?; + .await? + } else { + raw_result + }; + Ok(result) } .instrument(span) @@ -1685,7 +1707,9 @@ async fn handle_before_resolve_plugins( request: Vc, options: Vc, ) -> Result>> { - for plugin in &options.await?.before_resolve_plugins { + let options_value = options.await?; + + for plugin in &options_value.before_resolve_plugins { let condition = plugin.before_resolve_condition().resolve().await?; if !*condition.matches(request).await? { continue; @@ -1709,15 +1733,25 @@ async fn handle_after_resolve_plugins( options: Vc, result: Vc, ) -> Result> { + // Pre-fetch options to avoid repeated await calls in the inner loop + let options_value = options.await?; + + // Pre-resolve all plugin conditions once to avoid repeated resolve calls in the loop + let resolved_conditions = options_value + .after_resolve_plugins + .iter() + .map(async |p| Ok((*p, p.after_resolve_condition().resolve().await?))) + .try_join() + .await?; + async fn apply_plugins_to_path( path: FileSystemPath, lookup_path: FileSystemPath, reference_type: ReferenceType, request: Vc, - options: Vc, + plugins_with_conditions: &[AfterResolvePluginWithCondition], ) -> Result>> { - for plugin in &options.await?.after_resolve_plugins { - let after_resolve_condition = plugin.after_resolve_condition().resolve().await?; + for (plugin, after_resolve_condition) in plugins_with_conditions { if *after_resolve_condition.matches(path.clone()).await? && let Some(result) = *plugin .after_resolve( @@ -1748,7 +1782,7 @@ async fn handle_after_resolve_plugins( lookup_path.clone(), reference_type.clone(), request, - options, + &resolved_conditions, ) .await? { @@ -2646,7 +2680,8 @@ enum FindSelfReferencePackageResult { async fn find_self_reference( lookup_path: FileSystemPath, ) -> Result> { - let package_json_context = find_context_file(lookup_path, package_json(), false).await?; + let package_json_context = + find_context_file(lookup_path, package_json().resolve().await?, false).await?; if let FindContextFileResult::Found(package_json_path, _refs) = &*package_json_context { let read = read_package_json(Vc::upcast(FileSource::new(package_json_path.clone()))).await?; From e5926d3d1efa24563c819f7473e6425e2cb5547e Mon Sep 17 00:00:00 2001 From: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com> Date: Tue, 20 Jan 2026 15:00:17 +0100 Subject: [PATCH 2/7] Fix buildManifest.js deployment tests (#88806) When `NEXT_DEPLOYMENT_ID` is set (and thus skew protection is enabled), then these pages router manifests are actually on a different path (so that the output paths doesn't change with the build id anymore) Fixup for https://github.com/vercel/next.js/pull/88641 --- ...-static-asset-404-app-asset-prefix.test.ts | 8 +- ...lid-static-asset-404-app-base-path.test.ts | 8 +- .../invalid-static-asset-404-app.test.ts | 8 +- ...tatic-asset-404-pages-asset-prefix.test.ts | 8 +- ...d-static-asset-404-pages-base-path.test.ts | 8 +- .../invalid-static-asset-404-pages.test.ts | 8 +- .../test/index.test.ts | 74 ++++++++----------- 7 files changed, 55 insertions(+), 67 deletions(-) diff --git a/test/e2e/invalid-static-asset-404-app/invalid-static-asset-404-app-asset-prefix.test.ts b/test/e2e/invalid-static-asset-404-app/invalid-static-asset-404-app-asset-prefix.test.ts index 1d1498abb23c2b..fa5f0d07a76d61 100644 --- a/test/e2e/invalid-static-asset-404-app/invalid-static-asset-404-app-asset-prefix.test.ts +++ b/test/e2e/invalid-static-asset-404-app/invalid-static-asset-404-app-asset-prefix.test.ts @@ -1,7 +1,7 @@ import { nextTestSetup } from 'e2e-utils' describe('invalid-static-asset-404-app-asset-prefix', () => { - const { next, isNextDev } = nextTestSetup({ + const { next, isNextDeploy } = nextTestSetup({ files: __dirname, nextConfig: { assetPrefix: '/assets', @@ -9,9 +9,9 @@ describe('invalid-static-asset-404-app-asset-prefix', () => { }) it('should return correct output with status 200 on valid asset path', async () => { - const buildManifestPath = `/assets/_next/static/${ - isNextDev ? 'development' : next.buildId - }/_buildManifest.js` + const buildManifestPath = isNextDeploy + ? '/assets/_next/static/_buildManifest.js' + : `/assets/_next/static/${next.buildId}/_buildManifest.js` const res = await next.fetch(buildManifestPath) expect(res.status).toBe(200) diff --git a/test/e2e/invalid-static-asset-404-app/invalid-static-asset-404-app-base-path.test.ts b/test/e2e/invalid-static-asset-404-app/invalid-static-asset-404-app-base-path.test.ts index b5f94f42ba8b2a..afeea51b909f83 100644 --- a/test/e2e/invalid-static-asset-404-app/invalid-static-asset-404-app-base-path.test.ts +++ b/test/e2e/invalid-static-asset-404-app/invalid-static-asset-404-app-base-path.test.ts @@ -1,7 +1,7 @@ import { nextTestSetup } from 'e2e-utils' describe('invalid-static-asset-404-app-base-path', () => { - const { next, isNextDev } = nextTestSetup({ + const { next, isNextDeploy } = nextTestSetup({ files: __dirname, nextConfig: { basePath: '/base', @@ -9,9 +9,9 @@ describe('invalid-static-asset-404-app-base-path', () => { }) it('should return correct output with status 200 on valid asset path', async () => { - const buildManifestPath = `/base/_next/static/${ - isNextDev ? 'development' : next.buildId - }/_buildManifest.js` + const buildManifestPath = isNextDeploy + ? '/base/_next/static/_buildManifest.js' + : `/base/_next/static/${next.buildId}/_buildManifest.js` const res = await next.fetch(buildManifestPath) expect(res.status).toBe(200) diff --git a/test/e2e/invalid-static-asset-404-app/invalid-static-asset-404-app.test.ts b/test/e2e/invalid-static-asset-404-app/invalid-static-asset-404-app.test.ts index 25eef0d12a526d..fec02250957ec8 100644 --- a/test/e2e/invalid-static-asset-404-app/invalid-static-asset-404-app.test.ts +++ b/test/e2e/invalid-static-asset-404-app/invalid-static-asset-404-app.test.ts @@ -1,14 +1,14 @@ import { nextTestSetup } from 'e2e-utils' describe('invalid-static-asset-404-app', () => { - const { next, isNextDev } = nextTestSetup({ + const { next, isNextDeploy } = nextTestSetup({ files: __dirname, }) it('should return correct output with status 200 on valid asset path', async () => { - const buildManifestPath = `/_next/static/${ - isNextDev ? 'development' : next.buildId - }/_buildManifest.js` + const buildManifestPath = isNextDeploy + ? '/_next/static/_buildManifest.js' + : `/_next/static/${next.buildId}/_buildManifest.js` const res = await next.fetch(buildManifestPath) expect(res.status).toBe(200) diff --git a/test/e2e/invalid-static-asset-404-pages/invalid-static-asset-404-pages-asset-prefix.test.ts b/test/e2e/invalid-static-asset-404-pages/invalid-static-asset-404-pages-asset-prefix.test.ts index f894a3ebe91dc4..5b8e1caf10f529 100644 --- a/test/e2e/invalid-static-asset-404-pages/invalid-static-asset-404-pages-asset-prefix.test.ts +++ b/test/e2e/invalid-static-asset-404-pages/invalid-static-asset-404-pages-asset-prefix.test.ts @@ -1,7 +1,7 @@ import { nextTestSetup } from 'e2e-utils' describe('invalid-static-asset-404-pages-asset-prefix', () => { - const { next, isNextDev } = nextTestSetup({ + const { next, isNextDeploy } = nextTestSetup({ files: __dirname, nextConfig: { assetPrefix: '/assets', @@ -9,9 +9,9 @@ describe('invalid-static-asset-404-pages-asset-prefix', () => { }) it('should return correct output with status 200 on valid asset path', async () => { - const buildManifestPath = `/assets/_next/static/${ - isNextDev ? 'development' : next.buildId - }/_buildManifest.js` + const buildManifestPath = isNextDeploy + ? '/assets/_next/static/_buildManifest.js' + : `/assets/_next/static/${next.buildId}/_buildManifest.js` const res = await next.fetch(buildManifestPath) expect(res.status).toBe(200) diff --git a/test/e2e/invalid-static-asset-404-pages/invalid-static-asset-404-pages-base-path.test.ts b/test/e2e/invalid-static-asset-404-pages/invalid-static-asset-404-pages-base-path.test.ts index 6c09f9a868a719..ad311866e4d1e2 100644 --- a/test/e2e/invalid-static-asset-404-pages/invalid-static-asset-404-pages-base-path.test.ts +++ b/test/e2e/invalid-static-asset-404-pages/invalid-static-asset-404-pages-base-path.test.ts @@ -1,7 +1,7 @@ import { nextTestSetup } from 'e2e-utils' describe('invalid-static-asset-404-pages-base-path', () => { - const { next, isNextDev } = nextTestSetup({ + const { next, isNextDeploy } = nextTestSetup({ files: __dirname, nextConfig: { basePath: '/base', @@ -9,9 +9,9 @@ describe('invalid-static-asset-404-pages-base-path', () => { }) it('should return correct output with status 200 on valid asset path', async () => { - const buildManifestPath = `/base/_next/static/${ - isNextDev ? 'development' : next.buildId - }/_buildManifest.js` + const buildManifestPath = isNextDeploy + ? '/base/_next/static/_buildManifest.js' + : `/base/_next/static/${next.buildId}/_buildManifest.js` const res = await next.fetch(buildManifestPath) expect(res.status).toBe(200) diff --git a/test/e2e/invalid-static-asset-404-pages/invalid-static-asset-404-pages.test.ts b/test/e2e/invalid-static-asset-404-pages/invalid-static-asset-404-pages.test.ts index 1c4ccd84050596..ac33a341937c5d 100644 --- a/test/e2e/invalid-static-asset-404-pages/invalid-static-asset-404-pages.test.ts +++ b/test/e2e/invalid-static-asset-404-pages/invalid-static-asset-404-pages.test.ts @@ -1,14 +1,14 @@ import { nextTestSetup } from 'e2e-utils' describe('invalid-static-asset-404-pages', () => { - const { next, isNextDev } = nextTestSetup({ + const { next, isNextDeploy } = nextTestSetup({ files: __dirname, }) it('should return correct output with status 200 on valid asset path', async () => { - const buildManifestPath = `/_next/static/${ - isNextDev ? 'development' : next.buildId - }/_buildManifest.js` + const buildManifestPath = isNextDeploy + ? '/_next/static/_buildManifest.js' + : `/_next/static/${next.buildId}/_buildManifest.js` const res = await next.fetch(buildManifestPath) expect(res.status).toBe(200) diff --git a/test/e2e/middleware-custom-matchers-i18n/test/index.test.ts b/test/e2e/middleware-custom-matchers-i18n/test/index.test.ts index 9f7fd6d9d31a75..4156378830d870 100644 --- a/test/e2e/middleware-custom-matchers-i18n/test/index.test.ts +++ b/test/e2e/middleware-custom-matchers-i18n/test/index.test.ts @@ -4,22 +4,14 @@ import { join } from 'path' import webdriver from 'next-webdriver' import { fetchViaHTTP } from 'next-test-utils' -import { createNext, FileRef } from 'e2e-utils' -import { NextInstance } from 'e2e-utils' +import { FileRef, isNextDeploy, nextTestSetup } from 'e2e-utils' const itif = (condition: boolean) => (condition ? it : it.skip) -const isModeDeploy = process.env.NEXT_TEST_MODE === 'deploy' - describe('Middleware custom matchers i18n', () => { - let next: NextInstance - - beforeAll(async () => { - next = await createNext({ - files: new FileRef(join(__dirname, '../app')), - }) + const { next } = nextTestSetup({ + files: new FileRef(join(__dirname, '../app')), }) - afterAll(() => next.destroy()) it.each(['/hello', '/en/hello', '/nl-NL/hello', '/nl-NL/about'])( 'should match %s', @@ -41,7 +33,7 @@ describe('Middleware custom matchers i18n', () => { // FIXME: // See https://linear.app/vercel/issue/EC-160/header-value-set-on-middleware-is-not-propagated-on-client-request-of - itif(!isModeDeploy).each(['hello', 'en_hello', 'nl-NL_hello', 'nl-NL_about'])( + itif(!isNextDeploy).each(['hello', 'en_hello', 'nl-NL_hello', 'nl-NL_about'])( 'should match has query on client routing %s', async (id) => { const browser = await webdriver(next.url, '/routes') @@ -56,41 +48,37 @@ describe('Middleware custom matchers i18n', () => { }) describe('Middleware custom matchers with root', () => { - let next: NextInstance + const { next, isNextDeploy } = nextTestSetup({ + files: { + pages: new FileRef(join(__dirname, '../app', 'pages')), + 'next.config.js': new FileRef( + join(__dirname, '../app', 'next.config.js') + ), + 'middleware.js': ` + import { NextResponse } from 'next/server' + + export const config = { + matcher: [ + '/', + '/((?!api|_next/static|favicon|.well-known|auth|sitemap|robots.txt|files).*)', + ], + }; - beforeAll(async () => { - next = await createNext({ - files: { - pages: new FileRef(join(__dirname, '../app', 'pages')), - 'next.config.js': new FileRef( - join(__dirname, '../app', 'next.config.js') - ), - 'middleware.js': ` - import { NextResponse } from 'next/server' - - export const config = { - matcher: [ - '/', - '/((?!api|_next/static|favicon|.well-known|auth|sitemap|robots.txt|files).*)', - ], - }; - - export default function middleware(request) { - const nextUrl = request.nextUrl.clone() - nextUrl.pathname = '/' - const res = NextResponse.rewrite(nextUrl) - res.headers.set('X-From-Middleware', 'true') - return res - }`, - }, - }) + export default function middleware(request) { + const nextUrl = request.nextUrl.clone() + nextUrl.pathname = '/' + const res = NextResponse.rewrite(nextUrl) + res.headers.set('X-From-Middleware', 'true') + return res + }`, + }, }) - afterAll(() => next.destroy()) it('should not match', async () => { - const res = await fetchViaHTTP( - next.url, - `/_next/static/${next.buildId}/_buildManifest.js` + const res = await next.fetch( + isNextDeploy + ? '/_next/static/_buildManifest.js' + : `/_next/static/${next.buildId}/_buildManifest.js` ) expect(res.status).toBe(200) expect(res.headers.get('x-from-middleware')).toBeFalsy() From 363783dbbca73fa77aa6bb6be57d1397b8557e2e Mon Sep 17 00:00:00 2001 From: Hendrik Liebau Date: Tue, 20 Jan 2026 15:00:35 +0100 Subject: [PATCH 3/7] Simplify `getImplicitTags` to accept pathname instead of url object (#88753) The function only used `url.pathname`, not `url.search`. --- .../next/src/server/app-render/app-render.tsx | 9 +++---- .../next/src/server/lib/implicit-tags.test.ts | 26 +++++++++---------- packages/next/src/server/lib/implicit-tags.ts | 12 +++------ .../server/route-modules/app-route/module.ts | 2 +- packages/next/src/server/web/adapter.ts | 2 +- 5 files changed, 21 insertions(+), 30 deletions(-) diff --git a/packages/next/src/server/app-render/app-render.tsx b/packages/next/src/server/app-render/app-render.tsx index 607b1fa31da424..a32b4f6b986fc7 100644 --- a/packages/next/src/server/app-render/app-render.tsx +++ b/packages/next/src/server/app-render/app-render.tsx @@ -2023,15 +2023,12 @@ async function renderToHTMLOrFlightImpl( // fetch cache. Using the destination path ensures that // revalidatePath('/dest') invalidates cache entries for pages rewritten to // that destination. - // TODO: simplify getImplicitTags to accept pathname instead of url object. - const rewrittenPathname = getRequestMeta(req, 'rewrittenPathname') - const implicitTagsUrl = rewrittenPathname - ? { ...url, pathname: rewrittenPathname } - : url + const implicitTagsPathname = + getRequestMeta(req, 'rewrittenPathname') || url.pathname const implicitTags = await getImplicitTags( workStore.page, - implicitTagsUrl, + implicitTagsPathname, fallbackRouteParams ) diff --git a/packages/next/src/server/lib/implicit-tags.test.ts b/packages/next/src/server/lib/implicit-tags.test.ts index 712e5e578f66bd..31e6ef04d2fa2c 100644 --- a/packages/next/src/server/lib/implicit-tags.test.ts +++ b/packages/next/src/server/lib/implicit-tags.test.ts @@ -4,49 +4,49 @@ import { getImplicitTags } from './implicit-tags' describe('getImplicitTags()', () => { it.each<{ page: string - url: { pathname: string; search: string } + pathname: string fallbackRouteParams: null | OpaqueFallbackRouteParams expectedTags: string[] }>([ { page: '/', - url: { pathname: '/', search: '' }, + pathname: '/', fallbackRouteParams: null, expectedTags: ['_N_T_/layout', '_N_T_/', '_N_T_/index'], }, { page: '', - url: { pathname: '/', search: '' }, + pathname: '/', fallbackRouteParams: null, expectedTags: ['_N_T_/layout', '_N_T_/', '_N_T_/index'], }, { page: '/', - url: { pathname: '', search: '' }, + pathname: '', fallbackRouteParams: null, expectedTags: ['_N_T_/layout'], }, { page: '/page', - url: { pathname: '', search: '' }, + pathname: '', fallbackRouteParams: null, expectedTags: ['_N_T_/layout', '_N_T_/page'], }, { page: '/page', - url: { pathname: '/', search: '' }, + pathname: '/', fallbackRouteParams: null, expectedTags: ['_N_T_/layout', '_N_T_/page', '_N_T_/', '_N_T_/index'], }, { page: '/page', - url: { pathname: '/page', search: '' }, + pathname: '/page', fallbackRouteParams: null, expectedTags: ['_N_T_/layout', '_N_T_/page'], }, { page: '/index', - url: { pathname: '/', search: '' }, + pathname: '/', fallbackRouteParams: null, expectedTags: [ '_N_T_/layout', @@ -57,13 +57,13 @@ describe('getImplicitTags()', () => { }, { page: '/hello', - url: { pathname: '/hello', search: '' }, + pathname: '/hello', fallbackRouteParams: null, expectedTags: ['_N_T_/layout', '_N_T_/hello/layout', '_N_T_/hello'], }, { page: '/foo/bar/baz', - url: { pathname: '/foo/bar/baz', search: '' }, + pathname: '/foo/bar/baz', fallbackRouteParams: null, expectedTags: [ '_N_T_/layout', @@ -74,9 +74,9 @@ describe('getImplicitTags()', () => { ], }, ])( - 'for page $page with url $url and $fallback', - async ({ page, url, fallbackRouteParams, expectedTags }) => { - const result = await getImplicitTags(page, url, fallbackRouteParams) + 'for page $page with pathname $pathname', + async ({ page, pathname, fallbackRouteParams, expectedTags }) => { + const result = await getImplicitTags(page, pathname, fallbackRouteParams) expect(result.tags).toEqual(expectedTags) } ) diff --git a/packages/next/src/server/lib/implicit-tags.ts b/packages/next/src/server/lib/implicit-tags.ts index becffcea007b7f..3e808e808f2653 100644 --- a/packages/next/src/server/lib/implicit-tags.ts +++ b/packages/next/src/server/lib/implicit-tags.ts @@ -73,10 +73,7 @@ function createTagsExpirationsByCacheKind( export async function getImplicitTags( page: string, - url: { - pathname: string - search?: string - }, + pathname: string, fallbackRouteParams: null | OpaqueFallbackRouteParams ): Promise { const tags = new Set() @@ -90,11 +87,8 @@ export async function getImplicitTags( // Add the tags from the pathname. If the route has unknown params, we don't // want to add the pathname as a tag, as it will be invalid. - if ( - url.pathname && - (!fallbackRouteParams || fallbackRouteParams.size === 0) - ) { - const tag = `${NEXT_CACHE_IMPLICIT_TAG_ID}${url.pathname}` + if (pathname && (!fallbackRouteParams || fallbackRouteParams.size === 0)) { + const tag = `${NEXT_CACHE_IMPLICIT_TAG_ID}${pathname}` tags.add(tag) } diff --git a/packages/next/src/server/route-modules/app-route/module.ts b/packages/next/src/server/route-modules/app-route/module.ts index a6e1c8d1f88902..f8733c1401f2b6 100644 --- a/packages/next/src/server/route-modules/app-route/module.ts +++ b/packages/next/src/server/route-modules/app-route/module.ts @@ -703,7 +703,7 @@ export class AppRouteRouteModule extends RouteModule< const implicitTags = await getImplicitTags( this.definition.page, - req.nextUrl, + req.nextUrl.pathname, // App Routes don't support unknown route params. null ) diff --git a/packages/next/src/server/web/adapter.ts b/packages/next/src/server/web/adapter.ts index 3ebd3ec1b1ee37..e5affa0bd29009 100644 --- a/packages/next/src/server/web/adapter.ts +++ b/packages/next/src/server/web/adapter.ts @@ -283,7 +283,7 @@ export async function adapter( const implicitTags = await getImplicitTags( page, - request.nextUrl, + request.nextUrl.pathname, fallbackRouteParams ) From 689f6fe38eb9bd62fc8471c03af436680a3d0567 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Tue, 20 Jan 2026 15:28:59 +0100 Subject: [PATCH 4/7] Add `NEXT_DEPLOYMENT_ID` global (#86738) - Adds a `process.env.NEXT_DEPLOYMENT_ID` -> `globalThis.NEXT_DEPLOYMENT_ID` replacement - On startup, `globalThis.NEXT_DEPLOYMENT_ID` is initialized to `process.env.NEXT_DEPLOYMENT_ID_COMPILE_TIME` This prepares for https://github.com/vercel/next.js/pull/88761 to replace `process.env.NEXT_DEPLOYMENT_ID_COMPILE_TIME` with reading `` so that we can remove the env var inlining However, all of this is only done for Turbopack, because we cannot forward `globalThis.NEXT_DEPLOYMENT_ID` to web workers with Webpack easily. --- packages/next/src/build/define-env.ts | 46 ++++++++++++------- .../next/src/client/app-next-turbopack.ts | 1 + packages/next/src/client/app-webpack.ts | 8 +++- .../next/src/client/next-dev-turbopack.ts | 1 + packages/next/src/client/next-dev.ts | 1 + packages/next/src/client/next-turbopack.ts | 1 + packages/next/src/client/next.ts | 1 + .../client/register-deployment-id-global.ts | 2 + packages/next/src/shared/lib/deployment-id.ts | 5 +- .../worker/app/deployment-id-worker.ts | 2 + .../app-dir/worker/app/deployment-id/page.js | 35 ++++++++++++++ test/e2e/app-dir/worker/worker.test.ts | 28 +++++++++++ test/unit/next-image-get-img-props.test.ts | 44 +++++++++++------- .../src/browser/runtime/base/runtime-base.ts | 1 + ...ug-ids_browser_input_index_0151fefb.js.map | 10 ++-- ..._debug-ids_browser_input_index_0151fefb.js | 5 +- ...efault_dev_runtime_input_index_c0f7e0b0.js | 1 + ...lt_dev_runtime_input_index_c0f7e0b0.js.map | 8 ++-- ...nsforms_preset_env_input_index_5aaf1327.js | 1 + ...rms_preset_env_input_index_5aaf1327.js.map | 6 +-- 20 files changed, 158 insertions(+), 49 deletions(-) create mode 100644 packages/next/src/client/register-deployment-id-global.ts create mode 100644 test/e2e/app-dir/worker/app/deployment-id-worker.ts create mode 100644 test/e2e/app-dir/worker/app/deployment-id/page.js diff --git a/packages/next/src/build/define-env.ts b/packages/next/src/build/define-env.ts index f6e3c588b67a29..a7c5be7d90c724 100644 --- a/packages/next/src/build/define-env.ts +++ b/packages/next/src/build/define-env.ts @@ -41,11 +41,14 @@ export interface DefineEnvOptions { } } +const DEFINE_ENV_EXPRESSION = Symbol('DEFINE_ENV_EXPRESSION') + interface DefineEnv { [key: string]: | string | string[] | boolean + | { [DEFINE_ENV_EXPRESSION]: string } | ProxyMatcher[] | BloomFilter | Partial @@ -64,7 +67,9 @@ function serializeDefineEnv(defineEnv: DefineEnv): SerializedDefineEnv { const defineEnvStringified: SerializedDefineEnv = Object.fromEntries( Object.entries(defineEnv).map(([key, value]) => [ key, - JSON.stringify(value), + typeof value === 'object' && DEFINE_ENV_EXPRESSION in value + ? value[DEFINE_ENV_EXPRESSION] + : JSON.stringify(value), ]) ) return defineEnvStringified @@ -165,23 +170,32 @@ export function getDefineEnv({ 'process.env.__NEXT_CACHE_COMPONENTS': isCacheComponentsEnabled, 'process.env.__NEXT_USE_CACHE': isUseCacheEnabled, - ...(isClient + ...(config.experimental?.useSkewCookie || !config.deploymentId ? { - // TODO use `globalThis.NEXT_DEPLOYMENT_ID` on client to still support accessing - // process.env.NEXT_DEPLOYMENT_ID in userland - 'process.env.NEXT_DEPLOYMENT_ID': config.experimental?.useSkewCookie - ? false - : config.deploymentId || false, + 'process.env.NEXT_DEPLOYMENT_ID': false, } - : config.experimental?.runtimeServerDeploymentId - ? { - // Don't inline at all, keep process.env.NEXT_DEPLOYMENT_ID as is - } - : { - 'process.env.NEXT_DEPLOYMENT_ID': config.experimental?.useSkewCookie - ? false - : config.deploymentId || false, - }), + : isClient + ? isTurbopack + ? { + 'process.env.NEXT_DEPLOYMENT_ID': { + [DEFINE_ENV_EXPRESSION]: 'globalThis.NEXT_DEPLOYMENT_ID', + }, + // TODO replace with read from HTML document attribute + 'process.env.NEXT_DEPLOYMENT_ID_COMPILE_TIME': + config.deploymentId, + } + : { + // For Webpack, we currently don't use the non-inlining globalThis.NEXT_DEPLOYMENT_ID + // approach because we cannot forward this global variable to web workers easily. + 'process.env.NEXT_DEPLOYMENT_ID': config.deploymentId || false, + } + : config.experimental?.runtimeServerDeploymentId + ? { + // Don't inline at all, keep process.env.NEXT_DEPLOYMENT_ID as is + } + : { + 'process.env.NEXT_DEPLOYMENT_ID': config.deploymentId || false, + }), // Propagates the `__NEXT_EXPERIMENTAL_STATIC_SHELL_DEBUGGING` environment // variable to the client. diff --git a/packages/next/src/client/app-next-turbopack.ts b/packages/next/src/client/app-next-turbopack.ts index 10e8416e4fed47..0b4e7041395a25 100644 --- a/packages/next/src/client/app-next-turbopack.ts +++ b/packages/next/src/client/app-next-turbopack.ts @@ -1,3 +1,4 @@ +import './register-deployment-id-global' import { appBootstrap } from './app-bootstrap' import { isRecoverableError } from './react-client-callbacks/on-recoverable-error' diff --git a/packages/next/src/client/app-webpack.ts b/packages/next/src/client/app-webpack.ts index 50a942a7770446..2b31046d2ef432 100644 --- a/packages/next/src/client/app-webpack.ts +++ b/packages/next/src/client/app-webpack.ts @@ -1,14 +1,18 @@ // Override chunk URL mapping in the webpack runtime // https://github.com/webpack/webpack/blob/2738eebc7880835d88c727d364ad37f3ec557593/lib/RuntimeGlobals.js#L204 -import { getDeploymentIdQueryOrEmptyString } from '../shared/lib/deployment-id' +import './register-deployment-id-global' +import { + getDeploymentId, + getDeploymentIdQueryOrEmptyString, +} from '../shared/lib/deployment-id' import { encodeURIPath } from '../shared/lib/encode-uri-path' declare const __webpack_require__: any // If we have a deployment ID, we need to append it to the webpack chunk names // I am keeping the process check explicit so this can be statically optimized -if (process.env.NEXT_DEPLOYMENT_ID) { +if (getDeploymentId()) { const suffix = getDeploymentIdQueryOrEmptyString() const getChunkScriptFilename = __webpack_require__.u __webpack_require__.u = (...args: any[]) => diff --git a/packages/next/src/client/next-dev-turbopack.ts b/packages/next/src/client/next-dev-turbopack.ts index d456485c747ec0..f8c47425f04c90 100644 --- a/packages/next/src/client/next-dev-turbopack.ts +++ b/packages/next/src/client/next-dev-turbopack.ts @@ -1,4 +1,5 @@ // TODO: Remove use of `any` type. +import './register-deployment-id-global' import { initialize, version, router, emitter } from './' import initHMR from './dev/hot-middleware-client' diff --git a/packages/next/src/client/next-dev.ts b/packages/next/src/client/next-dev.ts index 57d459137cef83..59720da7981257 100644 --- a/packages/next/src/client/next-dev.ts +++ b/packages/next/src/client/next-dev.ts @@ -1,4 +1,5 @@ // TODO: Remove use of `any` type. +import './register-deployment-id-global' import './webpack' import { initialize, version, router, emitter } from './' import initHMR from './dev/hot-middleware-client' diff --git a/packages/next/src/client/next-turbopack.ts b/packages/next/src/client/next-turbopack.ts index 407db2123c5e45..727471c2e8bd7d 100644 --- a/packages/next/src/client/next-turbopack.ts +++ b/packages/next/src/client/next-turbopack.ts @@ -1,6 +1,7 @@ // A client-side entry point for Turbopack builds. Includes logic to load chunks, // but does not include development-time features like hot module reloading. +import './register-deployment-id-global' import '../lib/require-instrumentation-client' // TODO: Remove use of `any` type. diff --git a/packages/next/src/client/next.ts b/packages/next/src/client/next.ts index 5b38049bf0c497..8e552aeb8e9230 100644 --- a/packages/next/src/client/next.ts +++ b/packages/next/src/client/next.ts @@ -1,3 +1,4 @@ +import './register-deployment-id-global' import './webpack' import '../lib/require-instrumentation-client' diff --git a/packages/next/src/client/register-deployment-id-global.ts b/packages/next/src/client/register-deployment-id-global.ts new file mode 100644 index 00000000000000..eabb977e31df92 --- /dev/null +++ b/packages/next/src/client/register-deployment-id-global.ts @@ -0,0 +1,2 @@ +import { getDeploymentId } from '../shared/lib/deployment-id' +;(globalThis as any).NEXT_DEPLOYMENT_ID = getDeploymentId() diff --git a/packages/next/src/shared/lib/deployment-id.ts b/packages/next/src/shared/lib/deployment-id.ts index 6ca906f00fe7e6..22abdb143baa5a 100644 --- a/packages/next/src/shared/lib/deployment-id.ts +++ b/packages/next/src/shared/lib/deployment-id.ts @@ -1,7 +1,10 @@ // This could also be a variable instead of a function, but some unit tests want to change the ID at // runtime. Even though that would never happen in a real deployment. export function getDeploymentId(): string | undefined { - return process.env.NEXT_DEPLOYMENT_ID + return ( + process.env.NEXT_DEPLOYMENT_ID ?? + process.env.NEXT_DEPLOYMENT_ID_COMPILE_TIME + ) } export function getDeploymentIdQueryOrEmptyString(): string { diff --git a/test/e2e/app-dir/worker/app/deployment-id-worker.ts b/test/e2e/app-dir/worker/app/deployment-id-worker.ts new file mode 100644 index 00000000000000..269798a8842219 --- /dev/null +++ b/test/e2e/app-dir/worker/app/deployment-id-worker.ts @@ -0,0 +1,2 @@ +const deploymentId = process.env.NEXT_DEPLOYMENT_ID +self.postMessage(deploymentId) diff --git a/test/e2e/app-dir/worker/app/deployment-id/page.js b/test/e2e/app-dir/worker/app/deployment-id/page.js new file mode 100644 index 00000000000000..9a41e31453665b --- /dev/null +++ b/test/e2e/app-dir/worker/app/deployment-id/page.js @@ -0,0 +1,35 @@ +'use client' +import { useState } from 'react' + +export default function Home() { + const [workerDeploymentId, setWorkerDeploymentId] = useState('default') + const mainDeploymentId = process.env.NEXT_DEPLOYMENT_ID + + return ( +
+ +

+ Main deployment ID:{' '} + {mainDeploymentId} +

+

+ Worker deployment ID:{' '} + {workerDeploymentId} +

+
+ ) +} diff --git a/test/e2e/app-dir/worker/worker.test.ts b/test/e2e/app-dir/worker/worker.test.ts index 133d667d438f0b..d323b619d659a9 100644 --- a/test/e2e/app-dir/worker/worker.test.ts +++ b/test/e2e/app-dir/worker/worker.test.ts @@ -68,4 +68,32 @@ describe('app dir - workers', () => { ) ) }) + + it('should have access to NEXT_DEPLOYMENT_ID in web worker', async () => { + const browser = await next.browser('/deployment-id', { + beforePageLoad, + }) + + // Verify main thread has deployment ID and it's not empty + const mainDeploymentId = await browser + .elementByCss('#main-deployment-id') + .text() + expect(mainDeploymentId).toBe('test-deployment-id') + + // Initial worker state should be default + expect(await browser.elementByCss('#worker-deployment-id').text()).toBe( + 'default' + ) + + // Trigger worker to get deployment ID + await browser.elementByCss('button').click() + + // Wait for worker to respond and verify it matches main thread + await retry(async () => { + const workerDeploymentId = await browser + .elementByCss('#worker-deployment-id') + .text() + expect(workerDeploymentId).toBe('test-deployment-id') + }) + }) }) diff --git a/test/unit/next-image-get-img-props.test.ts b/test/unit/next-image-get-img-props.test.ts index 49baeba36a14e8..cd91c42a20dc79 100644 --- a/test/unit/next-image-get-img-props.test.ts +++ b/test/unit/next-image-get-img-props.test.ts @@ -1,6 +1,17 @@ /* eslint-env jest */ import { getImageProps } from 'next/image' +let deploymentId + +jest.mock('next/dist/shared/lib/deployment-id.js', () => { + return { + __esModule: true, + getDeploymentId() { + return deploymentId + }, + } +}) + describe('getImageProps()', () => { let warningMessages: string[] const originalConsoleWarn = console.warn @@ -9,6 +20,7 @@ describe('getImageProps()', () => { console.warn = (m: string) => { warningMessages.push(m) } + deploymentId = undefined }) afterEach(() => { @@ -612,7 +624,7 @@ describe('getImageProps()', () => { }) it('should add query string for imported local image when NEXT_DEPLOYMENT_ID defined', async () => { try { - process.env.NEXT_DEPLOYMENT_ID = 'dpl_123' + deploymentId = 'dpl_123' const { props } = getImageProps({ alt: 'a nice desc', src: '/_next/static/media/test.abc123.png', @@ -637,12 +649,12 @@ describe('getImageProps()', () => { ], ]) } finally { - delete process.env.NEXT_DEPLOYMENT_ID + deploymentId = undefined } }) it('should add query string for imported local image from microfrontend when NEXT_DEPLOYMENT_ID defined', async () => { try { - process.env.NEXT_DEPLOYMENT_ID = 'dpl_123' + deploymentId = 'dpl_123' const { props } = getImageProps({ alt: 'a nice desc', src: '/microfrontend/_next/static/media/test.abc123.png', // simulating microfrontend path @@ -667,12 +679,12 @@ describe('getImageProps()', () => { ], ]) } finally { - delete process.env.NEXT_DEPLOYMENT_ID + deploymentId = undefined } }) it('should add query string for relative local image when NEXT_DEPLOYMENT_ID defined', async () => { try { - process.env.NEXT_DEPLOYMENT_ID = 'dpl_123' + deploymentId = 'dpl_123' const { props } = getImageProps({ alt: 'a nice desc', src: '/test.png', @@ -694,12 +706,12 @@ describe('getImageProps()', () => { ['src', '/_next/image?url=%2Ftest.png&w=256&q=75&dpl=dpl_123'], ]) } finally { - delete process.env.NEXT_DEPLOYMENT_ID + deploymentId = undefined } }) it('should not add query string for absolute remote image when NEXT_DEPLOYMENT_ID defined', async () => { try { - process.env.NEXT_DEPLOYMENT_ID = 'dpl_123' + deploymentId = 'dpl_123' const { props } = getImageProps({ alt: 'a nice desc', src: 'http://example.com/test.png', @@ -724,12 +736,12 @@ describe('getImageProps()', () => { ], ]) } finally { - delete process.env.NEXT_DEPLOYMENT_ID + deploymentId = undefined } }) it('should add query string with question mark for unoptimized relative svg when NEXT_DEPLOYMENT_ID defined', async () => { try { - process.env.NEXT_DEPLOYMENT_ID = 'dpl_123' + deploymentId = 'dpl_123' const { props } = getImageProps({ alt: 'a nice desc', src: '/test.svg', @@ -747,12 +759,12 @@ describe('getImageProps()', () => { ['src', '/test.svg?dpl=dpl_123'], ]) } finally { - delete process.env.NEXT_DEPLOYMENT_ID + deploymentId = undefined } }) it('should add query string with ampersand for unoptimized relative svg when NEXT_DEPLOYMENT_ID defined', async () => { try { - process.env.NEXT_DEPLOYMENT_ID = 'dpl_123' + deploymentId = 'dpl_123' const { props } = getImageProps({ alt: 'a nice desc', src: '/test.svg?v=1', @@ -770,12 +782,12 @@ describe('getImageProps()', () => { ['src', '/test.svg?v=1&dpl=dpl_123'], ]) } finally { - delete process.env.NEXT_DEPLOYMENT_ID + deploymentId = undefined } }) it('should not add query string for unoptimized absolute remote svg when NEXT_DEPLOYMENT_ID defined', async () => { try { - process.env.NEXT_DEPLOYMENT_ID = 'dpl_123' + deploymentId = 'dpl_123' const { props } = getImageProps({ alt: 'a nice desc', src: 'http://example.com/test.svg', @@ -793,12 +805,12 @@ describe('getImageProps()', () => { ['src', 'http://example.com/test.svg'], ]) } finally { - delete process.env.NEXT_DEPLOYMENT_ID + deploymentId = undefined } }) it('should not add query string for unoptimized with no protocol when NEXT_DEPLOYMENT_ID defined', async () => { try { - process.env.NEXT_DEPLOYMENT_ID = 'dpl_123' + deploymentId = 'dpl_123' const { props } = getImageProps({ alt: 'a nice desc', src: '//example.com/test.png', @@ -817,7 +829,7 @@ describe('getImageProps()', () => { ['src', '//example.com/test.png'], ]) } finally { - delete process.env.NEXT_DEPLOYMENT_ID + deploymentId = undefined } }) }) diff --git a/turbopack/crates/turbopack-ecmascript-runtime/js/src/browser/runtime/base/runtime-base.ts b/turbopack/crates/turbopack-ecmascript-runtime/js/src/browser/runtime/base/runtime-base.ts index ff314c55967621..4ad94bb61df962 100644 --- a/turbopack/crates/turbopack-ecmascript-runtime/js/src/browser/runtime/base/runtime-base.ts +++ b/turbopack/crates/turbopack-ecmascript-runtime/js/src/browser/runtime/base/runtime-base.ts @@ -323,6 +323,7 @@ function getWorkerBlobURL(chunks: ChunkPath[]): string { // evaluated by poping urls off of this array. See `getPathFromScript` let bootstrap = `self.TURBOPACK_WORKER_LOCATION = ${JSON.stringify(location.origin)}; self.TURBOPACK_CHUNK_SUFFIX = ${JSON.stringify(CHUNK_SUFFIX)}; +self.NEXT_DEPLOYMENT_ID = ${JSON.stringify((globalThis as any).NEXT_DEPLOYMENT_ID)}; self.TURBOPACK_NEXT_CHUNK_URLS = ${JSON.stringify(chunks.reverse().map(getChunkRelativeUrl), null, 2)}; importScripts(...self.TURBOPACK_NEXT_CHUNK_URLS.map(c => self.TURBOPACK_WORKER_LOCATION + c).reverse());` let blob = new Blob([bootstrap], { type: 'text/javascript' }) diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/debug-ids/browser/output/aaf3a_crates_turbopack-tests_tests_snapshot_debug-ids_browser_input_index_0151fefb.js.map b/turbopack/crates/turbopack-tests/tests/snapshot/debug-ids/browser/output/aaf3a_crates_turbopack-tests_tests_snapshot_debug-ids_browser_input_index_0151fefb.js.map index f02d8bb69a81de..596ad278750a22 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/debug-ids/browser/output/aaf3a_crates_turbopack-tests_tests_snapshot_debug-ids_browser_input_index_0151fefb.js.map +++ b/turbopack/crates/turbopack-tests/tests/snapshot/debug-ids/browser/output/aaf3a_crates_turbopack-tests_tests_snapshot_debug-ids_browser_input_index_0151fefb.js.map @@ -1,11 +1,11 @@ { "version": 3, "sources": [], - "debugId": "ae0c8767-ff94-abb9-fa13-d8c5ded28f9e", + "debugId": "3834607a-5e38-b3f2-d7f2-094bfde98e30", "sections": [ {"offset": {"line": 14, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/shared/runtime-utils.ts"],"sourcesContent":["/**\n * This file contains runtime types and functions that are shared between all\n * TurboPack ECMAScript runtimes.\n *\n * It will be prepended to the runtime code of each runtime.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n\ntype EsmNamespaceObject = Record\n\n// @ts-ignore Defined in `dev-base.ts`\ndeclare function getOrInstantiateModuleFromParent(\n id: ModuleId,\n sourceModule: M\n): M\n\nconst REEXPORTED_OBJECTS = new WeakMap()\n\n/**\n * Constructs the `__turbopack_context__` object for a module.\n */\nfunction Context(\n this: TurbopackBaseContext,\n module: Module,\n exports: Exports\n) {\n this.m = module\n // We need to store this here instead of accessing it from the module object to:\n // 1. Make it available to factories directly, since we rewrite `this` to\n // `__turbopack_context__.e` in CJS modules.\n // 2. Support async modules which rewrite `module.exports` to a promise, so we\n // can still access the original exports object from functions like\n // `esmExport`\n // Ideally we could find a new approach for async modules and drop this property altogether.\n this.e = exports\n}\nconst contextPrototype = Context.prototype as TurbopackBaseContext\n\ntype ModuleContextMap = Record\n\ninterface ModuleContextEntry {\n id: () => ModuleId\n module: () => any\n}\n\ninterface ModuleContext {\n // require call\n (moduleId: string): Exports | EsmNamespaceObject\n\n // async import call\n import(moduleId: string): Promise\n\n keys(): ModuleId[]\n\n resolve(moduleId: string): ModuleId\n}\n\ntype GetOrInstantiateModuleFromParent = (\n moduleId: M['id'],\n parentModule: M\n) => M\n\ndeclare function getOrInstantiateRuntimeModule(\n chunkPath: ChunkPath,\n moduleId: ModuleId\n): Module\n\nconst hasOwnProperty = Object.prototype.hasOwnProperty\nconst toStringTag = typeof Symbol !== 'undefined' && Symbol.toStringTag\n\nfunction defineProp(\n obj: any,\n name: PropertyKey,\n options: PropertyDescriptor & ThisType\n) {\n if (!hasOwnProperty.call(obj, name)) Object.defineProperty(obj, name, options)\n}\n\nfunction getOverwrittenModule(\n moduleCache: ModuleCache,\n id: ModuleId\n): Module {\n let module = moduleCache[id]\n if (!module) {\n // This is invoked when a module is merged into another module, thus it wasn't invoked via\n // instantiateModule and the cache entry wasn't created yet.\n module = createModuleObject(id)\n moduleCache[id] = module\n }\n return module\n}\n\n/**\n * Creates the module object. Only done here to ensure all module objects have the same shape.\n */\nfunction createModuleObject(id: ModuleId): Module {\n return {\n exports: {},\n error: undefined,\n id,\n namespaceObject: undefined,\n }\n}\n\ntype BindingTag = 0\nconst BindingTag_Value = 0 as BindingTag\n\n// an arbitrary sequence of bindings as\n// - a prop name\n// - BindingTag_Value, a value to be bound directly, or\n// - 1 or 2 functions to bind as getters and sdetters\ntype EsmBindings = Array<\n string | BindingTag | (() => unknown) | ((v: unknown) => void) | unknown\n>\n\n/**\n * Adds the getters to the exports object.\n */\nfunction esm(exports: Exports, bindings: EsmBindings) {\n defineProp(exports, '__esModule', { value: true })\n if (toStringTag) defineProp(exports, toStringTag, { value: 'Module' })\n let i = 0\n while (i < bindings.length) {\n const propName = bindings[i++] as string\n const tagOrFunction = bindings[i++]\n if (typeof tagOrFunction === 'number') {\n if (tagOrFunction === BindingTag_Value) {\n defineProp(exports, propName, {\n value: bindings[i++],\n enumerable: true,\n writable: false,\n })\n } else {\n throw new Error(`unexpected tag: ${tagOrFunction}`)\n }\n } else {\n const getterFn = tagOrFunction as () => unknown\n if (typeof bindings[i] === 'function') {\n const setterFn = bindings[i++] as (v: unknown) => void\n defineProp(exports, propName, {\n get: getterFn,\n set: setterFn,\n enumerable: true,\n })\n } else {\n defineProp(exports, propName, {\n get: getterFn,\n enumerable: true,\n })\n }\n }\n }\n Object.seal(exports)\n}\n\n/**\n * Makes the module an ESM with exports\n */\nfunction esmExport(\n this: TurbopackBaseContext,\n bindings: EsmBindings,\n id: ModuleId | undefined\n) {\n let module: Module\n let exports: Module['exports']\n if (id != null) {\n module = getOverwrittenModule(this.c, id)\n exports = module.exports\n } else {\n module = this.m\n exports = this.e\n }\n module.namespaceObject = exports\n esm(exports, bindings)\n}\ncontextPrototype.s = esmExport\n\ntype ReexportedObjects = Record[]\nfunction ensureDynamicExports(\n module: Module,\n exports: Exports\n): ReexportedObjects {\n let reexportedObjects: ReexportedObjects | undefined =\n REEXPORTED_OBJECTS.get(module)\n\n if (!reexportedObjects) {\n REEXPORTED_OBJECTS.set(module, (reexportedObjects = []))\n module.exports = module.namespaceObject = new Proxy(exports, {\n get(target, prop) {\n if (\n hasOwnProperty.call(target, prop) ||\n prop === 'default' ||\n prop === '__esModule'\n ) {\n return Reflect.get(target, prop)\n }\n for (const obj of reexportedObjects!) {\n const value = Reflect.get(obj, prop)\n if (value !== undefined) return value\n }\n return undefined\n },\n ownKeys(target) {\n const keys = Reflect.ownKeys(target)\n for (const obj of reexportedObjects!) {\n for (const key of Reflect.ownKeys(obj)) {\n if (key !== 'default' && !keys.includes(key)) keys.push(key)\n }\n }\n return keys\n },\n })\n }\n return reexportedObjects\n}\n\n/**\n * Dynamically exports properties from an object\n */\nfunction dynamicExport(\n this: TurbopackBaseContext,\n object: Record,\n id: ModuleId | undefined\n) {\n let module: Module\n let exports: Exports\n if (id != null) {\n module = getOverwrittenModule(this.c, id)\n exports = module.exports\n } else {\n module = this.m\n exports = this.e\n }\n const reexportedObjects = ensureDynamicExports(module, exports)\n\n if (typeof object === 'object' && object !== null) {\n reexportedObjects.push(object)\n }\n}\ncontextPrototype.j = dynamicExport\n\nfunction exportValue(\n this: TurbopackBaseContext,\n value: any,\n id: ModuleId | undefined\n) {\n let module: Module\n if (id != null) {\n module = getOverwrittenModule(this.c, id)\n } else {\n module = this.m\n }\n module.exports = value\n}\ncontextPrototype.v = exportValue\n\nfunction exportNamespace(\n this: TurbopackBaseContext,\n namespace: any,\n id: ModuleId | undefined\n) {\n let module: Module\n if (id != null) {\n module = getOverwrittenModule(this.c, id)\n } else {\n module = this.m\n }\n module.exports = module.namespaceObject = namespace\n}\ncontextPrototype.n = exportNamespace\n\nfunction createGetter(obj: Record, key: string | symbol) {\n return () => obj[key]\n}\n\n/**\n * @returns prototype of the object\n */\nconst getProto: (obj: any) => any = Object.getPrototypeOf\n ? (obj) => Object.getPrototypeOf(obj)\n : (obj) => obj.__proto__\n\n/** Prototypes that are not expanded for exports */\nconst LEAF_PROTOTYPES = [null, getProto({}), getProto([]), getProto(getProto)]\n\n/**\n * @param raw\n * @param ns\n * @param allowExportDefault\n * * `false`: will have the raw module as default export\n * * `true`: will have the default property as default export\n */\nfunction interopEsm(\n raw: Exports,\n ns: EsmNamespaceObject,\n allowExportDefault?: boolean\n) {\n const bindings: EsmBindings = []\n let defaultLocation = -1\n for (\n let current = raw;\n (typeof current === 'object' || typeof current === 'function') &&\n !LEAF_PROTOTYPES.includes(current);\n current = getProto(current)\n ) {\n for (const key of Object.getOwnPropertyNames(current)) {\n bindings.push(key, createGetter(raw, key))\n if (defaultLocation === -1 && key === 'default') {\n defaultLocation = bindings.length - 1\n }\n }\n }\n\n // this is not really correct\n // we should set the `default` getter if the imported module is a `.cjs file`\n if (!(allowExportDefault && defaultLocation >= 0)) {\n // Replace the binding with one for the namespace itself in order to preserve iteration order.\n if (defaultLocation >= 0) {\n // Replace the getter with the value\n bindings.splice(defaultLocation, 1, BindingTag_Value, raw)\n } else {\n bindings.push('default', BindingTag_Value, raw)\n }\n }\n\n esm(ns, bindings)\n return ns\n}\n\nfunction createNS(raw: Module['exports']): EsmNamespaceObject {\n if (typeof raw === 'function') {\n return function (this: any, ...args: any[]) {\n return raw.apply(this, args)\n }\n } else {\n return Object.create(null)\n }\n}\n\nfunction esmImport(\n this: TurbopackBaseContext,\n id: ModuleId\n): Exclude {\n const module = getOrInstantiateModuleFromParent(id, this.m)\n\n // any ES module has to have `module.namespaceObject` defined.\n if (module.namespaceObject) return module.namespaceObject\n\n // only ESM can be an async module, so we don't need to worry about exports being a promise here.\n const raw = module.exports\n return (module.namespaceObject = interopEsm(\n raw,\n createNS(raw),\n raw && (raw as any).__esModule\n ))\n}\ncontextPrototype.i = esmImport\n\nfunction asyncLoader(\n this: TurbopackBaseContext,\n moduleId: ModuleId\n): Promise {\n const loader = this.r(moduleId) as (\n importFunction: EsmImport\n ) => Promise\n return loader(esmImport.bind(this))\n}\ncontextPrototype.A = asyncLoader\n\n// Add a simple runtime require so that environments without one can still pass\n// `typeof require` CommonJS checks so that exports are correctly registered.\nconst runtimeRequire =\n // @ts-ignore\n typeof require === 'function'\n ? // @ts-ignore\n require\n : function require() {\n throw new Error('Unexpected use of runtime require')\n }\ncontextPrototype.t = runtimeRequire\n\nfunction commonJsRequire(\n this: TurbopackBaseContext,\n id: ModuleId\n): Exports {\n return getOrInstantiateModuleFromParent(id, this.m).exports\n}\ncontextPrototype.r = commonJsRequire\n\n/**\n * Remove fragments and query parameters since they are never part of the context map keys\n *\n * This matches how we parse patterns at resolving time. Arguably we should only do this for\n * strings passed to `import` but the resolve does it for `import` and `require` and so we do\n * here as well.\n */\nfunction parseRequest(request: string): string {\n // Per the URI spec fragments can contain `?` characters, so we should trim it off first\n // https://datatracker.ietf.org/doc/html/rfc3986#section-3.5\n const hashIndex = request.indexOf('#')\n if (hashIndex !== -1) {\n request = request.substring(0, hashIndex)\n }\n\n const queryIndex = request.indexOf('?')\n if (queryIndex !== -1) {\n request = request.substring(0, queryIndex)\n }\n\n return request\n}\n/**\n * `require.context` and require/import expression runtime.\n */\nfunction moduleContext(map: ModuleContextMap): ModuleContext {\n function moduleContext(id: string): Exports {\n id = parseRequest(id)\n if (hasOwnProperty.call(map, id)) {\n return map[id].module()\n }\n\n const e = new Error(`Cannot find module '${id}'`)\n ;(e as any).code = 'MODULE_NOT_FOUND'\n throw e\n }\n\n moduleContext.keys = (): string[] => {\n return Object.keys(map)\n }\n\n moduleContext.resolve = (id: string): ModuleId => {\n id = parseRequest(id)\n if (hasOwnProperty.call(map, id)) {\n return map[id].id()\n }\n\n const e = new Error(`Cannot find module '${id}'`)\n ;(e as any).code = 'MODULE_NOT_FOUND'\n throw e\n }\n\n moduleContext.import = async (id: string) => {\n return await (moduleContext(id) as Promise)\n }\n\n return moduleContext\n}\ncontextPrototype.f = moduleContext\n\n/**\n * Returns the path of a chunk defined by its data.\n */\nfunction getChunkPath(chunkData: ChunkData): ChunkPath {\n return typeof chunkData === 'string' ? chunkData : chunkData.path\n}\n\nfunction isPromise(maybePromise: any): maybePromise is Promise {\n return (\n maybePromise != null &&\n typeof maybePromise === 'object' &&\n 'then' in maybePromise &&\n typeof maybePromise.then === 'function'\n )\n}\n\nfunction isAsyncModuleExt(obj: T): obj is AsyncModuleExt & T {\n return turbopackQueues in obj\n}\n\nfunction createPromise() {\n let resolve: (value: T | PromiseLike) => void\n let reject: (reason?: any) => void\n\n const promise = new Promise((res, rej) => {\n reject = rej\n resolve = res\n })\n\n return {\n promise,\n resolve: resolve!,\n reject: reject!,\n }\n}\n\n// Load the CompressedmoduleFactories of a chunk into the `moduleFactories` Map.\n// The CompressedModuleFactories format is\n// - 1 or more module ids\n// - a module factory function\n// So walking this is a little complex but the flat structure is also fast to\n// traverse, we can use `typeof` operators to distinguish the two cases.\nfunction installCompressedModuleFactories(\n chunkModules: CompressedModuleFactories,\n offset: number,\n moduleFactories: ModuleFactories,\n newModuleId?: (id: ModuleId) => void\n) {\n let i = offset\n while (i < chunkModules.length) {\n let moduleId = chunkModules[i] as ModuleId\n let end = i + 1\n // Find our factory function\n while (\n end < chunkModules.length &&\n typeof chunkModules[end] !== 'function'\n ) {\n end++\n }\n if (end === chunkModules.length) {\n throw new Error('malformed chunk format, expected a factory function')\n }\n // Each chunk item has a 'primary id' and optional additional ids. If the primary id is already\n // present we know all the additional ids are also present, so we don't need to check.\n if (!moduleFactories.has(moduleId)) {\n const moduleFactoryFn = chunkModules[end] as Function\n applyModuleFactoryName(moduleFactoryFn)\n newModuleId?.(moduleId)\n for (; i < end; i++) {\n moduleId = chunkModules[i] as ModuleId\n moduleFactories.set(moduleId, moduleFactoryFn)\n }\n }\n i = end + 1 // end is pointing at the last factory advance to the next id or the end of the array.\n }\n}\n\n// everything below is adapted from webpack\n// https://github.com/webpack/webpack/blob/6be4065ade1e252c1d8dcba4af0f43e32af1bdc1/lib/runtime/AsyncModuleRuntimeModule.js#L13\n\nconst turbopackQueues = Symbol('turbopack queues')\nconst turbopackExports = Symbol('turbopack exports')\nconst turbopackError = Symbol('turbopack error')\n\nconst enum QueueStatus {\n Unknown = -1,\n Unresolved = 0,\n Resolved = 1,\n}\n\ntype AsyncQueueFn = (() => void) & { queueCount: number }\ntype AsyncQueue = AsyncQueueFn[] & {\n status: QueueStatus\n}\n\nfunction resolveQueue(queue?: AsyncQueue) {\n if (queue && queue.status !== QueueStatus.Resolved) {\n queue.status = QueueStatus.Resolved\n queue.forEach((fn) => fn.queueCount--)\n queue.forEach((fn) => (fn.queueCount-- ? fn.queueCount++ : fn()))\n }\n}\n\ntype Dep = Exports | AsyncModulePromise | Promise\n\ntype AsyncModuleExt = {\n [turbopackQueues]: (fn: (queue: AsyncQueue) => void) => void\n [turbopackExports]: Exports\n [turbopackError]?: any\n}\n\ntype AsyncModulePromise = Promise & AsyncModuleExt\n\nfunction wrapDeps(deps: Dep[]): AsyncModuleExt[] {\n return deps.map((dep): AsyncModuleExt => {\n if (dep !== null && typeof dep === 'object') {\n if (isAsyncModuleExt(dep)) return dep\n if (isPromise(dep)) {\n const queue: AsyncQueue = Object.assign([], {\n status: QueueStatus.Unresolved,\n })\n\n const obj: AsyncModuleExt = {\n [turbopackExports]: {},\n [turbopackQueues]: (fn: (queue: AsyncQueue) => void) => fn(queue),\n }\n\n dep.then(\n (res) => {\n obj[turbopackExports] = res\n resolveQueue(queue)\n },\n (err) => {\n obj[turbopackError] = err\n resolveQueue(queue)\n }\n )\n\n return obj\n }\n }\n\n return {\n [turbopackExports]: dep,\n [turbopackQueues]: () => {},\n }\n })\n}\n\nfunction asyncModule(\n this: TurbopackBaseContext,\n body: (\n handleAsyncDependencies: (\n deps: Dep[]\n ) => Exports[] | Promise<() => Exports[]>,\n asyncResult: (err?: any) => void\n ) => void,\n hasAwait: boolean\n) {\n const module = this.m\n const queue: AsyncQueue | undefined = hasAwait\n ? Object.assign([], { status: QueueStatus.Unknown })\n : undefined\n\n const depQueues: Set = new Set()\n\n const { resolve, reject, promise: rawPromise } = createPromise()\n\n const promise: AsyncModulePromise = Object.assign(rawPromise, {\n [turbopackExports]: module.exports,\n [turbopackQueues]: (fn) => {\n queue && fn(queue)\n depQueues.forEach(fn)\n promise['catch'](() => {})\n },\n } satisfies AsyncModuleExt)\n\n const attributes: PropertyDescriptor = {\n get(): any {\n return promise\n },\n set(v: any) {\n // Calling `esmExport` leads to this.\n if (v !== promise) {\n promise[turbopackExports] = v\n }\n },\n }\n\n Object.defineProperty(module, 'exports', attributes)\n Object.defineProperty(module, 'namespaceObject', attributes)\n\n function handleAsyncDependencies(deps: Dep[]) {\n const currentDeps = wrapDeps(deps)\n\n const getResult = () =>\n currentDeps.map((d) => {\n if (d[turbopackError]) throw d[turbopackError]\n return d[turbopackExports]\n })\n\n const { promise, resolve } = createPromise<() => Exports[]>()\n\n const fn: AsyncQueueFn = Object.assign(() => resolve(getResult), {\n queueCount: 0,\n })\n\n function fnQueue(q: AsyncQueue) {\n if (q !== queue && !depQueues.has(q)) {\n depQueues.add(q)\n if (q && q.status === QueueStatus.Unresolved) {\n fn.queueCount++\n q.push(fn)\n }\n }\n }\n\n currentDeps.map((dep) => dep[turbopackQueues](fnQueue))\n\n return fn.queueCount ? promise : getResult()\n }\n\n function asyncResult(err?: any) {\n if (err) {\n reject((promise[turbopackError] = err))\n } else {\n resolve(promise[turbopackExports])\n }\n\n resolveQueue(queue)\n }\n\n body(handleAsyncDependencies, asyncResult)\n\n if (queue && queue.status === QueueStatus.Unknown) {\n queue.status = QueueStatus.Unresolved\n }\n}\ncontextPrototype.a = asyncModule\n\n/**\n * A pseudo \"fake\" URL object to resolve to its relative path.\n *\n * When UrlRewriteBehavior is set to relative, calls to the `new URL()` will construct url without base using this\n * runtime function to generate context-agnostic urls between different rendering context, i.e ssr / client to avoid\n * hydration mismatch.\n *\n * This is based on webpack's existing implementation:\n * https://github.com/webpack/webpack/blob/87660921808566ef3b8796f8df61bd79fc026108/lib/runtime/RelativeUrlRuntimeModule.js\n */\nconst relativeURL = function relativeURL(this: any, inputUrl: string) {\n const realUrl = new URL(inputUrl, 'x:/')\n const values: Record = {}\n for (const key in realUrl) values[key] = (realUrl as any)[key]\n values.href = inputUrl\n values.pathname = inputUrl.replace(/[?#].*/, '')\n values.origin = values.protocol = ''\n values.toString = values.toJSON = (..._args: Array) => inputUrl\n for (const key in values)\n Object.defineProperty(this, key, {\n enumerable: true,\n configurable: true,\n value: values[key],\n })\n}\nrelativeURL.prototype = URL.prototype\ncontextPrototype.U = relativeURL\n\n/**\n * Utility function to ensure all variants of an enum are handled.\n */\nfunction invariant(never: never, computeMessage: (arg: any) => string): never {\n throw new Error(`Invariant: ${computeMessage(never)}`)\n}\n\n/**\n * A stub function to make `require` available but non-functional in ESM.\n */\nfunction requireStub(_moduleId: ModuleId): never {\n throw new Error('dynamic usage of require is not supported')\n}\ncontextPrototype.z = requireStub\n\n// Make `globalThis` available to the module in a way that cannot be shadowed by a local variable.\ncontextPrototype.g = globalThis\n\ntype ContextConstructor = {\n new (module: Module, exports: Exports): TurbopackBaseContext\n}\n\nfunction applyModuleFactoryName(factory: Function) {\n // Give the module factory a nice name to improve stack traces.\n Object.defineProperty(factory, 'name', {\n value: 'module evaluation',\n })\n}\n"],"names":["REEXPORTED_OBJECTS","WeakMap","Context","module","exports","m","e","contextPrototype","prototype","hasOwnProperty","Object","toStringTag","Symbol","defineProp","obj","name","options","call","defineProperty","getOverwrittenModule","moduleCache","id","createModuleObject","error","undefined","namespaceObject","BindingTag_Value","esm","bindings","value","i","length","propName","tagOrFunction","enumerable","writable","Error","getterFn","setterFn","get","set","seal","esmExport","c","s","ensureDynamicExports","reexportedObjects","Proxy","target","prop","Reflect","ownKeys","keys","key","includes","push","dynamicExport","object","j","exportValue","v","exportNamespace","namespace","n","createGetter","getProto","getPrototypeOf","__proto__","LEAF_PROTOTYPES","interopEsm","raw","ns","allowExportDefault","defaultLocation","current","getOwnPropertyNames","splice","createNS","args","apply","create","esmImport","getOrInstantiateModuleFromParent","__esModule","asyncLoader","moduleId","loader","r","bind","A","runtimeRequire","require","require1","t","commonJsRequire","parseRequest","request","hashIndex","indexOf","substring","queryIndex","moduleContext","map","code","resolve","import","f","getChunkPath","chunkData","path","isPromise","maybePromise","then","isAsyncModuleExt","turbopackQueues","createPromise","reject","promise","Promise","res","rej","installCompressedModuleFactories","chunkModules","offset","moduleFactories","newModuleId","end","has","moduleFactoryFn","applyModuleFactoryName","turbopackExports","turbopackError","resolveQueue","queue","status","forEach","fn","queueCount","wrapDeps","deps","dep","assign","err","asyncModule","body","hasAwait","depQueues","Set","rawPromise","attributes","handleAsyncDependencies","currentDeps","getResult","d","fnQueue","q","add","asyncResult","a","relativeURL","inputUrl","realUrl","URL","values","href","pathname","replace","origin","protocol","toString","toJSON","_args","configurable","U","invariant","never","computeMessage","requireStub","_moduleId","z","g","globalThis","factory"],"mappings":"AAAA;;;;;CAKC,GAED,oDAAoD,GAEpD,6CAA6C;AAU7C,MAAMA,qBAAqB,IAAIC;AAE/B;;CAEC,GACD,SAASC,QAEPC,MAAc,EACdC,OAAgB;IAEhB,IAAI,CAACC,CAAC,GAAGF;IACT,gFAAgF;IAChF,yEAAyE;IACzE,+CAA+C;IAC/C,8EAA8E;IAC9E,sEAAsE;IACtE,iBAAiB;IACjB,4FAA4F;IAC5F,IAAI,CAACG,CAAC,GAAGF;AACX;AACA,MAAMG,mBAAmBL,QAAQM,SAAS;AA+B1C,MAAMC,iBAAiBC,OAAOF,SAAS,CAACC,cAAc;AACtD,MAAME,cAAc,OAAOC,WAAW,eAAeA,OAAOD,WAAW;AA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U;IAC7CH,OAAOI,MAAM,GAAGJ,OAAOK,QAAQ,GAAG;IAClCL,OAAOM,QAAQ,GAAGN,OAAOO,MAAM,GAAG,CAAC,GAAGC,QAAsBX;IAC5D,IAAK,MAAM3G,OAAO8G,OAChBzJ,OAAOQ,cAAc,CAAC,IAAI,EAAEmC,KAAK;QAC/BnB,YAAY;QACZ0I,cAAc;QACd/I,OAAOsI,MAAM,CAAC9G,IAAI;IACpB;AACJ;AACA0G,YAAYvJ,SAAS,GAAG0J,IAAI1J,SAAS;AACrCD,iBAAiBsK,CAAC,GAAGd;AAErB;;CAEC,GACD,SAASe,UAAUC,KAAY,EAAEC,cAAoC;IACnE,MAAM,IAAI5I,MAAM,CAAC,WAAW,EAAE4I,eAAeD,QAAQ;AACvD;AAEA;;CAEC,GACD,SAASE,YAAYC,SAAmB;IACtC,MAAM,IAAI9I,MAAM;AAClB;AACA7B,iBAAiB4K,CAAC,GAAGF;AAErB,kGAAkG;AAClG1K,iBAAiB6K,CAAC,GAAGC;AAMrB,SAASpD,uBAAuBqD,OAAiB;IAC/C,+DAA+D;IAC/D5K,OAAOQ,cAAc,CAACoK,SAAS,QAAQ;QACrCzJ,OAAO;IACT;AACF","ignoreList":[0]}}, - {"offset": {"line": 515, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/browser/runtime/base/runtime-base.ts"],"sourcesContent":["/**\n * This file contains runtime types and functions that are shared between all\n * Turbopack *browser* ECMAScript runtimes.\n *\n * It will be appended to the runtime code of each runtime right after the\n * shared runtime utils.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n/// \n\n// Used in WebWorkers to tell the runtime about the chunk base path\ndeclare var TURBOPACK_WORKER_LOCATION: string\n// Used in WebWorkers to tell the runtime about the chunk suffix\ndeclare var TURBOPACK_CHUNK_SUFFIX: string\n// Used in WebWorkers to tell the runtime about the current chunk url since it can't be detected via document.currentScript\n// Note it's stored in reversed order to use push and pop\ndeclare var TURBOPACK_NEXT_CHUNK_URLS: ChunkUrl[] | undefined\n\n// Injected by rust code\ndeclare var CHUNK_BASE_PATH: string\ndeclare var CHUNK_SUFFIX: string\n\ninterface TurbopackBrowserBaseContext extends TurbopackBaseContext {\n R: ResolvePathFromModule\n}\n\nconst browserContextPrototype =\n Context.prototype as TurbopackBrowserBaseContext\n\n// Provided by build or dev base\ndeclare function instantiateModule(\n id: ModuleId,\n sourceType: SourceType,\n sourceData: SourceData\n): Module\n\ntype RuntimeParams = {\n otherChunks: ChunkData[]\n runtimeModuleIds: ModuleId[]\n}\n\ntype ChunkRegistration = [\n chunkPath: ChunkScript,\n ...([RuntimeParams] | CompressedModuleFactories),\n]\n\ntype ChunkList = {\n script: ChunkListScript\n chunks: ChunkData[]\n source: 'entry' | 'dynamic'\n}\n\nenum SourceType {\n /**\n * The module was instantiated because it was included in an evaluated chunk's\n * runtime.\n * SourceData is a ChunkPath.\n */\n Runtime = 0,\n /**\n * The module was instantiated because a parent module imported it.\n * SourceData is a ModuleId.\n */\n Parent = 1,\n /**\n * The module was instantiated because it was included in a chunk's hot module\n * update.\n * SourceData is an array of ModuleIds or undefined.\n */\n Update = 2,\n}\n\ntype SourceData = ChunkPath | ModuleId | ModuleId[] | undefined\ninterface RuntimeBackend {\n registerChunk: (chunkPath: ChunkPath, params?: RuntimeParams) => void\n /**\n * Returns the same Promise for the same chunk URL.\n */\n loadChunkCached: (sourceType: SourceType, chunkUrl: ChunkUrl) => Promise\n loadWebAssembly: (\n sourceType: SourceType,\n sourceData: SourceData,\n wasmChunkPath: ChunkPath,\n edgeModule: () => WebAssembly.Module,\n importsObj: WebAssembly.Imports\n ) => Promise\n loadWebAssemblyModule: (\n sourceType: SourceType,\n sourceData: SourceData,\n wasmChunkPath: ChunkPath,\n edgeModule: () => WebAssembly.Module\n ) => Promise\n}\n\ninterface DevRuntimeBackend {\n reloadChunk?: (chunkUrl: ChunkUrl) => Promise\n unloadChunk?: (chunkUrl: ChunkUrl) => void\n restart: () => void\n}\n\nconst moduleFactories: ModuleFactories = new Map()\ncontextPrototype.M = moduleFactories\n\nconst availableModules: Map | true> = new Map()\n\nconst availableModuleChunks: Map | true> = new Map()\n\nfunction factoryNotAvailableMessage(\n moduleId: ModuleId,\n sourceType: SourceType,\n sourceData: SourceData\n): string {\n let instantiationReason\n switch (sourceType) {\n case SourceType.Runtime:\n instantiationReason = `as a runtime entry of chunk ${sourceData}`\n break\n case SourceType.Parent:\n instantiationReason = `because it was required from module ${sourceData}`\n break\n case SourceType.Update:\n instantiationReason = 'because of an HMR update'\n break\n default:\n invariant(\n sourceType,\n (sourceType) => `Unknown source type: ${sourceType}`\n )\n }\n return `Module ${moduleId} was instantiated ${instantiationReason}, but the module factory is not available.`\n}\n\nfunction loadChunk(\n this: TurbopackBrowserBaseContext,\n chunkData: ChunkData\n): Promise {\n return loadChunkInternal(SourceType.Parent, this.m.id, chunkData)\n}\nbrowserContextPrototype.l = loadChunk\n\nfunction loadInitialChunk(chunkPath: ChunkPath, chunkData: ChunkData) {\n return loadChunkInternal(SourceType.Runtime, chunkPath, chunkData)\n}\n\nasync function loadChunkInternal(\n sourceType: SourceType,\n sourceData: SourceData,\n chunkData: ChunkData\n): Promise {\n if (typeof chunkData === 'string') {\n return loadChunkPath(sourceType, sourceData, chunkData)\n }\n\n const includedList = chunkData.included || []\n const modulesPromises = includedList.map((included) => {\n if (moduleFactories.has(included)) return true\n return availableModules.get(included)\n })\n if (modulesPromises.length > 0 && modulesPromises.every((p) => p)) {\n // When all included items are already loaded or loading, we can skip loading ourselves\n await Promise.all(modulesPromises)\n return\n }\n\n const includedModuleChunksList = chunkData.moduleChunks || []\n const moduleChunksPromises = includedModuleChunksList\n .map((included) => {\n // TODO(alexkirsz) Do we need this check?\n // if (moduleFactories[included]) return true;\n return availableModuleChunks.get(included)\n })\n .filter((p) => p)\n\n let promise: Promise\n if (moduleChunksPromises.length > 0) {\n // Some module chunks are already loaded or loading.\n\n if (moduleChunksPromises.length === includedModuleChunksList.length) {\n // When all included module chunks are already loaded or loading, we can skip loading ourselves\n await Promise.all(moduleChunksPromises)\n return\n }\n\n const moduleChunksToLoad: Set = new Set()\n for (const moduleChunk of includedModuleChunksList) {\n if (!availableModuleChunks.has(moduleChunk)) {\n moduleChunksToLoad.add(moduleChunk)\n }\n }\n\n for (const moduleChunkToLoad of moduleChunksToLoad) {\n const promise = loadChunkPath(sourceType, sourceData, moduleChunkToLoad)\n\n availableModuleChunks.set(moduleChunkToLoad, promise)\n\n moduleChunksPromises.push(promise)\n }\n\n promise = Promise.all(moduleChunksPromises)\n } else {\n promise = loadChunkPath(sourceType, sourceData, chunkData.path)\n\n // Mark all included module chunks as loading if they are not already loaded or loading.\n for (const includedModuleChunk of includedModuleChunksList) {\n if (!availableModuleChunks.has(includedModuleChunk)) {\n availableModuleChunks.set(includedModuleChunk, promise)\n }\n }\n }\n\n for (const included of includedList) {\n if (!availableModules.has(included)) {\n // It might be better to race old and new promises, but it's rare that the new promise will be faster than a request started earlier.\n // In production it's even more rare, because the chunk optimization tries to deduplicate modules anyway.\n availableModules.set(included, promise)\n }\n }\n\n await promise\n}\n\nconst loadedChunk = Promise.resolve(undefined)\nconst instrumentedBackendLoadChunks = new WeakMap<\n Promise,\n Promise | typeof loadedChunk\n>()\n// Do not make this async. React relies on referential equality of the returned Promise.\nfunction loadChunkByUrl(\n this: TurbopackBrowserBaseContext,\n chunkUrl: ChunkUrl\n) {\n return loadChunkByUrlInternal(SourceType.Parent, this.m.id, chunkUrl)\n}\nbrowserContextPrototype.L = loadChunkByUrl\n\n// Do not make this async. React relies on referential equality of the returned Promise.\nfunction loadChunkByUrlInternal(\n sourceType: SourceType,\n sourceData: SourceData,\n chunkUrl: ChunkUrl\n): Promise {\n const thenable = BACKEND.loadChunkCached(sourceType, chunkUrl)\n let entry = instrumentedBackendLoadChunks.get(thenable)\n if (entry === undefined) {\n const resolve = instrumentedBackendLoadChunks.set.bind(\n instrumentedBackendLoadChunks,\n thenable,\n loadedChunk\n )\n entry = thenable.then(resolve).catch((cause) => {\n let loadReason: string\n switch (sourceType) {\n case SourceType.Runtime:\n loadReason = `as a runtime dependency of chunk ${sourceData}`\n break\n case SourceType.Parent:\n loadReason = `from module ${sourceData}`\n break\n case SourceType.Update:\n loadReason = 'from an HMR update'\n break\n default:\n invariant(\n sourceType,\n (sourceType) => `Unknown source type: ${sourceType}`\n )\n }\n let error = new Error(\n `Failed to load chunk ${chunkUrl} ${loadReason}${\n cause ? `: ${cause}` : ''\n }`,\n cause ? { cause } : undefined\n )\n error.name = 'ChunkLoadError'\n throw error\n })\n instrumentedBackendLoadChunks.set(thenable, entry)\n }\n\n return entry\n}\n\n// Do not make this async. React relies on referential equality of the returned Promise.\nfunction loadChunkPath(\n sourceType: SourceType,\n sourceData: SourceData,\n chunkPath: ChunkPath\n): Promise {\n const url = getChunkRelativeUrl(chunkPath)\n return loadChunkByUrlInternal(sourceType, sourceData, url)\n}\n\n/**\n * Returns an absolute url to an asset.\n */\nfunction resolvePathFromModule(\n this: TurbopackBaseContext,\n moduleId: string\n): string {\n const exported = this.r(moduleId)\n return exported?.default ?? exported\n}\nbrowserContextPrototype.R = resolvePathFromModule\n\n/**\n * no-op for browser\n * @param modulePath\n */\nfunction resolveAbsolutePath(modulePath?: string): string {\n return `/ROOT/${modulePath ?? ''}`\n}\nbrowserContextPrototype.P = resolveAbsolutePath\n\n/**\n * Returns a blob URL for the worker.\n * @param chunks list of chunks to load\n */\nfunction getWorkerBlobURL(chunks: ChunkPath[]): string {\n // It is important to reverse the array so when bootstrapping we can infer what chunk is being\n // evaluated by poping urls off of this array. See `getPathFromScript`\n let bootstrap = `self.TURBOPACK_WORKER_LOCATION = ${JSON.stringify(location.origin)};\nself.TURBOPACK_CHUNK_SUFFIX = ${JSON.stringify(CHUNK_SUFFIX)};\nself.TURBOPACK_NEXT_CHUNK_URLS = ${JSON.stringify(chunks.reverse().map(getChunkRelativeUrl), null, 2)};\nimportScripts(...self.TURBOPACK_NEXT_CHUNK_URLS.map(c => self.TURBOPACK_WORKER_LOCATION + c).reverse());`\n let blob = new Blob([bootstrap], { type: 'text/javascript' })\n return URL.createObjectURL(blob)\n}\nbrowserContextPrototype.b = getWorkerBlobURL\n\n/**\n * Instantiates a runtime module.\n */\nfunction instantiateRuntimeModule(\n moduleId: ModuleId,\n chunkPath: ChunkPath\n): Module {\n return instantiateModule(moduleId, SourceType.Runtime, chunkPath)\n}\n/**\n * Returns the URL relative to the origin where a chunk can be fetched from.\n */\nfunction getChunkRelativeUrl(chunkPath: ChunkPath | ChunkListPath): ChunkUrl {\n return `${CHUNK_BASE_PATH}${chunkPath\n .split('/')\n .map((p) => encodeURIComponent(p))\n .join('/')}${CHUNK_SUFFIX}` as ChunkUrl\n}\n\n/**\n * Return the ChunkPath from a ChunkScript.\n */\nfunction getPathFromScript(chunkScript: ChunkPath | ChunkScript): ChunkPath\nfunction getPathFromScript(\n chunkScript: ChunkListPath | ChunkListScript\n): ChunkListPath\nfunction getPathFromScript(\n chunkScript: ChunkPath | ChunkListPath | ChunkScript | ChunkListScript\n): ChunkPath | ChunkListPath {\n if (typeof chunkScript === 'string') {\n return chunkScript as ChunkPath | ChunkListPath\n }\n const chunkUrl =\n typeof TURBOPACK_NEXT_CHUNK_URLS !== 'undefined'\n ? TURBOPACK_NEXT_CHUNK_URLS.pop()!\n : chunkScript.getAttribute('src')!\n const src = decodeURIComponent(chunkUrl.replace(/[?#].*$/, ''))\n const path = src.startsWith(CHUNK_BASE_PATH)\n ? src.slice(CHUNK_BASE_PATH.length)\n : src\n return path as ChunkPath | ChunkListPath\n}\n\nconst regexJsUrl = /\\.js(?:\\?[^#]*)?(?:#.*)?$/\n/**\n * Checks if a given path/URL ends with .js, optionally followed by ?query or #fragment.\n */\nfunction isJs(chunkUrlOrPath: ChunkUrl | ChunkPath): boolean {\n return regexJsUrl.test(chunkUrlOrPath)\n}\n\nconst regexCssUrl = /\\.css(?:\\?[^#]*)?(?:#.*)?$/\n/**\n * Checks if a given path/URL ends with .css, optionally followed by ?query or #fragment.\n */\nfunction isCss(chunkUrl: ChunkUrl): boolean {\n return regexCssUrl.test(chunkUrl)\n}\n\nfunction loadWebAssembly(\n this: TurbopackBaseContext,\n chunkPath: ChunkPath,\n edgeModule: () => WebAssembly.Module,\n importsObj: WebAssembly.Imports\n): Promise {\n return BACKEND.loadWebAssembly(\n SourceType.Parent,\n this.m.id,\n chunkPath,\n edgeModule,\n importsObj\n )\n}\ncontextPrototype.w = loadWebAssembly\n\nfunction loadWebAssemblyModule(\n this: TurbopackBaseContext,\n chunkPath: ChunkPath,\n edgeModule: () => WebAssembly.Module\n): Promise {\n return BACKEND.loadWebAssemblyModule(\n SourceType.Parent,\n this.m.id,\n chunkPath,\n edgeModule\n )\n}\ncontextPrototype.u = loadWebAssemblyModule\n"],"names":["browserContextPrototype","Context","prototype","SourceType","moduleFactories","Map","contextPrototype","M","availableModules","availableModuleChunks","factoryNotAvailableMessage","moduleId","sourceType","sourceData","instantiationReason","invariant","loadChunk","chunkData","loadChunkInternal","m","id","l","loadInitialChunk","chunkPath","loadChunkPath","includedList","included","modulesPromises","map","has","get","length","every","p","Promise","all","includedModuleChunksList","moduleChunks","moduleChunksPromises","filter","promise","moduleChunksToLoad","Set","moduleChunk","add","moduleChunkToLoad","set","push","path","includedModuleChunk","loadedChunk","resolve","undefined","instrumentedBackendLoadChunks","WeakMap","loadChunkByUrl","chunkUrl","loadChunkByUrlInternal","L","thenable","BACKEND","loadChunkCached","entry","bind","then","catch","cause","loadReason","error","Error","name","url","getChunkRelativeUrl","resolvePathFromModule","exported","r","default","R","resolveAbsolutePath","modulePath","P","getWorkerBlobURL","chunks","bootstrap","JSON","stringify","location","origin","CHUNK_SUFFIX","reverse","blob","Blob","type","URL","createObjectURL","b","instantiateRuntimeModule","instantiateModule","CHUNK_BASE_PATH","split","encodeURIComponent","join","getPathFromScript","chunkScript","TURBOPACK_NEXT_CHUNK_URLS","pop","getAttribute","src","decodeURIComponent","replace","startsWith","slice","regexJsUrl","isJs","chunkUrlOrPath","test","regexCssUrl","isCss","loadWebAssembly","edgeModule","importsObj","w","loadWebAssemblyModule","u"],"mappings":"AAAA;;;;;;CAMC,GAED,oDAAoD,GAEpD,6CAA6C;AAC7C,yDAAyD;AAEzD,mEAAmE;AAgBnE,MAAMA,0BACJC,QAAQC,SAAS;AAyBnB,IAAA,AAAKC,oCAAAA;IACH;;;;GAIC;IAED;;;GAGC;IAED;;;;GAIC;WAhBEA;EAAAA;AAgDL,MAAMC,kBAAmC,IAAIC;AAC7CC,iBAAiBC,CAAC,GAAGH;AAErB,MAAMI,mBAAuD,IAAIH;AAEjE,MAAMI,wBAA6D,IAAIJ;AAEvE,SAASK,2BACPC,QAAkB,EAClBC,UAAsB,EACtBC,UAAsB;IAEtB,IAAIC;IACJ,OAAQF;QACN;YACEE,sBAAsB,CAAC,4BAA4B,EAAED,YAAY;YACjE;QACF;YACEC,sBAAsB,CAAC,oCAAoC,EAAED,YAAY;YACzE;QACF;YACEC,sBAAsB;YACtB;QACF;YACEC,UACEH,YACA,CAACA,aAAe,CAAC,qBAAqB,EAAEA,YAAY;IAE1D;IACA,OAAO,CAAC,OAAO,EAAED,SAAS,kBAAkB,EAAEG,oBAAoB,0CAA0C,CAAC;AAC/G;AAEA,SAASE,UAEPC,SAAoB;IAEpB,OAAOC,qBAAqC,IAAI,CAACC,CAAC,CAACC,EAAE,EAAEH;AACzD;AACAjB,wBAAwBqB,CAAC,GAAGL;AAE5B,SAASM,iBAAiBC,SAAoB,EAAEN,SAAoB;IAClE,OAAOC,qBAAsCK,WAAWN;AAC1D;AAEA,eAAeC,kBACbN,UAAsB,EACtBC,UAAsB,EACtBI,SAAoB;IAEpB,IAAI,OAAOA,cAAc,UAAU;QACjC,OAAOO,cAAcZ,YAAYC,YAAYI;IAC/C;IAEA,MAAMQ,eAAeR,UAAUS,QAAQ,IAAI,EAAE;IAC7C,MAAMC,kBAAkBF,aAAaG,GAAG,CAAC,CAACF;QACxC,IAAItB,gBAAgByB,GAAG,CAACH,WAA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Y,CAAC;IAC/B,MAAMC,MAAMC,mBAAmBpD,SAASqD,OAAO,CAAC,WAAW;IAC3D,MAAM7D,OAAO2D,IAAIG,UAAU,CAACZ,mBACxBS,IAAII,KAAK,CAACb,gBAAgBnE,MAAM,IAChC4E;IACJ,OAAO3D;AACT;AAEA,MAAMgE,aAAa;AACnB;;CAEC,GACD,SAASC,KAAKC,cAAoC;IAChD,OAAOF,WAAWG,IAAI,CAACD;AACzB;AAEA,MAAME,cAAc;AACpB;;CAEC,GACD,SAASC,MAAM7D,QAAkB;IAC/B,OAAO4D,YAAYD,IAAI,CAAC3D;AAC1B;AAEA,SAAS8D,gBAEP/F,SAAoB,EACpBgG,UAAoC,EACpCC,UAA+B;IAE/B,OAAO5D,QAAQ0D,eAAe,IAE5B,IAAI,CAACnG,CAAC,CAACC,EAAE,EACTG,WACAgG,YACAC;AAEJ;AACAlH,iBAAiBmH,CAAC,GAAGH;AAErB,SAASI,sBAEPnG,SAAoB,EACpBgG,UAAoC;IAEpC,OAAO3D,QAAQ8D,qBAAqB,IAElC,IAAI,CAACvG,CAAC,CAACC,EAAE,EACTG,WACAgG;AAEJ;AACAjH,iBAAiBqH,CAAC,GAAGD","ignoreList":[0]}}, - {"offset": {"line": 742, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/browser/runtime/base/dev-base.ts"],"sourcesContent":["/// \n/// \n/// \n\ninterface TurbopackDevContext extends TurbopackBrowserBaseContext {\n k: RefreshContext\n}\n\nconst devContextPrototype = Context.prototype as TurbopackDevContext\n\n/**\n * This file contains runtime types and functions that are shared between all\n * Turbopack *development* ECMAScript runtimes.\n *\n * It will be appended to the runtime code of each runtime right after the\n * shared runtime utils.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\nconst devModuleCache: ModuleCache = Object.create(null)\ndevContextPrototype.c = devModuleCache\n\n// This file must not use `import` and `export` statements. Otherwise, it\n// becomes impossible to augment interfaces declared in ``d files\n// (e.g. `Module`). Hence, the need for `import()` here.\ntype RefreshRuntimeGlobals =\n import('@next/react-refresh-utils/dist/runtime').RefreshRuntimeGlobals\n\ndeclare var $RefreshHelpers$: RefreshRuntimeGlobals['$RefreshHelpers$']\ndeclare var $RefreshReg$: RefreshRuntimeGlobals['$RefreshReg$']\ndeclare var $RefreshSig$: RefreshRuntimeGlobals['$RefreshSig$']\ndeclare var $RefreshInterceptModuleExecution$: RefreshRuntimeGlobals['$RefreshInterceptModuleExecution$']\n\ntype RefreshContext = {\n register: RefreshRuntimeGlobals['$RefreshReg$']\n signature: RefreshRuntimeGlobals['$RefreshSig$']\n registerExports: typeof registerExportsAndSetupBoundaryForReactRefresh\n}\n\ntype RefreshHelpers = RefreshRuntimeGlobals['$RefreshHelpers$']\n\ntype ModuleFactory = (\n this: Module['exports'],\n context: TurbopackDevContext\n) => unknown\n\ninterface DevRuntimeBackend {\n reloadChunk?: (chunkUrl: ChunkUrl) => Promise\n unloadChunk?: (chunkUrl: ChunkUrl) => void\n restart: () => void\n}\n\nclass UpdateApplyError extends Error {\n name = 'UpdateApplyError'\n\n dependencyChain: ModuleId[]\n\n constructor(message: string, dependencyChain: ModuleId[]) {\n super(message)\n this.dependencyChain = dependencyChain\n }\n}\n\n/**\n * Module IDs that are instantiated as part of the runtime of a chunk.\n */\nconst runtimeModules: Set = new Set()\n\n/**\n * Map from module ID to the chunks that contain this module.\n *\n * In HMR, we need to keep track of which modules are contained in which so\n * chunks. This is so we don't eagerly dispose of a module when it is removed\n * from chunk A, but still exists in chunk B.\n */\nconst moduleChunksMap: Map> = new Map()\n/**\n * Map from a chunk path to all modules it contains.\n */\nconst chunkModulesMap: Map> = new Map()\n/**\n * Chunk lists that contain a runtime. When these chunk lists receive an update\n * that can't be reconciled with the current state of the page, we need to\n * reload the runtime entirely.\n */\nconst runtimeChunkLists: Set = new Set()\n/**\n * Map from a chunk list to the chunk paths it contains.\n */\nconst chunkListChunksMap: Map> = new Map()\n/**\n * Map from a chunk path to the chunk lists it belongs to.\n */\nconst chunkChunkListsMap: Map> = new Map()\n\n/**\n * Maps module IDs to persisted data between executions of their hot module\n * implementation (`hot.data`).\n */\nconst moduleHotData: Map = new Map()\n/**\n * Maps module instances to their hot module state.\n */\nconst moduleHotState: Map = new Map()\n/**\n * Modules that call `module.hot.invalidate()` (while being updated).\n */\nconst queuedInvalidatedModules: Set = new Set()\n\n/**\n * Gets or instantiates a runtime module.\n */\n// @ts-ignore\nfunction getOrInstantiateRuntimeModule(\n chunkPath: ChunkPath,\n moduleId: ModuleId\n): Module {\n const module = devModuleCache[moduleId]\n if (module) {\n if (module.error) {\n throw module.error\n }\n return module\n }\n\n // @ts-ignore\n return instantiateModule(moduleId, SourceType.Runtime, chunkPath)\n}\n\n/**\n * Retrieves a module from the cache, or instantiate it if it is not cached.\n */\n// @ts-ignore Defined in `runtime-utils.ts`\nconst getOrInstantiateModuleFromParent: GetOrInstantiateModuleFromParent<\n HotModule\n> = (id, sourceModule) => {\n if (!sourceModule.hot.active) {\n console.warn(\n `Unexpected import of module ${id} from module ${sourceModule.id}, which was deleted by an HMR update`\n )\n }\n\n const module = devModuleCache[id]\n\n if (sourceModule.children.indexOf(id) === -1) {\n sourceModule.children.push(id)\n }\n\n if (module) {\n if (module.error) {\n throw module.error\n }\n\n if (module.parents.indexOf(sourceModule.id) === -1) {\n module.parents.push(sourceModule.id)\n }\n\n return module\n }\n\n return instantiateModule(id, SourceType.Parent, sourceModule.id)\n}\n\nfunction DevContext(\n this: TurbopackDevContext,\n module: HotModule,\n exports: Exports,\n refresh: RefreshContext\n) {\n Context.call(this, module, exports)\n this.k = refresh\n}\nDevContext.prototype = Context.prototype\n\ntype DevContextConstructor = {\n new (\n module: HotModule,\n exports: Exports,\n refresh: RefreshContext\n ): TurbopackDevContext\n}\n\nfunction instantiateModule(\n moduleId: ModuleId,\n sourceType: SourceType,\n sourceData: SourceData\n): Module {\n // We are in development, this is always a string.\n let id = moduleId as string\n\n const moduleFactory = moduleFactories.get(id)\n if (typeof moduleFactory !== 'function') {\n // This can happen if modules incorrectly handle HMR disposes/updates,\n // e.g. when they keep a `setTimeout` around which still executes old code\n // and contains e.g. a `require(\"something\")` call.\n throw new Error(\n factoryNotAvailableMessage(id, sourceType, sourceData) +\n ' It might have been deleted in an HMR update.'\n )\n }\n\n const hotData = moduleHotData.get(id)!\n const { hot, hotState } = createModuleHot(id, hotData)\n\n let parents: ModuleId[]\n switch (sourceType) {\n case SourceType.Runtime:\n runtimeModules.add(id)\n parents = []\n break\n case SourceType.Parent:\n // No need to add this module as a child of the parent module here, this\n // has already been taken care of in `getOrInstantiateModuleFromParent`.\n parents = [sourceData as ModuleId]\n break\n case SourceType.Update:\n parents = (sourceData as ModuleId[]) || []\n break\n default:\n invariant(\n sourceType,\n (sourceType) => `Unknown source type: ${sourceType}`\n )\n }\n\n const module: HotModule = createModuleObject(id) as HotModule\n const exports = module.exports\n module.parents = parents\n module.children = []\n module.hot = hot\n\n devModuleCache[id] = module\n moduleHotState.set(module, hotState)\n\n // NOTE(alexkirsz) This can fail when the module encounters a runtime error.\n try {\n runModuleExecutionHooks(module, (refresh) => {\n const context = new (DevContext as any as DevContextConstructor)(\n module,\n exports,\n refresh\n )\n moduleFactory(context, module, exports)\n })\n } catch (error) {\n module.error = error as any\n throw error\n }\n\n if (module.namespaceObject && module.exports !== module.namespaceObject) {\n // in case of a circular dependency: cjs1 -> esm2 -> cjs1\n interopEsm(module.exports, module.namespaceObject)\n }\n\n return module\n}\n\nconst DUMMY_REFRESH_CONTEXT = {\n register: (_type: unknown, _id: unknown) => {},\n signature: () => (_type: unknown) => {},\n registerExports: (_module: unknown, _helpers: unknown) => {},\n}\n\n/**\n * NOTE(alexkirsz) Webpack has a \"module execution\" interception hook that\n * Next.js' React Refresh runtime hooks into to add module context to the\n * refresh registry.\n */\nfunction runModuleExecutionHooks(\n module: HotModule,\n executeModule: (ctx: RefreshContext) => void\n) {\n if (typeof globalThis.$RefreshInterceptModuleExecution$ === 'function') {\n const cleanupReactRefreshIntercept =\n globalThis.$RefreshInterceptModuleExecution$(module.id)\n try {\n executeModule({\n register: globalThis.$RefreshReg$,\n signature: globalThis.$RefreshSig$,\n registerExports: registerExportsAndSetupBoundaryForReactRefresh,\n })\n } finally {\n // Always cleanup the intercept, even if module execution failed.\n cleanupReactRefreshIntercept()\n }\n } else {\n // If the react refresh hooks are not installed we need to bind dummy functions.\n // This is expected when running in a Web Worker. It is also common in some of\n // our test environments.\n executeModule(DUMMY_REFRESH_CONTEXT)\n }\n}\n\n/**\n * This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts\n */\nfunction registerExportsAndSetupBoundaryForReactRefresh(\n module: HotModule,\n helpers: RefreshHelpers\n) {\n const currentExports = module.exports\n const prevExports = module.hot.data.prevExports ?? null\n\n helpers.registerExportsForReactRefresh(currentExports, module.id)\n\n // A module can be accepted automatically based on its exports, e.g. when\n // it is a Refresh Boundary.\n if (helpers.isReactRefreshBoundary(currentExports)) {\n // Save the previous exports on update, so we can compare the boundary\n // signatures.\n module.hot.dispose((data) => {\n data.prevExports = currentExports\n })\n // Unconditionally accept an update to this module, we'll check if it's\n // still a Refresh Boundary later.\n module.hot.accept()\n\n // This field is set when the previous version of this module was a\n // Refresh Boundary, letting us know we need to check for invalidation or\n // enqueue an update.\n if (prevExports !== null) {\n // A boundary can become ineligible if its exports are incompatible\n // with the previous exports.\n //\n // For example, if you add/remove/change exports, we'll want to\n // re-execute the importing modules, and force those components to\n // re-render. Similarly, if you convert a class component to a\n // function, we want to invalidate the boundary.\n if (\n helpers.shouldInvalidateReactRefreshBoundary(\n helpers.getRefreshBoundarySignature(prevExports),\n helpers.getRefreshBoundarySignature(currentExports)\n )\n ) {\n module.hot.invalidate()\n } else {\n helpers.scheduleUpdate()\n }\n }\n } else {\n // Since we just executed the code for the module, it's possible that the\n // new exports made it ineligible for being a boundary.\n // We only care about the case when we were _previously_ a boundary,\n // because we already accepted this update (accidental side effect).\n const isNoLongerABoundary = prevExports !== null\n if (isNoLongerABoundary) {\n module.hot.invalidate()\n }\n }\n}\n\nfunction formatDependencyChain(dependencyChain: ModuleId[]): string {\n return `Dependency chain: ${dependencyChain.join(' -> ')}`\n}\n\nfunction computeOutdatedModules(\n added: Map,\n modified: Map\n): {\n outdatedModules: Set\n newModuleFactories: Map\n} {\n const newModuleFactories = new Map()\n\n for (const [moduleId, entry] of added) {\n if (entry != null) {\n newModuleFactories.set(moduleId, _eval(entry))\n }\n }\n\n const outdatedModules = computedInvalidatedModules(modified.keys())\n\n for (const [moduleId, entry] of modified) {\n newModuleFactories.set(moduleId, _eval(entry))\n }\n\n return { outdatedModules, newModuleFactories }\n}\n\nfunction computedInvalidatedModules(\n invalidated: Iterable\n): Set {\n const outdatedModules = new Set()\n\n for (const moduleId of invalidated) {\n const effect = getAffectedModuleEffects(moduleId)\n\n switch (effect.type) {\n case 'unaccepted':\n throw new UpdateApplyError(\n `cannot apply update: unaccepted module. ${formatDependencyChain(\n effect.dependencyChain\n )}.`,\n effect.dependencyChain\n )\n case 'self-declined':\n throw new UpdateApplyError(\n `cannot apply update: self-declined module. ${formatDependencyChain(\n effect.dependencyChain\n )}.`,\n effect.dependencyChain\n )\n case 'accepted':\n for (const outdatedModuleId of effect.outdatedModules) {\n outdatedModules.add(outdatedModuleId)\n }\n break\n // TODO(alexkirsz) Dependencies: handle dependencies effects.\n default:\n invariant(effect, (effect) => `Unknown effect type: ${effect?.type}`)\n }\n }\n\n return outdatedModules\n}\n\nfunction computeOutdatedSelfAcceptedModules(\n outdatedModules: Iterable\n): { moduleId: ModuleId; errorHandler: true | Function }[] {\n const outdatedSelfAcceptedModules: {\n moduleId: ModuleId\n errorHandler: true | Function\n }[] = []\n for (const moduleId of outdatedModules) {\n const module = devModuleCache[moduleId]\n const hotState = moduleHotState.get(module)!\n if (module && hotState.selfAccepted && !hotState.selfInvalidated) {\n outdatedSelfAcceptedModules.push({\n moduleId,\n errorHandler: hotState.selfAccepted,\n })\n }\n }\n return outdatedSelfAcceptedModules\n}\n\n/**\n * Adds, deletes, and moves modules between chunks. This must happen before the\n * dispose phase as it needs to know which modules were removed from all chunks,\n * which we can only compute *after* taking care of added and moved modules.\n */\nfunction updateChunksPhase(\n chunksAddedModules: Map>,\n chunksDeletedModules: Map>\n): { disposedModules: Set } {\n for (const [chunkPath, addedModuleIds] of chunksAddedModules) {\n for (const moduleId of addedModuleIds) {\n addModuleToChunk(moduleId, chunkPath)\n }\n }\n\n const disposedModules: Set = new Set()\n for (const [chunkPath, addedModuleIds] of chunksDeletedModules) {\n for (const moduleId of addedModuleIds) {\n if (removeModuleFromChunk(moduleId, chunkPath)) {\n disposedModules.add(moduleId)\n }\n }\n }\n\n return { disposedModules }\n}\n\nfunction disposePhase(\n outdatedModules: Iterable,\n disposedModules: Iterable\n): { outdatedModuleParents: Map> } {\n for (const moduleId of outdatedModules) {\n disposeModule(moduleId, 'replace')\n }\n\n for (const moduleId of disposedModules) {\n disposeModule(moduleId, 'clear')\n }\n\n // Removing modules from the module cache is a separate step.\n // We also want to keep track of previous parents of the outdated modules.\n const outdatedModuleParents = new Map()\n for (const moduleId of outdatedModules) {\n const oldModule = devModuleCache[moduleId]\n outdatedModuleParents.set(moduleId, oldModule?.parents)\n delete devModuleCache[moduleId]\n }\n\n // TODO(alexkirsz) Dependencies: remove outdated dependency from module\n // children.\n\n return { outdatedModuleParents }\n}\n\n/**\n * Disposes of an instance of a module.\n *\n * Returns the persistent hot data that should be kept for the next module\n * instance.\n *\n * NOTE: mode = \"replace\" will not remove modules from the devModuleCache\n * This must be done in a separate step afterwards.\n * This is important because all modules need to be disposed to update the\n * parent/child relationships before they are actually removed from the devModuleCache.\n * If this was done in this method, the following disposeModule calls won't find\n * the module from the module id in the cache.\n */\nfunction disposeModule(moduleId: ModuleId, mode: 'clear' | 'replace') {\n const module = devModuleCache[moduleId]\n if (!module) {\n return\n }\n\n const hotState = moduleHotState.get(module)!\n const data = {}\n\n // Run the `hot.dispose` handler, if any, passing in the persistent\n // `hot.data` object.\n for (const disposeHandler of hotState.disposeHandlers) {\n disposeHandler(data)\n }\n\n // This used to warn in `getOrInstantiateModuleFromParent` when a disposed\n // module is still importing other modules.\n module.hot.active = false\n\n moduleHotState.delete(module)\n\n // TODO(alexkirsz) Dependencies: delete the module from outdated deps.\n\n // Remove the disposed module from its children's parent list.\n // It will be added back once the module re-instantiates and imports its\n // children again.\n for (const childId of module.children) {\n const child = devModuleCache[childId]\n if (!child) {\n continue\n }\n\n const idx = child.parents.indexOf(module.id)\n if (idx >= 0) {\n child.parents.splice(idx, 1)\n }\n }\n\n switch (mode) {\n case 'clear':\n delete devModuleCache[module.id]\n moduleHotData.delete(module.id)\n break\n case 'replace':\n moduleHotData.set(module.id, data)\n break\n default:\n invariant(mode, (mode) => `invalid mode: ${mode}`)\n }\n}\n\nfunction applyPhase(\n outdatedSelfAcceptedModules: {\n moduleId: ModuleId\n errorHandler: true | Function\n }[],\n newModuleFactories: Map,\n outdatedModuleParents: Map>,\n reportError: (err: any) => void\n) {\n // Update module factories.\n for (const [moduleId, factory] of newModuleFactories.entries()) {\n applyModuleFactoryName(factory)\n moduleFactories.set(moduleId, factory)\n }\n\n // TODO(alexkirsz) Run new runtime entries here.\n\n // TODO(alexkirsz) Dependencies: call accept handlers for outdated deps.\n\n // Re-instantiate all outdated self-accepted modules.\n for (const { moduleId, errorHandler } of outdatedSelfAcceptedModules) {\n try {\n instantiateModule(\n moduleId,\n SourceType.Update,\n outdatedModuleParents.get(moduleId)\n )\n } catch (err) {\n if (typeof errorHandler === 'function') {\n try {\n errorHandler(err, { moduleId, module: devModuleCache[moduleId] })\n } catch (err2) {\n reportError(err2)\n reportError(err)\n }\n } else {\n reportError(err)\n }\n }\n }\n}\n\nfunction applyUpdate(update: PartialUpdate) {\n switch (update.type) {\n case 'ChunkListUpdate':\n applyChunkListUpdate(update)\n break\n default:\n invariant(update, (update) => `Unknown update type: ${update.type}`)\n }\n}\n\nfunction applyChunkListUpdate(update: ChunkListUpdate) {\n if (update.merged != null) {\n for (const merged of update.merged) {\n switch (merged.type) {\n case 'EcmascriptMergedUpdate':\n applyEcmascriptMergedUpdate(merged)\n break\n default:\n invariant(merged, (merged) => `Unknown merged type: ${merged.type}`)\n }\n }\n }\n\n if (update.chunks != null) {\n for (const [chunkPath, chunkUpdate] of Object.entries(\n update.chunks\n ) as Array<[ChunkPath, ChunkUpdate]>) {\n const chunkUrl = getChunkRelativeUrl(chunkPath)\n\n switch (chunkUpdate.type) {\n case 'added':\n BACKEND.loadChunkCached(SourceType.Update, chunkUrl)\n break\n case 'total':\n DEV_BACKEND.reloadChunk?.(chunkUrl)\n break\n case 'deleted':\n DEV_BACKEND.unloadChunk?.(chunkUrl)\n break\n case 'partial':\n invariant(\n chunkUpdate.instruction,\n (instruction) =>\n `Unknown partial instruction: ${JSON.stringify(instruction)}.`\n )\n break\n default:\n invariant(\n chunkUpdate,\n (chunkUpdate) => `Unknown chunk update type: ${chunkUpdate.type}`\n )\n }\n }\n }\n}\n\nfunction applyEcmascriptMergedUpdate(update: EcmascriptMergedUpdate) {\n const { entries = {}, chunks = {} } = update\n const { added, modified, chunksAdded, chunksDeleted } = computeChangedModules(\n entries,\n chunks\n )\n const { outdatedModules, newModuleFactories } = computeOutdatedModules(\n added,\n modified\n )\n const { disposedModules } = updateChunksPhase(chunksAdded, chunksDeleted)\n\n applyInternal(outdatedModules, disposedModules, newModuleFactories)\n}\n\nfunction applyInvalidatedModules(outdatedModules: Set) {\n if (queuedInvalidatedModules.size > 0) {\n computedInvalidatedModules(queuedInvalidatedModules).forEach((moduleId) => {\n outdatedModules.add(moduleId)\n })\n\n queuedInvalidatedModules.clear()\n }\n\n return outdatedModules\n}\n\nfunction applyInternal(\n outdatedModules: Set,\n disposedModules: Iterable,\n newModuleFactories: Map\n) {\n outdatedModules = applyInvalidatedModules(outdatedModules)\n\n const outdatedSelfAcceptedModules =\n computeOutdatedSelfAcceptedModules(outdatedModules)\n\n const { outdatedModuleParents } = disposePhase(\n outdatedModules,\n disposedModules\n )\n\n // we want to continue on error and only throw the error after we tried applying all updates\n let error: any\n\n function reportError(err: any) {\n if (!error) error = err\n }\n\n applyPhase(\n outdatedSelfAcceptedModules,\n newModuleFactories,\n outdatedModuleParents,\n reportError\n )\n\n if (error) {\n throw error\n }\n\n if (queuedInvalidatedModules.size > 0) {\n applyInternal(new Set(), [], new Map())\n }\n}\n\nfunction computeChangedModules(\n entries: Record,\n updates: Record\n): {\n added: Map\n modified: Map\n deleted: Set\n chunksAdded: Map>\n chunksDeleted: Map>\n} {\n const chunksAdded = new Map()\n const chunksDeleted = new Map()\n const added: Map = new Map()\n const modified = new Map()\n const deleted: Set = new Set()\n\n for (const [chunkPath, mergedChunkUpdate] of Object.entries(updates) as Array<\n [ChunkPath, EcmascriptMergedChunkUpdate]\n >) {\n switch (mergedChunkUpdate.type) {\n case 'added': {\n const updateAdded = new Set(mergedChunkUpdate.modules)\n for (const moduleId of updateAdded) {\n added.set(moduleId, entries[moduleId])\n }\n chunksAdded.set(chunkPath, updateAdded)\n break\n }\n case 'deleted': {\n // We could also use `mergedChunkUpdate.modules` here.\n const updateDeleted = new Set(chunkModulesMap.get(chunkPath))\n for (const moduleId of updateDeleted) {\n deleted.add(moduleId)\n }\n chunksDeleted.set(chunkPath, updateDeleted)\n break\n }\n case 'partial': {\n const updateAdded = new Set(mergedChunkUpdate.added)\n const updateDeleted = new Set(mergedChunkUpdate.deleted)\n for (const moduleId of updateAdded) {\n added.set(moduleId, entries[moduleId])\n }\n for (const moduleId of updateDeleted) {\n deleted.add(moduleId)\n }\n chunksAdded.set(chunkPath, updateAdded)\n chunksDeleted.set(chunkPath, updateDeleted)\n break\n }\n default:\n invariant(\n mergedChunkUpdate,\n (mergedChunkUpdate) =>\n `Unknown merged chunk update type: ${mergedChunkUpdate.type}`\n )\n }\n }\n\n // If a module was added from one chunk and deleted from another in the same update,\n // consider it to be modified, as it means the module was moved from one chunk to another\n // AND has new code in a single update.\n for (const moduleId of added.keys()) {\n if (deleted.has(moduleId)) {\n added.delete(moduleId)\n deleted.delete(moduleId)\n }\n }\n\n for (const [moduleId, entry] of Object.entries(entries)) {\n // Modules that haven't been added to any chunk but have new code are considered\n // to be modified.\n // This needs to be under the previous loop, as we need it to get rid of modules\n // that were added and deleted in the same update.\n if (!added.has(moduleId)) {\n modified.set(moduleId, entry)\n }\n }\n\n return { added, deleted, modified, chunksAdded, chunksDeleted }\n}\n\ntype ModuleEffect =\n | {\n type: 'unaccepted'\n dependencyChain: ModuleId[]\n }\n | {\n type: 'self-declined'\n dependencyChain: ModuleId[]\n moduleId: ModuleId\n }\n | {\n type: 'accepted'\n moduleId: ModuleId\n outdatedModules: Set\n }\n\nfunction getAffectedModuleEffects(moduleId: ModuleId): ModuleEffect {\n const outdatedModules: Set = new Set()\n\n type QueueItem = { moduleId?: ModuleId; dependencyChain: ModuleId[] }\n\n const queue: QueueItem[] = [\n {\n moduleId,\n dependencyChain: [],\n },\n ]\n\n let nextItem\n while ((nextItem = queue.shift())) {\n const { moduleId, dependencyChain } = nextItem\n\n if (moduleId != null) {\n if (outdatedModules.has(moduleId)) {\n // Avoid infinite loops caused by cycles between modules in the dependency chain.\n continue\n }\n\n outdatedModules.add(moduleId)\n }\n\n // We've arrived at the runtime of the chunk, which means that nothing\n // else above can accept this update.\n if (moduleId === undefined) {\n return {\n type: 'unaccepted',\n dependencyChain,\n }\n }\n\n const module = devModuleCache[moduleId]\n const hotState = moduleHotState.get(module)!\n\n if (\n // The module is not in the cache. Since this is a \"modified\" update,\n // it means that the module was never instantiated before.\n !module || // The module accepted itself without invalidating globalThis.\n // TODO is that right?\n (hotState.selfAccepted && !hotState.selfInvalidated)\n ) {\n continue\n }\n\n if (hotState.selfDeclined) {\n return {\n type: 'self-declined',\n dependencyChain,\n moduleId,\n }\n }\n\n if (runtimeModules.has(moduleId)) {\n queue.push({\n moduleId: undefined,\n dependencyChain: [...dependencyChain, moduleId],\n })\n continue\n }\n\n for (const parentId of module.parents) {\n const parent = devModuleCache[parentId]\n\n if (!parent) {\n // TODO(alexkirsz) Is this even possible?\n continue\n }\n\n // TODO(alexkirsz) Dependencies: check accepted and declined\n // dependencies here.\n\n queue.push({\n moduleId: parentId,\n dependencyChain: [...dependencyChain, moduleId],\n })\n }\n }\n\n return {\n type: 'accepted',\n moduleId,\n outdatedModules,\n }\n}\n\nfunction handleApply(chunkListPath: ChunkListPath, update: ServerMessage) {\n switch (update.type) {\n case 'partial': {\n // This indicates that the update is can be applied to the current state of the application.\n applyUpdate(update.instruction)\n break\n }\n case 'restart': {\n // This indicates that there is no way to apply the update to the\n // current state of the application, and that the application must be\n // restarted.\n DEV_BACKEND.restart()\n break\n }\n case 'notFound': {\n // This indicates that the chunk list no longer exists: either the dynamic import which created it was removed,\n // or the page itself was deleted.\n // If it is a dynamic import, we simply discard all modules that the chunk has exclusive access to.\n // If it is a runtime chunk list, we restart the application.\n if (runtimeChunkLists.has(chunkListPath)) {\n DEV_BACKEND.restart()\n } else {\n disposeChunkList(chunkListPath)\n }\n break\n }\n default:\n throw new Error(`Unknown update type: ${update.type}`)\n }\n}\n\nfunction createModuleHot(\n moduleId: ModuleId,\n hotData: HotData\n): { hot: Hot; hotState: HotState } {\n const hotState: HotState = {\n selfAccepted: false,\n selfDeclined: false,\n selfInvalidated: false,\n disposeHandlers: [],\n }\n\n const hot: Hot = {\n // TODO(alexkirsz) This is not defined in the HMR API. It was used to\n // decide whether to warn whenever an HMR-disposed module required other\n // modules. We might want to remove it.\n active: true,\n\n data: hotData ?? {},\n\n // TODO(alexkirsz) Support full (dep, callback, errorHandler) form.\n accept: (\n modules?: string | string[] | AcceptErrorHandler,\n _callback?: AcceptCallback,\n _errorHandler?: AcceptErrorHandler\n ) => {\n if (modules === undefined) {\n hotState.selfAccepted = true\n } else if (typeof modules === 'function') {\n hotState.selfAccepted = modules\n } else {\n throw new Error('unsupported `accept` signature')\n }\n },\n\n decline: (dep) => {\n if (dep === undefined) {\n hotState.selfDeclined = true\n } else {\n throw new Error('unsupported `decline` signature')\n }\n },\n\n dispose: (callback) => {\n hotState.disposeHandlers.push(callback)\n },\n\n addDisposeHandler: (callback) => {\n hotState.disposeHandlers.push(callback)\n },\n\n removeDisposeHandler: (callback) => {\n const idx = hotState.disposeHandlers.indexOf(callback)\n if (idx >= 0) {\n hotState.disposeHandlers.splice(idx, 1)\n }\n },\n\n invalidate: () => {\n hotState.selfInvalidated = true\n queuedInvalidatedModules.add(moduleId)\n },\n\n // NOTE(alexkirsz) This is part of the management API, which we don't\n // implement, but the Next.js React Refresh runtime uses this to decide\n // whether to schedule an update.\n status: () => 'idle',\n\n // NOTE(alexkirsz) Since we always return \"idle\" for now, these are no-ops.\n addStatusHandler: (_handler) => {},\n removeStatusHandler: (_handler) => {},\n\n // NOTE(jridgewell) Check returns the list of updated modules, but we don't\n // want the webpack code paths to ever update (the turbopack paths handle\n // this already).\n check: () => Promise.resolve(null),\n }\n\n return { hot, hotState }\n}\n\n/**\n * Removes a module from a chunk.\n * Returns `true` if there are no remaining chunks including this module.\n */\nfunction removeModuleFromChunk(\n moduleId: ModuleId,\n chunkPath: ChunkPath\n): boolean {\n const moduleChunks = moduleChunksMap.get(moduleId)!\n moduleChunks.delete(chunkPath)\n\n const chunkModules = chunkModulesMap.get(chunkPath)!\n chunkModules.delete(moduleId)\n\n const noRemainingModules = chunkModules.size === 0\n if (noRemainingModules) {\n chunkModulesMap.delete(chunkPath)\n }\n\n const noRemainingChunks = moduleChunks.size === 0\n if (noRemainingChunks) {\n moduleChunksMap.delete(moduleId)\n }\n\n return noRemainingChunks\n}\n\n/**\n * Disposes of a chunk list and its corresponding exclusive chunks.\n */\nfunction disposeChunkList(chunkListPath: ChunkListPath): boolean {\n const chunkPaths = chunkListChunksMap.get(chunkListPath)\n if (chunkPaths == null) {\n return false\n }\n chunkListChunksMap.delete(chunkListPath)\n\n for (const chunkPath of chunkPaths) {\n const chunkChunkLists = chunkChunkListsMap.get(chunkPath)!\n chunkChunkLists.delete(chunkListPath)\n\n if (chunkChunkLists.size === 0) {\n chunkChunkListsMap.delete(chunkPath)\n disposeChunk(chunkPath)\n }\n }\n\n // We must also dispose of the chunk list's chunk itself to ensure it may\n // be reloaded properly in the future.\n const chunkListUrl = getChunkRelativeUrl(chunkListPath)\n\n DEV_BACKEND.unloadChunk?.(chunkListUrl)\n\n return true\n}\n\n/**\n * Disposes of a chunk and its corresponding exclusive modules.\n *\n * @returns Whether the chunk was disposed of.\n */\nfunction disposeChunk(chunkPath: ChunkPath): boolean {\n const chunkUrl = getChunkRelativeUrl(chunkPath)\n // This should happen whether the chunk has any modules in it or not.\n // For instance, CSS chunks have no modules in them, but they still need to be unloaded.\n DEV_BACKEND.unloadChunk?.(chunkUrl)\n\n const chunkModules = chunkModulesMap.get(chunkPath)\n if (chunkModules == null) {\n return false\n }\n chunkModules.delete(chunkPath)\n\n for (const moduleId of chunkModules) {\n const moduleChunks = moduleChunksMap.get(moduleId)!\n moduleChunks.delete(chunkPath)\n\n const noRemainingChunks = moduleChunks.size === 0\n if (noRemainingChunks) {\n moduleChunksMap.delete(moduleId)\n disposeModule(moduleId, 'clear')\n availableModules.delete(moduleId)\n }\n }\n\n return true\n}\n\n/**\n * Adds a module to a chunk.\n */\nfunction addModuleToChunk(moduleId: ModuleId, chunkPath: ChunkPath) {\n let moduleChunks = moduleChunksMap.get(moduleId)\n if (!moduleChunks) {\n moduleChunks = new Set([chunkPath])\n moduleChunksMap.set(moduleId, moduleChunks)\n } else {\n moduleChunks.add(chunkPath)\n }\n\n let chunkModules = chunkModulesMap.get(chunkPath)\n if (!chunkModules) {\n chunkModules = new Set([moduleId])\n chunkModulesMap.set(chunkPath, chunkModules)\n } else {\n chunkModules.add(moduleId)\n }\n}\n\n/**\n * Marks a chunk list as a runtime chunk list. There can be more than one\n * runtime chunk list. For instance, integration tests can have multiple chunk\n * groups loaded at runtime, each with its own chunk list.\n */\nfunction markChunkListAsRuntime(chunkListPath: ChunkListPath) {\n runtimeChunkLists.add(chunkListPath)\n}\n\nfunction registerChunk(registration: ChunkRegistration) {\n const chunkPath = getPathFromScript(registration[0])\n let runtimeParams: RuntimeParams | undefined\n // When bootstrapping we are passed a single runtimeParams object so we can distinguish purely based on length\n if (registration.length === 2) {\n runtimeParams = registration[1] as RuntimeParams\n } else {\n runtimeParams = undefined\n installCompressedModuleFactories(\n registration as CompressedModuleFactories,\n /* offset= */ 1,\n moduleFactories,\n (id: ModuleId) => addModuleToChunk(id, chunkPath)\n )\n }\n return BACKEND.registerChunk(chunkPath, runtimeParams)\n}\n\n/**\n * Subscribes to chunk list updates from the update server and applies them.\n */\nfunction registerChunkList(chunkList: ChunkList) {\n const chunkListScript = chunkList.script\n const chunkListPath = getPathFromScript(chunkListScript)\n // The \"chunk\" is also registered to finish the loading in the backend\n BACKEND.registerChunk(chunkListPath as string as ChunkPath)\n globalThis.TURBOPACK_CHUNK_UPDATE_LISTENERS!.push([\n chunkListPath,\n handleApply.bind(null, chunkListPath),\n ])\n\n // Adding chunks to chunk lists and vice versa.\n const chunkPaths = new Set(chunkList.chunks.map(getChunkPath))\n chunkListChunksMap.set(chunkListPath, chunkPaths)\n for (const chunkPath of chunkPaths) {\n let chunkChunkLists = chunkChunkListsMap.get(chunkPath)\n if (!chunkChunkLists) {\n chunkChunkLists = new Set([chunkListPath])\n chunkChunkListsMap.set(chunkPath, chunkChunkLists)\n } else {\n chunkChunkLists.add(chunkListPath)\n }\n }\n\n if (chunkList.source === 'entry') {\n markChunkListAsRuntime(chunkListPath)\n }\n}\n\nglobalThis.TURBOPACK_CHUNK_UPDATE_LISTENERS ??= []\n"],"names":["devContextPrototype","Context","prototype","devModuleCache","Object","create","c","UpdateApplyError","Error","name","dependencyChain","message","runtimeModules","Set","moduleChunksMap","Map","chunkModulesMap","runtimeChunkLists","chunkListChunksMap","chunkChunkListsMap","moduleHotData","moduleHotState","queuedInvalidatedModules","getOrInstantiateRuntimeModule","chunkPath","moduleId","module","error","instantiateModule","SourceType","Runtime","getOrInstantiateModuleFromParent","id","sourceModule","hot","active","console","warn","children","indexOf","push","parents","Parent","DevContext","exports","refresh","call","k","sourceType","sourceData","moduleFactory","moduleFactories","get","factoryNotAvailableMessage","hotData","hotState","createModuleHot","add","Update","invariant","createModuleObject","set","runModuleExecutionHooks","context","namespaceObject","interopEsm","DUMMY_REFRESH_CONTEXT","register","_type","_id","signature","registerExports","_module","_helpers","executeModule","globalThis","$RefreshInterceptModuleExecution$","cleanupReactRefreshIntercept","$RefreshReg$","$RefreshSig$","registerExportsAndSetupBoundaryForReactRefresh","helpers","currentExports","prevExports","data","registerExportsForReactRefresh","isReactRefreshBoundary","dispose","accept","shouldInvalidateReactRefreshBoundary","getRefreshBoundarySignature","invalidate","scheduleUpdate","isNoLongerABoundary","formatDependencyChain","join","computeOutdatedModules","added","modified","newModuleFactories","entry","_eval","outdatedModules","computedInvalidatedModules","keys","invalidated","effect","getAffectedModuleEffects","type","outdatedModuleId","computeOutdatedSelfAcceptedModules","outdatedSelfAcceptedModules","selfAccepted","selfInvalidated","errorHandler","updateChunksPhase","chunksAddedModules","chunksDeletedModules","addedModuleIds","addModuleToChunk","disposedModules","removeModuleFromChunk","disposePhase","disposeModule","outdatedModuleParents","oldModule","mode","disposeHandler","disposeHandlers","delete","childId","child","idx","splice","applyPhase","reportError","factory","entries","applyModuleFactoryName","err","err2","applyUpdate","update","applyChunkListUpdate","merged","applyEcmascriptMergedUpdate","chunks","chunkUpdate","chunkUrl","getChunkRelativeUrl","BACKEND","loadChunkCached","DEV_BACKEND","reloadChunk","unloadChunk","instruction","JSON","stringify","chunksAdded","chunksDeleted","computeChangedModules","applyInternal","applyInvalidatedModules","size","forEach","clear","updates","deleted","mergedChunkUpdate","updateAdded","modules","updateDeleted","has","queue","nextItem","shift","undefined","selfDeclined","parentId","parent","handleApply","chunkListPath","restart","disposeChunkList","_callback","_errorHandler","decline","dep","callback","addDisposeHandler","removeDisposeHandler","status","addStatusHandler","_handler","removeStatusHandler","check","Promise","resolve","moduleChunks","chunkModules","noRemainingModules","noRemainingChunks","chunkPaths","chunkChunkLists","disposeChunk","chunkListUrl","availableModules","markChunkListAsRuntime","registerChunk","registration","getPathFromScript","runtimeParams","length","installCompressedModuleFactories","registerChunkList","chunkList","chunkListScript","script","TURBOPACK_CHUNK_UPDATE_LISTENERS","bind","map","getChunkPath","source"],"mappings":"AAAA,2CAA2C;AAC3C,4CAA4C;AAC5C,4CAA4C;AAM5C,MAAMA,sBAAsBC,QAAQC,SAAS;AAE7C;;;;;;CAMC,GAED,oDAAoD,GAEpD,MAAMC,iBAAyCC,OAAOC,MAAM,CAAC;AAC7DL,oBAAoBM,CAAC,GAAGH;AAgCxB,MAAMI,yBAAyBC;IAC7BC,OAAO,mBAAkB;IAEzBC,gBAA2B;IAE3BH,YAAYI,OAAe,EAAED,eAA2B,CAAE;QACxD,KAAK,CAACC;QACN,IAAI,CAACD,eAAe,GAAGA;IACzB;AACF;AAEA;;CAEC,GACD,MAAME,iBAAgC,IAAIC;AAE1C;;;;;;CAMC,GACD,MAAMC,kBAAiD,IAAIC;AAC3D;;CAEC,GACD,MAAMC,kBAAiD,IAAID;AAC3D;;;;CAIC,GACD,MAAME,oBAAwC,IAAIJ;AAClD;;CAEC,GACD,MAAMK,qBAAyD,IAAIH;AACnE;;CAEC,GACD,MAAMI,qBAAyD,IAAIJ;AAEnE;;;CAGC,GACD,MAAMK,gBAAwC,IAAIL;AAClD;;CAEC,GACD,MAAMM,iBAAwC,IAAIN;AAClD;;CAEC,GACD,MAAMO,2BAA0C,IAAIT;AAEpD;;CAEC,GACD,aAAa;AACb,SAASU,8BACPC,SAAoB,EACpBC,QAAkB;IAElB,MAAMC,SAASvB,cAAc,CAACsB,SAAS;IACvC,IAAIC,QAAQ;QACV,IAAIA,OAAOC,KAAK,EAAE;YAChB,MAAMD,OAAOC,KAAK;QACpB;QACA,OAAOD;IACT;IAEA,aAAa;IACb,OAAOE,kBAAkBH,UAAUI,WAAWC,OAAO,EAAEN;AACzD;A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I,CAAC;QAChD6I;QACAD,YAAYuC,IAAI,CAAC,MAAMtC;KACxB;IAED,+CAA+C;IAC/C,MAAMqB,aAAa,IAAI7L,IAAI0M,UAAUrE,MAAM,CAAC0E,GAAG,CAACC;IAChD3M,mBAAmB2C,GAAG,CAACwH,eAAeqB;IACtC,KAAK,MAAMlL,aAAakL,WAAY;QAClC,IAAIC,kBAAkBxL,mBAAmBiC,GAAG,CAAC5B;QAC7C,IAAI,CAACmL,iBAAiB;YACpBA,kBAAkB,IAAI9L,IAAI;gBAACwK;aAAc;YACzClK,mBAAmB0C,GAAG,CAACrC,WAAWmL;QACpC,OAAO;YACLA,gBAAgBlJ,GAAG,CAAC4H;QACtB;IACF;IAEA,IAAIkC,UAAUO,MAAM,KAAK,SAAS;QAChCf,uBAAuB1B;IACzB;AACF;AAEA1G,WAAW+I,gCAAgC,KAAK,EAAE","ignoreList":[0]}}, - {"offset": {"line": 1596, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/browser/runtime/dom/runtime-backend-dom.ts"],"sourcesContent":["/**\n * This file contains the runtime code specific to the Turbopack ECMAScript DOM runtime.\n *\n * It will be appended to the base runtime code.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n/// \n\nfunction getChunkSuffixFromScriptSrc() {\n // TURBOPACK_CHUNK_SUFFIX is set in web workers\n return (\n (self.TURBOPACK_CHUNK_SUFFIX ??\n document?.currentScript\n ?.getAttribute?.('src')\n ?.replace(/^(.*(?=\\?)|^.*$)/, '')) ||\n ''\n )\n}\n\ntype ChunkResolver = {\n resolved: boolean\n loadingStarted: boolean\n resolve: () => void\n reject: (error?: Error) => void\n promise: Promise\n}\n\nlet BACKEND: RuntimeBackend\n\n/**\n * Maps chunk paths to the corresponding resolver.\n */\nconst chunkResolvers: Map = new Map()\n\n;(() => {\n BACKEND = {\n async registerChunk(chunkPath, params) {\n const chunkUrl = getChunkRelativeUrl(chunkPath)\n\n const resolver = getOrCreateResolver(chunkUrl)\n resolver.resolve()\n\n if (params == null) {\n return\n }\n\n for (const otherChunkData of params.otherChunks) {\n const otherChunkPath = getChunkPath(otherChunkData)\n const otherChunkUrl = getChunkRelativeUrl(otherChunkPath)\n\n // Chunk might have started loading, so we want to avoid triggering another load.\n getOrCreateResolver(otherChunkUrl)\n }\n\n // This waits for chunks to be loaded, but also marks included items as available.\n await Promise.all(\n params.otherChunks.map((otherChunkData) =>\n loadInitialChunk(chunkPath, otherChunkData)\n )\n )\n\n if (params.runtimeModuleIds.length > 0) {\n for (const moduleId of params.runtimeModuleIds) {\n getOrInstantiateRuntimeModule(chunkPath, moduleId)\n }\n }\n },\n\n /**\n * Loads the given chunk, and returns a promise that resolves once the chunk\n * has been loaded.\n */\n loadChunkCached(sourceType: SourceType, chunkUrl: ChunkUrl) {\n return doLoadChunk(sourceType, chunkUrl)\n },\n\n async loadWebAssembly(\n _sourceType: SourceType,\n _sourceData: SourceData,\n wasmChunkPath: ChunkPath,\n _edgeModule: () => WebAssembly.Module,\n importsObj: WebAssembly.Imports\n ): Promise {\n const req = fetchWebAssembly(wasmChunkPath)\n\n const { instance } = await WebAssembly.instantiateStreaming(\n req,\n importsObj\n )\n\n return instance.exports\n },\n\n async loadWebAssemblyModule(\n _sourceType: SourceType,\n _sourceData: SourceData,\n wasmChunkPath: ChunkPath,\n _edgeModule: () => WebAssembly.Module\n ): Promise {\n const req = fetchWebAssembly(wasmChunkPath)\n\n return await WebAssembly.compileStreaming(req)\n },\n }\n\n function getOrCreateResolver(chunkUrl: ChunkUrl): ChunkResolver {\n let resolver = chunkResolvers.get(chunkUrl)\n if (!resolver) {\n let resolve: () => void\n let reject: (error?: Error) => void\n const promise = new Promise((innerResolve, innerReject) => {\n resolve = innerResolve\n reject = innerReject\n })\n resolver = {\n resolved: false,\n loadingStarted: false,\n promise,\n resolve: () => {\n resolver!.resolved = true\n resolve()\n },\n reject: reject!,\n }\n chunkResolvers.set(chunkUrl, resolver)\n }\n return resolver\n }\n\n /**\n * Loads the given chunk, and returns a promise that resolves once the chunk\n * has been loaded.\n */\n function doLoadChunk(sourceType: SourceType, chunkUrl: ChunkUrl) {\n const resolver = getOrCreateResolver(chunkUrl)\n if (resolver.loadingStarted) {\n return resolver.promise\n }\n\n if (sourceType === SourceType.Runtime) {\n // We don't need to load chunks references from runtime code, as they're already\n // present in the DOM.\n resolver.loadingStarted = true\n\n if (isCss(chunkUrl)) {\n // CSS chunks do not register themselves, and as such must be marked as\n // loaded instantly.\n resolver.resolve()\n }\n\n // We need to wait for JS chunks to register themselves within `registerChunk`\n // before we can start instantiating runtime modules, hence the absence of\n // `resolver.resolve()` in this branch.\n\n return resolver.promise\n }\n\n if (typeof importScripts === 'function') {\n // We're in a web worker\n if (isCss(chunkUrl)) {\n // ignore\n } else if (isJs(chunkUrl)) {\n self.TURBOPACK_NEXT_CHUNK_URLS!.push(chunkUrl)\n importScripts(TURBOPACK_WORKER_LOCATION + chunkUrl)\n } else {\n throw new Error(\n `can't infer type of chunk from URL ${chunkUrl} in worker`\n )\n }\n } else {\n // TODO(PACK-2140): remove this once all filenames are guaranteed to be escaped.\n const decodedChunkUrl = decodeURI(chunkUrl)\n\n if (isCss(chunkUrl)) {\n const previousLinks = document.querySelectorAll(\n `link[rel=stylesheet][href=\"${chunkUrl}\"],link[rel=stylesheet][href^=\"${chunkUrl}?\"],link[rel=stylesheet][href=\"${decodedChunkUrl}\"],link[rel=stylesheet][href^=\"${decodedChunkUrl}?\"]`\n )\n if (previousLinks.length > 0) {\n // CSS chunks do not register themselves, and as such must be marked as\n // loaded instantly.\n resolver.resolve()\n } else {\n const link = document.createElement('link')\n link.rel = 'stylesheet'\n link.href = chunkUrl\n link.onerror = () => {\n resolver.reject()\n }\n link.onload = () => {\n // CSS chunks do not register themselves, and as such must be marked as\n // loaded instantly.\n resolver.resolve()\n }\n // Append to the `head` for webpack compatibility.\n document.head.appendChild(link)\n }\n } else if (isJs(chunkUrl)) {\n const previousScripts = document.querySelectorAll(\n `script[src=\"${chunkUrl}\"],script[src^=\"${chunkUrl}?\"],script[src=\"${decodedChunkUrl}\"],script[src^=\"${decodedChunkUrl}?\"]`\n )\n if (previousScripts.length > 0) {\n // There is this edge where the script already failed loading, but we\n // can't detect that. The Promise will never resolve in this case.\n for (const script of Array.from(previousScripts)) {\n script.addEventListener('error', () => {\n resolver.reject()\n })\n }\n } else {\n const script = document.createElement('script')\n script.src = chunkUrl\n // We'll only mark the chunk as loaded once the script has been executed,\n // which happens in `registerChunk`. Hence the absence of `resolve()` in\n // this branch.\n script.onerror = () => {\n resolver.reject()\n }\n // Append to the `head` for webpack compatibility.\n document.head.appendChild(script)\n }\n } else {\n throw new Error(`can't infer type of chunk from URL ${chunkUrl}`)\n }\n }\n\n resolver.loadingStarted = true\n return resolver.promise\n }\n\n function fetchWebAssembly(wasmChunkPath: ChunkPath) {\n return fetch(getChunkRelativeUrl(wasmChunkPath))\n }\n})()\n"],"names":["getChunkSuffixFromScriptSrc","self","TURBOPACK_CHUNK_SUFFIX","document","currentScript","getAttribute","replace","BACKEND","chunkResolvers","Map","registerChunk","chunkPath","params","chunkUrl","getChunkRelativeUrl","resolver","getOrCreateResolver","resolve","otherChunkData","otherChunks","otherChunkPath","getChunkPath","otherChunkUrl","Promise","all","map","loadInitialChunk","runtimeModuleIds","length","moduleId","getOrInstantiateRuntimeModule","loadChunkCached","sourceType","doLoadChunk","loadWebAssembly","_sourceType","_sourceData","wasmChunkPath","_edgeModule","importsObj","req","fetchWebAssembly","instance","WebAssembly","instantiateStreaming","exports","loadWebAssemblyModule","compileStreaming","get","reject","promise","innerResolve","innerReject","resolved","loadingStarted","set","SourceType","Runtime","isCss","importScripts","isJs","TURBOPACK_NEXT_CHUNK_URLS","push","TURBOPACK_WORKER_LOCATION","Error","decodedChunkUrl","decodeURI","previousLinks","querySelectorAll","link","createElement","rel","href","onerror","onload","head","appendChild","previousScripts","script","Array","from","addEventListener","src","fetch"],"mappings":"AAAA;;;;CAIC,GAED,oDAAoD,GAEpD,sEAAsE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AAM,IAAId,MAAM,CAAC,mCAAmC,EAAEnD,UAAU;YAClE;QACF;QAEAE,SAASuC,cAAc,GAAG;QAC1B,OAAOvC,SAASmC,OAAO;IACzB;IAEA,SAAST,iBAAiBJ,aAAwB;QAChD,OAAO8C,MAAMrE,oBAAoBuB;IACnC;AACF,CAAC","ignoreList":[0]}}, - {"offset": {"line": 1761, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/browser/runtime/dom/dev-backend-dom.ts"],"sourcesContent":["/**\n * This file contains the runtime code specific to the Turbopack development\n * ECMAScript DOM runtime.\n *\n * It will be appended to the base development runtime code.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n/// \n/// \n/// \n\nlet DEV_BACKEND: DevRuntimeBackend\n;(() => {\n DEV_BACKEND = {\n unloadChunk(chunkUrl) {\n deleteResolver(chunkUrl)\n\n // TODO(PACK-2140): remove this once all filenames are guaranteed to be escaped.\n const decodedChunkUrl = decodeURI(chunkUrl)\n\n if (isCss(chunkUrl)) {\n const links = document.querySelectorAll(\n `link[href=\"${chunkUrl}\"],link[href^=\"${chunkUrl}?\"],link[href=\"${decodedChunkUrl}\"],link[href^=\"${decodedChunkUrl}?\"]`\n )\n for (const link of Array.from(links)) {\n link.remove()\n }\n } else if (isJs(chunkUrl)) {\n // Unloading a JS chunk would have no effect, as it lives in the JS\n // runtime once evaluated.\n // However, we still want to remove the script tag from the DOM to keep\n // the HTML somewhat consistent from the user's perspective.\n const scripts = document.querySelectorAll(\n `script[src=\"${chunkUrl}\"],script[src^=\"${chunkUrl}?\"],script[src=\"${decodedChunkUrl}\"],script[src^=\"${decodedChunkUrl}?\"]`\n )\n for (const script of Array.from(scripts)) {\n script.remove()\n }\n } else {\n throw new Error(`can't infer type of chunk from URL ${chunkUrl}`)\n }\n },\n\n reloadChunk(chunkUrl) {\n return new Promise((resolve, reject) => {\n if (!isCss(chunkUrl)) {\n reject(new Error('The DOM backend can only reload CSS chunks'))\n return\n }\n\n const decodedChunkUrl = decodeURI(chunkUrl)\n const previousLinks = document.querySelectorAll(\n `link[rel=stylesheet][href=\"${chunkUrl}\"],link[rel=stylesheet][href^=\"${chunkUrl}?\"],link[rel=stylesheet][href=\"${decodedChunkUrl}\"],link[rel=stylesheet][href^=\"${decodedChunkUrl}?\"]`\n )\n\n if (previousLinks.length === 0) {\n reject(new Error(`No link element found for chunk ${chunkUrl}`))\n return\n }\n\n const link = document.createElement('link')\n link.rel = 'stylesheet'\n\n if (navigator.userAgent.includes('Firefox')) {\n // Firefox won't reload CSS files that were previously loaded on the current page,\n // we need to add a query param to make sure CSS is actually reloaded from the server.\n //\n // I believe this is this issue: https://bugzilla.mozilla.org/show_bug.cgi?id=1037506\n //\n // Safari has a similar issue, but only if you have a `` tag\n // pointing to the same URL as the stylesheet: https://bugs.webkit.org/show_bug.cgi?id=187726\n link.href = `${chunkUrl}?ts=${Date.now()}`\n } else {\n link.href = chunkUrl\n }\n\n link.onerror = () => {\n reject()\n }\n link.onload = () => {\n // First load the new CSS, then remove the old ones. This prevents visible\n // flickering that would happen in-between removing the previous CSS and\n // loading the new one.\n for (const previousLink of Array.from(previousLinks))\n previousLink.remove()\n\n // CSS chunks do not register themselves, and as such must be marked as\n // loaded instantly.\n resolve()\n }\n\n // Make sure to insert the new CSS right after the previous one, so that\n // its precedence is higher.\n previousLinks[0].parentElement!.insertBefore(\n link,\n previousLinks[0].nextSibling\n )\n })\n },\n\n restart: () => self.location.reload(),\n }\n\n function deleteResolver(chunkUrl: ChunkUrl) {\n chunkResolvers.delete(chunkUrl)\n }\n})()\n\nfunction _eval({ code, url, map }: EcmascriptModuleEntry): ModuleFactory {\n code += `\\n\\n//# sourceURL=${encodeURI(\n location.origin + CHUNK_BASE_PATH + url + CHUNK_SUFFIX\n )}`\n if (map) {\n code += `\\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,${btoa(\n // btoa doesn't handle nonlatin characters, so escape them as \\x sequences\n // See https://stackoverflow.com/a/26603875\n unescape(encodeURIComponent(map))\n )}`\n }\n\n // eslint-disable-next-line no-eval\n return eval(code)\n}\n"],"names":["DEV_BACKEND","unloadChunk","chunkUrl","deleteResolver","decodedChunkUrl","decodeURI","isCss","links","document","querySelectorAll","link","Array","from","remove","isJs","scripts","script","Error","reloadChunk","Promise","resolve","reject","previousLinks","length","createElement","rel","navigator","userAgent","includes","href","Date","now","onerror","onload","previousLink","parentElement","insertBefore","nextSibling","restart","self","location","reload","chunkResolvers","delete","_eval","code","url","map","encodeURI","origin","CHUNK_BASE_PATH","CHUNK_SUFFIX","btoa","unescape","encodeURIComponent","eval"],"mappings":"AAAA;;;;;CAKC,GAED,oDAAoD,GAEpD,gDAAgD;AAChD,4CAA4C;AAC5C,iDAAiD;AACjD,0DAA0D;AAE1D,IAAIA;AACH,CAAC;IACAA,cAAc;QACZC,aAAYC,QAAQ;YAClBC,eAAeD;YAEf,gFAAgF;YAChF,MAAME,kBAAkBC,UAAUH;YAElC,IAAII,MAAMJ,WAAW;gBACnB,MAAMK,QAAQC,SAASC,gBAAgB,CACrC,CAAC,WAAW,EAAEP,SAAS,eAAe,EAAEA,SAAS,eAAe,EAAEE,gBAAgB,eAAe,EAAEA,gBAAgB,GAAG,CAAC;gBAEzH,KAAK,MAAMM,QAAQC,MAAMC,IAAI,CAACL,OAAQ;oBACpCG,KAAKG,MAAM;gBACb;YACF,OAAO,IAAIC,KAAKZ,WAAW;gBACzB,mEAAmE;gBACnE,0BAA0B;gBAC1B,uEAAuE;gBACvE,4DAA4D;gBAC5D,MAAMa,UAAUP,SAASC,gBAAgB,CACvC,CAAC,YAAY,EAAEP,SAAS,gBAAgB,EAAEA,SAAS,gBAAgB,EAAEE,gBAAgB,gBAAgB,EAAEA,gBAAgB,GAAG,CAAC;gBAE7H,KAAK,MAAMY,UAAUL,MAAMC,IAAI,CAACG,SAAU;oBACxCC,OAAOH,MAAM;gBACf;YACF,OAAO;gBACL,MAAM,IAAII,MAAM,CAAC,mCAAmC,EAAEf,UAAU;YAClE;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C;IAEA,SAAStC,eAAeD,QAAkB;QACxCwC,eAAeC,MAAM,CAACzC;IACxB;AACF,CAAC;AAED,SAAS0C,MAAM,EAAEC,IAAI,EAAEC,GAAG,EAAEC,GAAG,EAAyB;IACtDF,QAAQ,CAAC,kBAAkB,EAAEG,UAC3BR,SAASS,MAAM,GAAGC,kBAAkBJ,MAAMK,eACzC;IACH,IAAIJ,KAAK;QACPF,QAAQ,CAAC,kEAAkE,EAAEO,KAC3E,0EAA0E;QAC1E,2CAA2C;QAC3CC,SAASC,mBAAmBP,QAC3B;IACL;IAEA,mCAAmC;IACnC,OAAOQ,KAAKV;AACd","ignoreList":[0]}}] + {"offset": {"line": 515, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/browser/runtime/base/runtime-base.ts"],"sourcesContent":["/**\n * This file contains runtime types and functions that are shared between all\n * Turbopack *browser* ECMAScript runtimes.\n *\n * It will be appended to the runtime code of each runtime right after the\n * shared runtime utils.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n/// \n\n// Used in WebWorkers to tell the runtime about the chunk base path\ndeclare var TURBOPACK_WORKER_LOCATION: string\n// Used in WebWorkers to tell the runtime about the chunk suffix\ndeclare var TURBOPACK_CHUNK_SUFFIX: string\n// Used in WebWorkers to tell the runtime about the current chunk url since it can't be detected via document.currentScript\n// Note it's stored in reversed order to use push and pop\ndeclare var TURBOPACK_NEXT_CHUNK_URLS: ChunkUrl[] | undefined\n\n// Injected by rust code\ndeclare var CHUNK_BASE_PATH: string\ndeclare var CHUNK_SUFFIX: string\n\ninterface TurbopackBrowserBaseContext extends TurbopackBaseContext {\n R: ResolvePathFromModule\n}\n\nconst browserContextPrototype =\n Context.prototype as TurbopackBrowserBaseContext\n\n// Provided by build or dev base\ndeclare function instantiateModule(\n id: ModuleId,\n sourceType: SourceType,\n sourceData: SourceData\n): Module\n\ntype RuntimeParams = {\n otherChunks: ChunkData[]\n runtimeModuleIds: ModuleId[]\n}\n\ntype ChunkRegistration = [\n chunkPath: ChunkScript,\n ...([RuntimeParams] | CompressedModuleFactories),\n]\n\ntype ChunkList = {\n script: ChunkListScript\n chunks: ChunkData[]\n source: 'entry' | 'dynamic'\n}\n\nenum SourceType {\n /**\n * The module was instantiated because it was included in an evaluated chunk's\n * runtime.\n * SourceData is a ChunkPath.\n */\n Runtime = 0,\n /**\n * The module was instantiated because a parent module imported it.\n * SourceData is a ModuleId.\n */\n Parent = 1,\n /**\n * The module was instantiated because it was included in a chunk's hot module\n * update.\n * SourceData is an array of ModuleIds or undefined.\n */\n Update = 2,\n}\n\ntype SourceData = ChunkPath | ModuleId | ModuleId[] | undefined\ninterface RuntimeBackend {\n registerChunk: (chunkPath: ChunkPath, params?: RuntimeParams) => void\n /**\n * Returns the same Promise for the same chunk URL.\n */\n loadChunkCached: (sourceType: SourceType, chunkUrl: ChunkUrl) => Promise\n loadWebAssembly: (\n sourceType: SourceType,\n sourceData: SourceData,\n wasmChunkPath: ChunkPath,\n edgeModule: () => WebAssembly.Module,\n importsObj: WebAssembly.Imports\n ) => Promise\n loadWebAssemblyModule: (\n sourceType: SourceType,\n sourceData: SourceData,\n wasmChunkPath: ChunkPath,\n edgeModule: () => WebAssembly.Module\n ) => Promise\n}\n\ninterface DevRuntimeBackend {\n reloadChunk?: (chunkUrl: ChunkUrl) => Promise\n unloadChunk?: (chunkUrl: ChunkUrl) => void\n restart: () => void\n}\n\nconst moduleFactories: ModuleFactories = new Map()\ncontextPrototype.M = moduleFactories\n\nconst availableModules: Map | true> = new Map()\n\nconst availableModuleChunks: Map | true> = new Map()\n\nfunction factoryNotAvailableMessage(\n moduleId: ModuleId,\n sourceType: SourceType,\n sourceData: SourceData\n): string {\n let instantiationReason\n switch (sourceType) {\n case SourceType.Runtime:\n instantiationReason = `as a runtime entry of chunk ${sourceData}`\n break\n case SourceType.Parent:\n instantiationReason = `because it was required from module ${sourceData}`\n break\n case SourceType.Update:\n instantiationReason = 'because of an HMR update'\n break\n default:\n invariant(\n sourceType,\n (sourceType) => `Unknown source type: ${sourceType}`\n )\n }\n return `Module ${moduleId} was instantiated ${instantiationReason}, but the module factory is not available.`\n}\n\nfunction loadChunk(\n this: TurbopackBrowserBaseContext,\n chunkData: ChunkData\n): Promise {\n return loadChunkInternal(SourceType.Parent, this.m.id, chunkData)\n}\nbrowserContextPrototype.l = loadChunk\n\nfunction loadInitialChunk(chunkPath: ChunkPath, chunkData: ChunkData) {\n return loadChunkInternal(SourceType.Runtime, chunkPath, chunkData)\n}\n\nasync function loadChunkInternal(\n sourceType: SourceType,\n sourceData: SourceData,\n chunkData: ChunkData\n): Promise {\n if (typeof chunkData === 'string') {\n return loadChunkPath(sourceType, sourceData, chunkData)\n }\n\n const includedList = chunkData.included || []\n const modulesPromises = includedList.map((included) => {\n if (moduleFactories.has(included)) return true\n return availableModules.get(included)\n })\n if (modulesPromises.length > 0 && modulesPromises.every((p) => p)) {\n // When all included items are already loaded or loading, we can skip loading ourselves\n await Promise.all(modulesPromises)\n return\n }\n\n const includedModuleChunksList = chunkData.moduleChunks || []\n const moduleChunksPromises = includedModuleChunksList\n .map((included) => {\n // TODO(alexkirsz) Do we need this check?\n // if (moduleFactories[included]) return true;\n return availableModuleChunks.get(included)\n })\n .filter((p) => p)\n\n let promise: Promise\n if (moduleChunksPromises.length > 0) {\n // Some module chunks are already loaded or loading.\n\n if (moduleChunksPromises.length === includedModuleChunksList.length) {\n // When all included module chunks are already loaded or loading, we can skip loading ourselves\n await Promise.all(moduleChunksPromises)\n return\n }\n\n const moduleChunksToLoad: Set = new Set()\n for (const moduleChunk of includedModuleChunksList) {\n if (!availableModuleChunks.has(moduleChunk)) {\n moduleChunksToLoad.add(moduleChunk)\n }\n }\n\n for (const moduleChunkToLoad of moduleChunksToLoad) {\n const promise = loadChunkPath(sourceType, sourceData, moduleChunkToLoad)\n\n availableModuleChunks.set(moduleChunkToLoad, promise)\n\n moduleChunksPromises.push(promise)\n }\n\n promise = Promise.all(moduleChunksPromises)\n } else {\n promise = loadChunkPath(sourceType, sourceData, chunkData.path)\n\n // Mark all included module chunks as loading if they are not already loaded or loading.\n for (const includedModuleChunk of includedModuleChunksList) {\n if (!availableModuleChunks.has(includedModuleChunk)) {\n availableModuleChunks.set(includedModuleChunk, promise)\n }\n }\n }\n\n for (const included of includedList) {\n if (!availableModules.has(included)) {\n // It might be better to race old and new promises, but it's rare that the new promise will be faster than a request started earlier.\n // In production it's even more rare, because the chunk optimization tries to deduplicate modules anyway.\n availableModules.set(included, promise)\n }\n }\n\n await promise\n}\n\nconst loadedChunk = Promise.resolve(undefined)\nconst instrumentedBackendLoadChunks = new WeakMap<\n Promise,\n Promise | typeof loadedChunk\n>()\n// Do not make this async. React relies on referential equality of the returned Promise.\nfunction loadChunkByUrl(\n this: TurbopackBrowserBaseContext,\n chunkUrl: ChunkUrl\n) {\n return loadChunkByUrlInternal(SourceType.Parent, this.m.id, chunkUrl)\n}\nbrowserContextPrototype.L = loadChunkByUrl\n\n// Do not make this async. React relies on referential equality of the returned Promise.\nfunction loadChunkByUrlInternal(\n sourceType: SourceType,\n sourceData: SourceData,\n chunkUrl: ChunkUrl\n): Promise {\n const thenable = BACKEND.loadChunkCached(sourceType, chunkUrl)\n let entry = instrumentedBackendLoadChunks.get(thenable)\n if (entry === undefined) {\n const resolve = instrumentedBackendLoadChunks.set.bind(\n instrumentedBackendLoadChunks,\n thenable,\n loadedChunk\n )\n entry = thenable.then(resolve).catch((cause) => {\n let loadReason: string\n switch (sourceType) {\n case SourceType.Runtime:\n loadReason = `as a runtime dependency of chunk ${sourceData}`\n break\n case SourceType.Parent:\n loadReason = `from module ${sourceData}`\n break\n case SourceType.Update:\n loadReason = 'from an HMR update'\n break\n default:\n invariant(\n sourceType,\n (sourceType) => `Unknown source type: ${sourceType}`\n )\n }\n let error = new Error(\n `Failed to load chunk ${chunkUrl} ${loadReason}${\n cause ? `: ${cause}` : ''\n }`,\n cause ? { cause } : undefined\n )\n error.name = 'ChunkLoadError'\n throw error\n })\n instrumentedBackendLoadChunks.set(thenable, entry)\n }\n\n return entry\n}\n\n// Do not make this async. React relies on referential equality of the returned Promise.\nfunction loadChunkPath(\n sourceType: SourceType,\n sourceData: SourceData,\n chunkPath: ChunkPath\n): Promise {\n const url = getChunkRelativeUrl(chunkPath)\n return loadChunkByUrlInternal(sourceType, sourceData, url)\n}\n\n/**\n * Returns an absolute url to an asset.\n */\nfunction resolvePathFromModule(\n this: TurbopackBaseContext,\n moduleId: string\n): string {\n const exported = this.r(moduleId)\n return exported?.default ?? exported\n}\nbrowserContextPrototype.R = resolvePathFromModule\n\n/**\n * no-op for browser\n * @param modulePath\n */\nfunction resolveAbsolutePath(modulePath?: string): string {\n return `/ROOT/${modulePath ?? ''}`\n}\nbrowserContextPrototype.P = resolveAbsolutePath\n\n/**\n * Returns a blob URL for the worker.\n * @param chunks list of chunks to load\n */\nfunction getWorkerBlobURL(chunks: ChunkPath[]): string {\n // It is important to reverse the array so when bootstrapping we can infer what chunk is being\n // evaluated by poping urls off of this array. See `getPathFromScript`\n let bootstrap = `self.TURBOPACK_WORKER_LOCATION = ${JSON.stringify(location.origin)};\nself.TURBOPACK_CHUNK_SUFFIX = ${JSON.stringify(CHUNK_SUFFIX)};\nself.NEXT_DEPLOYMENT_ID = ${JSON.stringify((globalThis as any).NEXT_DEPLOYMENT_ID)};\nself.TURBOPACK_NEXT_CHUNK_URLS = ${JSON.stringify(chunks.reverse().map(getChunkRelativeUrl), null, 2)};\nimportScripts(...self.TURBOPACK_NEXT_CHUNK_URLS.map(c => self.TURBOPACK_WORKER_LOCATION + c).reverse());`\n let blob = new Blob([bootstrap], { type: 'text/javascript' })\n return URL.createObjectURL(blob)\n}\nbrowserContextPrototype.b = getWorkerBlobURL\n\n/**\n * Instantiates a runtime module.\n */\nfunction instantiateRuntimeModule(\n moduleId: ModuleId,\n chunkPath: ChunkPath\n): Module {\n return instantiateModule(moduleId, SourceType.Runtime, chunkPath)\n}\n/**\n * Returns the URL relative to the origin where a chunk can be fetched from.\n */\nfunction getChunkRelativeUrl(chunkPath: ChunkPath | ChunkListPath): ChunkUrl {\n return `${CHUNK_BASE_PATH}${chunkPath\n .split('/')\n .map((p) => encodeURIComponent(p))\n .join('/')}${CHUNK_SUFFIX}` as ChunkUrl\n}\n\n/**\n * Return the ChunkPath from a ChunkScript.\n */\nfunction getPathFromScript(chunkScript: ChunkPath | ChunkScript): ChunkPath\nfunction getPathFromScript(\n chunkScript: ChunkListPath | ChunkListScript\n): ChunkListPath\nfunction getPathFromScript(\n chunkScript: ChunkPath | ChunkListPath | ChunkScript | ChunkListScript\n): ChunkPath | ChunkListPath {\n if (typeof chunkScript === 'string') {\n return chunkScript as ChunkPath | ChunkListPath\n }\n const chunkUrl =\n typeof TURBOPACK_NEXT_CHUNK_URLS !== 'undefined'\n ? TURBOPACK_NEXT_CHUNK_URLS.pop()!\n : chunkScript.getAttribute('src')!\n const src = decodeURIComponent(chunkUrl.replace(/[?#].*$/, ''))\n const path = src.startsWith(CHUNK_BASE_PATH)\n ? src.slice(CHUNK_BASE_PATH.length)\n : src\n return path as ChunkPath | ChunkListPath\n}\n\nconst regexJsUrl = /\\.js(?:\\?[^#]*)?(?:#.*)?$/\n/**\n * Checks if a given path/URL ends with .js, optionally followed by ?query or #fragment.\n */\nfunction isJs(chunkUrlOrPath: ChunkUrl | ChunkPath): boolean {\n return regexJsUrl.test(chunkUrlOrPath)\n}\n\nconst regexCssUrl = /\\.css(?:\\?[^#]*)?(?:#.*)?$/\n/**\n * Checks if a given path/URL ends with .css, optionally followed by ?query or #fragment.\n */\nfunction isCss(chunkUrl: ChunkUrl): boolean {\n return regexCssUrl.test(chunkUrl)\n}\n\nfunction loadWebAssembly(\n this: TurbopackBaseContext,\n chunkPath: ChunkPath,\n edgeModule: () => WebAssembly.Module,\n importsObj: WebAssembly.Imports\n): Promise {\n return BACKEND.loadWebAssembly(\n SourceType.Parent,\n this.m.id,\n chunkPath,\n edgeModule,\n importsObj\n )\n}\ncontextPrototype.w = loadWebAssembly\n\nfunction loadWebAssemblyModule(\n this: TurbopackBaseContext,\n chunkPath: ChunkPath,\n edgeModule: () => WebAssembly.Module\n): Promise {\n return BACKEND.loadWebAssemblyModule(\n SourceType.Parent,\n this.m.id,\n chunkPath,\n edgeModule\n )\n}\ncontextPrototype.u = loadWebAssemblyModule\n"],"names":["browserContextPrototype","Context","prototype","SourceType","moduleFactories","Map","contextPrototype","M","availableModules","availableModuleChunks","factoryNotAvailableMessage","moduleId","sourceType","sourceData","instantiationReason","invariant","loadChunk","chunkData","loadChunkInternal","m","id","l","loadInitialChunk","chunkPath","loadChunkPath","includedList","included","modulesPromises","map","has","get","length","every","p","Promise","all","includedModuleChunksList","moduleChunks","moduleChunksPromises","filter","promise","moduleChunksToLoad","Set","moduleChunk","add","moduleChunkToLoad","set","push","path","includedModuleChunk","loadedChunk","resolve","undefined","instrumentedBackendLoadChunks","WeakMap","loadChunkByUrl","chunkUrl","loadChunkByUrlInternal","L","thenable","BACKEND","loadChunkCached","entry","bind","then","catch","cause","loadReason","error","Error","name","url","getChunkRelativeUrl","resolvePathFromModule","exported","r","default","R","resolveAbsolutePath","modulePath","P","getWorkerBlobURL","chunks","bootstrap","JSON","stringify","location","origin","CHUNK_SUFFIX","globalThis","NEXT_DEPLOYMENT_ID","reverse","blob","Blob","type","URL","createObjectURL","b","instantiateRuntimeModule","instantiateModule","CHUNK_BASE_PATH","split","encodeURIComponent","join","getPathFromScript","chunkScript","TURBOPACK_NEXT_CHUNK_URLS","pop","getAttribute","src","decodeURIComponent","replace","startsWith","slice","regexJsUrl","isJs","chunkUrlOrPath","test","regexCssUrl","isCss","loadWebAssembly","edgeModule","importsObj","w","loadWebAssemblyModule","u"],"mappings":"AAAA;;;;;;CAMC,GAED,oDAAoD,GAEpD,6CAA6C;AAC7C,yDAAyD;AAEzD,mEAAmE;AAgBnE,MAAMA,0BACJC,QAAQC,SAAS;AAyBnB,IAAA,AAAKC,oCAAAA;IACH;;;;GAIC;IAED;;;GAGC;IAED;;;;GA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AAMkE,aAAa;AACnB;;CAEC,GACD,SAASC,KAAKC,cAAoC;IAChD,OAAOF,WAAWG,IAAI,CAACD;AACzB;AAEA,MAAME,cAAc;AACpB;;CAEC,GACD,SAASC,MAAM/D,QAAkB;IAC/B,OAAO8D,YAAYD,IAAI,CAAC7D;AAC1B;AAEA,SAASgE,gBAEPjG,SAAoB,EACpBkG,UAAoC,EACpCC,UAA+B;IAE/B,OAAO9D,QAAQ4D,eAAe,IAE5B,IAAI,CAACrG,CAAC,CAACC,EAAE,EACTG,WACAkG,YACAC;AAEJ;AACApH,iBAAiBqH,CAAC,GAAGH;AAErB,SAASI,sBAEPrG,SAAoB,EACpBkG,UAAoC;IAEpC,OAAO7D,QAAQgE,qBAAqB,IAElC,IAAI,CAACzG,CAAC,CAACC,EAAE,EACTG,WACAkG;AAEJ;AACAnH,iBAAiBuH,CAAC,GAAGD","ignoreList":[0]}}, + {"offset": {"line": 743, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/browser/runtime/base/dev-base.ts"],"sourcesContent":["/// \n/// \n/// \n\ninterface TurbopackDevContext extends TurbopackBrowserBaseContext {\n k: RefreshContext\n}\n\nconst devContextPrototype = Context.prototype as TurbopackDevContext\n\n/**\n * This file contains runtime types and functions that are shared between all\n * Turbopack *development* ECMAScript runtimes.\n *\n * It will be appended to the runtime code of each runtime right after the\n * shared runtime utils.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\nconst devModuleCache: ModuleCache = Object.create(null)\ndevContextPrototype.c = devModuleCache\n\n// This file must not use `import` and `export` statements. Otherwise, it\n// becomes impossible to augment interfaces declared in ``d files\n// (e.g. `Module`). Hence, the need for `import()` here.\ntype RefreshRuntimeGlobals =\n import('@next/react-refresh-utils/dist/runtime').RefreshRuntimeGlobals\n\ndeclare var $RefreshHelpers$: RefreshRuntimeGlobals['$RefreshHelpers$']\ndeclare var $RefreshReg$: RefreshRuntimeGlobals['$RefreshReg$']\ndeclare var $RefreshSig$: RefreshRuntimeGlobals['$RefreshSig$']\ndeclare var $RefreshInterceptModuleExecution$: RefreshRuntimeGlobals['$RefreshInterceptModuleExecution$']\n\ntype RefreshContext = {\n register: RefreshRuntimeGlobals['$RefreshReg$']\n signature: RefreshRuntimeGlobals['$RefreshSig$']\n registerExports: typeof registerExportsAndSetupBoundaryForReactRefresh\n}\n\ntype RefreshHelpers = RefreshRuntimeGlobals['$RefreshHelpers$']\n\ntype ModuleFactory = (\n this: Module['exports'],\n context: TurbopackDevContext\n) => unknown\n\ninterface DevRuntimeBackend {\n reloadChunk?: (chunkUrl: ChunkUrl) => Promise\n unloadChunk?: (chunkUrl: ChunkUrl) => void\n restart: () => void\n}\n\nclass UpdateApplyError extends Error {\n name = 'UpdateApplyError'\n\n dependencyChain: ModuleId[]\n\n constructor(message: string, dependencyChain: ModuleId[]) {\n super(message)\n this.dependencyChain = dependencyChain\n }\n}\n\n/**\n * Module IDs that are instantiated as part of the runtime of a chunk.\n */\nconst runtimeModules: Set = new Set()\n\n/**\n * Map from module ID to the chunks that contain this module.\n *\n * In HMR, we need to keep track of which modules are contained in which so\n * chunks. This is so we don't eagerly dispose of a module when it is removed\n * from chunk A, but still exists in chunk B.\n */\nconst moduleChunksMap: Map> = new Map()\n/**\n * Map from a chunk path to all modules it contains.\n */\nconst chunkModulesMap: Map> = new Map()\n/**\n * Chunk lists that contain a runtime. When these chunk lists receive an update\n * that can't be reconciled with the current state of the page, we need to\n * reload the runtime entirely.\n */\nconst runtimeChunkLists: Set = new Set()\n/**\n * Map from a chunk list to the chunk paths it contains.\n */\nconst chunkListChunksMap: Map> = new Map()\n/**\n * Map from a chunk path to the chunk lists it belongs to.\n */\nconst chunkChunkListsMap: Map> = new Map()\n\n/**\n * Maps module IDs to persisted data between executions of their hot module\n * implementation (`hot.data`).\n */\nconst moduleHotData: Map = new Map()\n/**\n * Maps module instances to their hot module state.\n */\nconst moduleHotState: Map = new Map()\n/**\n * Modules that call `module.hot.invalidate()` (while being updated).\n */\nconst queuedInvalidatedModules: Set = new Set()\n\n/**\n * Gets or instantiates a runtime module.\n */\n// @ts-ignore\nfunction getOrInstantiateRuntimeModule(\n chunkPath: ChunkPath,\n moduleId: ModuleId\n): Module {\n const module = devModuleCache[moduleId]\n if (module) {\n if (module.error) {\n throw module.error\n }\n return module\n }\n\n // @ts-ignore\n return instantiateModule(moduleId, SourceType.Runtime, chunkPath)\n}\n\n/**\n * Retrieves a module from the cache, or instantiate it if it is not cached.\n */\n// @ts-ignore Defined in `runtime-utils.ts`\nconst getOrInstantiateModuleFromParent: GetOrInstantiateModuleFromParent<\n HotModule\n> = (id, sourceModule) => {\n if (!sourceModule.hot.active) {\n console.warn(\n `Unexpected import of module ${id} from module ${sourceModule.id}, which was deleted by an HMR update`\n )\n }\n\n const module = devModuleCache[id]\n\n if (sourceModule.children.indexOf(id) === -1) {\n sourceModule.children.push(id)\n }\n\n if (module) {\n if (module.error) {\n throw module.error\n }\n\n if (module.parents.indexOf(sourceModule.id) === -1) {\n module.parents.push(sourceModule.id)\n }\n\n return module\n }\n\n return instantiateModule(id, SourceType.Parent, sourceModule.id)\n}\n\nfunction DevContext(\n this: TurbopackDevContext,\n module: HotModule,\n exports: Exports,\n refresh: RefreshContext\n) {\n Context.call(this, module, exports)\n this.k = refresh\n}\nDevContext.prototype = Context.prototype\n\ntype DevContextConstructor = {\n new (\n module: HotModule,\n exports: Exports,\n refresh: RefreshContext\n ): TurbopackDevContext\n}\n\nfunction instantiateModule(\n moduleId: ModuleId,\n sourceType: SourceType,\n sourceData: SourceData\n): Module {\n // We are in development, this is always a string.\n let id = moduleId as string\n\n const moduleFactory = moduleFactories.get(id)\n if (typeof moduleFactory !== 'function') {\n // This can happen if modules incorrectly handle HMR disposes/updates,\n // e.g. when they keep a `setTimeout` around which still executes old code\n // and contains e.g. a `require(\"something\")` call.\n throw new Error(\n factoryNotAvailableMessage(id, sourceType, sourceData) +\n ' It might have been deleted in an HMR update.'\n )\n }\n\n const hotData = moduleHotData.get(id)!\n const { hot, hotState } = createModuleHot(id, hotData)\n\n let parents: ModuleId[]\n switch (sourceType) {\n case SourceType.Runtime:\n runtimeModules.add(id)\n parents = []\n break\n case SourceType.Parent:\n // No need to add this module as a child of the parent module here, this\n // has already been taken care of in `getOrInstantiateModuleFromParent`.\n parents = [sourceData as ModuleId]\n break\n case SourceType.Update:\n parents = (sourceData as ModuleId[]) || []\n break\n default:\n invariant(\n sourceType,\n (sourceType) => `Unknown source type: ${sourceType}`\n )\n }\n\n const module: HotModule = createModuleObject(id) as HotModule\n const exports = module.exports\n module.parents = parents\n module.children = []\n module.hot = hot\n\n devModuleCache[id] = module\n moduleHotState.set(module, hotState)\n\n // NOTE(alexkirsz) This can fail when the module encounters a runtime error.\n try {\n runModuleExecutionHooks(module, (refresh) => {\n const context = new (DevContext as any as DevContextConstructor)(\n module,\n exports,\n refresh\n )\n moduleFactory(context, module, exports)\n })\n } catch (error) {\n module.error = error as any\n throw error\n }\n\n if (module.namespaceObject && module.exports !== module.namespaceObject) {\n // in case of a circular dependency: cjs1 -> esm2 -> cjs1\n interopEsm(module.exports, module.namespaceObject)\n }\n\n return module\n}\n\nconst DUMMY_REFRESH_CONTEXT = {\n register: (_type: unknown, _id: unknown) => {},\n signature: () => (_type: unknown) => {},\n registerExports: (_module: unknown, _helpers: unknown) => {},\n}\n\n/**\n * NOTE(alexkirsz) Webpack has a \"module execution\" interception hook that\n * Next.js' React Refresh runtime hooks into to add module context to the\n * refresh registry.\n */\nfunction runModuleExecutionHooks(\n module: HotModule,\n executeModule: (ctx: RefreshContext) => void\n) {\n if (typeof globalThis.$RefreshInterceptModuleExecution$ === 'function') {\n const cleanupReactRefreshIntercept =\n globalThis.$RefreshInterceptModuleExecution$(module.id)\n try {\n executeModule({\n register: globalThis.$RefreshReg$,\n signature: globalThis.$RefreshSig$,\n registerExports: registerExportsAndSetupBoundaryForReactRefresh,\n })\n } finally {\n // Always cleanup the intercept, even if module execution failed.\n cleanupReactRefreshIntercept()\n }\n } else {\n // If the react refresh hooks are not installed we need to bind dummy functions.\n // This is expected when running in a Web Worker. It is also common in some of\n // our test environments.\n executeModule(DUMMY_REFRESH_CONTEXT)\n }\n}\n\n/**\n * This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts\n */\nfunction registerExportsAndSetupBoundaryForReactRefresh(\n module: HotModule,\n helpers: RefreshHelpers\n) {\n const currentExports = module.exports\n const prevExports = module.hot.data.prevExports ?? null\n\n helpers.registerExportsForReactRefresh(currentExports, module.id)\n\n // A module can be accepted automatically based on its exports, e.g. when\n // it is a Refresh Boundary.\n if (helpers.isReactRefreshBoundary(currentExports)) {\n // Save the previous exports on update, so we can compare the boundary\n // signatures.\n module.hot.dispose((data) => {\n data.prevExports = currentExports\n })\n // Unconditionally accept an update to this module, we'll check if it's\n // still a Refresh Boundary later.\n module.hot.accept()\n\n // This field is set when the previous version of this module was a\n // Refresh Boundary, letting us know we need to check for invalidation or\n // enqueue an update.\n if (prevExports !== null) {\n // A boundary can become ineligible if its exports are incompatible\n // with the previous exports.\n //\n // For example, if you add/remove/change exports, we'll want to\n // re-execute the importing modules, and force those components to\n // re-render. Similarly, if you convert a class component to a\n // function, we want to invalidate the boundary.\n if (\n helpers.shouldInvalidateReactRefreshBoundary(\n helpers.getRefreshBoundarySignature(prevExports),\n helpers.getRefreshBoundarySignature(currentExports)\n )\n ) {\n module.hot.invalidate()\n } else {\n helpers.scheduleUpdate()\n }\n }\n } else {\n // Since we just executed the code for the module, it's possible that the\n // new exports made it ineligible for being a boundary.\n // We only care about the case when we were _previously_ a boundary,\n // because we already accepted this update (accidental side effect).\n const isNoLongerABoundary = prevExports !== null\n if (isNoLongerABoundary) {\n module.hot.invalidate()\n }\n }\n}\n\nfunction formatDependencyChain(dependencyChain: ModuleId[]): string {\n return `Dependency chain: ${dependencyChain.join(' -> ')}`\n}\n\nfunction computeOutdatedModules(\n added: Map,\n modified: Map\n): {\n outdatedModules: Set\n newModuleFactories: Map\n} {\n const newModuleFactories = new Map()\n\n for (const [moduleId, entry] of added) {\n if (entry != null) {\n newModuleFactories.set(moduleId, _eval(entry))\n }\n }\n\n const outdatedModules = computedInvalidatedModules(modified.keys())\n\n for (const [moduleId, entry] of modified) {\n newModuleFactories.set(moduleId, _eval(entry))\n }\n\n return { outdatedModules, newModuleFactories }\n}\n\nfunction computedInvalidatedModules(\n invalidated: Iterable\n): Set {\n const outdatedModules = new Set()\n\n for (const moduleId of invalidated) {\n const effect = getAffectedModuleEffects(moduleId)\n\n switch (effect.type) {\n case 'unaccepted':\n throw new UpdateApplyError(\n `cannot apply update: unaccepted module. ${formatDependencyChain(\n effect.dependencyChain\n )}.`,\n effect.dependencyChain\n )\n case 'self-declined':\n throw new UpdateApplyError(\n `cannot apply update: self-declined module. ${formatDependencyChain(\n effect.dependencyChain\n )}.`,\n effect.dependencyChain\n )\n case 'accepted':\n for (const outdatedModuleId of effect.outdatedModules) {\n outdatedModules.add(outdatedModuleId)\n }\n break\n // TODO(alexkirsz) Dependencies: handle dependencies effects.\n default:\n invariant(effect, (effect) => `Unknown effect type: ${effect?.type}`)\n }\n }\n\n return outdatedModules\n}\n\nfunction computeOutdatedSelfAcceptedModules(\n outdatedModules: Iterable\n): { moduleId: ModuleId; errorHandler: true | Function }[] {\n const outdatedSelfAcceptedModules: {\n moduleId: ModuleId\n errorHandler: true | Function\n }[] = []\n for (const moduleId of outdatedModules) {\n const module = devModuleCache[moduleId]\n const hotState = moduleHotState.get(module)!\n if (module && hotState.selfAccepted && !hotState.selfInvalidated) {\n outdatedSelfAcceptedModules.push({\n moduleId,\n errorHandler: hotState.selfAccepted,\n })\n }\n }\n return outdatedSelfAcceptedModules\n}\n\n/**\n * Adds, deletes, and moves modules between chunks. This must happen before the\n * dispose phase as it needs to know which modules were removed from all chunks,\n * which we can only compute *after* taking care of added and moved modules.\n */\nfunction updateChunksPhase(\n chunksAddedModules: Map>,\n chunksDeletedModules: Map>\n): { disposedModules: Set } {\n for (const [chunkPath, addedModuleIds] of chunksAddedModules) {\n for (const moduleId of addedModuleIds) {\n addModuleToChunk(moduleId, chunkPath)\n }\n }\n\n const disposedModules: Set = new Set()\n for (const [chunkPath, addedModuleIds] of chunksDeletedModules) {\n for (const moduleId of addedModuleIds) {\n if (removeModuleFromChunk(moduleId, chunkPath)) {\n disposedModules.add(moduleId)\n }\n }\n }\n\n return { disposedModules }\n}\n\nfunction disposePhase(\n outdatedModules: Iterable,\n disposedModules: Iterable\n): { outdatedModuleParents: Map> } {\n for (const moduleId of outdatedModules) {\n disposeModule(moduleId, 'replace')\n }\n\n for (const moduleId of disposedModules) {\n disposeModule(moduleId, 'clear')\n }\n\n // Removing modules from the module cache is a separate step.\n // We also want to keep track of previous parents of the outdated modules.\n const outdatedModuleParents = new Map()\n for (const moduleId of outdatedModules) {\n const oldModule = devModuleCache[moduleId]\n outdatedModuleParents.set(moduleId, oldModule?.parents)\n delete devModuleCache[moduleId]\n }\n\n // TODO(alexkirsz) Dependencies: remove outdated dependency from module\n // children.\n\n return { outdatedModuleParents }\n}\n\n/**\n * Disposes of an instance of a module.\n *\n * Returns the persistent hot data that should be kept for the next module\n * instance.\n *\n * NOTE: mode = \"replace\" will not remove modules from the devModuleCache\n * This must be done in a separate step afterwards.\n * This is important because all modules need to be disposed to update the\n * parent/child relationships before they are actually removed from the devModuleCache.\n * If this was done in this method, the following disposeModule calls won't find\n * the module from the module id in the cache.\n */\nfunction disposeModule(moduleId: ModuleId, mode: 'clear' | 'replace') {\n const module = devModuleCache[moduleId]\n if (!module) {\n return\n }\n\n const hotState = moduleHotState.get(module)!\n const data = {}\n\n // Run the `hot.dispose` handler, if any, passing in the persistent\n // `hot.data` object.\n for (const disposeHandler of hotState.disposeHandlers) {\n disposeHandler(data)\n }\n\n // This used to warn in `getOrInstantiateModuleFromParent` when a disposed\n // module is still importing other modules.\n module.hot.active = false\n\n moduleHotState.delete(module)\n\n // TODO(alexkirsz) Dependencies: delete the module from outdated deps.\n\n // Remove the disposed module from its children's parent list.\n // It will be added back once the module re-instantiates and imports its\n // children again.\n for (const childId of module.children) {\n const child = devModuleCache[childId]\n if (!child) {\n continue\n }\n\n const idx = child.parents.indexOf(module.id)\n if (idx >= 0) {\n child.parents.splice(idx, 1)\n }\n }\n\n switch (mode) {\n case 'clear':\n delete devModuleCache[module.id]\n moduleHotData.delete(module.id)\n break\n case 'replace':\n moduleHotData.set(module.id, data)\n break\n default:\n invariant(mode, (mode) => `invalid mode: ${mode}`)\n }\n}\n\nfunction applyPhase(\n outdatedSelfAcceptedModules: {\n moduleId: ModuleId\n errorHandler: true | Function\n }[],\n newModuleFactories: Map,\n outdatedModuleParents: Map>,\n reportError: (err: any) => void\n) {\n // Update module factories.\n for (const [moduleId, factory] of newModuleFactories.entries()) {\n applyModuleFactoryName(factory)\n moduleFactories.set(moduleId, factory)\n }\n\n // TODO(alexkirsz) Run new runtime entries here.\n\n // TODO(alexkirsz) Dependencies: call accept handlers for outdated deps.\n\n // Re-instantiate all outdated self-accepted modules.\n for (const { moduleId, errorHandler } of outdatedSelfAcceptedModules) {\n try {\n instantiateModule(\n moduleId,\n SourceType.Update,\n outdatedModuleParents.get(moduleId)\n )\n } catch (err) {\n if (typeof errorHandler === 'function') {\n try {\n errorHandler(err, { moduleId, module: devModuleCache[moduleId] })\n } catch (err2) {\n reportError(err2)\n reportError(err)\n }\n } else {\n reportError(err)\n }\n }\n }\n}\n\nfunction applyUpdate(update: PartialUpdate) {\n switch (update.type) {\n case 'ChunkListUpdate':\n applyChunkListUpdate(update)\n break\n default:\n invariant(update, (update) => `Unknown update type: ${update.type}`)\n }\n}\n\nfunction applyChunkListUpdate(update: ChunkListUpdate) {\n if (update.merged != null) {\n for (const merged of update.merged) {\n switch (merged.type) {\n case 'EcmascriptMergedUpdate':\n applyEcmascriptMergedUpdate(merged)\n break\n default:\n invariant(merged, (merged) => `Unknown merged type: ${merged.type}`)\n }\n }\n }\n\n if (update.chunks != null) {\n for (const [chunkPath, chunkUpdate] of Object.entries(\n update.chunks\n ) as Array<[ChunkPath, ChunkUpdate]>) {\n const chunkUrl = getChunkRelativeUrl(chunkPath)\n\n switch (chunkUpdate.type) {\n case 'added':\n BACKEND.loadChunkCached(SourceType.Update, chunkUrl)\n break\n case 'total':\n DEV_BACKEND.reloadChunk?.(chunkUrl)\n break\n case 'deleted':\n DEV_BACKEND.unloadChunk?.(chunkUrl)\n break\n case 'partial':\n invariant(\n chunkUpdate.instruction,\n (instruction) =>\n `Unknown partial instruction: ${JSON.stringify(instruction)}.`\n )\n break\n default:\n invariant(\n chunkUpdate,\n (chunkUpdate) => `Unknown chunk update type: ${chunkUpdate.type}`\n )\n }\n }\n }\n}\n\nfunction applyEcmascriptMergedUpdate(update: EcmascriptMergedUpdate) {\n const { entries = {}, chunks = {} } = update\n const { added, modified, chunksAdded, chunksDeleted } = computeChangedModules(\n entries,\n chunks\n )\n const { outdatedModules, newModuleFactories } = computeOutdatedModules(\n added,\n modified\n )\n const { disposedModules } = updateChunksPhase(chunksAdded, chunksDeleted)\n\n applyInternal(outdatedModules, disposedModules, newModuleFactories)\n}\n\nfunction applyInvalidatedModules(outdatedModules: Set) {\n if (queuedInvalidatedModules.size > 0) {\n computedInvalidatedModules(queuedInvalidatedModules).forEach((moduleId) => {\n outdatedModules.add(moduleId)\n })\n\n queuedInvalidatedModules.clear()\n }\n\n return outdatedModules\n}\n\nfunction applyInternal(\n outdatedModules: Set,\n disposedModules: Iterable,\n newModuleFactories: Map\n) {\n outdatedModules = applyInvalidatedModules(outdatedModules)\n\n const outdatedSelfAcceptedModules =\n computeOutdatedSelfAcceptedModules(outdatedModules)\n\n const { outdatedModuleParents } = disposePhase(\n outdatedModules,\n disposedModules\n )\n\n // we want to continue on error and only throw the error after we tried applying all updates\n let error: any\n\n function reportError(err: any) {\n if (!error) error = err\n }\n\n applyPhase(\n outdatedSelfAcceptedModules,\n newModuleFactories,\n outdatedModuleParents,\n reportError\n )\n\n if (error) {\n throw error\n }\n\n if (queuedInvalidatedModules.size > 0) {\n applyInternal(new Set(), [], new Map())\n }\n}\n\nfunction computeChangedModules(\n entries: Record,\n updates: Record\n): {\n added: Map\n modified: Map\n deleted: Set\n chunksAdded: Map>\n chunksDeleted: Map>\n} {\n const chunksAdded = new Map()\n const chunksDeleted = new Map()\n const added: Map = new Map()\n const modified = new Map()\n const deleted: Set = new Set()\n\n for (const [chunkPath, mergedChunkUpdate] of Object.entries(updates) as Array<\n [ChunkPath, EcmascriptMergedChunkUpdate]\n >) {\n switch (mergedChunkUpdate.type) {\n case 'added': {\n const updateAdded = new Set(mergedChunkUpdate.modules)\n for (const moduleId of updateAdded) {\n added.set(moduleId, entries[moduleId])\n }\n chunksAdded.set(chunkPath, updateAdded)\n break\n }\n case 'deleted': {\n // We could also use `mergedChunkUpdate.modules` here.\n const updateDeleted = new Set(chunkModulesMap.get(chunkPath))\n for (const moduleId of updateDeleted) {\n deleted.add(moduleId)\n }\n chunksDeleted.set(chunkPath, updateDeleted)\n break\n }\n case 'partial': {\n const updateAdded = new Set(mergedChunkUpdate.added)\n const updateDeleted = new Set(mergedChunkUpdate.deleted)\n for (const moduleId of updateAdded) {\n added.set(moduleId, entries[moduleId])\n }\n for (const moduleId of updateDeleted) {\n deleted.add(moduleId)\n }\n chunksAdded.set(chunkPath, updateAdded)\n chunksDeleted.set(chunkPath, updateDeleted)\n break\n }\n default:\n invariant(\n mergedChunkUpdate,\n (mergedChunkUpdate) =>\n `Unknown merged chunk update type: ${mergedChunkUpdate.type}`\n )\n }\n }\n\n // If a module was added from one chunk and deleted from another in the same update,\n // consider it to be modified, as it means the module was moved from one chunk to another\n // AND has new code in a single update.\n for (const moduleId of added.keys()) {\n if (deleted.has(moduleId)) {\n added.delete(moduleId)\n deleted.delete(moduleId)\n }\n }\n\n for (const [moduleId, entry] of Object.entries(entries)) {\n // Modules that haven't been added to any chunk but have new code are considered\n // to be modified.\n // This needs to be under the previous loop, as we need it to get rid of modules\n // that were added and deleted in the same update.\n if (!added.has(moduleId)) {\n modified.set(moduleId, entry)\n }\n }\n\n return { added, deleted, modified, chunksAdded, chunksDeleted }\n}\n\ntype ModuleEffect =\n | {\n type: 'unaccepted'\n dependencyChain: ModuleId[]\n }\n | {\n type: 'self-declined'\n dependencyChain: ModuleId[]\n moduleId: ModuleId\n }\n | {\n type: 'accepted'\n moduleId: ModuleId\n outdatedModules: Set\n }\n\nfunction getAffectedModuleEffects(moduleId: ModuleId): ModuleEffect {\n const outdatedModules: Set = new Set()\n\n type QueueItem = { moduleId?: ModuleId; dependencyChain: ModuleId[] }\n\n const queue: QueueItem[] = [\n {\n moduleId,\n dependencyChain: [],\n },\n ]\n\n let nextItem\n while ((nextItem = queue.shift())) {\n const { moduleId, dependencyChain } = nextItem\n\n if (moduleId != null) {\n if (outdatedModules.has(moduleId)) {\n // Avoid infinite loops caused by cycles between modules in the dependency chain.\n continue\n }\n\n outdatedModules.add(moduleId)\n }\n\n // We've arrived at the runtime of the chunk, which means that nothing\n // else above can accept this update.\n if (moduleId === undefined) {\n return {\n type: 'unaccepted',\n dependencyChain,\n }\n }\n\n const module = devModuleCache[moduleId]\n const hotState = moduleHotState.get(module)!\n\n if (\n // The module is not in the cache. Since this is a \"modified\" update,\n // it means that the module was never instantiated before.\n !module || // The module accepted itself without invalidating globalThis.\n // TODO is that right?\n (hotState.selfAccepted && !hotState.selfInvalidated)\n ) {\n continue\n }\n\n if (hotState.selfDeclined) {\n return {\n type: 'self-declined',\n dependencyChain,\n moduleId,\n }\n }\n\n if (runtimeModules.has(moduleId)) {\n queue.push({\n moduleId: undefined,\n dependencyChain: [...dependencyChain, moduleId],\n })\n continue\n }\n\n for (const parentId of module.parents) {\n const parent = devModuleCache[parentId]\n\n if (!parent) {\n // TODO(alexkirsz) Is this even possible?\n continue\n }\n\n // TODO(alexkirsz) Dependencies: check accepted and declined\n // dependencies here.\n\n queue.push({\n moduleId: parentId,\n dependencyChain: [...dependencyChain, moduleId],\n })\n }\n }\n\n return {\n type: 'accepted',\n moduleId,\n outdatedModules,\n }\n}\n\nfunction handleApply(chunkListPath: ChunkListPath, update: ServerMessage) {\n switch (update.type) {\n case 'partial': {\n // This indicates that the update is can be applied to the current state of the application.\n applyUpdate(update.instruction)\n break\n }\n case 'restart': {\n // This indicates that there is no way to apply the update to the\n // current state of the application, and that the application must be\n // restarted.\n DEV_BACKEND.restart()\n break\n }\n case 'notFound': {\n // This indicates that the chunk list no longer exists: either the dynamic import which created it was removed,\n // or the page itself was deleted.\n // If it is a dynamic import, we simply discard all modules that the chunk has exclusive access to.\n // If it is a runtime chunk list, we restart the application.\n if (runtimeChunkLists.has(chunkListPath)) {\n DEV_BACKEND.restart()\n } else {\n disposeChunkList(chunkListPath)\n }\n break\n }\n default:\n throw new Error(`Unknown update type: ${update.type}`)\n }\n}\n\nfunction createModuleHot(\n moduleId: ModuleId,\n hotData: HotData\n): { hot: Hot; hotState: HotState } {\n const hotState: HotState = {\n selfAccepted: false,\n selfDeclined: false,\n selfInvalidated: false,\n disposeHandlers: [],\n }\n\n const hot: Hot = {\n // TODO(alexkirsz) This is not defined in the HMR API. It was used to\n // decide whether to warn whenever an HMR-disposed module required other\n // modules. We might want to remove it.\n active: true,\n\n data: hotData ?? {},\n\n // TODO(alexkirsz) Support full (dep, callback, errorHandler) form.\n accept: (\n modules?: string | string[] | AcceptErrorHandler,\n _callback?: AcceptCallback,\n _errorHandler?: AcceptErrorHandler\n ) => {\n if (modules === undefined) {\n hotState.selfAccepted = true\n } else if (typeof modules === 'function') {\n hotState.selfAccepted = modules\n } else {\n throw new Error('unsupported `accept` signature')\n }\n },\n\n decline: (dep) => {\n if (dep === undefined) {\n hotState.selfDeclined = true\n } else {\n throw new Error('unsupported `decline` signature')\n }\n },\n\n dispose: (callback) => {\n hotState.disposeHandlers.push(callback)\n },\n\n addDisposeHandler: (callback) => {\n hotState.disposeHandlers.push(callback)\n },\n\n removeDisposeHandler: (callback) => {\n const idx = hotState.disposeHandlers.indexOf(callback)\n if (idx >= 0) {\n hotState.disposeHandlers.splice(idx, 1)\n }\n },\n\n invalidate: () => {\n hotState.selfInvalidated = true\n queuedInvalidatedModules.add(moduleId)\n },\n\n // NOTE(alexkirsz) This is part of the management API, which we don't\n // implement, but the Next.js React Refresh runtime uses this to decide\n // whether to schedule an update.\n status: () => 'idle',\n\n // NOTE(alexkirsz) Since we always return \"idle\" for now, these are no-ops.\n addStatusHandler: (_handler) => {},\n removeStatusHandler: (_handler) => {},\n\n // NOTE(jridgewell) Check returns the list of updated modules, but we don't\n // want the webpack code paths to ever update (the turbopack paths handle\n // this already).\n check: () => Promise.resolve(null),\n }\n\n return { hot, hotState }\n}\n\n/**\n * Removes a module from a chunk.\n * Returns `true` if there are no remaining chunks including this module.\n */\nfunction removeModuleFromChunk(\n moduleId: ModuleId,\n chunkPath: ChunkPath\n): boolean {\n const moduleChunks = moduleChunksMap.get(moduleId)!\n moduleChunks.delete(chunkPath)\n\n const chunkModules = chunkModulesMap.get(chunkPath)!\n chunkModules.delete(moduleId)\n\n const noRemainingModules = chunkModules.size === 0\n if (noRemainingModules) {\n chunkModulesMap.delete(chunkPath)\n }\n\n const noRemainingChunks = moduleChunks.size === 0\n if (noRemainingChunks) {\n moduleChunksMap.delete(moduleId)\n }\n\n return noRemainingChunks\n}\n\n/**\n * Disposes of a chunk list and its corresponding exclusive chunks.\n */\nfunction disposeChunkList(chunkListPath: ChunkListPath): boolean {\n const chunkPaths = chunkListChunksMap.get(chunkListPath)\n if (chunkPaths == null) {\n return false\n }\n chunkListChunksMap.delete(chunkListPath)\n\n for (const chunkPath of chunkPaths) {\n const chunkChunkLists = chunkChunkListsMap.get(chunkPath)!\n chunkChunkLists.delete(chunkListPath)\n\n if (chunkChunkLists.size === 0) {\n chunkChunkListsMap.delete(chunkPath)\n disposeChunk(chunkPath)\n }\n }\n\n // We must also dispose of the chunk list's chunk itself to ensure it may\n // be reloaded properly in the future.\n const chunkListUrl = getChunkRelativeUrl(chunkListPath)\n\n DEV_BACKEND.unloadChunk?.(chunkListUrl)\n\n return true\n}\n\n/**\n * Disposes of a chunk and its corresponding exclusive modules.\n *\n * @returns Whether the chunk was disposed of.\n */\nfunction disposeChunk(chunkPath: ChunkPath): boolean {\n const chunkUrl = getChunkRelativeUrl(chunkPath)\n // This should happen whether the chunk has any modules in it or not.\n // For instance, CSS chunks have no modules in them, but they still need to be unloaded.\n DEV_BACKEND.unloadChunk?.(chunkUrl)\n\n const chunkModules = chunkModulesMap.get(chunkPath)\n if (chunkModules == null) {\n return false\n }\n chunkModules.delete(chunkPath)\n\n for (const moduleId of chunkModules) {\n const moduleChunks = moduleChunksMap.get(moduleId)!\n moduleChunks.delete(chunkPath)\n\n const noRemainingChunks = moduleChunks.size === 0\n if (noRemainingChunks) {\n moduleChunksMap.delete(moduleId)\n disposeModule(moduleId, 'clear')\n availableModules.delete(moduleId)\n }\n }\n\n return true\n}\n\n/**\n * Adds a module to a chunk.\n */\nfunction addModuleToChunk(moduleId: ModuleId, chunkPath: ChunkPath) {\n let moduleChunks = moduleChunksMap.get(moduleId)\n if (!moduleChunks) {\n moduleChunks = new Set([chunkPath])\n moduleChunksMap.set(moduleId, moduleChunks)\n } else {\n moduleChunks.add(chunkPath)\n }\n\n let chunkModules = chunkModulesMap.get(chunkPath)\n if (!chunkModules) {\n chunkModules = new Set([moduleId])\n chunkModulesMap.set(chunkPath, chunkModules)\n } else {\n chunkModules.add(moduleId)\n }\n}\n\n/**\n * Marks a chunk list as a runtime chunk list. There can be more than one\n * runtime chunk list. For instance, integration tests can have multiple chunk\n * groups loaded at runtime, each with its own chunk list.\n */\nfunction markChunkListAsRuntime(chunkListPath: ChunkListPath) {\n runtimeChunkLists.add(chunkListPath)\n}\n\nfunction registerChunk(registration: ChunkRegistration) {\n const chunkPath = getPathFromScript(registration[0])\n let runtimeParams: RuntimeParams | undefined\n // When bootstrapping we are passed a single runtimeParams object so we can distinguish purely based on length\n if (registration.length === 2) {\n runtimeParams = registration[1] as RuntimeParams\n } else {\n runtimeParams = undefined\n installCompressedModuleFactories(\n registration as CompressedModuleFactories,\n /* offset= */ 1,\n moduleFactories,\n (id: ModuleId) => addModuleToChunk(id, chunkPath)\n )\n }\n return BACKEND.registerChunk(chunkPath, runtimeParams)\n}\n\n/**\n * Subscribes to chunk list updates from the update server and applies them.\n */\nfunction registerChunkList(chunkList: ChunkList) {\n const chunkListScript = chunkList.script\n const chunkListPath = getPathFromScript(chunkListScript)\n // The \"chunk\" is also registered to finish the loading in the backend\n BACKEND.registerChunk(chunkListPath as string as ChunkPath)\n globalThis.TURBOPACK_CHUNK_UPDATE_LISTENERS!.push([\n chunkListPath,\n handleApply.bind(null, chunkListPath),\n ])\n\n // Adding chunks to chunk lists and vice versa.\n const chunkPaths = new Set(chunkList.chunks.map(getChunkPath))\n chunkListChunksMap.set(chunkListPath, chunkPaths)\n for (const chunkPath of chunkPaths) {\n let chunkChunkLists = chunkChunkListsMap.get(chunkPath)\n if (!chunkChunkLists) {\n chunkChunkLists = new Set([chunkListPath])\n chunkChunkListsMap.set(chunkPath, chunkChunkLists)\n } else {\n chunkChunkLists.add(chunkListPath)\n }\n }\n\n if (chunkList.source === 'entry') {\n markChunkListAsRuntime(chunkListPath)\n }\n}\n\nglobalThis.TURBOPACK_CHUNK_UPDATE_LISTENERS ??= []\n"],"names":["devContextPrototype","Context","prototype","devModuleCache","Object","create","c","UpdateApplyError","Error","name","dependencyChain","message","runtimeModules","Set","moduleChunksMap","Map","chunkModulesMap","runtimeChunkLists","chunkListChunksMap","chunkChunkListsMap","moduleHotData","moduleHotState","queuedInvalidatedModules","getOrInstantiateRuntimeModule","chunkPath","moduleId","module","error","instantiateModule","SourceType","Runtime","getOrInstantiateModuleFromParent","id","sourceModule","hot","active","console","warn","children","indexOf","push","parents","Parent","DevContext","exports","refresh","call","k","sourceType","sourceData","moduleFactory","moduleFactories","get","factoryNotAvailableMessage","hotData","hotState","createModuleHot","add","Update","invariant","createModuleObject","set","runModuleExecutionHooks","context","namespaceObject","interopEsm","DUMMY_REFRESH_CONTEXT","register","_type","_id","signature","registerExports","_module","_helpers","executeModule","globalThis","$RefreshInterceptModuleExecution$","cleanupReactRefreshIntercept","$RefreshReg$","$RefreshSig$","registerExportsAndSetupBoundaryForReactRefresh","helpers","currentExports","prevExports","data","registerExportsForReactRefresh","isReactRefreshBoundary","dispose","accept","shouldInvalidateReactRefreshBoundary","getRefreshBoundarySignature","invalidate","scheduleUpdate","isNoLongerABoundary","formatDependencyChain","join","computeOutdatedModules","added","modified","newModuleFactories","entry","_eval","outdatedModules","computedInvalidatedModules","keys","invalidated","effect","getAffectedModuleEffects","type","outdatedModuleId","computeOutdatedSelfAcceptedModules","outdatedSelfAcceptedModules","selfAccepted","selfInvalidated","errorHandler","updateChunksPhase","chunksAddedModules","chunksDeletedModules","addedModuleIds","addModuleToChunk","disposedModules","removeModuleFromChunk","disposePhase","disposeModule","outdatedModuleParents","oldModule","mode","disposeHandler","disposeHandlers","delete","childId","child","idx","splice","applyPhase","reportError","factory","entries","applyModuleFactoryName","err","err2","applyUpdate","update","applyChunkListUpdate","merged","applyEcmascriptMergedUpdate","chunks","chunkUpdate","chunkUrl","getChunkRelativeUrl","BACKEND","loadChunkCached","DEV_BACKEND","reloadChunk","unloadChunk","instruction","JSON","stringify","chunksAdded","chunksDeleted","computeChangedModules","applyInternal","applyInvalidatedModules","size","forEach","clear","updates","deleted","mergedChunkUpdate","updateAdded","modules","updateDeleted","has","queue","nextItem","shift","undefined","selfDeclined","parentId","parent","handleApply","chunkListPath","restart","disposeChunkList","_callback","_errorHandler","decline","dep","callback","addDisposeHandler","removeDisposeHandler","status","addStatusHandler","_handler","removeStatusHandler","check","Promise","resolve","moduleChunks","chunkModules","noRemainingModules","noRemainingChunks","chunkPaths","chunkChunkLists","disposeChunk","chunkListUrl","availableModules","markChunkListAsRuntime","registerChunk","registration","getPathFromScript","runtimeParams","length","installCompressedModuleFactories","registerChunkList","chunkList","chunkListScript","script","TURBOPACK_CHUNK_UPDATE_LIST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AAK,MAAMlL,aAAakL,WAAY;QAClC,IAAIC,kBAAkBxL,mBAAmBiC,GAAG,CAAC5B;QAC7C,IAAI,CAACmL,iBAAiB;YACpBA,kBAAkB,IAAI9L,IAAI;gBAACwK;aAAc;YACzClK,mBAAmB0C,GAAG,CAACrC,WAAWmL;QACpC,OAAO;YACLA,gBAAgBlJ,GAAG,CAAC4H;QACtB;IACF;IAEA,IAAIkC,UAAUO,MAAM,KAAK,SAAS;QAChCf,uBAAuB1B;IACzB;AACF;AAEA1G,WAAW+I,gCAAgC,KAAK,EAAE","ignoreList":[0]}}, + {"offset": {"line": 1597, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/browser/runtime/dom/runtime-backend-dom.ts"],"sourcesContent":["/**\n * This file contains the runtime code specific to the Turbopack ECMAScript DOM runtime.\n *\n * It will be appended to the base runtime code.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n/// \n\nfunction getChunkSuffixFromScriptSrc() {\n // TURBOPACK_CHUNK_SUFFIX is set in web workers\n return (\n (self.TURBOPACK_CHUNK_SUFFIX ??\n document?.currentScript\n ?.getAttribute?.('src')\n ?.replace(/^(.*(?=\\?)|^.*$)/, '')) ||\n ''\n )\n}\n\ntype ChunkResolver = {\n resolved: boolean\n loadingStarted: boolean\n resolve: () => void\n reject: (error?: Error) => void\n promise: Promise\n}\n\nlet BACKEND: RuntimeBackend\n\n/**\n * Maps chunk paths to the corresponding resolver.\n */\nconst chunkResolvers: Map = new Map()\n\n;(() => {\n BACKEND = {\n async registerChunk(chunkPath, params) {\n const chunkUrl = getChunkRelativeUrl(chunkPath)\n\n const resolver = getOrCreateResolver(chunkUrl)\n resolver.resolve()\n\n if (params == null) {\n return\n }\n\n for (const otherChunkData of params.otherChunks) {\n const otherChunkPath = getChunkPath(otherChunkData)\n const otherChunkUrl = getChunkRelativeUrl(otherChunkPath)\n\n // Chunk might have started loading, so we want to avoid triggering another load.\n getOrCreateResolver(otherChunkUrl)\n }\n\n // This waits for chunks to be loaded, but also marks included items as available.\n await Promise.all(\n params.otherChunks.map((otherChunkData) =>\n loadInitialChunk(chunkPath, otherChunkData)\n )\n )\n\n if (params.runtimeModuleIds.length > 0) {\n for (const moduleId of params.runtimeModuleIds) {\n getOrInstantiateRuntimeModule(chunkPath, moduleId)\n }\n }\n },\n\n /**\n * Loads the given chunk, and returns a promise that resolves once the chunk\n * has been loaded.\n */\n loadChunkCached(sourceType: SourceType, chunkUrl: ChunkUrl) {\n return doLoadChunk(sourceType, chunkUrl)\n },\n\n async loadWebAssembly(\n _sourceType: SourceType,\n _sourceData: SourceData,\n wasmChunkPath: ChunkPath,\n _edgeModule: () => WebAssembly.Module,\n importsObj: WebAssembly.Imports\n ): Promise {\n const req = fetchWebAssembly(wasmChunkPath)\n\n const { instance } = await WebAssembly.instantiateStreaming(\n req,\n importsObj\n )\n\n return instance.exports\n },\n\n async loadWebAssemblyModule(\n _sourceType: SourceType,\n _sourceData: SourceData,\n wasmChunkPath: ChunkPath,\n _edgeModule: () => WebAssembly.Module\n ): Promise {\n const req = fetchWebAssembly(wasmChunkPath)\n\n return await WebAssembly.compileStreaming(req)\n },\n }\n\n function getOrCreateResolver(chunkUrl: ChunkUrl): ChunkResolver {\n let resolver = chunkResolvers.get(chunkUrl)\n if (!resolver) {\n let resolve: () => void\n let reject: (error?: Error) => void\n const promise = new Promise((innerResolve, innerReject) => {\n resolve = innerResolve\n reject = innerReject\n })\n resolver = {\n resolved: false,\n loadingStarted: false,\n promise,\n resolve: () => {\n resolver!.resolved = true\n resolve()\n },\n reject: reject!,\n }\n chunkResolvers.set(chunkUrl, resolver)\n }\n return resolver\n }\n\n /**\n * Loads the given chunk, and returns a promise that resolves once the chunk\n * has been loaded.\n */\n function doLoadChunk(sourceType: SourceType, chunkUrl: ChunkUrl) {\n const resolver = getOrCreateResolver(chunkUrl)\n if (resolver.loadingStarted) {\n return resolver.promise\n }\n\n if (sourceType === SourceType.Runtime) {\n // We don't need to load chunks references from runtime code, as they're already\n // present in the DOM.\n resolver.loadingStarted = true\n\n if (isCss(chunkUrl)) {\n // CSS chunks do not register themselves, and as such must be marked as\n // loaded instantly.\n resolver.resolve()\n }\n\n // We need to wait for JS chunks to register themselves within `registerChunk`\n // before we can start instantiating runtime modules, hence the absence of\n // `resolver.resolve()` in this branch.\n\n return resolver.promise\n }\n\n if (typeof importScripts === 'function') {\n // We're in a web worker\n if (isCss(chunkUrl)) {\n // ignore\n } else if (isJs(chunkUrl)) {\n self.TURBOPACK_NEXT_CHUNK_URLS!.push(chunkUrl)\n importScripts(TURBOPACK_WORKER_LOCATION + chunkUrl)\n } else {\n throw new Error(\n `can't infer type of chunk from URL ${chunkUrl} in worker`\n )\n }\n } else {\n // TODO(PACK-2140): remove this once all filenames are guaranteed to be escaped.\n const decodedChunkUrl = decodeURI(chunkUrl)\n\n if (isCss(chunkUrl)) {\n const previousLinks = document.querySelectorAll(\n `link[rel=stylesheet][href=\"${chunkUrl}\"],link[rel=stylesheet][href^=\"${chunkUrl}?\"],link[rel=stylesheet][href=\"${decodedChunkUrl}\"],link[rel=stylesheet][href^=\"${decodedChunkUrl}?\"]`\n )\n if (previousLinks.length > 0) {\n // CSS chunks do not register themselves, and as such must be marked as\n // loaded instantly.\n resolver.resolve()\n } else {\n const link = document.createElement('link')\n link.rel = 'stylesheet'\n link.href = chunkUrl\n link.onerror = () => {\n resolver.reject()\n }\n link.onload = () => {\n // CSS chunks do not register themselves, and as such must be marked as\n // loaded instantly.\n resolver.resolve()\n }\n // Append to the `head` for webpack compatibility.\n document.head.appendChild(link)\n }\n } else if (isJs(chunkUrl)) {\n const previousScripts = document.querySelectorAll(\n `script[src=\"${chunkUrl}\"],script[src^=\"${chunkUrl}?\"],script[src=\"${decodedChunkUrl}\"],script[src^=\"${decodedChunkUrl}?\"]`\n )\n if (previousScripts.length > 0) {\n // There is this edge where the script already failed loading, but we\n // can't detect that. The Promise will never resolve in this case.\n for (const script of Array.from(previousScripts)) {\n script.addEventListener('error', () => {\n resolver.reject()\n })\n }\n } else {\n const script = document.createElement('script')\n script.src = chunkUrl\n // We'll only mark the chunk as loaded once the script has been executed,\n // which happens in `registerChunk`. Hence the absence of `resolve()` in\n // this branch.\n script.onerror = () => {\n resolver.reject()\n }\n // Append to the `head` for webpack compatibility.\n document.head.appendChild(script)\n }\n } else {\n throw new Error(`can't infer type of chunk from URL ${chunkUrl}`)\n }\n }\n\n resolver.loadingStarted = true\n return resolver.promise\n }\n\n function fetchWebAssembly(wasmChunkPath: ChunkPath) {\n return fetch(getChunkRelativeUrl(wasmChunkPath))\n }\n})()\n"],"names":["getChunkSuffixFromScriptSrc","self","TURBOPACK_CHUNK_SUFFIX","document","currentScript","getAttribute","replace","BACKEND","chunkResolvers","Map","registerChunk","chunkPath","params","chunkUrl","getChunkRelativeUrl","resolver","getOrCreateResolver","resolve","otherChunkData","otherChunks","otherChunkPath","getChunkPath","otherChunkUrl","Promise","all","map","loadInitialChunk","runtimeModuleIds","length","moduleId","getOrInstantiateRuntimeModule","loadChunkCached","sourceType","doLoadChunk","loadWebAssembly","_sourceType","_sourceData","wasmChunkPath","_edgeModule","importsObj","req","fetchWebAssembly","instance","WebAssembly","instantiateStreaming","exports","loadWebAssemblyModule","compileStreaming","get","reject","promise","innerResolve","innerReject","resolved","loadingStarted","set","SourceType","Runtime","isCss","importScripts","isJs","TURBOPACK_NEXT_CHUNK_URLS","push","TURBOPACK_WORKER_LOCATION","Error","decodedChunkUrl","decodeURI","previousLinks","querySelectorAll","link","createElement","rel","href","onerror","onload","head","appendChild","previousScripts","script","Array","from","addEventListener","src","fetch"],"mappings":"AAAA;;;;CAIC,GAED,oDAAoD,GAEpD,sEAAsE;AACtE,2DAA2D;AAE3D,SAASA;IACP,+CAA+C;IAC/C,OACE,CAACC,KAAKC,sBAAsB,IAC1BC,UAAUC,eACNC,eAAe,QACfC,QAAQ,oBAAoB,GAAG,KACrC;AAEJ;AAUA,IAAIC;AAEJ;;CAEC,GACD,MAAMC,iBAA+C,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CAAC","ignoreList":[0]}}, + {"offset": {"line": 1762, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/browser/runtime/dom/dev-backend-dom.ts"],"sourcesContent":["/**\n * This file contains the runtime code specific to the Turbopack development\n * ECMAScript DOM runtime.\n *\n * It will be appended to the base development runtime code.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n/// \n/// \n/// \n\nlet DEV_BACKEND: DevRuntimeBackend\n;(() => {\n DEV_BACKEND = {\n unloadChunk(chunkUrl) {\n deleteResolver(chunkUrl)\n\n // TODO(PACK-2140): remove this once all filenames are guaranteed to be escaped.\n const decodedChunkUrl = decodeURI(chunkUrl)\n\n if (isCss(chunkUrl)) {\n const links = document.querySelectorAll(\n `link[href=\"${chunkUrl}\"],link[href^=\"${chunkUrl}?\"],link[href=\"${decodedChunkUrl}\"],link[href^=\"${decodedChunkUrl}?\"]`\n )\n for (const link of Array.from(links)) {\n link.remove()\n }\n } else if (isJs(chunkUrl)) {\n // Unloading a JS chunk would have no effect, as it lives in the JS\n // runtime once evaluated.\n // However, we still want to remove the script tag from the DOM to keep\n // the HTML somewhat consistent from the user's perspective.\n const scripts = document.querySelectorAll(\n `script[src=\"${chunkUrl}\"],script[src^=\"${chunkUrl}?\"],script[src=\"${decodedChunkUrl}\"],script[src^=\"${decodedChunkUrl}?\"]`\n )\n for (const script of Array.from(scripts)) {\n script.remove()\n }\n } else {\n throw new Error(`can't infer type of chunk from URL ${chunkUrl}`)\n }\n },\n\n reloadChunk(chunkUrl) {\n return new Promise((resolve, reject) => {\n if (!isCss(chunkUrl)) {\n reject(new Error('The DOM backend can only reload CSS chunks'))\n return\n }\n\n const decodedChunkUrl = decodeURI(chunkUrl)\n const previousLinks = document.querySelectorAll(\n `link[rel=stylesheet][href=\"${chunkUrl}\"],link[rel=stylesheet][href^=\"${chunkUrl}?\"],link[rel=stylesheet][href=\"${decodedChunkUrl}\"],link[rel=stylesheet][href^=\"${decodedChunkUrl}?\"]`\n )\n\n if (previousLinks.length === 0) {\n reject(new Error(`No link element found for chunk ${chunkUrl}`))\n return\n }\n\n const link = document.createElement('link')\n link.rel = 'stylesheet'\n\n if (navigator.userAgent.includes('Firefox')) {\n // Firefox won't reload CSS files that were previously loaded on the current page,\n // we need to add a query param to make sure CSS is actually reloaded from the server.\n //\n // I believe this is this issue: https://bugzilla.mozilla.org/show_bug.cgi?id=1037506\n //\n // Safari has a similar issue, but only if you have a `` tag\n // pointing to the same URL as the stylesheet: https://bugs.webkit.org/show_bug.cgi?id=187726\n link.href = `${chunkUrl}?ts=${Date.now()}`\n } else {\n link.href = chunkUrl\n }\n\n link.onerror = () => {\n reject()\n }\n link.onload = () => {\n // First load the new CSS, then remove the old ones. This prevents visible\n // flickering that would happen in-between removing the previous CSS and\n // loading the new one.\n for (const previousLink of Array.from(previousLinks))\n previousLink.remove()\n\n // CSS chunks do not register themselves, and as such must be marked as\n // loaded instantly.\n resolve()\n }\n\n // Make sure to insert the new CSS right after the previous one, so that\n // its precedence is higher.\n previousLinks[0].parentElement!.insertBefore(\n link,\n previousLinks[0].nextSibling\n )\n })\n },\n\n restart: () => self.location.reload(),\n }\n\n function deleteResolver(chunkUrl: ChunkUrl) {\n chunkResolvers.delete(chunkUrl)\n }\n})()\n\nfunction _eval({ code, url, map }: EcmascriptModuleEntry): ModuleFactory {\n code += `\\n\\n//# sourceURL=${encodeURI(\n location.origin + CHUNK_BASE_PATH + url + CHUNK_SUFFIX\n )}`\n if (map) {\n code += `\\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,${btoa(\n // btoa doesn't handle nonlatin characters, so escape them as \\x sequences\n // See https://stackoverflow.com/a/26603875\n unescape(encodeURIComponent(map))\n )}`\n }\n\n // eslint-disable-next-line no-eval\n return eval(code)\n}\n"],"names":["DEV_BACKEND","unloadChunk","chunkUrl","deleteResolver","decodedChunkUrl","decodeURI","isCss","links","document","querySelectorAll","link","Array","from","remove","isJs","scripts","script","Error","reloadChunk","Promise","resolve","reject","previousLinks","length","createElement","rel","navigator","userAgent","includes","href","Date","now","onerror","onload","previousLink","parentElement","insertBefore","nextSibling","restart","self","location","reload","chunkResolvers","delete","_eval","code","url","map","encodeURI","origin","CHUNK_BASE_PATH","CHUNK_SUFFIX","btoa","unescape","encodeURIComponent","eval"],"mappings":"AAAA;;;;;CAKC,GAED,oDAAoD,GAEpD,gDAAgD;AAChD,4CAA4C;AAC5C,iDAAiD;AACjD,0DAA0D;AAE1D,IAAIA;AACH,CAAC;IACAA,cAAc;QACZC,aAAYC,QAAQ;YAClBC,eAAeD;YAEf,gFAAgF;YAChF,MAAME,kBAAkBC,UAAUH;YAElC,IAAII,MAAMJ,WAAW;gBACnB,MAAMK,QAAQC,SAASC,gBAAgB,CACrC,CAAC,WAAW,EAAEP,SAAS,eAAe,EAAEA,SAAS,eAAe,EAAEE,gBAAgB,eAAe,EAAEA,gBAAgB,GAAG,CAAC;gBAEzH,KAAK,MAAMM,QAAQC,MAAMC,IAAI,CAACL,OAAQ;oBACpCG,KAAKG,MAAM;gBACb;YACF,OAAO,IAAIC,KAAKZ,WAAW;gBACzB,mEAAmE;gBACnE,0BAA0B;gBAC1B,uEAAuE;gBACvE,4DAA4D;gBAC5D,MAAMa,UAAUP,SAASC,gBAAgB,CACvC,CAAC,YAAY,EAAEP,SAAS,gBAAgB,EAAEA,SAAS,gBAAgB,EAAEE,gBAAgB,gBAAgB,EAAEA,gBAAgB,GAAG,CAAC;gBAE7H,KAAK,MAAMY,UAAUL,MAAMC,IAAI,CAACG,SAAU;oBACxCC,OAAOH,MAAM;gBACf;YACF,OAAO;gBACL,MAAM,IAAII,MAAM,CAAC,mCAAmC,EAAEf,UAAU;YAClE;QACF;QAEAgB,aAAYhB,QAAQ;YAClB,OAAO,IAAIiB,QAAc,CAACC,SAASC;gBACjC,IAAI,CAACf,MAAMJ,WAAW;oBACpBmB,OAAO,IAAIJ,MAAM;oBACjB;gBACF;gBAEA,MAAMb,kBAAkBC,UAAUH;gBAClC,MAAMoB,g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MAAM,GAAGC,kBAAkBJ,MAAMK,eACzC;IACH,IAAIJ,KAAK;QACPF,QAAQ,CAAC,kEAAkE,EAAEO,KAC3E,0EAA0E;QAC1E,2CAA2C;QAC3CC,SAASC,mBAAmBP,QAC3B;IACL;IAEA,mCAAmC;IACnC,OAAOQ,KAAKV;AACd","ignoreList":[0]}}] } \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/debug-ids/browser/output/ba425_crates_turbopack-tests_tests_snapshot_debug-ids_browser_input_index_0151fefb.js b/turbopack/crates/turbopack-tests/tests/snapshot/debug-ids/browser/output/ba425_crates_turbopack-tests_tests_snapshot_debug-ids_browser_input_index_0151fefb.js index edfb49147539ad..1d71dcd4028dd3 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/debug-ids/browser/output/ba425_crates_turbopack-tests_tests_snapshot_debug-ids_browser_input_index_0151fefb.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/debug-ids/browser/output/ba425_crates_turbopack-tests_tests_snapshot_debug-ids_browser_input_index_0151fefb.js @@ -1,4 +1,4 @@ -;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="ae0c8767-ff94-abb9-fa13-d8c5ded28f9e")}catch(e){}}(); +;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="3834607a-5e38-b3f2-d7f2-094bfde98e30")}catch(e){}}(); (globalThis.TURBOPACK || (globalThis.TURBOPACK = [])).push([ "output/ba425_crates_turbopack-tests_tests_snapshot_debug-ids_browser_input_index_0151fefb.js", {"otherChunks":["output/aaf3a_crates_turbopack-tests_tests_snapshot_debug-ids_browser_input_index_0b8736b3.js"],"runtimeModuleIds":["[project]/turbopack/crates/turbopack-tests/tests/snapshot/debug-ids/browser/input/index.js [test] (ecmascript)"]} @@ -691,6 +691,7 @@ browserContextPrototype.P = resolveAbsolutePath; // evaluated by poping urls off of this array. See `getPathFromScript` let bootstrap = `self.TURBOPACK_WORKER_LOCATION = ${JSON.stringify(location.origin)}; self.TURBOPACK_CHUNK_SUFFIX = ${JSON.stringify(CHUNK_SUFFIX)}; +self.NEXT_DEPLOYMENT_ID = ${JSON.stringify(globalThis.NEXT_DEPLOYMENT_ID)}; self.TURBOPACK_NEXT_CHUNK_URLS = ${JSON.stringify(chunks.reverse().map(getChunkRelativeUrl), null, 2)}; importScripts(...self.TURBOPACK_NEXT_CHUNK_URLS.map(c => self.TURBOPACK_WORKER_LOCATION + c).reverse());`; let blob = new Blob([ @@ -1861,5 +1862,5 @@ chunkListsToRegister.forEach(registerChunkList); })(); -//# debugId=ae0c8767-ff94-abb9-fa13-d8c5ded28f9e +//# debugId=3834607a-5e38-b3f2-d7f2-094bfde98e30 //# sourceMappingURL=aaf3a_crates_turbopack-tests_tests_snapshot_debug-ids_browser_input_index_0151fefb.js.map \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_dev_runtime/output/5c1d0_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_c0f7e0b0.js b/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_dev_runtime/output/5c1d0_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_c0f7e0b0.js index 2b0d0a77cc27f7..7e8ba39e20fa77 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_dev_runtime/output/5c1d0_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_c0f7e0b0.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_dev_runtime/output/5c1d0_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_c0f7e0b0.js @@ -690,6 +690,7 @@ browserContextPrototype.P = resolveAbsolutePath; // evaluated by poping urls off of this array. See `getPathFromScript` let bootstrap = `self.TURBOPACK_WORKER_LOCATION = ${JSON.stringify(location.origin)}; self.TURBOPACK_CHUNK_SUFFIX = ${JSON.stringify(CHUNK_SUFFIX)}; +self.NEXT_DEPLOYMENT_ID = ${JSON.stringify(globalThis.NEXT_DEPLOYMENT_ID)}; self.TURBOPACK_NEXT_CHUNK_URLS = ${JSON.stringify(chunks.reverse().map(getChunkRelativeUrl), null, 2)}; importScripts(...self.TURBOPACK_NEXT_CHUNK_URLS.map(c => self.TURBOPACK_WORKER_LOCATION + c).reverse());`; let blob = new Blob([ diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_dev_runtime/output/780ce_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_c0f7e0b0.js.map b/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_dev_runtime/output/780ce_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_c0f7e0b0.js.map index 876d1a22b84fdc..3c9e1b4f4ec555 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_dev_runtime/output/780ce_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_c0f7e0b0.js.map +++ b/turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_dev_runtime/output/780ce_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_c0f7e0b0.js.map @@ -3,8 +3,8 @@ "sources": [], "sections": [ {"offset": {"line": 13, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/shared/runtime-utils.ts"],"sourcesContent":["/**\n * This file contains runtime types and functions that are shared between all\n * TurboPack ECMAScript runtimes.\n *\n * It will be prepended to the runtime code of each runtime.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n\ntype EsmNamespaceObject = Record\n\n// @ts-ignore Defined in `dev-base.ts`\ndeclare function getOrInstantiateModuleFromParent(\n id: ModuleId,\n sourceModule: M\n): M\n\nconst REEXPORTED_OBJECTS = new WeakMap()\n\n/**\n * Constructs the `__turbopack_context__` object for a module.\n */\nfunction Context(\n this: TurbopackBaseContext,\n module: Module,\n exports: Exports\n) {\n this.m = module\n // We need to store this here instead of accessing it from the module object to:\n // 1. Make it available to factories directly, since we rewrite `this` to\n // `__turbopack_context__.e` in CJS modules.\n // 2. Support async modules which rewrite `module.exports` to a promise, so we\n // can still access the original exports object from functions like\n // `esmExport`\n // Ideally we could find a new approach for async modules and drop this property altogether.\n this.e = exports\n}\nconst contextPrototype = Context.prototype as TurbopackBaseContext\n\ntype ModuleContextMap = Record\n\ninterface ModuleContextEntry {\n id: () => ModuleId\n module: () => any\n}\n\ninterface ModuleContext {\n // require call\n (moduleId: string): Exports | EsmNamespaceObject\n\n // async import call\n import(moduleId: string): Promise\n\n keys(): ModuleId[]\n\n resolve(moduleId: string): ModuleId\n}\n\ntype GetOrInstantiateModuleFromParent = (\n moduleId: M['id'],\n parentModule: M\n) => M\n\ndeclare function getOrInstantiateRuntimeModule(\n chunkPath: ChunkPath,\n moduleId: ModuleId\n): Module\n\nconst hasOwnProperty = Object.prototype.hasOwnProperty\nconst toStringTag = typeof Symbol !== 'undefined' && Symbol.toStringTag\n\nfunction defineProp(\n obj: any,\n name: PropertyKey,\n options: PropertyDescriptor & ThisType\n) {\n if (!hasOwnProperty.call(obj, name)) Object.defineProperty(obj, name, options)\n}\n\nfunction getOverwrittenModule(\n moduleCache: ModuleCache,\n id: ModuleId\n): Module {\n let module = moduleCache[id]\n if (!module) {\n // This is invoked when a module is merged into another module, thus it wasn't invoked via\n // instantiateModule and the cache entry wasn't created yet.\n module = createModuleObject(id)\n moduleCache[id] = module\n }\n return module\n}\n\n/**\n * Creates the module object. Only done here to ensure all module objects have the same shape.\n */\nfunction createModuleObject(id: ModuleId): Module {\n return {\n exports: {},\n error: undefined,\n id,\n namespaceObject: undefined,\n }\n}\n\ntype BindingTag = 0\nconst BindingTag_Value = 0 as BindingTag\n\n// an arbitrary sequence of bindings as\n// - a prop name\n// - BindingTag_Value, a value to be bound directly, or\n// - 1 or 2 functions to bind as getters and sdetters\ntype EsmBindings = Array<\n string | BindingTag | (() => unknown) | ((v: unknown) => void) | unknown\n>\n\n/**\n * Adds the getters to the exports object.\n */\nfunction esm(exports: Exports, bindings: EsmBindings) {\n defineProp(exports, '__esModule', { value: true })\n if (toStringTag) defineProp(exports, toStringTag, { value: 'Module' })\n let i = 0\n while (i < bindings.length) {\n const propName = bindings[i++] as string\n const tagOrFunction = bindings[i++]\n if (typeof tagOrFunction === 'number') {\n if (tagOrFunction === BindingTag_Value) {\n defineProp(exports, propName, {\n value: bindings[i++],\n enumerable: true,\n writable: false,\n })\n } else {\n throw new Error(`unexpected tag: ${tagOrFunction}`)\n }\n } else {\n const getterFn = tagOrFunction as () => unknown\n if (typeof bindings[i] === 'function') {\n const setterFn = bindings[i++] as (v: unknown) => void\n defineProp(exports, propName, {\n get: getterFn,\n set: setterFn,\n enumerable: true,\n })\n } else {\n defineProp(exports, propName, {\n get: getterFn,\n enumerable: true,\n })\n }\n }\n }\n Object.seal(exports)\n}\n\n/**\n * Makes the module an ESM with exports\n */\nfunction esmExport(\n this: TurbopackBaseContext,\n bindings: EsmBindings,\n id: ModuleId | undefined\n) {\n let module: Module\n let exports: Module['exports']\n if (id != null) {\n module = getOverwrittenModule(this.c, id)\n exports = module.exports\n } else {\n module = this.m\n exports = this.e\n }\n module.namespaceObject = exports\n esm(exports, bindings)\n}\ncontextPrototype.s = esmExport\n\ntype ReexportedObjects = Record[]\nfunction ensureDynamicExports(\n module: Module,\n exports: Exports\n): ReexportedObjects {\n let reexportedObjects: ReexportedObjects | undefined =\n REEXPORTED_OBJECTS.get(module)\n\n if (!reexportedObjects) {\n REEXPORTED_OBJECTS.set(module, (reexportedObjects = []))\n module.exports = module.namespaceObject = new Proxy(exports, {\n get(target, prop) {\n if (\n hasOwnProperty.call(target, prop) ||\n prop === 'default' ||\n prop === '__esModule'\n ) {\n return Reflect.get(target, prop)\n }\n for (const obj of reexportedObjects!) {\n const value = Reflect.get(obj, prop)\n if (value !== undefined) return value\n }\n return undefined\n },\n ownKeys(target) {\n const keys = Reflect.ownKeys(target)\n for (const obj of reexportedObjects!) {\n for (const key of Reflect.ownKeys(obj)) {\n if (key !== 'default' && !keys.includes(key)) keys.push(key)\n }\n }\n return keys\n },\n })\n }\n return reexportedObjects\n}\n\n/**\n * Dynamically exports properties from an object\n */\nfunction dynamicExport(\n this: TurbopackBaseContext,\n object: Record,\n id: ModuleId | undefined\n) {\n let module: Module\n let exports: Exports\n if (id != null) {\n module = getOverwrittenModule(this.c, id)\n exports = module.exports\n } else {\n module = this.m\n exports = this.e\n }\n const reexportedObjects = ensureDynamicExports(module, exports)\n\n if (typeof object === 'object' && object !== null) {\n reexportedObjects.push(object)\n }\n}\ncontextPrototype.j = dynamicExport\n\nfunction exportValue(\n this: TurbopackBaseContext,\n value: any,\n id: ModuleId | undefined\n) {\n let module: Module\n if (id != null) {\n module = getOverwrittenModule(this.c, id)\n } else {\n module = this.m\n }\n module.exports = value\n}\ncontextPrototype.v = exportValue\n\nfunction exportNamespace(\n this: TurbopackBaseContext,\n namespace: any,\n id: ModuleId | undefined\n) {\n let module: Module\n if (id != null) {\n module = getOverwrittenModule(this.c, id)\n } else {\n module = this.m\n }\n module.exports = module.namespaceObject = namespace\n}\ncontextPrototype.n = exportNamespace\n\nfunction createGetter(obj: Record, key: string | symbol) {\n return () => obj[key]\n}\n\n/**\n * @returns prototype of the object\n */\nconst getProto: (obj: any) => any = Object.getPrototypeOf\n ? (obj) => Object.getPrototypeOf(obj)\n : (obj) => obj.__proto__\n\n/** Prototypes that are not expanded for exports */\nconst LEAF_PROTOTYPES = [null, getProto({}), getProto([]), getProto(getProto)]\n\n/**\n * @param raw\n * @param ns\n * @param allowExportDefault\n * * `false`: will have the raw module as default export\n * * `true`: will have the default property as default export\n */\nfunction interopEsm(\n raw: Exports,\n ns: EsmNamespaceObject,\n allowExportDefault?: boolean\n) {\n const bindings: EsmBindings = []\n let defaultLocation = -1\n for (\n let current = raw;\n (typeof current === 'object' || typeof current === 'function') &&\n !LEAF_PROTOTYPES.includes(current);\n current = getProto(current)\n ) {\n for (const key of Object.getOwnPropertyNames(current)) {\n bindings.push(key, createGetter(raw, key))\n if (defaultLocation === -1 && key === 'default') {\n defaultLocation = bindings.length - 1\n }\n }\n }\n\n // this is not really correct\n // we should set the `default` getter if the imported module is a `.cjs file`\n if (!(allowExportDefault && defaultLocation >= 0)) {\n // Replace the binding with one for the namespace itself in order to preserve iteration order.\n if (defaultLocation >= 0) {\n // Replace the getter with the value\n bindings.splice(defaultLocation, 1, BindingTag_Value, raw)\n } else {\n bindings.push('default', BindingTag_Value, raw)\n }\n }\n\n esm(ns, bindings)\n return ns\n}\n\nfunction createNS(raw: Module['exports']): EsmNamespaceObject {\n if (typeof raw === 'function') {\n return function (this: any, ...args: any[]) {\n return raw.apply(this, args)\n }\n } else {\n return Object.create(null)\n }\n}\n\nfunction esmImport(\n this: TurbopackBaseContext,\n id: ModuleId\n): Exclude {\n const module = getOrInstantiateModuleFromParent(id, this.m)\n\n // any ES module has to have `module.namespaceObject` defined.\n if (module.namespaceObject) return module.namespaceObject\n\n // only ESM can be an async module, so we don't need to worry about exports being a promise here.\n const raw = module.exports\n return (module.namespaceObject = interopEsm(\n raw,\n createNS(raw),\n raw && (raw as any).__esModule\n ))\n}\ncontextPrototype.i = esmImport\n\nfunction asyncLoader(\n this: TurbopackBaseContext,\n moduleId: ModuleId\n): Promise {\n const loader = this.r(moduleId) as (\n importFunction: EsmImport\n ) => Promise\n return loader(esmImport.bind(this))\n}\ncontextPrototype.A = asyncLoader\n\n// Add a simple runtime require so that environments without one can still pass\n// `typeof require` CommonJS checks so that exports are correctly registered.\nconst runtimeRequire =\n // @ts-ignore\n typeof require === 'function'\n ? // @ts-ignore\n require\n : function require() {\n throw new Error('Unexpected use of runtime require')\n }\ncontextPrototype.t = runtimeRequire\n\nfunction commonJsRequire(\n this: TurbopackBaseContext,\n id: ModuleId\n): Exports {\n return getOrInstantiateModuleFromParent(id, this.m).exports\n}\ncontextPrototype.r = commonJsRequire\n\n/**\n * Remove fragments and query parameters since they are never part of the context map keys\n *\n * This matches how we parse patterns at resolving time. Arguably we should only do this for\n * strings passed to `import` but the resolve does it for `import` and `require` and so we do\n * here as well.\n */\nfunction parseRequest(request: string): string {\n // Per the URI spec fragments can contain `?` characters, so we should trim it off first\n // https://datatracker.ietf.org/doc/html/rfc3986#section-3.5\n const hashIndex = request.indexOf('#')\n if (hashIndex !== -1) {\n request = request.substring(0, hashIndex)\n }\n\n const queryIndex = request.indexOf('?')\n if (queryIndex !== -1) {\n request = request.substring(0, queryIndex)\n }\n\n return request\n}\n/**\n * `require.context` and require/import expression runtime.\n */\nfunction moduleContext(map: ModuleContextMap): ModuleContext {\n function moduleContext(id: string): Exports {\n id = parseRequest(id)\n if (hasOwnProperty.call(map, id)) {\n return map[id].module()\n }\n\n const e = new Error(`Cannot find module '${id}'`)\n ;(e as any).code = 'MODULE_NOT_FOUND'\n throw e\n }\n\n moduleContext.keys = (): string[] => {\n return Object.keys(map)\n }\n\n moduleContext.resolve = (id: string): ModuleId => {\n id = parseRequest(id)\n if (hasOwnProperty.call(map, id)) {\n return map[id].id()\n }\n\n const e = new Error(`Cannot find module '${id}'`)\n ;(e as any).code = 'MODULE_NOT_FOUND'\n throw e\n }\n\n moduleContext.import = async (id: string) => {\n return await (moduleContext(id) as Promise)\n }\n\n return moduleContext\n}\ncontextPrototype.f = moduleContext\n\n/**\n * Returns the path of a chunk defined by its data.\n */\nfunction getChunkPath(chunkData: ChunkData): ChunkPath {\n return typeof chunkData === 'string' ? chunkData : chunkData.path\n}\n\nfunction isPromise(maybePromise: any): maybePromise is Promise {\n return (\n maybePromise != null &&\n typeof maybePromise === 'object' &&\n 'then' in maybePromise &&\n typeof maybePromise.then === 'function'\n )\n}\n\nfunction isAsyncModuleExt(obj: T): obj is AsyncModuleExt & T {\n return turbopackQueues in obj\n}\n\nfunction createPromise() {\n let resolve: (value: T | PromiseLike) => void\n let reject: (reason?: any) => void\n\n const promise = new Promise((res, rej) => {\n reject = rej\n resolve = res\n })\n\n return {\n promise,\n resolve: resolve!,\n reject: reject!,\n }\n}\n\n// Load the CompressedmoduleFactories of a chunk into the `moduleFactories` Map.\n// The CompressedModuleFactories format is\n// - 1 or more module ids\n// - a module factory function\n// So walking this is a little complex but the flat structure is also fast to\n// traverse, we can use `typeof` operators to distinguish the two cases.\nfunction installCompressedModuleFactories(\n chunkModules: CompressedModuleFactories,\n offset: number,\n moduleFactories: ModuleFactories,\n newModuleId?: (id: ModuleId) => void\n) {\n let i = offset\n while (i < chunkModules.length) {\n let moduleId = chunkModules[i] as ModuleId\n let end = i + 1\n // Find our factory function\n while (\n end < chunkModules.length &&\n typeof chunkModules[end] !== 'function'\n ) {\n end++\n }\n if (end === chunkModules.length) {\n throw new Error('malformed chunk format, expected a factory function')\n }\n // Each chunk item has a 'primary id' and optional additional ids. If the primary id is already\n // present we know all the additional ids are also present, so we don't need to check.\n if (!moduleFactories.has(moduleId)) {\n const moduleFactoryFn = chunkModules[end] as Function\n applyModuleFactoryName(moduleFactoryFn)\n newModuleId?.(moduleId)\n for (; i < end; i++) {\n moduleId = chunkModules[i] as ModuleId\n moduleFactories.set(moduleId, moduleFactoryFn)\n }\n }\n i = end + 1 // end is pointing at the last factory advance to the next id or the end of the array.\n }\n}\n\n// everything below is adapted from webpack\n// https://github.com/webpack/webpack/blob/6be4065ade1e252c1d8dcba4af0f43e32af1bdc1/lib/runtime/AsyncModuleRuntimeModule.js#L13\n\nconst turbopackQueues = Symbol('turbopack queues')\nconst turbopackExports = Symbol('turbopack exports')\nconst turbopackError = Symbol('turbopack error')\n\nconst enum QueueStatus {\n Unknown = -1,\n Unresolved = 0,\n Resolved = 1,\n}\n\ntype AsyncQueueFn = (() => void) & { queueCount: number }\ntype AsyncQueue = AsyncQueueFn[] & {\n status: QueueStatus\n}\n\nfunction resolveQueue(queue?: AsyncQueue) {\n if (queue && queue.status !== QueueStatus.Resolved) {\n queue.status = QueueStatus.Resolved\n queue.forEach((fn) => fn.queueCount--)\n queue.forEach((fn) => (fn.queueCount-- ? fn.queueCount++ : fn()))\n }\n}\n\ntype Dep = Exports | AsyncModulePromise | Promise\n\ntype AsyncModuleExt = {\n [turbopackQueues]: (fn: (queue: AsyncQueue) => void) => void\n [turbopackExports]: Exports\n [turbopackError]?: any\n}\n\ntype AsyncModulePromise = Promise & AsyncModuleExt\n\nfunction wrapDeps(deps: Dep[]): AsyncModuleExt[] {\n return deps.map((dep): AsyncModuleExt => {\n if (dep !== null && typeof dep === 'object') {\n if (isAsyncModuleExt(dep)) return dep\n if (isPromise(dep)) {\n const queue: AsyncQueue = Object.assign([], {\n status: QueueStatus.Unresolved,\n })\n\n const obj: AsyncModuleExt = {\n [turbopackExports]: {},\n [turbopackQueues]: (fn: (queue: AsyncQueue) => void) => fn(queue),\n }\n\n dep.then(\n (res) => {\n obj[turbopackExports] = res\n resolveQueue(queue)\n },\n (err) => {\n obj[turbopackError] = err\n resolveQueue(queue)\n }\n )\n\n return obj\n }\n }\n\n return {\n [turbopackExports]: dep,\n [turbopackQueues]: () => {},\n }\n })\n}\n\nfunction asyncModule(\n this: TurbopackBaseContext,\n body: (\n handleAsyncDependencies: (\n deps: Dep[]\n ) => Exports[] | Promise<() => Exports[]>,\n asyncResult: (err?: any) => void\n ) => void,\n hasAwait: boolean\n) {\n const module = this.m\n const queue: AsyncQueue | undefined = hasAwait\n ? Object.assign([], { status: QueueStatus.Unknown })\n : undefined\n\n const depQueues: Set = new Set()\n\n const { resolve, reject, promise: rawPromise } = createPromise()\n\n const promise: AsyncModulePromise = Object.assign(rawPromise, {\n [turbopackExports]: module.exports,\n [turbopackQueues]: (fn) => {\n queue && fn(queue)\n depQueues.forEach(fn)\n promise['catch'](() => {})\n },\n } satisfies AsyncModuleExt)\n\n const attributes: PropertyDescriptor = {\n get(): any {\n return promise\n },\n set(v: any) {\n // Calling `esmExport` leads to this.\n if (v !== promise) {\n promise[turbopackExports] = v\n }\n },\n }\n\n Object.defineProperty(module, 'exports', attributes)\n Object.defineProperty(module, 'namespaceObject', attributes)\n\n function handleAsyncDependencies(deps: Dep[]) {\n const currentDeps = wrapDeps(deps)\n\n const getResult = () =>\n currentDeps.map((d) => {\n if (d[turbopackError]) throw d[turbopackError]\n return d[turbopackExports]\n })\n\n const { promise, resolve } = createPromise<() => Exports[]>()\n\n const fn: AsyncQueueFn = Object.assign(() => resolve(getResult), {\n queueCount: 0,\n })\n\n function fnQueue(q: AsyncQueue) {\n if (q !== queue && !depQueues.has(q)) {\n depQueues.add(q)\n if (q && q.status === QueueStatus.Unresolved) {\n fn.queueCount++\n q.push(fn)\n }\n }\n }\n\n currentDeps.map((dep) => dep[turbopackQueues](fnQueue))\n\n return fn.queueCount ? promise : getResult()\n }\n\n function asyncResult(err?: any) {\n if (err) {\n reject((promise[turbopackError] = err))\n } else {\n resolve(promise[turbopackExports])\n }\n\n resolveQueue(queue)\n }\n\n body(handleAsyncDependencies, asyncResult)\n\n if (queue && queue.status === QueueStatus.Unknown) {\n queue.status = QueueStatus.Unresolved\n }\n}\ncontextPrototype.a = asyncModule\n\n/**\n * A pseudo \"fake\" URL object to resolve to its relative path.\n *\n * When UrlRewriteBehavior is set to relative, calls to the `new URL()` will construct url without base using this\n * runtime function to generate context-agnostic urls between different rendering context, i.e ssr / client to avoid\n * hydration mismatch.\n *\n * This is based on webpack's existing implementation:\n * https://github.com/webpack/webpack/blob/87660921808566ef3b8796f8df61bd79fc026108/lib/runtime/RelativeUrlRuntimeModule.js\n */\nconst relativeURL = function relativeURL(this: any, inputUrl: string) {\n const realUrl = new URL(inputUrl, 'x:/')\n const values: Record = {}\n for (const key in realUrl) values[key] = (realUrl as any)[key]\n values.href = inputUrl\n values.pathname = inputUrl.replace(/[?#].*/, '')\n values.origin = values.protocol = ''\n values.toString = values.toJSON = (..._args: Array) => inputUrl\n for (const key in values)\n Object.defineProperty(this, key, {\n enumerable: true,\n configurable: true,\n value: values[key],\n })\n}\nrelativeURL.prototype = URL.prototype\ncontextPrototype.U = relativeURL\n\n/**\n * Utility function to ensure all variants of an enum are handled.\n */\nfunction invariant(never: never, computeMessage: (arg: any) => string): never {\n throw new Error(`Invariant: ${computeMessage(never)}`)\n}\n\n/**\n * A stub function to make `require` available but non-functional in ESM.\n */\nfunction requireStub(_moduleId: ModuleId): never {\n throw new Error('dynamic usage of require is not supported')\n}\ncontextPrototype.z = requireStub\n\n// Make `globalThis` available to the module in a way that cannot be shadowed by a local variable.\ncontextPrototype.g = globalThis\n\ntype ContextConstructor = {\n new (module: Module, exports: Exports): TurbopackBaseContext\n}\n\nfunction applyModuleFactoryName(factory: Function) {\n // Give the module factory a nice name to improve stack traces.\n Object.defineProperty(factory, 'name', {\n value: 'module evaluation',\n })\n}\n"],"names":["REEXPORTED_OBJECTS","WeakMap","Context","module","exports","m","e","contextPrototype","prototype","hasOwnProperty","Object","toStringTag","Symbol","defineProp","obj","name","options","call","defineProperty","getOverwrittenModule","moduleCache","id","createModuleObject","error","undefined","namespaceObject","BindingTag_Value","esm","bindings","value","i","length","propName","tagOrFunction","enumerable","writable","Error","getterFn","setterFn","get","set","seal","esmExport","c","s","ensureDynamicExports","reexportedObjects","Proxy","target","prop","Reflect","ownKeys","keys","key","includes","push","dynamicExport","object","j","exportValue","v","exportNamespace","namespace","n","createGetter","getProto","getPrototypeOf","__proto__","LEAF_PROTOTYPES","interopEsm","raw","ns","allowExportDefault","defaultLocation","current","getOwnPropertyNames","splice","createNS","args","apply","create","esmImport","getOrInstantiateModuleFromParent","__esModule","asyncLoader","moduleId","loader","r","bind","A","runtimeRequire","require","require1","t","commonJsRequire","parseRequest","request","hashIndex","indexOf","substring","queryIndex","moduleContext","map","code","resolve","import","f","getChunkPath","chunkData","path","isPromise","maybePromise","then","isAsyncModuleExt","turbopackQueues","createPromise","reject","promise","Promise","res","rej","installCompressedModuleFactories","chunkModules","offset","moduleFactories","newModuleId","end","has","moduleFactoryFn","applyModuleFactoryName","turbopackExports","turbopackError","resolveQueue","queue","status","forEach","fn","queueCount","wrapDeps","deps","dep","assign","err","asyncModule","body","hasAwait","depQueues","Set","rawPromise","attributes","handleAsyncDependencies","currentDeps","getResult","d","fnQueue","q","add","asyncResult","a","relativeURL","inputUrl","realUrl","URL","values","href","pathname","replace","origin","protocol","toString","toJSON","_args","configurable","U","invariant","never","computeMessage","requireStub","_moduleId","z","g","globalThis","factory"],"mappings":"AAAA;;;;;CAKC,GAED,oDAAoD,GAEpD,6CAA6C;AAU7C,MAAMA,qBAAqB,IAAIC;AAE/B;;CAEC,GACD,SAASC,QAEPC,MAAc,EACdC,OAAgB;IAEhB,IAAI,CAACC,CAAC,GAAGF;IACT,gFAAgF;IAChF,yEAAyE;IACzE,+CAA+C;IAC/C,8EAA8E;IAC9E,sEAAsE;IACtE,iBAAiB;IACjB,4FAA4F;IAC5F,IAAI,CAACG,CAAC,GAAGF;AACX;AACA,MAAMG,mBAAmBL,QAAQM,SAAS;AA+B1C,MAAMC,iBAAiBC,OAAOF,SAAS,CAACC,cAAc;AACtD,MAAME,cAAc,OAAOC,WAAW,eAAeA,OAAOD,WAAW;AAEvE,SAASE,WACPC,GAAQ,EACRC,IAAiB,EACjBC,OAA2C;IAE3C,IAAI,CAACP,eAAeQ,IAAI,CAACH,KAAKC,OAAOL,OAAOQ,cAAc,CAACJ,KAAKC,MAAMC;AACxE;AAEA,SAASG,qBACPC,WAAgC,EAChCC,EAAY;IAEZ,IAAIlB,SAASiB,WAAW,CAACC,GAAG;IAC5B,IAAI,CAAClB,QAAQ;QACX,0FAA0F;QAC1F,4DAA4D;QAC5DA,SAASmB,mBAAmBD;QAC5BD,WAAW,CAACC,GAAG,GAAGlB;IACpB;IACA,OAAOA;AACT;AAEA;;CAEC,GACD,SAASmB,mBAAmBD,EAAY;IACtC,OAAO;QACLjB,SAAS,CAAC;QACVmB,OAAOC;QACPH;QACAI,iBAAiBD;IACnB;AACF;AAGA,MAAME,mBAAmB;AAUzB;;CAEC,GACD,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,IAAI9I,MAAM;AAClB;AACA7B,iBAAiB4K,CAAC,GAAGF;AAErB,kGAAkG;AAClG1K,iBAAiB6K,CAAC,GAAGC;AAMrB,SAASpD,uBAAuBqD,OAAiB;IAC/C,+DAA+D;IAC/D5K,OAAOQ,cAAc,CAACoK,SAAS,QAAQ;QACrCzJ,OAAO;IACT;AACF","ignoreList":[0]}}, - {"offset": {"line": 514, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/browser/runtime/base/runtime-base.ts"],"sourcesContent":["/**\n * This file contains runtime types and functions that are shared between all\n * Turbopack *browser* ECMAScript runtimes.\n *\n * It will be appended to the runtime code of each runtime right after the\n * shared runtime utils.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n/// \n\n// Used in WebWorkers to tell the runtime about the chunk base path\ndeclare var TURBOPACK_WORKER_LOCATION: string\n// Used in WebWorkers to tell the runtime about the chunk suffix\ndeclare var TURBOPACK_CHUNK_SUFFIX: string\n// Used in WebWorkers to tell the runtime about the current chunk url since it can't be detected via document.currentScript\n// Note it's stored in reversed order to use push and pop\ndeclare var TURBOPACK_NEXT_CHUNK_URLS: ChunkUrl[] | undefined\n\n// Injected by rust code\ndeclare var CHUNK_BASE_PATH: string\ndeclare var CHUNK_SUFFIX: string\n\ninterface TurbopackBrowserBaseContext extends TurbopackBaseContext {\n R: ResolvePathFromModule\n}\n\nconst browserContextPrototype =\n Context.prototype as TurbopackBrowserBaseContext\n\n// Provided by build or dev base\ndeclare function instantiateModule(\n id: ModuleId,\n sourceType: SourceType,\n sourceData: SourceData\n): Module\n\ntype RuntimeParams = {\n otherChunks: ChunkData[]\n runtimeModuleIds: ModuleId[]\n}\n\ntype ChunkRegistration = [\n chunkPath: ChunkScript,\n ...([RuntimeParams] | CompressedModuleFactories),\n]\n\ntype ChunkList = {\n script: ChunkListScript\n chunks: ChunkData[]\n source: 'entry' | 'dynamic'\n}\n\nenum SourceType {\n /**\n * The module was instantiated because it was included in an evaluated chunk's\n * runtime.\n * SourceData is a ChunkPath.\n */\n Runtime = 0,\n /**\n * The module was instantiated because a parent module imported it.\n * SourceData is a ModuleId.\n */\n Parent = 1,\n /**\n * The module was instantiated because it was included in a chunk's hot module\n * update.\n * SourceData is an array of ModuleIds or undefined.\n */\n Update = 2,\n}\n\ntype SourceData = ChunkPath | ModuleId | ModuleId[] | undefined\ninterface RuntimeBackend {\n registerChunk: (chunkPath: ChunkPath, params?: RuntimeParams) => void\n /**\n * Returns the same Promise for the same chunk URL.\n */\n loadChunkCached: (sourceType: SourceType, chunkUrl: ChunkUrl) => Promise\n loadWebAssembly: (\n sourceType: SourceType,\n sourceData: SourceData,\n wasmChunkPath: ChunkPath,\n edgeModule: () => WebAssembly.Module,\n importsObj: WebAssembly.Imports\n ) => Promise\n loadWebAssemblyModule: (\n sourceType: SourceType,\n sourceData: SourceData,\n wasmChunkPath: ChunkPath,\n edgeModule: () => WebAssembly.Module\n ) => Promise\n}\n\ninterface DevRuntimeBackend {\n reloadChunk?: (chunkUrl: ChunkUrl) => Promise\n unloadChunk?: (chunkUrl: ChunkUrl) => void\n restart: () => void\n}\n\nconst moduleFactories: ModuleFactories = new Map()\ncontextPrototype.M = moduleFactories\n\nconst availableModules: Map | true> = new Map()\n\nconst availableModuleChunks: Map | true> = new Map()\n\nfunction factoryNotAvailableMessage(\n moduleId: ModuleId,\n sourceType: SourceType,\n sourceData: SourceData\n): string {\n let instantiationReason\n switch (sourceType) {\n case SourceType.Runtime:\n instantiationReason = `as a runtime entry of chunk ${sourceData}`\n break\n case SourceType.Parent:\n instantiationReason = `because it was required from module ${sourceData}`\n break\n case SourceType.Update:\n instantiationReason = 'because of an HMR update'\n break\n default:\n invariant(\n sourceType,\n (sourceType) => `Unknown source type: ${sourceType}`\n )\n }\n return `Module ${moduleId} was instantiated ${instantiationReason}, but the module factory is not available.`\n}\n\nfunction loadChunk(\n this: TurbopackBrowserBaseContext,\n chunkData: ChunkData\n): Promise {\n return loadChunkInternal(SourceType.Parent, this.m.id, chunkData)\n}\nbrowserContextPrototype.l = loadChunk\n\nfunction loadInitialChunk(chunkPath: ChunkPath, chunkData: ChunkData) {\n return loadChunkInternal(SourceType.Runtime, chunkPath, chunkData)\n}\n\nasync function loadChunkInternal(\n sourceType: SourceType,\n sourceData: SourceData,\n chunkData: ChunkData\n): Promise {\n if (typeof chunkData === 'string') {\n return loadChunkPath(sourceType, sourceData, chunkData)\n }\n\n const includedList = chunkData.included || []\n const modulesPromises = includedList.map((included) => {\n if (moduleFactories.has(included)) return true\n return availableModules.get(included)\n })\n if (modulesPromises.length > 0 && modulesPromises.every((p) => p)) {\n // When all included items are already loaded or loading, we can skip loading ourselves\n await Promise.all(modulesPromises)\n return\n }\n\n const includedModuleChunksList = chunkData.moduleChunks || []\n const moduleChunksPromises = includedModuleChunksList\n .map((included) => {\n // TODO(alexkirsz) Do we need this check?\n // if (moduleFactories[included]) return true;\n return availableModuleChunks.get(included)\n })\n .filter((p) => p)\n\n let promise: Promise\n if (moduleChunksPromises.length > 0) {\n // Some module chunks are already loaded or loading.\n\n if (moduleChunksPromises.length === includedModuleChunksList.length) {\n // When all included module chunks are already loaded or loading, we can skip loading ourselves\n await Promise.all(moduleChunksPromises)\n return\n }\n\n const moduleChunksToLoad: Set = new Set()\n for (const moduleChunk of includedModuleChunksList) {\n if (!availableModuleChunks.has(moduleChunk)) {\n moduleChunksToLoad.add(moduleChunk)\n }\n }\n\n for (const moduleChunkToLoad of moduleChunksToLoad) {\n const promise = loadChunkPath(sourceType, sourceData, moduleChunkToLoad)\n\n availableModuleChunks.set(moduleChunkToLoad, promise)\n\n moduleChunksPromises.push(promise)\n }\n\n promise = Promise.all(moduleChunksPromises)\n } else {\n promise = loadChunkPath(sourceType, sourceData, chunkData.path)\n\n // Mark all included module chunks as loading if they are not already loaded or loading.\n for (const includedModuleChunk of includedModuleChunksList) {\n if (!availableModuleChunks.has(includedModuleChunk)) {\n availableModuleChunks.set(includedModuleChunk, promise)\n }\n }\n }\n\n for (const included of includedList) {\n if (!availableModules.has(included)) {\n // It might be better to race old and new promises, but it's rare that the new promise will be faster than a request started earlier.\n // In production it's even more rare, because the chunk optimization tries to deduplicate modules anyway.\n availableModules.set(included, promise)\n }\n }\n\n await promise\n}\n\nconst loadedChunk = Promise.resolve(undefined)\nconst instrumentedBackendLoadChunks = new WeakMap<\n Promise,\n Promise | typeof loadedChunk\n>()\n// Do not make this async. React relies on referential equality of the returned Promise.\nfunction loadChunkByUrl(\n this: TurbopackBrowserBaseContext,\n chunkUrl: ChunkUrl\n) {\n return loadChunkByUrlInternal(SourceType.Parent, this.m.id, chunkUrl)\n}\nbrowserContextPrototype.L = loadChunkByUrl\n\n// Do not make this async. React relies on referential equality of the returned Promise.\nfunction loadChunkByUrlInternal(\n sourceType: SourceType,\n sourceData: SourceData,\n chunkUrl: ChunkUrl\n): Promise {\n const thenable = BACKEND.loadChunkCached(sourceType, chunkUrl)\n let entry = instrumentedBackendLoadChunks.get(thenable)\n if (entry === undefined) {\n const resolve = instrumentedBackendLoadChunks.set.bind(\n instrumentedBackendLoadChunks,\n thenable,\n loadedChunk\n )\n entry = thenable.then(resolve).catch((cause) => {\n let loadReason: string\n switch (sourceType) {\n case SourceType.Runtime:\n loadReason = `as a runtime dependency of chunk ${sourceData}`\n break\n case SourceType.Parent:\n loadReason = `from module ${sourceData}`\n break\n case SourceType.Update:\n loadReason = 'from an HMR update'\n break\n default:\n invariant(\n sourceType,\n (sourceType) => `Unknown source type: ${sourceType}`\n )\n }\n let error = new Error(\n `Failed to load chunk ${chunkUrl} ${loadReason}${\n cause ? `: ${cause}` : ''\n }`,\n cause ? { cause } : undefined\n )\n error.name = 'ChunkLoadError'\n throw error\n })\n instrumentedBackendLoadChunks.set(thenable, entry)\n }\n\n return entry\n}\n\n// Do not make this async. React relies on referential equality of the returned Promise.\nfunction loadChunkPath(\n sourceType: SourceType,\n sourceData: SourceData,\n chunkPath: ChunkPath\n): Promise {\n const url = getChunkRelativeUrl(chunkPath)\n return loadChunkByUrlInternal(sourceType, sourceData, url)\n}\n\n/**\n * Returns an absolute url to an asset.\n */\nfunction resolvePathFromModule(\n this: TurbopackBaseContext,\n moduleId: string\n): string {\n const exported = this.r(moduleId)\n return exported?.default ?? exported\n}\nbrowserContextPrototype.R = resolvePathFromModule\n\n/**\n * no-op for browser\n * @param modulePath\n */\nfunction resolveAbsolutePath(modulePath?: string): string {\n return `/ROOT/${modulePath ?? ''}`\n}\nbrowserContextPrototype.P = resolveAbsolutePath\n\n/**\n * Returns a blob URL for the worker.\n * @param chunks list of chunks to load\n */\nfunction getWorkerBlobURL(chunks: ChunkPath[]): string {\n // It is important to reverse the array so when bootstrapping we can infer what chunk is being\n // evaluated by poping urls off of this array. See `getPathFromScript`\n let bootstrap = `self.TURBOPACK_WORKER_LOCATION = ${JSON.stringify(location.origin)};\nself.TURBOPACK_CHUNK_SUFFIX = ${JSON.stringify(CHUNK_SUFFIX)};\nself.TURBOPACK_NEXT_CHUNK_URLS = ${JSON.stringify(chunks.reverse().map(getChunkRelativeUrl), null, 2)};\nimportScripts(...self.TURBOPACK_NEXT_CHUNK_URLS.map(c => self.TURBOPACK_WORKER_LOCATION + c).reverse());`\n let blob = new Blob([bootstrap], { type: 'text/javascript' })\n return URL.createObjectURL(blob)\n}\nbrowserContextPrototype.b = getWorkerBlobURL\n\n/**\n * Instantiates a runtime module.\n */\nfunction instantiateRuntimeModule(\n moduleId: ModuleId,\n chunkPath: ChunkPath\n): Module {\n return instantiateModule(moduleId, SourceType.Runtime, chunkPath)\n}\n/**\n * Returns the URL relative to the origin where a chunk can be fetched from.\n */\nfunction getChunkRelativeUrl(chunkPath: ChunkPath | ChunkListPath): ChunkUrl {\n return `${CHUNK_BASE_PATH}${chunkPath\n .split('/')\n .map((p) => encodeURIComponent(p))\n .join('/')}${CHUNK_SUFFIX}` as ChunkUrl\n}\n\n/**\n * Return the ChunkPath from a ChunkScript.\n */\nfunction getPathFromScript(chunkScript: ChunkPath | ChunkScript): ChunkPath\nfunction getPathFromScript(\n chunkScript: ChunkListPath | ChunkListScript\n): ChunkListPath\nfunction getPathFromScript(\n chunkScript: ChunkPath | ChunkListPath | ChunkScript | ChunkListScript\n): ChunkPath | ChunkListPath {\n if (typeof chunkScript === 'string') {\n return chunkScript as ChunkPath | ChunkListPath\n }\n const chunkUrl =\n typeof TURBOPACK_NEXT_CHUNK_URLS !== 'undefined'\n ? TURBOPACK_NEXT_CHUNK_URLS.pop()!\n : chunkScript.getAttribute('src')!\n const src = decodeURIComponent(chunkUrl.replace(/[?#].*$/, ''))\n const path = src.startsWith(CHUNK_BASE_PATH)\n ? src.slice(CHUNK_BASE_PATH.length)\n : src\n return path as ChunkPath | ChunkListPath\n}\n\nconst regexJsUrl = /\\.js(?:\\?[^#]*)?(?:#.*)?$/\n/**\n * Checks if a given path/URL ends with .js, optionally followed by ?query or #fragment.\n */\nfunction isJs(chunkUrlOrPath: ChunkUrl | ChunkPath): boolean {\n return regexJsUrl.test(chunkUrlOrPath)\n}\n\nconst regexCssUrl = /\\.css(?:\\?[^#]*)?(?:#.*)?$/\n/**\n * Checks if a given path/URL ends with .css, optionally followed by ?query or #fragment.\n */\nfunction isCss(chunkUrl: ChunkUrl): boolean {\n return regexCssUrl.test(chunkUrl)\n}\n\nfunction loadWebAssembly(\n this: TurbopackBaseContext,\n chunkPath: ChunkPath,\n edgeModule: () => WebAssembly.Module,\n importsObj: WebAssembly.Imports\n): Promise {\n return BACKEND.loadWebAssembly(\n SourceType.Parent,\n this.m.id,\n chunkPath,\n edgeModule,\n importsObj\n )\n}\ncontextPrototype.w = loadWebAssembly\n\nfunction loadWebAssemblyModule(\n this: TurbopackBaseContext,\n chunkPath: ChunkPath,\n edgeModule: () => WebAssembly.Module\n): Promise {\n return BACKEND.loadWebAssemblyModule(\n SourceType.Parent,\n this.m.id,\n chunkPath,\n edgeModule\n )\n}\ncontextPrototype.u = loadWebAssemblyModule\n"],"names":["browserContextPrototype","Context","prototype","SourceType","moduleFactories","Map","contextPrototype","M","availableModules","availableModuleChunks","factoryNotAvailableMessage","moduleId","sourceType","sourceData","instantiationReason","invariant","loadChunk","chunkData","loadChunkInternal","m","id","l","loadInitialChunk","chunkPath","loadChunkPath","includedList","included","modulesPromises","map","has","get","length","every","p","Promise","all","includedModuleChunksList","moduleChunks","moduleChunksPromises","filter","promise","moduleChunksToLoad","Set","moduleChunk","add","moduleChunkToLoad","set","push","path","includedModuleChunk","loadedChunk","resolve","undefined","instrumentedBackendLoadChunks","WeakMap","loadChunkByUrl","chunkUrl","loadChunkByUrlInternal","L","thenable","BACKEND","loadChunkCached","entry","bind","then","catch","cause","loadReason","error","Error","name","url","getChunkRelativeUrl","resolvePathFromModule","exported","r","default","R","resolveAbsolutePath","modulePath","P","getWorkerBlobURL","chunks","bootstrap","JSON","stringify","location","origin","CHUNK_SUFFIX","reverse","blob","Blob","type","URL","createObjectURL","b","instantiateRuntimeModule","instantiateModule","CHUNK_BASE_PATH","split","encodeURIComponent","join","getPathFromScript","chunkScript","TURBOPACK_NEXT_CHUNK_URLS","pop","getAttribute","src","decodeURIComponent","replace","startsWith","slice","regexJsUrl","isJs","chunkUrlOrPath","test","regexCssUrl","isCss","loadWebAssembly","edgeModule","importsObj","w","loadWebAssemblyModule","u"],"mappings":"AAAA;;;;;;CAMC,GAED,oDAAoD,GAEpD,6CAA6C;AAC7C,yDAAyD;AAEzD,mEAAmE;AAgBnE,MAAMA,0BACJC,QAAQC,SAAS;AAyBnB,IAAA,AAAKC,oCAAAA;IACH;;;;GAIC;IAED;;;GAGC;IAED;;;;GAIC;WAhBEA;EAAAA;AAgDL,MAAMC,kBAAmC,IAAIC;AAC7CC,iBAAiBC,CAAC,GAAGH;AAErB,MAAMI,mBAAuD,IAAIH;AAEjE,MAAMI,wBAA6D,IAAIJ;AAEvE,SAASK,2BACPC,QAAkB,EAClBC,UAAsB,EACtBC,UAAsB;IAEtB,IAAIC;IACJ,OAAQF;QACN;YACEE,sBAAsB,CAAC,4BAA4B,EAAED,YAAY;Y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ACAC;AAEJ;AACAlH,iBAAiBmH,CAAC,GAAGH;AAErB,SAASI,sBAEPnG,SAAoB,EACpBgG,UAAoC;IAEpC,OAAO3D,QAAQ8D,qBAAqB,IAElC,IAAI,CAACvG,CAAC,CAACC,EAAE,EACTG,WACAgG;AAEJ;AACAjH,iBAAiBqH,CAAC,GAAGD","ignoreList":[0]}}, - {"offset": {"line": 741, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/browser/runtime/base/dev-base.ts"],"sourcesContent":["/// \n/// \n/// \n\ninterface TurbopackDevContext extends TurbopackBrowserBaseContext {\n k: RefreshContext\n}\n\nconst devContextPrototype = Context.prototype as TurbopackDevContext\n\n/**\n * This file contains runtime types and functions that are shared between all\n * Turbopack *development* ECMAScript runtimes.\n *\n * It will be appended to the runtime code of each runtime right after the\n * shared runtime utils.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\nconst devModuleCache: ModuleCache = Object.create(null)\ndevContextPrototype.c = devModuleCache\n\n// This file must not use `import` and `export` statements. Otherwise, it\n// becomes impossible to augment interfaces declared in ``d files\n// (e.g. `Module`). Hence, the need for `import()` here.\ntype RefreshRuntimeGlobals =\n import('@next/react-refresh-utils/dist/runtime').RefreshRuntimeGlobals\n\ndeclare var $RefreshHelpers$: RefreshRuntimeGlobals['$RefreshHelpers$']\ndeclare var $RefreshReg$: RefreshRuntimeGlobals['$RefreshReg$']\ndeclare var $RefreshSig$: RefreshRuntimeGlobals['$RefreshSig$']\ndeclare var $RefreshInterceptModuleExecution$: RefreshRuntimeGlobals['$RefreshInterceptModuleExecution$']\n\ntype RefreshContext = {\n register: RefreshRuntimeGlobals['$RefreshReg$']\n signature: RefreshRuntimeGlobals['$RefreshSig$']\n registerExports: typeof registerExportsAndSetupBoundaryForReactRefresh\n}\n\ntype RefreshHelpers = RefreshRuntimeGlobals['$RefreshHelpers$']\n\ntype ModuleFactory = (\n this: Module['exports'],\n context: TurbopackDevContext\n) => unknown\n\ninterface DevRuntimeBackend {\n reloadChunk?: (chunkUrl: ChunkUrl) => Promise\n unloadChunk?: (chunkUrl: ChunkUrl) => void\n restart: () => void\n}\n\nclass UpdateApplyError extends Error {\n name = 'UpdateApplyError'\n\n dependencyChain: ModuleId[]\n\n constructor(message: string, dependencyChain: ModuleId[]) {\n super(message)\n this.dependencyChain = dependencyChain\n }\n}\n\n/**\n * Module IDs that are instantiated as part of the runtime of a chunk.\n */\nconst runtimeModules: Set = new Set()\n\n/**\n * Map from module ID to the chunks that contain this module.\n *\n * In HMR, we need to keep track of which modules are contained in which so\n * chunks. This is so we don't eagerly dispose of a module when it is removed\n * from chunk A, but still exists in chunk B.\n */\nconst moduleChunksMap: Map> = new Map()\n/**\n * Map from a chunk path to all modules it contains.\n */\nconst chunkModulesMap: Map> = new Map()\n/**\n * Chunk lists that contain a runtime. When these chunk lists receive an update\n * that can't be reconciled with the current state of the page, we need to\n * reload the runtime entirely.\n */\nconst runtimeChunkLists: Set = new Set()\n/**\n * Map from a chunk list to the chunk paths it contains.\n */\nconst chunkListChunksMap: Map> = new Map()\n/**\n * Map from a chunk path to the chunk lists it belongs to.\n */\nconst chunkChunkListsMap: Map> = new Map()\n\n/**\n * Maps module IDs to persisted data between executions of their hot module\n * implementation (`hot.data`).\n */\nconst moduleHotData: Map = new Map()\n/**\n * Maps module instances to their hot module state.\n */\nconst moduleHotState: Map = new Map()\n/**\n * Modules that call `module.hot.invalidate()` (while being updated).\n */\nconst queuedInvalidatedModules: Set = new Set()\n\n/**\n * Gets or instantiates a runtime module.\n */\n// @ts-ignore\nfunction getOrInstantiateRuntimeModule(\n chunkPath: ChunkPath,\n moduleId: ModuleId\n): Module {\n const module = devModuleCache[moduleId]\n if (module) {\n if (module.error) {\n throw module.error\n }\n return module\n }\n\n // @ts-ignore\n return instantiateModule(moduleId, SourceType.Runtime, chunkPath)\n}\n\n/**\n * Retrieves a module from the cache, or instantiate it if it is not cached.\n */\n// @ts-ignore Defined in `runtime-utils.ts`\nconst getOrInstantiateModuleFromParent: GetOrInstantiateModuleFromParent<\n HotModule\n> = (id, sourceModule) => {\n if (!sourceModule.hot.active) {\n console.warn(\n `Unexpected import of module ${id} from module ${sourceModule.id}, which was deleted by an HMR update`\n )\n }\n\n const module = devModuleCache[id]\n\n if (sourceModule.children.indexOf(id) === -1) {\n sourceModule.children.push(id)\n }\n\n if (module) {\n if (module.error) {\n throw module.error\n }\n\n if (module.parents.indexOf(sourceModule.id) === -1) {\n module.parents.push(sourceModule.id)\n }\n\n return module\n }\n\n return instantiateModule(id, SourceType.Parent, sourceModule.id)\n}\n\nfunction DevContext(\n this: TurbopackDevContext,\n module: HotModule,\n exports: Exports,\n refresh: RefreshContext\n) {\n Context.call(this, module, exports)\n this.k = refresh\n}\nDevContext.prototype = Context.prototype\n\ntype DevContextConstructor = {\n new (\n module: HotModule,\n exports: Exports,\n refresh: RefreshContext\n ): TurbopackDevContext\n}\n\nfunction instantiateModule(\n moduleId: ModuleId,\n sourceType: SourceType,\n sourceData: SourceData\n): Module {\n // We are in development, this is always a string.\n let id = moduleId as string\n\n const moduleFactory = moduleFactories.get(id)\n if (typeof moduleFactory !== 'function') {\n // This can happen if modules incorrectly handle HMR disposes/updates,\n // e.g. when they keep a `setTimeout` around which still executes old code\n // and contains e.g. a `require(\"something\")` call.\n throw new Error(\n factoryNotAvailableMessage(id, sourceType, sourceData) +\n ' It might have been deleted in an HMR update.'\n )\n }\n\n const hotData = moduleHotData.get(id)!\n const { hot, hotState } = createModuleHot(id, hotData)\n\n let parents: ModuleId[]\n switch (sourceType) {\n case SourceType.Runtime:\n runtimeModules.add(id)\n parents = []\n break\n case SourceType.Parent:\n // No need to add this module as a child of the parent module here, this\n // has already been taken care of in `getOrInstantiateModuleFromParent`.\n parents = [sourceData as ModuleId]\n break\n case SourceType.Update:\n parents = (sourceData as ModuleId[]) || []\n break\n default:\n invariant(\n sourceType,\n (sourceType) => `Unknown source type: ${sourceType}`\n )\n }\n\n const module: HotModule = createModuleObject(id) as HotModule\n const exports = module.exports\n module.parents = parents\n module.children = []\n module.hot = hot\n\n devModuleCache[id] = module\n moduleHotState.set(module, hotState)\n\n // NOTE(alexkirsz) This can fail when the module encounters a runtime error.\n try {\n runModuleExecutionHooks(module, (refresh) => {\n const context = new (DevContext as any as DevContextConstructor)(\n module,\n exports,\n refresh\n )\n moduleFactory(context, module, exports)\n })\n } catch (error) {\n module.error = error as any\n throw error\n }\n\n if (module.namespaceObject && module.exports !== module.namespaceObject) {\n // in case of a circular dependency: cjs1 -> esm2 -> cjs1\n interopEsm(module.exports, module.namespaceObject)\n }\n\n return module\n}\n\nconst DUMMY_REFRESH_CONTEXT = {\n register: (_type: unknown, _id: unknown) => {},\n signature: () => (_type: unknown) => {},\n registerExports: (_module: unknown, _helpers: unknown) => {},\n}\n\n/**\n * NOTE(alexkirsz) Webpack has a \"module execution\" interception hook that\n * Next.js' React Refresh runtime hooks into to add module context to the\n * refresh registry.\n */\nfunction runModuleExecutionHooks(\n module: HotModule,\n executeModule: (ctx: RefreshContext) => void\n) {\n if (typeof globalThis.$RefreshInterceptModuleExecution$ === 'function') {\n const cleanupReactRefreshIntercept =\n globalThis.$RefreshInterceptModuleExecution$(module.id)\n try {\n executeModule({\n register: globalThis.$RefreshReg$,\n signature: globalThis.$RefreshSig$,\n registerExports: registerExportsAndSetupBoundaryForReactRefresh,\n })\n } finally {\n // Always cleanup the intercept, even if module execution failed.\n cleanupReactRefreshIntercept()\n }\n } else {\n // If the react refresh hooks are not installed we need to bind dummy functions.\n // This is expected when running in a Web Worker. It is also common in some of\n // our test environments.\n executeModule(DUMMY_REFRESH_CONTEXT)\n }\n}\n\n/**\n * This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts\n */\nfunction registerExportsAndSetupBoundaryForReactRefresh(\n module: HotModule,\n helpers: RefreshHelpers\n) {\n const currentExports = module.exports\n const prevExports = module.hot.data.prevExports ?? null\n\n helpers.registerExportsForReactRefresh(currentExports, module.id)\n\n // A module can be accepted automatically based on its exports, e.g. when\n // it is a Refresh Boundary.\n if (helpers.isReactRefreshBoundary(currentExports)) {\n // Save the previous exports on update, so we can compare the boundary\n // signatures.\n module.hot.dispose((data) => {\n data.prevExports = currentExports\n })\n // Unconditionally accept an update to this module, we'll check if it's\n // still a Refresh Boundary later.\n module.hot.accept()\n\n // This field is set when the previous version of this module was a\n // Refresh Boundary, letting us know we need to check for invalidation or\n // enqueue an update.\n if (prevExports !== null) {\n // A boundary can become ineligible if its exports are incompatible\n // with the previous exports.\n //\n // For example, if you add/remove/change exports, we'll want to\n // re-execute the importing modules, and force those components to\n // re-render. Similarly, if you convert a class component to a\n // function, we want to invalidate the boundary.\n if (\n helpers.shouldInvalidateReactRefreshBoundary(\n helpers.getRefreshBoundarySignature(prevExports),\n helpers.getRefreshBoundarySignature(currentExports)\n )\n ) {\n module.hot.invalidate()\n } else {\n helpers.scheduleUpdate()\n }\n }\n } else {\n // Since we just executed the code for the module, it's possible that the\n // new exports made it ineligible for being a boundary.\n // We only care about the case when we were _previously_ a boundary,\n // because we already accepted this update (accidental side effect).\n const isNoLongerABoundary = prevExports !== null\n if (isNoLongerABoundary) {\n module.hot.invalidate()\n }\n }\n}\n\nfunction formatDependencyChain(dependencyChain: ModuleId[]): string {\n return `Dependency chain: ${dependencyChain.join(' -> ')}`\n}\n\nfunction computeOutdatedModules(\n added: Map,\n modified: Map\n): {\n outdatedModules: Set\n newModuleFactories: Map\n} {\n const newModuleFactories = new Map()\n\n for (const [moduleId, entry] of added) {\n if (entry != null) {\n newModuleFactories.set(moduleId, _eval(entry))\n }\n }\n\n const outdatedModules = computedInvalidatedModules(modified.keys())\n\n for (const [moduleId, entry] of modified) {\n newModuleFactories.set(moduleId, _eval(entry))\n }\n\n return { outdatedModules, newModuleFactories }\n}\n\nfunction computedInvalidatedModules(\n invalidated: Iterable\n): Set {\n const outdatedModules = new Set()\n\n for (const moduleId of invalidated) {\n const effect = getAffectedModuleEffects(moduleId)\n\n switch (effect.type) {\n case 'unaccepted':\n throw new UpdateApplyError(\n `cannot apply update: unaccepted module. ${formatDependencyChain(\n effect.dependencyChain\n )}.`,\n effect.dependencyChain\n )\n case 'self-declined':\n throw new UpdateApplyError(\n `cannot apply update: self-declined module. ${formatDependencyChain(\n effect.dependencyChain\n )}.`,\n effect.dependencyChain\n )\n case 'accepted':\n for (const outdatedModuleId of effect.outdatedModules) {\n outdatedModules.add(outdatedModuleId)\n }\n break\n // TODO(alexkirsz) Dependencies: handle dependencies effects.\n default:\n invariant(effect, (effect) => `Unknown effect type: ${effect?.type}`)\n }\n }\n\n return outdatedModules\n}\n\nfunction computeOutdatedSelfAcceptedModules(\n outdatedModules: Iterable\n): { moduleId: ModuleId; errorHandler: true | Function }[] {\n const outdatedSelfAcceptedModules: {\n moduleId: ModuleId\n errorHandler: true | Function\n }[] = []\n for (const moduleId of outdatedModules) {\n const module = devModuleCache[moduleId]\n const hotState = moduleHotState.get(module)!\n if (module && hotState.selfAccepted && !hotState.selfInvalidated) {\n outdatedSelfAcceptedModules.push({\n moduleId,\n errorHandler: hotState.selfAccepted,\n })\n }\n }\n return outdatedSelfAcceptedModules\n}\n\n/**\n * Adds, deletes, and moves modules between chunks. This must happen before the\n * dispose phase as it needs to know which modules were removed from all chunks,\n * which we can only compute *after* taking care of added and moved modules.\n */\nfunction updateChunksPhase(\n chunksAddedModules: Map>,\n chunksDeletedModules: Map>\n): { disposedModules: Set } {\n for (const [chunkPath, addedModuleIds] of chunksAddedModules) {\n for (const moduleId of addedModuleIds) {\n addModuleToChunk(moduleId, chunkPath)\n }\n }\n\n const disposedModules: Set = new Set()\n for (const [chunkPath, addedModuleIds] of chunksDeletedModules) {\n for (const moduleId of addedModuleIds) {\n if (removeModuleFromChunk(moduleId, chunkPath)) {\n disposedModules.add(moduleId)\n }\n }\n }\n\n return { disposedModules }\n}\n\nfunction disposePhase(\n outdatedModules: Iterable,\n disposedModules: Iterable\n): { outdatedModuleParents: Map> } {\n for (const moduleId of outdatedModules) {\n disposeModule(moduleId, 'replace')\n }\n\n for (const moduleId of disposedModules) {\n disposeModule(moduleId, 'clear')\n }\n\n // Removing modules from the module cache is a separate step.\n // We also want to keep track of previous parents of the outdated modules.\n const outdatedModuleParents = new Map()\n for (const moduleId of outdatedModules) {\n const oldModule = devModuleCache[moduleId]\n outdatedModuleParents.set(moduleId, oldModule?.parents)\n delete devModuleCache[moduleId]\n }\n\n // TODO(alexkirsz) Dependencies: remove outdated dependency from module\n // children.\n\n return { outdatedModuleParents }\n}\n\n/**\n * Disposes of an instance of a module.\n *\n * Returns the persistent hot data that should be kept for the next module\n * instance.\n *\n * NOTE: mode = \"replace\" will not remove modules from the devModuleCache\n * This must be done in a separate step afterwards.\n * This is important because all modules need to be disposed to update the\n * parent/child relationships before they are actually removed from the devModuleCache.\n * If this was done in this method, the following disposeModule calls won't find\n * the module from the module id in the cache.\n */\nfunction disposeModule(moduleId: ModuleId, mode: 'clear' | 'replace') {\n const module = devModuleCache[moduleId]\n if (!module) {\n return\n }\n\n const hotState = moduleHotState.get(module)!\n const data = {}\n\n // Run the `hot.dispose` handler, if any, passing in the persistent\n // `hot.data` object.\n for (const disposeHandler of hotState.disposeHandlers) {\n disposeHandler(data)\n }\n\n // This used to warn in `getOrInstantiateModuleFromParent` when a disposed\n // module is still importing other modules.\n module.hot.active = false\n\n moduleHotState.delete(module)\n\n // TODO(alexkirsz) Dependencies: delete the module from outdated deps.\n\n // Remove the disposed module from its children's parent list.\n // It will be added back once the module re-instantiates and imports its\n // children again.\n for (const childId of module.children) {\n const child = devModuleCache[childId]\n if (!child) {\n continue\n }\n\n const idx = child.parents.indexOf(module.id)\n if (idx >= 0) {\n child.parents.splice(idx, 1)\n }\n }\n\n switch (mode) {\n case 'clear':\n delete devModuleCache[module.id]\n moduleHotData.delete(module.id)\n break\n case 'replace':\n moduleHotData.set(module.id, data)\n break\n default:\n invariant(mode, (mode) => `invalid mode: ${mode}`)\n }\n}\n\nfunction applyPhase(\n outdatedSelfAcceptedModules: {\n moduleId: ModuleId\n errorHandler: true | Function\n }[],\n newModuleFactories: Map,\n outdatedModuleParents: Map>,\n reportError: (err: any) => void\n) {\n // Update module factories.\n for (const [moduleId, factory] of newModuleFactories.entries()) {\n applyModuleFactoryName(factory)\n moduleFactories.set(moduleId, factory)\n }\n\n // TODO(alexkirsz) Run new runtime entries here.\n\n // TODO(alexkirsz) Dependencies: call accept handlers for outdated deps.\n\n // Re-instantiate all outdated self-accepted modules.\n for (const { moduleId, errorHandler } of outdatedSelfAcceptedModules) {\n try {\n instantiateModule(\n moduleId,\n SourceType.Update,\n outdatedModuleParents.get(moduleId)\n )\n } catch (err) {\n if (typeof errorHandler === 'function') {\n try {\n errorHandler(err, { moduleId, module: devModuleCache[moduleId] })\n } catch (err2) {\n reportError(err2)\n reportError(err)\n }\n } else {\n reportError(err)\n }\n }\n }\n}\n\nfunction applyUpdate(update: PartialUpdate) {\n switch (update.type) {\n case 'ChunkListUpdate':\n applyChunkListUpdate(update)\n break\n default:\n invariant(update, (update) => `Unknown update type: ${update.type}`)\n }\n}\n\nfunction applyChunkListUpdate(update: ChunkListUpdate) {\n if (update.merged != null) {\n for (const merged of update.merged) {\n switch (merged.type) {\n case 'EcmascriptMergedUpdate':\n applyEcmascriptMergedUpdate(merged)\n break\n default:\n invariant(merged, (merged) => `Unknown merged type: ${merged.type}`)\n }\n }\n }\n\n if (update.chunks != null) {\n for (const [chunkPath, chunkUpdate] of Object.entries(\n update.chunks\n ) as Array<[ChunkPath, ChunkUpdate]>) {\n const chunkUrl = getChunkRelativeUrl(chunkPath)\n\n switch (chunkUpdate.type) {\n case 'added':\n BACKEND.loadChunkCached(SourceType.Update, chunkUrl)\n break\n case 'total':\n DEV_BACKEND.reloadChunk?.(chunkUrl)\n break\n case 'deleted':\n DEV_BACKEND.unloadChunk?.(chunkUrl)\n break\n case 'partial':\n invariant(\n chunkUpdate.instruction,\n (instruction) =>\n `Unknown partial instruction: ${JSON.stringify(instruction)}.`\n )\n break\n default:\n invariant(\n chunkUpdate,\n (chunkUpdate) => `Unknown chunk update type: ${chunkUpdate.type}`\n )\n }\n }\n }\n}\n\nfunction applyEcmascriptMergedUpdate(update: EcmascriptMergedUpdate) {\n const { entries = {}, chunks = {} } = update\n const { added, modified, chunksAdded, chunksDeleted } = computeChangedModules(\n entries,\n chunks\n )\n const { outdatedModules, newModuleFactories } = computeOutdatedModules(\n added,\n modified\n )\n const { disposedModules } = updateChunksPhase(chunksAdded, chunksDeleted)\n\n applyInternal(outdatedModules, disposedModules, newModuleFactories)\n}\n\nfunction applyInvalidatedModules(outdatedModules: Set) {\n if (queuedInvalidatedModules.size > 0) {\n computedInvalidatedModules(queuedInvalidatedModules).forEach((moduleId) => {\n outdatedModules.add(moduleId)\n })\n\n queuedInvalidatedModules.clear()\n }\n\n return outdatedModules\n}\n\nfunction applyInternal(\n outdatedModules: Set,\n disposedModules: Iterable,\n newModuleFactories: Map\n) {\n outdatedModules = applyInvalidatedModules(outdatedModules)\n\n const outdatedSelfAcceptedModules =\n computeOutdatedSelfAcceptedModules(outdatedModules)\n\n const { outdatedModuleParents } = disposePhase(\n outdatedModules,\n disposedModules\n )\n\n // we want to continue on error and only throw the error after we tried applying all updates\n let error: any\n\n function reportError(err: any) {\n if (!error) error = err\n }\n\n applyPhase(\n outdatedSelfAcceptedModules,\n newModuleFactories,\n outdatedModuleParents,\n reportError\n )\n\n if (error) {\n throw error\n }\n\n if (queuedInvalidatedModules.size > 0) {\n applyInternal(new Set(), [], new Map())\n }\n}\n\nfunction computeChangedModules(\n entries: Record,\n updates: Record\n): {\n added: Map\n modified: Map\n deleted: Set\n chunksAdded: Map>\n chunksDeleted: Map>\n} {\n const chunksAdded = new Map()\n const chunksDeleted = new Map()\n const added: Map = new Map()\n const modified = new Map()\n const deleted: Set = new Set()\n\n for (const [chunkPath, mergedChunkUpdate] of Object.entries(updates) as Array<\n [ChunkPath, EcmascriptMergedChunkUpdate]\n >) {\n switch (mergedChunkUpdate.type) {\n case 'added': {\n const updateAdded = new Set(mergedChunkUpdate.modules)\n for (const moduleId of updateAdded) {\n added.set(moduleId, entries[moduleId])\n }\n chunksAdded.set(chunkPath, updateAdded)\n break\n }\n case 'deleted': {\n // We could also use `mergedChunkUpdate.modules` here.\n const updateDeleted = new Set(chunkModulesMap.get(chunkPath))\n for (const moduleId of updateDeleted) {\n deleted.add(moduleId)\n }\n chunksDeleted.set(chunkPath, updateDeleted)\n break\n }\n case 'partial': {\n const updateAdded = new Set(mergedChunkUpdate.added)\n const updateDeleted = new Set(mergedChunkUpdate.deleted)\n for (const moduleId of updateAdded) {\n added.set(moduleId, entries[moduleId])\n }\n for (const moduleId of updateDeleted) {\n deleted.add(moduleId)\n }\n chunksAdded.set(chunkPath, updateAdded)\n chunksDeleted.set(chunkPath, updateDeleted)\n break\n }\n default:\n invariant(\n mergedChunkUpdate,\n (mergedChunkUpdate) =>\n `Unknown merged chunk update type: ${mergedChunkUpdate.type}`\n )\n }\n }\n\n // If a module was added from one chunk and deleted from another in the same update,\n // consider it to be modified, as it means the module was moved from one chunk to another\n // AND has new code in a single update.\n for (const moduleId of added.keys()) {\n if (deleted.has(moduleId)) {\n added.delete(moduleId)\n deleted.delete(moduleId)\n }\n }\n\n for (const [moduleId, entry] of Object.entries(entries)) {\n // Modules that haven't been added to any chunk but have new code are considered\n // to be modified.\n // This needs to be under the previous loop, as we need it to get rid of modules\n // that were added and deleted in the same update.\n if (!added.has(moduleId)) {\n modified.set(moduleId, entry)\n }\n }\n\n return { added, deleted, modified, chunksAdded, chunksDeleted }\n}\n\ntype ModuleEffect =\n | {\n type: 'unaccepted'\n dependencyChain: ModuleId[]\n }\n | {\n type: 'self-declined'\n dependencyChain: ModuleId[]\n moduleId: ModuleId\n }\n | {\n type: 'accepted'\n moduleId: ModuleId\n outdatedModules: Set\n }\n\nfunction getAffectedModuleEffects(moduleId: ModuleId): ModuleEffect {\n const outdatedModules: Set = new Set()\n\n type QueueItem = { moduleId?: ModuleId; dependencyChain: ModuleId[] }\n\n const queue: QueueItem[] = [\n {\n moduleId,\n dependencyChain: [],\n },\n ]\n\n let nextItem\n while ((nextItem = queue.shift())) {\n const { moduleId, dependencyChain } = nextItem\n\n if (moduleId != null) {\n if (outdatedModules.has(moduleId)) {\n // Avoid infinite loops caused by cycles between modules in the dependency chain.\n continue\n }\n\n outdatedModules.add(moduleId)\n }\n\n // We've arrived at the runtime of the chunk, which means that nothing\n // else above can accept this update.\n if (moduleId === undefined) {\n return {\n type: 'unaccepted',\n dependencyChain,\n }\n }\n\n const module = devModuleCache[moduleId]\n const hotState = moduleHotState.get(module)!\n\n if (\n // The module is not in the cache. Since this is a \"modified\" update,\n // it means that the module was never instantiated before.\n !module || // The module accepted itself without invalidating globalThis.\n // TODO is that right?\n (hotState.selfAccepted && !hotState.selfInvalidated)\n ) {\n continue\n }\n\n if (hotState.selfDeclined) {\n return {\n type: 'self-declined',\n dependencyChain,\n moduleId,\n }\n }\n\n if (runtimeModules.has(moduleId)) {\n queue.push({\n moduleId: undefined,\n dependencyChain: [...dependencyChain, moduleId],\n })\n continue\n }\n\n for (const parentId of module.parents) {\n const parent = devModuleCache[parentId]\n\n if (!parent) {\n // TODO(alexkirsz) Is this even possible?\n continue\n }\n\n // TODO(alexkirsz) Dependencies: check accepted and declined\n // dependencies here.\n\n queue.push({\n moduleId: parentId,\n dependencyChain: [...dependencyChain, moduleId],\n })\n }\n }\n\n return {\n type: 'accepted',\n moduleId,\n outdatedModules,\n }\n}\n\nfunction handleApply(chunkListPath: ChunkListPath, update: ServerMessage) {\n switch (update.type) {\n case 'partial': {\n // This indicates that the update is can be applied to the current state of the application.\n applyUpdate(update.instruction)\n break\n }\n case 'restart': {\n // This indicates that there is no way to apply the update to the\n // current state of the application, and that the application must be\n // restarted.\n DEV_BACKEND.restart()\n break\n }\n case 'notFound': {\n // This indicates that the chunk list no longer exists: either the dynamic import which created it was removed,\n // or the page itself was deleted.\n // If it is a dynamic import, we simply discard all modules that the chunk has exclusive access to.\n // If it is a runtime chunk list, we restart the application.\n if (runtimeChunkLists.has(chunkListPath)) {\n DEV_BACKEND.restart()\n } else {\n disposeChunkList(chunkListPath)\n }\n break\n }\n default:\n throw new Error(`Unknown update type: ${update.type}`)\n }\n}\n\nfunction createModuleHot(\n moduleId: ModuleId,\n hotData: HotData\n): { hot: Hot; hotState: HotState } {\n const hotState: HotState = {\n selfAccepted: false,\n selfDeclined: false,\n selfInvalidated: false,\n disposeHandlers: [],\n }\n\n const hot: Hot = {\n // TODO(alexkirsz) This is not defined in the HMR API. It was used to\n // decide whether to warn whenever an HMR-disposed module required other\n // modules. We might want to remove it.\n active: true,\n\n data: hotData ?? {},\n\n // TODO(alexkirsz) Support full (dep, callback, errorHandler) form.\n accept: (\n modules?: string | string[] | AcceptErrorHandler,\n _callback?: AcceptCallback,\n _errorHandler?: AcceptErrorHandler\n ) => {\n if (modules === undefined) {\n hotState.selfAccepted = true\n } else if (typeof modules === 'function') {\n hotState.selfAccepted = modules\n } else {\n throw new Error('unsupported `accept` signature')\n }\n },\n\n decline: (dep) => {\n if (dep === undefined) {\n hotState.selfDeclined = true\n } else {\n throw new Error('unsupported `decline` signature')\n }\n },\n\n dispose: (callback) => {\n hotState.disposeHandlers.push(callback)\n },\n\n addDisposeHandler: (callback) => {\n hotState.disposeHandlers.push(callback)\n },\n\n removeDisposeHandler: (callback) => {\n const idx = hotState.disposeHandlers.indexOf(callback)\n if (idx >= 0) {\n hotState.disposeHandlers.splice(idx, 1)\n }\n },\n\n invalidate: () => {\n hotState.selfInvalidated = true\n queuedInvalidatedModules.add(moduleId)\n },\n\n // NOTE(alexkirsz) This is part of the management API, which we don't\n // implement, but the Next.js React Refresh runtime uses this to decide\n // whether to schedule an update.\n status: () => 'idle',\n\n // NOTE(alexkirsz) Since we always return \"idle\" for now, these are no-ops.\n addStatusHandler: (_handler) => {},\n removeStatusHandler: (_handler) => {},\n\n // NOTE(jridgewell) Check returns the list of updated modules, but we don't\n // want the webpack code paths to ever update (the turbopack paths handle\n // this already).\n check: () => Promise.resolve(null),\n }\n\n return { hot, hotState }\n}\n\n/**\n * Removes a module from a chunk.\n * Returns `true` if there are no remaining chunks including this module.\n */\nfunction removeModuleFromChunk(\n moduleId: ModuleId,\n chunkPath: ChunkPath\n): boolean {\n const moduleChunks = moduleChunksMap.get(moduleId)!\n moduleChunks.delete(chunkPath)\n\n const chunkModules = chunkModulesMap.get(chunkPath)!\n chunkModules.delete(moduleId)\n\n const noRemainingModules = chunkModules.size === 0\n if (noRemainingModules) {\n chunkModulesMap.delete(chunkPath)\n }\n\n const noRemainingChunks = moduleChunks.size === 0\n if (noRemainingChunks) {\n moduleChunksMap.delete(moduleId)\n }\n\n return noRemainingChunks\n}\n\n/**\n * Disposes of a chunk list and its corresponding exclusive chunks.\n */\nfunction disposeChunkList(chunkListPath: ChunkListPath): boolean {\n const chunkPaths = chunkListChunksMap.get(chunkListPath)\n if (chunkPaths == null) {\n return false\n }\n chunkListChunksMap.delete(chunkListPath)\n\n for (const chunkPath of chunkPaths) {\n const chunkChunkLists = chunkChunkListsMap.get(chunkPath)!\n chunkChunkLists.delete(chunkListPath)\n\n if (chunkChunkLists.size === 0) {\n chunkChunkListsMap.delete(chunkPath)\n disposeChunk(chunkPath)\n }\n }\n\n // We must also dispose of the chunk list's chunk itself to ensure it may\n // be reloaded properly in the future.\n const chunkListUrl = getChunkRelativeUrl(chunkListPath)\n\n DEV_BACKEND.unloadChunk?.(chunkListUrl)\n\n return true\n}\n\n/**\n * Disposes of a chunk and its corresponding exclusive modules.\n *\n * @returns Whether the chunk was disposed of.\n */\nfunction disposeChunk(chunkPath: ChunkPath): boolean {\n const chunkUrl = getChunkRelativeUrl(chunkPath)\n // This should happen whether the chunk has any modules in it or not.\n // For instance, CSS chunks have no modules in them, but they still need to be unloaded.\n DEV_BACKEND.unloadChunk?.(chunkUrl)\n\n const chunkModules = chunkModulesMap.get(chunkPath)\n if (chunkModules == null) {\n return false\n }\n chunkModules.delete(chunkPath)\n\n for (const moduleId of chunkModules) {\n const moduleChunks = moduleChunksMap.get(moduleId)!\n moduleChunks.delete(chunkPath)\n\n const noRemainingChunks = moduleChunks.size === 0\n if (noRemainingChunks) {\n moduleChunksMap.delete(moduleId)\n disposeModule(moduleId, 'clear')\n availableModules.delete(moduleId)\n }\n }\n\n return true\n}\n\n/**\n * Adds a module to a chunk.\n */\nfunction addModuleToChunk(moduleId: ModuleId, chunkPath: ChunkPath) {\n let moduleChunks = moduleChunksMap.get(moduleId)\n if (!moduleChunks) {\n moduleChunks = new Set([chunkPath])\n moduleChunksMap.set(moduleId, moduleChunks)\n } else {\n moduleChunks.add(chunkPath)\n }\n\n let chunkModules = chunkModulesMap.get(chunkPath)\n if (!chunkModules) {\n chunkModules = new Set([moduleId])\n chunkModulesMap.set(chunkPath, chunkModules)\n } else {\n chunkModules.add(moduleId)\n }\n}\n\n/**\n * Marks a chunk list as a runtime chunk list. There can be more than one\n * runtime chunk list. For instance, integration tests can have multiple chunk\n * groups loaded at runtime, each with its own chunk list.\n */\nfunction markChunkListAsRuntime(chunkListPath: ChunkListPath) {\n runtimeChunkLists.add(chunkListPath)\n}\n\nfunction registerChunk(registration: ChunkRegistration) {\n const chunkPath = getPathFromScript(registration[0])\n let runtimeParams: RuntimeParams | undefined\n // When bootstrapping we are passed a single runtimeParams object so we can distinguish purely based on length\n if (registration.length === 2) {\n runtimeParams = registration[1] as RuntimeParams\n } else {\n runtimeParams = undefined\n installCompressedModuleFactories(\n registration as CompressedModuleFactories,\n /* offset= */ 1,\n moduleFactories,\n (id: ModuleId) => addModuleToChunk(id, chunkPath)\n )\n }\n return BACKEND.registerChunk(chunkPath, runtimeParams)\n}\n\n/**\n * Subscribes to chunk list updates from the update server and applies them.\n */\nfunction registerChunkList(chunkList: ChunkList) {\n const chunkListScript = chunkList.script\n const chunkListPath = getPathFromScript(chunkListScript)\n // The \"chunk\" is also registered to finish the loading in the backend\n BACKEND.registerChunk(chunkListPath as string as ChunkPath)\n globalThis.TURBOPACK_CHUNK_UPDATE_LISTENERS!.push([\n chunkListPath,\n handleApply.bind(null, chunkListPath),\n ])\n\n // Adding chunks to chunk lists and vice versa.\n const chunkPaths = new Set(chunkList.chunks.map(getChunkPath))\n chunkListChunksMap.set(chunkListPath, chunkPaths)\n for (const chunkPath of chunkPaths) {\n let chunkChunkLists = chunkChunkListsMap.get(chunkPath)\n if (!chunkChunkLists) {\n chunkChunkLists = new Set([chunkListPath])\n chunkChunkListsMap.set(chunkPath, chunkChunkLists)\n } else {\n chunkChunkLists.add(chunkListPath)\n }\n }\n\n if (chunkList.source === 'entry') {\n markChunkListAsRuntime(chunkListPath)\n }\n}\n\nglobalThis.TURBOPACK_CHUNK_UPDATE_LISTENERS ??= []\n"],"names":["devContextPrototype","Context","prototype","devModuleCache","Object","create","c","UpdateApplyError","Error","name","dependencyChain","message","runtimeModules","Set","moduleChunksMap","Map","chunkModulesMap","runtimeChunkLists","chunkListChunksMap","chunkChunkListsMap","moduleHotData","moduleHotState","queuedInvalidatedModules","getOrInstantiateRuntimeModule","chunkPath","moduleId","module","error","instantiateModule","SourceType","Runtime","getOrInstantiateModuleFromParent","id","sourceModule","hot","active","console","warn","children","indexOf","push","parents","Parent","DevContext","exports","refresh","call","k","sourceType","sourceData","moduleFactory","moduleFactories","get","factoryNotAvailableMessage","hotData","hotState","createModuleHot","add","Update","invariant","createModuleObject","set","runModuleExecutionHooks","context","namespaceObject","interopEsm","DUMMY_REFRESH_CONTEXT","register","_type","_id","signature","registerExports","_module","_helpers","executeModule","globalThis","$RefreshInterceptModuleExecution$","cleanupReactRefreshIntercept","$RefreshReg$","$RefreshSig$","registerExportsAndSetupBoundaryForReactRefresh","helpers","currentExports","prevExports","data","registerExportsForReactRefresh","isReactRefreshBoundary","dispose","accept","shouldInvalidateReactRefreshBoundary","getRefreshBoundarySignature","invalidate","scheduleUpdate","isNoLongerABoundary","formatDependencyChain","join","computeOutdatedModules","added","modified","newModuleFactories","entry","_eval","outdatedModules","computedInvalidatedModules","keys","invalidated","effect","getAffectedModuleEffects","type","outdatedModuleId","computeOutdatedSelfAcceptedModules","outdatedSelfAcceptedModules","selfAccepted","selfInvalidated","errorHandler","updateChunksPhase","chunksAddedModules","chunksDeletedModules","addedModuleIds","addModuleToChunk","disposedModules","removeModuleFromChunk","disposePhase","disposeModule","outdatedModuleParents","oldModule","mode","disposeHandler","disposeHandlers","delete","childId","child","idx","splice","applyPhase","reportError","factory","entries","applyModuleFactoryName","err","err2","applyUpdate","update","applyChunkListUpdate","merged","applyEcmascriptMergedUpdate","chunks","chunkUpdate","chunkUrl","getChunkRelativeUrl","BACKEND","loadChunkCached","DEV_BACKEND","reloadChunk","unloadChunk","instruction","JSON","stringify","chunksAdded","chunksDeleted","computeChangedModules","applyInternal","applyInvalidatedModules","size","forEach","clear","updates","deleted","mergedChunkUpdate","updateAdded","modules","updateDeleted","has","queue","nextItem","shift","undefined","selfDeclined","parentId","parent","handleApply","chunkListPath","restart","disposeChunkList","_callback","_errorHandler","decline","dep","callback","addDisposeHandler","removeDisposeHandler","status","addStatusHandler","_handler","removeStatusHandler","check","Promise","resolve","moduleChunks","chunkModules","noRemainingModules","noRemainingChunks","chunkPaths","chunkChunkLists","disposeChunk","chunkListUrl","availableModules","markChunkListAsRuntime","registerChunk","registration","getPathFromScript","runtimeParams","length","installCompressedModuleFactories","registerChunkList","chunkList","chunkListScript","script","TURBOPACK_CHUNK_UPDATE_LISTENERS","bind","map","getChunkPath","source"],"mappings":"AAAA,2CAA2C;AAC3C,4CAA4C;AAC5C,4CAA4C;AAM5C,MAAMA,sBAAsBC,QAAQC,SAAS;AAE7C;;;;;;CAMC,GAED,oDAAoD,GAEpD,MAAMC,iBAAyCC,OAAOC,MAAM,CAAC;AAC7DL,oBAAoBM,CAAC,GAAGH;AAgCxB,MAAMI,yBAAyBC;IAC7BC,OAAO,mBAAkB;IAEzBC,gBAA2B;IAE3BH,YAAYI,OAAe,EAAED,eAA2B,CAAE;QACxD,KA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gC,KAAK,EAAE","ignoreList":[0]}}, - {"offset": {"line": 1595, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/browser/runtime/dom/runtime-backend-dom.ts"],"sourcesContent":["/**\n * This file contains the runtime code specific to the Turbopack ECMAScript DOM runtime.\n *\n * It will be appended to the base runtime code.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n/// \n\nfunction getChunkSuffixFromScriptSrc() {\n // TURBOPACK_CHUNK_SUFFIX is set in web workers\n return (\n (self.TURBOPACK_CHUNK_SUFFIX ??\n document?.currentScript\n ?.getAttribute?.('src')\n ?.replace(/^(.*(?=\\?)|^.*$)/, '')) ||\n ''\n )\n}\n\ntype ChunkResolver = {\n resolved: boolean\n loadingStarted: boolean\n resolve: () => void\n reject: (error?: Error) => void\n promise: Promise\n}\n\nlet BACKEND: RuntimeBackend\n\n/**\n * Maps chunk paths to the corresponding resolver.\n */\nconst chunkResolvers: Map = new Map()\n\n;(() => {\n BACKEND = {\n async registerChunk(chunkPath, params) {\n const chunkUrl = getChunkRelativeUrl(chunkPath)\n\n const resolver = getOrCreateResolver(chunkUrl)\n resolver.resolve()\n\n if (params == null) {\n return\n }\n\n for (const otherChunkData of params.otherChunks) {\n const otherChunkPath = getChunkPath(otherChunkData)\n const otherChunkUrl = getChunkRelativeUrl(otherChunkPath)\n\n // Chunk might have started loading, so we want to avoid triggering another load.\n getOrCreateResolver(otherChunkUrl)\n }\n\n // This waits for chunks to be loaded, but also marks included items as available.\n await Promise.all(\n params.otherChunks.map((otherChunkData) =>\n loadInitialChunk(chunkPath, otherChunkData)\n )\n )\n\n if (params.runtimeModuleIds.length > 0) {\n for (const moduleId of params.runtimeModuleIds) {\n getOrInstantiateRuntimeModule(chunkPath, moduleId)\n }\n }\n },\n\n /**\n * Loads the given chunk, and returns a promise that resolves once the chunk\n * has been loaded.\n */\n loadChunkCached(sourceType: SourceType, chunkUrl: ChunkUrl) {\n return doLoadChunk(sourceType, chunkUrl)\n },\n\n async loadWebAssembly(\n _sourceType: SourceType,\n _sourceData: SourceData,\n wasmChunkPath: ChunkPath,\n _edgeModule: () => WebAssembly.Module,\n importsObj: WebAssembly.Imports\n ): Promise {\n const req = fetchWebAssembly(wasmChunkPath)\n\n const { instance } = await WebAssembly.instantiateStreaming(\n req,\n importsObj\n )\n\n return instance.exports\n },\n\n async loadWebAssemblyModule(\n _sourceType: SourceType,\n _sourceData: SourceData,\n wasmChunkPath: ChunkPath,\n _edgeModule: () => WebAssembly.Module\n ): Promise {\n const req = fetchWebAssembly(wasmChunkPath)\n\n return await WebAssembly.compileStreaming(req)\n },\n }\n\n function getOrCreateResolver(chunkUrl: ChunkUrl): ChunkResolver {\n let resolver = chunkResolvers.get(chunkUrl)\n if (!resolver) {\n let resolve: () => void\n let reject: (error?: Error) => void\n const promise = new Promise((innerResolve, innerReject) => {\n resolve = innerResolve\n reject = innerReject\n })\n resolver = {\n resolved: false,\n loadingStarted: false,\n promise,\n resolve: () => {\n resolver!.resolved = true\n resolve()\n },\n reject: reject!,\n }\n chunkResolvers.set(chunkUrl, resolver)\n }\n return resolver\n }\n\n /**\n * Loads the given chunk, and returns a promise that resolves once the chunk\n * has been loaded.\n */\n function doLoadChunk(sourceType: SourceType, chunkUrl: ChunkUrl) {\n const resolver = getOrCreateResolver(chunkUrl)\n if (resolver.loadingStarted) {\n return resolver.promise\n }\n\n if (sourceType === SourceType.Runtime) {\n // We don't need to load chunks references from runtime code, as they're already\n // present in the DOM.\n resolver.loadingStarted = true\n\n if (isCss(chunkUrl)) {\n // CSS chunks do not register themselves, and as such must be marked as\n // loaded instantly.\n resolver.resolve()\n }\n\n // We need to wait for JS chunks to register themselves within `registerChunk`\n // before we can start instantiating runtime modules, hence the absence of\n // `resolver.resolve()` in this branch.\n\n return resolver.promise\n }\n\n if (typeof importScripts === 'function') {\n // We're in a web worker\n if (isCss(chunkUrl)) {\n // ignore\n } else if (isJs(chunkUrl)) {\n self.TURBOPACK_NEXT_CHUNK_URLS!.push(chunkUrl)\n importScripts(TURBOPACK_WORKER_LOCATION + chunkUrl)\n } else {\n throw new Error(\n `can't infer type of chunk from URL ${chunkUrl} in worker`\n )\n }\n } else {\n // TODO(PACK-2140): remove this once all filenames are guaranteed to be escaped.\n const decodedChunkUrl = decodeURI(chunkUrl)\n\n if (isCss(chunkUrl)) {\n const previousLinks = document.querySelectorAll(\n `link[rel=stylesheet][href=\"${chunkUrl}\"],link[rel=stylesheet][href^=\"${chunkUrl}?\"],link[rel=stylesheet][href=\"${decodedChunkUrl}\"],link[rel=stylesheet][href^=\"${decodedChunkUrl}?\"]`\n )\n if (previousLinks.length > 0) {\n // CSS chunks do not register themselves, and as such must be marked as\n // loaded instantly.\n resolver.resolve()\n } else {\n const link = document.createElement('link')\n link.rel = 'stylesheet'\n link.href = chunkUrl\n link.onerror = () => {\n resolver.reject()\n }\n link.onload = () => {\n // CSS chunks do not register themselves, and as such must be marked as\n // loaded instantly.\n resolver.resolve()\n }\n // Append to the `head` for webpack compatibility.\n document.head.appendChild(link)\n }\n } else if (isJs(chunkUrl)) {\n const previousScripts = document.querySelectorAll(\n `script[src=\"${chunkUrl}\"],script[src^=\"${chunkUrl}?\"],script[src=\"${decodedChunkUrl}\"],script[src^=\"${decodedChunkUrl}?\"]`\n )\n if (previousScripts.length > 0) {\n // There is this edge where the script already failed loading, but we\n // can't detect that. The Promise will never resolve in this case.\n for (const script of Array.from(previousScripts)) {\n script.addEventListener('error', () => {\n resolver.reject()\n })\n }\n } else {\n const script = document.createElement('script')\n script.src = chunkUrl\n // We'll only mark the chunk as loaded once the script has been executed,\n // which happens in `registerChunk`. Hence the absence of `resolve()` in\n // this branch.\n script.onerror = () => {\n resolver.reject()\n }\n // Append to the `head` for webpack compatibility.\n document.head.appendChild(script)\n }\n } else {\n throw new Error(`can't infer type of chunk from URL ${chunkUrl}`)\n }\n }\n\n resolver.loadingStarted = true\n return resolver.promise\n }\n\n function fetchWebAssembly(wasmChunkPath: ChunkPath) {\n return fetch(getChunkRelativeUrl(wasmChunkPath))\n }\n})()\n"],"names":["getChunkSuffixFromScriptSrc","self","TURBOPACK_CHUNK_SUFFIX","document","currentScript","getAttribute","replace","BACKEND","chunkResolvers","Map","registerChunk","chunkPath","params","chunkUrl","getChunkRelativeUrl","resolver","getOrCreateResolver","resolve","otherChunkData","otherChunks","otherChunkPath","getChunkPath","otherChunkUrl","Promise","all","map","loadInitialChunk","runtimeModuleIds","length","moduleId","getOrInstantiateRuntimeModule","loadChunkCached","sourceType","doLoadChunk","loadWebAssembly","_sourceType","_sourceData","wasmChunkPath","_edgeModule","importsObj","req","fetchWebAssembly","instance","WebAssembly","instantiateStreaming","exports","loadWebAssemblyModule","compileStreaming","get","reject","promise","innerResolve","innerReject","resolved","loadingStarted","set","SourceType","Runtime","isCss","importScripts","isJs","TURBOPACK_NEXT_CHUNK_URLS","push","TURBOPACK_WORKER_LOCATION","Error","decodedChunkUrl","decodeURI","previousLinks","querySelectorAll","link","createElement","rel","href","onerror","onload","head","appendChild","previousScripts","script","Array","from","addEventListener","src","fetch"],"mappings":"AAAA;;;;CAIC,GAED,oDAAoD,GAEpD,sEAAsE;AACtE,2DAA2D;AAE3D,SAASA;IACP,+CAA+C;IAC/C,OACE,CAACC,KAAKC,sBAAsB,IAC1BC,UAAUC,eACNC,eAAe,QACfC,QAAQ,oBAAoB,GAAG,KACrC;AAEJ;AAUA,IAAIC;AAEJ;;CAEC,GACD,MAAMC,iBAA+C,IAAIC;AAExD,CAAC;IACAF,UAAU;QACR,MAAMG,eAAcC,SAAS,EAAEC,MAAM;YACnC,MAAMC,WAAWC,oBAAoBH;YAErC,MAAMI,WAAWC,oBAAoBH;YACrCE,SAASE,OAAO;YAEhB,IAAIL,UAAU,MAAM;gBAClB;YACF;YAEA,KAAK,MAAMM,kBAAkBN,OAAOO,WAAW,CAAE;gBAC/C,MAAMC,iBAAiBC,aAAaH;gBACpC,MAAMI,gBAAgBR,oBAAoBM;gBAE1C,iFAAiF;gBACjFJ,oBAAo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SAASwE,IAAI,CAACC,WAAW,CAACP;gBAC5B;YACF,OAAO,IAAIT,KAAK/C,WAAW;gBACzB,MAAMgE,kBAAkB1E,SAASiE,gBAAgB,CAC/C,CAAC,YAAY,EAAEvD,SAAS,gBAAgB,EAAEA,SAAS,gBAAgB,EAAEoD,gBAAgB,gBAAgB,EAAEA,gBAAgB,GAAG,CAAC;gBAE7H,IAAIY,gBAAgBjD,MAAM,GAAG,GAAG;oBAC9B,qEAAqE;oBACrE,kEAAkE;oBAClE,KAAK,MAAMkD,UAAUC,MAAMC,IAAI,CAACH,iBAAkB;wBAChDC,OAAOG,gBAAgB,CAAC,SAAS;4BAC/BlE,SAASkC,MAAM;wBACjB;oBACF;gBACF,OAAO;oBACL,MAAM6B,SAAS3E,SAASmE,aAAa,CAAC;oBACtCQ,OAAOI,GAAG,GAAGrE;oBACb,yEAAyE;oBACzE,wEAAwE;oBACxE,eAAe;oBACfiE,OAAOL,OAAO,GAAG;wBACf1D,SAASkC,MAAM;oBACjB;oBACA,kDAAkD;oBAClD9C,SAASwE,IAAI,CAACC,WAAW,CAACE;gBAC5B;YACF,OAAO;gBACL,MAAM,IAAId,MAAM,CAAC,mCAAmC,EAAEnD,UAAU;YAClE;QACF;QAEAE,SAASuC,cAAc,GAAG;QAC1B,OAAOvC,SAASmC,OAAO;IACzB;IAEA,SAAST,iBAAiBJ,aAAwB;QAChD,OAAO8C,MAAMrE,oBAAoBuB;IACnC;AACF,CAAC","ignoreList":[0]}}, - {"offset": {"line": 1760, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/browser/runtime/dom/dev-backend-dom.ts"],"sourcesContent":["/**\n * This file contains the runtime code specific to the Turbopack development\n * ECMAScript DOM runtime.\n *\n * It will be appended to the base development runtime code.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n/// \n/// \n/// \n\nlet DEV_BACKEND: DevRuntimeBackend\n;(() => {\n DEV_BACKEND = {\n unloadChunk(chunkUrl) {\n deleteResolver(chunkUrl)\n\n // TODO(PACK-2140): remove this once all filenames are guaranteed to be escaped.\n const decodedChunkUrl = decodeURI(chunkUrl)\n\n if (isCss(chunkUrl)) {\n const links = document.querySelectorAll(\n `link[href=\"${chunkUrl}\"],link[href^=\"${chunkUrl}?\"],link[href=\"${decodedChunkUrl}\"],link[href^=\"${decodedChunkUrl}?\"]`\n )\n for (const link of Array.from(links)) {\n link.remove()\n }\n } else if (isJs(chunkUrl)) {\n // Unloading a JS chunk would have no effect, as it lives in the JS\n // runtime once evaluated.\n // However, we still want to remove the script tag from the DOM to keep\n // the HTML somewhat consistent from the user's perspective.\n const scripts = document.querySelectorAll(\n `script[src=\"${chunkUrl}\"],script[src^=\"${chunkUrl}?\"],script[src=\"${decodedChunkUrl}\"],script[src^=\"${decodedChunkUrl}?\"]`\n )\n for (const script of Array.from(scripts)) {\n script.remove()\n }\n } else {\n throw new Error(`can't infer type of chunk from URL ${chunkUrl}`)\n }\n },\n\n reloadChunk(chunkUrl) {\n return new Promise((resolve, reject) => {\n if (!isCss(chunkUrl)) {\n reject(new Error('The DOM backend can only reload CSS chunks'))\n return\n }\n\n const decodedChunkUrl = decodeURI(chunkUrl)\n const previousLinks = document.querySelectorAll(\n `link[rel=stylesheet][href=\"${chunkUrl}\"],link[rel=stylesheet][href^=\"${chunkUrl}?\"],link[rel=stylesheet][href=\"${decodedChunkUrl}\"],link[rel=stylesheet][href^=\"${decodedChunkUrl}?\"]`\n )\n\n if (previousLinks.length === 0) {\n reject(new Error(`No link element found for chunk ${chunkUrl}`))\n return\n }\n\n const link = document.createElement('link')\n link.rel = 'stylesheet'\n\n if (navigator.userAgent.includes('Firefox')) {\n // Firefox won't reload CSS files that were previously loaded on the current page,\n // we need to add a query param to make sure CSS is actually reloaded from the server.\n //\n // I believe this is this issue: https://bugzilla.mozilla.org/show_bug.cgi?id=1037506\n //\n // Safari has a similar issue, but only if you have a `` tag\n // pointing to the same URL as the stylesheet: https://bugs.webkit.org/show_bug.cgi?id=187726\n link.href = `${chunkUrl}?ts=${Date.now()}`\n } else {\n link.href = chunkUrl\n }\n\n link.onerror = () => {\n reject()\n }\n link.onload = () => {\n // First load the new CSS, then remove the old ones. This prevents visible\n // flickering that would happen in-between removing the previous CSS and\n // loading the new one.\n for (const previousLink of Array.from(previousLinks))\n previousLink.remove()\n\n // CSS chunks do not register themselves, and as such must be marked as\n // loaded instantly.\n resolve()\n }\n\n // Make sure to insert the new CSS right after the previous one, so that\n // its precedence is higher.\n previousLinks[0].parentElement!.insertBefore(\n link,\n previousLinks[0].nextSibling\n )\n })\n },\n\n restart: () => self.location.reload(),\n }\n\n function deleteResolver(chunkUrl: ChunkUrl) {\n chunkResolvers.delete(chunkUrl)\n }\n})()\n\nfunction _eval({ code, url, map }: EcmascriptModuleEntry): ModuleFactory {\n code += `\\n\\n//# sourceURL=${encodeURI(\n location.origin + CHUNK_BASE_PATH + url + CHUNK_SUFFIX\n )}`\n if (map) {\n code += `\\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,${btoa(\n // btoa doesn't handle nonlatin characters, so escape them as \\x sequences\n // See https://stackoverflow.com/a/26603875\n unescape(encodeURIComponent(map))\n )}`\n }\n\n // eslint-disable-next-line no-eval\n return eval(code)\n}\n"],"names":["DEV_BACKEND","unloadChunk","chunkUrl","deleteResolver","decodedChunkUrl","decodeURI","isCss","links","document","querySelectorAll","link","Array","from","remove","isJs","scripts","script","Error","reloadChunk","Promise","resolve","reject","previousLinks","length","createElement","rel","navigator","userAgent","includes","href","Date","now","onerror","onload","previousLink","parentElement","insertBefore","nextSibling","restart","self","location","reload","chunkResolvers","delete","_eval","code","url","map","encodeURI","origin","CHUNK_BASE_PATH","CHUNK_SUFFIX","btoa","unescape","encodeURIComponent","eval"],"mappings":"AAAA;;;;;CAKC,GAED,oDAAoD,GAEpD,gDAAgD;AAChD,4CAA4C;AAC5C,iDAAiD;AACjD,0DAA0D;AAE1D,IAAIA;AACH,CAAC;IACAA,cAAc;QACZC,aAAYC,QAAQ;Y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IC,UAAUC,SAAS,CAACC,QAAQ,CAAC,YAAY;oBAC3C,kFAAkF;oBAClF,sFAAsF;oBACtF,EAAE;oBACF,qFAAqF;oBACrF,EAAE;oBACF,oFAAoF;oBACpF,6FAA6F;oBAC7FlB,KAAKmB,IAAI,GAAG,GAAG3B,SAAS,IAAI,EAAE4B,KAAKC,GAAG,IAAI;gBAC5C,OAAO;oBACLrB,KAAKmB,IAAI,GAAG3B;gBACd;gBAEAQ,KAAKsB,OAAO,GAAG;oBACbX;gBACF;gBACAX,KAAKuB,MAAM,GAAG;oBACZ,0EAA0E;oBAC1E,wEAAwE;oBACxE,uBAAuB;oBACvB,KAAK,MAAMC,gBAAgBvB,MAAMC,IAAI,CAACU,eACpCY,aAAarB,MAAM;oBAErB,uEAAuE;oBACvE,oBAAoB;oBACpBO;gBACF;gBAEA,wEAAwE;gBACxE,4BAA4B;gBAC5BE,aAAa,CAAC,EAAE,CAACa,aAAa,CAAEC,YAAY,CAC1C1B,MACAY,aAAa,CAAC,EAAE,CAACe,WAAW;YAEhC;QACF;QAEAC,SAAS,IAAMC,KAAKC,QAAQ,CAACC,MAAM;IACrC;IAEA,SAAStC,eAAeD,QAAkB;QACxCwC,eAAeC,MAAM,CAACzC;IACxB;AACF,CAAC;AAED,SAAS0C,MAAM,EAAEC,IAAI,EAAEC,GAAG,EAAEC,GAAG,EAAyB;IACtDF,QAAQ,CAAC,kBAAkB,EAAEG,UAC3BR,SAASS,MAAM,GAAGC,kBAAkBJ,MAAMK,eACzC;IACH,IAAIJ,KAAK;QACPF,QAAQ,CAAC,kEAAkE,EAAEO,KAC3E,0EAA0E;QAC1E,2CAA2C;QAC3CC,SAASC,mBAAmBP,QAC3B;IACL;IAEA,mCAAmC;IACnC,OAAOQ,KAAKV;AACd","ignoreList":[0]}}] + {"offset": {"line": 514, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/browser/runtime/base/runtime-base.ts"],"sourcesContent":["/**\n * This file contains runtime types and functions that are shared between all\n * Turbopack *browser* ECMAScript runtimes.\n *\n * It will be appended to the runtime code of each runtime right after the\n * shared runtime utils.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n/// \n\n// Used in WebWorkers to tell the runtime about the chunk base path\ndeclare var TURBOPACK_WORKER_LOCATION: string\n// Used in WebWorkers to tell the runtime about the chunk suffix\ndeclare var TURBOPACK_CHUNK_SUFFIX: string\n// Used in WebWorkers to tell the runtime about the current chunk url since it can't be detected via document.currentScript\n// Note it's stored in reversed order to use push and pop\ndeclare var TURBOPACK_NEXT_CHUNK_URLS: ChunkUrl[] | undefined\n\n// Injected by rust code\ndeclare var CHUNK_BASE_PATH: string\ndeclare var CHUNK_SUFFIX: string\n\ninterface TurbopackBrowserBaseContext extends TurbopackBaseContext {\n R: ResolvePathFromModule\n}\n\nconst browserContextPrototype =\n Context.prototype as TurbopackBrowserBaseContext\n\n// Provided by build or dev base\ndeclare function instantiateModule(\n id: ModuleId,\n sourceType: SourceType,\n sourceData: SourceData\n): Module\n\ntype RuntimeParams = {\n otherChunks: ChunkData[]\n runtimeModuleIds: ModuleId[]\n}\n\ntype ChunkRegistration = [\n chunkPath: ChunkScript,\n ...([RuntimeParams] | CompressedModuleFactories),\n]\n\ntype ChunkList = {\n script: ChunkListScript\n chunks: ChunkData[]\n source: 'entry' | 'dynamic'\n}\n\nenum SourceType {\n /**\n * The module was instantiated because it was included in an evaluated chunk's\n * runtime.\n * SourceData is a ChunkPath.\n */\n Runtime = 0,\n /**\n * The module was instantiated because a parent module imported it.\n * SourceData is a ModuleId.\n */\n Parent = 1,\n /**\n * The module was instantiated because it was included in a chunk's hot module\n * update.\n * SourceData is an array of ModuleIds or undefined.\n */\n Update = 2,\n}\n\ntype SourceData = ChunkPath | ModuleId | ModuleId[] | undefined\ninterface RuntimeBackend {\n registerChunk: (chunkPath: ChunkPath, params?: RuntimeParams) => void\n /**\n * Returns the same Promise for the same chunk URL.\n */\n loadChunkCached: (sourceType: SourceType, chunkUrl: ChunkUrl) => Promise\n loadWebAssembly: (\n sourceType: SourceType,\n sourceData: SourceData,\n wasmChunkPath: ChunkPath,\n edgeModule: () => WebAssembly.Module,\n importsObj: WebAssembly.Imports\n ) => Promise\n loadWebAssemblyModule: (\n sourceType: SourceType,\n sourceData: SourceData,\n wasmChunkPath: ChunkPath,\n edgeModule: () => WebAssembly.Module\n ) => Promise\n}\n\ninterface DevRuntimeBackend {\n reloadChunk?: (chunkUrl: ChunkUrl) => Promise\n unloadChunk?: (chunkUrl: ChunkUrl) => void\n restart: () => void\n}\n\nconst moduleFactories: ModuleFactories = new Map()\ncontextPrototype.M = moduleFactories\n\nconst availableModules: Map | true> = new Map()\n\nconst availableModuleChunks: Map | true> = new Map()\n\nfunction factoryNotAvailableMessage(\n moduleId: ModuleId,\n sourceType: SourceType,\n sourceData: SourceData\n): string {\n let instantiationReason\n switch (sourceType) {\n case SourceType.Runtime:\n instantiationReason = `as a runtime entry of chunk ${sourceData}`\n break\n case SourceType.Parent:\n instantiationReason = `because it was required from module ${sourceData}`\n break\n case SourceType.Update:\n instantiationReason = 'because of an HMR update'\n break\n default:\n invariant(\n sourceType,\n (sourceType) => `Unknown source type: ${sourceType}`\n )\n }\n return `Module ${moduleId} was instantiated ${instantiationReason}, but the module factory is not available.`\n}\n\nfunction loadChunk(\n this: TurbopackBrowserBaseContext,\n chunkData: ChunkData\n): Promise {\n return loadChunkInternal(SourceType.Parent, this.m.id, chunkData)\n}\nbrowserContextPrototype.l = loadChunk\n\nfunction loadInitialChunk(chunkPath: ChunkPath, chunkData: ChunkData) {\n return loadChunkInternal(SourceType.Runtime, chunkPath, chunkData)\n}\n\nasync function loadChunkInternal(\n sourceType: SourceType,\n sourceData: SourceData,\n chunkData: ChunkData\n): Promise {\n if (typeof chunkData === 'string') {\n return loadChunkPath(sourceType, sourceData, chunkData)\n }\n\n const includedList = chunkData.included || []\n const modulesPromises = includedList.map((included) => {\n if (moduleFactories.has(included)) return true\n return availableModules.get(included)\n })\n if (modulesPromises.length > 0 && modulesPromises.every((p) => p)) {\n // When all included items are already loaded or loading, we can skip loading ourselves\n await Promise.all(modulesPromises)\n return\n }\n\n const includedModuleChunksList = chunkData.moduleChunks || []\n const moduleChunksPromises = includedModuleChunksList\n .map((included) => {\n // TODO(alexkirsz) Do we need this check?\n // if (moduleFactories[included]) return true;\n return availableModuleChunks.get(included)\n })\n .filter((p) => p)\n\n let promise: Promise\n if (moduleChunksPromises.length > 0) {\n // Some module chunks are already loaded or loading.\n\n if (moduleChunksPromises.length === includedModuleChunksList.length) {\n // When all included module chunks are already loaded or loading, we can skip loading ourselves\n await Promise.all(moduleChunksPromises)\n return\n }\n\n const moduleChunksToLoad: Set = new Set()\n for (const moduleChunk of includedModuleChunksList) {\n if (!availableModuleChunks.has(moduleChunk)) {\n moduleChunksToLoad.add(moduleChunk)\n }\n }\n\n for (const moduleChunkToLoad of moduleChunksToLoad) {\n const promise = loadChunkPath(sourceType, sourceData, moduleChunkToLoad)\n\n availableModuleChunks.set(moduleChunkToLoad, promise)\n\n moduleChunksPromises.push(promise)\n }\n\n promise = Promise.all(moduleChunksPromises)\n } else {\n promise = loadChunkPath(sourceType, sourceData, chunkData.path)\n\n // Mark all included module chunks as loading if they are not already loaded or loading.\n for (const includedModuleChunk of includedModuleChunksList) {\n if (!availableModuleChunks.has(includedModuleChunk)) {\n availableModuleChunks.set(includedModuleChunk, promise)\n }\n }\n }\n\n for (const included of includedList) {\n if (!availableModules.has(included)) {\n // It might be better to race old and new promises, but it's rare that the new promise will be faster than a request started earlier.\n // In production it's even more rare, because the chunk optimization tries to deduplicate modules anyway.\n availableModules.set(included, promise)\n }\n }\n\n await promise\n}\n\nconst loadedChunk = Promise.resolve(undefined)\nconst instrumentedBackendLoadChunks = new WeakMap<\n Promise,\n Promise | typeof loadedChunk\n>()\n// Do not make this async. React relies on referential equality of the returned Promise.\nfunction loadChunkByUrl(\n this: TurbopackBrowserBaseContext,\n chunkUrl: ChunkUrl\n) {\n return loadChunkByUrlInternal(SourceType.Parent, this.m.id, chunkUrl)\n}\nbrowserContextPrototype.L = loadChunkByUrl\n\n// Do not make this async. React relies on referential equality of the returned Promise.\nfunction loadChunkByUrlInternal(\n sourceType: SourceType,\n sourceData: SourceData,\n chunkUrl: ChunkUrl\n): Promise {\n const thenable = BACKEND.loadChunkCached(sourceType, chunkUrl)\n let entry = instrumentedBackendLoadChunks.get(thenable)\n if (entry === undefined) {\n const resolve = instrumentedBackendLoadChunks.set.bind(\n instrumentedBackendLoadChunks,\n thenable,\n loadedChunk\n )\n entry = thenable.then(resolve).catch((cause) => {\n let loadReason: string\n switch (sourceType) {\n case SourceType.Runtime:\n loadReason = `as a runtime dependency of chunk ${sourceData}`\n break\n case SourceType.Parent:\n loadReason = `from module ${sourceData}`\n break\n case SourceType.Update:\n loadReason = 'from an HMR update'\n break\n default:\n invariant(\n sourceType,\n (sourceType) => `Unknown source type: ${sourceType}`\n )\n }\n let error = new Error(\n `Failed to load chunk ${chunkUrl} ${loadReason}${\n cause ? `: ${cause}` : ''\n }`,\n cause ? { cause } : undefined\n )\n error.name = 'ChunkLoadError'\n throw error\n })\n instrumentedBackendLoadChunks.set(thenable, entry)\n }\n\n return entry\n}\n\n// Do not make this async. React relies on referential equality of the returned Promise.\nfunction loadChunkPath(\n sourceType: SourceType,\n sourceData: SourceData,\n chunkPath: ChunkPath\n): Promise {\n const url = getChunkRelativeUrl(chunkPath)\n return loadChunkByUrlInternal(sourceType, sourceData, url)\n}\n\n/**\n * Returns an absolute url to an asset.\n */\nfunction resolvePathFromModule(\n this: TurbopackBaseContext,\n moduleId: string\n): string {\n const exported = this.r(moduleId)\n return exported?.default ?? exported\n}\nbrowserContextPrototype.R = resolvePathFromModule\n\n/**\n * no-op for browser\n * @param modulePath\n */\nfunction resolveAbsolutePath(modulePath?: string): string {\n return `/ROOT/${modulePath ?? ''}`\n}\nbrowserContextPrototype.P = resolveAbsolutePath\n\n/**\n * Returns a blob URL for the worker.\n * @param chunks list of chunks to load\n */\nfunction getWorkerBlobURL(chunks: ChunkPath[]): string {\n // It is important to reverse the array so when bootstrapping we can infer what chunk is being\n // evaluated by poping urls off of this array. See `getPathFromScript`\n let bootstrap = `self.TURBOPACK_WORKER_LOCATION = ${JSON.stringify(location.origin)};\nself.TURBOPACK_CHUNK_SUFFIX = ${JSON.stringify(CHUNK_SUFFIX)};\nself.NEXT_DEPLOYMENT_ID = ${JSON.stringify((globalThis as any).NEXT_DEPLOYMENT_ID)};\nself.TURBOPACK_NEXT_CHUNK_URLS = ${JSON.stringify(chunks.reverse().map(getChunkRelativeUrl), null, 2)};\nimportScripts(...self.TURBOPACK_NEXT_CHUNK_URLS.map(c => self.TURBOPACK_WORKER_LOCATION + c).reverse());`\n let blob = new Blob([bootstrap], { type: 'text/javascript' })\n return URL.createObjectURL(blob)\n}\nbrowserContextPrototype.b = getWorkerBlobURL\n\n/**\n * Instantiates a runtime module.\n */\nfunction instantiateRuntimeModule(\n moduleId: ModuleId,\n chunkPath: ChunkPath\n): Module {\n return instantiateModule(moduleId, SourceType.Runtime, chunkPath)\n}\n/**\n * Returns the URL relative to the origin where a chunk can be fetched from.\n */\nfunction getChunkRelativeUrl(chunkPath: ChunkPath | ChunkListPath): ChunkUrl {\n return `${CHUNK_BASE_PATH}${chunkPath\n .split('/')\n .map((p) => encodeURIComponent(p))\n .join('/')}${CHUNK_SUFFIX}` as ChunkUrl\n}\n\n/**\n * Return the ChunkPath from a ChunkScript.\n */\nfunction getPathFromScript(chunkScript: ChunkPath | ChunkScript): ChunkPath\nfunction getPathFromScript(\n chunkScript: ChunkListPath | ChunkListScript\n): ChunkListPath\nfunction getPathFromScript(\n chunkScript: ChunkPath | ChunkListPath | ChunkScript | ChunkListScript\n): ChunkPath | ChunkListPath {\n if (typeof chunkScript === 'string') {\n return chunkScript as ChunkPath | ChunkListPath\n }\n const chunkUrl =\n typeof TURBOPACK_NEXT_CHUNK_URLS !== 'undefined'\n ? TURBOPACK_NEXT_CHUNK_URLS.pop()!\n : chunkScript.getAttribute('src')!\n const src = decodeURIComponent(chunkUrl.replace(/[?#].*$/, ''))\n const path = src.startsWith(CHUNK_BASE_PATH)\n ? src.slice(CHUNK_BASE_PATH.length)\n : src\n return path as ChunkPath | ChunkListPath\n}\n\nconst regexJsUrl = /\\.js(?:\\?[^#]*)?(?:#.*)?$/\n/**\n * Checks if a given path/URL ends with .js, optionally followed by ?query or #fragment.\n */\nfunction isJs(chunkUrlOrPath: ChunkUrl | ChunkPath): boolean {\n return regexJsUrl.test(chunkUrlOrPath)\n}\n\nconst regexCssUrl = /\\.css(?:\\?[^#]*)?(?:#.*)?$/\n/**\n * Checks if a given path/URL ends with .css, optionally followed by ?query or #fragment.\n */\nfunction isCss(chunkUrl: ChunkUrl): boolean {\n return regexCssUrl.test(chunkUrl)\n}\n\nfunction loadWebAssembly(\n this: TurbopackBaseContext,\n chunkPath: ChunkPath,\n edgeModule: () => WebAssembly.Module,\n importsObj: WebAssembly.Imports\n): Promise {\n return BACKEND.loadWebAssembly(\n SourceType.Parent,\n this.m.id,\n chunkPath,\n edgeModule,\n importsObj\n )\n}\ncontextPrototype.w = loadWebAssembly\n\nfunction loadWebAssemblyModule(\n this: TurbopackBaseContext,\n chunkPath: ChunkPath,\n edgeModule: () => WebAssembly.Module\n): Promise {\n return BACKEND.loadWebAssemblyModule(\n SourceType.Parent,\n this.m.id,\n chunkPath,\n edgeModule\n )\n}\ncontextPrototype.u = loadWebAssemblyModule\n"],"names":["browserContextPrototype","Context","prototype","SourceType","moduleFactories","Map","contextPrototype","M","availableModules","availableModuleChunks","factoryNotAvailableMessage","moduleId","sourceType","sourceData","instantiationReason","invariant","loadChunk","chunkData","loadChunkInternal","m","id","l","loadInitialChunk","chunkPath","loadChunkPath","includedList","included","modulesPromises","map","has","get","length","every","p","Promise","all","includedModuleChunksList","moduleChunks","moduleChunksPromises","filter","promise","moduleChunksToLoad","Set","moduleChunk","add","moduleChunkToLoad","set","push","path","includedModuleChunk","loadedChunk","resolve","undefined","instrumentedBackendLoadChunks","WeakMap","loadChunkByUrl","chunkUrl","loadChunkByUrlInternal","L","thenable","BACKEND","loadChunkCached","entry","bind","then","catch","cause","loadReason","error","Error","name","url","getChunkRelativeUrl","resolvePathFromModule","exported","r","default","R","resolveAbsolutePath","modulePath","P","getWorkerBlobURL","chunks","bootstrap","JSON","stringify","location","origin","CHUNK_SUFFIX","globalThis","NEXT_DEPLOYMENT_ID","reverse","blob","Blob","type","URL","createObjectURL","b","instantiateRuntimeModule","instantiateModule","CHUNK_BASE_PATH","split","encodeURIComponent","join","getPathFromScript","chunkScript","TURBOPACK_NEXT_CHUNK_URLS","pop","getAttribute","src","decodeURIComponent","replace","startsWith","slice","regexJsUrl","isJs","chunkUrlOrPath","test","regexCssUrl","isCss","loadWebAssembly","edgeModule","importsObj","w","loadWebAssemblyModule","u"],"mappings":"AAAA;;;;;;CAMC,GAED,oDAAoD,GAEpD,6CAA6C;AAC7C,yDAAyD;AAEzD,mEAAmE;AAgBnE,MAAMA,0BACJC,QAAQC,SAAS;AAyBnB,IAAA,AAAKC,oCAAAA;IACH;;;;GAIC;IAED;;;GAGC;IAED;;;;GAIC;WAhBEA;EAAAA;AAgDL,MAAMC,kBAAmC,IAAIC;AAC7CC,iBAAiBC,CAAC,GAAGH;AAErB,MAAMI,mBAAuD,IAAIH;AAEjE,MAAMI,wBAA6D,IAAIJ;AAEvE,SAASK,2BACPC,QAAkB,EAClBC,UAAsB,EACtBC,UAAsB;IAEtB,IAAIC;IACJ,OAAQF;QACN;YACEE,sBAAsB,CAAC,4BAA4B,EAAED,YAAY;YACjE;QACF;YACEC,sBAAsB,CAAC,oCAAoC,EAAED,YAAY;YACzE;QACF;YACEC,sBAAsB;YACtB;QACF;YACEC,UACEH,YACA,CAACA,aAAe,CAAC,qBAAqB,EAAEA,YAAY;IAE1D;IACA,OAAO,CAAC,OAAO,EAAED,SAAS,kBAAkB,EAAEG,oBAAoB,0CAA0C,CAAC;AAC/G;AAEA,SAASE,UAEPC,SAAo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BuH,CAAC,GAAGD","ignoreList":[0]}}, + {"offset": {"line": 742, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/browser/runtime/base/dev-base.ts"],"sourcesContent":["/// \n/// \n/// \n\ninterface TurbopackDevContext extends TurbopackBrowserBaseContext {\n k: RefreshContext\n}\n\nconst devContextPrototype = Context.prototype as TurbopackDevContext\n\n/**\n * This file contains runtime types and functions that are shared between all\n * Turbopack *development* ECMAScript runtimes.\n *\n * It will be appended to the runtime code of each runtime right after the\n * shared runtime utils.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\nconst devModuleCache: ModuleCache = Object.create(null)\ndevContextPrototype.c = devModuleCache\n\n// This file must not use `import` and `export` statements. Otherwise, it\n// becomes impossible to augment interfaces declared in ``d files\n// (e.g. `Module`). Hence, the need for `import()` here.\ntype RefreshRuntimeGlobals =\n import('@next/react-refresh-utils/dist/runtime').RefreshRuntimeGlobals\n\ndeclare var $RefreshHelpers$: RefreshRuntimeGlobals['$RefreshHelpers$']\ndeclare var $RefreshReg$: RefreshRuntimeGlobals['$RefreshReg$']\ndeclare var $RefreshSig$: RefreshRuntimeGlobals['$RefreshSig$']\ndeclare var $RefreshInterceptModuleExecution$: RefreshRuntimeGlobals['$RefreshInterceptModuleExecution$']\n\ntype RefreshContext = {\n register: RefreshRuntimeGlobals['$RefreshReg$']\n signature: RefreshRuntimeGlobals['$RefreshSig$']\n registerExports: typeof registerExportsAndSetupBoundaryForReactRefresh\n}\n\ntype RefreshHelpers = RefreshRuntimeGlobals['$RefreshHelpers$']\n\ntype ModuleFactory = (\n this: Module['exports'],\n context: TurbopackDevContext\n) => unknown\n\ninterface DevRuntimeBackend {\n reloadChunk?: (chunkUrl: ChunkUrl) => Promise\n unloadChunk?: (chunkUrl: ChunkUrl) => void\n restart: () => void\n}\n\nclass UpdateApplyError extends Error {\n name = 'UpdateApplyError'\n\n dependencyChain: ModuleId[]\n\n constructor(message: string, dependencyChain: ModuleId[]) {\n super(message)\n this.dependencyChain = dependencyChain\n }\n}\n\n/**\n * Module IDs that are instantiated as part of the runtime of a chunk.\n */\nconst runtimeModules: Set = new Set()\n\n/**\n * Map from module ID to the chunks that contain this module.\n *\n * In HMR, we need to keep track of which modules are contained in which so\n * chunks. This is so we don't eagerly dispose of a module when it is removed\n * from chunk A, but still exists in chunk B.\n */\nconst moduleChunksMap: Map> = new Map()\n/**\n * Map from a chunk path to all modules it contains.\n */\nconst chunkModulesMap: Map> = new Map()\n/**\n * Chunk lists that contain a runtime. When these chunk lists receive an update\n * that can't be reconciled with the current state of the page, we need to\n * reload the runtime entirely.\n */\nconst runtimeChunkLists: Set = new Set()\n/**\n * Map from a chunk list to the chunk paths it contains.\n */\nconst chunkListChunksMap: Map> = new Map()\n/**\n * Map from a chunk path to the chunk lists it belongs to.\n */\nconst chunkChunkListsMap: Map> = new Map()\n\n/**\n * Maps module IDs to persisted data between executions of their hot module\n * implementation (`hot.data`).\n */\nconst moduleHotData: Map = new Map()\n/**\n * Maps module instances to their hot module state.\n */\nconst moduleHotState: Map = new Map()\n/**\n * Modules that call `module.hot.invalidate()` (while being updated).\n */\nconst queuedInvalidatedModules: Set = new Set()\n\n/**\n * Gets or instantiates a runtime module.\n */\n// @ts-ignore\nfunction getOrInstantiateRuntimeModule(\n chunkPath: ChunkPath,\n moduleId: ModuleId\n): Module {\n const module = devModuleCache[moduleId]\n if (module) {\n if (module.error) {\n throw module.error\n }\n return module\n }\n\n // @ts-ignore\n return instantiateModule(moduleId, SourceType.Runtime, chunkPath)\n}\n\n/**\n * Retrieves a module from the cache, or instantiate it if it is not cached.\n */\n// @ts-ignore Defined in `runtime-utils.ts`\nconst getOrInstantiateModuleFromParent: GetOrInstantiateModuleFromParent<\n HotModule\n> = (id, sourceModule) => {\n if (!sourceModule.hot.active) {\n console.warn(\n `Unexpected import of module ${id} from module ${sourceModule.id}, which was deleted by an HMR update`\n )\n }\n\n const module = devModuleCache[id]\n\n if (sourceModule.children.indexOf(id) === -1) {\n sourceModule.children.push(id)\n }\n\n if (module) {\n if (module.error) {\n throw module.error\n }\n\n if (module.parents.indexOf(sourceModule.id) === -1) {\n module.parents.push(sourceModule.id)\n }\n\n return module\n }\n\n return instantiateModule(id, SourceType.Parent, sourceModule.id)\n}\n\nfunction DevContext(\n this: TurbopackDevContext,\n module: HotModule,\n exports: Exports,\n refresh: RefreshContext\n) {\n Context.call(this, module, exports)\n this.k = refresh\n}\nDevContext.prototype = Context.prototype\n\ntype DevContextConstructor = {\n new (\n module: HotModule,\n exports: Exports,\n refresh: RefreshContext\n ): TurbopackDevContext\n}\n\nfunction instantiateModule(\n moduleId: ModuleId,\n sourceType: SourceType,\n sourceData: SourceData\n): Module {\n // We are in development, this is always a string.\n let id = moduleId as string\n\n const moduleFactory = moduleFactories.get(id)\n if (typeof moduleFactory !== 'function') {\n // This can happen if modules incorrectly handle HMR disposes/updates,\n // e.g. when they keep a `setTimeout` around which still executes old code\n // and contains e.g. a `require(\"something\")` call.\n throw new Error(\n factoryNotAvailableMessage(id, sourceType, sourceData) +\n ' It might have been deleted in an HMR update.'\n )\n }\n\n const hotData = moduleHotData.get(id)!\n const { hot, hotState } = createModuleHot(id, hotData)\n\n let parents: ModuleId[]\n switch (sourceType) {\n case SourceType.Runtime:\n runtimeModules.add(id)\n parents = []\n break\n case SourceType.Parent:\n // No need to add this module as a child of the parent module here, this\n // has already been taken care of in `getOrInstantiateModuleFromParent`.\n parents = [sourceData as ModuleId]\n break\n case SourceType.Update:\n parents = (sourceData as ModuleId[]) || []\n break\n default:\n invariant(\n sourceType,\n (sourceType) => `Unknown source type: ${sourceType}`\n )\n }\n\n const module: HotModule = createModuleObject(id) as HotModule\n const exports = module.exports\n module.parents = parents\n module.children = []\n module.hot = hot\n\n devModuleCache[id] = module\n moduleHotState.set(module, hotState)\n\n // NOTE(alexkirsz) This can fail when the module encounters a runtime error.\n try {\n runModuleExecutionHooks(module, (refresh) => {\n const context = new (DevContext as any as DevContextConstructor)(\n module,\n exports,\n refresh\n )\n moduleFactory(context, module, exports)\n })\n } catch (error) {\n module.error = error as any\n throw error\n }\n\n if (module.namespaceObject && module.exports !== module.namespaceObject) {\n // in case of a circular dependency: cjs1 -> esm2 -> cjs1\n interopEsm(module.exports, module.namespaceObject)\n }\n\n return module\n}\n\nconst DUMMY_REFRESH_CONTEXT = {\n register: (_type: unknown, _id: unknown) => {},\n signature: () => (_type: unknown) => {},\n registerExports: (_module: unknown, _helpers: unknown) => {},\n}\n\n/**\n * NOTE(alexkirsz) Webpack has a \"module execution\" interception hook that\n * Next.js' React Refresh runtime hooks into to add module context to the\n * refresh registry.\n */\nfunction runModuleExecutionHooks(\n module: HotModule,\n executeModule: (ctx: RefreshContext) => void\n) {\n if (typeof globalThis.$RefreshInterceptModuleExecution$ === 'function') {\n const cleanupReactRefreshIntercept =\n globalThis.$RefreshInterceptModuleExecution$(module.id)\n try {\n executeModule({\n register: globalThis.$RefreshReg$,\n signature: globalThis.$RefreshSig$,\n registerExports: registerExportsAndSetupBoundaryForReactRefresh,\n })\n } finally {\n // Always cleanup the intercept, even if module execution failed.\n cleanupReactRefreshIntercept()\n }\n } else {\n // If the react refresh hooks are not installed we need to bind dummy functions.\n // This is expected when running in a Web Worker. It is also common in some of\n // our test environments.\n executeModule(DUMMY_REFRESH_CONTEXT)\n }\n}\n\n/**\n * This is adapted from https://github.com/vercel/next.js/blob/3466862d9dc9c8bb3131712134d38757b918d1c0/packages/react-refresh-utils/internal/ReactRefreshModule.runtime.ts\n */\nfunction registerExportsAndSetupBoundaryForReactRefresh(\n module: HotModule,\n helpers: RefreshHelpers\n) {\n const currentExports = module.exports\n const prevExports = module.hot.data.prevExports ?? null\n\n helpers.registerExportsForReactRefresh(currentExports, module.id)\n\n // A module can be accepted automatically based on its exports, e.g. when\n // it is a Refresh Boundary.\n if (helpers.isReactRefreshBoundary(currentExports)) {\n // Save the previous exports on update, so we can compare the boundary\n // signatures.\n module.hot.dispose((data) => {\n data.prevExports = currentExports\n })\n // Unconditionally accept an update to this module, we'll check if it's\n // still a Refresh Boundary later.\n module.hot.accept()\n\n // This field is set when the previous version of this module was a\n // Refresh Boundary, letting us know we need to check for invalidation or\n // enqueue an update.\n if (prevExports !== null) {\n // A boundary can become ineligible if its exports are incompatible\n // with the previous exports.\n //\n // For example, if you add/remove/change exports, we'll want to\n // re-execute the importing modules, and force those components to\n // re-render. Similarly, if you convert a class component to a\n // function, we want to invalidate the boundary.\n if (\n helpers.shouldInvalidateReactRefreshBoundary(\n helpers.getRefreshBoundarySignature(prevExports),\n helpers.getRefreshBoundarySignature(currentExports)\n )\n ) {\n module.hot.invalidate()\n } else {\n helpers.scheduleUpdate()\n }\n }\n } else {\n // Since we just executed the code for the module, it's possible that the\n // new exports made it ineligible for being a boundary.\n // We only care about the case when we were _previously_ a boundary,\n // because we already accepted this update (accidental side effect).\n const isNoLongerABoundary = prevExports !== null\n if (isNoLongerABoundary) {\n module.hot.invalidate()\n }\n }\n}\n\nfunction formatDependencyChain(dependencyChain: ModuleId[]): string {\n return `Dependency chain: ${dependencyChain.join(' -> ')}`\n}\n\nfunction computeOutdatedModules(\n added: Map,\n modified: Map\n): {\n outdatedModules: Set\n newModuleFactories: Map\n} {\n const newModuleFactories = new Map()\n\n for (const [moduleId, entry] of added) {\n if (entry != null) {\n newModuleFactories.set(moduleId, _eval(entry))\n }\n }\n\n const outdatedModules = computedInvalidatedModules(modified.keys())\n\n for (const [moduleId, entry] of modified) {\n newModuleFactories.set(moduleId, _eval(entry))\n }\n\n return { outdatedModules, newModuleFactories }\n}\n\nfunction computedInvalidatedModules(\n invalidated: Iterable\n): Set {\n const outdatedModules = new Set()\n\n for (const moduleId of invalidated) {\n const effect = getAffectedModuleEffects(moduleId)\n\n switch (effect.type) {\n case 'unaccepted':\n throw new UpdateApplyError(\n `cannot apply update: unaccepted module. ${formatDependencyChain(\n effect.dependencyChain\n )}.`,\n effect.dependencyChain\n )\n case 'self-declined':\n throw new UpdateApplyError(\n `cannot apply update: self-declined module. ${formatDependencyChain(\n effect.dependencyChain\n )}.`,\n effect.dependencyChain\n )\n case 'accepted':\n for (const outdatedModuleId of effect.outdatedModules) {\n outdatedModules.add(outdatedModuleId)\n }\n break\n // TODO(alexkirsz) Dependencies: handle dependencies effects.\n default:\n invariant(effect, (effect) => `Unknown effect type: ${effect?.type}`)\n }\n }\n\n return outdatedModules\n}\n\nfunction computeOutdatedSelfAcceptedModules(\n outdatedModules: Iterable\n): { moduleId: ModuleId; errorHandler: true | Function }[] {\n const outdatedSelfAcceptedModules: {\n moduleId: ModuleId\n errorHandler: true | Function\n }[] = []\n for (const moduleId of outdatedModules) {\n const module = devModuleCache[moduleId]\n const hotState = moduleHotState.get(module)!\n if (module && hotState.selfAccepted && !hotState.selfInvalidated) {\n outdatedSelfAcceptedModules.push({\n moduleId,\n errorHandler: hotState.selfAccepted,\n })\n }\n }\n return outdatedSelfAcceptedModules\n}\n\n/**\n * Adds, deletes, and moves modules between chunks. This must happen before the\n * dispose phase as it needs to know which modules were removed from all chunks,\n * which we can only compute *after* taking care of added and moved modules.\n */\nfunction updateChunksPhase(\n chunksAddedModules: Map>,\n chunksDeletedModules: Map>\n): { disposedModules: Set } {\n for (const [chunkPath, addedModuleIds] of chunksAddedModules) {\n for (const moduleId of addedModuleIds) {\n addModuleToChunk(moduleId, chunkPath)\n }\n }\n\n const disposedModules: Set = new Set()\n for (const [chunkPath, addedModuleIds] of chunksDeletedModules) {\n for (const moduleId of addedModuleIds) {\n if (removeModuleFromChunk(moduleId, chunkPath)) {\n disposedModules.add(moduleId)\n }\n }\n }\n\n return { disposedModules }\n}\n\nfunction disposePhase(\n outdatedModules: Iterable,\n disposedModules: Iterable\n): { outdatedModuleParents: Map> } {\n for (const moduleId of outdatedModules) {\n disposeModule(moduleId, 'replace')\n }\n\n for (const moduleId of disposedModules) {\n disposeModule(moduleId, 'clear')\n }\n\n // Removing modules from the module cache is a separate step.\n // We also want to keep track of previous parents of the outdated modules.\n const outdatedModuleParents = new Map()\n for (const moduleId of outdatedModules) {\n const oldModule = devModuleCache[moduleId]\n outdatedModuleParents.set(moduleId, oldModule?.parents)\n delete devModuleCache[moduleId]\n }\n\n // TODO(alexkirsz) Dependencies: remove outdated dependency from module\n // children.\n\n return { outdatedModuleParents }\n}\n\n/**\n * Disposes of an instance of a module.\n *\n * Returns the persistent hot data that should be kept for the next module\n * instance.\n *\n * NOTE: mode = \"replace\" will not remove modules from the devModuleCache\n * This must be done in a separate step afterwards.\n * This is important because all modules need to be disposed to update the\n * parent/child relationships before they are actually removed from the devModuleCache.\n * If this was done in this method, the following disposeModule calls won't find\n * the module from the module id in the cache.\n */\nfunction disposeModule(moduleId: ModuleId, mode: 'clear' | 'replace') {\n const module = devModuleCache[moduleId]\n if (!module) {\n return\n }\n\n const hotState = moduleHotState.get(module)!\n const data = {}\n\n // Run the `hot.dispose` handler, if any, passing in the persistent\n // `hot.data` object.\n for (const disposeHandler of hotState.disposeHandlers) {\n disposeHandler(data)\n }\n\n // This used to warn in `getOrInstantiateModuleFromParent` when a disposed\n // module is still importing other modules.\n module.hot.active = false\n\n moduleHotState.delete(module)\n\n // TODO(alexkirsz) Dependencies: delete the module from outdated deps.\n\n // Remove the disposed module from its children's parent list.\n // It will be added back once the module re-instantiates and imports its\n // children again.\n for (const childId of module.children) {\n const child = devModuleCache[childId]\n if (!child) {\n continue\n }\n\n const idx = child.parents.indexOf(module.id)\n if (idx >= 0) {\n child.parents.splice(idx, 1)\n }\n }\n\n switch (mode) {\n case 'clear':\n delete devModuleCache[module.id]\n moduleHotData.delete(module.id)\n break\n case 'replace':\n moduleHotData.set(module.id, data)\n break\n default:\n invariant(mode, (mode) => `invalid mode: ${mode}`)\n }\n}\n\nfunction applyPhase(\n outdatedSelfAcceptedModules: {\n moduleId: ModuleId\n errorHandler: true | Function\n }[],\n newModuleFactories: Map,\n outdatedModuleParents: Map>,\n reportError: (err: any) => void\n) {\n // Update module factories.\n for (const [moduleId, factory] of newModuleFactories.entries()) {\n applyModuleFactoryName(factory)\n moduleFactories.set(moduleId, factory)\n }\n\n // TODO(alexkirsz) Run new runtime entries here.\n\n // TODO(alexkirsz) Dependencies: call accept handlers for outdated deps.\n\n // Re-instantiate all outdated self-accepted modules.\n for (const { moduleId, errorHandler } of outdatedSelfAcceptedModules) {\n try {\n instantiateModule(\n moduleId,\n SourceType.Update,\n outdatedModuleParents.get(moduleId)\n )\n } catch (err) {\n if (typeof errorHandler === 'function') {\n try {\n errorHandler(err, { moduleId, module: devModuleCache[moduleId] })\n } catch (err2) {\n reportError(err2)\n reportError(err)\n }\n } else {\n reportError(err)\n }\n }\n }\n}\n\nfunction applyUpdate(update: PartialUpdate) {\n switch (update.type) {\n case 'ChunkListUpdate':\n applyChunkListUpdate(update)\n break\n default:\n invariant(update, (update) => `Unknown update type: ${update.type}`)\n }\n}\n\nfunction applyChunkListUpdate(update: ChunkListUpdate) {\n if (update.merged != null) {\n for (const merged of update.merged) {\n switch (merged.type) {\n case 'EcmascriptMergedUpdate':\n applyEcmascriptMergedUpdate(merged)\n break\n default:\n invariant(merged, (merged) => `Unknown merged type: ${merged.type}`)\n }\n }\n }\n\n if (update.chunks != null) {\n for (const [chunkPath, chunkUpdate] of Object.entries(\n update.chunks\n ) as Array<[ChunkPath, ChunkUpdate]>) {\n const chunkUrl = getChunkRelativeUrl(chunkPath)\n\n switch (chunkUpdate.type) {\n case 'added':\n BACKEND.loadChunkCached(SourceType.Update, chunkUrl)\n break\n case 'total':\n DEV_BACKEND.reloadChunk?.(chunkUrl)\n break\n case 'deleted':\n DEV_BACKEND.unloadChunk?.(chunkUrl)\n break\n case 'partial':\n invariant(\n chunkUpdate.instruction,\n (instruction) =>\n `Unknown partial instruction: ${JSON.stringify(instruction)}.`\n )\n break\n default:\n invariant(\n chunkUpdate,\n (chunkUpdate) => `Unknown chunk update type: ${chunkUpdate.type}`\n )\n }\n }\n }\n}\n\nfunction applyEcmascriptMergedUpdate(update: EcmascriptMergedUpdate) {\n const { entries = {}, chunks = {} } = update\n const { added, modified, chunksAdded, chunksDeleted } = computeChangedModules(\n entries,\n chunks\n )\n const { outdatedModules, newModuleFactories } = computeOutdatedModules(\n added,\n modified\n )\n const { disposedModules } = updateChunksPhase(chunksAdded, chunksDeleted)\n\n applyInternal(outdatedModules, disposedModules, newModuleFactories)\n}\n\nfunction applyInvalidatedModules(outdatedModules: Set) {\n if (queuedInvalidatedModules.size > 0) {\n computedInvalidatedModules(queuedInvalidatedModules).forEach((moduleId) => {\n outdatedModules.add(moduleId)\n })\n\n queuedInvalidatedModules.clear()\n }\n\n return outdatedModules\n}\n\nfunction applyInternal(\n outdatedModules: Set,\n disposedModules: Iterable,\n newModuleFactories: Map\n) {\n outdatedModules = applyInvalidatedModules(outdatedModules)\n\n const outdatedSelfAcceptedModules =\n computeOutdatedSelfAcceptedModules(outdatedModules)\n\n const { outdatedModuleParents } = disposePhase(\n outdatedModules,\n disposedModules\n )\n\n // we want to continue on error and only throw the error after we tried applying all updates\n let error: any\n\n function reportError(err: any) {\n if (!error) error = err\n }\n\n applyPhase(\n outdatedSelfAcceptedModules,\n newModuleFactories,\n outdatedModuleParents,\n reportError\n )\n\n if (error) {\n throw error\n }\n\n if (queuedInvalidatedModules.size > 0) {\n applyInternal(new Set(), [], new Map())\n }\n}\n\nfunction computeChangedModules(\n entries: Record,\n updates: Record\n): {\n added: Map\n modified: Map\n deleted: Set\n chunksAdded: Map>\n chunksDeleted: Map>\n} {\n const chunksAdded = new Map()\n const chunksDeleted = new Map()\n const added: Map = new Map()\n const modified = new Map()\n const deleted: Set = new Set()\n\n for (const [chunkPath, mergedChunkUpdate] of Object.entries(updates) as Array<\n [ChunkPath, EcmascriptMergedChunkUpdate]\n >) {\n switch (mergedChunkUpdate.type) {\n case 'added': {\n const updateAdded = new Set(mergedChunkUpdate.modules)\n for (const moduleId of updateAdded) {\n added.set(moduleId, entries[moduleId])\n }\n chunksAdded.set(chunkPath, updateAdded)\n break\n }\n case 'deleted': {\n // We could also use `mergedChunkUpdate.modules` here.\n const updateDeleted = new Set(chunkModulesMap.get(chunkPath))\n for (const moduleId of updateDeleted) {\n deleted.add(moduleId)\n }\n chunksDeleted.set(chunkPath, updateDeleted)\n break\n }\n case 'partial': {\n const updateAdded = new Set(mergedChunkUpdate.added)\n const updateDeleted = new Set(mergedChunkUpdate.deleted)\n for (const moduleId of updateAdded) {\n added.set(moduleId, entries[moduleId])\n }\n for (const moduleId of updateDeleted) {\n deleted.add(moduleId)\n }\n chunksAdded.set(chunkPath, updateAdded)\n chunksDeleted.set(chunkPath, updateDeleted)\n break\n }\n default:\n invariant(\n mergedChunkUpdate,\n (mergedChunkUpdate) =>\n `Unknown merged chunk update type: ${mergedChunkUpdate.type}`\n )\n }\n }\n\n // If a module was added from one chunk and deleted from another in the same update,\n // consider it to be modified, as it means the module was moved from one chunk to another\n // AND has new code in a single update.\n for (const moduleId of added.keys()) {\n if (deleted.has(moduleId)) {\n added.delete(moduleId)\n deleted.delete(moduleId)\n }\n }\n\n for (const [moduleId, entry] of Object.entries(entries)) {\n // Modules that haven't been added to any chunk but have new code are considered\n // to be modified.\n // This needs to be under the previous loop, as we need it to get rid of modules\n // that were added and deleted in the same update.\n if (!added.has(moduleId)) {\n modified.set(moduleId, entry)\n }\n }\n\n return { added, deleted, modified, chunksAdded, chunksDeleted }\n}\n\ntype ModuleEffect =\n | {\n type: 'unaccepted'\n dependencyChain: ModuleId[]\n }\n | {\n type: 'self-declined'\n dependencyChain: ModuleId[]\n moduleId: ModuleId\n }\n | {\n type: 'accepted'\n moduleId: ModuleId\n outdatedModules: Set\n }\n\nfunction getAffectedModuleEffects(moduleId: ModuleId): ModuleEffect {\n const outdatedModules: Set = new Set()\n\n type QueueItem = { moduleId?: ModuleId; dependencyChain: ModuleId[] }\n\n const queue: QueueItem[] = [\n {\n moduleId,\n dependencyChain: [],\n },\n ]\n\n let nextItem\n while ((nextItem = queue.shift())) {\n const { moduleId, dependencyChain } = nextItem\n\n if (moduleId != null) {\n if (outdatedModules.has(moduleId)) {\n // Avoid infinite loops caused by cycles between modules in the dependency chain.\n continue\n }\n\n outdatedModules.add(moduleId)\n }\n\n // We've arrived at the runtime of the chunk, which means that nothing\n // else above can accept this update.\n if (moduleId === undefined) {\n return {\n type: 'unaccepted',\n dependencyChain,\n }\n }\n\n const module = devModuleCache[moduleId]\n const hotState = moduleHotState.get(module)!\n\n if (\n // The module is not in the cache. Since this is a \"modified\" update,\n // it means that the module was never instantiated before.\n !module || // The module accepted itself without invalidating globalThis.\n // TODO is that right?\n (hotState.selfAccepted && !hotState.selfInvalidated)\n ) {\n continue\n }\n\n if (hotState.selfDeclined) {\n return {\n type: 'self-declined',\n dependencyChain,\n moduleId,\n }\n }\n\n if (runtimeModules.has(moduleId)) {\n queue.push({\n moduleId: undefined,\n dependencyChain: [...dependencyChain, moduleId],\n })\n continue\n }\n\n for (const parentId of module.parents) {\n const parent = devModuleCache[parentId]\n\n if (!parent) {\n // TODO(alexkirsz) Is this even possible?\n continue\n }\n\n // TODO(alexkirsz) Dependencies: check accepted and declined\n // dependencies here.\n\n queue.push({\n moduleId: parentId,\n dependencyChain: [...dependencyChain, moduleId],\n })\n }\n }\n\n return {\n type: 'accepted',\n moduleId,\n outdatedModules,\n }\n}\n\nfunction handleApply(chunkListPath: ChunkListPath, update: ServerMessage) {\n switch (update.type) {\n case 'partial': {\n // This indicates that the update is can be applied to the current state of the application.\n applyUpdate(update.instruction)\n break\n }\n case 'restart': {\n // This indicates that there is no way to apply the update to the\n // current state of the application, and that the application must be\n // restarted.\n DEV_BACKEND.restart()\n break\n }\n case 'notFound': {\n // This indicates that the chunk list no longer exists: either the dynamic import which created it was removed,\n // or the page itself was deleted.\n // If it is a dynamic import, we simply discard all modules that the chunk has exclusive access to.\n // If it is a runtime chunk list, we restart the application.\n if (runtimeChunkLists.has(chunkListPath)) {\n DEV_BACKEND.restart()\n } else {\n disposeChunkList(chunkListPath)\n }\n break\n }\n default:\n throw new Error(`Unknown update type: ${update.type}`)\n }\n}\n\nfunction createModuleHot(\n moduleId: ModuleId,\n hotData: HotData\n): { hot: Hot; hotState: HotState } {\n const hotState: HotState = {\n selfAccepted: false,\n selfDeclined: false,\n selfInvalidated: false,\n disposeHandlers: [],\n }\n\n const hot: Hot = {\n // TODO(alexkirsz) This is not defined in the HMR API. It was used to\n // decide whether to warn whenever an HMR-disposed module required other\n // modules. We might want to remove it.\n active: true,\n\n data: hotData ?? {},\n\n // TODO(alexkirsz) Support full (dep, callback, errorHandler) form.\n accept: (\n modules?: string | string[] | AcceptErrorHandler,\n _callback?: AcceptCallback,\n _errorHandler?: AcceptErrorHandler\n ) => {\n if (modules === undefined) {\n hotState.selfAccepted = true\n } else if (typeof modules === 'function') {\n hotState.selfAccepted = modules\n } else {\n throw new Error('unsupported `accept` signature')\n }\n },\n\n decline: (dep) => {\n if (dep === undefined) {\n hotState.selfDeclined = true\n } else {\n throw new Error('unsupported `decline` signature')\n }\n },\n\n dispose: (callback) => {\n hotState.disposeHandlers.push(callback)\n },\n\n addDisposeHandler: (callback) => {\n hotState.disposeHandlers.push(callback)\n },\n\n removeDisposeHandler: (callback) => {\n const idx = hotState.disposeHandlers.indexOf(callback)\n if (idx >= 0) {\n hotState.disposeHandlers.splice(idx, 1)\n }\n },\n\n invalidate: () => {\n hotState.selfInvalidated = true\n queuedInvalidatedModules.add(moduleId)\n },\n\n // NOTE(alexkirsz) This is part of the management API, which we don't\n // implement, but the Next.js React Refresh runtime uses this to decide\n // whether to schedule an update.\n status: () => 'idle',\n\n // NOTE(alexkirsz) Since we always return \"idle\" for now, these are no-ops.\n addStatusHandler: (_handler) => {},\n removeStatusHandler: (_handler) => {},\n\n // NOTE(jridgewell) Check returns the list of updated modules, but we don't\n // want the webpack code paths to ever update (the turbopack paths handle\n // this already).\n check: () => Promise.resolve(null),\n }\n\n return { hot, hotState }\n}\n\n/**\n * Removes a module from a chunk.\n * Returns `true` if there are no remaining chunks including this module.\n */\nfunction removeModuleFromChunk(\n moduleId: ModuleId,\n chunkPath: ChunkPath\n): boolean {\n const moduleChunks = moduleChunksMap.get(moduleId)!\n moduleChunks.delete(chunkPath)\n\n const chunkModules = chunkModulesMap.get(chunkPath)!\n chunkModules.delete(moduleId)\n\n const noRemainingModules = chunkModules.size === 0\n if (noRemainingModules) {\n chunkModulesMap.delete(chunkPath)\n }\n\n const noRemainingChunks = moduleChunks.size === 0\n if (noRemainingChunks) {\n moduleChunksMap.delete(moduleId)\n }\n\n return noRemainingChunks\n}\n\n/**\n * Disposes of a chunk list and its corresponding exclusive chunks.\n */\nfunction disposeChunkList(chunkListPath: ChunkListPath): boolean {\n const chunkPaths = chunkListChunksMap.get(chunkListPath)\n if (chunkPaths == null) {\n return false\n }\n chunkListChunksMap.delete(chunkListPath)\n\n for (const chunkPath of chunkPaths) {\n const chunkChunkLists = chunkChunkListsMap.get(chunkPath)!\n chunkChunkLists.delete(chunkListPath)\n\n if (chunkChunkLists.size === 0) {\n chunkChunkListsMap.delete(chunkPath)\n disposeChunk(chunkPath)\n }\n }\n\n // We must also dispose of the chunk list's chunk itself to ensure it may\n // be reloaded properly in the future.\n const chunkListUrl = getChunkRelativeUrl(chunkListPath)\n\n DEV_BACKEND.unloadChunk?.(chunkListUrl)\n\n return true\n}\n\n/**\n * Disposes of a chunk and its corresponding exclusive modules.\n *\n * @returns Whether the chunk was disposed of.\n */\nfunction disposeChunk(chunkPath: ChunkPath): boolean {\n const chunkUrl = getChunkRelativeUrl(chunkPath)\n // This should happen whether the chunk has any modules in it or not.\n // For instance, CSS chunks have no modules in them, but they still need to be unloaded.\n DEV_BACKEND.unloadChunk?.(chunkUrl)\n\n const chunkModules = chunkModulesMap.get(chunkPath)\n if (chunkModules == null) {\n return false\n }\n chunkModules.delete(chunkPath)\n\n for (const moduleId of chunkModules) {\n const moduleChunks = moduleChunksMap.get(moduleId)!\n moduleChunks.delete(chunkPath)\n\n const noRemainingChunks = moduleChunks.size === 0\n if (noRemainingChunks) {\n moduleChunksMap.delete(moduleId)\n disposeModule(moduleId, 'clear')\n availableModules.delete(moduleId)\n }\n }\n\n return true\n}\n\n/**\n * Adds a module to a chunk.\n */\nfunction addModuleToChunk(moduleId: ModuleId, chunkPath: ChunkPath) {\n let moduleChunks = moduleChunksMap.get(moduleId)\n if (!moduleChunks) {\n moduleChunks = new Set([chunkPath])\n moduleChunksMap.set(moduleId, moduleChunks)\n } else {\n moduleChunks.add(chunkPath)\n }\n\n let chunkModules = chunkModulesMap.get(chunkPath)\n if (!chunkModules) {\n chunkModules = new Set([moduleId])\n chunkModulesMap.set(chunkPath, chunkModules)\n } else {\n chunkModules.add(moduleId)\n }\n}\n\n/**\n * Marks a chunk list as a runtime chunk list. There can be more than one\n * runtime chunk list. For instance, integration tests can have multiple chunk\n * groups loaded at runtime, each with its own chunk list.\n */\nfunction markChunkListAsRuntime(chunkListPath: ChunkListPath) {\n runtimeChunkLists.add(chunkListPath)\n}\n\nfunction registerChunk(registration: ChunkRegistration) {\n const chunkPath = getPathFromScript(registration[0])\n let runtimeParams: RuntimeParams | undefined\n // When bootstrapping we are passed a single runtimeParams object so we can distinguish purely based on length\n if (registration.length === 2) {\n runtimeParams = registration[1] as RuntimeParams\n } else {\n runtimeParams = undefined\n installCompressedModuleFactories(\n registration as CompressedModuleFactories,\n /* offset= */ 1,\n moduleFactories,\n (id: ModuleId) => addModuleToChunk(id, chunkPath)\n )\n }\n return BACKEND.registerChunk(chunkPath, runtimeParams)\n}\n\n/**\n * Subscribes to chunk list updates from the update server and applies them.\n */\nfunction registerChunkList(chunkList: ChunkList) {\n const chunkListScript = chunkList.script\n const chunkListPath = getPathFromScript(chunkListScript)\n // The \"chunk\" is also registered to finish the loading in the backend\n BACKEND.registerChunk(chunkListPath as string as ChunkPath)\n globalThis.TURBOPACK_CHUNK_UPDATE_LISTENERS!.push([\n chunkListPath,\n handleApply.bind(null, chunkListPath),\n ])\n\n // Adding chunks to chunk lists and vice versa.\n const chunkPaths = new Set(chunkList.chunks.map(getChunkPath))\n chunkListChunksMap.set(chunkListPath, chunkPaths)\n for (const chunkPath of chunkPaths) {\n let chunkChunkLists = chunkChunkListsMap.get(chunkPath)\n if (!chunkChunkLists) {\n chunkChunkLists = new Set([chunkListPath])\n chunkChunkListsMap.set(chunkPath, chunkChunkLists)\n } else {\n chunkChunkLists.add(chunkListPath)\n }\n }\n\n if (chunkList.source === 'entry') {\n markChunkListAsRuntime(chunkListPath)\n }\n}\n\nglobalThis.TURBOPACK_CHUNK_UPDATE_LISTENERS ??= []\n"],"names":["devContextPrototype","Context","prototype","devModuleCache","Object","create","c","UpdateApplyError","Error","name","dependencyChain","message","runtimeModules","Set","moduleChunksMap","Map","chunkModulesMap","runtimeChunkLists","chunkListChunksMap","chunkChunkListsMap","moduleHotData","moduleHotState","queuedInvalidatedModules","getOrInstantiateRuntimeModule","chunkPath","moduleId","module","error","instantiateModule","SourceType","Runtime","getOrInstantiateModuleFromParent","id","sourceModule","hot","active","console","warn","children","indexOf","push","parents","Parent","DevContext","exports","refresh","call","k","sourceType","sourceData","moduleFactory","moduleFactories","get","factoryNotAvailableMessage","hotData","hotState","createModuleHot","add","Update","invariant","createModuleObject","set","runModuleExecutionHooks","context","namespaceObject","interopEsm","DUMMY_REFRESH_CONTEXT","register","_type","_id","signature","registerExports","_module","_helpers","executeModule","globalThis","$RefreshInterceptModuleExecution$","cleanupReactRefreshIntercept","$RefreshReg$","$RefreshSig$","registerExportsAndSetupBoundaryForReactRefresh","helpers","currentExports","prevExports","data","registerExportsForReactRefresh","isReactRefreshBoundary","dispose","accept","shouldInvalidateReactRefreshBoundary","getRefreshBoundarySignature","invalidate","scheduleUpdate","isNoLongerABoundary","formatDependencyChain","join","computeOutdatedModules","added","modified","newModuleFactories","entry","_eval","outdatedModules","computedInvalidatedModules","keys","invalidated","effect","getAffectedModuleEffects","type","outdatedModuleId","computeOutdatedSelfAcceptedModules","outdatedSelfAcceptedModules","selfAccepted","selfInvalidated","errorHandler","updateChunksPhase","chunksAddedModules","chunksDeletedModules","addedModuleIds","addModuleToChunk","disposedModules","removeModuleFromChunk","disposePhase","disposeModule","outdatedModuleParents","oldModule","mode","disposeHandler","disposeHandlers","delete","childId","child","idx","splice","applyPhase","reportError","factory","entries","applyModuleFactoryName","err","err2","applyUpdate","update","applyChunkListUpdate","merged","applyEcmascriptMergedUpdate","chunks","chunkUpdate","chunkUrl","getChunkRelativeUrl","BACKEND","loadChunkCached","DEV_BACKEND","reloadChunk","unloadChunk","instruction","JSON","stringify","chunksAdded","chunksDeleted","computeChangedModules","applyInternal","applyInvalidatedModules","size","forEach","clear","updates","deleted","mergedChunkUpdate","updateAdded","modules","updateDeleted","has","queue","nextItem","shift","undefined","selfDeclined","parentId","parent","handleApply","chunkListPath","restart","disposeChunkList","_callback","_errorHandler","decline","dep","callback","addDisposeHandler","removeDisposeHandler","status","addStatusHandler","_handler","removeStatusHandler","check","Promise","resolve","moduleChunks","chunkModules","noRemainingModules","noRemainingChunks","chunkPaths","chunkChunkLists","disposeChunk","chunkListUrl","availableModules","markChunkListAsRuntime","registerChunk","registration","getPathFromScript","runtimeParams","length","installCompressedModuleFactories","registerChunkList","chunkList","chunkListScript","script","TURBOPACK_CHUNK_UPDATE_LISTENERS","bind","map","getChunkPath","source"],"mappings":"AAAA,2CAA2C;AAC3C,4CAA4C;AAC5C,4CAA4C;AAM5C,MAAMA,sBAAsBC,QAAQC,SAAS;AAE7C;;;;;;CAMC,GAED,oDAAoD,GAEpD,MAAMC,iBAAyCC,OAAOC,MAAM,CAAC;AAC7DL,oBAAoBM,CAAC,GAAGH;AAgCxB,MAAMI,yBAAyBC;IAC7BC,OAAO,mBAAkB;IAEzBC,gBAA2B;IAE3BH,YAAYI,OAAe,EAAED,eAA2B,CAAE;QACxD,KAAK,CAACC;QACN,IAAI,CAACD,eAAe,GAAGA;IACzB;AACF;AAEA;;CAEC,GACD,MAAME,iBAAgC,IAAIC;AAE1C;;;;;;CAMC,GACD,MAAMC,kBAAiD,IAAIC;AAC3D;;CAEC,GACD,MAAMC,kBAAiD,IAAID;AAC3D;;;;CAI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MAAMzL,YAAY0L,kBAAkBD,YAAY,CAAC,EAAE;IACnD,IAAIE;IACJ,8GAA8G;IAC9G,IAAIF,aAAaG,MAAM,KAAK,GAAG;QAC7BD,gBAAgBF,YAAY,CAAC,EAAE;IACjC,OAAO;QACLE,gBAAgBnC;QAChBqC,iCACEJ,cACA,WAAW,GAAG,GACd9J,iBACA,CAACnB,KAAiBuF,iBAAiBvF,IAAIR;IAE3C;IACA,OAAO8H,QAAQ0D,aAAa,CAACxL,WAAW2L;AAC1C;AAEA;;CAEC,GACD,SAASG,kBAAkBC,SAAoB;IAC7C,MAAMC,kBAAkBD,UAAUE,MAAM;IACxC,MAAMpC,gBAAgB6B,kBAAkBM;IACxC,sEAAsE;IACtElE,QAAQ0D,aAAa,CAAC3B;IACtB1G,WAAW+I,gCAAgC,CAAElL,IAAI,CAAC;QAChD6I;QACAD,YAAYuC,IAAI,CAAC,MAAMtC;KACxB;IAED,+CAA+C;IAC/C,MAAMqB,aAAa,IAAI7L,IAAI0M,UAAUrE,MAAM,CAAC0E,GAAG,CAACC;IAChD3M,mBAAmB2C,GAAG,CAACwH,eAAeqB;IACtC,KAAK,MAAMlL,aAAakL,WAAY;QAClC,IAAIC,kBAAkBxL,mBAAmBiC,GAAG,CAAC5B;QAC7C,IAAI,CAACmL,iBAAiB;YACpBA,kBAAkB,IAAI9L,IAAI;gBAACwK;aAAc;YACzClK,mBAAmB0C,GAAG,CAACrC,WAAWmL;QACpC,OAAO;YACLA,gBAAgBlJ,GAAG,CAAC4H;QACtB;IACF;IAEA,IAAIkC,UAAUO,MAAM,KAAK,SAAS;QAChCf,uBAAuB1B;IACzB;AACF;AAEA1G,WAAW+I,gCAAgC,KAAK,EAAE","ignoreList":[0]}}, + {"offset": {"line": 1596, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/browser/runtime/dom/runtime-backend-dom.ts"],"sourcesContent":["/**\n * This file contains the runtime code specific to the Turbopack ECMAScript DOM runtime.\n *\n * It will be appended to the base runtime code.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n/// \n\nfunction getChunkSuffixFromScriptSrc() {\n // TURBOPACK_CHUNK_SUFFIX is set in web workers\n return (\n (self.TURBOPACK_CHUNK_SUFFIX ??\n document?.currentScript\n ?.getAttribute?.('src')\n ?.replace(/^(.*(?=\\?)|^.*$)/, '')) ||\n ''\n )\n}\n\ntype ChunkResolver = {\n resolved: boolean\n loadingStarted: boolean\n resolve: () => void\n reject: (error?: Error) => void\n promise: Promise\n}\n\nlet BACKEND: RuntimeBackend\n\n/**\n * Maps chunk paths to the corresponding resolver.\n */\nconst chunkResolvers: Map = new Map()\n\n;(() => {\n BACKEND = {\n async registerChunk(chunkPath, params) {\n const chunkUrl = getChunkRelativeUrl(chunkPath)\n\n const resolver = getOrCreateResolver(chunkUrl)\n resolver.resolve()\n\n if (params == null) {\n return\n }\n\n for (const otherChunkData of params.otherChunks) {\n const otherChunkPath = getChunkPath(otherChunkData)\n const otherChunkUrl = getChunkRelativeUrl(otherChunkPath)\n\n // Chunk might have started loading, so we want to avoid triggering another load.\n getOrCreateResolver(otherChunkUrl)\n }\n\n // This waits for chunks to be loaded, but also marks included items as available.\n await Promise.all(\n params.otherChunks.map((otherChunkData) =>\n loadInitialChunk(chunkPath, otherChunkData)\n )\n )\n\n if (params.runtimeModuleIds.length > 0) {\n for (const moduleId of params.runtimeModuleIds) {\n getOrInstantiateRuntimeModule(chunkPath, moduleId)\n }\n }\n },\n\n /**\n * Loads the given chunk, and returns a promise that resolves once the chunk\n * has been loaded.\n */\n loadChunkCached(sourceType: SourceType, chunkUrl: ChunkUrl) {\n return doLoadChunk(sourceType, chunkUrl)\n },\n\n async loadWebAssembly(\n _sourceType: SourceType,\n _sourceData: SourceData,\n wasmChunkPath: ChunkPath,\n _edgeModule: () => WebAssembly.Module,\n importsObj: WebAssembly.Imports\n ): Promise {\n const req = fetchWebAssembly(wasmChunkPath)\n\n const { instance } = await WebAssembly.instantiateStreaming(\n req,\n importsObj\n )\n\n return instance.exports\n },\n\n async loadWebAssemblyModule(\n _sourceType: SourceType,\n _sourceData: SourceData,\n wasmChunkPath: ChunkPath,\n _edgeModule: () => WebAssembly.Module\n ): Promise {\n const req = fetchWebAssembly(wasmChunkPath)\n\n return await WebAssembly.compileStreaming(req)\n },\n }\n\n function getOrCreateResolver(chunkUrl: ChunkUrl): ChunkResolver {\n let resolver = chunkResolvers.get(chunkUrl)\n if (!resolver) {\n let resolve: () => void\n let reject: (error?: Error) => void\n const promise = new Promise((innerResolve, innerReject) => {\n resolve = innerResolve\n reject = innerReject\n })\n resolver = {\n resolved: false,\n loadingStarted: false,\n promise,\n resolve: () => {\n resolver!.resolved = true\n resolve()\n },\n reject: reject!,\n }\n chunkResolvers.set(chunkUrl, resolver)\n }\n return resolver\n }\n\n /**\n * Loads the given chunk, and returns a promise that resolves once the chunk\n * has been loaded.\n */\n function doLoadChunk(sourceType: SourceType, chunkUrl: ChunkUrl) {\n const resolver = getOrCreateResolver(chunkUrl)\n if (resolver.loadingStarted) {\n return resolver.promise\n }\n\n if (sourceType === SourceType.Runtime) {\n // We don't need to load chunks references from runtime code, as they're already\n // present in the DOM.\n resolver.loadingStarted = true\n\n if (isCss(chunkUrl)) {\n // CSS chunks do not register themselves, and as such must be marked as\n // loaded instantly.\n resolver.resolve()\n }\n\n // We need to wait for JS chunks to register themselves within `registerChunk`\n // before we can start instantiating runtime modules, hence the absence of\n // `resolver.resolve()` in this branch.\n\n return resolver.promise\n }\n\n if (typeof importScripts === 'function') {\n // We're in a web worker\n if (isCss(chunkUrl)) {\n // ignore\n } else if (isJs(chunkUrl)) {\n self.TURBOPACK_NEXT_CHUNK_URLS!.push(chunkUrl)\n importScripts(TURBOPACK_WORKER_LOCATION + chunkUrl)\n } else {\n throw new Error(\n `can't infer type of chunk from URL ${chunkUrl} in worker`\n )\n }\n } else {\n // TODO(PACK-2140): remove this once all filenames are guaranteed to be escaped.\n const decodedChunkUrl = decodeURI(chunkUrl)\n\n if (isCss(chunkUrl)) {\n const previousLinks = document.querySelectorAll(\n `link[rel=stylesheet][href=\"${chunkUrl}\"],link[rel=stylesheet][href^=\"${chunkUrl}?\"],link[rel=stylesheet][href=\"${decodedChunkUrl}\"],link[rel=stylesheet][href^=\"${decodedChunkUrl}?\"]`\n )\n if (previousLinks.length > 0) {\n // CSS chunks do not register themselves, and as such must be marked as\n // loaded instantly.\n resolver.resolve()\n } else {\n const link = document.createElement('link')\n link.rel = 'stylesheet'\n link.href = chunkUrl\n link.onerror = () => {\n resolver.reject()\n }\n link.onload = () => {\n // CSS chunks do not register themselves, and as such must be marked as\n // loaded instantly.\n resolver.resolve()\n }\n // Append to the `head` for webpack compatibility.\n document.head.appendChild(link)\n }\n } else if (isJs(chunkUrl)) {\n const previousScripts = document.querySelectorAll(\n `script[src=\"${chunkUrl}\"],script[src^=\"${chunkUrl}?\"],script[src=\"${decodedChunkUrl}\"],script[src^=\"${decodedChunkUrl}?\"]`\n )\n if (previousScripts.length > 0) {\n // There is this edge where the script already failed loading, but we\n // can't detect that. The Promise will never resolve in this case.\n for (const script of Array.from(previousScripts)) {\n script.addEventListener('error', () => {\n resolver.reject()\n })\n }\n } else {\n const script = document.createElement('script')\n script.src = chunkUrl\n // We'll only mark the chunk as loaded once the script has been executed,\n // which happens in `registerChunk`. Hence the absence of `resolve()` in\n // this branch.\n script.onerror = () => {\n resolver.reject()\n }\n // Append to the `head` for webpack compatibility.\n document.head.appendChild(script)\n }\n } else {\n throw new Error(`can't infer type of chunk from URL ${chunkUrl}`)\n }\n }\n\n resolver.loadingStarted = true\n return resolver.promise\n }\n\n function fetchWebAssembly(wasmChunkPath: ChunkPath) {\n return fetch(getChunkRelativeUrl(wasmChunkPath))\n }\n})()\n"],"names":["getChunkSuffixFromScriptSrc","self","TURBOPACK_CHUNK_SUFFIX","document","currentScript","getAttribute","replace","BACKEND","chunkResolvers","Map","registerChunk","chunkPath","params","chunkUrl","getChunkRelativeUrl","resolver","getOrCreateResolver","resolve","otherChunkData","otherChunks","otherChunkPath","getChunkPath","otherChunkUrl","Promise","all","map","loadInitialChunk","runtimeModuleIds","length","moduleId","getOrInstantiateRuntimeModule","loadChunkCached","sourceType","doLoadChunk","loadWebAssembly","_sourceType","_sourceData","wasmChunkPath","_edgeModule","importsObj","req","fetchWebAssembly","instance","WebAssembly","instantiateStreaming","exports","loadWebAssemblyModule","compileStreaming","get","reject","promise","innerResolve","innerReject","resolved","loadingStarted","set","SourceType","Runtime","isCss","importScripts","isJs","TURBOPACK_NEXT_CHUNK_URLS","push","TURBOPACK_WORKER_LOCATION","Error","decodedChunkUrl","decodeURI","previousLinks","querySelectorAll","link","createElement","rel","href","onerror","onload","head","appendChild","previousScripts","script","Array","from","addEventListener","src","fetch"],"mappings":"AAAA;;;;CAIC,GAED,oDAAoD,GAEpD,sEAAsE;AACtE,2DAA2D;AAE3D,SAASA;IACP,+CAA+C;IAC/C,OACE,CAACC,KAAKC,sBAAsB,IAC1BC,UAAUC,eACNC,eAAe,QACfC,QAAQ,oBAAoB,GAAG,KACrC;AAEJ;AAUA,IAAIC;AAEJ;;CAEC,GACD,MAAMC,iBAA+C,IAAIC;AAExD,CAAC;IACAF,UAAU;QACR,MAAMG,eAAcC,SAAS,EAAEC,MAAM;YACnC,MAAMC,WAAWC,oBAAoBH;YAErC,MAAMI,WAAWC,oBAAoBH;YACrCE,SAASE,OAAO;YAEhB,IAAIL,UAAU,MAAM;gBAClB;YACF;YAEA,KAAK,MAAMM,kBAAkBN,OAAOO,WAAW,CAAE;gBAC/C,MAAMC,iBAAiBC,aAAaH;gBACpC,MAAMI,gBAAgBR,oBAAoBM;gBAE1C,iFAAiF;gBACjFJ,oBAAoBM;YACtB;YAEA,kFAAkF;YAClF,MAAMC,QAAQC,GAAG,CACfZ,OAAOO,WAAW,CAACM,GAAG,CAAC,CAACP,iBACtBQ,iBAAiBf,WAAWO;YAIhC,IAAIN,OAAOe,gBAAgB,CAACC,MAAM,GAAG,GAAG;gBACtC,KAAK,MAA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B,gBAAgB,EAAEA,gBAAgB,GAAG,CAAC;gBAE7H,IAAIY,gBAAgBjD,MAAM,GAAG,GAAG;oBAC9B,qEAAqE;oBACrE,kEAAkE;oBAClE,KAAK,MAAMkD,UAAUC,MAAMC,IAAI,CAACH,iBAAkB;wBAChDC,OAAOG,gBAAgB,CAAC,SAAS;4BAC/BlE,SAASkC,MAAM;wBACjB;oBACF;gBACF,OAAO;oBACL,MAAM6B,SAAS3E,SAASmE,aAAa,CAAC;oBACtCQ,OAAOI,GAAG,GAAGrE;oBACb,yEAAyE;oBACzE,wEAAwE;oBACxE,eAAe;oBACfiE,OAAOL,OAAO,GAAG;wBACf1D,SAASkC,MAAM;oBACjB;oBACA,kDAAkD;oBAClD9C,SAASwE,IAAI,CAACC,WAAW,CAACE;gBAC5B;YACF,OAAO;gBACL,MAAM,IAAId,MAAM,CAAC,mCAAmC,EAAEnD,UAAU;YAClE;QACF;QAEAE,SAASuC,cAAc,GAAG;QAC1B,OAAOvC,SAASmC,OAAO;IACzB;IAEA,SAAST,iBAAiBJ,aAAwB;QAChD,OAAO8C,MAAMrE,oBAAoBuB;IACnC;AACF,CAAC","ignoreList":[0]}}, + {"offset": {"line": 1761, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/browser/runtime/dom/dev-backend-dom.ts"],"sourcesContent":["/**\n * This file contains the runtime code specific to the Turbopack development\n * ECMAScript DOM runtime.\n *\n * It will be appended to the base development runtime code.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n/// \n/// \n/// \n\nlet DEV_BACKEND: DevRuntimeBackend\n;(() => {\n DEV_BACKEND = {\n unloadChunk(chunkUrl) {\n deleteResolver(chunkUrl)\n\n // TODO(PACK-2140): remove this once all filenames are guaranteed to be escaped.\n const decodedChunkUrl = decodeURI(chunkUrl)\n\n if (isCss(chunkUrl)) {\n const links = document.querySelectorAll(\n `link[href=\"${chunkUrl}\"],link[href^=\"${chunkUrl}?\"],link[href=\"${decodedChunkUrl}\"],link[href^=\"${decodedChunkUrl}?\"]`\n )\n for (const link of Array.from(links)) {\n link.remove()\n }\n } else if (isJs(chunkUrl)) {\n // Unloading a JS chunk would have no effect, as it lives in the JS\n // runtime once evaluated.\n // However, we still want to remove the script tag from the DOM to keep\n // the HTML somewhat consistent from the user's perspective.\n const scripts = document.querySelectorAll(\n `script[src=\"${chunkUrl}\"],script[src^=\"${chunkUrl}?\"],script[src=\"${decodedChunkUrl}\"],script[src^=\"${decodedChunkUrl}?\"]`\n )\n for (const script of Array.from(scripts)) {\n script.remove()\n }\n } else {\n throw new Error(`can't infer type of chunk from URL ${chunkUrl}`)\n }\n },\n\n reloadChunk(chunkUrl) {\n return new Promise((resolve, reject) => {\n if (!isCss(chunkUrl)) {\n reject(new Error('The DOM backend can only reload CSS chunks'))\n return\n }\n\n const decodedChunkUrl = decodeURI(chunkUrl)\n const previousLinks = document.querySelectorAll(\n `link[rel=stylesheet][href=\"${chunkUrl}\"],link[rel=stylesheet][href^=\"${chunkUrl}?\"],link[rel=stylesheet][href=\"${decodedChunkUrl}\"],link[rel=stylesheet][href^=\"${decodedChunkUrl}?\"]`\n )\n\n if (previousLinks.length === 0) {\n reject(new Error(`No link element found for chunk ${chunkUrl}`))\n return\n }\n\n const link = document.createElement('link')\n link.rel = 'stylesheet'\n\n if (navigator.userAgent.includes('Firefox')) {\n // Firefox won't reload CSS files that were previously loaded on the current page,\n // we need to add a query param to make sure CSS is actually reloaded from the server.\n //\n // I believe this is this issue: https://bugzilla.mozilla.org/show_bug.cgi?id=1037506\n //\n // Safari has a similar issue, but only if you have a `` tag\n // pointing to the same URL as the stylesheet: https://bugs.webkit.org/show_bug.cgi?id=187726\n link.href = `${chunkUrl}?ts=${Date.now()}`\n } else {\n link.href = chunkUrl\n }\n\n link.onerror = () => {\n reject()\n }\n link.onload = () => {\n // First load the new CSS, then remove the old ones. This prevents visible\n // flickering that would happen in-between removing the previous CSS and\n // loading the new one.\n for (const previousLink of Array.from(previousLinks))\n previousLink.remove()\n\n // CSS chunks do not register themselves, and as such must be marked as\n // loaded instantly.\n resolve()\n }\n\n // Make sure to insert the new CSS right after the previous one, so that\n // its precedence is higher.\n previousLinks[0].parentElement!.insertBefore(\n link,\n previousLinks[0].nextSibling\n )\n })\n },\n\n restart: () => self.location.reload(),\n }\n\n function deleteResolver(chunkUrl: ChunkUrl) {\n chunkResolvers.delete(chunkUrl)\n }\n})()\n\nfunction _eval({ code, url, map }: EcmascriptModuleEntry): ModuleFactory {\n code += `\\n\\n//# sourceURL=${encodeURI(\n location.origin + CHUNK_BASE_PATH + url + CHUNK_SUFFIX\n )}`\n if (map) {\n code += `\\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,${btoa(\n // btoa doesn't handle nonlatin characters, so escape them as \\x sequences\n // See https://stackoverflow.com/a/26603875\n unescape(encodeURIComponent(map))\n )}`\n }\n\n // eslint-disable-next-line no-eval\n return eval(code)\n}\n"],"names":["DEV_BACKEND","unloadChunk","chunkUrl","deleteResolver","decodedChunkUrl","decodeURI","isCss","links","document","querySelectorAll","link","Array","from","remove","isJs","scripts","script","Error","reloadChunk","Promise","resolve","reject","previousLinks","length","createElement","rel","navigator","userAgent","includes","href","Date","now","onerror","onload","previousLink","parentElement","insertBefore","nextSibling","restart","self","location","reload","chunkResolvers","delete","_eval","code","url","map","encodeURI","origin","CHUNK_BASE_PATH","CHUNK_SUFFIX","btoa","unescape","encodeURIComponent","eval"],"mappings":"AAAA;;;;;CAKC,GAED,oDAAoD,GAEpD,gDAAgD;AAChD,4CAA4C;AAC5C,iDAAiD;AACjD,0DAA0D;AAE1D,IAAIA;AACH,CAAC;IACAA,cAAc;QACZC,aAAYC,QAAQ;YAClBC,eAAeD;YAEf,gFAAgF;YAChF,MAAME,kBAAkBC,UAAUH;YAElC,IAAII,MAAMJ,WAAW;gBACnB,MAAMK,QAAQC,SAASC,gBAAgB,CACrC,CAAC,WAAW,EAAEP,SAAS,eAAe,EAAEA,SAAS,eAAe,EAAEE,gBAAgB,e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AAI,EAAE4B,KAAKC,GAAG,IAAI;gBAC5C,OAAO;oBACLrB,KAAKmB,IAAI,GAAG3B;gBACd;gBAEAQ,KAAKsB,OAAO,GAAG;oBACbX;gBACF;gBACAX,KAAKuB,MAAM,GAAG;oBACZ,0EAA0E;oBAC1E,wEAAwE;oBACxE,uBAAuB;oBACvB,KAAK,MAAMC,gBAAgBvB,MAAMC,IAAI,CAACU,eACpCY,aAAarB,MAAM;oBAErB,uEAAuE;oBACvE,oBAAoB;oBACpBO;gBACF;gBAEA,wEAAwE;gBACxE,4BAA4B;gBAC5BE,aAAa,CAAC,EAAE,CAACa,aAAa,CAAEC,YAAY,CAC1C1B,MACAY,aAAa,CAAC,EAAE,CAACe,WAAW;YAEhC;QACF;QAEAC,SAAS,IAAMC,KAAKC,QAAQ,CAACC,MAAM;IACrC;IAEA,SAAStC,eAAeD,QAAkB;QACxCwC,eAAeC,MAAM,CAACzC;IACxB;AACF,CAAC;AAED,SAAS0C,MAAM,EAAEC,IAAI,EAAEC,GAAG,EAAEC,GAAG,EAAyB;IACtDF,QAAQ,CAAC,kBAAkB,EAAEG,UAC3BR,SAASS,MAAM,GAAGC,kBAAkBJ,MAAMK,eACzC;IACH,IAAIJ,KAAK;QACPF,QAAQ,CAAC,kEAAkE,EAAEO,KAC3E,0EAA0E;QAC1E,2CAA2C;QAC3CC,SAASC,mBAAmBP,QAC3B;IACL;IAEA,mCAAmC;IACnC,OAAOQ,KAAKV;AACd","ignoreList":[0]}}] } \ No newline at end of file diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/preset_env/output/5c1d0_turbopack-tests_tests_snapshot_swc_transforms_preset_env_input_index_5aaf1327.js b/turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/preset_env/output/5c1d0_turbopack-tests_tests_snapshot_swc_transforms_preset_env_input_index_5aaf1327.js index 0116455ace017c..878b65ab3bf98a 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/preset_env/output/5c1d0_turbopack-tests_tests_snapshot_swc_transforms_preset_env_input_index_5aaf1327.js +++ b/turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/preset_env/output/5c1d0_turbopack-tests_tests_snapshot_swc_transforms_preset_env_input_index_5aaf1327.js @@ -1188,6 +1188,7 @@ browserContextPrototype.P = resolveAbsolutePath; // evaluated by poping urls off of this array. See `getPathFromScript` var bootstrap = `self.TURBOPACK_WORKER_LOCATION = ${JSON.stringify(location.origin)}; self.TURBOPACK_CHUNK_SUFFIX = ${JSON.stringify(CHUNK_SUFFIX)}; +self.NEXT_DEPLOYMENT_ID = ${JSON.stringify(globalThis.NEXT_DEPLOYMENT_ID)}; self.TURBOPACK_NEXT_CHUNK_URLS = ${JSON.stringify(chunks.reverse().map(getChunkRelativeUrl), null, 2)}; importScripts(...self.TURBOPACK_NEXT_CHUNK_URLS.map(c => self.TURBOPACK_WORKER_LOCATION + c).reverse());`; var blob = new Blob([ diff --git a/turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/preset_env/output/780ce_turbopack-tests_tests_snapshot_swc_transforms_preset_env_input_index_5aaf1327.js.map b/turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/preset_env/output/780ce_turbopack-tests_tests_snapshot_swc_transforms_preset_env_input_index_5aaf1327.js.map index dc0c3a2f012396..43e49415a05386 100644 --- a/turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/preset_env/output/780ce_turbopack-tests_tests_snapshot_swc_transforms_preset_env_input_index_5aaf1327.js.map +++ b/turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/preset_env/output/780ce_turbopack-tests_tests_snapshot_swc_transforms_preset_env_input_index_5aaf1327.js.map @@ -3,7 +3,7 @@ "sources": [], "sections": [ {"offset": {"line": 13, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/shared/runtime-utils.ts"],"sourcesContent":["/**\n * This file contains runtime types and functions that are shared between all\n * TurboPack ECMAScript runtimes.\n *\n * It will be prepended to the runtime code of each runtime.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n\ntype EsmNamespaceObject = Record\n\n// @ts-ignore Defined in `dev-base.ts`\ndeclare function getOrInstantiateModuleFromParent(\n id: ModuleId,\n sourceModule: M\n): M\n\nconst REEXPORTED_OBJECTS = new WeakMap()\n\n/**\n * Constructs the `__turbopack_context__` object for a module.\n */\nfunction Context(\n this: TurbopackBaseContext,\n module: Module,\n exports: Exports\n) {\n this.m = module\n // We need to store this here instead of accessing it from the module object to:\n // 1. Make it available to factories directly, since we rewrite `this` to\n // `__turbopack_context__.e` in CJS modules.\n // 2. Support async modules which rewrite `module.exports` to a promise, so we\n // can still access the original exports object from functions like\n // `esmExport`\n // Ideally we could find a new approach for async modules and drop this property altogether.\n this.e = exports\n}\nconst contextPrototype = Context.prototype as TurbopackBaseContext\n\ntype ModuleContextMap = Record\n\ninterface ModuleContextEntry {\n id: () => ModuleId\n module: () => any\n}\n\ninterface ModuleContext {\n // require call\n (moduleId: string): Exports | EsmNamespaceObject\n\n // async import call\n import(moduleId: string): Promise\n\n keys(): ModuleId[]\n\n resolve(moduleId: string): ModuleId\n}\n\ntype GetOrInstantiateModuleFromParent = (\n moduleId: M['id'],\n parentModule: M\n) => M\n\ndeclare function getOrInstantiateRuntimeModule(\n chunkPath: ChunkPath,\n moduleId: ModuleId\n): Module\n\nconst hasOwnProperty = Object.prototype.hasOwnProperty\nconst toStringTag = typeof Symbol !== 'undefined' && Symbol.toStringTag\n\nfunction defineProp(\n obj: any,\n name: PropertyKey,\n options: PropertyDescriptor & ThisType\n) {\n if (!hasOwnProperty.call(obj, name)) Object.defineProperty(obj, name, options)\n}\n\nfunction getOverwrittenModule(\n moduleCache: ModuleCache,\n id: ModuleId\n): Module {\n let module = moduleCache[id]\n if (!module) {\n // This is invoked when a module is merged into another module, thus it wasn't invoked via\n // instantiateModule and the cache entry wasn't created yet.\n module = createModuleObject(id)\n moduleCache[id] = module\n }\n return module\n}\n\n/**\n * Creates the module object. Only done here to ensure all module objects have the same shape.\n */\nfunction createModuleObject(id: ModuleId): Module {\n return {\n exports: {},\n error: undefined,\n id,\n namespaceObject: undefined,\n }\n}\n\ntype BindingTag = 0\nconst BindingTag_Value = 0 as BindingTag\n\n// an arbitrary sequence of bindings as\n// - a prop name\n// - BindingTag_Value, a value to be bound directly, or\n// - 1 or 2 functions to bind as getters and sdetters\ntype EsmBindings = Array<\n string | BindingTag | (() => unknown) | ((v: unknown) => void) | unknown\n>\n\n/**\n * Adds the getters to the exports object.\n */\nfunction esm(exports: Exports, bindings: EsmBindings) {\n defineProp(exports, '__esModule', { value: true })\n if (toStringTag) defineProp(exports, toStringTag, { value: 'Module' })\n let i = 0\n while (i < bindings.length) {\n const propName = bindings[i++] as string\n const tagOrFunction = bindings[i++]\n if (typeof tagOrFunction === 'number') {\n if (tagOrFunction === BindingTag_Value) {\n defineProp(exports, propName, {\n value: bindings[i++],\n enumerable: true,\n writable: false,\n })\n } else {\n throw new Error(`unexpected tag: ${tagOrFunction}`)\n }\n } else {\n const getterFn = tagOrFunction as () => unknown\n if (typeof bindings[i] === 'function') {\n const setterFn = bindings[i++] as (v: unknown) => void\n defineProp(exports, propName, {\n get: getterFn,\n set: setterFn,\n enumerable: true,\n })\n } else {\n defineProp(exports, propName, {\n get: getterFn,\n enumerable: true,\n })\n }\n }\n }\n Object.seal(exports)\n}\n\n/**\n * Makes the module an ESM with exports\n */\nfunction esmExport(\n this: TurbopackBaseContext,\n bindings: EsmBindings,\n id: ModuleId | undefined\n) {\n let module: Module\n let exports: Module['exports']\n if (id != null) {\n module = getOverwrittenModule(this.c, id)\n exports = module.exports\n } else {\n module = this.m\n exports = this.e\n }\n module.namespaceObject = exports\n esm(exports, bindings)\n}\ncontextPrototype.s = esmExport\n\ntype ReexportedObjects = Record[]\nfunction ensureDynamicExports(\n module: Module,\n exports: Exports\n): ReexportedObjects {\n let reexportedObjects: ReexportedObjects | undefined =\n REEXPORTED_OBJECTS.get(module)\n\n if (!reexportedObjects) {\n REEXPORTED_OBJECTS.set(module, (reexportedObjects = []))\n module.exports = module.namespaceObject = new Proxy(exports, {\n get(target, prop) {\n if (\n hasOwnProperty.call(target, prop) ||\n prop === 'default' ||\n prop === '__esModule'\n ) {\n return Reflect.get(target, prop)\n }\n for (const obj of reexportedObjects!) {\n const value = Reflect.get(obj, prop)\n if (value !== undefined) return value\n }\n return undefined\n },\n ownKeys(target) {\n const keys = Reflect.ownKeys(target)\n for (const obj of reexportedObjects!) {\n for (const key of Reflect.ownKeys(obj)) {\n if (key !== 'default' && !keys.includes(key)) keys.push(key)\n }\n }\n return keys\n },\n })\n }\n return reexportedObjects\n}\n\n/**\n * Dynamically exports properties from an object\n */\nfunction dynamicExport(\n this: TurbopackBaseContext,\n object: Record,\n id: ModuleId | undefined\n) {\n let module: Module\n let exports: Exports\n if (id != null) {\n module = getOverwrittenModule(this.c, id)\n exports = module.exports\n } else {\n module = this.m\n exports = this.e\n }\n const reexportedObjects = ensureDynamicExports(module, exports)\n\n if (typeof object === 'object' && object !== null) {\n reexportedObjects.push(object)\n }\n}\ncontextPrototype.j = dynamicExport\n\nfunction exportValue(\n this: TurbopackBaseContext,\n value: any,\n id: ModuleId | undefined\n) {\n let module: Module\n if (id != null) {\n module = getOverwrittenModule(this.c, id)\n } else {\n module = this.m\n }\n module.exports = value\n}\ncontextPrototype.v = exportValue\n\nfunction exportNamespace(\n this: TurbopackBaseContext,\n namespace: any,\n id: ModuleId | undefined\n) {\n let module: Module\n if (id != null) {\n module = getOverwrittenModule(this.c, id)\n } else {\n module = this.m\n }\n module.exports = module.namespaceObject = namespace\n}\ncontextPrototype.n = exportNamespace\n\nfunction createGetter(obj: Record, key: string | symbol) {\n return () => obj[key]\n}\n\n/**\n * @returns prototype of the object\n */\nconst getProto: (obj: any) => any = Object.getPrototypeOf\n ? (obj) => Object.getPrototypeOf(obj)\n : (obj) => obj.__proto__\n\n/** Prototypes that are not expanded for exports */\nconst LEAF_PROTOTYPES = [null, getProto({}), getProto([]), getProto(getProto)]\n\n/**\n * @param raw\n * @param ns\n * @param allowExportDefault\n * * `false`: will have the raw module as default export\n * * `true`: will have the default property as default export\n */\nfunction interopEsm(\n raw: Exports,\n ns: EsmNamespaceObject,\n allowExportDefault?: boolean\n) {\n const bindings: EsmBindings = []\n let defaultLocation = -1\n for (\n let current = raw;\n (typeof current === 'object' || typeof current === 'function') &&\n !LEAF_PROTOTYPES.includes(current);\n current = getProto(current)\n ) {\n for (const key of Object.getOwnPropertyNames(current)) {\n bindings.push(key, createGetter(raw, key))\n if (defaultLocation === -1 && key === 'default') {\n defaultLocation = bindings.length - 1\n }\n }\n }\n\n // this is not really correct\n // we should set the `default` getter if the imported module is a `.cjs file`\n if (!(allowExportDefault && defaultLocation >= 0)) {\n // Replace the binding with one for the namespace itself in order to preserve iteration order.\n if (defaultLocation >= 0) {\n // Replace the getter with the value\n bindings.splice(defaultLocation, 1, BindingTag_Value, raw)\n } else {\n bindings.push('default', BindingTag_Value, raw)\n }\n }\n\n esm(ns, bindings)\n return ns\n}\n\nfunction createNS(raw: Module['exports']): EsmNamespaceObject {\n if (typeof raw === 'function') {\n return function (this: any, ...args: any[]) {\n return raw.apply(this, args)\n }\n } else {\n return Object.create(null)\n }\n}\n\nfunction esmImport(\n this: TurbopackBaseContext,\n id: ModuleId\n): Exclude {\n const module = getOrInstantiateModuleFromParent(id, this.m)\n\n // any ES module has to have `module.namespaceObject` defined.\n if (module.namespaceObject) return module.namespaceObject\n\n // only ESM can be an async module, so we don't need to worry about exports being a promise here.\n const raw = module.exports\n return (module.namespaceObject = interopEsm(\n raw,\n createNS(raw),\n raw && (raw as any).__esModule\n ))\n}\ncontextPrototype.i = esmImport\n\nfunction asyncLoader(\n this: TurbopackBaseContext,\n moduleId: ModuleId\n): Promise {\n const loader = this.r(moduleId) as (\n importFunction: EsmImport\n ) => Promise\n return loader(esmImport.bind(this))\n}\ncontextPrototype.A = asyncLoader\n\n// Add a simple runtime require so that environments without one can still pass\n// `typeof require` CommonJS checks so that exports are correctly registered.\nconst runtimeRequire =\n // @ts-ignore\n typeof require === 'function'\n ? // @ts-ignore\n require\n : function require() {\n throw new Error('Unexpected use of runtime require')\n }\ncontextPrototype.t = runtimeRequire\n\nfunction commonJsRequire(\n this: TurbopackBaseContext,\n id: ModuleId\n): Exports {\n return getOrInstantiateModuleFromParent(id, this.m).exports\n}\ncontextPrototype.r = commonJsRequire\n\n/**\n * Remove fragments and query parameters since they are never part of the context map keys\n *\n * This matches how we parse patterns at resolving time. Arguably we should only do this for\n * strings passed to `import` but the resolve does it for `import` and `require` and so we do\n * here as well.\n */\nfunction parseRequest(request: string): string {\n // Per the URI spec fragments can contain `?` characters, so we should trim it off first\n // https://datatracker.ietf.org/doc/html/rfc3986#section-3.5\n const hashIndex = request.indexOf('#')\n if (hashIndex !== -1) {\n request = request.substring(0, hashIndex)\n }\n\n const queryIndex = request.indexOf('?')\n if (queryIndex !== -1) {\n request = request.substring(0, queryIndex)\n }\n\n return request\n}\n/**\n * `require.context` and require/import expression runtime.\n */\nfunction moduleContext(map: ModuleContextMap): ModuleContext {\n function moduleContext(id: string): Exports {\n id = parseRequest(id)\n if (hasOwnProperty.call(map, id)) {\n return map[id].module()\n }\n\n const e = new Error(`Cannot find module '${id}'`)\n ;(e as any).code = 'MODULE_NOT_FOUND'\n throw e\n }\n\n moduleContext.keys = (): string[] => {\n return Object.keys(map)\n }\n\n moduleContext.resolve = (id: string): ModuleId => {\n id = parseRequest(id)\n if (hasOwnProperty.call(map, id)) {\n return map[id].id()\n }\n\n const e = new Error(`Cannot find module '${id}'`)\n ;(e as any).code = 'MODULE_NOT_FOUND'\n throw e\n }\n\n moduleContext.import = async (id: string) => {\n return await (moduleContext(id) as Promise)\n }\n\n return moduleContext\n}\ncontextPrototype.f = moduleContext\n\n/**\n * Returns the path of a chunk defined by its data.\n */\nfunction getChunkPath(chunkData: ChunkData): ChunkPath {\n return typeof chunkData === 'string' ? chunkData : chunkData.path\n}\n\nfunction isPromise(maybePromise: any): maybePromise is Promise {\n return (\n maybePromise != null &&\n typeof maybePromise === 'object' &&\n 'then' in maybePromise &&\n typeof maybePromise.then === 'function'\n )\n}\n\nfunction isAsyncModuleExt(obj: T): obj is AsyncModuleExt & T {\n return turbopackQueues in obj\n}\n\nfunction createPromise() {\n let resolve: (value: T | PromiseLike) => void\n let reject: (reason?: any) => void\n\n const promise = new Promise((res, rej) => {\n reject = rej\n resolve = res\n })\n\n return {\n promise,\n resolve: resolve!,\n reject: reject!,\n }\n}\n\n// Load the CompressedmoduleFactories of a chunk into the `moduleFactories` Map.\n// The CompressedModuleFactories format is\n// - 1 or more module ids\n// - a module factory function\n// So walking this is a little complex but the flat structure is also fast to\n// traverse, we can use `typeof` operators to distinguish the two cases.\nfunction installCompressedModuleFactories(\n chunkModules: CompressedModuleFactories,\n offset: number,\n moduleFactories: ModuleFactories,\n newModuleId?: (id: ModuleId) => void\n) {\n let i = offset\n while (i < chunkModules.length) {\n let moduleId = chunkModules[i] as ModuleId\n let end = i + 1\n // Find our factory function\n while (\n end < chunkModules.length &&\n typeof chunkModules[end] !== 'function'\n ) {\n end++\n }\n if (end === chunkModules.length) {\n throw new Error('malformed chunk format, expected a factory function')\n }\n // Each chunk item has a 'primary id' and optional additional ids. If the primary id is already\n // present we know all the additional ids are also present, so we don't need to check.\n if (!moduleFactories.has(moduleId)) {\n const moduleFactoryFn = chunkModules[end] as Function\n applyModuleFactoryName(moduleFactoryFn)\n newModuleId?.(moduleId)\n for (; i < end; i++) {\n moduleId = chunkModules[i] as ModuleId\n moduleFactories.set(moduleId, moduleFactoryFn)\n }\n }\n i = end + 1 // end is pointing at the last factory advance to the next id or the end of the array.\n }\n}\n\n// everything below is adapted from webpack\n// https://github.com/webpack/webpack/blob/6be4065ade1e252c1d8dcba4af0f43e32af1bdc1/lib/runtime/AsyncModuleRuntimeModule.js#L13\n\nconst turbopackQueues = Symbol('turbopack queues')\nconst turbopackExports = Symbol('turbopack exports')\nconst turbopackError = Symbol('turbopack error')\n\nconst enum QueueStatus {\n Unknown = -1,\n Unresolved = 0,\n Resolved = 1,\n}\n\ntype AsyncQueueFn = (() => void) & { queueCount: number }\ntype AsyncQueue = AsyncQueueFn[] & {\n status: QueueStatus\n}\n\nfunction resolveQueue(queue?: AsyncQueue) {\n if (queue && queue.status !== QueueStatus.Resolved) {\n queue.status = QueueStatus.Resolved\n queue.forEach((fn) => fn.queueCount--)\n queue.forEach((fn) => (fn.queueCount-- ? fn.queueCount++ : fn()))\n }\n}\n\ntype Dep = Exports | AsyncModulePromise | Promise\n\ntype AsyncModuleExt = {\n [turbopackQueues]: (fn: (queue: AsyncQueue) => void) => void\n [turbopackExports]: Exports\n [turbopackError]?: any\n}\n\ntype AsyncModulePromise = Promise & AsyncModuleExt\n\nfunction wrapDeps(deps: Dep[]): AsyncModuleExt[] {\n return deps.map((dep): AsyncModuleExt => {\n if (dep !== null && typeof dep === 'object') {\n if (isAsyncModuleExt(dep)) return dep\n if (isPromise(dep)) {\n const queue: AsyncQueue = Object.assign([], {\n status: QueueStatus.Unresolved,\n })\n\n const obj: AsyncModuleExt = {\n [turbopackExports]: {},\n [turbopackQueues]: (fn: (queue: AsyncQueue) => void) => fn(queue),\n }\n\n dep.then(\n (res) => {\n obj[turbopackExports] = res\n resolveQueue(queue)\n },\n (err) => {\n obj[turbopackError] = err\n resolveQueue(queue)\n }\n )\n\n return obj\n }\n }\n\n return {\n [turbopackExports]: dep,\n [turbopackQueues]: () => {},\n }\n })\n}\n\nfunction asyncModule(\n this: TurbopackBaseContext,\n body: (\n handleAsyncDependencies: (\n deps: Dep[]\n ) => Exports[] | Promise<() => Exports[]>,\n asyncResult: (err?: any) => void\n ) => void,\n hasAwait: boolean\n) {\n const module = this.m\n const queue: AsyncQueue | undefined = hasAwait\n ? Object.assign([], { status: QueueStatus.Unknown })\n : undefined\n\n const depQueues: Set = new Set()\n\n const { resolve, reject, promise: rawPromise } = createPromise()\n\n const promise: AsyncModulePromise = Object.assign(rawPromise, {\n [turbopackExports]: module.exports,\n [turbopackQueues]: (fn) => {\n queue && fn(queue)\n depQueues.forEach(fn)\n promise['catch'](() => {})\n },\n } satisfies AsyncModuleExt)\n\n const attributes: PropertyDescriptor = {\n get(): any {\n return promise\n },\n set(v: any) {\n // Calling `esmExport` leads to this.\n if (v !== promise) {\n promise[turbopackExports] = v\n }\n },\n }\n\n Object.defineProperty(module, 'exports', attributes)\n Object.defineProperty(module, 'namespaceObject', attributes)\n\n function handleAsyncDependencies(deps: Dep[]) {\n const currentDeps = wrapDeps(deps)\n\n const getResult = () =>\n currentDeps.map((d) => {\n if (d[turbopackError]) throw d[turbopackError]\n return d[turbopackExports]\n })\n\n const { promise, resolve } = createPromise<() => Exports[]>()\n\n const fn: AsyncQueueFn = Object.assign(() => resolve(getResult), {\n queueCount: 0,\n })\n\n function fnQueue(q: AsyncQueue) {\n if (q !== queue && !depQueues.has(q)) {\n depQueues.add(q)\n if (q && q.status === QueueStatus.Unresolved) {\n fn.queueCount++\n q.push(fn)\n }\n }\n }\n\n currentDeps.map((dep) => dep[turbopackQueues](fnQueue))\n\n return fn.queueCount ? promise : getResult()\n }\n\n function asyncResult(err?: any) {\n if (err) {\n reject((promise[turbopackError] = err))\n } else {\n resolve(promise[turbopackExports])\n }\n\n resolveQueue(queue)\n }\n\n body(handleAsyncDependencies, asyncResult)\n\n if (queue && queue.status === QueueStatus.Unknown) {\n queue.status = QueueStatus.Unresolved\n }\n}\ncontextPrototype.a = asyncModule\n\n/**\n * A pseudo \"fake\" URL object to resolve to its relative path.\n *\n * When UrlRewriteBehavior is set to relative, calls to the `new URL()` will construct url without base using this\n * runtime function to generate context-agnostic urls between different rendering context, i.e ssr / client to avoid\n * hydration mismatch.\n *\n * This is based on webpack's existing implementation:\n * https://github.com/webpack/webpack/blob/87660921808566ef3b8796f8df61bd79fc026108/lib/runtime/RelativeUrlRuntimeModule.js\n */\nconst relativeURL = function relativeURL(this: any, inputUrl: string) {\n const realUrl = new URL(inputUrl, 'x:/')\n const values: Record = {}\n for (const key in realUrl) values[key] = (realUrl as any)[key]\n values.href = inputUrl\n values.pathname = inputUrl.replace(/[?#].*/, '')\n values.origin = values.protocol = ''\n values.toString = values.toJSON = (..._args: Array) => inputUrl\n for (const key in values)\n Object.defineProperty(this, key, {\n enumerable: true,\n configurable: true,\n value: values[key],\n })\n}\nrelativeURL.prototype = URL.prototype\ncontextPrototype.U = relativeURL\n\n/**\n * Utility function to ensure all variants of an enum are handled.\n */\nfunction invariant(never: never, computeMessage: (arg: any) => string): never {\n throw new Error(`Invariant: ${computeMessage(never)}`)\n}\n\n/**\n * A stub function to make `require` available but non-functional in ESM.\n */\nfunction requireStub(_moduleId: ModuleId): never {\n throw new Error('dynamic usage of require is not supported')\n}\ncontextPrototype.z = requireStub\n\n// Make `globalThis` available to the module in a way that cannot be shadowed by a local variable.\ncontextPrototype.g = globalThis\n\ntype ContextConstructor = {\n new (module: Module, exports: Exports): TurbopackBaseContext\n}\n\nfunction applyModuleFactoryName(factory: Function) {\n // Give the module factory a nice name to improve stack traces.\n Object.defineProperty(factory, 'name', {\n value: 'module evaluation',\n })\n}\n"],"names":["REEXPORTED_OBJECTS","WeakMap","Context","module","exports","m","e","contextPrototype","prototype","hasOwnProperty","Object","toStringTag","Symbol","defineProp","obj","name","options","call","defineProperty","getOverwrittenModule","moduleCache","id","createModuleObject","error","undefined","namespaceObject","BindingTag_Value","esm","bindings","value","i","length","propName","tagOrFunction","enumerable","writable","Error","getterFn","setterFn","get","set","seal","esmExport","c","s","ensureDynamicExports","reexportedObjects","Proxy","target","prop","Reflect","_iteratorError","ownKeys","keys","_iteratorError1","key","includes","push","dynamicExport","object","_type_of","j","exportValue","v","exportNamespace","namespace","n","createGetter","getProto","getPrototypeOf","__proto__","LEAF_PROTOTYPES","interopEsm","raw","ns","allowExportDefault","defaultLocation","current","getOwnPropertyNames","splice","createNS","_key","args","apply","create","esmImport","getOrInstantiateModuleFromParent","__esModule","asyncLoader","moduleId","loader","r","bind","A","runtimeRequire","require","require1","t","commonJsRequire","parseRequest","request","hashIndex","indexOf","substring","queryIndex","moduleContext","map","code","resolve","import","f","getChunkPath","chunkData","path","isPromise","maybePromise","then","isAsyncModuleExt","turbopackQueues","createPromise","reject","promise","Promise","res","rej","installCompressedModuleFactories","chunkModules","offset","moduleFactories","newModuleId","end","has","moduleFactoryFn","applyModuleFactoryName","turbopackExports","turbopackError","resolveQueue","queue","status","forEach","fn","queueCount","wrapDeps","deps","dep","assign","_obj","err","_obj1","asyncModule","body","hasAwait","depQueues","Set","_createPromise","rawPromise","attributes","handleAsyncDependencies","currentDeps","getResult","d","fnQueue","q","add","asyncResult","a","relativeURL","inputUrl","realUrl","URL","values","href","pathname","replace","origin","protocol","toString","toJSON","_args","key1","configurable","U","invariant","never","computeMessage","requireStub","_moduleId","z","g","globalThis","factory"],"mappings":"AAAA;;;;;CAKC,GAED,oDAAoD,GAEpD,6CAA6C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAU7C,IAAMA,qBAAqB,IAAIC;AAE/B;;CAEC,GACD,SAASC,QAEPC,MAAc,EACdC,OAAgB;IAEhB,IAAI,CAACC,CAAC,GAAGF;IACT,gFAAgF;IAChF,yEAAyE;IACzE,+CAA+C;IAC/C,8EAA8E;IAC9E,sEAAsE;IACtE,iBAAiB;IACjB,4FAA4F;IAC5F,IAAI,CAACG,CAAC,GAAGF;AACX;AACA,IAAMG,mBAAmBL,QAAQM,SAAS;AA+B1C,IAAMC,iBAAiBC,OAAOF,SAAS,CAACC,cAAc;AACtD,IAAME,cAAc,OAAOC,WAAW,eAAeA,OAAOD,WAAW;AAEvE,SAASE,WACPC,GAAQ,EACRC,IAAiB,EACjBC,OAA2C;IAE3C,IAAI,CAACP,eAAeQ,IAAI,CAACH,KAAKC,OAAOL,OAAO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AAY;QACZkJ,cAAc;QACdvJ,OAAO6I,MAAM,CAACS,KAAI;IACpB;AACJ;AACAb,YAAY9J,SAAS,GAAGiK,IAAIjK,SAAS;AACrCD,iBAAiB8K,CAAC,GAAGf;AAErB;;CAEC,GACD,SAASgB,UAAUC,KAAY,EAAEC,cAAoC;IACnE,MAAM,IAAIpJ,MAAM,CAAC,WAAW,EAAEoJ,eAAeD,QAAQ;AACvD;AAEA;;CAEC,GACD,SAASE,YAAYC,SAAmB;IACtC,MAAM,IAAItJ,MAAM;AAClB;AACA7B,iBAAiBoL,CAAC,GAAGF;AAErB,kGAAkG;AAClGlL,iBAAiBqL,CAAC,GAAGC;AAMrB,SAASxD,uBAAuByD,OAAiB;IAC/C,+DAA+D;IAC/DpL,OAAOQ,cAAc,CAAC4K,SAAS,QAAQ;QACrCjK,OAAO;IACT;AACF","ignoreList":[0]}}, - {"offset": {"line": 762, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/browser/runtime/base/runtime-base.ts"],"sourcesContent":["/**\n * This file contains runtime types and functions that are shared between all\n * Turbopack *browser* ECMAScript runtimes.\n *\n * It will be appended to the runtime code of each runtime right after the\n * shared runtime utils.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n/// \n\n// Used in WebWorkers to tell the runtime about the chunk base path\ndeclare var TURBOPACK_WORKER_LOCATION: string\n// Used in WebWorkers to tell the runtime about the chunk suffix\ndeclare var TURBOPACK_CHUNK_SUFFIX: string\n// Used in WebWorkers to tell the runtime about the current chunk url since it can't be detected via document.currentScript\n// Note it's stored in reversed order to use push and pop\ndeclare var TURBOPACK_NEXT_CHUNK_URLS: ChunkUrl[] | undefined\n\n// Injected by rust code\ndeclare var CHUNK_BASE_PATH: string\ndeclare var CHUNK_SUFFIX: string\n\ninterface TurbopackBrowserBaseContext extends TurbopackBaseContext {\n R: ResolvePathFromModule\n}\n\nconst browserContextPrototype =\n Context.prototype as TurbopackBrowserBaseContext\n\n// Provided by build or dev base\ndeclare function instantiateModule(\n id: ModuleId,\n sourceType: SourceType,\n sourceData: SourceData\n): Module\n\ntype RuntimeParams = {\n otherChunks: ChunkData[]\n runtimeModuleIds: ModuleId[]\n}\n\ntype ChunkRegistration = [\n chunkPath: ChunkScript,\n ...([RuntimeParams] | CompressedModuleFactories),\n]\n\ntype ChunkList = {\n script: ChunkListScript\n chunks: ChunkData[]\n source: 'entry' | 'dynamic'\n}\n\nenum SourceType {\n /**\n * The module was instantiated because it was included in an evaluated chunk's\n * runtime.\n * SourceData is a ChunkPath.\n */\n Runtime = 0,\n /**\n * The module was instantiated because a parent module imported it.\n * SourceData is a ModuleId.\n */\n Parent = 1,\n /**\n * The module was instantiated because it was included in a chunk's hot module\n * update.\n * SourceData is an array of ModuleIds or undefined.\n */\n Update = 2,\n}\n\ntype SourceData = ChunkPath | ModuleId | ModuleId[] | undefined\ninterface RuntimeBackend {\n registerChunk: (chunkPath: ChunkPath, params?: RuntimeParams) => void\n /**\n * Returns the same Promise for the same chunk URL.\n */\n loadChunkCached: (sourceType: SourceType, chunkUrl: ChunkUrl) => Promise\n loadWebAssembly: (\n sourceType: SourceType,\n sourceData: SourceData,\n wasmChunkPath: ChunkPath,\n edgeModule: () => WebAssembly.Module,\n importsObj: WebAssembly.Imports\n ) => Promise\n loadWebAssemblyModule: (\n sourceType: SourceType,\n sourceData: SourceData,\n wasmChunkPath: ChunkPath,\n edgeModule: () => WebAssembly.Module\n ) => Promise\n}\n\ninterface DevRuntimeBackend {\n reloadChunk?: (chunkUrl: ChunkUrl) => Promise\n unloadChunk?: (chunkUrl: ChunkUrl) => void\n restart: () => void\n}\n\nconst moduleFactories: ModuleFactories = new Map()\ncontextPrototype.M = moduleFactories\n\nconst availableModules: Map | true> = new Map()\n\nconst availableModuleChunks: Map | true> = new Map()\n\nfunction factoryNotAvailableMessage(\n moduleId: ModuleId,\n sourceType: SourceType,\n sourceData: SourceData\n): string {\n let instantiationReason\n switch (sourceType) {\n case SourceType.Runtime:\n instantiationReason = `as a runtime entry of chunk ${sourceData}`\n break\n case SourceType.Parent:\n instantiationReason = `because it was required from module ${sourceData}`\n break\n case SourceType.Update:\n instantiationReason = 'because of an HMR update'\n break\n default:\n invariant(\n sourceType,\n (sourceType) => `Unknown source type: ${sourceType}`\n )\n }\n return `Module ${moduleId} was instantiated ${instantiationReason}, but the module factory is not available.`\n}\n\nfunction loadChunk(\n this: TurbopackBrowserBaseContext,\n chunkData: ChunkData\n): Promise {\n return loadChunkInternal(SourceType.Parent, this.m.id, chunkData)\n}\nbrowserContextPrototype.l = loadChunk\n\nfunction loadInitialChunk(chunkPath: ChunkPath, chunkData: ChunkData) {\n return loadChunkInternal(SourceType.Runtime, chunkPath, chunkData)\n}\n\nasync function loadChunkInternal(\n sourceType: SourceType,\n sourceData: SourceData,\n chunkData: ChunkData\n): Promise {\n if (typeof chunkData === 'string') {\n return loadChunkPath(sourceType, sourceData, chunkData)\n }\n\n const includedList = chunkData.included || []\n const modulesPromises = includedList.map((included) => {\n if (moduleFactories.has(included)) return true\n return availableModules.get(included)\n })\n if (modulesPromises.length > 0 && modulesPromises.every((p) => p)) {\n // When all included items are already loaded or loading, we can skip loading ourselves\n await Promise.all(modulesPromises)\n return\n }\n\n const includedModuleChunksList = chunkData.moduleChunks || []\n const moduleChunksPromises = includedModuleChunksList\n .map((included) => {\n // TODO(alexkirsz) Do we need this check?\n // if (moduleFactories[included]) return true;\n return availableModuleChunks.get(included)\n })\n .filter((p) => p)\n\n let promise: Promise\n if (moduleChunksPromises.length > 0) {\n // Some module chunks are already loaded or loading.\n\n if (moduleChunksPromises.length === includedModuleChunksList.length) {\n // When all included module chunks are already loaded or loading, we can skip loading ourselves\n await Promise.all(moduleChunksPromises)\n return\n }\n\n const moduleChunksToLoad: Set = new Set()\n for (const moduleChunk of includedModuleChunksList) {\n if (!availableModuleChunks.has(moduleChunk)) {\n moduleChunksToLoad.add(moduleChunk)\n }\n }\n\n for (const moduleChunkToLoad of moduleChunksToLoad) {\n const promise = loadChunkPath(sourceType, sourceData, moduleChunkToLoad)\n\n availableModuleChunks.set(moduleChunkToLoad, promise)\n\n moduleChunksPromises.push(promise)\n }\n\n promise = Promise.all(moduleChunksPromises)\n } else {\n promise = loadChunkPath(sourceType, sourceData, chunkData.path)\n\n // Mark all included module chunks as loading if they are not already loaded or loading.\n for (const includedModuleChunk of includedModuleChunksList) {\n if (!availableModuleChunks.has(includedModuleChunk)) {\n availableModuleChunks.set(includedModuleChunk, promise)\n }\n }\n }\n\n for (const included of includedList) {\n if (!availableModules.has(included)) {\n // It might be better to race old and new promises, but it's rare that the new promise will be faster than a request started earlier.\n // In production it's even more rare, because the chunk optimization tries to deduplicate modules anyway.\n availableModules.set(included, promise)\n }\n }\n\n await promise\n}\n\nconst loadedChunk = Promise.resolve(undefined)\nconst instrumentedBackendLoadChunks = new WeakMap<\n Promise,\n Promise | typeof loadedChunk\n>()\n// Do not make this async. React relies on referential equality of the returned Promise.\nfunction loadChunkByUrl(\n this: TurbopackBrowserBaseContext,\n chunkUrl: ChunkUrl\n) {\n return loadChunkByUrlInternal(SourceType.Parent, this.m.id, chunkUrl)\n}\nbrowserContextPrototype.L = loadChunkByUrl\n\n// Do not make this async. React relies on referential equality of the returned Promise.\nfunction loadChunkByUrlInternal(\n sourceType: SourceType,\n sourceData: SourceData,\n chunkUrl: ChunkUrl\n): Promise {\n const thenable = BACKEND.loadChunkCached(sourceType, chunkUrl)\n let entry = instrumentedBackendLoadChunks.get(thenable)\n if (entry === undefined) {\n const resolve = instrumentedBackendLoadChunks.set.bind(\n instrumentedBackendLoadChunks,\n thenable,\n loadedChunk\n )\n entry = thenable.then(resolve).catch((cause) => {\n let loadReason: string\n switch (sourceType) {\n case SourceType.Runtime:\n loadReason = `as a runtime dependency of chunk ${sourceData}`\n break\n case SourceType.Parent:\n loadReason = `from module ${sourceData}`\n break\n case SourceType.Update:\n loadReason = 'from an HMR update'\n break\n default:\n invariant(\n sourceType,\n (sourceType) => `Unknown source type: ${sourceType}`\n )\n }\n let error = new Error(\n `Failed to load chunk ${chunkUrl} ${loadReason}${\n cause ? `: ${cause}` : ''\n }`,\n cause ? { cause } : undefined\n )\n error.name = 'ChunkLoadError'\n throw error\n })\n instrumentedBackendLoadChunks.set(thenable, entry)\n }\n\n return entry\n}\n\n// Do not make this async. React relies on referential equality of the returned Promise.\nfunction loadChunkPath(\n sourceType: SourceType,\n sourceData: SourceData,\n chunkPath: ChunkPath\n): Promise {\n const url = getChunkRelativeUrl(chunkPath)\n return loadChunkByUrlInternal(sourceType, sourceData, url)\n}\n\n/**\n * Returns an absolute url to an asset.\n */\nfunction resolvePathFromModule(\n this: TurbopackBaseContext,\n moduleId: string\n): string {\n const exported = this.r(moduleId)\n return exported?.default ?? exported\n}\nbrowserContextPrototype.R = resolvePathFromModule\n\n/**\n * no-op for browser\n * @param modulePath\n */\nfunction resolveAbsolutePath(modulePath?: string): string {\n return `/ROOT/${modulePath ?? ''}`\n}\nbrowserContextPrototype.P = resolveAbsolutePath\n\n/**\n * Returns a blob URL for the worker.\n * @param chunks list of chunks to load\n */\nfunction getWorkerBlobURL(chunks: ChunkPath[]): string {\n // It is important to reverse the array so when bootstrapping we can infer what chunk is being\n // evaluated by poping urls off of this array. See `getPathFromScript`\n let bootstrap = `self.TURBOPACK_WORKER_LOCATION = ${JSON.stringify(location.origin)};\nself.TURBOPACK_CHUNK_SUFFIX = ${JSON.stringify(CHUNK_SUFFIX)};\nself.TURBOPACK_NEXT_CHUNK_URLS = ${JSON.stringify(chunks.reverse().map(getChunkRelativeUrl), null, 2)};\nimportScripts(...self.TURBOPACK_NEXT_CHUNK_URLS.map(c => self.TURBOPACK_WORKER_LOCATION + c).reverse());`\n let blob = new Blob([bootstrap], { type: 'text/javascript' })\n return URL.createObjectURL(blob)\n}\nbrowserContextPrototype.b = getWorkerBlobURL\n\n/**\n * Instantiates a runtime module.\n */\nfunction instantiateRuntimeModule(\n moduleId: ModuleId,\n chunkPath: ChunkPath\n): Module {\n return instantiateModule(moduleId, SourceType.Runtime, chunkPath)\n}\n/**\n * Returns the URL relative to the origin where a chunk can be fetched from.\n */\nfunction getChunkRelativeUrl(chunkPath: ChunkPath | ChunkListPath): ChunkUrl {\n return `${CHUNK_BASE_PATH}${chunkPath\n .split('/')\n .map((p) => encodeURIComponent(p))\n .join('/')}${CHUNK_SUFFIX}` as ChunkUrl\n}\n\n/**\n * Return the ChunkPath from a ChunkScript.\n */\nfunction getPathFromScript(chunkScript: ChunkPath | ChunkScript): ChunkPath\nfunction getPathFromScript(\n chunkScript: ChunkListPath | ChunkListScript\n): ChunkListPath\nfunction getPathFromScript(\n chunkScript: ChunkPath | ChunkListPath | ChunkScript | ChunkListScript\n): ChunkPath | ChunkListPath {\n if (typeof chunkScript === 'string') {\n return chunkScript as ChunkPath | ChunkListPath\n }\n const chunkUrl =\n typeof TURBOPACK_NEXT_CHUNK_URLS !== 'undefined'\n ? TURBOPACK_NEXT_CHUNK_URLS.pop()!\n : chunkScript.getAttribute('src')!\n const src = decodeURIComponent(chunkUrl.replace(/[?#].*$/, ''))\n const path = src.startsWith(CHUNK_BASE_PATH)\n ? src.slice(CHUNK_BASE_PATH.length)\n : src\n return path as ChunkPath | ChunkListPath\n}\n\nconst regexJsUrl = /\\.js(?:\\?[^#]*)?(?:#.*)?$/\n/**\n * Checks if a given path/URL ends with .js, optionally followed by ?query or #fragment.\n */\nfunction isJs(chunkUrlOrPath: ChunkUrl | ChunkPath): boolean {\n return regexJsUrl.test(chunkUrlOrPath)\n}\n\nconst regexCssUrl = /\\.css(?:\\?[^#]*)?(?:#.*)?$/\n/**\n * Checks if a given path/URL ends with .css, optionally followed by ?query or #fragment.\n */\nfunction isCss(chunkUrl: ChunkUrl): boolean {\n return regexCssUrl.test(chunkUrl)\n}\n\nfunction loadWebAssembly(\n this: TurbopackBaseContext,\n chunkPath: ChunkPath,\n edgeModule: () => WebAssembly.Module,\n importsObj: WebAssembly.Imports\n): Promise {\n return BACKEND.loadWebAssembly(\n SourceType.Parent,\n this.m.id,\n chunkPath,\n edgeModule,\n importsObj\n )\n}\ncontextPrototype.w = loadWebAssembly\n\nfunction loadWebAssemblyModule(\n this: TurbopackBaseContext,\n chunkPath: ChunkPath,\n edgeModule: () => WebAssembly.Module\n): Promise {\n return BACKEND.loadWebAssemblyModule(\n SourceType.Parent,\n this.m.id,\n chunkPath,\n edgeModule\n )\n}\ncontextPrototype.u = loadWebAssemblyModule\n"],"names":["browserContextPrototype","Context","prototype","SourceType","moduleFactories","Map","contextPrototype","M","availableModules","availableModuleChunks","factoryNotAvailableMessage","moduleId","sourceType","sourceData","instantiationReason","invariant","loadChunk","chunkData","loadChunkInternal","m","id","l","loadInitialChunk","chunkPath","includedList","modulesPromises","includedModuleChunksList","moduleChunksPromises","promise","moduleChunksToLoad","_iteratorError","moduleChunk","_iteratorError1","moduleChunkToLoad","promise1","_iteratorError2","includedModuleChunk","_iteratorError3","included","loadChunkPath","map","has","get","length","every","p","Promise","all","moduleChunks","filter","Set","add","set","push","path","loadedChunk","resolve","undefined","instrumentedBackendLoadChunks","WeakMap","loadChunkByUrl","chunkUrl","loadChunkByUrlInternal","L","thenable","BACKEND","loadChunkCached","entry","bind","then","catch","cause","loadReason","error","Error","name","url","getChunkRelativeUrl","resolvePathFromModule","exported","r","default","R","resolveAbsolutePath","modulePath","P","getWorkerBlobURL","chunks","bootstrap","JSON","stringify","location","origin","CHUNK_SUFFIX","reverse","blob","Blob","type","URL","createObjectURL","b","instantiateRuntimeModule","instantiateModule","CHUNK_BASE_PATH","split","encodeURIComponent","join","getPathFromScript","chunkScript","TURBOPACK_NEXT_CHUNK_URLS","pop","getAttribute","src","decodeURIComponent","replace","startsWith","slice","regexJsUrl","isJs","chunkUrlOrPath","test","regexCssUrl","isCss","loadWebAssembly","edgeModule","importsObj","w","loadWebAssemblyModule","u"],"mappings":"AAAA;;;;;;CAMC,GAED,oDAAoD,GAEpD,6CAA6C;AAC7C,yDAAyD;AAEzD,mEAAmE;;;;;;;;;;;;;;;;;;;;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7D,QAAkB;IAC/B,OAAO4D,YAAYD,IAAI,CAAC3D;AAC1B;AAEA,SAAS8D,gBAEPpG,SAAoB,EACpBqG,UAAoC,EACpCC,UAA+B;IAE/B,OAAO5D,QAAQ0D,eAAe,IAE5B,IAAI,CAACxG,CAAC,CAACC,EAAE,EACTG,WACAqG,YACAC;AAEJ;AACAvH,iBAAiBwH,CAAC,GAAGH;AAErB,SAASI,sBAEPxG,SAAoB,EACpBqG,UAAoC;IAEpC,OAAO3D,QAAQ8D,qBAAqB,IAElC,IAAI,CAAC5G,CAAC,CAACC,EAAE,EACTG,WACAqG;AAEJ;AACAtH,iBAAiB0H,CAAC,GAAGD","ignoreList":[0]}}, - {"offset": {"line": 1241, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/browser/runtime/base/build-base.ts"],"sourcesContent":["/// \n/// \n\nconst moduleCache: ModuleCache = {}\ncontextPrototype.c = moduleCache\n\n/**\n * Gets or instantiates a runtime module.\n */\n// @ts-ignore\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction getOrInstantiateRuntimeModule(\n chunkPath: ChunkPath,\n moduleId: ModuleId\n): Module {\n const module = moduleCache[moduleId]\n if (module) {\n if (module.error) {\n throw module.error\n }\n return module\n }\n\n return instantiateModule(moduleId, SourceType.Runtime, chunkPath)\n}\n\n/**\n * Retrieves a module from the cache, or instantiate it if it is not cached.\n */\n// Used by the backend\n// @ts-ignore\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nconst getOrInstantiateModuleFromParent: GetOrInstantiateModuleFromParent<\n Module\n> = (id, sourceModule) => {\n const module = moduleCache[id]\n\n if (module) {\n if (module.error) {\n throw module.error\n }\n return module\n }\n\n return instantiateModule(id, SourceType.Parent, sourceModule.id)\n}\n\nfunction instantiateModule(\n id: ModuleId,\n sourceType: SourceType,\n sourceData: SourceData\n): Module {\n const moduleFactory = moduleFactories.get(id)\n if (typeof moduleFactory !== 'function') {\n // This can happen if modules incorrectly handle HMR disposes/updates,\n // e.g. when they keep a `setTimeout` around which still executes old code\n // and contains e.g. a `require(\"something\")` call.\n throw new Error(factoryNotAvailableMessage(id, sourceType, sourceData))\n }\n\n const module: Module = createModuleObject(id)\n const exports = module.exports\n\n moduleCache[id] = module\n\n // NOTE(alexkirsz) This can fail when the module encounters a runtime error.\n const context = new (Context as any as ContextConstructor)(\n module,\n exports\n )\n try {\n moduleFactory(context, module, exports)\n } catch (error) {\n module.error = error as any\n throw error\n }\n\n if (module.namespaceObject && module.exports !== module.namespaceObject) {\n // in case of a circular dependency: cjs1 -> esm2 -> cjs1\n interopEsm(module.exports, module.namespaceObject)\n }\n\n return module\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction registerChunk(registration: ChunkRegistration) {\n const chunkPath = getPathFromScript(registration[0])\n let runtimeParams: RuntimeParams | undefined\n // When bootstrapping we are passed a single runtimeParams object so we can distinguish purely based on length\n if (registration.length === 2) {\n runtimeParams = registration[1] as RuntimeParams\n } else {\n runtimeParams = undefined\n installCompressedModuleFactories(\n registration as CompressedModuleFactories,\n /* offset= */ 1,\n moduleFactories\n )\n }\n\n return BACKEND.registerChunk(chunkPath, runtimeParams)\n}\n"],"names":["moduleCache","contextPrototype","c","getOrInstantiateRuntimeModule","chunkPath","moduleId","module","error","instantiateModule","SourceType","Runtime","getOrInstantiateModuleFromParent","id","sourceModule","Parent","sourceType","sourceData","moduleFactory","moduleFactories","get","Error","factoryNotAvailableMessage","createModuleObject","exports","context","Context","namespaceObject","interopEsm","registerChunk","registration","getPathFromScript","runtimeParams","length","undefined","installCompressedModuleFactories","BACKEND"],"mappings":"AAAA,0CAA0C;AAC1C,mCAAmC;AAEnC,IAAMA,cAAmC,CAAC;AAC1CC,iBAAiBC,CAAC,GAAGF;AAErB;;CAEC,GACD,aAAa;AACb,6DAA6D;AAC7D,SAASG,8BACPC,SAAoB,EACpBC,QAAkB;IAElB,IAAMC,SAASN,WAAW,CAACK,SAAS;IACpC,IAAIC,QAAQ;QACV,IAAI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IAAIF,aAAaG,MAAM,KAAK,GAAG;QAC7BD,gBAAgBF,YAAY,CAAC,EAAE;IACjC,OAAO;QACLE,gBAAgBE;QAChBC,iCACEL,cACA,WAAW,GAAG,GACdX;IAEJ;IAEA,OAAOiB,QAAQP,aAAa,CAACxB,WAAW2B;AAC1C","ignoreList":[0]}}, - {"offset": {"line": 1312, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/browser/runtime/dom/runtime-backend-dom.ts"],"sourcesContent":["/**\n * This file contains the runtime code specific to the Turbopack ECMAScript DOM runtime.\n *\n * It will be appended to the base runtime code.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n/// \n\nfunction getChunkSuffixFromScriptSrc() {\n // TURBOPACK_CHUNK_SUFFIX is set in web workers\n return (\n (self.TURBOPACK_CHUNK_SUFFIX ??\n document?.currentScript\n ?.getAttribute?.('src')\n ?.replace(/^(.*(?=\\?)|^.*$)/, '')) ||\n ''\n )\n}\n\ntype ChunkResolver = {\n resolved: boolean\n loadingStarted: boolean\n resolve: () => void\n reject: (error?: Error) => void\n promise: Promise\n}\n\nlet BACKEND: RuntimeBackend\n\n/**\n * Maps chunk paths to the corresponding resolver.\n */\nconst chunkResolvers: Map = new Map()\n\n;(() => {\n BACKEND = {\n async registerChunk(chunkPath, params) {\n const chunkUrl = getChunkRelativeUrl(chunkPath)\n\n const resolver = getOrCreateResolver(chunkUrl)\n resolver.resolve()\n\n if (params == null) {\n return\n }\n\n for (const otherChunkData of params.otherChunks) {\n const otherChunkPath = getChunkPath(otherChunkData)\n const otherChunkUrl = getChunkRelativeUrl(otherChunkPath)\n\n // Chunk might have started loading, so we want to avoid triggering another load.\n getOrCreateResolver(otherChunkUrl)\n }\n\n // This waits for chunks to be loaded, but also marks included items as available.\n await Promise.all(\n params.otherChunks.map((otherChunkData) =>\n loadInitialChunk(chunkPath, otherChunkData)\n )\n )\n\n if (params.runtimeModuleIds.length > 0) {\n for (const moduleId of params.runtimeModuleIds) {\n getOrInstantiateRuntimeModule(chunkPath, moduleId)\n }\n }\n },\n\n /**\n * Loads the given chunk, and returns a promise that resolves once the chunk\n * has been loaded.\n */\n loadChunkCached(sourceType: SourceType, chunkUrl: ChunkUrl) {\n return doLoadChunk(sourceType, chunkUrl)\n },\n\n async loadWebAssembly(\n _sourceType: SourceType,\n _sourceData: SourceData,\n wasmChunkPath: ChunkPath,\n _edgeModule: () => WebAssembly.Module,\n importsObj: WebAssembly.Imports\n ): Promise {\n const req = fetchWebAssembly(wasmChunkPath)\n\n const { instance } = await WebAssembly.instantiateStreaming(\n req,\n importsObj\n )\n\n return instance.exports\n },\n\n async loadWebAssemblyModule(\n _sourceType: SourceType,\n _sourceData: SourceData,\n wasmChunkPath: ChunkPath,\n _edgeModule: () => WebAssembly.Module\n ): Promise {\n const req = fetchWebAssembly(wasmChunkPath)\n\n return await WebAssembly.compileStreaming(req)\n },\n }\n\n function getOrCreateResolver(chunkUrl: ChunkUrl): ChunkResolver {\n let resolver = chunkResolvers.get(chunkUrl)\n if (!resolver) {\n let resolve: () => void\n let reject: (error?: Error) => void\n const promise = new Promise((innerResolve, innerReject) => {\n resolve = innerResolve\n reject = innerReject\n })\n resolver = {\n resolved: false,\n loadingStarted: false,\n promise,\n resolve: () => {\n resolver!.resolved = true\n resolve()\n },\n reject: reject!,\n }\n chunkResolvers.set(chunkUrl, resolver)\n }\n return resolver\n }\n\n /**\n * Loads the given chunk, and returns a promise that resolves once the chunk\n * has been loaded.\n */\n function doLoadChunk(sourceType: SourceType, chunkUrl: ChunkUrl) {\n const resolver = getOrCreateResolver(chunkUrl)\n if (resolver.loadingStarted) {\n return resolver.promise\n }\n\n if (sourceType === SourceType.Runtime) {\n // We don't need to load chunks references from runtime code, as they're already\n // present in the DOM.\n resolver.loadingStarted = true\n\n if (isCss(chunkUrl)) {\n // CSS chunks do not register themselves, and as such must be marked as\n // loaded instantly.\n resolver.resolve()\n }\n\n // We need to wait for JS chunks to register themselves within `registerChunk`\n // before we can start instantiating runtime modules, hence the absence of\n // `resolver.resolve()` in this branch.\n\n return resolver.promise\n }\n\n if (typeof importScripts === 'function') {\n // We're in a web worker\n if (isCss(chunkUrl)) {\n // ignore\n } else if (isJs(chunkUrl)) {\n self.TURBOPACK_NEXT_CHUNK_URLS!.push(chunkUrl)\n importScripts(TURBOPACK_WORKER_LOCATION + chunkUrl)\n } else {\n throw new Error(\n `can't infer type of chunk from URL ${chunkUrl} in worker`\n )\n }\n } else {\n // TODO(PACK-2140): remove this once all filenames are guaranteed to be escaped.\n const decodedChunkUrl = decodeURI(chunkUrl)\n\n if (isCss(chunkUrl)) {\n const previousLinks = document.querySelectorAll(\n `link[rel=stylesheet][href=\"${chunkUrl}\"],link[rel=stylesheet][href^=\"${chunkUrl}?\"],link[rel=stylesheet][href=\"${decodedChunkUrl}\"],link[rel=stylesheet][href^=\"${decodedChunkUrl}?\"]`\n )\n if (previousLinks.length > 0) {\n // CSS chunks do not register themselves, and as such must be marked as\n // loaded instantly.\n resolver.resolve()\n } else {\n const link = document.createElement('link')\n link.rel = 'stylesheet'\n link.href = chunkUrl\n link.onerror = () => {\n resolver.reject()\n }\n link.onload = () => {\n // CSS chunks do not register themselves, and as such must be marked as\n // loaded instantly.\n resolver.resolve()\n }\n // Append to the `head` for webpack compatibility.\n document.head.appendChild(link)\n }\n } else if (isJs(chunkUrl)) {\n const previousScripts = document.querySelectorAll(\n `script[src=\"${chunkUrl}\"],script[src^=\"${chunkUrl}?\"],script[src=\"${decodedChunkUrl}\"],script[src^=\"${decodedChunkUrl}?\"]`\n )\n if (previousScripts.length > 0) {\n // There is this edge where the script already failed loading, but we\n // can't detect that. The Promise will never resolve in this case.\n for (const script of Array.from(previousScripts)) {\n script.addEventListener('error', () => {\n resolver.reject()\n })\n }\n } else {\n const script = document.createElement('script')\n script.src = chunkUrl\n // We'll only mark the chunk as loaded once the script has been executed,\n // which happens in `registerChunk`. Hence the absence of `resolve()` in\n // this branch.\n script.onerror = () => {\n resolver.reject()\n }\n // Append to the `head` for webpack compatibility.\n document.head.appendChild(script)\n }\n } else {\n throw new Error(`can't infer type of chunk from URL ${chunkUrl}`)\n }\n }\n\n resolver.loadingStarted = true\n return resolver.promise\n }\n\n function fetchWebAssembly(wasmChunkPath: ChunkPath) {\n return fetch(getChunkRelativeUrl(wasmChunkPath))\n }\n})()\n"],"names":["getChunkSuffixFromScriptSrc","_self_TURBOPACK_CHUNK_SUFFIX","_document_currentScript_getAttribute","TURBOPACK_CHUNK_SUFFIX","currentScript","getAttribute","replace","BACKEND","chunkResolvers","Map","registerChunk","chunkPath","params","chunkUrl","resolver","_iteratorError","otherChunkData","otherChunkPath","otherChunkUrl","_iteratorError1","moduleId","getChunkRelativeUrl","getOrCreateResolver","resolve","otherChunks","getChunkPath","Promise","all","map","loadInitialChunk","runtimeModuleIds","length","getOrInstantiateRuntimeModule","loadChunkCached","sourceType","doLoadChunk","loadWebAssembly","_sourceType","_sourceData","wasmChunkPath","_edgeModule","importsObj","req","instance","fetchWebAssembly","WebAssembly","instantiateStreaming","exports","loadWebAssemblyModule","compileStreaming","get","reject","promise","innerResolve","innerReject","resolved","loadingStarted","set","SourceType","Runtime","isCss","importScripts","isJs","self","TURBOPACK_NEXT_CHUNK_URLS","push","TURBOPACK_WORKER_LOCATION","Error","decodedChunkUrl","decodeURI","previousLinks","document","querySelectorAll","link","createElement","rel","href","onerror","onload","head","appendChild","previousScripts","Array","from","script","addEventListener","script1","src","fetch"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;CAIC,GAED,oDAAoD,GAEpD,sEAAsE;AACtE,2DAA2D;AAE3D,SAASA;QAGJC;QACCC,sCAAAA,uCAAAA,yBAAAA;IAHJ,+CAA+C;IAC/C,OACE,CAAA,CAACD,+BAAAA,KAAKE,sBAAsB,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CAAC,YAAY,EAAE3D,SAAS,gBAAgB,EAAEA,SAAS,gBAAgB,EAAEuD,gBAAgB,gBAAgB,EAAEA,gBAAgB,GAAG,CAAC;gBAE7H,IAAIa,gBAAgBlD,MAAM,GAAG,GAAG;wBAGzBhB,kCAAAA,2BAAAA;;wBAFL,qEAAqE;wBACrE,kEAAkE;wBAClE,QAAKA,YAAgBmE,MAAMC,IAAI,CAACF,qCAA3BlE,SAAAA,6BAAAA,QAAAA,yBAAAA,iCAA6C;4BAA7CA,IAAMqE,SAANrE;4BACHqE,OAAOC,gBAAgB,CAAC,SAAS;gCAC/BvE,SAASqC,MAAM;4BACjB;wBACF;;wBAJKpC;wBAAAA;;;iCAAAA,6BAAAA;gCAAAA;;;gCAAAA;sCAAAA;;;;gBAKP,OAAO;oBACL,IAAMuE,UAASf,SAASG,aAAa,CAAC;oBACtCY,QAAOC,GAAG,GAAG1E;oBACb,yEAAyE;oBACzE,wEAAwE;oBACxE,eAAe;oBACfyE,QAAOT,OAAO,GAAG;wBACf/D,SAASqC,MAAM;oBACjB;oBACA,kDAAkD;oBAClDoB,SAASQ,IAAI,CAACC,WAAW,CAACM;gBAC5B;YACF,OAAO;gBACL,MAAM,IAAInB,MAAM,CAAC,mCAAmC,EAAEtD,UAAU;YAClE;QACF;QAEAC,SAAS0C,cAAc,GAAG;QAC1B,OAAO1C,SAASsC,OAAO;IACzB;IAEA,SAASR,iBAAiBL,aAAwB;QAChD,OAAOiD,MAAMnE,oBAAoBkB;IACnC;AACF,CAAC","ignoreList":[0]}}] + {"offset": {"line": 762, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/browser/runtime/base/runtime-base.ts"],"sourcesContent":["/**\n * This file contains runtime types and functions that are shared between all\n * Turbopack *browser* ECMAScript runtimes.\n *\n * It will be appended to the runtime code of each runtime right after the\n * shared runtime utils.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n/// \n\n// Used in WebWorkers to tell the runtime about the chunk base path\ndeclare var TURBOPACK_WORKER_LOCATION: string\n// Used in WebWorkers to tell the runtime about the chunk suffix\ndeclare var TURBOPACK_CHUNK_SUFFIX: string\n// Used in WebWorkers to tell the runtime about the current chunk url since it can't be detected via document.currentScript\n// Note it's stored in reversed order to use push and pop\ndeclare var TURBOPACK_NEXT_CHUNK_URLS: ChunkUrl[] | undefined\n\n// Injected by rust code\ndeclare var CHUNK_BASE_PATH: string\ndeclare var CHUNK_SUFFIX: string\n\ninterface TurbopackBrowserBaseContext extends TurbopackBaseContext {\n R: ResolvePathFromModule\n}\n\nconst browserContextPrototype =\n Context.prototype as TurbopackBrowserBaseContext\n\n// Provided by build or dev base\ndeclare function instantiateModule(\n id: ModuleId,\n sourceType: SourceType,\n sourceData: SourceData\n): Module\n\ntype RuntimeParams = {\n otherChunks: ChunkData[]\n runtimeModuleIds: ModuleId[]\n}\n\ntype ChunkRegistration = [\n chunkPath: ChunkScript,\n ...([RuntimeParams] | CompressedModuleFactories),\n]\n\ntype ChunkList = {\n script: ChunkListScript\n chunks: ChunkData[]\n source: 'entry' | 'dynamic'\n}\n\nenum SourceType {\n /**\n * The module was instantiated because it was included in an evaluated chunk's\n * runtime.\n * SourceData is a ChunkPath.\n */\n Runtime = 0,\n /**\n * The module was instantiated because a parent module imported it.\n * SourceData is a ModuleId.\n */\n Parent = 1,\n /**\n * The module was instantiated because it was included in a chunk's hot module\n * update.\n * SourceData is an array of ModuleIds or undefined.\n */\n Update = 2,\n}\n\ntype SourceData = ChunkPath | ModuleId | ModuleId[] | undefined\ninterface RuntimeBackend {\n registerChunk: (chunkPath: ChunkPath, params?: RuntimeParams) => void\n /**\n * Returns the same Promise for the same chunk URL.\n */\n loadChunkCached: (sourceType: SourceType, chunkUrl: ChunkUrl) => Promise\n loadWebAssembly: (\n sourceType: SourceType,\n sourceData: SourceData,\n wasmChunkPath: ChunkPath,\n edgeModule: () => WebAssembly.Module,\n importsObj: WebAssembly.Imports\n ) => Promise\n loadWebAssemblyModule: (\n sourceType: SourceType,\n sourceData: SourceData,\n wasmChunkPath: ChunkPath,\n edgeModule: () => WebAssembly.Module\n ) => Promise\n}\n\ninterface DevRuntimeBackend {\n reloadChunk?: (chunkUrl: ChunkUrl) => Promise\n unloadChunk?: (chunkUrl: ChunkUrl) => void\n restart: () => void\n}\n\nconst moduleFactories: ModuleFactories = new Map()\ncontextPrototype.M = moduleFactories\n\nconst availableModules: Map | true> = new Map()\n\nconst availableModuleChunks: Map | true> = new Map()\n\nfunction factoryNotAvailableMessage(\n moduleId: ModuleId,\n sourceType: SourceType,\n sourceData: SourceData\n): string {\n let instantiationReason\n switch (sourceType) {\n case SourceType.Runtime:\n instantiationReason = `as a runtime entry of chunk ${sourceData}`\n break\n case SourceType.Parent:\n instantiationReason = `because it was required from module ${sourceData}`\n break\n case SourceType.Update:\n instantiationReason = 'because of an HMR update'\n break\n default:\n invariant(\n sourceType,\n (sourceType) => `Unknown source type: ${sourceType}`\n )\n }\n return `Module ${moduleId} was instantiated ${instantiationReason}, but the module factory is not available.`\n}\n\nfunction loadChunk(\n this: TurbopackBrowserBaseContext,\n chunkData: ChunkData\n): Promise {\n return loadChunkInternal(SourceType.Parent, this.m.id, chunkData)\n}\nbrowserContextPrototype.l = loadChunk\n\nfunction loadInitialChunk(chunkPath: ChunkPath, chunkData: ChunkData) {\n return loadChunkInternal(SourceType.Runtime, chunkPath, chunkData)\n}\n\nasync function loadChunkInternal(\n sourceType: SourceType,\n sourceData: SourceData,\n chunkData: ChunkData\n): Promise {\n if (typeof chunkData === 'string') {\n return loadChunkPath(sourceType, sourceData, chunkData)\n }\n\n const includedList = chunkData.included || []\n const modulesPromises = includedList.map((included) => {\n if (moduleFactories.has(included)) return true\n return availableModules.get(included)\n })\n if (modulesPromises.length > 0 && modulesPromises.every((p) => p)) {\n // When all included items are already loaded or loading, we can skip loading ourselves\n await Promise.all(modulesPromises)\n return\n }\n\n const includedModuleChunksList = chunkData.moduleChunks || []\n const moduleChunksPromises = includedModuleChunksList\n .map((included) => {\n // TODO(alexkirsz) Do we need this check?\n // if (moduleFactories[included]) return true;\n return availableModuleChunks.get(included)\n })\n .filter((p) => p)\n\n let promise: Promise\n if (moduleChunksPromises.length > 0) {\n // Some module chunks are already loaded or loading.\n\n if (moduleChunksPromises.length === includedModuleChunksList.length) {\n // When all included module chunks are already loaded or loading, we can skip loading ourselves\n await Promise.all(moduleChunksPromises)\n return\n }\n\n const moduleChunksToLoad: Set = new Set()\n for (const moduleChunk of includedModuleChunksList) {\n if (!availableModuleChunks.has(moduleChunk)) {\n moduleChunksToLoad.add(moduleChunk)\n }\n }\n\n for (const moduleChunkToLoad of moduleChunksToLoad) {\n const promise = loadChunkPath(sourceType, sourceData, moduleChunkToLoad)\n\n availableModuleChunks.set(moduleChunkToLoad, promise)\n\n moduleChunksPromises.push(promise)\n }\n\n promise = Promise.all(moduleChunksPromises)\n } else {\n promise = loadChunkPath(sourceType, sourceData, chunkData.path)\n\n // Mark all included module chunks as loading if they are not already loaded or loading.\n for (const includedModuleChunk of includedModuleChunksList) {\n if (!availableModuleChunks.has(includedModuleChunk)) {\n availableModuleChunks.set(includedModuleChunk, promise)\n }\n }\n }\n\n for (const included of includedList) {\n if (!availableModules.has(included)) {\n // It might be better to race old and new promises, but it's rare that the new promise will be faster than a request started earlier.\n // In production it's even more rare, because the chunk optimization tries to deduplicate modules anyway.\n availableModules.set(included, promise)\n }\n }\n\n await promise\n}\n\nconst loadedChunk = Promise.resolve(undefined)\nconst instrumentedBackendLoadChunks = new WeakMap<\n Promise,\n Promise | typeof loadedChunk\n>()\n// Do not make this async. React relies on referential equality of the returned Promise.\nfunction loadChunkByUrl(\n this: TurbopackBrowserBaseContext,\n chunkUrl: ChunkUrl\n) {\n return loadChunkByUrlInternal(SourceType.Parent, this.m.id, chunkUrl)\n}\nbrowserContextPrototype.L = loadChunkByUrl\n\n// Do not make this async. React relies on referential equality of the returned Promise.\nfunction loadChunkByUrlInternal(\n sourceType: SourceType,\n sourceData: SourceData,\n chunkUrl: ChunkUrl\n): Promise {\n const thenable = BACKEND.loadChunkCached(sourceType, chunkUrl)\n let entry = instrumentedBackendLoadChunks.get(thenable)\n if (entry === undefined) {\n const resolve = instrumentedBackendLoadChunks.set.bind(\n instrumentedBackendLoadChunks,\n thenable,\n loadedChunk\n )\n entry = thenable.then(resolve).catch((cause) => {\n let loadReason: string\n switch (sourceType) {\n case SourceType.Runtime:\n loadReason = `as a runtime dependency of chunk ${sourceData}`\n break\n case SourceType.Parent:\n loadReason = `from module ${sourceData}`\n break\n case SourceType.Update:\n loadReason = 'from an HMR update'\n break\n default:\n invariant(\n sourceType,\n (sourceType) => `Unknown source type: ${sourceType}`\n )\n }\n let error = new Error(\n `Failed to load chunk ${chunkUrl} ${loadReason}${\n cause ? `: ${cause}` : ''\n }`,\n cause ? { cause } : undefined\n )\n error.name = 'ChunkLoadError'\n throw error\n })\n instrumentedBackendLoadChunks.set(thenable, entry)\n }\n\n return entry\n}\n\n// Do not make this async. React relies on referential equality of the returned Promise.\nfunction loadChunkPath(\n sourceType: SourceType,\n sourceData: SourceData,\n chunkPath: ChunkPath\n): Promise {\n const url = getChunkRelativeUrl(chunkPath)\n return loadChunkByUrlInternal(sourceType, sourceData, url)\n}\n\n/**\n * Returns an absolute url to an asset.\n */\nfunction resolvePathFromModule(\n this: TurbopackBaseContext,\n moduleId: string\n): string {\n const exported = this.r(moduleId)\n return exported?.default ?? exported\n}\nbrowserContextPrototype.R = resolvePathFromModule\n\n/**\n * no-op for browser\n * @param modulePath\n */\nfunction resolveAbsolutePath(modulePath?: string): string {\n return `/ROOT/${modulePath ?? ''}`\n}\nbrowserContextPrototype.P = resolveAbsolutePath\n\n/**\n * Returns a blob URL for the worker.\n * @param chunks list of chunks to load\n */\nfunction getWorkerBlobURL(chunks: ChunkPath[]): string {\n // It is important to reverse the array so when bootstrapping we can infer what chunk is being\n // evaluated by poping urls off of this array. See `getPathFromScript`\n let bootstrap = `self.TURBOPACK_WORKER_LOCATION = ${JSON.stringify(location.origin)};\nself.TURBOPACK_CHUNK_SUFFIX = ${JSON.stringify(CHUNK_SUFFIX)};\nself.NEXT_DEPLOYMENT_ID = ${JSON.stringify((globalThis as any).NEXT_DEPLOYMENT_ID)};\nself.TURBOPACK_NEXT_CHUNK_URLS = ${JSON.stringify(chunks.reverse().map(getChunkRelativeUrl), null, 2)};\nimportScripts(...self.TURBOPACK_NEXT_CHUNK_URLS.map(c => self.TURBOPACK_WORKER_LOCATION + c).reverse());`\n let blob = new Blob([bootstrap], { type: 'text/javascript' })\n return URL.createObjectURL(blob)\n}\nbrowserContextPrototype.b = getWorkerBlobURL\n\n/**\n * Instantiates a runtime module.\n */\nfunction instantiateRuntimeModule(\n moduleId: ModuleId,\n chunkPath: ChunkPath\n): Module {\n return instantiateModule(moduleId, SourceType.Runtime, chunkPath)\n}\n/**\n * Returns the URL relative to the origin where a chunk can be fetched from.\n */\nfunction getChunkRelativeUrl(chunkPath: ChunkPath | ChunkListPath): ChunkUrl {\n return `${CHUNK_BASE_PATH}${chunkPath\n .split('/')\n .map((p) => encodeURIComponent(p))\n .join('/')}${CHUNK_SUFFIX}` as ChunkUrl\n}\n\n/**\n * Return the ChunkPath from a ChunkScript.\n */\nfunction getPathFromScript(chunkScript: ChunkPath | ChunkScript): ChunkPath\nfunction getPathFromScript(\n chunkScript: ChunkListPath | ChunkListScript\n): ChunkListPath\nfunction getPathFromScript(\n chunkScript: ChunkPath | ChunkListPath | ChunkScript | ChunkListScript\n): ChunkPath | ChunkListPath {\n if (typeof chunkScript === 'string') {\n return chunkScript as ChunkPath | ChunkListPath\n }\n const chunkUrl =\n typeof TURBOPACK_NEXT_CHUNK_URLS !== 'undefined'\n ? TURBOPACK_NEXT_CHUNK_URLS.pop()!\n : chunkScript.getAttribute('src')!\n const src = decodeURIComponent(chunkUrl.replace(/[?#].*$/, ''))\n const path = src.startsWith(CHUNK_BASE_PATH)\n ? src.slice(CHUNK_BASE_PATH.length)\n : src\n return path as ChunkPath | ChunkListPath\n}\n\nconst regexJsUrl = /\\.js(?:\\?[^#]*)?(?:#.*)?$/\n/**\n * Checks if a given path/URL ends with .js, optionally followed by ?query or #fragment.\n */\nfunction isJs(chunkUrlOrPath: ChunkUrl | ChunkPath): boolean {\n return regexJsUrl.test(chunkUrlOrPath)\n}\n\nconst regexCssUrl = /\\.css(?:\\?[^#]*)?(?:#.*)?$/\n/**\n * Checks if a given path/URL ends with .css, optionally followed by ?query or #fragment.\n */\nfunction isCss(chunkUrl: ChunkUrl): boolean {\n return regexCssUrl.test(chunkUrl)\n}\n\nfunction loadWebAssembly(\n this: TurbopackBaseContext,\n chunkPath: ChunkPath,\n edgeModule: () => WebAssembly.Module,\n importsObj: WebAssembly.Imports\n): Promise {\n return BACKEND.loadWebAssembly(\n SourceType.Parent,\n this.m.id,\n chunkPath,\n edgeModule,\n importsObj\n )\n}\ncontextPrototype.w = loadWebAssembly\n\nfunction loadWebAssemblyModule(\n this: TurbopackBaseContext,\n chunkPath: ChunkPath,\n edgeModule: () => WebAssembly.Module\n): Promise {\n return BACKEND.loadWebAssemblyModule(\n SourceType.Parent,\n this.m.id,\n chunkPath,\n edgeModule\n )\n}\ncontextPrototype.u = loadWebAssemblyModule\n"],"names":["browserContextPrototype","Context","prototype","SourceType","moduleFactories","Map","contextPrototype","M","availableModules","availableModuleChunks","factoryNotAvailableMessage","moduleId","sourceType","sourceData","instantiationReason","invariant","loadChunk","chunkData","loadChunkInternal","m","id","l","loadInitialChunk","chunkPath","includedList","modulesPromises","includedModuleChunksList","moduleChunksPromises","promise","moduleChunksToLoad","_iteratorError","moduleChunk","_iteratorError1","moduleChunkToLoad","promise1","_iteratorError2","includedModuleChunk","_iteratorError3","included","loadChunkPath","map","has","get","length","every","p","Promise","all","moduleChunks","filter","Set","add","set","push","path","loadedChunk","resolve","undefined","instrumentedBackendLoadChunks","WeakMap","loadChunkByUrl","chunkUrl","loadChunkByUrlInternal","L","thenable","BACKEND","loadChunkCached","entry","bind","then","catch","cause","loadReason","error","Error","name","url","getChunkRelativeUrl","resolvePathFromModule","exported","r","default","R","resolveAbsolutePath","modulePath","P","getWorkerBlobURL","chunks","bootstrap","JSON","stringify","location","origin","CHUNK_SUFFIX","globalThis","NEXT_DEPLOYMENT_ID","reverse","blob","Blob","type","URL","createObjectURL","b","instantiateRuntimeModule","instantiateModule","CHUNK_BASE_PATH","split","encodeURIComponent","join","getPathFromScript","chunkScript","TURBOPACK_NEXT_CHUNK_URLS","pop","getAttribute","src","decodeURIComponent","replace","startsWith","slice","regexJsUrl","isJs","chunkUrlOrPath","test","regexCssUrl","isCss","loadWebAssembly","edgeModule","importsObj","w","loadWebAssemblyModule","u"],"mappings":"AAAA;;;;;;CAMC,GAED,oDAAoD,GAEpD,6CAA6C;AAC7C,yDAAyD;AAEzD,mEAAmE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBnE,IAAMA,0BACJC,QAAQC,SAAS;AAyBnB,IAAA,AAAKC,oCAAAA;IACH;;;;GAIC;IAED;;;GAGC;IAED;;;;GAIC;WAhBEA;EAAAA;AAgDL,IAAMC,kBAAmC,IAAIC;AAC7CC,iBAAiBC,CAAC,GAAGH;AAErB,IAAMI,mBAAuD,IAAIH;AAEjE,IAAMI,wBAA6D,IAAIJ;AAEvE,SAASK,2BACPC,QAAkB,EAClBC,UAAsB,EACtBC,UAAsB;IAEtB,IAAIC;IACJ,OAAQF;QACN;YACEE,sBAAsB,CAAC,4BAA4B,EAAED,YAAY;YACjE;QACF;YACEC,sBAAsB,CAAC,oCAAoC,EAAED,YAAY;YACzE;QACF;YACEC,sBAAsB;YACtB;QACF;YACEC,UACEH,YACA,SAACA;uBAAe,CAAC,qBAAqB,EAAEA,YAAY;;IAE1D;IACA,OAAO,CAAC,OAAO,EAAED,SAAS,kBAAkB,EAAEG,oBAAoB,0CAA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AC,KACNlE,GAAG,CAAC,SAACK;eAAM8D,mBAAmB9D;OAC9B+D,IAAI,CAAC,OAAOf,cAAc;AAC/B;AASA,SAASgB,kBACPC,WAAsE;IAEtE,IAAI,OAAOA,gBAAgB,UAAU;QACnC,OAAOA;IACT;IACA,IAAMjD,WACJ,OAAOkD,8BAA8B,cACjCA,0BAA0BC,GAAG,KAC7BF,YAAYG,YAAY,CAAC;IAC/B,IAAMC,MAAMC,mBAAmBtD,SAASuD,OAAO,CAAC,WAAW;IAC3D,IAAM9D,OAAO4D,IAAIG,UAAU,CAACZ,mBACxBS,IAAII,KAAK,CAACb,gBAAgB9D,MAAM,IAChCuE;IACJ,OAAO5D;AACT;AAEA,IAAMiE,aAAa;AACnB;;CAEC,GACD,SAASC,KAAKC,cAAoC;IAChD,OAAOF,WAAWG,IAAI,CAACD;AACzB;AAEA,IAAME,cAAc;AACpB;;CAEC,GACD,SAASC,MAAM/D,QAAkB;IAC/B,OAAO8D,YAAYD,IAAI,CAAC7D;AAC1B;AAEA,SAASgE,gBAEPtG,SAAoB,EACpBuG,UAAoC,EACpCC,UAA+B;IAE/B,OAAO9D,QAAQ4D,eAAe,IAE5B,IAAI,CAAC1G,CAAC,CAACC,EAAE,EACTG,WACAuG,YACAC;AAEJ;AACAzH,iBAAiB0H,CAAC,GAAGH;AAErB,SAASI,sBAEP1G,SAAoB,EACpBuG,UAAoC;IAEpC,OAAO7D,QAAQgE,qBAAqB,IAElC,IAAI,CAAC9G,CAAC,CAACC,EAAE,EACTG,WACAuG;AAEJ;AACAxH,iBAAiB4H,CAAC,GAAGD","ignoreList":[0]}}, + {"offset": {"line": 1242, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/browser/runtime/base/build-base.ts"],"sourcesContent":["/// \n/// \n\nconst moduleCache: ModuleCache = {}\ncontextPrototype.c = moduleCache\n\n/**\n * Gets or instantiates a runtime module.\n */\n// @ts-ignore\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction getOrInstantiateRuntimeModule(\n chunkPath: ChunkPath,\n moduleId: ModuleId\n): Module {\n const module = moduleCache[moduleId]\n if (module) {\n if (module.error) {\n throw module.error\n }\n return module\n }\n\n return instantiateModule(moduleId, SourceType.Runtime, chunkPath)\n}\n\n/**\n * Retrieves a module from the cache, or instantiate it if it is not cached.\n */\n// Used by the backend\n// @ts-ignore\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nconst getOrInstantiateModuleFromParent: GetOrInstantiateModuleFromParent<\n Module\n> = (id, sourceModule) => {\n const module = moduleCache[id]\n\n if (module) {\n if (module.error) {\n throw module.error\n }\n return module\n }\n\n return instantiateModule(id, SourceType.Parent, sourceModule.id)\n}\n\nfunction instantiateModule(\n id: ModuleId,\n sourceType: SourceType,\n sourceData: SourceData\n): Module {\n const moduleFactory = moduleFactories.get(id)\n if (typeof moduleFactory !== 'function') {\n // This can happen if modules incorrectly handle HMR disposes/updates,\n // e.g. when they keep a `setTimeout` around which still executes old code\n // and contains e.g. a `require(\"something\")` call.\n throw new Error(factoryNotAvailableMessage(id, sourceType, sourceData))\n }\n\n const module: Module = createModuleObject(id)\n const exports = module.exports\n\n moduleCache[id] = module\n\n // NOTE(alexkirsz) This can fail when the module encounters a runtime error.\n const context = new (Context as any as ContextConstructor)(\n module,\n exports\n )\n try {\n moduleFactory(context, module, exports)\n } catch (error) {\n module.error = error as any\n throw error\n }\n\n if (module.namespaceObject && module.exports !== module.namespaceObject) {\n // in case of a circular dependency: cjs1 -> esm2 -> cjs1\n interopEsm(module.exports, module.namespaceObject)\n }\n\n return module\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction registerChunk(registration: ChunkRegistration) {\n const chunkPath = getPathFromScript(registration[0])\n let runtimeParams: RuntimeParams | undefined\n // When bootstrapping we are passed a single runtimeParams object so we can distinguish purely based on length\n if (registration.length === 2) {\n runtimeParams = registration[1] as RuntimeParams\n } else {\n runtimeParams = undefined\n installCompressedModuleFactories(\n registration as CompressedModuleFactories,\n /* offset= */ 1,\n moduleFactories\n )\n }\n\n return BACKEND.registerChunk(chunkPath, runtimeParams)\n}\n"],"names":["moduleCache","contextPrototype","c","getOrInstantiateRuntimeModule","chunkPath","moduleId","module","error","instantiateModule","SourceType","Runtime","getOrInstantiateModuleFromParent","id","sourceModule","Parent","sourceType","sourceData","moduleFactory","moduleFactories","get","Error","factoryNotAvailableMessage","createModuleObject","exports","context","Context","namespaceObject","interopEsm","registerChunk","registration","getPathFromScript","runtimeParams","length","undefined","installCompressedModuleFactories","BACKEND"],"mappings":"AAAA,0CAA0C;AAC1C,mCAAmC;AAEnC,IAAMA,cAAmC,CAAC;AAC1CC,iBAAiBC,CAAC,GAAGF;AAErB;;CAEC,GACD,aAAa;AACb,6DAA6D;AAC7D,SAASG,8BACPC,SAAoB,EACpBC,QAAkB;IAElB,IAAMC,SAASN,WAAW,CAACK,SAAS;IACpC,IAAIC,QAAQ;QACV,IAAIA,OAAOC,KAAK,EAAE;YAChB,MAAMD,OAAOC,KAAK;QACpB;QACA,OAAOD;IACT;IAEA,OAAOE,kBAAkBH,UAAUI,WAAWC,OAAO,EAAEN;AACzD;AAEA;;CAEC,GACD,sBAAsB;AACtB,aAAa;AACb,6DAA6D;AAC7D,IAAMO,mCAEF,SAACC,IAAIC;IACP,IAAMP,SAASN,WAAW,CAACY,GAAG;IAE9B,IAAIN,QAAQ;QACV,IAAIA,OAAOC,KAAK,EAAE;YAChB,MAAMD,OAAOC,KAAK;QACpB;QACA,OAAOD;IACT;IAEA,OAAOE,kBAAkBI,IAAIH,WAAWK,MAAM,EAAED,aAAaD,EAAE;AACjE;AAEA,SAASJ,kBACPI,EAAY,EACZG,UAAsB,EACtBC,UAAsB;IAEtB,IAAMC,gBAAgBC,gBAAgBC,GAAG,CAACP;IAC1C,IAAI,OAAOK,kBAAkB,YAAY;QACvC,sEAAsE;QACtE,0EAA0E;QAC1E,mDAAmD;QACnD,MAAM,IAAIG,MAAMC,2BAA2BT,IAAIG,YAAYC;IAC7D;IAEA,IAAMV,SAAiBgB,mBAAmBV;IAC1C,IAAMW,UAAUjB,OAAOiB,OAAO;IAE9BvB,WAAW,CAACY,GAAG,GAAGN;IAElB,4EAA4E;IAC5E,IAAMkB,UAAU,IAAKC,QACnBnB,QACAiB;IAEF,IAAI;QACFN,cAAcO,SAASlB,QAAQiB;IACjC,EAAE,OAAOhB,OAAO;QACdD,OAAOC,KAAK,GAAGA;QACf,MAAMA;IACR;IAEA,IAAID,OAAOoB,eAAe,IAAIpB,OAAOiB,OAAO,KAAKjB,OAAOoB,eAAe,EAAE;QACvE,yDAAyD;QACzDC,WAAWrB,OAAOiB,OAAO,EAAEjB,OAAOoB,eAAe;IACnD;IAEA,OAAOpB;AACT;AAEA,6DAA6D;AAC7D,SAASsB,cAAcC,YAA+B;IACpD,IAAMzB,YAAY0B,kBAAkBD,YAAY,CAAC,EAAE;IACnD,IAAIE;IACJ,8GAA8G;IAC9G,IAAIF,aAAaG,MAAM,KAAK,GAAG;QAC7BD,gBAAgBF,YAAY,CAAC,EAAE;IACjC,OAAO;QACLE,gBAAgBE;QAChBC,iCACEL,cACA,WAAW,GAAG,GACdX;IAEJ;IAEA,OAAOiB,QAAQP,aAAa,CAACxB,WAAW2B;AAC1C","ignoreList":[0]}}, + {"offset": {"line": 1313, "column": 0}, "map": {"version":3,"sources":["turbopack:///[turbopack]/browser/runtime/dom/runtime-backend-dom.ts"],"sourcesContent":["/**\n * This file contains the runtime code specific to the Turbopack ECMAScript DOM runtime.\n *\n * It will be appended to the base runtime code.\n */\n\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\n/// \n/// \n\nfunction getChunkSuffixFromScriptSrc() {\n // TURBOPACK_CHUNK_SUFFIX is set in web workers\n return (\n (self.TURBOPACK_CHUNK_SUFFIX ??\n document?.currentScript\n ?.getAttribute?.('src')\n ?.replace(/^(.*(?=\\?)|^.*$)/, '')) ||\n ''\n )\n}\n\ntype ChunkResolver = {\n resolved: boolean\n loadingStarted: boolean\n resolve: () => void\n reject: (error?: Error) => void\n promise: Promise\n}\n\nlet BACKEND: RuntimeBackend\n\n/**\n * Maps chunk paths to the corresponding resolver.\n */\nconst chunkResolvers: Map = new Map()\n\n;(() => {\n BACKEND = {\n async registerChunk(chunkPath, params) {\n const chunkUrl = getChunkRelativeUrl(chunkPath)\n\n const resolver = getOrCreateResolver(chunkUrl)\n resolver.resolve()\n\n if (params == null) {\n return\n }\n\n for (const otherChunkData of params.otherChunks) {\n const otherChunkPath = getChunkPath(otherChunkData)\n const otherChunkUrl = getChunkRelativeUrl(otherChunkPath)\n\n // Chunk might have started loading, so we want to avoid triggering another load.\n getOrCreateResolver(otherChunkUrl)\n }\n\n // This waits for chunks to be loaded, but also marks included items as available.\n await Promise.all(\n params.otherChunks.map((otherChunkData) =>\n loadInitialChunk(chunkPath, otherChunkData)\n )\n )\n\n if (params.runtimeModuleIds.length > 0) {\n for (const moduleId of params.runtimeModuleIds) {\n getOrInstantiateRuntimeModule(chunkPath, moduleId)\n }\n }\n },\n\n /**\n * Loads the given chunk, and returns a promise that resolves once the chunk\n * has been loaded.\n */\n loadChunkCached(sourceType: SourceType, chunkUrl: ChunkUrl) {\n return doLoadChunk(sourceType, chunkUrl)\n },\n\n async loadWebAssembly(\n _sourceType: SourceType,\n _sourceData: SourceData,\n wasmChunkPath: ChunkPath,\n _edgeModule: () => WebAssembly.Module,\n importsObj: WebAssembly.Imports\n ): Promise {\n const req = fetchWebAssembly(wasmChunkPath)\n\n const { instance } = await WebAssembly.instantiateStreaming(\n req,\n importsObj\n )\n\n return instance.exports\n },\n\n async loadWebAssemblyModule(\n _sourceType: SourceType,\n _sourceData: SourceData,\n wasmChunkPath: ChunkPath,\n _edgeModule: () => WebAssembly.Module\n ): Promise {\n const req = fetchWebAssembly(wasmChunkPath)\n\n return await WebAssembly.compileStreaming(req)\n },\n }\n\n function getOrCreateResolver(chunkUrl: ChunkUrl): ChunkResolver {\n let resolver = chunkResolvers.get(chunkUrl)\n if (!resolver) {\n let resolve: () => void\n let reject: (error?: Error) => void\n const promise = new Promise((innerResolve, innerReject) => {\n resolve = innerResolve\n reject = innerReject\n })\n resolver = {\n resolved: false,\n loadingStarted: false,\n promise,\n resolve: () => {\n resolver!.resolved = true\n resolve()\n },\n reject: reject!,\n }\n chunkResolvers.set(chunkUrl, resolver)\n }\n return resolver\n }\n\n /**\n * Loads the given chunk, and returns a promise that resolves once the chunk\n * has been loaded.\n */\n function doLoadChunk(sourceType: SourceType, chunkUrl: ChunkUrl) {\n const resolver = getOrCreateResolver(chunkUrl)\n if (resolver.loadingStarted) {\n return resolver.promise\n }\n\n if (sourceType === SourceType.Runtime) {\n // We don't need to load chunks references from runtime code, as they're already\n // present in the DOM.\n resolver.loadingStarted = true\n\n if (isCss(chunkUrl)) {\n // CSS chunks do not register themselves, and as such must be marked as\n // loaded instantly.\n resolver.resolve()\n }\n\n // We need to wait for JS chunks to register themselves within `registerChunk`\n // before we can start instantiating runtime modules, hence the absence of\n // `resolver.resolve()` in this branch.\n\n return resolver.promise\n }\n\n if (typeof importScripts === 'function') {\n // We're in a web worker\n if (isCss(chunkUrl)) {\n // ignore\n } else if (isJs(chunkUrl)) {\n self.TURBOPACK_NEXT_CHUNK_URLS!.push(chunkUrl)\n importScripts(TURBOPACK_WORKER_LOCATION + chunkUrl)\n } else {\n throw new Error(\n `can't infer type of chunk from URL ${chunkUrl} in worker`\n )\n }\n } else {\n // TODO(PACK-2140): remove this once all filenames are guaranteed to be escaped.\n const decodedChunkUrl = decodeURI(chunkUrl)\n\n if (isCss(chunkUrl)) {\n const previousLinks = document.querySelectorAll(\n `link[rel=stylesheet][href=\"${chunkUrl}\"],link[rel=stylesheet][href^=\"${chunkUrl}?\"],link[rel=stylesheet][href=\"${decodedChunkUrl}\"],link[rel=stylesheet][href^=\"${decodedChunkUrl}?\"]`\n )\n if (previousLinks.length > 0) {\n // CSS chunks do not register themselves, and as such must be marked as\n // loaded instantly.\n resolver.resolve()\n } else {\n const link = document.createElement('link')\n link.rel = 'stylesheet'\n link.href = chunkUrl\n link.onerror = () => {\n resolver.reject()\n }\n link.onload = () => {\n // CSS chunks do not register themselves, and as such must be marked as\n // loaded instantly.\n resolver.resolve()\n }\n // Append to the `head` for webpack compatibility.\n document.head.appendChild(link)\n }\n } else if (isJs(chunkUrl)) {\n const previousScripts = document.querySelectorAll(\n `script[src=\"${chunkUrl}\"],script[src^=\"${chunkUrl}?\"],script[src=\"${decodedChunkUrl}\"],script[src^=\"${decodedChunkUrl}?\"]`\n )\n if (previousScripts.length > 0) {\n // There is this edge where the script already failed loading, but we\n // can't detect that. The Promise will never resolve in this case.\n for (const script of Array.from(previousScripts)) {\n script.addEventListener('error', () => {\n resolver.reject()\n })\n }\n } else {\n const script = document.createElement('script')\n script.src = chunkUrl\n // We'll only mark the chunk as loaded once the script has been executed,\n // which happens in `registerChunk`. Hence the absence of `resolve()` in\n // this branch.\n script.onerror = () => {\n resolver.reject()\n }\n // Append to the `head` for webpack compatibility.\n document.head.appendChild(script)\n }\n } else {\n throw new Error(`can't infer type of chunk from URL ${chunkUrl}`)\n }\n }\n\n resolver.loadingStarted = true\n return resolver.promise\n }\n\n function fetchWebAssembly(wasmChunkPath: ChunkPath) {\n return fetch(getChunkRelativeUrl(wasmChunkPath))\n }\n})()\n"],"names":["getChunkSuffixFromScriptSrc","_self_TURBOPACK_CHUNK_SUFFIX","_document_currentScript_getAttribute","TURBOPACK_CHUNK_SUFFIX","currentScript","getAttribute","replace","BACKEND","chunkResolvers","Map","registerChunk","chunkPath","params","chunkUrl","resolver","_iteratorError","otherChunkData","otherChunkPath","otherChunkUrl","_iteratorError1","moduleId","getChunkRelativeUrl","getOrCreateResolver","resolve","otherChunks","getChunkPath","Promise","all","map","loadInitialChunk","runtimeModuleIds","length","getOrInstantiateRuntimeModule","loadChunkCached","sourceType","doLoadChunk","loadWebAssembly","_sourceType","_sourceData","wasmChunkPath","_edgeModule","importsObj","req","instance","fetchWebAssembly","WebAssembly","instantiateStreaming","exports","loadWebAssemblyModule","compileStreaming","get","reject","promise","innerResolve","innerReject","resolved","loadingStarted","set","SourceType","Runtime","isCss","importScripts","isJs","self","TURBOPACK_NEXT_CHUNK_URLS","push","TURBOPACK_WORKER_LOCATION","Error","decodedChunkUrl","decodeURI","previousLinks","document","querySelectorAll","link","createElement","rel","href","onerror","onload","head","appendChild","previousScripts","Array","from","script","addEventListener","script1","src","fetch"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;CAIC,GAED,oDAAoD,GAEpD,sEAAsE;AACtE,2DAA2D;AAE3D,SAASA;QAGJC;QACCC,sCAAAA,uCAAAA,yBAAAA;IAHJ,+CAA+C;IAC/C,OACE,CAAA,CAACD,+BAAAA,KAAKE,sBAAsB,AAGS,cAHpCF,0CAAAA,gCACCC,YAAAA,sBAAAA,iCAAAA,0BAAAA,UAAUE,aAAa,cAAvBF,+CAAAA,wCAAAA,wBACIG,YAAY,cADhBH,6DAAAA,uCAAAA,2CAAAA,yBACmB,oBADnBA,2DAAAA,qCAEII,OAAO,CAAC,oBAAoB,QAClC;AAEJ;AAUA,IAAIC;AAEJ;;CAEC,GACD,IAAMC,iBAA+C,IAAIC;AAExD,CAAC;IACAF,UAAU;QACFG,eAAN,SAAMA,cAAcC,SAAS,EAAEC,MAAM;;oBAC7BC,UAEAC,UAODC,2BAAAA,mBAAAA,gBAAAA,WAAAA,OAAMC,gBACHC,gBACAC,eAcDC,4BAAAA,oBAAAA,iBAAAA,YAAAA,QAAMC;;;;4BAzBPP,WAAWQ,oBAAoBV;4BAE/BG,WAAWQ,oBAAoBT;4BACrCC,SAASS,OAAO;4BAEhB,IAAIX,UAAU,MAAM;gCAClB;;;4BACF;4BAEKG,kCAAAA,2BAAAA;;gCAAL,IAAKA,YAAwBH,OAAOY,WAAW,uBAA1CT,6B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BACA,kDAAkD;oBAClDoB,SAASQ,IAAI,CAACC,WAAW,CAACM;gBAC5B;YACF,OAAO;gBACL,MAAM,IAAInB,MAAM,CAAC,mCAAmC,EAAEtD,UAAU;YAClE;QACF;QAEAC,SAAS0C,cAAc,GAAG;QAC1B,OAAO1C,SAASsC,OAAO;IACzB;IAEA,SAASR,iBAAiBL,aAAwB;QAChD,OAAOiD,MAAMnE,oBAAoBkB;IACnC;AACF,CAAC","ignoreList":[0]}}] } \ No newline at end of file From eb14325ed44c70671ac4d36c2fe2cb9cef67ca34 Mon Sep 17 00:00:00 2001 From: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com> Date: Tue, 20 Jan 2026 16:11:24 +0100 Subject: [PATCH 5/7] Turbopack: remove deployment id suffix from client reference manifest chunks (#88741) Closes PACK-6539 When `experimental.runtimeServerDeploymentId` is enabled, read the `process.env.NEXT_DEPLOYMENT_ID` and append to the chunks when evaluating the `client-reference-manifest.js` Originally, I tried to do it after the manifest is loaded (in `loadComponents` or in the `RouteModule.prepare`) to "hydrate" the manifest, but that is too late because the manifest needs to be initialized immediately to make module-evaluation-time server actions work (which need the manifest immediately) --- crates/next-core/src/next_config.rs | 11 +++++ .../client_reference_manifest.rs | 36 ++++++++++---- packages/next/src/build/templates/edge-ssr.ts | 2 - .../webpack/plugins/flight-manifest-plugin.ts | 2 +- packages/next/src/server/load-components.ts | 2 +- .../next/src/server/load-manifest.external.ts | 4 +- .../client-reference-chunking.test.ts | 21 ++------- test/e2e/app-dir/rsc-basic/rsc-basic.test.ts | 24 +++++----- test/lib/next-test-utils.ts | 40 ++++++++++++++++ .../client-actions-tree-shaking.test.ts | 39 +++++---------- .../route-handler-manifest-size.test.ts | 47 ++++--------------- .../deployment-id-handling/app/next.config.js | 1 + .../deployment-id-handling.test.ts | 13 +++-- 13 files changed, 131 insertions(+), 111 deletions(-) diff --git a/crates/next-core/src/next_config.rs b/crates/next-core/src/next_config.rs index d9ef99cc329dfc..b9f3f83fe445f4 100644 --- a/crates/next-core/src/next_config.rs +++ b/crates/next-core/src/next_config.rs @@ -968,6 +968,8 @@ pub struct ExperimentalConfig { cache_components: Option, use_cache: Option, root_params: Option, + runtime_server_deployment_id: Option, + // --- // UNSUPPORTED // --- @@ -1815,6 +1817,15 @@ impl NextConfig { ) } + #[turbo_tasks::function] + pub fn runtime_server_deployment_id_available(&self) -> Vc { + Vc::cell( + self.experimental + .runtime_server_deployment_id + .unwrap_or(false), + ) + } + #[turbo_tasks::function] pub fn cache_kinds(&self) -> Vc { let mut cache_kinds = CacheKinds::default(); diff --git a/crates/next-core/src/next_manifests/client_reference_manifest.rs b/crates/next-core/src/next_manifests/client_reference_manifest.rs index 788107743b0866..6ab0e36bb815e9 100644 --- a/crates/next-core/src/next_manifests/client_reference_manifest.rs +++ b/crates/next-core/src/next_manifests/client_reference_manifest.rs @@ -167,12 +167,15 @@ async fn build_manifest( async move { let mut entry_manifest: SerializedClientReferenceManifest = Default::default(); let mut references = FxIndexSet::default(); - let chunk_suffix_path = next_config.chunk_suffix_path().owned().await?; let prefix_path = next_config.computed_asset_prefix().owned().await?; - let suffix_path = chunk_suffix_path.unwrap_or_default(); - - // TODO: Add `suffix` to the manifest for React to use. - // entry_manifest.module_loading.prefix = prefix_path; + let runtime_server_deployment_id_available = + *next_config.runtime_server_deployment_id_available().await?; + let suffix_path = if !runtime_server_deployment_id_available { + let chunk_suffix_path = next_config.chunk_suffix_path().owned().await?; + chunk_suffix_path.unwrap_or_default() + } else { + rcstr!("") + }; entry_manifest.module_loading.cross_origin = next_config.cross_origin().owned().await?; let ClientReferencesChunks { @@ -469,15 +472,28 @@ async fn build_manifest( FileContent::Content(File::from(formatdoc! { r#" globalThis.__RSC_MANIFEST = globalThis.__RSC_MANIFEST || {{}}; - globalThis.__RSC_MANIFEST[{entry_name}] = {manifest} + globalThis.__RSC_MANIFEST[{entry_name}] = {manifest}; + {suffix} "#, entry_name = StringifyJs(&normalized_manifest_entry), - manifest = &client_reference_manifest_json + manifest = &client_reference_manifest_json, + suffix = if runtime_server_deployment_id_available { + formatdoc!{ + r#" + for (const key in globalThis.__RSC_MANIFEST[{entry_name}].clientModules) {{ + const val = {{ ...globalThis.__RSC_MANIFEST[{entry_name}].clientModules[key] }} + globalThis.__RSC_MANIFEST[{entry_name}].clientModules[key] = val + val.chunks = val.chunks.map((c) => `${{c}}?dpl=${{process.env.NEXT_DEPLOYMENT_ID}}`) + }} + "#, + entry_name = StringifyJs(&normalized_manifest_entry), + } + } else { + "".to_string() + } })) .cell(), - ) - .to_resolved() - .await?, + ).to_resolved().await?, references: ResolvedVc::cell(references.into_iter().collect()), } .cell()) diff --git a/packages/next/src/build/templates/edge-ssr.ts b/packages/next/src/build/templates/edge-ssr.ts index de73a03c0df656..9677d6c9453aec 100644 --- a/packages/next/src/build/templates/edge-ssr.ts +++ b/packages/next/src/build/templates/edge-ssr.ts @@ -114,7 +114,6 @@ async function requestHandler( buildManifest, prerenderManifest, reactLoadableManifest, - clientReferenceManifest, subresourceIntegrityManifest, dynamicCssManifest, } = prepareResult @@ -168,7 +167,6 @@ async function requestHandler( buildManifest, subresourceIntegrityManifest, reactLoadableManifest, - clientReferenceManifest, dynamicCssManifest, }, } diff --git a/packages/next/src/build/webpack/plugins/flight-manifest-plugin.ts b/packages/next/src/build/webpack/plugins/flight-manifest-plugin.ts index 3dee6cccc8ce2f..d3316b81d361ea 100644 --- a/packages/next/src/build/webpack/plugins/flight-manifest-plugin.ts +++ b/packages/next/src/build/webpack/plugins/flight-manifest-plugin.ts @@ -610,7 +610,7 @@ export class ClientReferenceManifestPlugin { new sources.RawSource( `globalThis.__RSC_MANIFEST=(globalThis.__RSC_MANIFEST||{});globalThis.__RSC_MANIFEST[${JSON.stringify( pagePath.slice('app'.length) - )}]=${json}` + )}]=${json};` ) as unknown as webpack.sources.RawSource ) } diff --git a/packages/next/src/server/load-components.ts b/packages/next/src/server/load-components.ts index 093c6d67eb11c2..11555f0dfdfc9b 100644 --- a/packages/next/src/server/load-components.ts +++ b/packages/next/src/server/load-components.ts @@ -146,7 +146,7 @@ async function tryLoadClientReferenceManifest( manifestPath: string, entryName: string, attempts?: number -) { +): Promise | undefined> { try { const context = await evalManifestWithRetries<{ __RSC_MANIFEST: { [key: string]: ClientReferenceManifest } diff --git a/packages/next/src/server/load-manifest.external.ts b/packages/next/src/server/load-manifest.external.ts index 254808e07952d3..1bc6878cacb2ca 100644 --- a/packages/next/src/server/load-manifest.external.ts +++ b/packages/next/src/server/load-manifest.external.ts @@ -92,7 +92,9 @@ export function evalManifest( throw new Error('Manifest file is empty') } - let contextObject = {} + let contextObject = { + process: { env: { NEXT_DEPLOYMENT_ID: process.env.NEXT_DEPLOYMENT_ID } }, + } runInNewContext(content, contextObject) // Freeze the context object so it cannot be modified if we're caching it. diff --git a/test/e2e/app-dir/client-reference-chunking/client-reference-chunking.test.ts b/test/e2e/app-dir/client-reference-chunking/client-reference-chunking.test.ts index 610810173b9d19..ef701cb2cc222e 100644 --- a/test/e2e/app-dir/client-reference-chunking/client-reference-chunking.test.ts +++ b/test/e2e/app-dir/client-reference-chunking/client-reference-chunking.test.ts @@ -1,18 +1,5 @@ -import { type NextInstance, nextTestSetup } from 'e2e-utils' -import { type ClientReferenceManifest } from 'next/dist/build/webpack/plugins/flight-manifest-plugin' - -async function loadClientReferenceManifest( - next: NextInstance, - page: string -): Promise { - return JSON.parse( - ( - await next.readFile( - `${next.distDir}/server/app${page}page_client-reference-manifest.js` - ) - ).match(/]\s*=\s*([\S\s]+)$/)[1] - ) -} +import { nextTestSetup } from 'e2e-utils' +import { getClientReferenceManifest } from 'next-test-utils' describe('client-reference-chunking', () => { const { next } = nextTestSetup({ @@ -28,8 +15,8 @@ describe('client-reference-chunking', () => { 'Welcome to the Issue Page' ) - let rootManifest = await loadClientReferenceManifest(next, '/') - let issueManifest = await loadClientReferenceManifest(next, '/issue/') + let rootManifest = getClientReferenceManifest(next, '/page') + let issueManifest = getClientReferenceManifest(next, '/issue/page') // These two routes have the same client component references, so these should be exactly the // same (especially the `chunks` field) diff --git a/test/e2e/app-dir/rsc-basic/rsc-basic.test.ts b/test/e2e/app-dir/rsc-basic/rsc-basic.test.ts index f054473424beef..c3a17670a79836 100644 --- a/test/e2e/app-dir/rsc-basic/rsc-basic.test.ts +++ b/test/e2e/app-dir/rsc-basic/rsc-basic.test.ts @@ -1,5 +1,10 @@ import path from 'path' -import { check, getDistDir } from 'next-test-utils' +import { + check, + getClientReferenceManifest, + getDistDir, + retry, +} from 'next-test-utils' import { nextTestSetup } from 'e2e-utils' import cheerio from 'cheerio' import { @@ -37,25 +42,20 @@ describe('app dir - rsc basics', () => { if (isNextDev && !isTurbopack) { it('should have correct client references keys in manifest', async () => { await next.render('/') - await check(async () => { + await retry(() => { // Check that the client-side manifest is correct before any requests - const clientReferenceManifest = JSON.parse( - ( - await next.readFile( - `${getDistDir()}/server/app/page_client-reference-manifest.js` - ) - ).match(/]=(.+)$/)[1] + const clientReferenceManifest = getClientReferenceManifest( + next, + '/page' ) const clientModulesNames = Object.keys( clientReferenceManifest.clientModules ) - clientModulesNames.every((name) => { + expect(clientModulesNames).toSatisfyAll((name) => { const [, key] = name.split('#', 2) return key === undefined || key === '' || key === 'default' }) - - return 'success' - }, 'success') + }) }) } diff --git a/test/lib/next-test-utils.ts b/test/lib/next-test-utils.ts index 47617dab304b84..cf8da6d34bcaea 100644 --- a/test/lib/next-test-utils.ts +++ b/test/lib/next-test-utils.ts @@ -35,6 +35,8 @@ import escapeRegex from 'escape-string-regexp' // TODO: Create dedicated Jest environment that sets up these matchers // Edge Runtime unit tests fail with "EvalError: Code generation from strings disallowed for this context" if these matchers are imported in those tests. import './add-redbox-matchers' +import { NextInstance } from 'e2e-utils' +import { ClientReferenceManifest } from 'next/dist/build/webpack/plugins/flight-manifest-plugin' export { shouldUseTurbopack } @@ -1921,3 +1923,41 @@ export function getDistDir(): '.next' | '.next/dev' { ? '.next/dev' : '.next' } + +/** + * Loads and returns the client reference manifest for a given route + */ +export function getClientReferenceManifest( + next: NextInstance, + route: string +): ClientReferenceManifest { + const manifestPath = path.join( + next.testDir, + next.distDir, + `server/app${route}_client-reference-manifest.js` + ) + const modulePath = require.resolve(manifestPath) + + // Clear global + delete (globalThis as any).__RSC_MANIFEST + + // Need to use jest.isolateModules because Jest messes with require.cache and `delete + // require.cache[modulePath]` doesn't actually work anymore + jest.isolateModules(() => { + // Load the manifest (it sets globalThis.__RSC_MANIFEST) + require(modulePath) + }) + + const manifest = (globalThis as any).__RSC_MANIFEST[ + route + ] as ClientReferenceManifest + + // Sanity check + expect( + manifest.clientModules || + manifest.ssrModuleMapping || + manifest.rscModuleMapping + ).toBeDefined() + + return manifest +} diff --git a/test/production/app-dir/actions-tree-shaking/client-actions-tree-shaking/client-actions-tree-shaking.test.ts b/test/production/app-dir/actions-tree-shaking/client-actions-tree-shaking/client-actions-tree-shaking.test.ts index 72e21cf8484470..21b2f48ed4b73d 100644 --- a/test/production/app-dir/actions-tree-shaking/client-actions-tree-shaking/client-actions-tree-shaking.test.ts +++ b/test/production/app-dir/actions-tree-shaking/client-actions-tree-shaking/client-actions-tree-shaking.test.ts @@ -1,8 +1,6 @@ -import { promises as fs } from 'fs' import { join } from 'path' import { nextTestSetup } from 'e2e-utils' -import { retry } from 'next-test-utils' -import { ClientReferenceManifest } from 'next/dist/build/webpack/plugins/flight-manifest-plugin' +import { getClientReferenceManifest, retry } from 'next-test-utils' function getServerReferenceIdsFromBundle(source: string): string[] { // Reference IDs are strings with [0-9a-f] that are at least 32 characters long. @@ -33,29 +31,20 @@ describe('app-dir - client-actions-tree-shaking', () => { /** * Parses the client reference manifest for a given route and returns the client chunks */ - function getClientChunks(appDir: string, route: string): Array { - const modulePath = require.resolve( - join(appDir, `.next/server/app/${route}_client-reference-manifest.js`) - ) - require(modulePath) - const clientManfiest = globalThis.__RSC_MANIFEST[ - route - ] as ClientReferenceManifest - delete globalThis.__RSC_MANIFEST[route] - delete require.cache[modulePath] + function getClientChunks(route: string): Array { + const clientManifest = getClientReferenceManifest(next, route) const chunks = new Set() - if (process.env.IS_TURBOPACK_TEST) { // These only exist for turbopack and are encoded as files - // entryJSFiles is a map of moduel name to a set of chunks relative to `.next` - for (const entries of Object.values(clientManfiest.entryJSFiles)) { + // entryJSFiles is a map of module name to a set of chunks relative to `.next` + for (const entries of Object.values(clientManifest.entryJSFiles)) { for (const chunk of entries) { chunks.add(chunk) } } // client mmodules is a mapping from module name to a set of chunks releative to `/_next/` // So strip that prefix and add it to the chunks - for (const clientModule of Object.values(clientManfiest.clientModules)) { + for (const clientModule of Object.values(clientManifest.clientModules)) { for (const chunk of clientModule.chunks) { chunks.add(chunk.replace('/_next/', '')) } @@ -63,7 +52,7 @@ describe('app-dir - client-actions-tree-shaking', () => { } else { // webpack doens't use entryJSFiles, so we need to use clientModules but the format is different. // chunks is a sequence of 'chunk-id', chunk-path pairs, so we need to skip the chunk-id - for (const clientModule of Object.values(clientManfiest.clientModules)) { + for (const clientModule of Object.values(clientManifest.clientModules)) { for (let i = 1; i < clientModule.chunks.length; i += 2) { chunks.add(clientModule.chunks[i]) } @@ -73,25 +62,23 @@ describe('app-dir - client-actions-tree-shaking', () => { } it('should not bundle unused server reference id in client bundles', async () => { - const appDir = next.testDir - - const bundle1Files = getClientChunks(appDir, '/route-1/page') - const bundle2Files = getClientChunks(appDir, '/route-2/page') - const bundle3Files = getClientChunks(appDir, '/route-3/page') + const bundle1Files = getClientChunks('/route-1/page') + const bundle2Files = getClientChunks('/route-2/page') + const bundle3Files = getClientChunks('/route-3/page') const bundle1Contents = await Promise.all( bundle1Files.map((file: string) => - fs.readFile(join(appDir, '.next', file), 'utf8') + next.readFile(join(next.distDir, file)) ) ) const bundle2Contents = await Promise.all( bundle2Files.map((file: string) => - fs.readFile(join(appDir, '.next', file), 'utf8') + next.readFile(join(next.distDir, file)) ) ) const bundle3Contents = await Promise.all( bundle3Files.map((file: string) => - fs.readFile(join(appDir, '.next', file), 'utf8') + next.readFile(join(next.distDir, file)) ) ) diff --git a/test/production/app-dir/route-handler-manifest-size/route-handler-manifest-size.test.ts b/test/production/app-dir/route-handler-manifest-size/route-handler-manifest-size.test.ts index 693aeb388388e6..9dd312179eebb0 100644 --- a/test/production/app-dir/route-handler-manifest-size/route-handler-manifest-size.test.ts +++ b/test/production/app-dir/route-handler-manifest-size/route-handler-manifest-size.test.ts @@ -1,5 +1,5 @@ -import { join } from 'path' import { nextTestSetup } from 'e2e-utils' +import { getClientReferenceManifest } from 'next-test-utils' import type { ClientReferenceManifest } from 'next/dist/build/webpack/plugins/flight-manifest-plugin' describe('route-handler-manifest-size', () => { @@ -11,38 +11,6 @@ describe('route-handler-manifest-size', () => { if (skipped) return - /** - * Loads and returns the client reference manifest for a given route - */ - function getClientReferenceManifest(route: string): ClientReferenceManifest { - const appDir = next.testDir - const manifestPath = join( - appDir, - `.next/server/app${route}_client-reference-manifest.js` - ) - const modulePath = require.resolve(manifestPath) - - // Clear any cached version - delete require.cache[modulePath] - - // Initialize global if needed - if (!(globalThis as any).__RSC_MANIFEST) { - ;(globalThis as any).__RSC_MANIFEST = {} - } - - // Load the manifest (it sets globalThis.__RSC_MANIFEST) - require(modulePath) - - const manifest = (globalThis as any).__RSC_MANIFEST[ - route - ] as ClientReferenceManifest - - // Clean up require cache but keep manifest for potential re-reads - delete require.cache[modulePath] - - return manifest - } - /** * Gets the module paths from clientModules */ @@ -52,7 +20,7 @@ describe('route-handler-manifest-size', () => { if (isNextStart) { it('should not include page client components in pure route handler manifest', () => { - const manifest = getClientReferenceManifest('/api/hello/route') + const manifest = getClientReferenceManifest(next, '/api/hello/route') const modulePaths = getClientModulePaths(manifest) // The pure route handler should NOT contain client components from the page @@ -66,7 +34,7 @@ describe('route-handler-manifest-size', () => { }) it('should include page client components in page manifest', () => { - const manifest = getClientReferenceManifest('/page') + const manifest = getClientReferenceManifest(next, '/page') const modulePaths = getClientModulePaths(manifest) // The page should contain its client components @@ -80,8 +48,8 @@ describe('route-handler-manifest-size', () => { }) it('should have significantly smaller manifest for pure route handler compared to page', () => { - const routeManifest = getClientReferenceManifest('/api/hello/route') - const pageManifest = getClientReferenceManifest('/page') + const routeManifest = getClientReferenceManifest(next, '/api/hello/route') + const pageManifest = getClientReferenceManifest(next, '/page') const routeModuleCount = Object.keys(routeManifest.clientModules).length const pageModuleCount = Object.keys(pageManifest.clientModules).length @@ -92,7 +60,10 @@ describe('route-handler-manifest-size', () => { }) it('should not include page components in route handler that imports client module', () => { - const manifest = getClientReferenceManifest('/api-with-client/route') + const manifest = getClientReferenceManifest( + next, + '/api-with-client/route' + ) const modulePaths = getClientModulePaths(manifest) // Route handler should NOT have unrelated client components from the page diff --git a/test/production/deployment-id-handling/app/next.config.js b/test/production/deployment-id-handling/app/next.config.js index b4839c0d3f9627..847dc115c5399b 100644 --- a/test/production/deployment-id-handling/app/next.config.js +++ b/test/production/deployment-id-handling/app/next.config.js @@ -3,5 +3,6 @@ module.exports = { deploymentId: process.env.CUSTOM_DEPLOYMENT_ID, experimental: { useSkewCookie: Boolean(process.env.COOKIE_SKEW), + runtimeServerDeploymentId: !!process.env.RUNTIME_SERVER_DEPLOYMENT_ID, }, } diff --git a/test/production/deployment-id-handling/deployment-id-handling.test.ts b/test/production/deployment-id-handling/deployment-id-handling.test.ts index 7388b6c9764f71..b6bb507f3148b9 100644 --- a/test/production/deployment-id-handling/deployment-id-handling.test.ts +++ b/test/production/deployment-id-handling/deployment-id-handling.test.ts @@ -2,14 +2,21 @@ import { nextTestSetup } from 'e2e-utils' import { retry } from 'next-test-utils' import { join } from 'node:path' -describe.each(['NEXT_DEPLOYMENT_ID', 'CUSTOM_DEPLOYMENT_ID'])( - 'deployment-id-handling enabled with %s', - (envKey) => { +describe.each([ + ['NEXT_DEPLOYMENT_ID', ''], + ['CUSTOM_DEPLOYMENT_ID', ''], + ['NEXT_DEPLOYMENT_ID', ' and runtimeServerDeploymentId'], +])( + 'deployment-id-handling enabled with %s%s', + (envKey, runtimeServerDeploymentId) => { const deploymentId = Date.now() + '' const { next } = nextTestSetup({ files: join(__dirname, 'app'), env: { [envKey]: deploymentId, + RUNTIME_SERVER_DEPLOYMENT_ID: runtimeServerDeploymentId + ? '1' + : undefined, }, }) From 03a1815a533c849cccf25836a45e5e52dbe18467 Mon Sep 17 00:00:00 2001 From: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com> Date: Tue, 20 Jan 2026 17:13:43 +0100 Subject: [PATCH 6/7] Inject `` and don't inline it into JS anymore (#88761) We don't inline `process.env.NEXT_DEPLOYMENT_ID` anymore into browser chunks, and instead read it from ` --- packages/next/src/build/define-env.ts | 4 +- packages/next/src/pages/_document.tsx | 17 +- .../next/src/server/app-render/app-render.tsx | 11 ++ packages/next/src/server/render.tsx | 1 + .../stream-utils/node-web-streams-helper.ts | 184 +++++++++++------- packages/next/src/shared/lib/deployment-id.ts | 21 +- .../shared/lib/html-context.shared-runtime.ts | 1 + 7 files changed, 158 insertions(+), 81 deletions(-) diff --git a/packages/next/src/build/define-env.ts b/packages/next/src/build/define-env.ts index a7c5be7d90c724..40e3f656feeb0c 100644 --- a/packages/next/src/build/define-env.ts +++ b/packages/next/src/build/define-env.ts @@ -177,12 +177,10 @@ export function getDefineEnv({ : isClient ? isTurbopack ? { + // This is set at runtime by packages/next/src/client/register-deployment-id-global.ts 'process.env.NEXT_DEPLOYMENT_ID': { [DEFINE_ENV_EXPRESSION]: 'globalThis.NEXT_DEPLOYMENT_ID', }, - // TODO replace with read from HTML document attribute - 'process.env.NEXT_DEPLOYMENT_ID_COMPILE_TIME': - config.deploymentId, } : { // For Webpack, we currently don't use the non-inlining globalThis.NEXT_DEPLOYMENT_ID diff --git a/packages/next/src/pages/_document.tsx b/packages/next/src/pages/_document.tsx index 2a7b5404aadbc7..a2e8b84cd9413f 100644 --- a/packages/next/src/pages/_document.tsx +++ b/packages/next/src/pages/_document.tsx @@ -928,13 +928,24 @@ export function Html( HTMLHtmlElement > ) { - const { docComponentsRendered, locale, scriptLoader, __NEXT_DATA__ } = - useHtmlContext() + const { + docComponentsRendered, + locale, + scriptLoader, + deploymentId, + __NEXT_DATA__, + } = useHtmlContext() docComponentsRendered.Html = true handleDocumentScriptLoaderItems(scriptLoader, __NEXT_DATA__, props) - return + return ( + + ) } export function Main() { diff --git a/packages/next/src/server/app-render/app-render.tsx b/packages/next/src/server/app-render/app-render.tsx index a32b4f6b986fc7..216e98d6292812 100644 --- a/packages/next/src/server/app-render/app-render.tsx +++ b/packages/next/src/server/app-render/app-render.tsx @@ -2884,6 +2884,7 @@ async function renderToStream( ), getServerInsertedHTML, getServerInsertedMetadata, + deploymentId: ctx.renderOpts.deploymentId, }) } } @@ -2961,6 +2962,7 @@ async function renderToStream( isStaticGeneration: generateStaticHTML, isBuildTimePrerendering: ctx.workStore.isBuildTimePrerendering === true, buildId: ctx.workStore.buildId, + deploymentId: ctx.renderOpts.deploymentId, getServerInsertedHTML, getServerInsertedMetadata, validateRootLayout: dev, @@ -3130,6 +3132,7 @@ async function renderToStream( isBuildTimePrerendering: ctx.workStore.isBuildTimePrerendering === true, buildId: ctx.workStore.buildId, + deploymentId: ctx.renderOpts.deploymentId, getServerInsertedHTML: makeGetServerInsertedHTML({ polyfills, renderServerInsertedHTML, @@ -4839,6 +4842,7 @@ async function prerenderToStream( stream: await continueDynamicPrerender(prelude, { getServerInsertedHTML, getServerInsertedMetadata, + deploymentId: ctx.renderOpts.deploymentId, }), dynamicAccess: consumeDynamicAccess( serverDynamicTracking, @@ -4934,6 +4938,7 @@ async function prerenderToStream( isBuildTimePrerendering: ctx.workStore.isBuildTimePrerendering === true, buildId: ctx.workStore.buildId, + deploymentId: ctx.renderOpts.deploymentId, }) } else { // Normal static prerender case, no fallback param handling needed @@ -4948,6 +4953,7 @@ async function prerenderToStream( isBuildTimePrerendering: ctx.workStore.isBuildTimePrerendering === true, buildId: ctx.workStore.buildId, + deploymentId: ctx.renderOpts.deploymentId, }) } @@ -5119,6 +5125,7 @@ async function prerenderToStream( stream: await continueDynamicPrerender(prelude, { getServerInsertedHTML, getServerInsertedMetadata, + deploymentId: ctx.renderOpts.deploymentId, }), dynamicAccess: dynamicTracking.dynamicAccesses, // TODO: Should this include the SSR pass? @@ -5140,6 +5147,7 @@ async function prerenderToStream( stream: await continueDynamicPrerender(prelude, { getServerInsertedHTML, getServerInsertedMetadata, + deploymentId: ctx.renderOpts.deploymentId, }), dynamicAccess: dynamicTracking.dynamicAccesses, // TODO: Should this include the SSR pass? @@ -5206,6 +5214,7 @@ async function prerenderToStream( isBuildTimePrerendering: ctx.workStore.isBuildTimePrerendering === true, buildId: ctx.workStore.buildId, + deploymentId: ctx.renderOpts.deploymentId, }), dynamicAccess: dynamicTracking.dynamicAccesses, // TODO: Should this include the SSR pass? @@ -5306,6 +5315,7 @@ async function prerenderToStream( buildId: ctx.workStore.buildId, getServerInsertedHTML, getServerInsertedMetadata, + deploymentId: ctx.renderOpts.deploymentId, }), // TODO: Should this include the SSR pass? collectedRevalidate: prerenderLegacyStore.revalidate, @@ -5491,6 +5501,7 @@ async function prerenderToStream( }), getServerInsertedMetadata, validateRootLayout: dev, + deploymentId: ctx.renderOpts.deploymentId, }), dynamicAccess: null, collectedRevalidate: diff --git a/packages/next/src/server/render.tsx b/packages/next/src/server/render.tsx index f867c3dc63bb84..c48635404742ab 100644 --- a/packages/next/src/server/render.tsx +++ b/packages/next/src/server/render.tsx @@ -1499,6 +1499,7 @@ export async function renderToHTMLImpl( docComponentsRendered, dangerousAsPath: router.asPath, isDevelopment: !!dev, + deploymentId: sharedContext.deploymentId, dynamicImports: Array.from(dynamicImports), dynamicCssManifest: new Set(renderOpts.dynamicCssManifest || []), assetPrefix, diff --git a/packages/next/src/server/stream-utils/node-web-streams-helper.ts b/packages/next/src/server/stream-utils/node-web-streams-helper.ts index 86fde7b2045c99..fabdef49956df2 100644 --- a/packages/next/src/server/stream-utils/node-web-streams-helper.ts +++ b/packages/next/src/server/stream-utils/node-web-streams-helper.ts @@ -725,6 +725,48 @@ function createStripDocumentClosingTagsTransform(): TransformStream< }) } +function createHtmlDataDplIdTransformStream( + dplId: string +): TransformStream { + let didTransform = false + + return new TransformStream({ + transform(chunk, controller) { + if (didTransform) { + controller.enqueue(chunk) + return + } + + const htmlTagIndex = indexOfUint8Array(chunk, ENCODED_TAGS.OPENING.HTML) + if (htmlTagIndex === -1) { + controller.enqueue(chunk) + return + } + + // Insert the data-dpl-id attribute right after " Promise getServerInsertedMetadata: () => Promise validateRootLayout?: boolean @@ -816,6 +859,7 @@ export async function continueFizzStream( isStaticGeneration, isBuildTimePrerendering, buildId, + deploymentId, getServerInsertedHTML, getServerInsertedMetadata, validateRootLayout, @@ -840,6 +884,9 @@ export async function continueFizzStream( // Add build id comment to start of the HTML document (in export mode) createPrefetchCommentStream(isBuildTimePrerendering, buildId), + // Insert data-dpl-id attribute on the html tag + deploymentId ? createHtmlDataDplIdTransformStream(deploymentId) : null, + // Transform metadata createMetadataTransformStream(getServerInsertedMetadata), @@ -869,6 +916,7 @@ export async function continueFizzStream( type ContinueDynamicPrerenderOptions = { getServerInsertedHTML: () => Promise getServerInsertedMetadata: () => Promise + deploymentId: string | undefined } export async function continueDynamicPrerender( @@ -876,18 +924,20 @@ export async function continueDynamicPrerender( { getServerInsertedHTML, getServerInsertedMetadata, + deploymentId, }: ContinueDynamicPrerenderOptions ) { - return ( - prerenderStream - // Buffer everything to avoid flushing too frequently - .pipeThrough(createBufferedTransformStream()) - .pipeThrough(createStripDocumentClosingTagsTransform()) - // Insert generated tags to head - .pipeThrough(createHeadInsertionTransformStream(getServerInsertedHTML)) - // Transform metadata - .pipeThrough(createMetadataTransformStream(getServerInsertedMetadata)) - ) + return chainTransformers(prerenderStream, [ + // Buffer everything to avoid flushing too frequently + createBufferedTransformStream(), + createStripDocumentClosingTagsTransform(), + // Insert data-dpl-id attribute on the html tag + deploymentId ? createHtmlDataDplIdTransformStream(deploymentId) : null, + // Insert generated tags to head + createHeadInsertionTransformStream(getServerInsertedHTML), + // Transform metadata + createMetadataTransformStream(getServerInsertedMetadata), + ]) } type ContinueStaticPrerenderOptions = { @@ -896,6 +946,7 @@ type ContinueStaticPrerenderOptions = { getServerInsertedMetadata: () => Promise isBuildTimePrerendering: boolean buildId: string + deploymentId: string | undefined } export async function continueStaticPrerender( @@ -906,27 +957,25 @@ export async function continueStaticPrerender( getServerInsertedMetadata, isBuildTimePrerendering, buildId, + deploymentId, }: ContinueStaticPrerenderOptions ) { - return ( - prerenderStream - // Buffer everything to avoid flushing too frequently - .pipeThrough(createBufferedTransformStream()) - // Add build id comment to start of the HTML document (in export mode) - .pipeThrough( - createPrefetchCommentStream(isBuildTimePrerendering, buildId) - ) - // Insert generated tags to head - .pipeThrough(createHeadInsertionTransformStream(getServerInsertedHTML)) - // Transform metadata - .pipeThrough(createMetadataTransformStream(getServerInsertedMetadata)) - // Insert the inlined data (Flight data, form state, etc.) stream into the HTML - .pipeThrough( - createFlightDataInjectionTransformStream(inlinedDataStream, true) - ) - // Close tags should always be deferred to the end - .pipeThrough(createMoveSuffixStream()) - ) + return chainTransformers(prerenderStream, [ + // Buffer everything to avoid flushing too frequently + createBufferedTransformStream(), + // Add build id comment to start of the HTML document (in export mode) + createPrefetchCommentStream(isBuildTimePrerendering, buildId), + // Insert data-dpl-id attribute on the html tag + deploymentId ? createHtmlDataDplIdTransformStream(deploymentId) : null, + // Insert generated tags to head + createHeadInsertionTransformStream(getServerInsertedHTML), + // Transform metadata + createMetadataTransformStream(getServerInsertedMetadata), + // Insert the inlined data (Flight data, form state, etc.) stream into the HTML + createFlightDataInjectionTransformStream(inlinedDataStream, true), + // Close tags should always be deferred to the end + createMoveSuffixStream(), + ]) } export async function continueStaticFallbackPrerender( @@ -937,32 +986,30 @@ export async function continueStaticFallbackPrerender( getServerInsertedMetadata, isBuildTimePrerendering, buildId, + deploymentId, }: ContinueStaticPrerenderOptions ) { // Same as `continueStaticPrerender`, but also inserts an additional script // to instruct the client to start fetching the hydration data as early // as possible. - return ( - prerenderStream - // Buffer everything to avoid flushing too frequently - .pipeThrough(createBufferedTransformStream()) - // Add build id comment to start of the HTML document (in export mode) - .pipeThrough( - createPrefetchCommentStream(isBuildTimePrerendering, buildId) - ) - // Insert generated tags to head - .pipeThrough(createHeadInsertionTransformStream(getServerInsertedHTML)) - // Insert the client resume script into the head - .pipeThrough(createClientResumeScriptInsertionTransformStream()) - // Transform metadata - .pipeThrough(createMetadataTransformStream(getServerInsertedMetadata)) - // Insert the inlined data (Flight data, form state, etc.) stream into the HTML - .pipeThrough( - createFlightDataInjectionTransformStream(inlinedDataStream, true) - ) - // Close tags should always be deferred to the end - .pipeThrough(createMoveSuffixStream()) - ) + return chainTransformers(prerenderStream, [ + // Buffer everything to avoid flushing too frequently + createBufferedTransformStream(), + // Add build id comment to start of the HTML document (in export mode) + createPrefetchCommentStream(isBuildTimePrerendering, buildId), + // Insert data-dpl-id attribute on the html tag + deploymentId ? createHtmlDataDplIdTransformStream(deploymentId) : null, + // Insert generated tags to head + createHeadInsertionTransformStream(getServerInsertedHTML), + // Insert the client resume script into the head + createClientResumeScriptInsertionTransformStream(), + // Transform metadata + createMetadataTransformStream(getServerInsertedMetadata), + // Insert the inlined data (Flight data, form state, etc.) stream into the HTML + createFlightDataInjectionTransformStream(inlinedDataStream, true), + // Close tags should always be deferred to the end + createMoveSuffixStream(), + ]) } type ContinueResumeOptions = { @@ -970,6 +1017,7 @@ type ContinueResumeOptions = { getServerInsertedHTML: () => Promise getServerInsertedMetadata: () => Promise delayDataUntilFirstHtmlChunk: boolean + deploymentId: string | undefined } export async function continueDynamicHTMLResume( @@ -979,26 +1027,26 @@ export async function continueDynamicHTMLResume( inlinedDataStream, getServerInsertedHTML, getServerInsertedMetadata, + deploymentId, }: ContinueResumeOptions ) { - return ( - renderStream - // Buffer everything to avoid flushing too frequently - .pipeThrough(createBufferedTransformStream()) - // Insert generated tags to head - .pipeThrough(createHeadInsertionTransformStream(getServerInsertedHTML)) - // Transform metadata - .pipeThrough(createMetadataTransformStream(getServerInsertedMetadata)) - // Insert the inlined data (Flight data, form state, etc.) stream into the HTML - .pipeThrough( - createFlightDataInjectionTransformStream( - inlinedDataStream, - delayDataUntilFirstHtmlChunk - ) - ) - // Close tags should always be deferred to the end - .pipeThrough(createMoveSuffixStream()) - ) + return chainTransformers(renderStream, [ + // Buffer everything to avoid flushing too frequently + createBufferedTransformStream(), + // Insert data-dpl-id attribute on the html tag + deploymentId ? createHtmlDataDplIdTransformStream(deploymentId) : null, + // Insert generated tags to head + createHeadInsertionTransformStream(getServerInsertedHTML), + // Transform metadata + createMetadataTransformStream(getServerInsertedMetadata), + // Insert the inlined data (Flight data, form state, etc.) stream into the HTML + createFlightDataInjectionTransformStream( + inlinedDataStream, + delayDataUntilFirstHtmlChunk + ), + // Close tags should always be deferred to the end + createMoveSuffixStream(), + ]) } export function createDocumentClosingStream(): ReadableStream { diff --git a/packages/next/src/shared/lib/deployment-id.ts b/packages/next/src/shared/lib/deployment-id.ts index 22abdb143baa5a..b3b4d126ab7019 100644 --- a/packages/next/src/shared/lib/deployment-id.ts +++ b/packages/next/src/shared/lib/deployment-id.ts @@ -1,14 +1,21 @@ -// This could also be a variable instead of a function, but some unit tests want to change the ID at -// runtime. Even though that would never happen in a real deployment. +let deploymentId: string | undefined + +if (typeof window !== 'undefined') { + deploymentId = document.documentElement.dataset.dplId + // Immediately remove the attribute to prevent hydration errors (the dplId was inserted into the + // HTML only), React isn't aware of it at all. + delete document.documentElement.dataset.dplId +} else { + // Client side: replaced with globalThis.NEXT_DEPLOYMENT_ID + // Server side: left as is or replaced with a string or replaced with false + deploymentId = process.env.NEXT_DEPLOYMENT_ID || undefined +} + export function getDeploymentId(): string | undefined { - return ( - process.env.NEXT_DEPLOYMENT_ID ?? - process.env.NEXT_DEPLOYMENT_ID_COMPILE_TIME - ) + return deploymentId } export function getDeploymentIdQueryOrEmptyString(): string { - let deploymentId = getDeploymentId() if (deploymentId) { return `?dpl=${deploymentId}` } diff --git a/packages/next/src/shared/lib/html-context.shared-runtime.ts b/packages/next/src/shared/lib/html-context.shared-runtime.ts index 4bed5a57beffcc..14553286162626 100644 --- a/packages/next/src/shared/lib/html-context.shared-runtime.ts +++ b/packages/next/src/shared/lib/html-context.shared-runtime.ts @@ -18,6 +18,7 @@ export type HtmlProps = { } buildManifest: BuildManifest isDevelopment: boolean + deploymentId: string | undefined dynamicImports: string[] /** * This manifest is only needed for Pages dir, Production, Webpack From 13b13ede48ed86906c45af058fbae62565674494 Mon Sep 17 00:00:00 2001 From: Jiachi Liu Date: Tue, 20 Jan 2026 17:26:03 +0100 Subject: [PATCH 7/7] [metadata] match the Metadata and ResolvedMetadata type (#88739) --- .../next/src/lib/metadata/resolve-metadata.ts | 12 ++ .../src/lib/metadata/types/extra-types.ts | 4 +- .../lib/metadata/types/metadata-interface.ts | 14 +-- .../src/lib/metadata/types/opengraph-types.ts | 2 +- .../src/lib/metadata/types/twitter-types.ts | 10 +- .../app/deprecated-other-fields/page.js | 10 ++ ...etadata-warnings-with-metadatabase.test.ts | 8 ++ .../metadata-spread-types/app/layout.tsx | 27 +++++ .../metadata-spread-types/app/page.tsx | 27 +++++ .../app/spread-all/page.tsx | 19 ++++ .../metadata-spread-types.test.ts | 46 ++++++++ .../metadata-spread-types/next.config.js | 2 + .../unit/metadata-types-compatibility.test.ts | 107 ++++++++++++++++++ 13 files changed, 272 insertions(+), 16 deletions(-) create mode 100644 test/e2e/app-dir/metadata-warnings/app/deprecated-other-fields/page.js create mode 100644 test/production/app-dir/metadata-spread-types/app/layout.tsx create mode 100644 test/production/app-dir/metadata-spread-types/app/page.tsx create mode 100644 test/production/app-dir/metadata-spread-types/app/spread-all/page.tsx create mode 100644 test/production/app-dir/metadata-spread-types/metadata-spread-types.test.ts create mode 100644 test/production/app-dir/metadata-spread-types/next.config.js create mode 100644 test/unit/metadata-types-compatibility.test.ts diff --git a/packages/next/src/lib/metadata/resolve-metadata.ts b/packages/next/src/lib/metadata/resolve-metadata.ts index a644ffcef2ddad..b0116dcb305430 100644 --- a/packages/next/src/lib/metadata/resolve-metadata.ts +++ b/packages/next/src/lib/metadata/resolve-metadata.ts @@ -387,6 +387,18 @@ async function mergeMetadata( newResolvedMetadata.other, metadata.other ) + if (metadata.other) { + if ('apple-touch-fullscreen' in metadata.other) { + buildState.warnings.add( + `Use appleWebApp instead\nRead more: https://nextjs.org/docs/app/api-reference/functions/generate-metadata` + ) + } + if ('apple-touch-icon-precomposed' in metadata.other) { + buildState.warnings.add( + `Use icons.apple instead\nRead more: https://nextjs.org/docs/app/api-reference/functions/generate-metadata` + ) + } + } break case 'metadataBase': newResolvedMetadata.metadataBase = metadataBase diff --git a/packages/next/src/lib/metadata/types/extra-types.ts b/packages/next/src/lib/metadata/types/extra-types.ts index e0754e4d41c3ed..a3983dc5f37267 100644 --- a/packages/next/src/lib/metadata/types/extra-types.ts +++ b/packages/next/src/lib/metadata/types/extra-types.ts @@ -92,7 +92,7 @@ export type ResolvedAppleWebApp = { statusBarStyle?: 'default' | 'black' | 'black-translucent' | undefined } -export type Facebook = FacebookAppId | FacebookAdmins +export type Facebook = FacebookAppId | FacebookAdmins | ResolvedFacebook export type FacebookAppId = { appId: string admins?: never | undefined @@ -106,7 +106,7 @@ export type ResolvedFacebook = { admins?: string[] | undefined } -export type Pinterest = PinterestRichPin +export type Pinterest = PinterestRichPin | ResolvedPinterest export type PinterestRichPin = { richPin: string | boolean } diff --git a/packages/next/src/lib/metadata/types/metadata-interface.ts b/packages/next/src/lib/metadata/types/metadata-interface.ts index 03421196818488..6847da93f7cbb2 100644 --- a/packages/next/src/lib/metadata/types/metadata-interface.ts +++ b/packages/next/src/lib/metadata/types/metadata-interface.ts @@ -557,9 +557,9 @@ interface Metadata extends DeprecatedMetadataFields { * ``` */ other?: - | ({ + | { [name: string]: string | number | Array - } & DeprecatedMetadataFields) + } | undefined } @@ -567,7 +567,7 @@ interface Metadata extends DeprecatedMetadataFields { * ResolvedMetadataWithURLs represents the fully processed metadata after * defaults are applied and relative URLs are composed with `metadataBase`. */ -interface ResolvedMetadataWithURLs extends DeprecatedMetadataFields { +interface ResolvedMetadataWithURLs { // origin and base path for absolute urls for various metadata links such as // opengraph-image metadataBase: string | null | URL @@ -657,11 +657,9 @@ interface ResolvedMetadataWithURLs extends DeprecatedMetadataFields { // meta name properties category: null | string classification: null | string - other: - | null - | ({ - [name: string]: string | number | Array - } & DeprecatedMetadataFields) + other: null | { + [name: string]: string | number | Array + } } export type WithStringifiedURLs = T extends URL diff --git a/packages/next/src/lib/metadata/types/opengraph-types.ts b/packages/next/src/lib/metadata/types/opengraph-types.ts index 76b4cbd6126bf3..f368cc5fc473f5 100644 --- a/packages/next/src/lib/metadata/types/opengraph-types.ts +++ b/packages/next/src/lib/metadata/types/opengraph-types.ts @@ -45,7 +45,7 @@ type OpenGraphMetadata = { images?: OGImage | Array | undefined audio?: OGAudio | Array | undefined videos?: OGVideo | Array | undefined - url?: string | URL | undefined + url?: null | string | URL | undefined countryName?: string | undefined ttl?: number | undefined } diff --git a/packages/next/src/lib/metadata/types/twitter-types.ts b/packages/next/src/lib/metadata/types/twitter-types.ts index 2300c9e572f712..c54d94550e5442 100644 --- a/packages/next/src/lib/metadata/types/twitter-types.ts +++ b/packages/next/src/lib/metadata/types/twitter-types.ts @@ -11,11 +11,11 @@ export type Twitter = type TwitterMetadata = { // defaults to card="summary" - site?: string | undefined // username for account associated to the site itself - siteId?: string | undefined // id for account associated to the site itself - creator?: string | undefined // username for the account associated to the creator of the content on the site - creatorId?: string | undefined // id for the account associated to the creator of the content on the site - description?: string | undefined + site?: null | string | undefined // username for account associated to the site itself + siteId?: null | string | undefined // id for account associated to the site itself + creator?: null | string | undefined // username for the account associated to the creator of the content on the site + creatorId?: null | string | undefined // id for the account associated to the creator of the content on the site + description?: null | string | undefined title?: string | TemplateString | undefined images?: TwitterImage | Array | undefined } diff --git a/test/e2e/app-dir/metadata-warnings/app/deprecated-other-fields/page.js b/test/e2e/app-dir/metadata-warnings/app/deprecated-other-fields/page.js new file mode 100644 index 00000000000000..ff340245591926 --- /dev/null +++ b/test/e2e/app-dir/metadata-warnings/app/deprecated-other-fields/page.js @@ -0,0 +1,10 @@ +export default function Page() { + return 'deprecated other fields' +} + +export const metadata = { + other: { + 'apple-touch-fullscreen': 'yes', + 'apple-touch-icon-precomposed': '/icon.png', + }, +} diff --git a/test/e2e/app-dir/metadata-warnings/metadata-warnings-with-metadatabase.test.ts b/test/e2e/app-dir/metadata-warnings/metadata-warnings-with-metadatabase.test.ts index 4be3e870d1f108..78894630cc4ca5 100644 --- a/test/e2e/app-dir/metadata-warnings/metadata-warnings-with-metadatabase.test.ts +++ b/test/e2e/app-dir/metadata-warnings/metadata-warnings-with-metadatabase.test.ts @@ -70,4 +70,12 @@ describe('app dir - metadata missing metadataBase', () => { const output = next.cliOutput.slice(outputLength) expect(output).not.toContain('Unsupported metadata viewport') }) + + it('should warn for deprecated fields in other property', async () => { + const logStartPosition = next.cliOutput.length + await next.fetch('/deprecated-other-fields') + const output = getCliOutput(logStartPosition) + expect(output).toInclude('Use appleWebApp instead') + expect(output).toInclude('Use icons.apple instead') + }) }) diff --git a/test/production/app-dir/metadata-spread-types/app/layout.tsx b/test/production/app-dir/metadata-spread-types/app/layout.tsx new file mode 100644 index 00000000000000..5182a952bd65fe --- /dev/null +++ b/test/production/app-dir/metadata-spread-types/app/layout.tsx @@ -0,0 +1,27 @@ +import type { Metadata } from 'next' + +export const metadata: Metadata = { + title: 'Layout title', + description: 'Layout description', + openGraph: { + title: 'Layout OG title', + description: 'Layout OG description', + url: 'https://example.com', + siteName: 'Example Site', + }, + twitter: { + card: 'summary', + title: 'Layout Twitter title', + description: 'Layout Twitter description', + site: '@example', + creator: '@creator', + }, +} + +export default function Layout({ children }: { children: React.ReactNode }) { + return ( + + {children} + + ) +} diff --git a/test/production/app-dir/metadata-spread-types/app/page.tsx b/test/production/app-dir/metadata-spread-types/app/page.tsx new file mode 100644 index 00000000000000..5de76835c15b17 --- /dev/null +++ b/test/production/app-dir/metadata-spread-types/app/page.tsx @@ -0,0 +1,27 @@ +import type { Metadata, ResolvingMetadata } from 'next' + +export default function Page() { + return

Spread parent metadata test

+} + +export async function generateMetadata( + _: unknown, + parent: ResolvingMetadata +): Promise { + const resolvedParent = await parent + + return { + title: 'Page title', + description: 'Page description', + openGraph: { + ...resolvedParent.openGraph, + title: 'Page OG title', + description: 'Page OG description', + }, + twitter: { + ...resolvedParent.twitter, + title: 'Page Twitter title', + description: 'Page Twitter description', + }, + } +} diff --git a/test/production/app-dir/metadata-spread-types/app/spread-all/page.tsx b/test/production/app-dir/metadata-spread-types/app/spread-all/page.tsx new file mode 100644 index 00000000000000..f6663b72346e85 --- /dev/null +++ b/test/production/app-dir/metadata-spread-types/app/spread-all/page.tsx @@ -0,0 +1,19 @@ +import type { Metadata, ResolvingMetadata } from 'next' + +export async function generateMetadata( + _: unknown, + parent: ResolvingMetadata +): Promise { + const parentMeta = await parent + + return { ...parentMeta, title: 'Spread all page' } +} + +export default function Page() { + return ( +
+

Spread all page

+

This page spreads the entire parent metadata

+
+ ) +} diff --git a/test/production/app-dir/metadata-spread-types/metadata-spread-types.test.ts b/test/production/app-dir/metadata-spread-types/metadata-spread-types.test.ts new file mode 100644 index 00000000000000..5280f1aefbaa35 --- /dev/null +++ b/test/production/app-dir/metadata-spread-types/metadata-spread-types.test.ts @@ -0,0 +1,46 @@ +import { nextTestSetup } from 'e2e-utils' +import { createMultiDomMatcher } from 'next-test-utils' + +describe('metadata spread types', () => { + const { next } = nextTestSetup({ + files: __dirname, + }) + + it('should allow spreading resolved parent metadata into child metadata', async () => { + const browser = await next.browser('/') + const matchMultiDom = createMultiDomMatcher(browser) + + // Verify page title from child's generateMetadata + expect(await browser.eval(`document.title`)).toBe('Page title') + + // Verify openGraph metadata is correctly merged + await matchMultiDom('meta', 'property', 'content', { + 'og:title': 'Page OG title', + 'og:description': 'Page OG description', + 'og:url': 'https://example.com', + 'og:site_name': 'Example Site', + }) + + // Verify twitter metadata is correctly merged + await matchMultiDom('meta', 'name', 'content', { + 'twitter:title': 'Page Twitter title', + 'twitter:description': 'Page Twitter description', + 'twitter:site': '@example', + 'twitter:creator': '@creator', + }) + }) + + it('should allow spreading entire resolved parent metadata', async () => { + const browser = await next.browser('/spread-all') + + // Verify page title is overridden + expect(await browser.eval(`document.title`)).toBe('Spread all page') + + // Verify parent metadata is inherited + expect( + await browser.eval( + `document.querySelector('meta[name="description"]')?.content` + ) + ).toBe('Layout description') + }) +}) diff --git a/test/production/app-dir/metadata-spread-types/next.config.js b/test/production/app-dir/metadata-spread-types/next.config.js new file mode 100644 index 00000000000000..5a877d2dbfabad --- /dev/null +++ b/test/production/app-dir/metadata-spread-types/next.config.js @@ -0,0 +1,2 @@ +/** @type {import('next').NextConfig} */ +module.exports = {} diff --git a/test/unit/metadata-types-compatibility.test.ts b/test/unit/metadata-types-compatibility.test.ts new file mode 100644 index 00000000000000..75b3a77b8efa83 --- /dev/null +++ b/test/unit/metadata-types-compatibility.test.ts @@ -0,0 +1,107 @@ +/** + * Type compatibility tests for Metadata and ResolvedMetadata. + * + * These tests verify that ResolvedMetadata properties can be assigned to + * Metadata input types. This is important because users often want to + * extend parent metadata in generateMetadata: + * + * ```ts + * export async function generateMetadata(_, parent: ResolvingMetadata) { + * const resolved = await parent + * return { + * openGraph: { + * ...resolved.openGraph, // Should not cause type errors + * title: 'Override title', + * }, + * } + * } + * ``` + * + * If these tests fail, it means ResolvedMetadata has properties + * that are not assignable to Metadata (e.g., `null` vs `undefined` mismatch). + */ + +import type { Metadata, ResolvedMetadata } from 'next' +import { expectTypeOf } from 'expect-type' + +// Extract property types for comparison +type ResolvedOpenGraphUrl = NonNullable['url'] +type MetadataOpenGraphUrl = NonNullable['url'] + +type ResolvedTwitterSite = NonNullable['site'] +type MetadataTwitterSite = NonNullable['site'] + +type ResolvedTwitterCreator = NonNullable< + ResolvedMetadata['twitter'] +>['creator'] +type MetadataTwitterCreator = NonNullable['creator'] + +type ResolvedTwitterSiteId = NonNullable['siteId'] +type MetadataTwitterSiteId = NonNullable['siteId'] + +type ResolvedTwitterCreatorId = NonNullable< + ResolvedMetadata['twitter'] +>['creatorId'] +type MetadataTwitterCreatorId = NonNullable['creatorId'] + +type ResolvedTwitterDescription = NonNullable< + ResolvedMetadata['twitter'] +>['description'] +type MetadataTwitterDescription = NonNullable< + Metadata['twitter'] +>['description'] + +type ResolvedFacebookType = NonNullable +type MetadataFacebookType = NonNullable + +type ResolvedPinterestType = NonNullable +type MetadataPinterestType = NonNullable + +describe('Metadata and ResolvedMetadata type compatibility', () => { + describe('top-level ResolvedMetadata', () => { + it('should have ResolvedMetadata assignable to Metadata', () => { + // This tests spreading the entire resolved metadata: { ...parentMeta, title: 'Test' } + expectTypeOf().toMatchTypeOf() + }) + }) + + describe('openGraph property types', () => { + it('should have ResolvedOpenGraph.url assignable to Metadata.openGraph.url', () => { + expectTypeOf().toMatchTypeOf() + }) + }) + + describe('twitter property types', () => { + it('should have ResolvedTwitter.site assignable to Metadata.twitter.site', () => { + expectTypeOf().toMatchTypeOf() + }) + + it('should have ResolvedTwitter.siteId assignable to Metadata.twitter.siteId', () => { + expectTypeOf().toMatchTypeOf() + }) + + it('should have ResolvedTwitter.creator assignable to Metadata.twitter.creator', () => { + expectTypeOf().toMatchTypeOf() + }) + + it('should have ResolvedTwitter.creatorId assignable to Metadata.twitter.creatorId', () => { + expectTypeOf().toMatchTypeOf() + }) + + it('should have ResolvedTwitter.description assignable to Metadata.twitter.description', () => { + expectTypeOf().toMatchTypeOf() + }) + }) + + describe('facebook property types', () => { + it('should have ResolvedFacebook assignable to Metadata.facebook', () => { + expectTypeOf().toMatchTypeOf() + }) + }) + + describe('pinterest property types', () => { + it('should have ResolvedPinterest assignable to Metadata.pinterest', () => { + expectTypeOf().toMatchTypeOf() + }) + }) +})