{"version":3,"sources":["../../../../src/build/templates/app-route.ts"],"sourcesContent":["import {\n  AppRouteRouteModule,\n  type AppRouteRouteHandlerContext,\n  type AppRouteRouteModuleOptions,\n} from '../../server/route-modules/app-route/module.compiled'\nimport { RouteKind } from '../../server/route-kind'\nimport { patchFetch as _patchFetch } from '../../server/lib/patch-fetch'\nimport type { IncomingMessage, ServerResponse } from 'node:http'\nimport {\n  addRequestMeta,\n  getRequestMeta,\n  setRequestMeta,\n  type RequestMeta,\n} from '../../server/request-meta'\nimport {\n  getTracer,\n  type Span,\n  SpanKind,\n  SpanStatusCode,\n} from '../../server/lib/trace/tracer'\nimport { setManifestsSingleton } from '../../server/app-render/manifests-singleton'\nimport { normalizeAppPath } from '../../shared/lib/router/utils/app-paths'\nimport { NodeNextRequest, NodeNextResponse } from '../../server/base-http/node'\nimport {\n  NextRequestAdapter,\n  signalFromNodeResponse,\n} from '../../server/web/spec-extension/adapters/next-request'\nimport { BaseServerSpan } from '../../server/lib/trace/constants'\nimport { getRevalidateReason } from '../../server/instrumentation/utils'\nimport { sendResponse } from '../../server/send-response'\nimport {\n  fromNodeOutgoingHttpHeaders,\n  toNodeOutgoingHttpHeaders,\n} from '../../server/web/utils'\nimport { getCacheControlHeader } from '../../server/lib/cache-control'\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from '../../lib/constants'\nimport { NoFallbackError } from '../../shared/lib/no-fallback-error.external'\nimport {\n  CachedRouteKind,\n  type ResponseCacheEntry,\n  type ResponseGenerator,\n} from '../../server/response-cache'\n\n// These are injected by the loader afterwards. This is injected as a variable\n// instead of a replacement because this could also be `undefined` instead of\n// an empty string.\ndeclare const nextConfigOutput: AppRouteRouteModuleOptions['nextConfigOutput']\n\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\n// INJECT:nextConfigOutput\n\nconst routeModule = new AppRouteRouteModule({\n  definition: {\n    kind: RouteKind.APP_ROUTE,\n    page: 'VAR_DEFINITION_PAGE',\n    pathname: 'VAR_DEFINITION_PATHNAME',\n    filename: 'VAR_DEFINITION_FILENAME',\n    bundlePath: 'VAR_DEFINITION_BUNDLE_PATH',\n  },\n  distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n  relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n  resolvedPagePath: 'VAR_RESOLVED_PAGE_PATH',\n  nextConfigOutput,\n  // The lazy require factory ensures that:\n  // - In dev: devRequestTimingInternalsEnd is set before userland executes,\n  //   correctly attributing module load time to application-code rather than\n  //   framework internals.\n  // - In all modes: async modules (route files with top-level await) are\n  //   handled correctly — require() returns a Promise for such modules, which\n  //   ensureUserland() awaits before the first request is handled.\n  userland: () => require('VAR_USERLAND') as typeof import('VAR_USERLAND'),\n  // In Turbopack dev mode, also provide a synchronous per-request getter so\n  // server HMR updates are picked up without re-executing the entry chunk.\n  // Using require() (synchronous) avoids adding async overhead that would be\n  // incorrectly attributed to application-code time in devRequestTiming.\n  ...(process.env.TURBOPACK && process.env.__NEXT_DEV_SERVER\n    ? {\n        getUserland: () =>\n          require('VAR_USERLAND') as typeof import('VAR_USERLAND'),\n      }\n    : {}),\n})\n\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule\n\nfunction patchFetch() {\n  return _patchFetch({\n    workAsyncStorage,\n    workUnitAsyncStorage,\n  })\n}\n\nexport {\n  routeModule,\n  workAsyncStorage,\n  workUnitAsyncStorage,\n  serverHooks,\n  patchFetch,\n}\n\nexport async function handler(\n  req: IncomingMessage,\n  res: ServerResponse,\n  ctx: {\n    waitUntil?: (prom: Promise<void>) => void\n    requestMeta?: RequestMeta\n  }\n) {\n  if (ctx.requestMeta) {\n    setRequestMeta(req, ctx.requestMeta)\n  }\n  if (routeModule.isDev) {\n    addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint())\n  }\n  let srcPage = 'VAR_DEFINITION_PAGE'\n\n  // turbopack doesn't normalize `/index` in the page name\n  // so we need to to process dynamic routes properly\n  // TODO: fix turbopack providing differing value from webpack\n  if (process.env.TURBOPACK) {\n    srcPage = srcPage.replace(/\\/index$/, '') || '/'\n  } else if (srcPage === '/index') {\n    // we always normalize /index specifically\n    srcPage = '/'\n  }\n  const multiZoneDraftMode = process.env\n    .__NEXT_MULTI_ZONE_DRAFT_MODE as any as boolean\n\n  const prepareResult = await routeModule.prepare(req, res, {\n    srcPage,\n    multiZoneDraftMode,\n  })\n\n  if (!prepareResult) {\n    res.statusCode = 400\n    res.end('Bad Request')\n    ctx.waitUntil?.(Promise.resolve())\n    return null\n  }\n\n  const {\n    buildId,\n    deploymentId,\n    params,\n    nextConfig,\n    parsedUrl,\n    isDraftMode,\n    prerenderManifest,\n    routerServerContext,\n    isOnDemandRevalidate,\n    revalidateOnlyGenerated,\n    resolvedPathname,\n    clientReferenceManifest,\n    serverActionsManifest,\n  } = prepareResult\n\n  const normalizedSrcPage = normalizeAppPath(srcPage)\n\n  let isIsr = Boolean(\n    prerenderManifest.dynamicRoutes[normalizedSrcPage] ||\n      prerenderManifest.routes[resolvedPathname]\n  )\n\n  const render404 = async () => {\n    // TODO: should route-module itself handle rendering the 404\n    if (routerServerContext?.render404) {\n      await routerServerContext.render404(req, res, parsedUrl, false)\n    } else {\n      res.end('This page could not be found')\n    }\n    return null\n  }\n\n  if (isIsr && !isDraftMode) {\n    const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname])\n    const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage]\n\n    if (prerenderInfo) {\n      if (prerenderInfo.fallback === false && !isPrerendered) {\n        if (nextConfig.adapterPath) {\n          return await render404()\n        }\n        throw new NoFallbackError()\n      }\n    }\n  }\n\n  let cacheKey: string | null = null\n\n  if (isIsr && !routeModule.isDev && !isDraftMode) {\n    cacheKey = resolvedPathname\n    // ensure /index and / is normalized to one key\n    cacheKey = cacheKey === '/index' ? '/' : cacheKey\n  }\n\n  const supportsDynamicResponse: boolean =\n    // If we're in development, we always support dynamic HTML\n    routeModule.isDev === true ||\n    // If this is not SSG or does not have static paths, then it supports\n    // dynamic HTML.\n    !isIsr\n\n  // This is a revalidation request if the request is for a static\n  // page and it is not being resumed from a postponed render and\n  // it is not a dynamic RSC request then it is a revalidation\n  // request.\n  const isStaticGeneration = isIsr && !supportsDynamicResponse\n\n  // Before rendering (which initializes component tree modules), we have to\n  // set the reference manifests to our global store so Server Action's\n  // encryption util can access to them at the top level of the page module.\n  if (serverActionsManifest && clientReferenceManifest) {\n    setManifestsSingleton({\n      page: srcPage,\n      clientReferenceManifest,\n      serverActionsManifest,\n    })\n  }\n\n  const method = req.method || 'GET'\n  const tracer = getTracer()\n  const activeSpan = tracer.getActiveScopeSpan()\n  const isWrappedByNextServer = Boolean(\n    routerServerContext?.isWrappedByNextServer\n  )\n  const isMinimalMode = Boolean(getRequestMeta(req, 'minimalMode'))\n\n  const incrementalCache =\n    getRequestMeta(req, 'incrementalCache') ||\n    (await routeModule.getIncrementalCache(\n      req,\n      nextConfig,\n      prerenderManifest,\n      isMinimalMode\n    ))\n\n  incrementalCache?.resetRequestCache()\n  ;(globalThis as any).__incrementalCache = incrementalCache\n\n  const context: AppRouteRouteHandlerContext = {\n    params,\n    previewProps: prerenderManifest.preview,\n    renderOpts: {\n      experimental: {\n        authInterrupts: Boolean(nextConfig.experimental.authInterrupts),\n        useCacheTimeout: nextConfig.experimental.useCacheTimeout,\n      },\n      cacheComponents: Boolean(nextConfig.cacheComponents),\n      validationLevel: nextConfig.experimental.instantInsights.validationLevel,\n      supportsDynamicResponse,\n      incrementalCache,\n      hmrRefreshHash: getRequestMeta(req, 'hmrRefreshHash'),\n      cacheLifeProfiles: nextConfig.cacheLife,\n      staticPageGenerationTimeout: nextConfig.staticPageGenerationTimeout,\n      waitUntil: ctx.waitUntil,\n      onClose: (cb) => {\n        res.on('close', cb)\n      },\n      onAfterTaskError: undefined,\n      onInstrumentationRequestError: (\n        error,\n        _request,\n        errorContext,\n        silenceLog\n      ) =>\n        routeModule.onRequestError(\n          req,\n          error,\n          errorContext,\n          silenceLog,\n          routerServerContext\n        ),\n    },\n    sharedContext: {\n      buildId,\n      deploymentId,\n    },\n  }\n  const nodeNextReq = new NodeNextRequest(req)\n  const nodeNextRes = new NodeNextResponse(res)\n\n  const nextReq = NextRequestAdapter.fromNodeNextRequest(\n    nodeNextReq,\n    signalFromNodeResponse(res)\n  )\n\n  const responseGenerator: ResponseGenerator = async ({\n    previousCacheEntry,\n  }) => {\n    try {\n      if (\n        !isMinimalMode &&\n        isOnDemandRevalidate &&\n        revalidateOnlyGenerated &&\n        !previousCacheEntry\n      ) {\n        res.statusCode = 404\n        // on-demand revalidate always sets this header\n        res.setHeader('x-nextjs-cache', 'REVALIDATED')\n        res.end('This page could not be found')\n        return null\n      }\n\n      const response = await routeModule.handle(nextReq, context)\n\n      ;(req as any).fetchMetrics = (context.renderOpts as any).fetchMetrics\n      let pendingWaitUntil = context.renderOpts.pendingWaitUntil\n\n      // Attempt using provided waitUntil if available\n      // if it's not we fallback to sendResponse's handling\n      if (pendingWaitUntil) {\n        if (ctx.waitUntil) {\n          ctx.waitUntil(pendingWaitUntil)\n          pendingWaitUntil = undefined\n        }\n      }\n      const cacheTags = context.renderOpts.collectedTags\n\n      // If the request is for a static response, we can cache it so long\n      // as it's not edge.\n      if (isIsr) {\n        const blob = await response.blob()\n\n        // Copy the headers from the response.\n        const headers = toNodeOutgoingHttpHeaders(response.headers)\n\n        if (cacheTags) {\n          headers[NEXT_CACHE_TAGS_HEADER] = cacheTags\n        }\n\n        if (!headers['content-type'] && blob.type) {\n          headers['content-type'] = blob.type\n        }\n\n        const revalidate =\n          typeof context.renderOpts.collectedRevalidate === 'undefined' ||\n          context.renderOpts.collectedRevalidate >= INFINITE_CACHE\n            ? false\n            : context.renderOpts.collectedRevalidate\n\n        const expire =\n          typeof context.renderOpts.collectedExpire === 'undefined' ||\n          context.renderOpts.collectedExpire >= INFINITE_CACHE\n            ? // Fall back to the global `expireTime` config when the\n              // route has a numeric `revalidate` but didn't declare an\n              // explicit `expire` (e.g. via `cacheLife`). This mirrors the\n              // build-time fallback in `build/index.ts` so cache entries\n              // and the response Cache-Control header agree on the route's\n              // effective expire. Routes that opt out of revalidation\n              // (`revalidate: false`) or that are dynamic (`revalidate: 0`)\n              // keep `expire: undefined`.\n              revalidate !== false && revalidate > 0\n              ? nextConfig.expireTime\n              : undefined\n            : context.renderOpts.collectedExpire\n\n        // Create the cache entry for the response.\n        const cacheEntry: ResponseCacheEntry = {\n          value: {\n            kind: CachedRouteKind.APP_ROUTE,\n            status: response.status,\n            body: Buffer.from(await blob.arrayBuffer()),\n            headers,\n          },\n          cacheControl: { revalidate, expire },\n        }\n\n        return cacheEntry\n      } else {\n        // send response without caching if not ISR\n        await sendResponse(nodeNextReq, nodeNextRes, response, pendingWaitUntil)\n        return null\n      }\n    } catch (err) {\n      // if this is a background revalidate we need to report\n      // the request error here as it won't be bubbled\n      if (previousCacheEntry?.isStale) {\n        const silenceLog = false\n        await routeModule.onRequestError(\n          req,\n          err,\n          {\n            routerKind: 'App Router',\n            routePath: srcPage,\n            routeType: 'route',\n            revalidateReason: getRevalidateReason({\n              isStaticGeneration,\n              isOnDemandRevalidate,\n            }),\n          },\n          silenceLog,\n          routerServerContext\n        )\n      }\n      throw err\n    }\n  }\n\n  const handleResponse = async (\n    currentSpan: Span | undefined,\n    parentSpan: Span | undefined\n  ) => {\n    try {\n      const cacheEntry = await routeModule.handleResponse({\n        req,\n        nextConfig,\n        cacheKey,\n        routeKind: RouteKind.APP_ROUTE,\n        isFallback: false,\n        prerenderManifest,\n        isRoutePPREnabled: false,\n        isOnDemandRevalidate,\n        revalidateOnlyGenerated,\n        responseGenerator,\n        waitUntil: ctx.waitUntil,\n        isMinimalMode,\n      })\n\n      // we don't create a cacheEntry for ISR\n      if (!isIsr) {\n        return\n      }\n\n      if (cacheEntry?.value?.kind !== CachedRouteKind.APP_ROUTE) {\n        throw new Error(\n          `Invariant: app-route received invalid cache entry ${cacheEntry?.value?.kind}`\n        )\n      }\n\n      if (!isMinimalMode) {\n        res.setHeader(\n          'x-nextjs-cache',\n          isOnDemandRevalidate\n            ? 'REVALIDATED'\n            : cacheEntry.isMiss\n              ? 'MISS'\n              : cacheEntry.isStale\n                ? 'STALE'\n                : 'HIT'\n        )\n      }\n\n      // Draft mode should never be cached\n      if (isDraftMode) {\n        res.setHeader(\n          'Cache-Control',\n          'private, no-cache, no-store, max-age=0, must-revalidate'\n        )\n      }\n\n      const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers)\n\n      if (!(isMinimalMode && isIsr)) {\n        headers.delete(NEXT_CACHE_TAGS_HEADER)\n      }\n\n      // If cache control is already set on the response we don't\n      // override it to allow users to customize it via next.config\n      if (\n        cacheEntry.cacheControl &&\n        !res.getHeader('Cache-Control') &&\n        !headers.get('Cache-Control')\n      ) {\n        headers.set(\n          'Cache-Control',\n          getCacheControlHeader(cacheEntry.cacheControl)\n        )\n      }\n\n      await sendResponse(\n        nodeNextReq,\n        nodeNextRes,\n        // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n        new Response(cacheEntry.value.body, {\n          headers,\n          status: cacheEntry.value.status || 200,\n        })\n      )\n      return\n    } catch (err) {\n      if (!(err instanceof NoFallbackError)) {\n        const silenceLog = false\n        await routeModule.onRequestError(\n          req,\n          err,\n          {\n            routerKind: 'App Router',\n            routePath: normalizedSrcPage,\n            routeType: 'route',\n            revalidateReason: getRevalidateReason({\n              isStaticGeneration,\n              isOnDemandRevalidate,\n            }),\n          },\n          silenceLog,\n          routerServerContext\n        )\n      }\n\n      // rethrow so that we can handle serving error page\n\n      // If this is during static generation, throw the error again.\n      if (isIsr) throw err\n\n      // Otherwise, send a 500 response.\n      await sendResponse(\n        nodeNextReq,\n        nodeNextRes,\n        new Response(null, { status: 500 })\n      )\n      return\n    } finally {\n      ;(() => {\n        if (!currentSpan) {\n          return\n        }\n\n        let statusCode = res.statusCode\n\n        currentSpan.setAttributes({\n          'http.status_code': statusCode,\n          'next.rsc': false,\n        })\n\n        if (statusCode && statusCode >= 500) {\n          // For 5xx status codes: SHOULD be set to 'Error' span status.\n          // x-ref: https://opentelemetry.io/docs/specs/semconv/http/http-spans/#status\n          currentSpan.setStatus({\n            code: SpanStatusCode.ERROR,\n          })\n          // For span status 'Error', SHOULD set 'error.type' attribute.\n          currentSpan.setAttribute('error.type', statusCode.toString())\n        }\n\n        const rootSpanAttributes = tracer.getRootSpanAttributes()\n        // We were unable to get attributes, probably OTEL is not enabled\n        if (!rootSpanAttributes) {\n          return\n        }\n\n        if (\n          rootSpanAttributes.get('next.span_type') !==\n          BaseServerSpan.handleRequest\n        ) {\n          console.warn(\n            `Unexpected root span type '${rootSpanAttributes.get(\n              'next.span_type'\n            )}'. Please report this Next.js issue https://github.com/vercel/next.js`\n          )\n          return\n        }\n\n        const route = rootSpanAttributes.get('next.route') || normalizedSrcPage\n        const name = `${method} ${route}`\n\n        currentSpan.setAttributes({\n          'next.route': route,\n          'http.route': route,\n          'next.span_name': name,\n        })\n        currentSpan.updateName(name)\n\n        // Propagate http.route to the parent span if one exists (e.g.\n        // a platform-created HTTP span in adapter deployments).\n        if (parentSpan && parentSpan !== currentSpan) {\n          parentSpan.setAttribute('http.route', route)\n          parentSpan.updateName(name)\n        }\n      })()\n    }\n  }\n\n  // TODO: activeSpan code path is for when wrapped by\n  // next-server can be removed when this is no longer used\n  if (isWrappedByNextServer && activeSpan) {\n    await handleResponse(activeSpan, undefined)\n  } else {\n    let parentSpan = tracer.getActiveScopeSpan()\n    await tracer.withPropagatedContext(\n      req.headers,\n      () =>\n        tracer.trace(\n          BaseServerSpan.handleRequest,\n          {\n            spanName: `${method} ${srcPage}`,\n            kind: SpanKind.SERVER,\n            attributes: {\n              'http.method': method,\n              'http.target': req.url,\n            },\n          },\n          (span) => handleResponse(span, parentSpan)\n        ),\n      undefined,\n      !isWrappedByNextServer\n    )\n  }\n}\n"],"names":["AppRouteRouteModule","RouteKind","patchFetch","_patchFetch","addRequestMeta","getRequestMeta","setRequestMeta","getTracer","SpanKind","SpanStatusCode","setManifestsSingleton","normalizeAppPath","NodeNextRequest","NodeNextResponse","NextRequestAdapter","signalFromNodeResponse","BaseServerSpan","getRevalidateReason","sendResponse","fromNodeOutgoingHttpHeaders","toNodeOutgoingHttpHeaders","getCacheControlHeader","INFINITE_CACHE","NEXT_CACHE_TAGS_HEADER","NoFallbackError","CachedRouteKind","routeModule","definition","kind","APP_ROUTE","page","pathname","filename","bundlePath","distDir","process","env","__NEXT_RELATIVE_DIST_DIR","relativeProjectDir","__NEXT_RELATIVE_PROJECT_DIR","resolvedPagePath","nextConfigOutput","userland","require","TURBOPACK","__NEXT_DEV_SERVER","getUserland","workAsyncStorage","workUnitAsyncStorage","serverHooks","handler","req","res","ctx","requestMeta","isDev","hrtime","bigint","srcPage","replace","multiZoneDraftMode","__NEXT_MULTI_ZONE_DRAFT_MODE","prepareResult","prepare","statusCode","end","waitUntil","Promise","resolve","buildId","deploymentId","params","nextConfig","parsedUrl","isDraftMode","prerenderManifest","routerServerContext","isOnDemandRevalidate","revalidateOnlyGenerated","resolvedPathname","clientReferenceManifest","serverActionsManifest","normalizedSrcPage","isIsr","Boolean","dynamicRoutes","routes","render404","isPrerendered","prerenderInfo","fallback","adapterPath","cacheKey","supportsDynamicResponse","isStaticGeneration","method","tracer","activeSpan","getActiveScopeSpan","isWrappedByNextServer","isMinimalMode","incrementalCache","getIncrementalCache","resetRequestCache","globalThis","__incrementalCache","context","previewProps","preview","renderOpts","experimental","authInterrupts","useCacheTimeout","cacheComponents","validationLevel","instantInsights","hmrRefreshHash","cacheLifeProfiles","cacheLife","staticPageGenerationTimeout","onClose","cb","on","onAfterTaskError","undefined","onInstrumentationRequestError","error","_request","errorContext","silenceLog","onRequestError","sharedContext","nodeNextReq","nodeNextRes","nextReq","fromNodeNextRequest","responseGenerator","previousCacheEntry","setHeader","response","handle","fetchMetrics","pendingWaitUntil","cacheTags","collectedTags","blob","headers","type","revalidate","collectedRevalidate","expire","collectedExpire","expireTime","cacheEntry","value","status","body","Buffer","from","arrayBuffer","cacheControl","err","isStale","routerKind","routePath","routeType","revalidateReason","handleResponse","currentSpan","parentSpan","routeKind","isFallback","isRoutePPREnabled","Error","isMiss","delete","getHeader","get","set","Response","setAttributes","setStatus","code","ERROR","setAttribute","toString","rootSpanAttributes","getRootSpanAttributes","handleRequest","console","warn","route","name","updateName","withPropagatedContext","trace","spanName","SERVER","attributes","url","span"],"mappings":"AAAA,SACEA,mBAAmB,QAGd,uDAAsD;AAC7D,SAASC,SAAS,QAAQ,0BAAyB;AACnD,SAASC,cAAcC,WAAW,QAAQ,+BAA8B;AAExE,SACEC,cAAc,EACdC,cAAc,EACdC,cAAc,QAET,4BAA2B;AAClC,SACEC,SAAS,EAETC,QAAQ,EACRC,cAAc,QACT,gCAA+B;AACtC,SAASC,qBAAqB,QAAQ,8CAA6C;AACnF,SAASC,gBAAgB,QAAQ,0CAAyC;AAC1E,SAASC,eAAe,EAAEC,gBAAgB,QAAQ,8BAA6B;AAC/E,SACEC,kBAAkB,EAClBC,sBAAsB,QACjB,wDAAuD;AAC9D,SAASC,cAAc,QAAQ,mCAAkC;AACjE,SAASC,mBAAmB,QAAQ,qCAAoC;AACxE,SAASC,YAAY,QAAQ,6BAA4B;AACzD,SACEC,2BAA2B,EAC3BC,yBAAyB,QACpB,yBAAwB;AAC/B,SAASC,qBAAqB,QAAQ,iCAAgC;AACtE,SAASC,cAAc,EAAEC,sBAAsB,QAAQ,sBAAqB;AAC5E,SAASC,eAAe,QAAQ,8CAA6C;AAC7E,SACEC,eAAe,QAGV,8BAA6B;AAOpC,2EAA2E;AAC3E,UAAU;AACV,0BAA0B;AAE1B,MAAMC,cAAc,IAAI1B,oBAAoB;IAC1C2B,YAAY;QACVC,MAAM3B,UAAU4B,SAAS;QACzBC,MAAM;QACNC,UAAU;QACVC,UA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