react-router 7.8.0 → 7.8.1-pre.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/development/{chunk-VC6RBZTR.js → chunk-3JDDYHAM.js} +130 -130
  3. package/dist/development/{chunk-EVX7OBGB.js → chunk-5556IWOV.js} +98 -83
  4. package/dist/development/{chunk-ZYFC6VSF.mjs → chunk-74543KUN.mjs} +62 -47
  5. package/dist/{production/chunk-XPGU3ZMH.mjs → development/chunk-NL6TORMN.mjs} +147 -33
  6. package/dist/development/dom-export.js +3 -3
  7. package/dist/development/dom-export.mjs +3 -3
  8. package/dist/{production/index-react-server-client-DXb0OgpJ.d.mts → development/index-react-server-client-11fLy3qB.d.mts} +1 -1
  9. package/dist/development/{index-react-server-client-CMphySRb.d.ts → index-react-server-client-BQ6FxdA_.d.ts} +1 -1
  10. package/dist/development/index-react-server-client.d.mts +2 -2
  11. package/dist/development/index-react-server-client.d.ts +2 -2
  12. package/dist/development/index-react-server-client.js +4 -4
  13. package/dist/development/index-react-server-client.mjs +2 -2
  14. package/dist/development/index-react-server.d.mts +38 -1
  15. package/dist/development/index-react-server.d.ts +38 -1
  16. package/dist/development/index-react-server.js +56 -45
  17. package/dist/development/index-react-server.mjs +56 -46
  18. package/dist/development/index.d.mts +42 -4
  19. package/dist/development/index.d.ts +42 -4
  20. package/dist/development/index.js +242 -128
  21. package/dist/development/index.mjs +3 -3
  22. package/dist/development/lib/types/internal.d.mts +6 -3
  23. package/dist/development/lib/types/internal.d.ts +6 -3
  24. package/dist/development/lib/types/internal.js +1 -1
  25. package/dist/development/lib/types/internal.mjs +1 -1
  26. package/dist/development/{route-data-CpB5xtMm.d.mts → route-data-CNjObrhZ.d.mts} +1 -1
  27. package/dist/development/{routeModules-qBivMBjd.d.ts → routeModules-C3oqzPpI.d.ts} +1 -1
  28. package/dist/production/{chunk-BOD6JCOU.js → chunk-3OSMCWIR.js} +98 -83
  29. package/dist/production/{chunk-SIHON65V.mjs → chunk-HVGIEXH6.mjs} +62 -47
  30. package/dist/{development/chunk-HZX6U7MI.mjs → production/chunk-J44BHEXU.mjs} +147 -33
  31. package/dist/production/{chunk-O6DRQPUD.js → chunk-OE6UW5JS.js} +130 -130
  32. package/dist/production/dom-export.js +3 -3
  33. package/dist/production/dom-export.mjs +3 -3
  34. package/dist/{development/index-react-server-client-DXb0OgpJ.d.mts → production/index-react-server-client-11fLy3qB.d.mts} +1 -1
  35. package/dist/production/{index-react-server-client-CMphySRb.d.ts → index-react-server-client-BQ6FxdA_.d.ts} +1 -1
  36. package/dist/production/index-react-server-client.d.mts +2 -2
  37. package/dist/production/index-react-server-client.d.ts +2 -2
  38. package/dist/production/index-react-server-client.js +4 -4
  39. package/dist/production/index-react-server-client.mjs +2 -2
  40. package/dist/production/index-react-server.d.mts +38 -1
  41. package/dist/production/index-react-server.d.ts +38 -1
  42. package/dist/production/index-react-server.js +56 -45
  43. package/dist/production/index-react-server.mjs +56 -46
  44. package/dist/production/index.d.mts +42 -4
  45. package/dist/production/index.d.ts +42 -4
  46. package/dist/production/index.js +242 -128
  47. package/dist/production/index.mjs +3 -3
  48. package/dist/production/lib/types/internal.d.mts +6 -3
  49. package/dist/production/lib/types/internal.d.ts +6 -3
  50. package/dist/production/lib/types/internal.js +1 -1
  51. package/dist/production/lib/types/internal.mjs +1 -1
  52. package/dist/production/{route-data-CpB5xtMm.d.mts → route-data-CNjObrhZ.d.mts} +1 -1
  53. package/dist/production/{routeModules-qBivMBjd.d.ts → routeModules-C3oqzPpI.d.ts} +1 -1
  54. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
2
- * react-router v7.8.0
2
+ * react-router v7.8.1-pre.1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -513,8 +513,8 @@ function convertRouteMatchToUiMatch(match, loaderData) {
513
513
  handle: route.handle
514
514
  };
515
515
  }
516
- function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "") {
517
- let flattenRoute = (route, index, relativePath) => {
516
+ function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "", _hasParentOptionalSegments = false) {
517
+ let flattenRoute = (route, index, hasParentOptionalSegments = _hasParentOptionalSegments, relativePath) => {
518
518
  let meta = {
519
519
  relativePath: relativePath === void 0 ? route.path || "" : relativePath,
520
520
  caseSensitive: route.caseSensitive === true,
@@ -522,6 +522,9 @@ function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "")
522
522
  route
523
523
  };
524
524
  if (meta.relativePath.startsWith("/")) {
525
+ if (!meta.relativePath.startsWith(parentPath) && hasParentOptionalSegments) {
526
+ return;
527
+ }
525
528
  invariant(
526
529
  meta.relativePath.startsWith(parentPath),
527
530
  `Absolute route path "${meta.relativePath}" nested under path "${parentPath}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`
@@ -537,7 +540,13 @@ function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "")
537
540
  route.index !== true,
538
541
  `Index routes must not have child routes. Please remove all child routes from route path "${path}".`
539
542
  );
540
- flattenRoutes(route.children, branches, routesMeta, path);
543
+ flattenRoutes(
544
+ route.children,
545
+ branches,
546
+ routesMeta,
547
+ path,
548
+ hasParentOptionalSegments
549
+ );
541
550
  }
542
551
  if (route.path == null && !route.index) {
543
552
  return;
@@ -553,7 +562,7 @@ function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "")
553
562
  flattenRoute(route, index);
554
563
  } else {
555
564
  for (let exploded of explodeOptionalSegments(route.path)) {
556
- flattenRoute(route, index, exploded);
565
+ flattenRoute(route, index, true, exploded);
557
566
  }
558
567
  }
559
568
  });
@@ -745,7 +754,7 @@ function compilePath(path, caseSensitive = false, end = true) {
745
754
  params.push({ paramName, isOptional: isOptional != null });
746
755
  return isOptional ? "/?([^\\/]+)?" : "/([^\\/]+)";
747
756
  }
748
- );
757
+ ).replace(/\/([\w-]+)\?(\/|$)/g, "(/$1)?$2");
749
758
  if (path.endsWith("*")) {
750
759
  params.push({ paramName: "*" });
751
760
  regexpSource += path === "*" || path === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$";
@@ -2814,9 +2823,23 @@ function createStaticHandler(routes, opts) {
2814
2823
  return res;
2815
2824
  },
2816
2825
  async (error, routeId) => {
2817
- if (isResponse(error)) {
2826
+ if (isRedirectResponse(error)) {
2818
2827
  return error;
2819
2828
  }
2829
+ if (isResponse(error)) {
2830
+ try {
2831
+ error = new ErrorResponseImpl(
2832
+ error.status,
2833
+ error.statusText,
2834
+ await parseResponseBody(error)
2835
+ );
2836
+ } catch (e) {
2837
+ error = e;
2838
+ }
2839
+ }
2840
+ if (isDataWithResponseInit(error)) {
2841
+ error = dataWithResponseInitToErrorResponse(error);
2842
+ }
2820
2843
  if (renderedStaticContext) {
2821
2844
  if (routeId in renderedStaticContext.loaderData) {
2822
2845
  renderedStaticContext.loaderData[routeId] = void 0;
@@ -2942,8 +2965,8 @@ function createStaticHandler(routes, opts) {
2942
2965
  return res;
2943
2966
  },
2944
2967
  (error) => {
2945
- if (isRouteErrorResponse(error)) {
2946
- return Promise.resolve(errorResponseToResponse(error));
2968
+ if (isDataWithResponseInit(error)) {
2969
+ return Promise.resolve(dataWithResponseInitToResponse(error));
2947
2970
  }
2948
2971
  if (isResponse(error)) {
2949
2972
  return Promise.resolve(error);
@@ -3272,8 +3295,12 @@ function createStaticHandler(routes, opts) {
3272
3295
  basename
3273
3296
  );
3274
3297
  }
3275
- if (isResponse(result.result) && isRouteRequest) {
3276
- throw result;
3298
+ if (isRouteRequest) {
3299
+ if (isResponse(result.result)) {
3300
+ throw result;
3301
+ } else if (isDataWithResponseInit(result.result)) {
3302
+ throw dataWithResponseInitToResponse(result.result);
3303
+ }
3277
3304
  }
3278
3305
  dataResults[match.route.id] = await convertDataStrategyResultToDataResult(result);
3279
3306
  })
@@ -3941,9 +3968,15 @@ function clientMiddlewareErrorHandler(error, routeId, matches, didCallHandler) {
3941
3968
  [routeId]: { type: "error", result: error }
3942
3969
  };
3943
3970
  } else {
3971
+ let maxBoundaryIdx = Math.min(
3972
+ // Throwing route
3973
+ matches.findIndex((m) => m.route.id === routeId) || 0,
3974
+ // or the shallowest route that needs to load data
3975
+ matches.findIndex((m) => m.unstable_shouldCallHandler()) || 0
3976
+ );
3944
3977
  let boundaryRouteId = findNearestBoundary(
3945
3978
  matches,
3946
- _optionalChain([matches, 'access', _37 => _37.find, 'call', _38 => _38((m) => m.route.id === routeId || m.route.loader), 'optionalAccess', _39 => _39.route, 'access', _40 => _40.id]) || routeId
3979
+ matches[maxBoundaryIdx].route.id
3947
3980
  ).route.id;
3948
3981
  return {
3949
3982
  [boundaryRouteId]: { type: "error", result: error }
@@ -4003,11 +4036,7 @@ async function callServerRouteMiddleware(args, middlewares, handler, errorHandle
4003
4036
  nextResult = result;
4004
4037
  return nextResult;
4005
4038
  } catch (e) {
4006
- nextResult = await errorHandler(
4007
- // Convert thrown data() values to ErrorResponses
4008
- isDataWithResponseInit(e) ? dataWithResponseInitToErrorResponse(e) : e,
4009
- routeId
4010
- );
4039
+ nextResult = await errorHandler(e, routeId);
4011
4040
  return nextResult;
4012
4041
  }
4013
4042
  };
@@ -4032,11 +4061,7 @@ async function callServerRouteMiddleware(args, middlewares, handler, errorHandle
4032
4061
  return nextResult;
4033
4062
  }
4034
4063
  } catch (e) {
4035
- let response = await errorHandler(
4036
- // Convert thrown data() values to ErrorResponses
4037
- isDataWithResponseInit(e) ? dataWithResponseInitToErrorResponse(e) : e,
4038
- routeId
4039
- );
4064
+ let response = await errorHandler(e, routeId);
4040
4065
  return response;
4041
4066
  }
4042
4067
  }
@@ -4168,8 +4193,8 @@ function getDataStrategyMatch(mapRouteProperties, manifest, request, match, lazy
4168
4193
  return callLoaderOrAction({
4169
4194
  request,
4170
4195
  match,
4171
- lazyHandlerPromise: _optionalChain([_lazyPromises, 'optionalAccess', _41 => _41.handler]),
4172
- lazyRoutePromise: _optionalChain([_lazyPromises, 'optionalAccess', _42 => _42.route]),
4196
+ lazyHandlerPromise: _optionalChain([_lazyPromises, 'optionalAccess', _37 => _37.handler]),
4197
+ lazyRoutePromise: _optionalChain([_lazyPromises, 'optionalAccess', _38 => _38.route]),
4173
4198
  handlerOverride,
4174
4199
  scopedContext
4175
4200
  });
@@ -4209,8 +4234,8 @@ function getTargetedDataStrategyMatches(mapRouteProperties, manifest, request, m
4209
4234
  });
4210
4235
  }
4211
4236
  async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherKey, scopedContext, isStaticHandler) {
4212
- if (matches.some((m) => _optionalChain([m, 'access', _43 => _43._lazyPromises, 'optionalAccess', _44 => _44.middleware]))) {
4213
- await Promise.all(matches.map((m) => _optionalChain([m, 'access', _45 => _45._lazyPromises, 'optionalAccess', _46 => _46.middleware])));
4237
+ if (matches.some((m) => _optionalChain([m, 'access', _39 => _39._lazyPromises, 'optionalAccess', _40 => _40.middleware]))) {
4238
+ await Promise.all(matches.map((m) => _optionalChain([m, 'access', _41 => _41._lazyPromises, 'optionalAccess', _42 => _42.middleware])));
4214
4239
  }
4215
4240
  let dataStrategyArgs = {
4216
4241
  request,
@@ -4255,8 +4280,8 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
4255
4280
  try {
4256
4281
  await Promise.all(
4257
4282
  matches.flatMap((m) => [
4258
- _optionalChain([m, 'access', _47 => _47._lazyPromises, 'optionalAccess', _48 => _48.handler]),
4259
- _optionalChain([m, 'access', _49 => _49._lazyPromises, 'optionalAccess', _50 => _50.route])
4283
+ _optionalChain([m, 'access', _43 => _43._lazyPromises, 'optionalAccess', _44 => _44.handler]),
4284
+ _optionalChain([m, 'access', _45 => _45._lazyPromises, 'optionalAccess', _46 => _46.route])
4260
4285
  ])
4261
4286
  );
4262
4287
  } catch (e) {
@@ -4362,21 +4387,19 @@ async function callLoaderOrAction({
4362
4387
  }
4363
4388
  return result;
4364
4389
  }
4390
+ async function parseResponseBody(response) {
4391
+ let contentType = response.headers.get("Content-Type");
4392
+ if (contentType && /\bapplication\/json\b/.test(contentType)) {
4393
+ return response.body == null ? null : response.json();
4394
+ }
4395
+ return response.text();
4396
+ }
4365
4397
  async function convertDataStrategyResultToDataResult(dataStrategyResult) {
4366
4398
  let { result, type } = dataStrategyResult;
4367
4399
  if (isResponse(result)) {
4368
4400
  let data2;
4369
4401
  try {
4370
- let contentType = result.headers.get("Content-Type");
4371
- if (contentType && /\bapplication\/json\b/.test(contentType)) {
4372
- if (result.body == null) {
4373
- data2 = null;
4374
- } else {
4375
- data2 = await result.json();
4376
- }
4377
- } else {
4378
- data2 = await result.text();
4379
- }
4402
+ data2 = await parseResponseBody(result);
4380
4403
  } catch (e) {
4381
4404
  return { type: "error" /* error */, error: e };
4382
4405
  }
@@ -4401,19 +4424,19 @@ async function convertDataStrategyResultToDataResult(dataStrategyResult) {
4401
4424
  return {
4402
4425
  type: "error" /* error */,
4403
4426
  error: result.data,
4404
- statusCode: _optionalChain([result, 'access', _51 => _51.init, 'optionalAccess', _52 => _52.status]),
4405
- headers: _optionalChain([result, 'access', _53 => _53.init, 'optionalAccess', _54 => _54.headers]) ? new Headers(result.init.headers) : void 0
4427
+ statusCode: _optionalChain([result, 'access', _47 => _47.init, 'optionalAccess', _48 => _48.status]),
4428
+ headers: _optionalChain([result, 'access', _49 => _49.init, 'optionalAccess', _50 => _50.headers]) ? new Headers(result.init.headers) : void 0
4406
4429
  };
4407
4430
  }
4408
4431
  return {
4409
4432
  type: "error" /* error */,
4410
4433
  error: new ErrorResponseImpl(
4411
- _optionalChain([result, 'access', _55 => _55.init, 'optionalAccess', _56 => _56.status]) || 500,
4434
+ _optionalChain([result, 'access', _51 => _51.init, 'optionalAccess', _52 => _52.status]) || 500,
4412
4435
  void 0,
4413
4436
  result.data
4414
4437
  ),
4415
4438
  statusCode: isRouteErrorResponse(result) ? result.status : void 0,
4416
- headers: _optionalChain([result, 'access', _57 => _57.init, 'optionalAccess', _58 => _58.headers]) ? new Headers(result.init.headers) : void 0
4439
+ headers: _optionalChain([result, 'access', _53 => _53.init, 'optionalAccess', _54 => _54.headers]) ? new Headers(result.init.headers) : void 0
4417
4440
  };
4418
4441
  }
4419
4442
  return {
@@ -4426,8 +4449,8 @@ async function convertDataStrategyResultToDataResult(dataStrategyResult) {
4426
4449
  return {
4427
4450
  type: "data" /* data */,
4428
4451
  data: result.data,
4429
- statusCode: _optionalChain([result, 'access', _59 => _59.init, 'optionalAccess', _60 => _60.status]),
4430
- headers: _optionalChain([result, 'access', _61 => _61.init, 'optionalAccess', _62 => _62.headers]) ? new Headers(result.init.headers) : void 0
4452
+ statusCode: _optionalChain([result, 'access', _55 => _55.init, 'optionalAccess', _56 => _56.status]),
4453
+ headers: _optionalChain([result, 'access', _57 => _57.init, 'optionalAccess', _58 => _58.headers]) ? new Headers(result.init.headers) : void 0
4431
4454
  };
4432
4455
  }
4433
4456
  return { type: "data" /* data */, data: result };
@@ -4576,7 +4599,7 @@ function processLoaderData(state, matches, results, pendingActionResult, revalid
4576
4599
  let result = fetcherResults[key];
4577
4600
  invariant(result, "Did not find corresponding fetcher result");
4578
4601
  if (isErrorResult(result)) {
4579
- let boundaryMatch = findNearestBoundary(state.matches, _optionalChain([match, 'optionalAccess', _63 => _63.route, 'access', _64 => _64.id]));
4602
+ let boundaryMatch = findNearestBoundary(state.matches, _optionalChain([match, 'optionalAccess', _59 => _59.route, 'access', _60 => _60.id]));
4580
4603
  if (!(errors && errors[boundaryMatch.route.id])) {
4581
4604
  errors = {
4582
4605
  ...errors,
@@ -4706,27 +4729,15 @@ function isHashChangeOnly(a, b) {
4706
4729
  return false;
4707
4730
  }
4708
4731
  function dataWithResponseInitToResponse(data2) {
4709
- return new Response(
4710
- typeof data2.data === "string" ? data2.data : JSON.stringify(data2.data),
4711
- data2.init || void 0
4712
- );
4732
+ return Response.json(data2.data, _nullishCoalesce(data2.init, () => ( void 0)));
4713
4733
  }
4714
4734
  function dataWithResponseInitToErrorResponse(data2) {
4715
4735
  return new ErrorResponseImpl(
4716
- _nullishCoalesce(_optionalChain([data2, 'access', _65 => _65.init, 'optionalAccess', _66 => _66.status]), () => ( 500)),
4717
- _nullishCoalesce(_optionalChain([data2, 'access', _67 => _67.init, 'optionalAccess', _68 => _68.statusText]), () => ( "Internal Server Error")),
4736
+ _nullishCoalesce(_optionalChain([data2, 'access', _61 => _61.init, 'optionalAccess', _62 => _62.status]), () => ( 500)),
4737
+ _nullishCoalesce(_optionalChain([data2, 'access', _63 => _63.init, 'optionalAccess', _64 => _64.statusText]), () => ( "Internal Server Error")),
4718
4738
  data2.data
4719
4739
  );
4720
4740
  }
4721
- function errorResponseToResponse(error) {
4722
- return new Response(
4723
- typeof error.data === "string" ? error.data : JSON.stringify(error.data),
4724
- {
4725
- status: error.status,
4726
- statusText: error.statusText
4727
- }
4728
- );
4729
- }
4730
4741
  function isDataStrategyResult(result) {
4731
4742
  return result != null && typeof result === "object" && "type" in result && "result" in result && (result.type === "data" /* data */ || result.type === "error" /* error */);
4732
4743
  }
@@ -5753,7 +5764,7 @@ function getTurboStreamSingleFetchDataStrategy(getRouter, manifest, routeModules
5753
5764
  return {
5754
5765
  hasLoader: manifestRoute.hasLoader,
5755
5766
  hasClientLoader: manifestRoute.hasClientLoader,
5756
- hasShouldRevalidate: Boolean(_optionalChain([routeModule, 'optionalAccess', _69 => _69.shouldRevalidate]))
5767
+ hasShouldRevalidate: Boolean(_optionalChain([routeModule, 'optionalAccess', _65 => _65.shouldRevalidate]))
5757
5768
  };
5758
5769
  },
5759
5770
  fetchAndDecodeViaTurboStream,
@@ -5920,7 +5931,7 @@ async function bubbleMiddlewareErrors(singleFetchPromise, matches, routesParams,
5920
5931
  let routeResult = fetchedData.routes[match.route.id];
5921
5932
  if ("error" in routeResult) {
5922
5933
  middlewareError = routeResult.error;
5923
- if (_optionalChain([results, 'access', _70 => _70[match.route.id], 'optionalAccess', _71 => _71.result]) == null) {
5934
+ if (_optionalChain([results, 'access', _66 => _66[match.route.id], 'optionalAccess', _67 => _67.result]) == null) {
5924
5935
  results[match.route.id] = {
5925
5936
  type: "error",
5926
5937
  result: middlewareError
@@ -6033,7 +6044,7 @@ async function fetchAndDecodeViaTurboStream(args, basename, targetRoutes) {
6033
6044
  }
6034
6045
  } else {
6035
6046
  let typed = decoded.value;
6036
- let routeId = _optionalChain([targetRoutes, 'optionalAccess', _72 => _72[0]]);
6047
+ let routeId = _optionalChain([targetRoutes, 'optionalAccess', _68 => _68[0]]);
6037
6048
  invariant2(routeId, "No routeId found for single fetch call decoding");
6038
6049
  if ("redirect" in typed) {
6039
6050
  data2 = { redirect: typed };
@@ -6344,7 +6355,7 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
6344
6355
  if (locationArg) {
6345
6356
  let parsedLocationArg = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
6346
6357
  invariant(
6347
- parentPathnameBase === "/" || _optionalChain([parsedLocationArg, 'access', _73 => _73.pathname, 'optionalAccess', _74 => _74.startsWith, 'call', _75 => _75(parentPathnameBase)]),
6358
+ parentPathnameBase === "/" || _optionalChain([parsedLocationArg, 'access', _69 => _69.pathname, 'optionalAccess', _70 => _70.startsWith, 'call', _71 => _71(parentPathnameBase)]),
6348
6359
  `When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${parentPathnameBase}" but pathname "${parsedLocationArg.pathname}" was given in the \`location\` prop.`
6349
6360
  );
6350
6361
  location = parsedLocationArg;
@@ -6492,10 +6503,10 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, fut
6492
6503
  }
6493
6504
  }
6494
6505
  let renderedMatches = matches;
6495
- let errors = _optionalChain([dataRouterState, 'optionalAccess', _76 => _76.errors]);
6506
+ let errors = _optionalChain([dataRouterState, 'optionalAccess', _72 => _72.errors]);
6496
6507
  if (errors != null) {
6497
6508
  let errorIndex = renderedMatches.findIndex(
6498
- (m) => m.route.id && _optionalChain([errors, 'optionalAccess', _77 => _77[m.route.id]]) !== void 0
6509
+ (m) => m.route.id && _optionalChain([errors, 'optionalAccess', _73 => _73[m.route.id]]) !== void 0
6499
6510
  );
6500
6511
  invariant(
6501
6512
  errorIndex >= 0,
@@ -6672,15 +6683,15 @@ function useRouteError() {
6672
6683
  if (error !== void 0) {
6673
6684
  return error;
6674
6685
  }
6675
- return _optionalChain([state, 'access', _78 => _78.errors, 'optionalAccess', _79 => _79[routeId]]);
6686
+ return _optionalChain([state, 'access', _74 => _74.errors, 'optionalAccess', _75 => _75[routeId]]);
6676
6687
  }
6677
6688
  function useAsyncValue() {
6678
6689
  let value = React3.useContext(AwaitContext);
6679
- return _optionalChain([value, 'optionalAccess', _80 => _80._data]);
6690
+ return _optionalChain([value, 'optionalAccess', _76 => _76._data]);
6680
6691
  }
6681
6692
  function useAsyncError() {
6682
6693
  let value = React3.useContext(AwaitContext);
6683
- return _optionalChain([value, 'optionalAccess', _81 => _81._error]);
6694
+ return _optionalChain([value, 'optionalAccess', _77 => _77._error]);
6684
6695
  }
6685
6696
  var blockerId = 0;
6686
6697
  function useBlocker(shouldBlock) {
@@ -6792,7 +6803,7 @@ function getKeyedLinksForMatches(matches, routeModules, manifest) {
6792
6803
  let route = manifest.routes[match.route.id];
6793
6804
  return [
6794
6805
  route && route.css ? route.css.map((href) => ({ rel: "stylesheet", href })) : [],
6795
- _optionalChain([module, 'optionalAccess', _82 => _82.links, 'optionalCall', _83 => _83()]) || []
6806
+ _optionalChain([module, 'optionalAccess', _78 => _78.links, 'optionalCall', _79 => _79()]) || []
6796
6807
  ];
6797
6808
  }).flat(2);
6798
6809
  let preloads = getModuleLinkHrefs(matches, manifest);
@@ -6893,7 +6904,7 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
6893
6904
  // param change, /users/123 -> /users/456
6894
6905
  currentMatches[index].pathname !== match.pathname || // splat param changed, which is not present in match.path
6895
6906
  // e.g. /files/images/avatar.jpg -> files/finances.xls
6896
- _optionalChain([currentMatches, 'access', _84 => _84[index], 'access', _85 => _85.route, 'access', _86 => _86.path, 'optionalAccess', _87 => _87.endsWith, 'call', _88 => _88("*")]) && currentMatches[index].params["*"] !== match.params["*"]
6907
+ _optionalChain([currentMatches, 'access', _80 => _80[index], 'access', _81 => _81.route, 'access', _82 => _82.path, 'optionalAccess', _83 => _83.endsWith, 'call', _84 => _84("*")]) && currentMatches[index].params["*"] !== match.params["*"]
6897
6908
  );
6898
6909
  };
6899
6910
  if (mode === "assets") {
@@ -6916,7 +6927,7 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
6916
6927
  location.pathname + location.search + location.hash,
6917
6928
  window.origin
6918
6929
  ),
6919
- currentParams: _optionalChain([currentMatches, 'access', _89 => _89[0], 'optionalAccess', _90 => _90.params]) || {},
6930
+ currentParams: _optionalChain([currentMatches, 'access', _85 => _85[0], 'optionalAccess', _86 => _86.params]) || {},
6920
6931
  nextUrl: new URL(page, window.origin),
6921
6932
  nextParams: match.params,
6922
6933
  defaultShouldRevalidate: true
@@ -7188,10 +7199,10 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
7188
7199
  )
7189
7200
  });
7190
7201
  let hasInitialData = initialState && initialState.loaderData && route.id in initialState.loaderData;
7191
- let initialData = hasInitialData ? _optionalChain([initialState, 'optionalAccess', _91 => _91.loaderData, 'optionalAccess', _92 => _92[route.id]]) : void 0;
7202
+ let initialData = hasInitialData ? _optionalChain([initialState, 'optionalAccess', _87 => _87.loaderData, 'optionalAccess', _88 => _88[route.id]]) : void 0;
7192
7203
  let hasInitialError = initialState && initialState.errors && route.id in initialState.errors;
7193
- let initialError = hasInitialError ? _optionalChain([initialState, 'optionalAccess', _93 => _93.errors, 'optionalAccess', _94 => _94[route.id]]) : void 0;
7194
- let isHydrationRequest = needsRevalidation == null && (_optionalChain([routeModule, 'access', _95 => _95.clientLoader, 'optionalAccess', _96 => _96.hydrate]) === true || !route.hasLoader);
7204
+ let initialError = hasInitialError ? _optionalChain([initialState, 'optionalAccess', _89 => _89.errors, 'optionalAccess', _90 => _90[route.id]]) : void 0;
7205
+ let isHydrationRequest = needsRevalidation == null && (_optionalChain([routeModule, 'access', _91 => _91.clientLoader, 'optionalAccess', _92 => _92.hydrate]) === true || !route.hasLoader);
7195
7206
  dataRoute.loader = async ({ request, params, context }, singleFetch) => {
7196
7207
  try {
7197
7208
  let result = await prefetchStylesAndCallHandler(async () => {
@@ -7488,7 +7499,7 @@ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDi
7488
7499
  function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscovery, isSpaMode) {
7489
7500
  React6.useEffect(() => {
7490
7501
  if (!isFogOfWarEnabled(routeDiscovery, ssr) || // @ts-expect-error - TS doesn't know about this yet
7491
- _optionalChain([window, 'access', _97 => _97.navigator, 'optionalAccess', _98 => _98.connection, 'optionalAccess', _99 => _99.saveData]) === true) {
7502
+ _optionalChain([window, 'access', _93 => _93.navigator, 'optionalAccess', _94 => _94.connection, 'optionalAccess', _95 => _95.saveData]) === true) {
7492
7503
  return;
7493
7504
  }
7494
7505
  function registerElement(el) {
@@ -7591,7 +7602,7 @@ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, ro
7591
7602
  sessionStorage.removeItem(MANIFEST_VERSION_STORAGE_KEY);
7592
7603
  serverPatches = await res.json();
7593
7604
  } catch (e) {
7594
- if (_optionalChain([signal, 'optionalAccess', _100 => _100.aborted])) return;
7605
+ if (_optionalChain([signal, 'optionalAccess', _96 => _96.aborted])) return;
7595
7606
  throw e;
7596
7607
  }
7597
7608
  let knownRoutes = new Set(Object.keys(manifest.routes));
@@ -7832,7 +7843,7 @@ function PrefetchPageLinksImpl({
7832
7843
  if (!manifestRoute || !manifestRoute.hasLoader) {
7833
7844
  return;
7834
7845
  }
7835
- if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && _optionalChain([routeModules, 'access', _101 => _101[m.route.id], 'optionalAccess', _102 => _102.shouldRevalidate])) {
7846
+ if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && _optionalChain([routeModules, 'access', _97 => _97[m.route.id], 'optionalAccess', _98 => _98.shouldRevalidate])) {
7836
7847
  foundOptOutRoute = true;
7837
7848
  } else if (manifestRoute.hasClientLoader) {
7838
7849
  foundOptOutRoute = true;
@@ -7906,7 +7917,7 @@ function Meta() {
7906
7917
  error
7907
7918
  };
7908
7919
  matches[i] = match;
7909
- if (_optionalChain([routeModule, 'optionalAccess', _103 => _103.meta])) {
7920
+ if (_optionalChain([routeModule, 'optionalAccess', _99 => _99.meta])) {
7910
7921
  routeMeta = typeof routeModule.meta === "function" ? routeModule.meta({
7911
7922
  data: data2,
7912
7923
  loaderData: data2,
@@ -7976,6 +7987,9 @@ function isValidMetaTag(tagName) {
7976
7987
  return typeof tagName === "string" && /^(meta|link)$/.test(tagName);
7977
7988
  }
7978
7989
  var isHydrated = false;
7990
+ function setIsHydrated() {
7991
+ isHydrated = true;
7992
+ }
7979
7993
  function Scripts(scriptProps) {
7980
7994
  let {
7981
7995
  manifest,
@@ -7994,7 +8008,7 @@ function Scripts(scriptProps) {
7994
8008
  }
7995
8009
  let matches = getActiveMatches(routerMatches, null, isSpaMode);
7996
8010
  React7.useEffect(() => {
7997
- isHydrated = true;
8011
+ setIsHydrated();
7998
8012
  }, []);
7999
8013
  let initialScripts = React7.useMemo(() => {
8000
8014
  if (isRSCRouterContext) {
@@ -8002,7 +8016,7 @@ function Scripts(scriptProps) {
8002
8016
  }
8003
8017
  let streamScript = "window.__reactRouterContext.stream = new ReadableStream({start(controller){window.__reactRouterContext.streamController = controller;}}).pipeThrough(new TextEncoderStream());";
8004
8018
  let contextScript = staticContext ? `window.__reactRouterContext = ${serverHandoffString};${streamScript}` : " ";
8005
- let routeModulesScript = !isStatic ? " " : `${_optionalChain([manifest, 'access', _104 => _104.hmr, 'optionalAccess', _105 => _105.runtime]) ? `import ${JSON.stringify(manifest.hmr.runtime)};` : ""}${!enableFogOfWar ? `import ${JSON.stringify(manifest.url)}` : ""};
8019
+ let routeModulesScript = !isStatic ? " " : `${_optionalChain([manifest, 'access', _100 => _100.hmr, 'optionalAccess', _101 => _101.runtime]) ? `import ${JSON.stringify(manifest.hmr.runtime)};` : ""}${!enableFogOfWar ? `import ${JSON.stringify(manifest.url)}` : ""};
8006
8020
  ${matches.map((match, routeIndex) => {
8007
8021
  let routeVarName = `route${routeIndex}`;
8008
8022
  let manifestEntry = manifest.routes[match.route.id];
@@ -8232,7 +8246,7 @@ function BoundaryShell({
8232
8246
  children
8233
8247
  }) {
8234
8248
  let { routeModules } = useFrameworkContext();
8235
- if (_optionalChain([routeModules, 'access', _106 => _106.root, 'optionalAccess', _107 => _107.Layout]) && !isOutsideRemixApp) {
8249
+ if (_optionalChain([routeModules, 'access', _102 => _102.root, 'optionalAccess', _103 => _103.Layout]) && !isOutsideRemixApp) {
8236
8250
  return children;
8237
8251
  }
8238
8252
  return /* @__PURE__ */ React8.createElement("html", { lang: "en" }, /* @__PURE__ */ React8.createElement("head", null, /* @__PURE__ */ React8.createElement("meta", { charSet: "utf-8" }), /* @__PURE__ */ React8.createElement(
@@ -8344,4 +8358,5 @@ function BoundaryShell({
8344
8358
 
8345
8359
 
8346
8360
 
8347
- exports.Action = Action; exports.createMemoryHistory = createMemoryHistory; exports.createBrowserHistory = createBrowserHistory; exports.createHashHistory = createHashHistory; exports.invariant = invariant; exports.warning = warning; exports.createPath = createPath; exports.parsePath = parsePath; exports.unstable_createContext = unstable_createContext; exports.unstable_RouterContextProvider = unstable_RouterContextProvider; exports.convertRoutesToDataRoutes = convertRoutesToDataRoutes; exports.matchRoutes = matchRoutes; exports.generatePath = generatePath; exports.matchPath = matchPath; exports.stripBasename = stripBasename; exports.resolvePath = resolvePath; exports.getResolveToMatches = getResolveToMatches; exports.resolveTo = resolveTo; exports.joinPaths = joinPaths; exports.data = data; exports.redirect = redirect; exports.redirectDocument = redirectDocument; exports.replace = replace; exports.ErrorResponseImpl = ErrorResponseImpl; exports.isRouteErrorResponse = isRouteErrorResponse; exports.encode = encode; exports.IDLE_NAVIGATION = IDLE_NAVIGATION; exports.IDLE_FETCHER = IDLE_FETCHER; exports.IDLE_BLOCKER = IDLE_BLOCKER; exports.createRouter = createRouter; exports.createStaticHandler = createStaticHandler; exports.getStaticContextFromError = getStaticContextFromError; exports.isDataWithResponseInit = isDataWithResponseInit; exports.isResponse = isResponse; exports.isRedirectStatusCode = isRedirectStatusCode; exports.isRedirectResponse = isRedirectResponse; exports.isMutationMethod = isMutationMethod; exports.createRequestInit = createRequestInit; exports.SingleFetchRedirectSymbol = SingleFetchRedirectSymbol; exports.SINGLE_FETCH_REDIRECT_STATUS = SINGLE_FETCH_REDIRECT_STATUS; exports.NO_BODY_STATUS_CODES = NO_BODY_STATUS_CODES; exports.StreamTransfer = StreamTransfer; exports.getTurboStreamSingleFetchDataStrategy = getTurboStreamSingleFetchDataStrategy; exports.getSingleFetchDataStrategyImpl = getSingleFetchDataStrategyImpl; exports.stripIndexParam = stripIndexParam; exports.singleFetchUrl = singleFetchUrl; exports.decodeViaTurboStream = decodeViaTurboStream; exports.DataRouterContext = DataRouterContext; exports.DataRouterStateContext = DataRouterStateContext; exports.RSCRouterContext = RSCRouterContext; exports.ViewTransitionContext = ViewTransitionContext; exports.FetchersContext = FetchersContext; exports.AwaitContext = AwaitContext; exports.NavigationContext = NavigationContext; exports.LocationContext = LocationContext; exports.RouteContext = RouteContext; exports.ENABLE_DEV_WARNINGS = ENABLE_DEV_WARNINGS; exports.warnOnce = warnOnce; exports.useHref = useHref; exports.useInRouterContext = useInRouterContext; exports.useLocation = useLocation; exports.useNavigationType = useNavigationType; exports.useMatch = useMatch; exports.useNavigate = useNavigate; exports.useOutletContext = useOutletContext; exports.useOutlet = useOutlet; exports.useParams = useParams; exports.useResolvedPath = useResolvedPath; exports.useRoutes = useRoutes; exports.useRoutesImpl = useRoutesImpl; exports._renderMatches = _renderMatches; exports.useRouteId = useRouteId; exports.useNavigation = useNavigation; exports.useRevalidator = useRevalidator; exports.useMatches = useMatches; exports.useLoaderData = useLoaderData; exports.useRouteLoaderData = useRouteLoaderData; exports.useActionData = useActionData; exports.useRouteError = useRouteError; exports.useAsyncValue = useAsyncValue; exports.useAsyncError = useAsyncError; exports.useBlocker = useBlocker; exports.RemixErrorBoundary = RemixErrorBoundary; exports.createServerRoutes = createServerRoutes; exports.createClientRoutesWithHMRRevalidationOptOut = createClientRoutesWithHMRRevalidationOptOut; exports.noActionDefinedError = noActionDefinedError; exports.createClientRoutes = createClientRoutes; exports.shouldHydrateRouteLoader = shouldHydrateRouteLoader; exports.getPatchRoutesOnNavigationFunction = getPatchRoutesOnNavigationFunction; exports.useFogOFWarDiscovery = useFogOFWarDiscovery; exports.getManifestPath = getManifestPath; exports.FrameworkContext = FrameworkContext; exports.usePrefetchBehavior = usePrefetchBehavior; exports.CRITICAL_CSS_DATA_ATTRIBUTE = CRITICAL_CSS_DATA_ATTRIBUTE; exports.Links = Links; exports.PrefetchPageLinks = PrefetchPageLinks; exports.Meta = Meta; exports.Scripts = Scripts; exports.mergeRefs = mergeRefs;
8361
+
8362
+ exports.Action = Action; exports.createMemoryHistory = createMemoryHistory; exports.createBrowserHistory = createBrowserHistory; exports.createHashHistory = createHashHistory; exports.invariant = invariant; exports.warning = warning; exports.createPath = createPath; exports.parsePath = parsePath; exports.unstable_createContext = unstable_createContext; exports.unstable_RouterContextProvider = unstable_RouterContextProvider; exports.convertRoutesToDataRoutes = convertRoutesToDataRoutes; exports.matchRoutes = matchRoutes; exports.generatePath = generatePath; exports.matchPath = matchPath; exports.stripBasename = stripBasename; exports.resolvePath = resolvePath; exports.getResolveToMatches = getResolveToMatches; exports.resolveTo = resolveTo; exports.joinPaths = joinPaths; exports.data = data; exports.redirect = redirect; exports.redirectDocument = redirectDocument; exports.replace = replace; exports.ErrorResponseImpl = ErrorResponseImpl; exports.isRouteErrorResponse = isRouteErrorResponse; exports.encode = encode; exports.IDLE_NAVIGATION = IDLE_NAVIGATION; exports.IDLE_FETCHER = IDLE_FETCHER; exports.IDLE_BLOCKER = IDLE_BLOCKER; exports.createRouter = createRouter; exports.createStaticHandler = createStaticHandler; exports.getStaticContextFromError = getStaticContextFromError; exports.isDataWithResponseInit = isDataWithResponseInit; exports.isResponse = isResponse; exports.isRedirectStatusCode = isRedirectStatusCode; exports.isRedirectResponse = isRedirectResponse; exports.isMutationMethod = isMutationMethod; exports.createRequestInit = createRequestInit; exports.SingleFetchRedirectSymbol = SingleFetchRedirectSymbol; exports.SINGLE_FETCH_REDIRECT_STATUS = SINGLE_FETCH_REDIRECT_STATUS; exports.NO_BODY_STATUS_CODES = NO_BODY_STATUS_CODES; exports.StreamTransfer = StreamTransfer; exports.getTurboStreamSingleFetchDataStrategy = getTurboStreamSingleFetchDataStrategy; exports.getSingleFetchDataStrategyImpl = getSingleFetchDataStrategyImpl; exports.stripIndexParam = stripIndexParam; exports.singleFetchUrl = singleFetchUrl; exports.decodeViaTurboStream = decodeViaTurboStream; exports.DataRouterContext = DataRouterContext; exports.DataRouterStateContext = DataRouterStateContext; exports.RSCRouterContext = RSCRouterContext; exports.ViewTransitionContext = ViewTransitionContext; exports.FetchersContext = FetchersContext; exports.AwaitContext = AwaitContext; exports.NavigationContext = NavigationContext; exports.LocationContext = LocationContext; exports.RouteContext = RouteContext; exports.ENABLE_DEV_WARNINGS = ENABLE_DEV_WARNINGS; exports.warnOnce = warnOnce; exports.useHref = useHref; exports.useInRouterContext = useInRouterContext; exports.useLocation = useLocation; exports.useNavigationType = useNavigationType; exports.useMatch = useMatch; exports.useNavigate = useNavigate; exports.useOutletContext = useOutletContext; exports.useOutlet = useOutlet; exports.useParams = useParams; exports.useResolvedPath = useResolvedPath; exports.useRoutes = useRoutes; exports.useRoutesImpl = useRoutesImpl; exports._renderMatches = _renderMatches; exports.useRouteId = useRouteId; exports.useNavigation = useNavigation; exports.useRevalidator = useRevalidator; exports.useMatches = useMatches; exports.useLoaderData = useLoaderData; exports.useRouteLoaderData = useRouteLoaderData; exports.useActionData = useActionData; exports.useRouteError = useRouteError; exports.useAsyncValue = useAsyncValue; exports.useAsyncError = useAsyncError; exports.useBlocker = useBlocker; exports.RemixErrorBoundary = RemixErrorBoundary; exports.createServerRoutes = createServerRoutes; exports.createClientRoutesWithHMRRevalidationOptOut = createClientRoutesWithHMRRevalidationOptOut; exports.noActionDefinedError = noActionDefinedError; exports.createClientRoutes = createClientRoutes; exports.shouldHydrateRouteLoader = shouldHydrateRouteLoader; exports.getPatchRoutesOnNavigationFunction = getPatchRoutesOnNavigationFunction; exports.useFogOFWarDiscovery = useFogOFWarDiscovery; exports.getManifestPath = getManifestPath; exports.FrameworkContext = FrameworkContext; exports.usePrefetchBehavior = usePrefetchBehavior; exports.CRITICAL_CSS_DATA_ATTRIBUTE = CRITICAL_CSS_DATA_ATTRIBUTE; exports.Links = Links; exports.PrefetchPageLinks = PrefetchPageLinks; exports.Meta = Meta; exports.setIsHydrated = setIsHydrated; exports.Scripts = Scripts; exports.mergeRefs = mergeRefs;