{"version":3,"sources":["../../../../../../src/build/webpack/loaders/next-app-loader/index.ts"],"sourcesContent":["import type webpack from 'next/dist/compiled/webpack/webpack'\nimport {\n  UNDERSCORE_GLOBAL_ERROR_ROUTE,\n  UNDERSCORE_NOT_FOUND_ROUTE,\n  type ValueOf,\n} from '../../../../shared/lib/constants'\nimport {\n  UNDERSCORE_GLOBAL_ERROR_ROUTE_ENTRY,\n  UNDERSCORE_NOT_FOUND_ROUTE_ENTRY,\n} from '../../../../shared/lib/entry-constants'\nimport type { ModuleTuple, CollectedMetadata } from '../metadata/types'\n\nimport path from 'path'\nimport { bold } from '../../../../lib/picocolors'\nimport { getModuleBuildInfo } from '../get-module-build-info'\nimport { verifyRootLayout } from '../../../../lib/verify-root-layout'\nimport * as Log from '../../../output/log'\nimport { APP_DIR_ALIAS } from '../../../../lib/constants'\nimport {\n  createMetadataExportsCode,\n  createStaticMetadataFromRoute,\n} from '../metadata/discover'\nimport { promises as fs } from 'fs'\nimport { isAppRouteRoute } from '../../../../lib/is-app-route-route'\nimport type { NextConfig } from '../../../../server/config-shared'\nimport { AppPathnameNormalizer } from '../../../../server/normalizers/built/app/app-pathname-normalizer'\nimport type { ProxyConfig } from '../../../analysis/get-page-static-info'\nimport { isAppBuiltinPage } from '../../../utils'\nimport { loadEntrypoint } from '../../../load-entrypoint'\nimport {\n  isGroupSegment,\n  DEFAULT_SEGMENT_KEY,\n  PAGE_SEGMENT_KEY,\n} from '../../../../shared/lib/segment'\nimport { getFilesInDir } from '../../../../lib/get-files-in-dir'\nimport type { PageExtensions } from '../../../page-extensions-type'\nimport { PARALLEL_ROUTE_DEFAULT_PATH } from '../../../../client/components/builtin/default'\nimport { PARALLEL_ROUTE_DEFAULT_NULL_PATH } from '../../../../client/components/builtin/default-null'\nimport type { Compilation } from 'webpack'\nimport { createAppRouteCode } from './create-app-route-code'\nimport { MissingDefaultParallelRouteError } from '../../../../shared/lib/errors/missing-default-parallel-route-error'\nimport { isInterceptionRouteAppPath } from '../../../../shared/lib/router/utils/interception-routes'\nimport { normalizeAppPath } from '../../../../shared/lib/router/utils/app-paths'\n\nimport { normalizePathSep } from '../../../../shared/lib/page-path/normalize-path-sep'\nimport { installBindings } from '../../../swc/install-bindings'\n\nexport type AppLoaderOptions = {\n  name: string\n  page: string\n  pagePath: string\n  appDir: string\n  appPaths: readonly string[] | null\n  // All normalized app paths across the entire app, used for computing\n  // static siblings for dynamic segments\n  allNormalizedAppPaths: readonly string[] | null\n  preferredRegion: string | string[] | undefined\n  pageExtensions: PageExtensions\n  assetPrefix: string\n  rootDir?: string\n  tsconfigPath?: string\n  isDev?: true\n  basePath: string\n  nextConfigOutput?: NextConfig['output']\n  middlewareConfig: string\n  isGlobalNotFoundEnabled: true | undefined\n}\ntype AppLoader = webpack.LoaderDefinitionFunction<AppLoaderOptions>\n\nconst HTTP_ACCESS_FALLBACKS = {\n  'not-found': 'not-found',\n  forbidden: 'forbidden',\n  unauthorized: 'unauthorized',\n} as const\nconst defaultHTTPAccessFallbackPaths = {\n  'not-found': 'next/dist/client/components/builtin/not-found.js',\n  forbidden: 'next/dist/client/components/builtin/forbidden.js',\n  unauthorized: 'next/dist/client/components/builtin/unauthorized.js',\n} as const\n\nconst FILE_TYPES = {\n  layout: 'layout',\n  template: 'template',\n  error: 'error',\n  loading: 'loading',\n  'global-error': 'global-error',\n  'global-not-found': 'global-not-found',\n  ...HTTP_ACCESS_FALLBACKS,\n} as const\n\nconst GLOBAL_ERROR_FILE_TYPE = 'global-error'\nconst GLOBAL_NOT_FOUND_FILE_TYPE = 'global-not-found'\nconst PAGE_SEGMENT = 'page$'\nconst PARALLEL_VIRTUAL_SEGMENT = 'slot$'\n\nconst defaultGlobalErrorPath =\n  'next/dist/client/components/builtin/global-error.js'\nconst defaultNotFoundPath = 'next/dist/client/components/builtin/not-found.js'\nconst defaultEmptyStubPath = 'next/dist/client/components/builtin/empty-stub.js'\nconst defaultLayoutPath = 'next/dist/client/components/builtin/layout.js'\nconst defaultGlobalNotFoundPath =\n  'next/dist/client/components/builtin/global-not-found.js'\nconst appErrorPath = 'next/dist/client/components/builtin/app-error.js'\n\ntype DirResolver = (pathToResolve: string) => string\ntype PathResolver = (\n  pathname: string\n) => Promise<string | undefined> | string | undefined\nexport type MetadataResolver = (\n  dir: string,\n  filename: string,\n  extensions: readonly string[]\n) => Promise<string[]>\n\nexport type AppDirModules = {\n  readonly [moduleKey in ValueOf<typeof FILE_TYPES>]?: ModuleTuple\n} & {\n  readonly page?: ModuleTuple\n} & {\n  readonly metadata?: CollectedMetadata\n} & {\n  readonly defaultPage?: ModuleTuple\n}\n\nconst normalizeParallelKey = (key: string) =>\n  key.startsWith('@') ? key.slice(1) : key\n\nconst isCatchAllSegment = (segment: string) =>\n  segment.startsWith('[...') || segment.startsWith('[[...')\n\nconst isDynamicSegment = (segment: string) =>\n  segment.startsWith('[') && segment.endsWith(']')\n\nconst isDirectory = async (pathname: string) => {\n  try {\n    const stat = await fs.stat(pathname)\n    return stat.isDirectory()\n  } catch (err) {\n    return false\n  }\n}\n\nasync function createTreeCodeFromPath(\n  pagePath: string,\n  {\n    page,\n    resolveDir,\n    resolver,\n    resolveParallelSegments,\n    hasChildRoutesForSegment,\n    getStaticSiblingSegments,\n    metadataResolver,\n    pageExtensions,\n    basePath,\n    collectedDeclarations,\n    isGlobalNotFoundEnabled,\n    isDev,\n  }: {\n    page: string\n    resolveDir: DirResolver\n    resolver: PathResolver\n    metadataResolver: MetadataResolver\n    resolveParallelSegments: (\n      pathname: string\n    ) => [key: string, segment: string | string[]][]\n    hasChildRoutesForSegment: (segmentPath: string) => boolean\n    getStaticSiblingSegments: (segmentPath: string) => string[]\n    loaderContext: webpack.LoaderContext<AppLoaderOptions>\n    pageExtensions: PageExtensions\n    basePath: string\n    collectedDeclarations: [string, string][]\n    isGlobalNotFoundEnabled: boolean\n    isDev: boolean\n  }\n): Promise<{\n  treeCode: string\n  rootLayout: string | undefined\n  globalError: string\n  globalNotFound: string\n}> {\n  const splittedPath = pagePath.split(/[\\\\/]/, 1)\n  const isNotFoundRoute = page === UNDERSCORE_NOT_FOUND_ROUTE_ENTRY\n  const isAppErrorRoute = page === UNDERSCORE_GLOBAL_ERROR_ROUTE_ENTRY\n  const isDefaultNotFound = isAppBuiltinPage(pagePath)\n\n  const appDirPrefix = isDefaultNotFound ? APP_DIR_ALIAS : splittedPath[0]\n\n  let rootLayout: string | undefined\n  let globalError: string = defaultGlobalErrorPath\n  let globalNotFound: string = defaultNotFoundPath\n\n  async function resolveAdjacentParallelSegments(\n    segmentPath: string\n  ): Promise<string[]> {\n    const absoluteSegmentPath = resolveDir(`${appDirPrefix}${segmentPath}`)\n\n    if (!absoluteSegmentPath) {\n      return []\n    }\n\n    const segmentIsDirectory = await isDirectory(absoluteSegmentPath)\n\n    if (!segmentIsDirectory) {\n      return []\n    }\n\n    // We need to resolve all parallel routes in this level.\n    const files = await fs.opendir(absoluteSegmentPath)\n\n    const parallelSegments: string[] = ['children']\n\n    for await (const dirent of files) {\n      // Make sure name starts with \"@\" and is a directory.\n      if (dirent.isDirectory() && dirent.name.charCodeAt(0) === 64) {\n        parallelSegments.push(dirent.name)\n      }\n    }\n\n    return parallelSegments\n  }\n\n  async function createSubtreePropsFromSegmentPath(\n    segments: string[],\n    nestedCollectedDeclarations: [string, string][]\n  ): Promise<{\n    treeCode: string\n  }> {\n    const segmentPath = segments.join('/')\n\n    // Existing tree are the children of the current segment\n    const props: Record<string, string> = {}\n    // Root layer could be 1st layer of normal routes\n    const isRootLayer = segments.length === 0\n    const isRootLayoutOrRootPage = segments.length <= 1\n\n    // We need to resolve all parallel routes in this level.\n    const parallelSegments: [key: string, segment: string | string[]][] = []\n    if (isRootLayer) {\n      parallelSegments.push(['children', ''])\n    } else {\n      parallelSegments.push(...resolveParallelSegments(segmentPath))\n    }\n\n    let metadata: Awaited<ReturnType<typeof createStaticMetadataFromRoute>> =\n      null\n    const routerDirPath = `${appDirPrefix}${segmentPath}`\n    const resolvedRouteDir = resolveDir(routerDirPath)\n\n    if (\n      resolvedRouteDir &&\n      // Do not collect metadata for app-error route as it's for generating pure static 500.html\n      !normalizePathSep(pagePath).endsWith(appErrorPath)\n    ) {\n      metadata = await createStaticMetadataFromRoute(resolvedRouteDir, {\n        basePath,\n        segment: segmentPath,\n        metadataResolver,\n        isRootLayoutOrRootPage,\n        pageExtensions,\n      })\n    }\n\n    for (const [parallelKey, parallelSegment] of parallelSegments) {\n      // if parallelSegment is the page segment (ie, `page$` and not ['page$']), it gets loaded into the __PAGE__ slot\n      // as it's the page for the current route.\n      if (parallelSegment === PAGE_SEGMENT) {\n        const matchedPagePath = `${appDirPrefix}${segmentPath}${\n          parallelKey === 'children' ? '' : `/${parallelKey}`\n        }/page`\n\n        const resolvedPagePath = await resolver(matchedPagePath)\n        if (resolvedPagePath) {\n          const varName = `page${nestedCollectedDeclarations.length}`\n          nestedCollectedDeclarations.push([varName, resolvedPagePath])\n\n          // Use '' for segment as it's the page. There can't be a segment called '' so this is the safest way to add it.\n          props[normalizeParallelKey(parallelKey)] =\n            `['${PAGE_SEGMENT_KEY}', {}, {\n          page: [${varName}, ${JSON.stringify(resolvedPagePath)}],\n          ${createMetadataExportsCode(metadata)}\n        }]`\n          continue\n        } else {\n          throw new Error(`Can't resolve ${matchedPagePath}`)\n        }\n      }\n\n      // if the parallelSegment was not matched to the __PAGE__ slot, then it's a parallel route at this level.\n      // the code below recursively traverses the parallel slots directory to match the corresponding __PAGE__ for each parallel slot\n      // while also filling in layout/default/etc files into the loader tree at each segment level.\n\n      const subSegmentPath = [...segments]\n      if (parallelKey !== 'children') {\n        // A `children` parallel key should have already been processed in the above segment\n        // So we exclude it when constructing the subsegment path for the remaining segment levels\n        subSegmentPath.push(parallelKey)\n      }\n\n      const normalizedParallelSegment = Array.isArray(parallelSegment)\n        ? parallelSegment[0]\n        : parallelSegment\n\n      if (\n        normalizedParallelSegment !== PAGE_SEGMENT &&\n        normalizedParallelSegment !== PARALLEL_VIRTUAL_SEGMENT\n      ) {\n        // If we don't have a page segment, nor a special $children marker, it means we need to traverse the next directory\n        // (ie, `normalizedParallelSegment` would correspond with the folder that contains the next level of pages/layout/etc)\n        // we push it to the subSegmentPath so that we can fill in the loader tree for that segment.\n        subSegmentPath.push(normalizedParallelSegment)\n      }\n\n      const parallelSegmentPath = subSegmentPath.join('/')\n\n      // Fill in the loader tree for all of the special files types (layout, default, etc) at this level\n      // `page` is not included here as it's added above.\n      const filePathEntries = await Promise.all(\n        Object.values(FILE_TYPES).map(async (file) => {\n          return [\n            file,\n            await resolver(\n              `${appDirPrefix}${\n                // TODO-APP: parallelSegmentPath sometimes ends in `/` but sometimes it doesn't. This should be consistent.\n                parallelSegmentPath.endsWith('/')\n                  ? parallelSegmentPath\n                  : parallelSegmentPath + '/'\n              }${file}`\n            ),\n          ] as const\n        })\n      )\n      const filePaths = new Map<ValueOf<typeof FILE_TYPES>, string | undefined>(\n        filePathEntries\n      )\n\n      // Resolve global-* convention files at the root layer\n      if (isRootLayer) {\n        const resolvedGlobalErrorPath = await resolver(\n          `${appDirPrefix}/${GLOBAL_ERROR_FILE_TYPE}`\n        )\n        if (resolvedGlobalErrorPath) {\n          globalError = resolvedGlobalErrorPath\n        }\n\n        // TODO(global-not-found): remove this flag assertion condition\n        //  once global-not-found is stable\n        if (isGlobalNotFoundEnabled) {\n          const resolvedGlobalNotFoundPath = await resolver(\n            `${appDirPrefix}/${GLOBAL_NOT_FOUND_FILE_TYPE}`\n          )\n          if (resolvedGlobalNotFoundPath) {\n            globalNotFound = resolvedGlobalNotFoundPath\n          }\n          // Add global-not-found to root layer's filePaths, so that it's always available,\n          // by default it's the built-in global-not-found.js\n          filePaths.set(GLOBAL_NOT_FOUND_FILE_TYPE, globalNotFound)\n        }\n      }\n\n      // Add global-error to ALL layers' filePaths, so that it's always available.\n      // By default it's the built-in global-error.js, or user's custom one if defined.\n      filePaths.set(GLOBAL_ERROR_FILE_TYPE, globalError)\n\n      let definedFilePaths = Array.from(filePaths.entries()).filter(\n        ([, filePath]) => filePath !== undefined\n      ) as [ValueOf<typeof FILE_TYPES>, string][]\n\n      // Add default access fallback as root fallback if not present\n      const existedConventionNames = new Set(\n        definedFilePaths.map(([type]) => type)\n      )\n      // If the first layer is a group route, we treat it as root layer\n      const isFirstLayerGroupRoute =\n        segments.length === 1 &&\n        subSegmentPath.filter((seg) => isGroupSegment(seg)).length === 1\n\n      if (isRootLayer || isFirstLayerGroupRoute) {\n        const accessFallbackTypes = Object.keys(\n          defaultHTTPAccessFallbackPaths\n        ) as (keyof typeof defaultHTTPAccessFallbackPaths)[]\n        for (const type of accessFallbackTypes) {\n          const hasRootFallbackFile = await resolver(\n            `${appDirPrefix}/${FILE_TYPES[type]}`\n          )\n          const hasLayerFallbackFile = existedConventionNames.has(type)\n\n          // If you already have a root access error fallback, don't insert default access error boundary to group routes root\n          if (\n            // Is treated as root layout and without boundary\n            !(hasRootFallbackFile && isFirstLayerGroupRoute) &&\n            // Does not have a fallback boundary file\n            !hasLayerFallbackFile\n          ) {\n            const defaultFallbackPath = defaultHTTPAccessFallbackPaths[type]\n            if (!(isDefaultNotFound && type === 'not-found')) {\n              definedFilePaths.push([type, defaultFallbackPath])\n            }\n          }\n        }\n      }\n\n      if (!rootLayout) {\n        const layoutPath = definedFilePaths.find(\n          ([type]) => type === 'layout'\n        )?.[1]\n        rootLayout = layoutPath\n\n        // When `global-not-found` is disabled, we insert a default layout if\n        // root layout is presented. This logic and the default layout will be removed\n        // once `global-not-found` is stabilized.\n        if (\n          !isGlobalNotFoundEnabled &&\n          isDefaultNotFound &&\n          !layoutPath &&\n          !rootLayout\n        ) {\n          rootLayout = defaultLayoutPath\n          definedFilePaths.push(['layout', rootLayout])\n        }\n      }\n\n      let parallelSegmentKey = Array.isArray(parallelSegment)\n        ? parallelSegment[0]\n        : parallelSegment\n\n      // normalize the parallel segment key to remove any special markers that we inserted in the\n      // earlier logic (such as children$ and page$). These should never appear in the loader tree, and\n      // should instead be the corresponding segment keys (ie `__PAGE__`) or the `children` parallel route.\n      parallelSegmentKey =\n        parallelSegmentKey === PARALLEL_VIRTUAL_SEGMENT ||\n        parallelSegmentKey === PAGE_SEGMENT\n          ? '(__SLOT__)'\n          : parallelSegmentKey\n\n      const normalizedParallelKey = normalizeParallelKey(parallelKey)\n      let subtreeCode: string | undefined\n      // If it's root not found page, set not-found boundary as children page\n      if (isNotFoundRoute) {\n        if (normalizedParallelKey === 'children') {\n          const matchedGlobalNotFound = isGlobalNotFoundEnabled\n            ? (definedFilePaths.find(\n                ([type]) => type === GLOBAL_NOT_FOUND_FILE_TYPE\n              )?.[1] ?? defaultGlobalNotFoundPath)\n            : undefined\n\n          // If custom global-not-found.js is defined, use global-not-found.js\n          if (matchedGlobalNotFound) {\n            const varName = `notFound${nestedCollectedDeclarations.length}`\n            nestedCollectedDeclarations.push([varName, matchedGlobalNotFound])\n            const layoutName = `layout${nestedCollectedDeclarations.length}`\n            nestedCollectedDeclarations.push([layoutName, defaultEmptyStubPath])\n            subtreeCode = `{\n              children: [${JSON.stringify(UNDERSCORE_NOT_FOUND_ROUTE)}, {\n                children: ['${PAGE_SEGMENT_KEY}', {}, {\n                  layout: [\n                    ${varName},\n                    ${JSON.stringify(matchedGlobalNotFound)}\n                  ],\n                  page: [\n                    ${layoutName},\n                    ${JSON.stringify(defaultEmptyStubPath)}\n                  ]\n                }]\n              }, {}]\n            }`\n          } else {\n            // If custom not-found.js is found, use it and layout to compose the page,\n            // and fallback to built-in not-found component if doesn't exist.\n            const notFoundPath =\n              definedFilePaths.find(([type]) => type === 'not-found')?.[1] ??\n              defaultNotFoundPath\n            const varName = `notFound${nestedCollectedDeclarations.length}`\n            nestedCollectedDeclarations.push([varName, notFoundPath])\n            subtreeCode = `{\n              children: [${JSON.stringify(UNDERSCORE_NOT_FOUND_ROUTE.slice(1))}, {\n                children: ['${PAGE_SEGMENT_KEY}', {}, {\n                  page: [\n                    ${varName},\n                    ${JSON.stringify(notFoundPath)}\n                  ]\n                }]\n              }, {}]\n            }`\n          }\n        }\n      }\n\n      // If it's app-error route, set app-error as children page\n      if (isAppErrorRoute) {\n        const varName = `appError${nestedCollectedDeclarations.length}`\n        nestedCollectedDeclarations.push([varName, appErrorPath])\n        subtreeCode = `{\n          children: [${JSON.stringify(UNDERSCORE_GLOBAL_ERROR_ROUTE.slice(1))}, {\n            children: ['${PAGE_SEGMENT_KEY}', {}, {\n              page: [\n                ${varName},\n                ${JSON.stringify(appErrorPath)}\n              ]\n            }]\n          }, {}]\n        }`\n      }\n\n      // For 404 route\n      // if global-not-found is in definedFilePaths, remove root layout for /_not-found,\n      // and change it to global-not-found route.\n      // TODO: remove this once global-not-found is stable.\n      if (isNotFoundRoute && isGlobalNotFoundEnabled) {\n        definedFilePaths = definedFilePaths.filter(\n          ([type]) => type !== 'layout'\n        )\n\n        // Replace the layout to global-not-found\n        definedFilePaths.push([\n          'layout',\n          definedFilePaths.find(\n            ([type]) => type === GLOBAL_NOT_FOUND_FILE_TYPE\n          )?.[1] ?? defaultGlobalNotFoundPath,\n        ])\n      }\n\n      if (isAppErrorRoute) {\n        definedFilePaths = definedFilePaths.filter(\n          ([type]) => type !== 'layout'\n        )\n      }\n\n      const modulesCode = `{\n        ${definedFilePaths\n          .map(([file, filePath]) => {\n            const varName = `module${nestedCollectedDeclarations.length}`\n            nestedCollectedDeclarations.push([varName, filePath])\n            return `'${file}': [${varName}, ${JSON.stringify(filePath)}],`\n          })\n          .join('\\n')}\n        ${createMetadataExportsCode(metadata)}\n      }`\n\n      if (!subtreeCode) {\n        const { treeCode: pageSubtreeCode } =\n          await createSubtreePropsFromSegmentPath(\n            subSegmentPath,\n            nestedCollectedDeclarations\n          )\n\n        subtreeCode = pageSubtreeCode\n      }\n\n      // Compute static siblings for dynamic segments. In dev mode, routes are\n      // compiled on-demand so we don't know all siblings; pass null.\n      const staticSiblingsCode = isDev\n        ? 'null'\n        : `${JSON.stringify(getStaticSiblingSegments(parallelSegmentPath))}`\n      props[normalizedParallelKey] = `[\n        '${parallelSegmentKey}',\n        ${subtreeCode},\n        ${modulesCode},\n        ${staticSiblingsCode}\n      ]`\n    }\n\n    const adjacentParallelSegments =\n      await resolveAdjacentParallelSegments(segmentPath)\n\n    for (const adjacentParallelSegment of adjacentParallelSegments) {\n      if (!props[normalizeParallelKey(adjacentParallelSegment)]) {\n        const actualSegment =\n          adjacentParallelSegment === 'children'\n            ? ''\n            : `/${adjacentParallelSegment}`\n\n        // Use the default path if it's found, otherwise if it's a children\n        // slot, then use the fallback (which triggers a `notFound()`). If this\n        // isn't a children slot, then throw an error, as it produces a silent\n        // 404 if we'd used the fallback.\n        const fullSegmentPath = `${appDirPrefix}${segmentPath}${actualSegment}`\n        let defaultPath = await resolver(`${fullSegmentPath}/default`)\n        if (!defaultPath) {\n          if (adjacentParallelSegment === 'children') {\n            // When we host applications on Vercel, the status code affects the\n            // underlying behavior of the route, which when we are missing the\n            // children slot of an interception route, will yield a full 404\n            // response for the RSC request instead. For this reason, we expect\n            // that if a default file is missing when we're rendering an\n            // interception route, we instead always render null for the default\n            // slot to avoid the full 404 response.\n            if (isInterceptionRouteAppPath(page)) {\n              defaultPath = PARALLEL_ROUTE_DEFAULT_NULL_PATH\n            } else {\n              defaultPath = PARALLEL_ROUTE_DEFAULT_PATH\n            }\n          } else {\n            // Check if we're inside a catch-all route (i.e., the parallel route is a child\n            // of a catch-all segment). Only skip validation if the slot is UNDER a catch-all.\n            // For example:\n            //   /[...catchAll]/@slot - isInsideCatchAll = true (skip validation) ✓\n            //   /@slot/[...catchAll] - isInsideCatchAll = false (require default) ✓\n            // The catch-all provides fallback behavior, so default.js is not required.\n            const isInsideCatchAll = segments.some(isCatchAllSegment)\n\n            // Check if this is a leaf segment (no child routes).\n            // Leaf segments don't need default.js because there are no child routes\n            // that could cause the parallel slot to unmatch. For example:\n            //   /repo-overview/@slot/page with no child routes - isLeafSegment = true (skip validation) ✓\n            //   /repo-overview/@slot/page with /repo-overview/child/page - isLeafSegment = false (require default) ✓\n            // This also handles route groups correctly by filtering them out.\n            const isLeafSegment = !hasChildRoutesForSegment(segmentPath)\n\n            if (!isInsideCatchAll && !isLeafSegment) {\n              // Replace internal webpack alias with user-facing directory name\n              const userFacingPath = fullSegmentPath.replace(\n                APP_DIR_ALIAS,\n                'app'\n              )\n              throw new MissingDefaultParallelRouteError(\n                userFacingPath,\n                adjacentParallelSegment\n              )\n            }\n            defaultPath = PARALLEL_ROUTE_DEFAULT_PATH\n          }\n        }\n\n        const varName = `default${nestedCollectedDeclarations.length}`\n        nestedCollectedDeclarations.push([varName, defaultPath])\n        props[normalizeParallelKey(adjacentParallelSegment)] = `[\n          '${DEFAULT_SEGMENT_KEY}',\n          {},\n          {\n            defaultPage: [${varName}, ${JSON.stringify(defaultPath)}],\n          }\n        ]`\n      }\n    }\n    return {\n      treeCode: `{\n        ${Object.entries(props)\n          .map(([key, value]) => `${key}: ${value}`)\n          .join(',\\n')}\n      }`,\n    }\n  }\n\n  const { treeCode } = await createSubtreePropsFromSegmentPath(\n    [],\n    collectedDeclarations\n  )\n\n  return {\n    treeCode: `${treeCode}.children;`,\n    rootLayout,\n    globalError,\n    globalNotFound,\n  }\n}\n\nfunction createAbsolutePath(appDir: string, pathToTurnAbsolute: string) {\n  return (\n    pathToTurnAbsolute\n      // Replace all POSIX path separators with the current OS path separator\n      .replace(/\\//g, path.sep)\n      .replace(/^private-next-app-dir/, appDir)\n  )\n}\n\nconst filesInDirMapMap: WeakMap<\n  Compilation,\n  Map<string, Promise<Set<string>>>\n> = new WeakMap()\nconst nextAppLoader: AppLoader = async function nextAppLoader() {\n  // install native bindings early so they are always available.\n  // When run by webpack, next will have already done this, so this will be fast,\n  // but if run by turbopack in a subprocess it is required.  In that case we cannot pass the\n  // `useWasmBinary` flag, but that is ok since turbopack doesn't currently support wasm.\n  await installBindings()\n  const loaderOptions = this.getOptions()\n  const {\n    name,\n    appDir,\n    appPaths,\n    allNormalizedAppPaths: allNormalizedAppPathsOption,\n    pagePath,\n    pageExtensions,\n    rootDir,\n    tsconfigPath,\n    isDev,\n    nextConfigOutput,\n    preferredRegion,\n    basePath,\n    middlewareConfig: middlewareConfigBase64,\n  } = loaderOptions\n\n  const isGlobalNotFoundEnabled = !!loaderOptions.isGlobalNotFoundEnabled\n\n  // Update FILE_TYPES on the very top-level of the loader\n  if (!isGlobalNotFoundEnabled) {\n    // @ts-expect-error this delete is only necessary while experimental\n    delete FILE_TYPES['global-not-found']\n  }\n\n  const buildInfo = getModuleBuildInfo((this as any)._module)\n  const collectedDeclarations: [string, string][] = []\n\n  // Use the page from loaderOptions directly instead of deriving it from name.\n  // The name (bundlePath) may have been normalized with normalizePagePath()\n  // which is designed for Pages Router and incorrectly duplicates /index paths\n  // (e.g., /index/page -> /index/index/page). The page parameter contains the\n  // correct unnormalized value.\n  const page = loaderOptions.page\n\n  const middlewareConfig: ProxyConfig = JSON.parse(\n    Buffer.from(middlewareConfigBase64, 'base64').toString()\n  )\n  buildInfo.route = {\n    page,\n    absolutePagePath: createAbsolutePath(appDir, pagePath),\n    preferredRegion,\n    middlewareConfig,\n    relatedModules: [],\n  }\n\n  const extensions =\n    typeof pageExtensions === 'string'\n      ? [pageExtensions]\n      : pageExtensions.map((extension) => `.${extension}`)\n\n  const normalizedAppPaths =\n    typeof appPaths === 'string' ? [appPaths] : appPaths || []\n\n  // All normalized app paths for computing static siblings across route groups\n  const allNormalizedAppPaths = allNormalizedAppPathsOption ?? []\n\n  const resolveParallelSegments = (\n    pathname: string\n  ): [string, string | string[]][] => {\n    const matched: Record<string, string | string[]> = {}\n    let existingChildrenPath: string | undefined\n    for (const appPath of normalizedAppPaths) {\n      if (appPath.startsWith(pathname + '/')) {\n        const rest = appPath.slice(pathname.length + 1).split('/')\n\n        // It is the actual page, mark it specially.\n        if (rest.length === 1 && rest[0] === 'page') {\n          existingChildrenPath = appPath\n          matched.children = PAGE_SEGMENT\n          continue\n        }\n\n        const isParallelRoute = rest[0].startsWith('@')\n        if (isParallelRoute) {\n          if (rest.length === 2 && rest[1] === 'page') {\n            // We found a parallel route at this level. We don't want to mark it explicitly as the page segment,\n            // as that should be matched to the `children` slot. Instead, we use an array, to signal to `createSubtreePropsFromSegmentPath`\n            // that it needs to recursively fill in the loader tree code for the parallel route at the appropriate levels.\n            matched[rest[0]] = [PAGE_SEGMENT]\n            continue\n          }\n          // If it was a parallel route but we weren't able to find the page segment (ie, maybe the page is nested further)\n          // we first insert a special marker to ensure that we still process layout/default/etc at the slot level prior to continuing\n          // on to the page segment.\n          matched[rest[0]] = [PARALLEL_VIRTUAL_SEGMENT, ...rest.slice(1)]\n          continue\n        }\n\n        if (existingChildrenPath && matched.children !== rest[0]) {\n          // If we get here, it means we already set a `page` segment earlier in the loop,\n          // meaning we already matched a page to the `children` parallel segment.\n          const isIncomingParallelPage = appPath.includes('@')\n          const hasCurrentParallelPage = existingChildrenPath.includes('@')\n\n          if (isIncomingParallelPage) {\n            // The duplicate segment was for a parallel slot. In this case,\n            // rather than throwing an error, we can ignore it since this can happen for valid reasons.\n            // For example, when we attempt to normalize catch-all routes, we'll push potential slot matches so\n            // that they are available in the loader tree when we go to render the page.\n            // We only need to throw an error if the duplicate segment was for a regular page.\n            // For example, /app/(groupa)/page & /app/(groupb)/page is an error since it corresponds\n            // with the same path.\n            continue\n          } else if (!hasCurrentParallelPage && !isIncomingParallelPage) {\n            // Both the current `children` and the incoming `children` are regular pages.\n            throw new Error(\n              `You cannot have two parallel pages that resolve to the same path. Please check ${existingChildrenPath} and ${appPath}. Refer to the route group docs for more information: https://nextjs.org/docs/app/building-your-application/routing/route-groups`\n            )\n          }\n        }\n\n        existingChildrenPath = appPath\n        matched.children = rest[0]\n      }\n    }\n\n    return Object.entries(matched)\n  }\n\n  const hasChildRoutesForSegment = (segmentPath: string): boolean => {\n    const pathPrefix = segmentPath ? `${segmentPath}/` : ''\n\n    for (const appPath of normalizedAppPaths) {\n      if (appPath.startsWith(pathPrefix)) {\n        const rest = appPath.slice(pathPrefix.length).split('/')\n\n        // Filter out route groups to get the actual route segments\n        // Route groups (e.g., \"(group)\") don't contribute to the URL path\n        const routeSegments = rest.filter((segment) => !isGroupSegment(segment))\n\n        // If it's just 'page' at this level, skip (not a child route)\n        if (routeSegments.length === 1 && routeSegments[0] === 'page') {\n          continue\n        }\n\n        // If the first segment (after filtering route groups) is a parallel route, skip\n        if (routeSegments[0]?.startsWith('@')) {\n          continue\n        }\n\n        // If we have more than just 'page', then there are child routes\n        // Examples:\n        //   ['child', 'page'] -> true (has child route)\n        //   ['page'] -> false (already filtered above)\n        //   ['grandchild', 'deeper', 'page'] -> true (has nested child routes)\n        if (\n          routeSegments.length > 1 ||\n          (routeSegments.length === 1 && routeSegments[0] !== 'page')\n        ) {\n          return true\n        }\n      }\n    }\n\n    return false\n  }\n\n  /**\n   * For a given segment path (in file system space, e.g., \"(group)/products/[id]\"),\n   * find all static sibling segments at the same URL path level.\n   *\n   * This accounts for route groups - siblings may exist in different parts of the\n   * file system tree but at the same URL level.\n   *\n   * For example:\n   *   /app/(marketing)/products/sale/page.tsx -> /products/sale\n   *   /app/(shop)/products/[id]/page.tsx -> /products/[id]\n   *\n   * When called with \"(shop)/products/[id]\", this would return ['sale'].\n   *\n   * TODO: This function, along with resolveParallelSegments and\n   * hasChildRoutesForSegment, repeatedly scans normalizedAppPaths. A more\n   * optimal approach would build an intermediate tree structure first\n   * (representing the URL namespace with route groups collapsed), then derive\n   * all this information in a single pass. The Turbopack implementation\n   * already uses a more tree-oriented approach (DirectoryTree ->\n   * AppPageLoaderTree), so this is less urgent to refactor given Turbopack is\n   * the canonical implementation going forward.\n   */\n  const getStaticSiblingSegments = (segmentPath: string): string[] => {\n    // Normalize the current path to URL space\n    // Add a trailing /page so normalizeAppPath strips it properly\n    const currentUrlPath = normalizeAppPath(segmentPath + '/page')\n    const currentUrlSegments = currentUrlPath.split('/').filter(Boolean)\n\n    // If the path is empty (root level), there are no siblings\n    if (currentUrlSegments.length === 0) {\n      return []\n    }\n\n    const currentSegment = currentUrlSegments[currentUrlSegments.length - 1]\n    const parentUrlPath =\n      currentUrlSegments.length === 1\n        ? '/'\n        : '/' + currentUrlSegments.slice(0, -1).join('/')\n\n    // The URL level at which we're looking for siblings (0-indexed)\n    const siblingLevel = currentUrlSegments.length - 1\n\n    // Only compute siblings for dynamic segments\n    if (!isDynamicSegment(currentSegment)) {\n      return []\n    }\n\n    // Use a Set to avoid duplicates (multiple paths may share the same sibling segment)\n    const siblings = new Set<string>()\n\n    for (const appPath of allNormalizedAppPaths) {\n      // Normalize each path to URL space (strip route groups, parallel routes, and /page suffix)\n      const urlPath = normalizeAppPath(appPath)\n      const urlSegments = urlPath.split('/').filter(Boolean)\n\n      // Path must have at least enough segments to reach the sibling level\n      if (urlSegments.length <= siblingLevel) {\n        continue\n      }\n\n      // Check if the parent path matches (all segments before the sibling level)\n      const pathParent =\n        siblingLevel === 0\n          ? '/'\n          : '/' + urlSegments.slice(0, siblingLevel).join('/')\n\n      if (pathParent !== parentUrlPath) {\n        continue\n      }\n\n      // Get the segment at the same level as the current segment\n      const segmentAtLevel = urlSegments[siblingLevel]\n\n      // Check if this is a sibling: different segment and static\n      if (\n        segmentAtLevel !== currentSegment &&\n        !isDynamicSegment(segmentAtLevel)\n      ) {\n        siblings.add(segmentAtLevel)\n      }\n    }\n\n    return Array.from(siblings)\n  }\n\n  const resolveDir: DirResolver = (pathToResolve) => {\n    return createAbsolutePath(appDir, pathToResolve)\n  }\n\n  const resolveAppRoute: PathResolver = (pathToResolve) => {\n    return createAbsolutePath(appDir, pathToResolve)\n  }\n\n  // Cached checker to see if a file exists in a given directory.\n  // This can be more efficient than checking them with `fs.stat` one by one\n  // because all the thousands of files are likely in a few possible directories.\n  // Note that it should only be cached for this compilation, not globally.\n  const fileExistsInDirectory = async (dirname: string, fileName: string) => {\n    // I don't think we should ever hit this code path, but if we do we should handle it gracefully.\n    if (this._compilation === undefined) {\n      try {\n        return (await getFilesInDir(dirname).catch(() => new Set())).has(\n          fileName\n        )\n      } catch (e) {\n        return false\n      }\n    }\n    const map =\n      filesInDirMapMap.get(this._compilation) ||\n      new Map<string, Promise<Set<string>>>()\n    if (!filesInDirMapMap.has(this._compilation)) {\n      filesInDirMapMap.set(this._compilation, map)\n    }\n    if (!map.has(dirname)) {\n      map.set(\n        dirname,\n        getFilesInDir(dirname).catch(() => new Set())\n      )\n    }\n    return ((await map.get(dirname)) || new Set()).has(fileName)\n  }\n\n  const resolver: PathResolver = async (pathname) => {\n    const absolutePath = createAbsolutePath(appDir, pathname)\n\n    const filenameIndex = absolutePath.lastIndexOf(path.sep)\n    const dirname = absolutePath.slice(0, filenameIndex)\n    const filename = absolutePath.slice(filenameIndex + 1)\n\n    const checks = await Promise.all(\n      extensions.map(async (ext) => {\n        const absolutePathWithExtension = `${absolutePath}${ext}`\n        const exists = await fileExistsInDirectory(dirname, `${filename}${ext}`)\n        // Call `addMissingDependency` for all files even if they didn't match,\n        // because they might be added or removed during development.\n        this.addMissingDependency(absolutePathWithExtension)\n        return exists ? absolutePathWithExtension : undefined\n      })\n    )\n\n    return checks.find((result) => result)\n  }\n\n  const metadataResolver: MetadataResolver = async (\n    dirname,\n    filename,\n    exts\n  ) => {\n    const absoluteDir = createAbsolutePath(appDir, dirname)\n\n    const checks = await Promise.all(\n      exts.map(async (ext) => {\n        // Compared to `resolver` above the exts do not have the `.` included already, so it's added here.\n        const filenameWithExt = `${filename}.${ext}`\n        const absolutePathWithExtension = `${absoluteDir}${path.sep}${filenameWithExt}`\n        const exists = await fileExistsInDirectory(dirname, filenameWithExt)\n        // Call `addMissingDependency` for all files even if they didn't match,\n        // because they might be added or removed during development.\n        this.addMissingDependency(absolutePathWithExtension)\n        return exists ? absolutePathWithExtension : undefined\n      })\n    )\n\n    return checks.filter((result) => result !== undefined)\n  }\n\n  if (isAppRouteRoute(name)) {\n    return createAppRouteCode({\n      appDir,\n      // TODO: investigate if the local `page` is the same as the loaderOptions.page\n      page: loaderOptions.page,\n      name,\n      pagePath,\n      resolveAppRoute,\n      pageExtensions,\n      nextConfigOutput,\n    })\n  }\n\n  let treeCodeResult = await createTreeCodeFromPath(pagePath, {\n    page,\n    resolveDir,\n    resolver,\n    metadataResolver,\n    resolveParallelSegments,\n    hasChildRoutesForSegment,\n    getStaticSiblingSegments,\n    loaderContext: this,\n    pageExtensions,\n    basePath,\n    collectedDeclarations,\n    isGlobalNotFoundEnabled,\n    isDev: !!isDev,\n  })\n\n  const isGlobalNotFoundPath =\n    page === UNDERSCORE_NOT_FOUND_ROUTE_ENTRY &&\n    !!treeCodeResult.globalNotFound &&\n    isGlobalNotFoundEnabled\n\n  const isAppErrorRoute = page === UNDERSCORE_GLOBAL_ERROR_ROUTE_ENTRY\n\n  if (!treeCodeResult.rootLayout && !isGlobalNotFoundPath && !isAppErrorRoute) {\n    if (!isDev) {\n      // If we're building and missing a root layout, exit the build\n      Log.error(\n        `${bold(\n          pagePath.replace(`${APP_DIR_ALIAS}/`, '')\n        )} doesn't have a root layout. To fix this error, make sure every page has a root layout.`\n      )\n      process.exit(1)\n    } else {\n      // In dev we'll try to create a root layout\n      const [createdRootLayout, rootLayoutPath] = await verifyRootLayout({\n        appDir: appDir,\n        dir: rootDir!,\n        tsconfigPath: tsconfigPath,\n        pagePath,\n        pageExtensions,\n      })\n      if (!createdRootLayout) {\n        let message = `${bold(\n          pagePath.replace(`${APP_DIR_ALIAS}/`, '')\n        )} doesn't have a root layout. `\n\n        if (rootLayoutPath) {\n          message += `We tried to create ${bold(\n            path.relative(this._compiler?.context ?? '', rootLayoutPath)\n          )} for you but something went wrong.`\n        } else {\n          message +=\n            'To fix this error, make sure every page has a root layout.'\n        }\n\n        throw new Error(message)\n      }\n\n      // Clear fs cache, get the new result with the created root layout.\n      if (this._compilation) filesInDirMapMap.get(this._compilation)?.clear()\n      treeCodeResult = await createTreeCodeFromPath(pagePath, {\n        page,\n        resolveDir,\n        resolver,\n        metadataResolver,\n        resolveParallelSegments,\n        hasChildRoutesForSegment,\n        getStaticSiblingSegments,\n        loaderContext: this,\n        pageExtensions,\n        basePath,\n        collectedDeclarations,\n        isGlobalNotFoundEnabled,\n        isDev: !!isDev,\n      })\n    }\n  }\n\n  const pathname = new AppPathnameNormalizer().normalize(page)\n\n  // Prefer to modify next/src/server/app-render/entry-base.ts since this is shared with Turbopack.\n  // Any changes to this code should be reflected in Turbopack's app_source.rs and/or app-renderer.tsx as well.\n  const code = await loadEntrypoint(\n    'app-page',\n    {\n      VAR_DEFINITION_PAGE: page,\n      VAR_DEFINITION_PATHNAME: pathname,\n    },\n    {\n      tree: treeCodeResult.treeCode,\n      __next_app_require__: '__webpack_require__',\n      // all modules are in the entry chunk, so we never actually need to load chunks in webpack\n      __next_app_load_chunk__: '() => Promise.resolve()',\n    }\n  )\n\n  // Lazily evaluate the imported modules in the generated code\n  const header = collectedDeclarations\n    .map(([varName, modulePath]) => {\n      return `const ${varName} = () => import(/* webpackMode: \"eager\" */ ${JSON.stringify(\n        modulePath\n      )});\\n`\n    })\n    .join('')\n\n  return header + code\n}\n\nexport default nextAppLoader\n"],"names":["UNDERSCORE_GLOBAL_ERROR_ROUTE","UNDERSCORE_NOT_FOUND_ROUTE","UNDERSCORE_GLOBAL_ERROR_ROUTE_ENTRY","UNDERSCORE_NOT_FOUND_ROUTE_ENTRY","path","bold","getModuleBuildInfo","verifyRootLayout","Log","APP_DIR_ALIAS","createMetadataExportsCode","createStaticMetadataFromRoute","promises","fs","isAppRouteRoute","AppPathnameNormalizer","isAppBuiltinPage","loadEntrypoint","isGroupSegment","DEFAULT_SEGMENT_KEY","PAGE_SEGMENT_KEY","getFilesInDir","PARALLEL_ROUTE_DEFAULT_PATH","PARALLEL_ROUTE_DEFAULT_NULL_PATH","createAppRouteCode","MissingDefaultParallelRouteError","isInterceptionRouteAppPath","normalizeAppPath","normalizePathSep","installBindings","HTTP_ACCESS_FALLBACKS","forbidden","unauthorized","defaultHTTPAccessFallbackPaths","FILE_TYPES","layout","template","error","loading","GLOBAL_ERROR_FILE_TYPE","GLOBAL_NOT_FOUND_FILE_TYPE","PAGE_SEGMENT","PARALLEL_VIRTUAL_SEGMENT","defaultGlobalErrorPath","defaultNotFoundPath","defaultEmptyStubPath","defaultLayoutPath","defaultGlobalNotFoundPath","appErrorPath","normalizeParallelKey","key","startsWith","slice","isCatchAllSegment","segment","isDynamicSegment","endsWith","isDirectory","pathname","stat","err","createTreeCodeFromPath","pagePath","page","resolveDir","resolver","resolveParallelSegments","hasChildRoutesForSegment","getStaticSiblingSegments","metadataResolver","pageExtensions","basePath","collectedDeclarations","isGlobalNotFoundEnabled","isDev","splittedPath","split","isNotFoundRoute","isAppErrorRoute","isDefaultNotFound","appDirPrefix","rootLayout","globalError","globalNotFound","resolveAdjacentParallelSegments","segmentPath","absoluteSegmentPath","segmentIsDirectory","files","opendir","parallelSegments","dirent","name","charCodeAt","push","createSubtreePropsFromSegmentPath","segments","nestedCollectedDeclarations","join","props","isRootLayer","length","isRootLayoutOrRootPage","metadata","routerDirPath","resolvedRouteDir","parallelKey","parallelSegment","matchedPagePath","resolvedPagePath","varName","JSON","stringify","Error","subSegmentPath","normalizedParallelSegment","Array","isArray","parallelSegmentPath","filePathEntries","Promise","all","Object","values","map","file","filePaths","Map","resolvedGlobalErrorPath","resolvedGlobalNotFoundPath","set","definedFilePaths","from","entries","filter","filePath","undefined","existedConventionNames","Set","type","isFirstLayerGroupRoute","seg","accessFallbackTypes","keys","hasRootFallbackFile","hasLayerFallbackFile","has","defaultFallbackPath","layoutPath","find","parallelSegmentKey","normalizedParallelKey","subtreeCode","matchedGlobalNotFound","layoutName","notFoundPath","modulesCode","treeCode","pageSubtreeCode","staticSiblingsCode","adjacentParallelSegments","adjacentParallelSegment","actualSegment","fullSegmentPath","defaultPath","isInsideCatchAll","some","isLeafSegment","userFacingPath","replace","value","createAbsolutePath","appDir","pathToTurnAbsolute","sep","filesInDirMapMap","WeakMap","nextAppLoader","loaderOptions","getOptions","appPaths","allNormalizedAppPaths","allNormalizedAppPathsOption","rootDir","tsconfigPath","nextConfigOutput","preferredRegion","middlewareConfig","middlewareConfigBase64","buildInfo","_module","parse","Buffer","toString","route","absolutePagePath","relatedModules","extensions","extension","normalizedAppPaths","matched","existingChildrenPath","appPath","rest","children","isParallelRoute","isIncomingParallelPage","includes","hasCurrentParallelPage","pathPrefix","routeSegments","currentUrlPath","currentUrlSegments","Boolean","currentSegment","parentUrlPath","siblingLevel","siblings","urlPath","urlSegments","pathParent","segmentAtLevel","add","pathToResolve","resolveAppRoute","fileExistsInDirectory","dirname","fileName","_compilation","catch","e","get","absolutePath","filenameIndex","lastIndexOf","filename","checks","ext","absolutePathWithExtension","exists","addMissingDependency","result","exts","absoluteDir","filenameWithExt","treeCodeResult","loaderContext","isGlobalNotFoundPath","process","exit","createdRootLayout","rootLayoutPath","dir","message","relative","_compiler","context","clear","normalize","code","VAR_DEFINITION_PAGE","VAR_DEFINITION_PATHNAME","tree","__next_app_require__","__next_app_load_chunk__","header","modulePath"],"mappings":"AACA,SACEA,6BAA6B,EAC7BC,0BAA0B,QAErB,mCAAkC;AACzC,SACEC,mCAAmC,EACnCC,gCAAgC,QAC3B,yCAAwC;AAG/C,OAAOC,UAAU,OAAM;AACvB,SAASC,IAAI,QAAQ,6BAA4B;AACjD,SAASC,kBAAkB,QAAQ,2BAA0B;AAC7D,SAASC,gBAAgB,QAAQ,qCAAoC;AACrE,YAAYC,SAAS,sBAAqB;AAC1C,SAASC,aAAa,QAAQ,4BAA2B;AACzD,SACEC,yBAAyB,EACzBC,6BAA6B,QACxB,uBAAsB;AAC7B,SAASC,YAAYC,EAAE,QAAQ,KAAI;AACnC,SAASC,eAAe,QAAQ,qCAAoC;AAEpE,SAASC,qBAAqB,QAAQ,mEAAkE;AAExG,SAASC,gBAAgB,QAAQ,iBAAgB;AACjD,SAASC,cAAc,QAAQ,2BAA0B;AACzD,SACEC,cAAc,EACdC,mBAAmB,EACnBC,gBAAgB,QACX,iCAAgC;AACvC,SAASC,aAAa,QAAQ,mCAAkC;AAEhE,SAASC,2BAA2B,QAAQ,gDAA+C;AAC3F,SAASC,g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