react-router 7.18.2 → 7.18.4

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 (60) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/development/{browser-DBmQ1yAR.d.mts → browser-BR5QG7ZC.d.mts} +1 -1
  3. package/dist/development/{browser-B2PdsXXH.d.ts → browser-eq4RgLsD.d.ts} +1 -1
  4. package/dist/development/{chunk-HHGH3NKS.js → chunk-GR4NQCSD.js} +122 -19
  5. package/dist/development/{chunk-ZA36QIGN.mjs → chunk-H4DAEOV7.mjs} +16 -8
  6. package/dist/development/{chunk-7XGYIT3M.js → chunk-HQO5H5CC.js} +103 -103
  7. package/dist/{production/chunk-VJZ67BZE.js → development/chunk-LVPI3KDG.js} +7 -7
  8. package/dist/development/{chunk-62JRHF6Z.mjs → chunk-OB3PAWPO.mjs} +117 -14
  9. package/dist/{production/context-CeD5LmaF.d.mts → development/context-nqAapj74.d.mts} +9 -0
  10. package/dist/development/dom-export.d.mts +2 -2
  11. package/dist/development/dom-export.d.ts +2 -2
  12. package/dist/development/dom-export.js +45 -32
  13. package/dist/development/dom-export.mjs +17 -4
  14. package/dist/{production/index-react-server-client-3ykjivgQ.d.ts → development/index-react-server-client-BjY-eKuf.d.ts} +2 -1
  15. package/dist/{production/index-react-server-client-CACgcj2J.d.mts → development/index-react-server-client-K63fpMH4.d.mts} +1 -1
  16. package/dist/development/index-react-server-client.d.mts +2 -2
  17. package/dist/development/index-react-server-client.d.ts +2 -2
  18. package/dist/development/index-react-server-client.js +4 -4
  19. package/dist/development/index-react-server-client.mjs +2 -2
  20. package/dist/development/index-react-server.d.mts +8 -0
  21. package/dist/development/index-react-server.d.ts +8 -0
  22. package/dist/development/index-react-server.js +25 -9
  23. package/dist/development/index-react-server.mjs +25 -9
  24. package/dist/development/index.d.mts +6 -6
  25. package/dist/development/index.d.ts +6 -6
  26. package/dist/development/index.js +102 -94
  27. package/dist/development/index.mjs +3 -3
  28. package/dist/{production/instrumentation-Dkmpzd13.d.ts → development/instrumentation-B7w3_Eo9.d.ts} +8 -0
  29. package/dist/development/lib/types/internal.js +1 -1
  30. package/dist/development/lib/types/internal.mjs +1 -1
  31. package/dist/production/{browser-DBmQ1yAR.d.mts → browser-BR5QG7ZC.d.mts} +1 -1
  32. package/dist/production/{browser-B2PdsXXH.d.ts → browser-eq4RgLsD.d.ts} +1 -1
  33. package/dist/production/{chunk-FDTIF24W.js → chunk-AOOKMWND.js} +103 -103
  34. package/dist/production/{chunk-SJTG3J2Q.mjs → chunk-G2MPF4YY.mjs} +16 -8
  35. package/dist/production/{chunk-YBLPXYCV.mjs → chunk-Q34X6AWR.mjs} +117 -14
  36. package/dist/{development/chunk-3UVS743K.js → production/chunk-QURBR4FZ.js} +7 -7
  37. package/dist/production/{chunk-TP6EHSSF.js → chunk-YNGRUB6F.js} +122 -19
  38. package/dist/{development/context-CeD5LmaF.d.mts → production/context-nqAapj74.d.mts} +9 -0
  39. package/dist/production/dom-export.d.mts +2 -2
  40. package/dist/production/dom-export.d.ts +2 -2
  41. package/dist/production/dom-export.js +45 -32
  42. package/dist/production/dom-export.mjs +17 -4
  43. package/dist/{development/index-react-server-client-3ykjivgQ.d.ts → production/index-react-server-client-BjY-eKuf.d.ts} +2 -1
  44. package/dist/{development/index-react-server-client-CACgcj2J.d.mts → production/index-react-server-client-K63fpMH4.d.mts} +1 -1
  45. package/dist/production/index-react-server-client.d.mts +2 -2
  46. package/dist/production/index-react-server-client.d.ts +2 -2
  47. package/dist/production/index-react-server-client.js +4 -4
  48. package/dist/production/index-react-server-client.mjs +2 -2
  49. package/dist/production/index-react-server.d.mts +8 -0
  50. package/dist/production/index-react-server.d.ts +8 -0
  51. package/dist/production/index-react-server.js +25 -9
  52. package/dist/production/index-react-server.mjs +25 -9
  53. package/dist/production/index.d.mts +6 -6
  54. package/dist/production/index.d.ts +6 -6
  55. package/dist/production/index.js +102 -94
  56. package/dist/production/index.mjs +3 -3
  57. package/dist/{development/instrumentation-Dkmpzd13.d.ts → production/instrumentation-B7w3_Eo9.d.ts} +8 -0
  58. package/dist/production/lib/types/internal.js +1 -1
  59. package/dist/production/lib/types/internal.mjs +1 -1
  60. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.18.2
2
+ * react-router v7.18.4
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -784,13 +784,16 @@ function matchPathImpl(pattern, pathname, matcher, compiledParams) {
784
784
  let match = pathname.match(matcher);
785
785
  if (!match) return null;
786
786
  let matchedPathname = match[0];
787
- let pathnameBase = matchedPathname.replace(/(.)\/+$/, "$1");
787
+ let pathnameBase = removeTrailingSlash(matchedPathname, 1);
788
788
  let captureGroups = match.slice(1);
789
789
  let params = compiledParams.reduce(
790
790
  (memo2, { paramName, isOptional }, index) => {
791
791
  if (paramName === "*") {
792
792
  let splatValue = captureGroups[index] || "";
793
- pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\/+$/, "$1");
793
+ pathnameBase = removeTrailingSlash(
794
+ matchedPathname.slice(0, matchedPathname.length - splatValue.length),
795
+ 1
796
+ );
794
797
  }
795
798
  const value = captureGroups[index];
796
799
  if (isOptional && !value) {
@@ -880,7 +883,7 @@ function resolvePath(to, fromPathname = "/") {
880
883
  let pathname;
881
884
  if (toPathname) {
882
885
  toPathname = removeDoubleSlashes(toPathname);
883
- if (toPathname.startsWith("/")) {
886
+ if (toPathname.startsWith("/") || toPathname.startsWith("\\")) {
884
887
  pathname = resolvePathname(toPathname.substring(1), "/");
885
888
  } else {
886
889
  pathname = resolvePathname(toPathname, fromPathname);
@@ -968,7 +971,13 @@ function resolveTo(toArg, routePathnames, locationPathname, isPathRelative = fal
968
971
  }
969
972
  var removeDoubleSlashes = (path) => path.replace(/[\\/]{2,}/g, "/");
970
973
  var joinPaths = (paths) => removeDoubleSlashes(paths.join("/"));
971
- var removeTrailingSlash = (path) => path.replace(/\/+$/, "");
974
+ function removeTrailingSlash(path, minLength = 0) {
975
+ let end = path.length;
976
+ while (end > minLength && path.charCodeAt(end - 1) === 47) {
977
+ end--;
978
+ }
979
+ return end === path.length ? path : path.slice(0, end);
980
+ }
972
981
  var normalizePathname = (pathname) => removeTrailingSlash(pathname).replace(/^\/*/, "/");
973
982
  var normalizeSearch = (search) => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search;
974
983
  var normalizeHash = (hash) => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash;
@@ -1341,6 +1350,51 @@ function isPlainObject(thing) {
1341
1350
  return proto === Object.prototype || proto === null || Object.getOwnPropertyNames(proto).sort().join("\0") === objectProtoNames;
1342
1351
  }
1343
1352
 
1353
+ // lib/router/navigation.ts
1354
+ var DEFAULT_NAVIGATION_URL = new URL("http://localhost");
1355
+ function getNavigatorCurrentUrl(navigator) {
1356
+ if (navigator.createURL) {
1357
+ return navigator.createURL("/");
1358
+ }
1359
+ try {
1360
+ return new URL(navigator.createHref("/"), DEFAULT_NAVIGATION_URL);
1361
+ } catch {
1362
+ return DEFAULT_NAVIGATION_URL;
1363
+ }
1364
+ }
1365
+ function isSameOrigin(a, b) {
1366
+ return a.origin === b.origin && (a.origin !== "null" || a.protocol === b.protocol && a.host === b.host);
1367
+ }
1368
+ function isExplicitUrl(destination, target) {
1369
+ if (destination.startsWith("//")) {
1370
+ return true;
1371
+ }
1372
+ let protocol = target.protocol.toLowerCase();
1373
+ if (!destination.toLowerCase().startsWith(protocol)) {
1374
+ return false;
1375
+ }
1376
+ return target.host === "" || destination.slice(protocol.length).startsWith("//");
1377
+ }
1378
+ function validateNavigationTarget(original, resolved, currentUrl, externalPolicy) {
1379
+ let originalUrl = null;
1380
+ try {
1381
+ originalUrl = original == null ? null : new URL(original, currentUrl);
1382
+ } catch {
1383
+ }
1384
+ let resolvedUrl = new URL(resolved, currentUrl);
1385
+ let originalIsExternal = originalUrl != null && !isSameOrigin(originalUrl, currentUrl);
1386
+ let resolvedIsExternal = !isSameOrigin(resolvedUrl, currentUrl);
1387
+ if (externalPolicy === "reject") {
1388
+ if (originalIsExternal || resolvedIsExternal) {
1389
+ throw new Error("External navigation is not allowed");
1390
+ }
1391
+ } else if (resolvedIsExternal) {
1392
+ if (originalUrl == null || !isExplicitUrl(original, originalUrl) || !isSameOrigin(originalUrl, resolvedUrl)) {
1393
+ throw new Error("External navigation is not allowed");
1394
+ }
1395
+ }
1396
+ }
1397
+
1344
1398
  // lib/router/router.ts
1345
1399
  var validMutationMethodsArr = [
1346
1400
  "POST",
@@ -1764,7 +1818,7 @@ function createRouter(init) {
1764
1818
  init.history.replace(location, location.state);
1765
1819
  }
1766
1820
  let viewTransitionOpts;
1767
- if (pendingAction === "POP" /* Pop */) {
1821
+ if (pendingAction === "POP" /* Pop */ && !isUninterruptedRevalidation && location !== state.location) {
1768
1822
  let priorPaths = appliedViewTransitions.get(state.location.pathname);
1769
1823
  if (priorPaths && priorPaths.has(location.pathname)) {
1770
1824
  viewTransitionOpts = {
@@ -1852,11 +1906,21 @@ function createRouter(init) {
1852
1906
  ...opts.mask
1853
1907
  };
1854
1908
  maskPath = {
1855
- pathname: "",
1856
- search: "",
1857
- hash: "",
1858
- ...partialPath
1909
+ pathname: partialPath.pathname ?? "",
1910
+ search: partialPath.search ?? "",
1911
+ hash: partialPath.hash ?? ""
1859
1912
  };
1913
+ if (PROTOCOL_RELATIVE_URL_REGEX.test(maskPath.pathname)) {
1914
+ throw new Error("External navigation is not allowed");
1915
+ } else if (maskPath.pathname.startsWith("\\")) {
1916
+ maskPath.pathname = maskPath.pathname.replace(/^\\+/, "/");
1917
+ }
1918
+ validateNavigationTarget(
1919
+ typeof opts.mask === "string" ? opts.mask : createPath(opts.mask),
1920
+ createPath(maskPath),
1921
+ init.history.createURL("/"),
1922
+ "reject"
1923
+ );
1860
1924
  }
1861
1925
  let currentLocation = state.location;
1862
1926
  let nextLocation = createLocation(
@@ -1870,6 +1934,12 @@ function createRouter(init) {
1870
1934
  ...nextLocation,
1871
1935
  ...init.history.encodeLocation(nextLocation)
1872
1936
  };
1937
+ validateNavigationTarget(
1938
+ to == null ? init.history.createHref(state.location) : typeof to === "string" ? to : createPath(to),
1939
+ init.history.createHref(nextLocation.mask || nextLocation),
1940
+ init.history.createURL("/"),
1941
+ "reject"
1942
+ );
1873
1943
  let userReplace = opts && opts.replace != null ? opts.replace : void 0;
1874
1944
  let historyAction = "PUSH" /* Push */;
1875
1945
  if (userReplace === true) {
@@ -2880,12 +2950,20 @@ function createRouter(init) {
2880
2950
  }
2881
2951
  let location = redirect2.response.headers.get("Location");
2882
2952
  invariant(location, "Expected a Location header on the redirect Response");
2953
+ let originalLocation = location;
2954
+ let currentUrl = new URL(request.url);
2883
2955
  location = normalizeRedirectLocation(
2884
2956
  location,
2885
- new URL(request.url),
2957
+ currentUrl,
2886
2958
  basename,
2887
2959
  init.history
2888
2960
  );
2961
+ validateNavigationTarget(
2962
+ originalLocation,
2963
+ location,
2964
+ currentUrl,
2965
+ "allow-explicit"
2966
+ );
2889
2967
  let redirectLocation = createLocation(state.location, location, {
2890
2968
  _isRedirect: true
2891
2969
  });
@@ -3404,6 +3482,7 @@ function createRouter(init) {
3404
3482
  // Passthrough to history-aware createHref used by useHref so we get proper
3405
3483
  // hash-aware URLs in DOM paths
3406
3484
  createHref: (to) => init.history.createHref(to),
3485
+ createURL: (to) => init.history.createURL(to),
3407
3486
  encodeLocation: (to) => init.history.encodeLocation(to),
3408
3487
  getFetcher,
3409
3488
  resetFetcher,
@@ -5945,6 +6024,12 @@ function useNavigateUnstable() {
5945
6024
  if (dataRouterContext == null && basename !== "/") {
5946
6025
  path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
5947
6026
  }
6027
+ validateNavigationTarget(
6028
+ typeof to === "string" ? to : createPath(to),
6029
+ navigator.createHref(path),
6030
+ getNavigatorCurrentUrl(navigator),
6031
+ "reject"
6032
+ );
5948
6033
  (!!options.replace ? navigator.replace : navigator.push)(
5949
6034
  path,
5950
6035
  options.state,
@@ -6186,7 +6271,7 @@ function RSCErrorHandler({
6186
6271
  children,
6187
6272
  error
6188
6273
  }) {
6189
- let { basename } = React2.useContext(NavigationContext);
6274
+ let { basename, navigator } = React2.useContext(NavigationContext);
6190
6275
  if (typeof error === "object" && error && "digest" in error && typeof error.digest === "string") {
6191
6276
  let redirect2 = decodeRedirectErrorDigest(error.digest);
6192
6277
  if (redirect2) {
@@ -6194,6 +6279,12 @@ function RSCErrorHandler({
6194
6279
  if (existingRedirect) throw existingRedirect;
6195
6280
  let parsed = parseToInfo(redirect2.location, basename);
6196
6281
  let target = parsed.absoluteURL || parsed.to;
6282
+ validateNavigationTarget(
6283
+ redirect2.location,
6284
+ target,
6285
+ getNavigatorCurrentUrl(navigator),
6286
+ "allow-explicit"
6287
+ );
6197
6288
  if (hasInvalidProtocol(target)) {
6198
6289
  throw new Error("Invalid redirect location");
6199
6290
  }
@@ -6871,6 +6962,7 @@ function RouterProvider({
6871
6962
  let navigator = React3.useMemo(() => {
6872
6963
  return {
6873
6964
  createHref: router.createHref,
6965
+ createURL: router.createURL,
6874
6966
  encodeLocation: router.encodeLocation,
6875
6967
  go: (n) => router.navigate(n),
6876
6968
  push: (to, state2, opts) => router.navigate(to, {
@@ -7003,7 +7095,7 @@ function Navigate({
7003
7095
  // the router loaded. We can help them understand how to avoid that.
7004
7096
  `<Navigate> may be used only in the context of a <Router> component.`
7005
7097
  );
7006
- let { static: isStatic } = React3.useContext(NavigationContext);
7098
+ let { static: isStatic, navigator } = React3.useContext(NavigationContext);
7007
7099
  warning(
7008
7100
  !isStatic,
7009
7101
  `<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`
@@ -7017,6 +7109,12 @@ function Navigate({
7017
7109
  locationPathname,
7018
7110
  relative === "path"
7019
7111
  );
7112
+ validateNavigationTarget(
7113
+ typeof to === "string" ? to : createPath(to),
7114
+ navigator.createHref(path),
7115
+ getNavigatorCurrentUrl(navigator),
7116
+ "reject"
7117
+ );
7020
7118
  let jsonPath = JSON.stringify(path);
7021
7119
  React3.useEffect(() => {
7022
7120
  navigate(JSON.parse(jsonPath), { replace: replace2, state, relative });
@@ -8172,6 +8270,9 @@ var ESCAPE_REGEX = /[&><\u2028\u2029]/g;
8172
8270
  function escapeHtml(html) {
8173
8271
  return html.replace(ESCAPE_REGEX, (match) => ESCAPE_LOOKUP[match]);
8174
8272
  }
8273
+ function escapeAttribute(value) {
8274
+ return value.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
8275
+ }
8175
8276
 
8176
8277
  // lib/dom/ssr/invariant.ts
8177
8278
  function invariant2(value, message) {
@@ -10307,7 +10408,7 @@ var isBrowser2 = typeof window !== "undefined" && typeof window.document !== "un
10307
10408
  try {
10308
10409
  if (isBrowser2) {
10309
10410
  window.__reactRouterVersion = // @ts-expect-error
10310
- "7.18.2";
10411
+ "7.18.4";
10311
10412
  }
10312
10413
  } catch (e) {
10313
10414
  }
@@ -11481,6 +11582,7 @@ export {
11481
11582
  ErrorResponseImpl,
11482
11583
  isRouteErrorResponse,
11483
11584
  instrumentHandler,
11585
+ validateNavigationTarget,
11484
11586
  IDLE_NAVIGATION,
11485
11587
  IDLE_FETCHER,
11486
11588
  IDLE_BLOCKER,
@@ -11551,6 +11653,7 @@ export {
11551
11653
  withErrorBoundaryProps,
11552
11654
  createSearchParams,
11553
11655
  escapeHtml,
11656
+ escapeAttribute,
11554
11657
  encode,
11555
11658
  createRequestInit,
11556
11659
  SingleFetchRedirectSymbol,
@@ -207,6 +207,14 @@ interface Router$1 {
207
207
  * @param location
208
208
  */
209
209
  createHref(location: Location | URL): string;
210
+ /**
211
+ * @private
212
+ * PRIVATE - DO NOT USE
213
+ *
214
+ * Utility function to create a URL for the given location
215
+ * @param location
216
+ */
217
+ createURL?(to: To): URL;
210
218
  /**
211
219
  * @private
212
220
  * PRIVATE - DO NOT USE
@@ -1751,6 +1759,7 @@ interface NavigateOptions {
1751
1759
  */
1752
1760
  interface Navigator {
1753
1761
  createHref: History["createHref"];
1762
+ createURL?: History["createURL"];
1754
1763
  encodeLocation?: History["encodeLocation"];
1755
1764
  go: History["go"];
1756
1765
  push(to: To, state?: any, opts?: NavigateOptions): void;
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import { a as RouterProviderProps$1, R as RouterInit, C as ClientInstrumentation, b as ClientOnErrorFunction } from './context-CeD5LmaF.mjs';
3
- export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-DBmQ1yAR.mjs';
2
+ import { a as RouterProviderProps$1, R as RouterInit, C as ClientInstrumentation, b as ClientOnErrorFunction } from './context-nqAapj74.mjs';
3
+ export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-BR5QG7ZC.mjs';
4
4
  import './data-DEjBmEfD.mjs';
5
5
 
6
6
  type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { RouterProviderProps as RouterProviderProps$1, RouterInit, ClientOnErrorFunction } from 'react-router';
3
- import { C as ClientInstrumentation } from './instrumentation-Dkmpzd13.js';
4
- export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-B2PdsXXH.js';
3
+ import { C as ClientInstrumentation } from './instrumentation-B7w3_Eo9.js';
4
+ export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-eq4RgLsD.js';
5
5
  import './data-CjO11-hU.js';
6
6
 
7
7
  type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
@@ -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.18.2
2
+ * react-router v7.18.4
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -13,7 +13,7 @@
13
13
 
14
14
 
15
15
 
16
- var _chunk3UVS743Kjs = require('./chunk-3UVS743K.js');
16
+ var _chunkLVPI3KDGjs = require('./chunk-LVPI3KDG.js');
17
17
 
18
18
 
19
19
 
@@ -37,7 +37,8 @@ var _chunk3UVS743Kjs = require('./chunk-3UVS743K.js');
37
37
 
38
38
 
39
39
 
40
- var _chunkHHGH3NKSjs = require('./chunk-HHGH3NKS.js');
40
+
41
+ var _chunkGR4NQCSDjs = require('./chunk-GR4NQCSD.js');
41
42
 
42
43
  // lib/dom-export/dom-router-provider.tsx
43
44
  var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react); var React3 = _interopRequireWildcard(_react);
@@ -213,7 +214,7 @@ function HydratedRouter(props) {
213
214
  }, []);
214
215
  React2.useEffect(() => {
215
216
  if (process.env.NODE_ENV === "development" && criticalCss === void 0) {
216
- document.querySelectorAll(`[${_chunkHHGH3NKSjs.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
217
+ document.querySelectorAll(`[${_chunkGR4NQCSDjs.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
217
218
  }
218
219
  }, [criticalCss]);
219
220
  let [location2, setLocation] = React2.useState(router.state.location);
@@ -307,8 +308,14 @@ function createCallServer({
307
308
  Promise.resolve(payloadPromise).then(async (payload) => {
308
309
  if (payload.type === "redirect") {
309
310
  let location2 = normalizeRedirectLocation(payload.location);
311
+ _chunkGR4NQCSDjs.validateNavigationTarget.call(void 0,
312
+ payload.location,
313
+ location2,
314
+ new URL(window.location.href),
315
+ "allow-explicit"
316
+ );
310
317
  if (payload.reload || isExternalLocation(location2)) {
311
- if (_chunkHHGH3NKSjs.hasInvalidProtocol.call(void 0, location2)) {
318
+ if (_chunkGR4NQCSDjs.hasInvalidProtocol.call(void 0, location2)) {
312
319
  throw new Error("Invalid redirect location");
313
320
  }
314
321
  window.location.href = location2;
@@ -328,8 +335,14 @@ function createCallServer({
328
335
  if (rerender && landedActionId < actionId && globalVar.__routerActionID <= actionId) {
329
336
  if (rerender.type === "redirect") {
330
337
  let location2 = normalizeRedirectLocation(rerender.location);
338
+ _chunkGR4NQCSDjs.validateNavigationTarget.call(void 0,
339
+ rerender.location,
340
+ location2,
341
+ new URL(window.location.href),
342
+ "allow-explicit"
343
+ );
331
344
  if (rerender.reload || isExternalLocation(location2)) {
332
- if (_chunkHHGH3NKSjs.hasInvalidProtocol.call(void 0, location2)) {
345
+ if (_chunkGR4NQCSDjs.hasInvalidProtocol.call(void 0, location2)) {
333
346
  throw new Error("Invalid redirect location");
334
347
  }
335
348
  window.location.href = location2;
@@ -394,7 +407,7 @@ function createRouterFromPayload({
394
407
  };
395
408
  if (payload.type !== "render") throw new Error("Invalid payload type");
396
409
  globalVar.__reactRouterRouteModules = _nullishCoalesce(globalVar.__reactRouterRouteModules, () => ( {}));
397
- _chunk3UVS743Kjs.populateRSCRouteModules.call(void 0, globalVar.__reactRouterRouteModules, payload.matches);
410
+ _chunkLVPI3KDGjs.populateRSCRouteModules.call(void 0, globalVar.__reactRouterRouteModules, payload.matches);
398
411
  let routes = payload.matches.reduceRight((previous, match) => {
399
412
  const route = createRouteFromServerManifest(
400
413
  match,
@@ -408,12 +421,12 @@ function createRouterFromPayload({
408
421
  return [route];
409
422
  }, []);
410
423
  let applyPatchesPromise;
411
- globalVar.__reactRouterDataRouter = _chunkHHGH3NKSjs.createRouter.call(void 0, {
424
+ globalVar.__reactRouterDataRouter = _chunkGR4NQCSDjs.createRouter.call(void 0, {
412
425
  routes,
413
426
  getContext,
414
427
  basename: payload.basename,
415
- history: _chunkHHGH3NKSjs.createBrowserHistory.call(void 0, ),
416
- hydrationData: _chunk3UVS743Kjs.getHydrationData.call(void 0, {
428
+ history: _chunkGR4NQCSDjs.createBrowserHistory.call(void 0, ),
429
+ hydrationData: _chunkLVPI3KDGjs.getHydrationData.call(void 0, {
417
430
  state: {
418
431
  loaderData: payload.loaderData,
419
432
  actionData: payload.actionData,
@@ -422,7 +435,7 @@ function createRouterFromPayload({
422
435
  routes,
423
436
  getRouteInfo: (routeId) => {
424
437
  let match = payload.matches.find((m) => m.id === routeId);
425
- _chunkHHGH3NKSjs.invariant.call(void 0, match, "Route not found in payload");
438
+ _chunkGR4NQCSDjs.invariant.call(void 0, match, "Route not found in payload");
426
439
  return {
427
440
  clientLoader: match.clientLoader,
428
441
  hasLoader: match.hasLoader,
@@ -537,9 +550,9 @@ function createRouterFromPayload({
537
550
  routeModules: globalVar.__reactRouterRouteModules
538
551
  };
539
552
  }
540
- var renderedRoutesContext = _chunkHHGH3NKSjs.createContext.call(void 0, );
553
+ var renderedRoutesContext = _chunkGR4NQCSDjs.createContext.call(void 0, );
541
554
  function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReadableStream, fetchImplementation) {
542
- let dataStrategy = _chunkHHGH3NKSjs.getSingleFetchDataStrategyImpl.call(void 0,
555
+ let dataStrategy = _chunkGR4NQCSDjs.getSingleFetchDataStrategyImpl.call(void 0,
543
556
  getRouter,
544
557
  (match) => {
545
558
  let M = match;
@@ -596,20 +609,20 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReada
596
609
  function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation) {
597
610
  return async (args, basename, trailingSlashAware, targetRoutes) => {
598
611
  let { request, context } = args;
599
- let url = _chunkHHGH3NKSjs.singleFetchUrl.call(void 0, request.url, basename, trailingSlashAware, "rsc");
612
+ let url = _chunkGR4NQCSDjs.singleFetchUrl.call(void 0, request.url, basename, trailingSlashAware, "rsc");
600
613
  if (request.method === "GET") {
601
- url = _chunkHHGH3NKSjs.stripIndexParam.call(void 0, url);
614
+ url = _chunkGR4NQCSDjs.stripIndexParam.call(void 0, url);
602
615
  if (targetRoutes) {
603
616
  url.searchParams.set("_routes", targetRoutes.join(","));
604
617
  }
605
618
  }
606
619
  let res = await fetchImplementation(
607
- new Request(url, await _chunkHHGH3NKSjs.createRequestInit.call(void 0, request))
620
+ new Request(url, await _chunkGR4NQCSDjs.createRequestInit.call(void 0, request))
608
621
  );
609
622
  if (res.status >= 400 && !res.headers.has("X-Remix-Response")) {
610
- throw new (0, _chunkHHGH3NKSjs.ErrorResponseImpl)(res.status, res.statusText, await res.text());
623
+ throw new (0, _chunkGR4NQCSDjs.ErrorResponseImpl)(res.status, res.statusText, await res.text());
611
624
  }
612
- _chunkHHGH3NKSjs.invariant.call(void 0, res.body, "No response body to decode");
625
+ _chunkGR4NQCSDjs.invariant.call(void 0, res.body, "No response body to decode");
613
626
  try {
614
627
  const payload = await createFromReadableStream(res.body, {
615
628
  temporaryReferences: void 0
@@ -633,7 +646,7 @@ function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation)
633
646
  }
634
647
  context.get(renderedRoutesContext).push(...payload.matches);
635
648
  let results = { routes: {} };
636
- const dataKey = _chunkHHGH3NKSjs.isMutationMethod.call(void 0, request.method) ? "actionData" : "loaderData";
649
+ const dataKey = _chunkGR4NQCSDjs.isMutationMethod.call(void 0, request.method) ? "actionData" : "loaderData";
637
650
  for (let [routeId, data] of Object.entries(payload[dataKey] || {})) {
638
651
  results.routes[routeId] = { data };
639
652
  }
@@ -666,7 +679,7 @@ function RSCHydratedRouter({
666
679
  [createFromReadableStream, payload, fetchImplementation, getContext]
667
680
  );
668
681
  React3.useEffect(() => {
669
- _chunkHHGH3NKSjs.setIsHydrated.call(void 0, );
682
+ _chunkGR4NQCSDjs.setIsHydrated.call(void 0, );
670
683
  }, []);
671
684
  React3.useLayoutEffect(() => {
672
685
  const globalVar = window;
@@ -774,8 +787,8 @@ function RSCHydratedRouter({
774
787
  },
775
788
  routeModules
776
789
  };
777
- return /* @__PURE__ */ React3.createElement(_chunkHHGH3NKSjs.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunk3UVS743Kjs.RSCRouterGlobalErrorBoundary, { location: state.location }, /* @__PURE__ */ React3.createElement(_chunkHHGH3NKSjs.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement(
778
- _chunkHHGH3NKSjs.RouterProvider,
790
+ return /* @__PURE__ */ React3.createElement(_chunkGR4NQCSDjs.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunkLVPI3KDGjs.RSCRouterGlobalErrorBoundary, { location: state.location }, /* @__PURE__ */ React3.createElement(_chunkGR4NQCSDjs.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement(
791
+ _chunkGR4NQCSDjs.RouterProvider,
779
792
  {
780
793
  router: transitionEnabledRouter,
781
794
  flushSync: ReactDOM2.flushSync
@@ -791,8 +804,8 @@ function createRouteFromServerManifest(match, payload) {
791
804
  // the server loader flow regardless of whether the client loader calls
792
805
  // `serverLoader` or not, otherwise we'll have nothing to render.
793
806
  match.hasComponent && !match.element;
794
- _chunkHHGH3NKSjs.invariant.call(void 0, window.__reactRouterRouteModules);
795
- _chunk3UVS743Kjs.populateRSCRouteModules.call(void 0, window.__reactRouterRouteModules, match);
807
+ _chunkGR4NQCSDjs.invariant.call(void 0, window.__reactRouterRouteModules);
808
+ _chunkLVPI3KDGjs.populateRSCRouteModules.call(void 0, window.__reactRouterRouteModules, match);
796
809
  let dataRoute = {
797
810
  id: match.id,
798
811
  element: match.element,
@@ -840,7 +853,7 @@ function createRouteFromServerManifest(match, payload) {
840
853
  return await callSingleFetch(singleFetch);
841
854
  }
842
855
  }) : match.hasAction ? (_, singleFetch) => callSingleFetch(singleFetch) : () => {
843
- throw _chunkHHGH3NKSjs.noActionDefinedError.call(void 0, "action", match.id);
856
+ throw _chunkGR4NQCSDjs.noActionDefinedError.call(void 0, "action", match.id);
844
857
  },
845
858
  path: match.path,
846
859
  shouldRevalidate: match.shouldRevalidate,
@@ -852,7 +865,7 @@ function createRouteFromServerManifest(match, payload) {
852
865
  hasClientAction: match.clientAction != null
853
866
  };
854
867
  if (typeof dataRoute.loader === "function") {
855
- dataRoute.loader.hydrate = _chunkHHGH3NKSjs.shouldHydrateRouteLoader.call(void 0,
868
+ dataRoute.loader.hydrate = _chunkGR4NQCSDjs.shouldHydrateRouteLoader.call(void 0,
856
869
  match.id,
857
870
  match.clientLoader,
858
871
  match.hasLoader,
@@ -862,7 +875,7 @@ function createRouteFromServerManifest(match, payload) {
862
875
  return dataRoute;
863
876
  }
864
877
  function callSingleFetch(singleFetch) {
865
- _chunkHHGH3NKSjs.invariant.call(void 0, typeof singleFetch === "function", "Invalid singleFetch parameter");
878
+ _chunkGR4NQCSDjs.invariant.call(void 0, typeof singleFetch === "function", "Invalid singleFetch parameter");
866
879
  return singleFetch();
867
880
  }
868
881
  function preventInvalidServerHandlerCall(type, routeId, hasHandler) {
@@ -870,7 +883,7 @@ function preventInvalidServerHandlerCall(type, routeId, hasHandler) {
870
883
  let fn = type === "action" ? "serverAction()" : "serverLoader()";
871
884
  let msg = `You are trying to call ${fn} on a route that does not have a server ${type} (routeId: "${routeId}")`;
872
885
  console.error(msg);
873
- throw new (0, _chunkHHGH3NKSjs.ErrorResponseImpl)(400, "Bad Request", new Error(msg), true);
886
+ throw new (0, _chunkGR4NQCSDjs.ErrorResponseImpl)(400, "Bad Request", new Error(msg), true);
874
887
  }
875
888
  }
876
889
  var nextPaths = /* @__PURE__ */ new Set();
@@ -893,12 +906,12 @@ function getManifestUrl(paths) {
893
906
  return url;
894
907
  }
895
908
  async function fetchAndApplyManifestPatches(paths, createFromReadableStream, fetchImplementation, signal) {
896
- paths = _chunkHHGH3NKSjs.getPathsWithAncestors.call(void 0, paths);
909
+ paths = _chunkGR4NQCSDjs.getPathsWithAncestors.call(void 0, paths);
897
910
  let url = getManifestUrl(paths);
898
911
  if (url == null) {
899
912
  return;
900
913
  }
901
- if (url.toString().length > _chunkHHGH3NKSjs.URL_LIMIT) {
914
+ if (url.toString().length > _chunkGR4NQCSDjs.URL_LIMIT) {
902
915
  nextPaths.clear();
903
916
  return;
904
917
  }
@@ -942,8 +955,8 @@ function isExternalLocation(location2) {
942
955
  return newLocation.origin !== window.location.origin;
943
956
  }
944
957
  function normalizeRedirectLocation(location2) {
945
- if (_chunkHHGH3NKSjs.PROTOCOL_RELATIVE_URL_REGEX.test(location2)) {
946
- let path = _chunkHHGH3NKSjs.resolvePath.call(void 0, location2);
958
+ if (_chunkGR4NQCSDjs.PROTOCOL_RELATIVE_URL_REGEX.test(location2)) {
959
+ let path = _chunkGR4NQCSDjs.resolvePath.call(void 0, location2);
947
960
  return path.pathname + path.search + path.hash;
948
961
  }
949
962
  return location2;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.18.2
2
+ * react-router v7.18.4
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -13,7 +13,7 @@ import {
13
13
  RSCRouterGlobalErrorBoundary,
14
14
  getHydrationData,
15
15
  populateRSCRouteModules
16
- } from "./chunk-ZA36QIGN.mjs";
16
+ } from "./chunk-H4DAEOV7.mjs";
17
17
  import {
18
18
  CRITICAL_CSS_DATA_ATTRIBUTE,
19
19
  ErrorResponseImpl,
@@ -45,8 +45,9 @@ import {
45
45
  shouldHydrateRouteLoader,
46
46
  singleFetchUrl,
47
47
  stripIndexParam,
48
- useFogOFWarDiscovery
49
- } from "./chunk-62JRHF6Z.mjs";
48
+ useFogOFWarDiscovery,
49
+ validateNavigationTarget
50
+ } from "./chunk-OB3PAWPO.mjs";
50
51
 
51
52
  // lib/dom-export/dom-router-provider.tsx
52
53
  import * as React from "react";
@@ -299,6 +300,12 @@ function createCallServer({
299
300
  Promise.resolve(payloadPromise).then(async (payload) => {
300
301
  if (payload.type === "redirect") {
301
302
  let location2 = normalizeRedirectLocation(payload.location);
303
+ validateNavigationTarget(
304
+ payload.location,
305
+ location2,
306
+ new URL(window.location.href),
307
+ "allow-explicit"
308
+ );
302
309
  if (payload.reload || isExternalLocation(location2)) {
303
310
  if (hasInvalidProtocol(location2)) {
304
311
  throw new Error("Invalid redirect location");
@@ -320,6 +327,12 @@ function createCallServer({
320
327
  if (rerender && landedActionId < actionId && globalVar.__routerActionID <= actionId) {
321
328
  if (rerender.type === "redirect") {
322
329
  let location2 = normalizeRedirectLocation(rerender.location);
330
+ validateNavigationTarget(
331
+ rerender.location,
332
+ location2,
333
+ new URL(window.location.href),
334
+ "allow-explicit"
335
+ );
323
336
  if (rerender.reload || isExternalLocation(location2)) {
324
337
  if (hasInvalidProtocol(location2)) {
325
338
  throw new Error("Invalid redirect location");
@@ -1,4 +1,4 @@
1
- import { l as ServerInstrumentation, H as HydrationState, e as StaticHandlerContext, c as RelativeRoutingType, a as Router$1, g as RouterState, R as RouterInit, t as FutureConfig$1, C as ClientInstrumentation, d as GetScrollRestorationKeyFunction, F as Fetcher, B as BlockerFunction, u as CreateStaticHandlerOptions$1, S as StaticHandler } from './instrumentation-Dkmpzd13.js';
1
+ import { l as ServerInstrumentation, H as HydrationState, e as StaticHandlerContext, c as RelativeRoutingType, a as Router$1, g as RouterState, R as RouterInit, t as FutureConfig$1, C as ClientInstrumentation, d as GetScrollRestorationKeyFunction, F as Fetcher, B as BlockerFunction, u as CreateStaticHandlerOptions$1, S as StaticHandler } from './instrumentation-B7w3_Eo9.js';
2
2
  import * as React from 'react';
3
3
  import { p as RouteManifest, aE as ServerRouteModule, t as MiddlewareEnabled, c as RouterContextProvider, u as AppLoadContext, s as LoaderFunctionArgs, a0 as ActionFunctionArgs, O as RouteModules, n as DataRouteObject, a as ClientLoaderFunction, o as RouteBranch, aF as TrackedPromise, f as History, T as To, L as Location, i as Action, ac as RouteMatch, Y as InitialEntry, _ as NonIndexRouteObject, a7 as LazyRouteFunction, Z as IndexRouteObject, P as Params, l as DataStrategyFunction, m as PatchRoutesOnNavigationFunction, e as RouteObject, U as UIMatch, q as HTMLFormMethod, F as FormEncType, av as PageLinkDescriptor, Q as SerializeFrom } from './data-CjO11-hU.js';
4
4
 
@@ -197,6 +197,7 @@ interface NavigateOptions {
197
197
  */
198
198
  interface Navigator {
199
199
  createHref: History["createHref"];
200
+ createURL?: History["createURL"];
200
201
  encodeLocation?: History["encodeLocation"];
201
202
  go: History["go"];
202
203
  push(to: To, state?: any, opts?: NavigateOptions): void;
@@ -1,4 +1,4 @@
1
- import { o as ServerInstrumentation, H as HydrationState, h as StaticHandlerContext, f as RelativeRoutingType, g as GetScrollRestorationKeyFunction, R as RouterInit, ah as FutureConfig$1, C as ClientInstrumentation, N as NavigateOptions, F as Fetcher, c as Router, B as BlockerFunction, ai as CreateStaticHandlerOptions$1, S as StaticHandler } from './context-CeD5LmaF.mjs';
1
+ import { o as ServerInstrumentation, H as HydrationState, h as StaticHandlerContext, f as RelativeRoutingType, g as GetScrollRestorationKeyFunction, R as RouterInit, ah as FutureConfig$1, C as ClientInstrumentation, N as NavigateOptions, F as Fetcher, c as Router, B as BlockerFunction, ai as CreateStaticHandlerOptions$1, S as StaticHandler } from './context-nqAapj74.mjs';
2
2
  import * as React from 'react';
3
3
  import { J as RouteManifest, aF as ServerRouteModule, p as MiddlewareEnabled, c as RouterContextProvider, q as AppLoadContext, o as LoaderFunctionArgs, a3 as ActionFunctionArgs, Z as RouteModules, E as DataRouteObject, a as ClientLoaderFunction, I as RouteBranch, m as HTMLFormMethod, n as FormEncType, aw as PageLinkDescriptor, T as To, s as History, z as DataStrategyFunction, B as PatchRoutesOnNavigationFunction, r as RouteObject, _ as SerializeFrom, L as Location } from './data-DEjBmEfD.mjs';
4
4
 
@@ -1,4 +1,4 @@
1
- export { Q as MemoryRouter, T as Navigate, U as Outlet, V as Route, W as Router, X as RouterProvider, Y as Routes, A as UNSAFE_AwaitContextProvider, ab as UNSAFE_WithComponentProps, af as UNSAFE_WithErrorBoundaryProps, ad as UNSAFE_WithHydrateFallbackProps } from './context-CeD5LmaF.mjs';
2
- export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-CACgcj2J.mjs';
1
+ export { Q as MemoryRouter, T as Navigate, U as Outlet, V as Route, W as Router, X as RouterProvider, Y as Routes, A as UNSAFE_AwaitContextProvider, ab as UNSAFE_WithComponentProps, af as UNSAFE_WithErrorBoundaryProps, ad as UNSAFE_WithHydrateFallbackProps } from './context-nqAapj74.mjs';
2
+ export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-K63fpMH4.mjs';
3
3
  import './data-DEjBmEfD.mjs';
4
4
  import 'react';
@@ -1,4 +1,4 @@
1
- export { W as BrowserRouter, $ as Form, X as HashRouter, Y as Link, an as Links, j as MemoryRouter, am as Meta, _ as NavLink, k as Navigate, l as Outlet, m as Route, n as Router, o as RouterProvider, p as Routes, a0 as ScrollRestoration, ak as StaticRouter, al as StaticRouterProvider, b as UNSAFE_AwaitContextProvider, aH as UNSAFE_WithComponentProps, aL as UNSAFE_WithErrorBoundaryProps, aJ as UNSAFE_WithHydrateFallbackProps, Z as unstable_HistoryRouter } from './index-react-server-client-3ykjivgQ.js';
2
- import './instrumentation-Dkmpzd13.js';
1
+ export { W as BrowserRouter, $ as Form, X as HashRouter, Y as Link, an as Links, j as MemoryRouter, am as Meta, _ as NavLink, k as Navigate, l as Outlet, m as Route, n as Router, o as RouterProvider, p as Routes, a0 as ScrollRestoration, ak as StaticRouter, al as StaticRouterProvider, b as UNSAFE_AwaitContextProvider, aH as UNSAFE_WithComponentProps, aL as UNSAFE_WithErrorBoundaryProps, aJ as UNSAFE_WithHydrateFallbackProps, Z as unstable_HistoryRouter } from './index-react-server-client-BjY-eKuf.js';
2
+ import './instrumentation-B7w3_Eo9.js';
3
3
  import './data-CjO11-hU.js';
4
4
  import 'react';