{"version":3,"sources":["../../../../src/build/segment-config/pages/pages-segment-config.ts"],"sourcesContent":["import { z } from 'next/dist/compiled/zod'\nimport { formatZodError } from '../../../shared/lib/zod'\n\n/**\n * The schema for the page segment config.\n */\nconst PagesSegmentConfigSchema = z.object({\n  /**\n   * The runtime to use for the page.\n   */\n  runtime: z.enum(['edge', 'experimental-edge', 'nodejs']).optional(),\n\n  /**\n   * The maximum duration for the page render.\n   */\n  maxDuration: z.number().optional(),\n\n  /**\n   * The exported config object for the page.\n   */\n  config: z\n    .object({\n      /**\n       * The runtime to use for the page.\n       */\n      runtime: z.enum(['edge', 'experimental-edge', 'nodejs']).optional(),\n\n      /**\n       * The maximum duration for the page render.\n       */\n      maxDuration: z.number().optional(),\n    })\n    .optional(),\n})\n\n/**\n * Parse the page segment config.\n * @param data - The data to parse.\n * @param route - The route of the page.\n * @returns The parsed page segment config.\n */\nexport function parsePagesSegmentConfig(\n  data: unknown,\n  route: string\n): PagesSegmentConfig {\n  const parsed = PagesSegmentConfigSchema.safeParse(data, {})\n  if (!parsed.success) {\n    throw formatZodError(\n      `Invalid segment configuration options detected for \"${route}\". Read more at https://nextjs.org/docs/messages/invalid-page-config`,\n      parsed.error\n    )\n  }\n\n  return parsed.data\n}\n\n/**\n * The keys of the configuration for a page.\n *\n * @internal - required to exclude zod types from the build\n */\nexport const PagesSegmentConfigSchemaKeys =\n  PagesSegmentConfigSchema.keyof().options\n\nexport type PagesSegmentConfigConfig = {\n  /**\n   * The maximum duration for the page render.\n   */\n  maxDuration?: number\n\n  /**\n   * The runtime to use for the page.\n   */\n  runtime?: 'edge' | 'experimental-edge' | 'nodejs'\n\n  /**\n   * The preferred region for the page.\n   */\n  regions?: string[]\n}\n\nexport type PagesSegmentConfig = {\n  /**\n   * The runtime to use for the page.\n   */\n  runtime?: 'edge' | 'experimental-edge' | 'nodejs'\n\n  /**\n   * The maximum duration for the page render.\n   */\n  maxDuration?: number\n\n  /**\n   * The exported config object for the page.\n   */\n  config?: PagesSegmentConfigConfig\n}\n"],"names":["PagesSegmentConfigSchemaKeys","parsePagesSegmentConfig","PagesSegmentConfigSchema","z","object","runtime","enum","optional","maxDuration","number","config","data","route","parsed","safeParse","success","formatZodError","error","keyof","options"],"mappings":";;;;;;;;;;;;;;;IA6DaA,4BAA4B;eAA5BA;;IApBGC,uBAAuB;eAAvBA;;;qBAzCE;sBACa;AAE/B;;CAEC,GACD,MAAMC,2BAA2BC,MAAC,CAACC,MAAM,CAAC;IACxC;;GAEC,GACDC,SAASF,MAAC,CAACG,IAAI,CAAC;QAAC;QAAQ;QAAqB;KAAS,EAAEC,QAAQ;IAEjE;;GAEC,GACDC,aAAaL,MAAC,CAACM,MAAM,GAAGF,QAAQ;IAEhC;;GAEC,GACDG,QAAQP,MAAC,CACNC,MAAM,CAAC;QACN;;OAEC,GACDC,SAASF,MAAC,CAACG,IAAI,CAAC;YAAC;YAAQ;YAAqB;SAAS,EAAEC,QAAQ;QAEjE;;OAEC,GACDC,aAAaL,MAAC,CAACM,MAAM,GAAGF,QAAQ;IAClC,GACCA,QAAQ;AACb;AAQO,SAASN,wBACdU,IAAa,EACbC,KAAa;IAEb,MAAMC,SAASX,yBAAyBY,SAAS,CAACH,MAAM,CAAC;IACzD,IAAI,CAACE,OAAOE,OAAO,EAAE;QACnB,MAAMC,IAAAA,oBAAc,EAClB,CAAC,oDAAoD,EAAEJ,MAAM,oEAAoE,CAAC,EAClIC,OAAOI,KAAK;IAEhB;IAEA,OAAOJ,OAAOF,IAAI;AACpB;AAOO,MAAMX,+BACXE,yBAAyBgB,KAAK,GAAGC,OAAO","ignoreList":[0]}