{"version":3,"sources":["../../src/server/server-utils.ts"],"names":["format","formatUrl","parse","parseUrl","normalizeLocalePath","getPathMatch","getNamedRouteRegex","getRouteMatcher","matchHas","prepareDestination","removeTrailingSlash","normalizeRscPath","NEXT_QUERY_PARAM_PREFIX","normalizeVercelUrl","req","trustQuery","paramKeys","pageIsDynamic","defaultRouteRegex","_parsedUrl","url","search","key","Object","keys","query","startsWith","groups","includes","interpolateDynamicPath","pathname","params","param","optional","repeat","builtParam","paramIdx","indexOf","paramValue","value","Array","isArray","map","v","encodeURIComponent","join","slice","length","getUtils","page","i18n","basePath","rewrites","trailingSlash","caseSensitive","dynamicRouteMatcher","defaultRouteMatches","handleRewrites","parsedUrl","rewriteParams","fsPathname","matchesPage","fsPathnameNoSlash","checkRewrite","rewrite","matcher","source","removeUnnamedParams","strict","sensitive","has","missing","hasParams","assign","parsedDestination","destQuery","appendParamsToQuery","destination","protocol","replace","RegExp","destLocalePathResult","locales","nextInternalLocale","detectedLocale","dynamicParams","beforeFiles","finished","afterFiles","fallback","getParamsFromRouteMatches","renderOpts","routeKeys","re","exec","str","obj","fromEntries","URLSearchParams","matchesHasLocale","normalizedKey","substring","routeKeyNames","filterLocaleItem","val","isCatchAll","_val","some","item","toLowerCase","locale","splice","every","name","reduce","prev","keyName","paramName","pos","parseInt","headers","normalizeDynamicRouteParams","ignoreOptional","hasValidParams","defaultValue","isOptional","isDefaultValue","defaultVal","undefined","split"],"mappings":"AAOA,SAASA,UAAUC,SAAS,EAAEC,SAASC,QAAQ,QAAQ,MAAK;AAC5D,SAASC,mBAAmB,QAAQ,2CAA0C;AAC9E,SAASC,YAAY,QAAQ,wCAAuC;AACpE,SAASC,kBAAkB,QAAQ,yCAAwC;AAC3E,SAASC,eAAe,QAAQ,2CAA0C;AAC1E,SACEC,QAAQ,EACRC,kBAAkB,QACb,iDAAgD;AACvD,SAASC,mBAAmB,QAAQ,mDAAkD;AACtF,SAASC,gBAAgB,QAAQ,uCAAsC;AACvE,SAASC,uBAA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