{"version":3,"sources":["../../../src/build/static-paths/app.ts"],"sourcesContent":["import type { Params } from '../../server/request/params'\nimport type { AppPageModule } from '../../server/route-modules/app-page/module'\nimport type { AppSegment } from '../segment-config/app/app-segments'\nimport type {\n  FallbackRouteParam,\n  PrerenderedRoute,\n  StaticPathsResult,\n} from './types'\n\nimport path from 'node:path'\nimport { AfterRunner } from '../../server/after/run-with-after'\nimport { createWorkStore } from '../../server/async-storage/work-store'\nimport { FallbackMode } from '../../lib/fallback'\nimport type { IncrementalCache } from '../../server/lib/incremental-cache'\nimport {\n  normalizePathname,\n  encodeParam,\n  extractPathnameRouteParamSegments,\n  resolveRouteParamsFromTree,\n} from './utils'\nimport escapePathDelimiters from '../../shared/lib/router/utils/escape-path-delimiters'\nimport { createIncrementalCache } from '../../export/helpers/create-incremental-cache'\nimport type { NextConfigComplete } from '../../server/config-shared'\nimport type { WorkStore } from '../../server/app-render/work-async-storage.external'\nimport type { DynamicParamTypes } from '../../shared/lib/app-router-types'\nimport { getParamProperties } from '../../shared/lib/router/utils/get-segment-param'\nimport { throwEmptyGenerateStaticParamsError } from '../../shared/lib/errors/empty-generate-static-params-error'\nimport type { AppRouteModule } from '../../server/route-modules/app-route/module.compiled'\nimport type { NormalizedAppRoute } from '../../shared/lib/router/routes/app'\nimport { interceptionPrefixFromParamType } from '../../shared/lib/router/utils/interception-prefix-from-param-type'\nimport type {\n  GenerateStaticParamsStore,\n  WorkUnitAsyncStorage,\n} from '../../server/app-render/work-unit-async-storage.external'\nimport type { ImplicitTags } from '../../server/lib/implicit-tags'\nimport { getImplicitTags } from '../../server/lib/implicit-tags'\n\n/**\n * Filters out duplicate parameters from a list of parameters.\n * This function uses a Map to efficiently store and retrieve unique parameter combinations.\n *\n * @param childrenRouteParams - The keys of the parameters. These should be sorted to ensure consistent key generation.\n * @param routeParams - The list of parameter objects to filter.\n * @returns A new array containing only the unique parameter combinations.\n */\nexport function filterUniqueParams(\n  childrenRouteParams: readonly { paramName: string }[],\n  routeParams: readonly Params[]\n): Params[] {\n  // A Map is used to store unique parameter combinations. The key of the Map\n  // is a string representation of the parameter combination, and the value\n  // is the actual `Params` object.\n  const unique = new Map<string, Params>()\n\n  // Iterate over each parameter object in the input array.\n  for (const params of routeParams) {\n    let key = '' // Initialize an empty string to build the unique key for the current `params` object.\n\n    // Iterate through the `routeParamKeys` (which are assumed to be sorted).\n    // This consistent order is crucial for generating a stable and unique key\n    // for each parameter combination.\n    for (const { paramName: paramKey } of childrenRouteParams) {\n      const value = params[paramKey]\n\n      // Construct a part of the key using the parameter key and its value.\n      // A type prefix (`A:` for Array, `S:` for String, `U:` for undefined) is added to the value\n      // to prevent collisions. For example, `['a', 'b']` and `'a,b'` would\n      // otherwise generate the same string representation, leading to incorrect\n      // deduplication. This ensures that different types with the same string\n      // representation are treated as distinct.\n      let valuePart: string\n      if (Array.isArray(value)) {\n        valuePart = `A:${value.join(',')}`\n      } else if (value === undefined) {\n        valuePart = `U:undefined`\n      } else {\n        valuePart = `S:${value}`\n      }\n      key += `${paramKey}:${valuePart}|`\n    }\n\n    // If the generated key is not already in the `unique` Map, it means this\n    // parameter combination is unique so far. Add it to the Map.\n    if (!unique.has(key)) {\n      unique.set(key, params)\n    }\n  }\n\n  // Convert the Map's values (the unique `Params` objects) back into an array\n  // and return it.\n  return Array.from(unique.values())\n}\n\n/**\n * Generates all unique sub-combinations of Route Parameters from a list of Static Parameters.\n * This function creates all possible prefixes of the Route Parameters, which is\n * useful for generating Static Shells that can serve as Fallback Shells for more specific Route Shells.\n *\n * When Root Parameters are provided, the function ensures that Static Shells only\n * include complete sets of Root Parameters. This prevents generating invalid Static Shells\n * that are missing required Root Parameters.\n *\n * Example with Root Parameters ('lang', 'region') and Route Parameters ('lang', 'region', 'slug'):\n *\n * Given the following Static Parameters:\n * ```\n * [\n *   { lang: 'en', region: 'US', slug: ['home'] },\n *   { lang: 'en', region: 'US', slug: ['about'] },\n *   { lang: 'fr', region: 'CA', slug: ['about'] },\n * ]\n * ```\n *\n * The result will be:\n * ```\n * [\n *   { lang: 'en', region: 'US' },  // Complete Root Parameters\n *   { lang: 'en', region: 'US', slug: ['home'] },\n *   { lang: 'en', region: 'US', slug: ['about'] },\n *   { lang: 'fr', region: 'CA' },  // Complete Root Parameters\n *   { lang: 'fr', region: 'CA', slug: ['about'] },\n * ]\n * ```\n *\n * Note that partial combinations like `{ lang: 'en' }` are NOT generated because\n * they don't include the complete set of Root Parameters.\n *\n * For routes without Root Parameters (e.g., `/[slug]`), all sub-combinations are generated\n * as before.\n *\n * @param childrenRouteParams - The children route params. These should be sorted\n *   to ensure consistent key generation for the internal Map.\n * @param routeParams - The list of Static Parameters to filter.\n * @param rootParamKeys - The keys of the Root Parameters. When provided, ensures Static Shells\n *   include all Root Parameters.\n * @returns A new array containing all unique sub-combinations of Route Parameters.\n */\nexport function generateAllParamCombinations(\n  childrenRouteParams: ReadonlyArray<{\n    readonly paramName: string\n  }>,\n  routeParams: readonly Params[],\n  rootParamKeys: readonly string[]\n): Params[] {\n  // A Map is used to store unique combinations of Route Parameters.\n  // The key of the Map is a string representation of the Route Parameter\n  // combination, and the value is the `Params` object containing only\n  // the Route Parameters.\n  const combinations = new Map<string, Params>()\n\n  // Determine the minimum index where all Root Parameters are included.\n  // This optimization ensures we only generate combinations that include\n  // a complete set of Root Parameters, preventing invalid Static Shells.\n  //\n  // For example, if rootParamKeys = ['lang', 'region'] and routeParamKeys = ['lang', 'region', 'slug']:\n  // - 'lang' is at index 0, 'region' is at index 1\n  // - minIndexForCompleteRootParams = max(0, 1) = 1\n  // - We'll only generate combinations starting from index 1 (which includes both lang and region)\n  let minIndexForCompleteRootParams = -1\n  if (rootParamKeys.length > 0) {\n    // Find the index of the last Root Parameter in routeParamKeys.\n    // This tells us the minimum combination length needed to include all Root Parameters.\n    for (const rootParamKey of rootParamKeys) {\n      const index = childrenRouteParams.findIndex(\n        (param) => param.paramName === rootParamKey\n      )\n      if (index === -1) {\n        // Root Parameter not found in Route Parameters - this shouldn't happen in normal cases\n        // but we handle it gracefully by treating it as if there are no Root Parameters.\n        // This allows the function to fall back to generating all sub-combinations.\n        minIndexForCompleteRootParams = -1\n        break\n      }\n      // Track the highest index among all Root Parameters.\n      // This ensures all Root Parameters are included in any generated combination.\n      minIndexForCompleteRootParams = Math.max(\n        minIndexForCompleteRootParams,\n        index\n      )\n    }\n  }\n\n  // Iterate over each Static Parameter object in the input array.\n  // Each params object represents one potential route combination (e.g., { lang: 'en', region: 'US', slug: 'home' })\n  for (const params of routeParams) {\n    // Generate all possible prefix combinations for this Static Parameter set.\n    // For routeParamKeys = ['lang', 'region', 'slug'], we'll generate combinations at:\n    // - i=0: { lang: 'en' }\n    // - i=1: { lang: 'en', region: 'US' }\n    // - i=2: { lang: 'en', region: 'US', slug: 'home' }\n    //\n    // The iteration order is crucial for generating stable and unique keys\n    // for each Route Parameter combination.\n    for (let i = 0; i < childrenRouteParams.length; i++) {\n      // Skip generating combinations that don't include all Root Parameters.\n      // This prevents creating invalid Static Shells that are missing required Root Parameters.\n      //\n      // For example, if Root Parameters are ['lang', 'region'] and minIndexForCompleteRootParams = 1:\n      // - Skip i=0 (would only include 'lang', missing 'region')\n      // - Process i=1 and higher (includes both 'lang' and 'region')\n      if (\n        minIndexForCompleteRootParams >= 0 &&\n        i < minIndexForCompleteRootParams\n      ) {\n        continue\n      }\n\n      // Initialize data structures for building this specific combination\n      const combination: Params = {}\n      const keyParts: string[] = []\n      let hasAllRootParams = true\n\n      // Build the sub-combination with parameters from index 0 to i (inclusive).\n      // This creates a prefix of the full parameter set, building up combinations incrementally.\n      //\n      // For example, if routeParamKeys = ['lang', 'region', 'slug'] and i = 1:\n      // - j=0: Add 'lang' parameter\n      // - j=1: Add 'region' parameter\n      // Result: { lang: 'en', region: 'US' }\n      for (let j = 0; j <= i; j++) {\n        const { paramName: routeKey } = childrenRouteParams[j]\n\n        // Check if the parameter exists in the original params object and has a defined value.\n        // This handles cases where generateStaticParams doesn't provide all possible parameters,\n        // or where some parameters are optional/undefined.\n        if (\n          !params.hasOwnProperty(routeKey) ||\n          params[routeKey] === undefined\n        ) {\n          // If this missing parameter is a Root Parameter, mark the combination as invalid.\n          // Root Parameters are required for Static Shells, so we can't generate partial combinations without them.\n          if (rootParamKeys.includes(routeKey)) {\n            hasAllRootParams = false\n          }\n          // Stop building this combination since we've hit a missing parameter.\n          // This ensures we only generate valid prefix combinations with consecutive parameters.\n          break\n        }\n\n        const value = params[routeKey]\n        combination[routeKey] = value\n\n        // Construct a unique key part for this parameter to enable deduplication.\n        // We use type prefixes to prevent collisions between different value types\n        // that might have the same string representation.\n        //\n        // Examples:\n        // - Array ['foo', 'bar'] becomes \"A:foo,bar\"\n        // - String \"foo,bar\" becomes \"S:foo,bar\"\n        // - This prevents collisions between ['foo', 'bar'] and \"foo,bar\"\n        let valuePart: string\n        if (Array.isArray(value)) {\n          valuePart = `A:${value.join(',')}`\n        } else {\n          valuePart = `S:${value}`\n        }\n        keyParts.push(`${routeKey}:${valuePart}`)\n      }\n\n      // Build the final unique key by joining all parameter parts.\n      // This key is used for deduplication in the combinations Map.\n      // Format: \"lang:S:en|region:S:US|slug:A:home,about\"\n      const currentKey = keyParts.join('|')\n\n      // Only add the combination if it meets our criteria:\n      // 1. hasAllRootParams: Contains all required Root Parameters\n      // 2. !combinations.has(currentKey): Is not a duplicate of an existing combination\n      //\n      // This ensures we only generate valid, unique parameter combinations for Static Shells.\n      if (hasAllRootParams && !combinations.has(currentKey)) {\n        combinations.set(currentKey, combination)\n      }\n    }\n  }\n\n  // Convert the Map's values back into an array and return the final result.\n  // The Map ensures all combinations are unique, and we return only the\n  // parameter objects themselves, discarding the internal deduplication keys.\n  return Array.from(combinations.values())\n}\n\n/**\n * Calculates the fallback mode based on the given parameters.\n *\n * @param dynamicParams - Whether dynamic params are enabled.\n * @param fallbackRootParams - The root params that are part of the fallback.\n * @param baseFallbackMode - The base fallback mode to use.\n * @returns The calculated fallback mode.\n */\nexport function calculateFallbackMode(\n  dynamicParams: boolean,\n  fallbackRootParams: readonly string[],\n  baseFallbackMode: FallbackMode | undefined\n): FallbackMode {\n  return dynamicParams\n    ? // If the fallback params includes any root params, then we need to\n      // perform a blocking static render.\n      fallbackRootParams.length > 0\n      ? FallbackMode.BLOCKING_STATIC_RENDER\n      : (baseFallbackMode ?? FallbackMode.NOT_FOUND)\n    : FallbackMode.NOT_FOUND\n}\n\n/**\n * Validates the parameters to ensure they're accessible and have the correct\n * types.\n *\n * @param page - The page to validate.\n * @param regex - The route regex.\n * @param isRoutePPREnabled - Whether the route has partial prerendering enabled.\n * @param pathnameSegments - The keys of the parameters.\n * @param rootParamKeys - The keys of the root params.\n * @param routeParams - The list of parameters to validate.\n * @returns The list of validated parameters.\n */\nfunction validateParams(\n  page: string,\n  isRoutePPREnabled: boolean,\n  pathnameSegments: ReadonlyArray<{\n    readonly paramName: string\n    readonly paramType: DynamicParamTypes\n  }>,\n  rootParamKeys: readonly string[],\n  routeParams: readonly Params[]\n): Params[] {\n  const valid: Params[] = []\n\n  // Validate that if there are any root params, that the user has provided at\n  // least one value for them only if we're using partial prerendering.\n  if (isRoutePPREnabled && rootParamKeys.length > 0) {\n    if (\n      routeParams.length === 0 ||\n      rootParamKeys.some((key) =>\n        routeParams.some((params) => !(key in params))\n      )\n    ) {\n      if (rootParamKeys.length === 1) {\n        throw new Error(\n          `A required root parameter (${rootParamKeys[0]}) was not provided in generateStaticParams for ${page}, please provide at least one value.`\n        )\n      }\n\n      throw new Error(\n        `Required root params (${rootParamKeys.join(', ')}) were not provided in generateStaticParams for ${page}, please provide at least one value for each.`\n      )\n    }\n  }\n\n  for (const params of routeParams) {\n    const item: Params = {}\n\n    for (const { paramName: key, paramType } of pathnameSegments) {\n      const { repeat, optional } = getParamProperties(paramType)\n\n      let paramValue = params[key]\n\n      if (\n        optional &&\n        params.hasOwnProperty(key) &&\n        (paramValue === null ||\n          paramValue === undefined ||\n          (paramValue as any) === false)\n      ) {\n        paramValue = []\n      }\n\n      // A parameter is missing, so the rest of the params are not accessible.\n      // We only support this when the route has partial prerendering enabled.\n      // This will make it so that the remaining params are marked as missing so\n      // we can generate a fallback route for them.\n      if (!paramValue && isRoutePPREnabled) {\n        break\n      }\n\n      // Perform validation for the parameter based on whether it's a repeat\n      // parameter or not.\n      if (repeat) {\n        if (!Array.isArray(paramValue)) {\n          throw new Error(\n            `A required parameter (${key}) was not provided as an array received ${typeof paramValue} in generateStaticParams for ${page}`\n          )\n        }\n      } else {\n        if (typeof paramValue !== 'string') {\n          throw new Error(\n            `A required parameter (${key}) was not provided as a string received ${typeof paramValue} in generateStaticParams for ${page}`\n          )\n        }\n      }\n\n      item[key] = paramValue\n    }\n\n    valid.push(item)\n  }\n\n  return valid\n}\n\ninterface TrieNode {\n  /**\n   * The children of the node. Each key is a unique string representation of a parameter value,\n   * and the value is the next TrieNode in the path.\n   */\n  children: Map<string, TrieNode>\n\n  /**\n   * The routes that are associated with this specific parameter combination (node).\n   * These are the routes whose concrete parameters lead to this node in the Trie.\n   */\n  routes: PrerenderedRoute[]\n}\n\n/**\n * Assigns static shell metadata to each prerendered route.\n * This function uses a Trie data structure to efficiently determine whether each route\n * should throw an error when its static shell is empty and whether a fallback shell\n * can still be completed into a more specific prerendered shell.\n *\n * A route should not throw on empty static shell if it has child routes in the Trie. For example,\n * if we have two routes, `/blog/first-post` and `/blog/[slug]`, the route for\n * `/blog/[slug]` should not throw because `/blog/first-post` is a more specific concrete route.\n *\n * @param prerenderedRoutes - The prerendered routes.\n * @param pathnameSegments - The pathname params and whether each one is still\n * prerenderable via generateStaticParams.\n */\nexport function assignStaticShellMetadata(\n  prerenderedRoutes: readonly PrerenderedRoute[],\n  pathnameSegments: ReadonlyArray<{\n    readonly paramName: string\n    readonly hasGenerateStaticParams: boolean\n  }>,\n  computeRemainingPrerenderableParams: boolean\n): void {\n  // If there are no routes to process, exit early.\n  if (prerenderedRoutes.length === 0) {\n    return\n  }\n\n  // Initialize the root of the Trie. This node represents the starting point\n  // before any parameters have been considered.\n  const root: TrieNode = { children: new Map(), routes: [] }\n\n  // Phase 1: Build the Trie.\n  // Iterate over each prerendered route and insert it into the Trie.\n  // Each route's concrete parameter values form a path in the Trie.\n  for (const route of prerenderedRoutes) {\n    let currentNode = root // Start building the path from the root for each route.\n\n    // Iterate through the sorted parameter keys. The order of keys is crucial\n    // for ensuring that routes with the same concrete parameters follow the\n    // same path in the Trie, regardless of the original order of properties\n    // in the `params` object.\n    for (const { paramName: key } of pathnameSegments) {\n      // Check if the current route actually has a concrete value for this parameter.\n      // If a dynamic segment is not filled (i.e., it's a fallback), it won't have\n      // this property, and we stop building the path for this route at this point.\n      if (route.params.hasOwnProperty(key)) {\n        const value = route.params[key]\n\n        // Generate a unique key for the parameter's value. This is critical\n        // to prevent collisions between different data types that might have\n        // the same string representation (e.g., `['a', 'b']` vs `'a,b'`).\n        // A type prefix (`A:` for Array, `S:` for String, `U:` for undefined)\n        // is added to the value to prevent collisions. This ensures that\n        // different types with the same string representation are treated as\n        // distinct.\n        let valueKey: string\n        if (Array.isArray(value)) {\n          valueKey = `A:${value.join(',')}`\n        } else if (value === undefined) {\n          valueKey = `U:undefined`\n        } else {\n          valueKey = `S:${value}`\n        }\n\n        // Look for a child node corresponding to this `valueKey` from the `currentNode`.\n        let childNode = currentNode.children.get(valueKey)\n        if (!childNode) {\n          // If the child node doesn't exist, create a new one and add it to\n          // the current node's children.\n          childNode = {\n            children: new Map(),\n            routes: [],\n          }\n          currentNode.children.set(valueKey, childNode)\n        }\n        // Move deeper into the Trie to the `childNode` for the next parameter.\n        currentNode = childNode\n      }\n    }\n    // After processing all concrete parameters for the route, add the full\n    // `PrerenderedRoute` object to the `routes` array of the `currentNode`.\n    // This node represents the unique concrete parameter combination for this route.\n    currentNode.routes.push(route)\n  }\n\n  // Phase 2: Traverse the Trie to assign the `throwOnEmptyStaticShell` property.\n  // This is done using an iterative Depth-First Search (DFS) approach with an\n  // explicit stack to avoid JavaScript's recursion depth limits (stack overflow)\n  // for very deep routing structures.\n  const stack: TrieNode[] = [root] // Initialize the stack with the root node.\n\n  while (stack.length > 0) {\n    const node = stack.pop()! // Pop the next node to process from the stack.\n\n    // `hasChildren` indicates if this node has any more specific concrete\n    // parameter combinations branching off from it. If true, it means this\n    // node represents a prefix for other, more specific routes.\n    const hasChildren = node.children.size > 0\n\n    // If the current node has routes associated with it (meaning, routes whose\n    // concrete parameters lead to this node's path in the Trie).\n    if (node.routes.length > 0) {\n      // Determine the minimum number of fallback parameters among all routes\n      // that are associated with this current Trie node. This is used to\n      // identify if a route should not throw on empty static shell relative to another route *at the same level*\n      // of concrete parameters, but with fewer fallback parameters.\n      let minFallbacks = Infinity\n      for (const r of node.routes) {\n        // `fallbackRouteParams?.length ?? 0` handles cases where `fallbackRouteParams`\n        // might be `undefined` or `null`, treating them as 0 length.\n        minFallbacks = Math.min(\n          minFallbacks,\n          r.fallbackRouteParams ? r.fallbackRouteParams.length : 0\n        )\n      }\n\n      // Now, for each `PrerenderedRoute` associated with this node:\n      for (const route of node.routes) {\n        // A route is ok not to throw on an empty static shell (and thus\n        // `throwOnEmptyStaticShell` should be `false`) if either of the\n        // following conditions is met:\n        // 1. `hasChildren` is true: This node has further concrete parameter children.\n        //    This means the current route is a parent to more specific routes (e.g.,\n        //    `/blog/[slug]` should not throw when concrete routes like `/blog/first-post` exist).\n        // OR\n        // 2. `route.fallbackRouteParams.length > minFallbacks`: This route has\n        //    more fallback parameters than another route at the same Trie node.\n        //    This implies the current route is a more general version that should not throw\n        //    compared to a more specific route that has fewer fallback parameters\n        //    (e.g., `/1234/[...slug]` should not throw relative to `/[id]/[...slug]`).\n        if (\n          hasChildren ||\n          (route.fallbackRouteParams &&\n            route.fallbackRouteParams.length > minFallbacks)\n        ) {\n          route.throwOnEmptyStaticShell = false // Should not throw on empty static shell.\n        } else {\n          route.throwOnEmptyStaticShell = true // Should throw on empty static shell.\n        }\n\n        if (\n          computeRemainingPrerenderableParams &&\n          route.fallbackRouteParams &&\n          route.fallbackRouteParams.length > 0\n        ) {\n          const fallbackRouteParamsByName = new Map(\n            route.fallbackRouteParams.map((param) => [param.paramName, param])\n          )\n          const remainingPrerenderableParams: FallbackRouteParam[] = []\n\n          // Only unresolved pathname params that can still be filled by\n          // generateStaticParams belong here. Once we hit an unresolved param\n          // that is purely dynamic, the rest of the shell also stays dynamic\n          // and cannot be completed into a more specific prerendered shell.\n          for (const segment of pathnameSegments) {\n            if (route.params.hasOwnProperty(segment.paramName)) {\n              continue\n            }\n\n            if (!segment.hasGenerateStaticParams) {\n              break\n            }\n\n            const fallbackRouteParam = fallbackRouteParamsByName.get(\n              segment.paramName\n            )\n            if (!fallbackRouteParam) {\n              break\n            }\n\n            remainingPrerenderableParams.push(fallbackRouteParam)\n          }\n\n          route.remainingPrerenderableParams =\n            remainingPrerenderableParams.length > 0\n              ? remainingPrerenderableParams\n              : undefined\n        }\n      }\n    }\n\n    // Add all children of the current node to the stack. This ensures that\n    // the traversal continues to explore deeper paths in the Trie.\n    for (const child of node.children.values()) {\n      stack.push(child)\n    }\n  }\n}\n\n/**\n * Calls a single generateStaticParams function within a WorkUnitStore context,\n * making root param getters available during static param generation.\n */\nasync function callGenerateStaticParams(\n  generateStaticParams: NonNullable<AppSegment['generateStaticParams']>,\n  workUnitAsyncStorage: WorkUnitAsyncStorage,\n  parentParams: Params,\n  rootParamKeys: readonly string[],\n  implicitTags: ImplicitTags\n): Promise<Params[]> {\n  const rootParams: Params = {}\n  for (const key of rootParamKeys) {\n    if (key in parentParams) {\n      rootParams[key] = parentParams[key]\n    }\n  }\n\n  const workUnitStore: GenerateStaticParamsStore = {\n    type: 'generate-static-params',\n    phase: 'render',\n    implicitTags,\n    rootParams,\n  }\n\n  return workUnitAsyncStorage.run(workUnitStore, generateStaticParams, {\n    params: parentParams,\n  })\n}\n\n/**\n * Processes app directory segments to build route parameters from generateStaticParams functions.\n * This function walks through the segments array and calls generateStaticParams for each segment that has it,\n * combining parent parameters with child parameters to build the complete parameter combinations.\n * Uses iterative processing instead of recursion for better performance.\n *\n * @param segments - Array of app directory segments to process\n * @param store - Work store for tracking fetch cache configuration\n * @param workUnitAsyncStorage - AsyncLocalStorage for work unit stores\n * @param isRoutePPREnabled - Whether PPR is enabled for this route\n * @param rootParamKeys - The keys identifying which params are root params\n * @returns Promise that resolves to an array of all parameter combinations\n */\nexport async function generateRouteStaticParams(\n  segments: ReadonlyArray<\n    Readonly<Pick<AppSegment, 'config' | 'generateStaticParams'>>\n  >,\n  store: Pick<WorkStore, 'fetchCache' | 'page'>,\n  workUnitAsyncStorage: WorkUnitAsyncStorage,\n  isRoutePPREnabled: boolean,\n  rootParamKeys: readonly string[]\n): Promise<Params[]> {\n  // Early return if no segments to process\n  if (segments.length === 0) return []\n\n  const implicitTags = await getImplicitTags(store.page, store.page, null)\n\n  // Use iterative processing with a work queue to avoid recursion overhead\n  interface WorkItem {\n    segmentIndex: number\n    params: Params[]\n  }\n\n  const queue: WorkItem[] = [{ segmentIndex: 0, params: [] }]\n  let currentParams: Params[] = []\n\n  while (queue.length > 0) {\n    const { segmentIndex, params } = queue.shift()!\n\n    // If we've processed all segments, this is our final result\n    if (segmentIndex >= segments.length) {\n      currentParams = params\n      break\n    }\n\n    const current = segments[segmentIndex]\n\n    // Skip segments without generateStaticParams and continue to next\n    if (typeof current.generateStaticParams !== 'function') {\n      queue.push({ segmentIndex: segmentIndex + 1, params })\n      continue\n    }\n\n    // Configure fetchCache if specified\n    if (current.config?.fetchCache !== undefined) {\n      store.fetchCache = current.config.fetchCache\n    }\n\n    const nextParams: Params[] = []\n\n    // If there are parent params, we need to process them.\n    if (params.length > 0) {\n      // Process each parent parameter combination\n      for (const parentParams of params) {\n        const result = await callGenerateStaticParams(\n          current.generateStaticParams,\n          workUnitAsyncStorage,\n          parentParams,\n          rootParamKeys,\n          implicitTags\n        )\n\n        if (result.length > 0) {\n          // Merge parent params with each result item\n          for (const item of result) {\n            nextParams.push({ ...parentParams, ...item })\n          }\n        } else if (isRoutePPREnabled) {\n          throwEmptyGenerateStaticParamsError()\n        } else {\n          // No results, just pass through parent params\n          nextParams.push(parentParams)\n        }\n      }\n    } else {\n      // No parent params, call generateStaticParams with empty object\n      const result = await callGenerateStaticParams(\n        current.generateStaticParams,\n        workUnitAsyncStorage,\n        {},\n        rootParamKeys,\n        implicitTags\n      )\n      if (result.length === 0 && isRoutePPREnabled) {\n        throwEmptyGenerateStaticParamsError()\n      }\n\n      nextParams.push(...result)\n    }\n\n    // Add next segment to work queue\n    queue.push({ segmentIndex: segmentIndex + 1, params: nextParams })\n  }\n\n  return currentParams\n}\n\nfunction createReplacements(\n  segment: Pick<AppSegment, 'paramType'>,\n  paramValue: string | string[]\n) {\n  // Determine the prefix to use for the interception marker.\n  let prefix: string\n  if (segment.paramType) {\n    prefix = interceptionPrefixFromParamType(segment.paramType) ?? ''\n  } else {\n    prefix = ''\n  }\n\n  return {\n    pathname:\n      prefix +\n      encodeParam(paramValue, (value) =>\n        // Only escape path delimiters if the value is a string, the following\n        // version will URL encode the value.\n        escapePathDelimiters(value, true)\n      ),\n    encodedPathname:\n      prefix +\n      encodeParam(\n        paramValue,\n        // URL encode the value.\n        encodeURIComponent\n      ),\n  }\n}\n\n/**\n * Processes app directory segments to build route parameters from generateStaticParams functions.\n * This function walks through the segments array and calls generateStaticParams for each segment that has it,\n * combining parent parameters with child parameters to build the complete parameter combinations.\n * Uses iterative processing instead of recursion for better performance.\n *\n * @param segments - Array of app directory segments to process\n * @param store - Work store for tracking fetch cache configuration\n * @returns Promise that resolves to an array of all parameter combinations\n */\nexport async function buildAppStaticPaths({\n  dir,\n  page,\n  route,\n  distDir,\n  cacheComponents,\n  authInterrupts,\n  segments,\n  isrFlushToDisk,\n  cacheHandler,\n  cacheLifeProfiles,\n  requestHeaders,\n  cacheHandlers,\n  cacheMaxMemorySize,\n  fetchCacheKeyPrefix,\n  nextConfigOutput,\n  ComponentMod,\n  isRoutePPREnabled = false,\n  partialFallbacksEnabled = false,\n  buildId,\n  rootParamKeys,\n}: {\n  dir: string\n  page: string\n  route: NormalizedAppRoute\n  cacheComponents: boolean\n  authInterrupts: boolean\n  segments: readonly Readonly<AppSegment>[]\n  distDir: string\n  isrFlushToDisk?: boolean\n  fetchCacheKeyPrefix?: string\n  cacheHandler?: string\n  cacheHandlers?: NextConfigComplete['cacheHandlers']\n  cacheLifeProfiles?: {\n    [profile: string]: import('../../server/use-cache/cache-life').CacheLife\n  }\n  cacheMaxMemorySize: number\n  requestHeaders: IncrementalCache['requestHeaders']\n  nextConfigOutput: 'standalone' | 'export' | undefined\n  ComponentMod: AppPageModule | AppRouteModule\n  isRoutePPREnabled: boolean\n  partialFallbacksEnabled?: boolean\n  buildId: string\n  rootParamKeys: readonly string[]\n}): Promise<StaticPathsResult> {\n  if (\n    segments.some((generate) => generate.config?.dynamicParams === true) &&\n    nextConfigOutput === 'export'\n  ) {\n    throw new Error(\n      '\"dynamicParams: true\" cannot be used with \"output: export\". See more info here: https://nextjs.org/docs/app/building-your-application/deploying/static-exports'\n    )\n  }\n\n  ComponentMod.patchFetch()\n\n  const incrementalCache = await createIncrementalCache({\n    dir,\n    distDir,\n    cacheHandler,\n    cacheHandlers,\n    requestHeaders,\n    fetchCacheKeyPrefix,\n    flushToDisk: isrFlushToDisk,\n    cacheMaxMemorySize,\n  })\n\n  // Extract segments that contribute to the pathname.\n  // For AppPageRouteModule: Traverses the loader tree to find all segments (including\n  //   interception routes in parallel slots) that match the pathname\n  // For AppRouteRouteModule: Filters the segments array to get non-parallel route params\n  const pathnameRouteParamSegments = extractPathnameRouteParamSegments(\n    ComponentMod.routeModule,\n    segments,\n    route\n  )\n\n  const afterRunner = new AfterRunner()\n\n  const store = createWorkStore({\n    page,\n    renderOpts: {\n      incrementalCache,\n      cacheLifeProfiles,\n      supportsDynamicResponse: true,\n      cacheComponents,\n      experimental: {\n        authInterrupts,\n      },\n      waitUntil: afterRunner.context.waitUntil,\n      onClose: afterRunner.context.onClose,\n      onAfterTaskError: afterRunner.context.onTaskError,\n    },\n    buildId,\n    previouslyRevalidatedTags: [],\n  })\n\n  const routeParams = await ComponentMod.workAsyncStorage.run(\n    store,\n    generateRouteStaticParams,\n    segments,\n    store,\n    ComponentMod.workUnitAsyncStorage,\n    isRoutePPREnabled,\n    rootParamKeys\n  )\n  const generatedParamNames = new Set<string>()\n  for (const params of routeParams) {\n    for (const paramName of Object.keys(params)) {\n      generatedParamNames.add(paramName)\n    }\n  }\n  const prerenderablePathSegments = pathnameRouteParamSegments.map(\n    (segment) => ({\n      paramName: segment.paramName,\n      hasGenerateStaticParams: generatedParamNames.has(segment.paramName),\n    })\n  )\n\n  await afterRunner.executeAfter()\n\n  let lastDynamicSegmentHadGenerateStaticParams = false\n  for (const segment of segments) {\n    // Check to see if there are any missing params for segments that have\n    // dynamicParams set to false.\n    if (\n      segment.paramName &&\n      segment.paramType &&\n      segment.config?.dynamicParams === false\n    ) {\n      for (const params of routeParams) {\n        if (segment.paramName in params) continue\n\n        const relative = segment.filePath\n          ? path.relative(dir, segment.filePath)\n          : undefined\n\n        throw new Error(\n          `Segment \"${relative}\" exports \"dynamicParams: false\" but the param \"${segment.paramName}\" is missing from the generated route params.`\n        )\n      }\n    }\n\n    if (\n      segment.paramName &&\n      segment.paramType &&\n      typeof segment.generateStaticParams !== 'function'\n    ) {\n      lastDynamicSegmentHadGenerateStaticParams = false\n    } else if (typeof segment.generateStaticParams === 'function') {\n      lastDynamicSegmentHadGenerateStaticParams = true\n    }\n  }\n\n  // Determine if all the segments have had their parameters provided.\n  const hadAllParamsGenerated =\n    pathnameRouteParamSegments.length === 0 ||\n    (routeParams.length > 0 &&\n      routeParams.every((params) => {\n        for (const { paramName } of pathnameRouteParamSegments) {\n          if (paramName in params) continue\n          return false\n        }\n        return true\n      }))\n\n  // TODO: dynamic params should be allowed to be granular per segment but\n  // we need additional information stored/leveraged in the prerender\n  // manifest to allow this behavior.\n  const dynamicParams = segments.every(\n    (segment) => segment.config?.dynamicParams !== false\n  )\n\n  const supportsRoutePreGeneration =\n    hadAllParamsGenerated || !process.env.__NEXT_DEV_SERVER\n\n  const fallbackMode = dynamicParams\n    ? supportsRoutePreGeneration\n      ? isRoutePPREnabled\n        ? FallbackMode.PRERENDER\n        : FallbackMode.BLOCKING_STATIC_RENDER\n      : undefined\n    : FallbackMode.NOT_FOUND\n\n  const prerenderedRoutesByPathname = new Map<string, PrerenderedRoute>()\n\n  // Convert rootParamKeys to Set for O(1) lookup.\n  const rootParamSet = new Set(rootParamKeys)\n\n  if (hadAllParamsGenerated || isRoutePPREnabled) {\n    let paramsToProcess = routeParams\n\n    if (isRoutePPREnabled) {\n      // Discover all unique combinations of the routeParams so we can generate\n      // routes that won't throw on empty static shell for each of them if\n      // they're available.\n      paramsToProcess = generateAllParamCombinations(\n        pathnameRouteParamSegments,\n        routeParams,\n        rootParamKeys\n      )\n\n      // Collect all the fallback route params for the segments.\n      const fallbackRouteParams: FallbackRouteParam[] = []\n      for (const segment of segments) {\n        if (!segment.paramName || !segment.paramType) continue\n        fallbackRouteParams.push({\n          paramName: segment.paramName,\n          paramType: segment.paramType,\n        })\n      }\n\n      // Add the base route, this is the route with all the placeholders as it's\n      // derived from the `page` string.\n      prerenderedRoutesByPathname.set(page, {\n        params: {},\n        pathname: page,\n        encodedPathname: page,\n        fallbackRouteParams,\n        fallbackMode: calculateFallbackMode(\n          dynamicParams,\n          rootParamKeys,\n          fallbackMode\n        ),\n        fallbackRootParams: rootParamKeys,\n        throwOnEmptyStaticShell: true,\n      })\n    }\n\n    filterUniqueParams(\n      pathnameRouteParamSegments,\n      validateParams(\n        page,\n        isRoutePPREnabled,\n        pathnameRouteParamSegments,\n        rootParamKeys,\n        paramsToProcess\n      )\n    ).forEach((params) => {\n      let pathname = page\n      let encodedPathname = page\n\n      const fallbackRouteParams: FallbackRouteParam[] = []\n\n      for (const { name, paramName, paramType } of pathnameRouteParamSegments) {\n        const paramValue = params[paramName]\n\n        if (!paramValue) {\n          if (isRoutePPREnabled) {\n            // Mark remaining params as fallback params.\n            fallbackRouteParams.push({ paramName, paramType })\n            for (\n              let i =\n                pathnameRouteParamSegments.findIndex(\n                  (param) => param.paramName === paramName\n                ) + 1;\n              i < pathnameRouteParamSegments.length;\n              i++\n            ) {\n              fallbackRouteParams.push({\n                paramName: pathnameRouteParamSegments[i].paramName,\n                paramType: pathnameRouteParamSegments[i].paramType,\n              })\n            }\n            break\n          } else {\n            // This route is not complete, and we aren't performing a partial\n            // prerender, so we should return, skipping this route.\n            return\n          }\n        }\n\n        const replacements = createReplacements({ paramType }, paramValue)\n\n        pathname = pathname.replace(\n          name,\n          // We're replacing the segment name with the replacement pathname\n          // which will include the interception marker prefix if it exists.\n          replacements.pathname\n        )\n\n        encodedPathname = encodedPathname.replace(\n          name,\n          // We're replacing the segment name with the replacement encoded\n          // pathname which will include the encoded param value.\n          replacements.encodedPathname\n        )\n      }\n\n      // Resolve all route params from the loader tree if this is from an\n      // app page. This processes both regular route params and parallel route params.\n      if (\n        'loaderTree' in ComponentMod.routeModule.userland &&\n        Array.isArray(ComponentMod.routeModule.userland.loaderTree)\n      ) {\n        resolveRouteParamsFromTree(\n          ComponentMod.routeModule.userland.loaderTree,\n          params,\n          route,\n          fallbackRouteParams\n        )\n      }\n\n      const fallbackRootParams: string[] = []\n      for (const { paramName } of fallbackRouteParams) {\n        // If the param is a root param then we can add it to the fallback\n        // root params.\n        if (rootParamSet.has(paramName)) {\n          fallbackRootParams.push(paramName)\n        }\n      }\n\n      pathname = normalizePathname(pathname)\n\n      prerenderedRoutesByPathname.set(pathname, {\n        params,\n        pathname,\n        encodedPathname: normalizePathname(encodedPathname),\n        fallbackRouteParams,\n        fallbackMode: calculateFallbackMode(\n          dynamicParams,\n          fallbackRootParams,\n          fallbackMode\n        ),\n        fallbackRootParams,\n        throwOnEmptyStaticShell: true,\n      })\n    })\n  }\n\n  const prerenderedRoutes =\n    prerenderedRoutesByPathname.size > 0 ||\n    lastDynamicSegmentHadGenerateStaticParams\n      ? [...prerenderedRoutesByPathname.values()]\n      : undefined\n\n  // Now we have to set the throwOnEmptyStaticShell for each of the routes.\n  if (prerenderedRoutes && cacheComponents) {\n    assignStaticShellMetadata(\n      prerenderedRoutes,\n      prerenderablePathSegments,\n      partialFallbacksEnabled\n    )\n  }\n\n  return { fallbackMode, prerenderedRoutes }\n}\n"],"names":["assignStaticShellMetadata","buildAppStaticPaths","calculateFallbackMode","filterUniqueParams","generateAllParamCombinations","generateRouteStaticParams","childrenRouteParams","routeParams","unique","Map","params","key","paramName","paramKey","value","valuePart","Array","isArray","join","undefined","has","set","from","values","rootParamKeys","combinations","minIndexForCompleteRootParams","length","rootParamKey","index","findIndex","param","Math","max","i","combination","keyParts","hasAllRootParams","j","routeKey","hasOwnProperty","includes","push","currentKey","dynamicParams","fallbackRootParams","baseFallbackMode","FallbackMode","BLOCKING_STATIC_RENDER","NOT_FOUND","validateParams","page","isRoutePPREnabled","pathnameSegments","valid","some","Error","item","paramType","repeat","optional","getParamProperties","paramValue","prerenderedRoutes","computeRemainingPrerenderableParams","root","children","routes","route","currentNode","valueKey","childNode","get","stack","node","pop","hasChildren","size","minFallbacks","Infinity","r","min","fallbackRouteParams","throwOnEmptyStaticShell","fallbackRouteParamsByName","map","remainingPrerenderableParams","segment","hasGenerateStaticParams","fallbackRouteParam","child","callGenerateStaticParams","generateStaticParams","workUnitAsyncStorage","parentParams","implicitTags","rootParams","workUnitStore","type","phase","run","segments","store","getImplicitTags","queue","segmentIndex","currentParams","current","shift","config","fetchCache","nextParams","result","throwEmptyGenerateStaticParamsError","createReplacements","prefix","interceptionPrefixFromParamType","pathname","encodeParam","escapePathDelimiters","encodedPathname","encodeURIComponent","dir","distDir","cacheComponents","authInterrupts","isrFlushToDisk","cacheHandler","cacheLifeProfiles","requestHeaders","cacheHandlers","cacheMaxMemorySize","fetchCacheKeyPrefix","nextConfigOutput","ComponentMod","partialFallbacksEnabled","buildId","generate","patchFetch","incrementalCache","createIncrementalCache","flushToDisk","pathnameRouteParamSegments","extractPathnameRouteParamSegments","routeModule","afterRunner","AfterRunner","createWorkStore","renderOpts","supportsDynamicResponse","experimental","waitUntil","context","onClose","onAfterTaskError","onTaskError","previouslyRevalidatedTags","workAsyncStorage","generatedParamNames","Set","Object","keys","add","prerenderablePathSegments","executeAfter","lastDynamicSegmentHadGenerateStaticParams","relative","filePath","path","hadAllParamsGenerated","every","supportsRoutePreGeneration","process","env","__NEXT_DEV_SERVER","fallbackMode","PRERENDER","prerenderedRoutesByPathname","rootParamSet","paramsToProcess","forEach","name","replacements","replace","userland","loaderTree","resolveRouteParamsFromTree","normalizePathname"],"mappings":";;;;;;;;;;;;;;;;;;;IA2agBA,yBAAyB;eAAzBA;;IAgWMC,mBAAmB;eAAnBA;;IA1eNC,qBAAqB;eAArBA;;IApPAC,kBAAkB;eAAlBA;;IA4FAC,4BAA4B;eAA5BA;;IA4fMC,yBAAyB;eAAzBA;;;iEA5nBL;8BACW;2BACI;0BACH;uBAOtB;6EAC0B;wCACM;iCAIJ;gDACiB;iDAGJ;8BAMhB;;;;;;AAUzB,SAASF,mBACdG,mBAAqD,EACrDC,WAA8B;IAE9B,2EAA2E;IAC3E,yEAAyE;IACzE,iCAAiC;IACjC,MAAMC,SAAS,IAAIC;IAEnB,yDAAyD;IACzD,KAAK,MAAMC,UAAUH,YAAa;QAChC,IAAII,MAAM,GAAG,sFAAsF;;QAEnG,yEAAyE;QACzE,0EAA0E;QAC1E,kCAAkC;QAClC,KAAK,MAAM,EAAEC,WAAWC,QAAQ,EAAE,IAAIP,oBAAqB;YACzD,MAAMQ,QAAQJ,MAAM,CAACG,SAAS;YAE9B,qEAAqE;YACrE,4FAA4F;YAC5F,qEAAqE;YACrE,0EAA0E;YAC1E,wEAAwE;YACxE,0CAA0C;YAC1C,IAAIE;YACJ,IAAIC,MAAMC,OAAO,CAACH,QAAQ;gBACxBC,YAAY,CAAC,EAAE,EAAED,MAAMI,IAAI,CAAC,MAAM;YACpC,OAAO,IAAIJ,UAAUK,WAAW;gBAC9BJ,YAAY,CAAC,WAAW,CAAC;YAC3B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