/
opt
/
canhelp
/
node_modules
/
next
/
dist
/
esm
/
server
/
lib
/
/opt/canhelp/node_modules/next/dist/esm/server/lib
mkdir
upload
Name
Size
Mode
Actions
cache-handlers/
-
0755
rm
experimental/
-
0755
rm
incremental-cache/
-
0755
rm
module-loader/
-
0755
rm
router-utils/
-
0755
rm
server-ipc/
-
0755
rm
trace/
-
0755
rm
app-dir-module.js
1164
0644
edit
dl
rm
app-dir-module.js.map
2598
0644
edit
dl
rm
app-info-log.js
2723
0644
edit
dl
rm
app-info-log.js.map
5827
0644
edit
dl
rm
async-callback-set.js
519
0644
edit
dl
rm
async-callback-set.js.map
1097
0644
edit
dl
rm
cache-control.js
583
0644
edit
dl
rm
cache-control.js.map
1622
0644
edit
dl
rm
chrome-devtools-workspace.js
2297
0644
edit
dl
rm
chrome-devtools-workspace.js.map
4145
0644
edit
dl
rm
clone-response.js
2883
0644
edit
dl
rm
clone-response.js.map
4441
0644
edit
dl
rm
cpu-profile.js
1020
0644
edit
dl
rm
cpu-profile.js.map
2061
0644
edit
dl
rm
decode-query-path-parameter.js
458
0644
edit
dl
rm
decode-query-path-parameter.js.map
740
0644
edit
dl
rm
dedupe-fetch.js
5085
0644
edit
dl
rm
dedupe-fetch.js.map
7374
0644
edit
dl
rm
dev-bundler-service.js
3110
0644
edit
dl
rm
dev-bundler-service.js.map
5838
0644
edit
dl
rm
disk-lru-cache.external.js
1857
0644
edit
dl
rm
disk-lru-cache.external.js.map
3149
0644
edit
dl
rm
etag.js
1148
0644
edit
dl
rm
etag.js.map
2165
0644
edit
dl
rm
find-page-file.js
5445
0644
edit
dl
rm
find-page-file.js.map
9480
0644
edit
dl
rm
fix-mojibake.js
523
0644
edit
dl
rm
fix-mojibake.js.map
1026
0644
edit
dl
rm
format-hostname.js
332
0644
edit
dl
rm
format-hostname.js.map
616
0644
edit
dl
rm
i18n-provider.js
5531
0644
edit
dl
rm
i18n-provider.js.map
9041
0644
edit
dl
rm
implicit-tags.js
2450
0644
edit
dl
rm
implicit-tags.js.map
5238
0644
edit
dl
rm
is-ipv6.js
2090
0644
edit
dl
rm
is-ipv6.js.map
3388
0644
edit
dl
rm
lazy-result.js
939
0644
edit
dl
rm
lazy-result.js.map
1869
0644
edit
dl
rm
lru-cache.js
7148
0644
edit
dl
rm
lru-cache.js.map
11374
0644
edit
dl
rm
match-next-data-pathname.js
312
0644
edit
dl
rm
match-next-data-pathname.js.map
629
0644
edit
dl
rm
mock-request.js
13753
0644
edit
dl
rm
mock-request.js.map
21224
0644
edit
dl
rm
node-fs-methods.js
364
0644
edit
dl
rm
node-fs-methods.js.map
946
0644
edit
dl
rm
parse-stack.js
1561
0644
edit
dl
rm
parse-stack.js.map
2983
0644
edit
dl
rm
patch-fetch.js
44939
0644
edit
dl
rm
patch-fetch.js.map
64721
0644
edit
dl
rm
patch-set-header.js
1368
0644
edit
dl
rm
patch-set-header.js.map
2471
0644
edit
dl
rm
render-server.js
2988
0644
edit
dl
rm
render-server.js.map
6276
0644
edit
dl
rm
router-server.js
30029
0644
edit
dl
rm
router-server.js.map
46752
0644
edit
dl
rm
server-action-request-meta.js
1530
0644
edit
dl
rm
server-action-request-meta.js.map
3030
0644
edit
dl
rm
source-maps.js
8172
0644
edit
dl
rm
source-maps.js.map
14812
0644
edit
dl
rm
start-server.js
16797
0644
edit
dl
rm
start-server.js.map
27727
0644
edit
dl
rm
streaming-metadata.js
762
0644
edit
dl
rm
streaming-metadata.js.map
1582
0644
edit
dl
rm
to-route.js
582
0644
edit
dl
rm
to-route.js.map
848
0644
edit
dl
rm
types.js
46
0644
edit
dl
rm
types.js.map
451
0644
edit
dl
rm
utils.js
8516
0644
edit
dl
rm
utils.js.map
13627
0644
edit
dl
rm
worker-utils.js
755
0644
edit
dl
rm
worker-utils.js.map
1120
0644
edit
dl
rm
Edit:
/opt/canhelp/node_modules/next/dist/esm/server/lib/i18n-provider.js.map
(9041B)
{"version":3,"sources":["../../../src/server/lib/i18n-provider.ts"],"sourcesContent":["import type { DomainLocale, I18NConfig } from '../config-shared'\nimport { getRequestMeta, type NextIncomingMessage } from '../request-meta'\n\n/**\n * The result of matching a locale aware route.\n */\nexport interface LocaleAnalysisResult {\n /**\n * The pathname without the locale prefix (if any).\n */\n pathname: string\n\n /**\n * The detected locale. If no locale was detected, this will be `undefined`.\n */\n detectedLocale?: string\n\n /**\n * True if the locale was inferred from the default locale.\n */\n inferredFromDefault: boolean\n}\n\ntype LocaleAnalysisOptions = {\n /**\n * When provided, it will be used as the default locale if the locale\n * cannot be inferred from the pathname.\n */\n defaultLocale?: string\n}\n\n/**\n * The I18NProvider is used to match locale aware routes, detect the locale from\n * the pathname and hostname and normalize the pathname by removing the locale\n * prefix.\n */\nexport class I18NProvider {\n private readonly lowerCaseLocales: ReadonlyArray<string>\n private readonly lowerCaseDomains?: ReadonlyArray<\n DomainLocale & {\n // The configuration references a domain with an optional port, but the\n // hostname is always the domain without the port and is used for\n // matching.\n hostname: string\n }\n >\n\n constructor(public readonly config: Readonly<I18NConfig>) {\n if (!config.locales.length) {\n throw new Error('Invariant: No locales provided')\n }\n\n this.lowerCaseLocales = config.locales.map((locale) => locale.toLowerCase())\n this.lowerCaseDomains = config.domains?.map((domainLocale) => {\n const domain = domainLocale.domain.toLowerCase()\n return {\n defaultLocale: domainLocale.defaultLocale.toLowerCase(),\n hostname: domain.split(':', 1)[0],\n domain,\n locales: domainLocale.locales?.map((locale) => locale.toLowerCase()),\n http: domainLocale.http,\n }\n })\n }\n\n /**\n * Detects the domain locale from the hostname and the detected locale if\n * provided.\n *\n * @param hostname The hostname to detect the domain locale from, this must be lowercased.\n * @param detectedLocale The detected locale to use if the hostname does not match.\n * @returns The domain locale if found, `undefined` otherwise.\n */\n public detectDomainLocale(\n hostname?: string,\n detectedLocale?: string\n ): DomainLocale | undefined {\n if (!hostname || !this.lowerCaseDomains || !this.config.domains) return\n\n if (detectedLocale) detectedLocale = detectedLocale.toLowerCase()\n\n for (let i = 0; i < this.lowerCaseDomains.length; i++) {\n const domainLocale = this.lowerCaseDomains[i]\n if (\n // We assume that the hostname is already lowercased.\n domainLocale.hostname === hostname ||\n // Configuration validation ensures that the locale is not repeated in\n // other domains locales.\n domainLocale.locales?.some((locale) => locale === detectedLocale)\n ) {\n return this.config.domains[i]\n }\n }\n\n return\n }\n\n /**\n * Pulls the pre-computed locale and inference results from the query\n * object.\n *\n * @param req the request object\n * @param pathname the pathname that could contain a locale prefix\n * @returns the locale analysis result\n */\n public fromRequest(\n req: NextIncomingMessage,\n pathname: string\n ): LocaleAnalysisResult {\n const detectedLocale = getRequestMeta(req, 'locale')\n\n // If a locale was detected on the query, analyze the pathname to ensure\n // that the locale matches.\n if (detectedLocale) {\n const analysis = this.analyze(pathname)\n\n // If the analysis contained a locale we should validate it against the\n // query and strip it from the pathname.\n if (analysis.detectedLocale) {\n if (analysis.detectedLocale !== detectedLocale) {\n console.warn(\n `The detected locale does not match the locale in the query. Expected to find '${detectedLocale}' in '${pathname}' but found '${analysis.detectedLocale}'}`\n )\n }\n\n pathname = analysis.pathname\n }\n }\n\n return {\n pathname,\n detectedLocale,\n inferredFromDefault:\n getRequestMeta(req, 'localeInferredFromDefault') ?? false,\n }\n }\n\n /**\n * Analyzes the pathname for a locale and returns the pathname without it.\n *\n * @param pathname The pathname that could contain a locale prefix.\n * @param options The options to use when matching the locale.\n * @returns The matched locale and the pathname without the locale prefix\n * (if any).\n */\n public analyze(\n pathname: string,\n options: LocaleAnalysisOptions = {}\n ): LocaleAnalysisResult {\n let detectedLocale: string | undefined = options.defaultLocale\n\n // By default, we assume that the default locale was inferred if there was\n // no detected locale.\n let inferredFromDefault = typeof detectedLocale === 'string'\n\n // The first segment will be empty, because it has a leading `/`. If\n // there is no further segment, there is no locale (or it's the default).\n const segments = pathname.split('/', 2)\n if (!segments[1])\n return {\n detectedLocale,\n pathname,\n inferredFromDefault,\n }\n\n // The second segment will contain the locale part if any.\n const segment = segments[1].toLowerCase()\n\n // See if the segment matches one of the locales. If it doesn't, there is\n // no locale (or it's the default).\n const index = this.lowerCaseLocales.indexOf(segment)\n if (index < 0)\n return {\n detectedLocale,\n pathname,\n inferredFromDefault,\n }\n\n // Return the case-sensitive locale.\n detectedLocale = this.config.locales[index]\n inferredFromDefault = false\n\n // Remove the `/${locale}` part of the pathname.\n pathname = pathname.slice(detectedLocale.length + 1) || '/'\n\n return {\n detectedLocale,\n pathname,\n inferredFromDefault,\n }\n }\n}\n"],"names":["getRequestMeta","I18NProvider","constructor","config","locales","length","Error","lowerCaseLocales","map","locale","toLowerCase","lowerCaseDomains","domains","domainLocale","domain","defaultLocale","hostname","split","http","detectDomainLocale","detectedLocale","i","some","fromRequest","req","pathname","analysis","analyze","console","warn","inferredFromDefault","options","segments","segment","index","indexOf","slice"],"mappings":"AACA,SAASA,cAAc,QAAkC,kBAAiB;AA8B1E;;;;CAIC,GACD,OAAO,MAAMC;IAWXC,YAAY,AAAgBC,MAA4B,CAAE;YAMhCA;aANEA,SAAAA;QAC1B,IAAI,CAACA,OAAOC,OAAO,CAACC,MAAM,EAAE;YAC1B,MAAM,qBAA2C,CAA3C,IAAIC,MAAM,mCAAV,qBAAA;uBAAA;4BAAA;8BAAA;YAA0C;QAClD;QAEA,IAAI,CAACC,gBAAgB,GAAGJ,OAAOC,OAAO,CAACI,GAAG,CAAC,CAACC,SAAWA,OAAOC,WAAW;QACzE,IAAI,CAACC,gBAAgB,IAAGR,kBAAAA,OAAOS,OAAO,qBAAdT,gBAAgBK,GAAG,CAAC,CAACK;gBAMhCA;YALX,MAAMC,SAASD,aAAaC,MAAM,CAACJ,WAAW;YAC9C,OAAO;gBACLK,eAAeF,aAAaE,aAAa,CAACL,WAAW;gBACrDM,UAAUF,OAAOG,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE;gBACjCH;gBACAV,OAAO,GAAES,wBAAAA,aAAaT,OAAO,qBAApBS,sBAAsBL,GAAG,CAAC,CAACC,SAAWA,OAAOC,WAAW;gBACjEQ,MAAML,aAAaK,IAAI;YACzB;QACF;IACF;IAEA;;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