react-router 0.0.0-experimental-e56aa53bc → 0.0.0-experimental-e6fb6e074

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 (65) hide show
  1. package/CHANGELOG.md +18 -734
  2. package/README.md +14 -5
  3. package/dist/index.d.ts +30 -0
  4. package/dist/index.js +1501 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/lib/components.d.ts +157 -0
  7. package/dist/lib/context.d.ts +102 -0
  8. package/dist/lib/deprecations.d.ts +4 -0
  9. package/dist/lib/hooks.d.ts +181 -0
  10. package/dist/main.js +19 -0
  11. package/dist/react-router.development.js +1397 -0
  12. package/dist/react-router.development.js.map +1 -0
  13. package/dist/react-router.production.min.js +12 -0
  14. package/dist/react-router.production.min.js.map +1 -0
  15. package/dist/umd/react-router.development.js +1624 -0
  16. package/dist/umd/react-router.development.js.map +1 -0
  17. package/dist/umd/react-router.production.min.js +12 -0
  18. package/dist/umd/react-router.production.min.js.map +1 -0
  19. package/package.json +9 -111
  20. package/dist/development/chunk-RMWJZNG5.mjs +0 -11505
  21. package/dist/development/data-CQbyyGzl.d.mts +0 -11
  22. package/dist/development/data-CQbyyGzl.d.ts +0 -11
  23. package/dist/development/dom-export.d.mts +0 -23
  24. package/dist/development/dom-export.d.ts +0 -23
  25. package/dist/development/dom-export.js +0 -6341
  26. package/dist/development/dom-export.mjs +0 -222
  27. package/dist/development/fog-of-war-C5L_Yd5M.d.mts +0 -1778
  28. package/dist/development/fog-of-war-DrUCUQQ-.d.ts +0 -1778
  29. package/dist/development/index.d.mts +0 -855
  30. package/dist/development/index.d.ts +0 -855
  31. package/dist/development/index.js +0 -11664
  32. package/dist/development/index.mjs +0 -263
  33. package/dist/development/lib/types/route-module.d.mts +0 -209
  34. package/dist/development/lib/types/route-module.d.ts +0 -209
  35. package/dist/development/lib/types/route-module.js +0 -28
  36. package/dist/development/lib/types/route-module.mjs +0 -10
  37. package/dist/development/route-data-BIYebJr3.d.mts +0 -1749
  38. package/dist/development/route-data-BIYebJr3.d.ts +0 -1749
  39. package/dist/development/rsc-export.d.mts +0 -1788
  40. package/dist/development/rsc-export.d.ts +0 -1788
  41. package/dist/development/rsc-export.js +0 -2778
  42. package/dist/development/rsc-export.mjs +0 -2743
  43. package/dist/production/chunk-BXBFRMFA.mjs +0 -11505
  44. package/dist/production/data-CQbyyGzl.d.mts +0 -11
  45. package/dist/production/data-CQbyyGzl.d.ts +0 -11
  46. package/dist/production/dom-export.d.mts +0 -23
  47. package/dist/production/dom-export.d.ts +0 -23
  48. package/dist/production/dom-export.js +0 -6341
  49. package/dist/production/dom-export.mjs +0 -222
  50. package/dist/production/fog-of-war-C5L_Yd5M.d.mts +0 -1778
  51. package/dist/production/fog-of-war-DrUCUQQ-.d.ts +0 -1778
  52. package/dist/production/index.d.mts +0 -855
  53. package/dist/production/index.d.ts +0 -855
  54. package/dist/production/index.js +0 -11664
  55. package/dist/production/index.mjs +0 -263
  56. package/dist/production/lib/types/route-module.d.mts +0 -209
  57. package/dist/production/lib/types/route-module.d.ts +0 -209
  58. package/dist/production/lib/types/route-module.js +0 -28
  59. package/dist/production/lib/types/route-module.mjs +0 -10
  60. package/dist/production/route-data-BIYebJr3.d.mts +0 -1749
  61. package/dist/production/route-data-BIYebJr3.d.ts +0 -1749
  62. package/dist/production/rsc-export.d.mts +0 -1788
  63. package/dist/production/rsc-export.d.ts +0 -1788
  64. package/dist/production/rsc-export.js +0 -2778
  65. package/dist/production/rsc-export.mjs +0 -2743
@@ -0,0 +1,1624 @@
1
+ /**
2
+ * React Router v0.0.0-experimental-e6fb6e074
3
+ *
4
+ * Copyright (c) Remix Software Inc.
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE.md file in the root directory of this source tree.
8
+ *
9
+ * @license MIT
10
+ */
11
+ (function (global, factory) {
12
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@remix-run/router')) :
13
+ typeof define === 'function' && define.amd ? define(['exports', 'react', '@remix-run/router'], factory) :
14
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ReactRouter = {}, global.React, global.RemixRouter));
15
+ })(this, (function (exports, React, router) { 'use strict';
16
+
17
+ function _interopNamespace(e) {
18
+ if (e && e.__esModule) return e;
19
+ var n = Object.create(null);
20
+ if (e) {
21
+ Object.keys(e).forEach(function (k) {
22
+ if (k !== 'default') {
23
+ var d = Object.getOwnPropertyDescriptor(e, k);
24
+ Object.defineProperty(n, k, d.get ? d : {
25
+ enumerable: true,
26
+ get: function () { return e[k]; }
27
+ });
28
+ }
29
+ });
30
+ }
31
+ n["default"] = e;
32
+ return Object.freeze(n);
33
+ }
34
+
35
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
36
+
37
+ function _extends() {
38
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
39
+ for (var i = 1; i < arguments.length; i++) {
40
+ var source = arguments[i];
41
+ for (var key in source) {
42
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
43
+ target[key] = source[key];
44
+ }
45
+ }
46
+ }
47
+ return target;
48
+ };
49
+ return _extends.apply(this, arguments);
50
+ }
51
+
52
+ // Create react-specific types from the agnostic types in @remix-run/router to
53
+ // export from react-router
54
+ const DataRouterContext = /*#__PURE__*/React__namespace.createContext(null);
55
+ {
56
+ DataRouterContext.displayName = "DataRouter";
57
+ }
58
+ const DataRouterStateContext = /*#__PURE__*/React__namespace.createContext(null);
59
+ {
60
+ DataRouterStateContext.displayName = "DataRouterState";
61
+ }
62
+ const AwaitContext = /*#__PURE__*/React__namespace.createContext(null);
63
+ {
64
+ AwaitContext.displayName = "Await";
65
+ }
66
+
67
+ /**
68
+ * A Navigator is a "location changer"; it's how you get to different locations.
69
+ *
70
+ * Every history instance conforms to the Navigator interface, but the
71
+ * distinction is useful primarily when it comes to the low-level `<Router>` API
72
+ * where both the location and a navigator must be provided separately in order
73
+ * to avoid "tearing" that may occur in a suspense-enabled app if the action
74
+ * and/or location were to be read directly from the history instance.
75
+ */
76
+
77
+ const NavigationContext = /*#__PURE__*/React__namespace.createContext(null);
78
+ {
79
+ NavigationContext.displayName = "Navigation";
80
+ }
81
+ const LocationContext = /*#__PURE__*/React__namespace.createContext(null);
82
+ {
83
+ LocationContext.displayName = "Location";
84
+ }
85
+ const RouteContext = /*#__PURE__*/React__namespace.createContext({
86
+ outlet: null,
87
+ matches: [],
88
+ isDataRoute: false
89
+ });
90
+ {
91
+ RouteContext.displayName = "Route";
92
+ }
93
+ const RouteErrorContext = /*#__PURE__*/React__namespace.createContext(null);
94
+ {
95
+ RouteErrorContext.displayName = "RouteError";
96
+ }
97
+
98
+ /**
99
+ * Returns the full href for the given "to" value. This is useful for building
100
+ * custom links that are also accessible and preserve right-click behavior.
101
+ *
102
+ * @see https://reactrouter.com/v6/hooks/use-href
103
+ */
104
+ function useHref(to, _temp) {
105
+ let {
106
+ relative
107
+ } = _temp === void 0 ? {} : _temp;
108
+ !useInRouterContext() ? router.UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the
109
+ // router loaded. We can help them understand how to avoid that.
110
+ "useHref() may be used only in the context of a <Router> component.") : void 0;
111
+ let {
112
+ basename,
113
+ navigator
114
+ } = React__namespace.useContext(NavigationContext);
115
+ let {
116
+ hash,
117
+ pathname,
118
+ search
119
+ } = useResolvedPath(to, {
120
+ relative
121
+ });
122
+ let joinedPathname = pathname;
123
+
124
+ // If we're operating within a basename, prepend it to the pathname prior
125
+ // to creating the href. If this is a root navigation, then just use the raw
126
+ // basename which allows the basename to have full control over the presence
127
+ // of a trailing slash on root links
128
+ if (basename !== "/") {
129
+ joinedPathname = pathname === "/" ? basename : router.joinPaths([basename, pathname]);
130
+ }
131
+ return navigator.createHref({
132
+ pathname: joinedPathname,
133
+ search,
134
+ hash
135
+ });
136
+ }
137
+
138
+ /**
139
+ * Returns true if this component is a descendant of a `<Router>`.
140
+ *
141
+ * @see https://reactrouter.com/v6/hooks/use-in-router-context
142
+ */
143
+ function useInRouterContext() {
144
+ return React__namespace.useContext(LocationContext) != null;
145
+ }
146
+
147
+ /**
148
+ * Returns the current location object, which represents the current URL in web
149
+ * browsers.
150
+ *
151
+ * Note: If you're using this it may mean you're doing some of your own
152
+ * "routing" in your app, and we'd like to know what your use case is. We may
153
+ * be able to provide something higher-level to better suit your needs.
154
+ *
155
+ * @see https://reactrouter.com/v6/hooks/use-location
156
+ */
157
+ function useLocation() {
158
+ !useInRouterContext() ? router.UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the
159
+ // router loaded. We can help them understand how to avoid that.
160
+ "useLocation() may be used only in the context of a <Router> component.") : void 0;
161
+ return React__namespace.useContext(LocationContext).location;
162
+ }
163
+
164
+ /**
165
+ * Returns the current navigation action which describes how the router came to
166
+ * the current location, either by a pop, push, or replace on the history stack.
167
+ *
168
+ * @see https://reactrouter.com/v6/hooks/use-navigation-type
169
+ */
170
+ function useNavigationType() {
171
+ return React__namespace.useContext(LocationContext).navigationType;
172
+ }
173
+
174
+ /**
175
+ * Returns a PathMatch object if the given pattern matches the current URL.
176
+ * This is useful for components that need to know "active" state, e.g.
177
+ * `<NavLink>`.
178
+ *
179
+ * @see https://reactrouter.com/v6/hooks/use-match
180
+ */
181
+ function useMatch(pattern) {
182
+ !useInRouterContext() ? router.UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the
183
+ // router loaded. We can help them understand how to avoid that.
184
+ "useMatch() may be used only in the context of a <Router> component.") : void 0;
185
+ let {
186
+ pathname
187
+ } = useLocation();
188
+ return React__namespace.useMemo(() => router.matchPath(pattern, router.UNSAFE_decodePath(pathname)), [pathname, pattern]);
189
+ }
190
+
191
+ /**
192
+ * The interface for the navigate() function returned from useNavigate().
193
+ */
194
+
195
+ const navigateEffectWarning = "You should call navigate() in a React.useEffect(), not when " + "your component is first rendered.";
196
+
197
+ // Mute warnings for calls to useNavigate in SSR environments
198
+ function useIsomorphicLayoutEffect(cb) {
199
+ let isStatic = React__namespace.useContext(NavigationContext).static;
200
+ if (!isStatic) {
201
+ // We should be able to get rid of this once react 18.3 is released
202
+ // See: https://github.com/facebook/react/pull/26395
203
+ // eslint-disable-next-line react-hooks/rules-of-hooks
204
+ React__namespace.useLayoutEffect(cb);
205
+ }
206
+ }
207
+
208
+ /**
209
+ * Returns an imperative method for changing the location. Used by `<Link>`s, but
210
+ * may also be used by other elements to change the location.
211
+ *
212
+ * @see https://reactrouter.com/v6/hooks/use-navigate
213
+ */
214
+ function useNavigate() {
215
+ let {
216
+ isDataRoute
217
+ } = React__namespace.useContext(RouteContext);
218
+ // Conditional usage is OK here because the usage of a data router is static
219
+ // eslint-disable-next-line react-hooks/rules-of-hooks
220
+ return isDataRoute ? useNavigateStable() : useNavigateUnstable();
221
+ }
222
+ function useNavigateUnstable() {
223
+ !useInRouterContext() ? router.UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the
224
+ // router loaded. We can help them understand how to avoid that.
225
+ "useNavigate() may be used only in the context of a <Router> component.") : void 0;
226
+ let dataRouterContext = React__namespace.useContext(DataRouterContext);
227
+ let {
228
+ basename,
229
+ future,
230
+ navigator
231
+ } = React__namespace.useContext(NavigationContext);
232
+ let {
233
+ matches
234
+ } = React__namespace.useContext(RouteContext);
235
+ let {
236
+ pathname: locationPathname
237
+ } = useLocation();
238
+ let routePathnamesJson = JSON.stringify(router.UNSAFE_getResolveToMatches(matches, future.v7_relativeSplatPath));
239
+ let activeRef = React__namespace.useRef(false);
240
+ useIsomorphicLayoutEffect(() => {
241
+ activeRef.current = true;
242
+ });
243
+ let navigate = React__namespace.useCallback(function (to, options) {
244
+ if (options === void 0) {
245
+ options = {};
246
+ }
247
+ router.UNSAFE_warning(activeRef.current, navigateEffectWarning) ;
248
+
249
+ // Short circuit here since if this happens on first render the navigate
250
+ // is useless because we haven't wired up our history listener yet
251
+ if (!activeRef.current) return;
252
+ if (typeof to === "number") {
253
+ navigator.go(to);
254
+ return;
255
+ }
256
+ let path = router.resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, options.relative === "path");
257
+
258
+ // If we're operating within a basename, prepend it to the pathname prior
259
+ // to handing off to history (but only if we're not in a data router,
260
+ // otherwise it'll prepend the basename inside of the router).
261
+ // If this is a root navigation, then we navigate to the raw basename
262
+ // which allows the basename to have full control over the presence of a
263
+ // trailing slash on root links
264
+ if (dataRouterContext == null && basename !== "/") {
265
+ path.pathname = path.pathname === "/" ? basename : router.joinPaths([basename, path.pathname]);
266
+ }
267
+ (!!options.replace ? navigator.replace : navigator.push)(path, options.state, options);
268
+ }, [basename, navigator, routePathnamesJson, locationPathname, dataRouterContext]);
269
+ return navigate;
270
+ }
271
+ const OutletContext = /*#__PURE__*/React__namespace.createContext(null);
272
+
273
+ /**
274
+ * Returns the context (if provided) for the child route at this level of the route
275
+ * hierarchy.
276
+ * @see https://reactrouter.com/v6/hooks/use-outlet-context
277
+ */
278
+ function useOutletContext() {
279
+ return React__namespace.useContext(OutletContext);
280
+ }
281
+
282
+ /**
283
+ * Returns the element for the child route at this level of the route
284
+ * hierarchy. Used internally by `<Outlet>` to render child routes.
285
+ *
286
+ * @see https://reactrouter.com/v6/hooks/use-outlet
287
+ */
288
+ function useOutlet(context) {
289
+ let outlet = React__namespace.useContext(RouteContext).outlet;
290
+ if (outlet) {
291
+ return /*#__PURE__*/React__namespace.createElement(OutletContext.Provider, {
292
+ value: context
293
+ }, outlet);
294
+ }
295
+ return outlet;
296
+ }
297
+
298
+ /**
299
+ * Returns an object of key/value pairs of the dynamic params from the current
300
+ * URL that were matched by the route path.
301
+ *
302
+ * @see https://reactrouter.com/v6/hooks/use-params
303
+ */
304
+ function useParams() {
305
+ let {
306
+ matches
307
+ } = React__namespace.useContext(RouteContext);
308
+ let routeMatch = matches[matches.length - 1];
309
+ return routeMatch ? routeMatch.params : {};
310
+ }
311
+
312
+ /**
313
+ * Resolves the pathname of the given `to` value against the current location.
314
+ *
315
+ * @see https://reactrouter.com/v6/hooks/use-resolved-path
316
+ */
317
+ function useResolvedPath(to, _temp2) {
318
+ let {
319
+ relative
320
+ } = _temp2 === void 0 ? {} : _temp2;
321
+ let {
322
+ future
323
+ } = React__namespace.useContext(NavigationContext);
324
+ let {
325
+ matches
326
+ } = React__namespace.useContext(RouteContext);
327
+ let {
328
+ pathname: locationPathname
329
+ } = useLocation();
330
+ let routePathnamesJson = JSON.stringify(router.UNSAFE_getResolveToMatches(matches, future.v7_relativeSplatPath));
331
+ return React__namespace.useMemo(() => router.resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, relative === "path"), [to, routePathnamesJson, locationPathname, relative]);
332
+ }
333
+
334
+ /**
335
+ * Returns the element of the route that matched the current location, prepared
336
+ * with the correct context to render the remainder of the route tree. Route
337
+ * elements in the tree must render an `<Outlet>` to render their child route's
338
+ * element.
339
+ *
340
+ * @see https://reactrouter.com/v6/hooks/use-routes
341
+ */
342
+ function useRoutes(routes, locationArg) {
343
+ return useRoutesImpl(routes, locationArg);
344
+ }
345
+
346
+ // Internal implementation with accept optional param for RouterProvider usage
347
+ function useRoutesImpl(routes, locationArg, dataRouterState, future) {
348
+ !useInRouterContext() ? router.UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the
349
+ // router loaded. We can help them understand how to avoid that.
350
+ "useRoutes() may be used only in the context of a <Router> component.") : void 0;
351
+ let {
352
+ navigator,
353
+ static: isStatic
354
+ } = React__namespace.useContext(NavigationContext);
355
+ let {
356
+ matches: parentMatches
357
+ } = React__namespace.useContext(RouteContext);
358
+ let routeMatch = parentMatches[parentMatches.length - 1];
359
+ let parentParams = routeMatch ? routeMatch.params : {};
360
+ let parentPathname = routeMatch ? routeMatch.pathname : "/";
361
+ let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : "/";
362
+ let parentRoute = routeMatch && routeMatch.route;
363
+ {
364
+ // You won't get a warning about 2 different <Routes> under a <Route>
365
+ // without a trailing *, but this is a best-effort warning anyway since we
366
+ // cannot even give the warning unless they land at the parent route.
367
+ //
368
+ // Example:
369
+ //
370
+ // <Routes>
371
+ // {/* This route path MUST end with /* because otherwise
372
+ // it will never match /blog/post/123 */}
373
+ // <Route path="blog" element={<Blog />} />
374
+ // <Route path="blog/feed" element={<BlogFeed />} />
375
+ // </Routes>
376
+ //
377
+ // function Blog() {
378
+ // return (
379
+ // <Routes>
380
+ // <Route path="post/:id" element={<Post />} />
381
+ // </Routes>
382
+ // );
383
+ // }
384
+ let parentPath = parentRoute && parentRoute.path || "";
385
+ warningOnce(parentPathname, !parentRoute || parentPath.endsWith("*"), "You rendered descendant <Routes> (or called `useRoutes()`) at " + ("\"" + parentPathname + "\" (under <Route path=\"" + parentPath + "\">) but the ") + "parent route path has no trailing \"*\". This means if you navigate " + "deeper, the parent won't match anymore and therefore the child " + "routes will never render.\n\n" + ("Please change the parent <Route path=\"" + parentPath + "\"> to <Route ") + ("path=\"" + (parentPath === "/" ? "*" : parentPath + "/*") + "\">."));
386
+ }
387
+ let locationFromContext = useLocation();
388
+ let location;
389
+ if (locationArg) {
390
+ var _parsedLocationArg$pa;
391
+ let parsedLocationArg = typeof locationArg === "string" ? router.parsePath(locationArg) : locationArg;
392
+ !(parentPathnameBase === "/" || ((_parsedLocationArg$pa = parsedLocationArg.pathname) == null ? void 0 : _parsedLocationArg$pa.startsWith(parentPathnameBase))) ? router.UNSAFE_invariant(false, "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.")) : void 0;
393
+ location = parsedLocationArg;
394
+ } else {
395
+ location = locationFromContext;
396
+ }
397
+ let pathname = location.pathname || "/";
398
+ let remainingPathname = pathname;
399
+ if (parentPathnameBase !== "/") {
400
+ // Determine the remaining pathname by removing the # of URL segments the
401
+ // parentPathnameBase has, instead of removing based on character count.
402
+ // This is because we can't guarantee that incoming/outgoing encodings/
403
+ // decodings will match exactly.
404
+ // We decode paths before matching on a per-segment basis with
405
+ // decodeURIComponent(), but we re-encode pathnames via `new URL()` so they
406
+ // match what `window.location.pathname` would reflect. Those don't 100%
407
+ // align when it comes to encoded URI characters such as % and &.
408
+ //
409
+ // So we may end up with:
410
+ // pathname: "/descendant/a%25b/match"
411
+ // parentPathnameBase: "/descendant/a%b"
412
+ //
413
+ // And the direct substring removal approach won't work :/
414
+ let parentSegments = parentPathnameBase.replace(/^\//, "").split("/");
415
+ let segments = pathname.replace(/^\//, "").split("/");
416
+ remainingPathname = "/" + segments.slice(parentSegments.length).join("/");
417
+ }
418
+ let matches = !isStatic && dataRouterState && dataRouterState.matches && dataRouterState.matches.length > 0 ? dataRouterState.matches : router.matchRoutes(routes, {
419
+ pathname: remainingPathname
420
+ });
421
+ {
422
+ router.UNSAFE_warning(parentRoute || matches != null, "No routes matched location \"" + location.pathname + location.search + location.hash + "\" ") ;
423
+ router.UNSAFE_warning(matches == null || matches[matches.length - 1].route.element !== undefined || matches[matches.length - 1].route.Component !== undefined || matches[matches.length - 1].route.lazy !== undefined, "Matched leaf route at location \"" + location.pathname + location.search + location.hash + "\" " + "does not have an element or Component. This means it will render an <Outlet /> with a " + "null value by default resulting in an \"empty\" page.") ;
424
+ }
425
+ let renderedMatches = _renderMatches(matches && matches.map(match => Object.assign({}, match, {
426
+ params: Object.assign({}, parentParams, match.params),
427
+ pathname: router.joinPaths([parentPathnameBase,
428
+ // Re-encode pathnames that were decoded inside matchRoutes
429
+ navigator.encodeLocation ? navigator.encodeLocation(match.pathname).pathname : match.pathname]),
430
+ pathnameBase: match.pathnameBase === "/" ? parentPathnameBase : router.joinPaths([parentPathnameBase,
431
+ // Re-encode pathnames that were decoded inside matchRoutes
432
+ navigator.encodeLocation ? navigator.encodeLocation(match.pathnameBase).pathname : match.pathnameBase])
433
+ })), parentMatches, dataRouterState, future);
434
+
435
+ // When a user passes in a `locationArg`, the associated routes need to
436
+ // be wrapped in a new `LocationContext.Provider` in order for `useLocation`
437
+ // to use the scoped location instead of the global location.
438
+ if (locationArg && renderedMatches) {
439
+ return /*#__PURE__*/React__namespace.createElement(LocationContext.Provider, {
440
+ value: {
441
+ location: _extends({
442
+ pathname: "/",
443
+ search: "",
444
+ hash: "",
445
+ state: null,
446
+ key: "default"
447
+ }, location),
448
+ navigationType: router.Action.Pop
449
+ }
450
+ }, renderedMatches);
451
+ }
452
+ return renderedMatches;
453
+ }
454
+ function DefaultErrorComponent() {
455
+ let error = useRouteError();
456
+ let message = router.isRouteErrorResponse(error) ? error.status + " " + error.statusText : error instanceof Error ? error.message : JSON.stringify(error);
457
+ let stack = error instanceof Error ? error.stack : null;
458
+ let lightgrey = "rgba(200,200,200, 0.5)";
459
+ let preStyles = {
460
+ padding: "0.5rem",
461
+ backgroundColor: lightgrey
462
+ };
463
+ let codeStyles = {
464
+ padding: "2px 4px",
465
+ backgroundColor: lightgrey
466
+ };
467
+ let devInfo = null;
468
+ {
469
+ console.error("Error handled by React Router default ErrorBoundary:", error);
470
+ devInfo = /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement("p", null, "\uD83D\uDCBF Hey developer \uD83D\uDC4B"), /*#__PURE__*/React__namespace.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own ", /*#__PURE__*/React__namespace.createElement("code", {
471
+ style: codeStyles
472
+ }, "ErrorBoundary"), " or", " ", /*#__PURE__*/React__namespace.createElement("code", {
473
+ style: codeStyles
474
+ }, "errorElement"), " prop on your route."));
475
+ }
476
+ return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement("h2", null, "Unexpected Application Error!"), /*#__PURE__*/React__namespace.createElement("h3", {
477
+ style: {
478
+ fontStyle: "italic"
479
+ }
480
+ }, message), stack ? /*#__PURE__*/React__namespace.createElement("pre", {
481
+ style: preStyles
482
+ }, stack) : null, devInfo);
483
+ }
484
+ const defaultErrorElement = /*#__PURE__*/React__namespace.createElement(DefaultErrorComponent, null);
485
+ class RenderErrorBoundary extends React__namespace.Component {
486
+ constructor(props) {
487
+ super(props);
488
+ this.state = {
489
+ location: props.location,
490
+ revalidation: props.revalidation,
491
+ error: props.error
492
+ };
493
+ }
494
+ static getDerivedStateFromError(error) {
495
+ return {
496
+ error: error
497
+ };
498
+ }
499
+ static getDerivedStateFromProps(props, state) {
500
+ // When we get into an error state, the user will likely click "back" to the
501
+ // previous page that didn't have an error. Because this wraps the entire
502
+ // application, that will have no effect--the error page continues to display.
503
+ // This gives us a mechanism to recover from the error when the location changes.
504
+ //
505
+ // Whether we're in an error state or not, we update the location in state
506
+ // so that when we are in an error state, it gets reset when a new location
507
+ // comes in and the user recovers from the error.
508
+ if (state.location !== props.location || state.revalidation !== "idle" && props.revalidation === "idle") {
509
+ return {
510
+ error: props.error,
511
+ location: props.location,
512
+ revalidation: props.revalidation
513
+ };
514
+ }
515
+
516
+ // If we're not changing locations, preserve the location but still surface
517
+ // any new errors that may come through. We retain the existing error, we do
518
+ // this because the error provided from the app state may be cleared without
519
+ // the location changing.
520
+ return {
521
+ error: props.error !== undefined ? props.error : state.error,
522
+ location: state.location,
523
+ revalidation: props.revalidation || state.revalidation
524
+ };
525
+ }
526
+ componentDidCatch(error, errorInfo) {
527
+ console.error("React Router caught the following error during render", error, errorInfo);
528
+ }
529
+ render() {
530
+ return this.state.error !== undefined ? /*#__PURE__*/React__namespace.createElement(RouteContext.Provider, {
531
+ value: this.props.routeContext
532
+ }, /*#__PURE__*/React__namespace.createElement(RouteErrorContext.Provider, {
533
+ value: this.state.error,
534
+ children: this.props.component
535
+ })) : this.props.children;
536
+ }
537
+ }
538
+ function RenderedRoute(_ref) {
539
+ let {
540
+ routeContext,
541
+ match,
542
+ children
543
+ } = _ref;
544
+ let dataRouterContext = React__namespace.useContext(DataRouterContext);
545
+
546
+ // Track how deep we got in our render pass to emulate SSR componentDidCatch
547
+ // in a DataStaticRouter
548
+ if (dataRouterContext && dataRouterContext.static && dataRouterContext.staticContext && (match.route.errorElement || match.route.ErrorBoundary)) {
549
+ dataRouterContext.staticContext._deepestRenderedBoundaryId = match.route.id;
550
+ }
551
+ return /*#__PURE__*/React__namespace.createElement(RouteContext.Provider, {
552
+ value: routeContext
553
+ }, children);
554
+ }
555
+ function _renderMatches(matches, parentMatches, dataRouterState, future) {
556
+ var _dataRouterState;
557
+ if (parentMatches === void 0) {
558
+ parentMatches = [];
559
+ }
560
+ if (dataRouterState === void 0) {
561
+ dataRouterState = null;
562
+ }
563
+ if (future === void 0) {
564
+ future = null;
565
+ }
566
+ if (matches == null) {
567
+ var _future;
568
+ if (!dataRouterState) {
569
+ return null;
570
+ }
571
+ if (dataRouterState.errors) {
572
+ // Don't bail if we have data router errors so we can render them in the
573
+ // boundary. Use the pre-matched (or shimmed) matches
574
+ matches = dataRouterState.matches;
575
+ } else if ((_future = future) != null && _future.v7_partialHydration && parentMatches.length === 0 && !dataRouterState.initialized && dataRouterState.matches.length > 0) {
576
+ // Don't bail if we're initializing with partial hydration and we have
577
+ // router matches. That means we're actively running `patchRoutesOnNavigation`
578
+ // so we should render down the partial matches to the appropriate
579
+ // `HydrateFallback`. We only do this if `parentMatches` is empty so it
580
+ // only impacts the root matches for `RouterProvider` and no descendant
581
+ // `<Routes>`
582
+ matches = dataRouterState.matches;
583
+ } else {
584
+ return null;
585
+ }
586
+ }
587
+ let renderedMatches = matches;
588
+
589
+ // If we have data errors, trim matches to the highest error boundary
590
+ let errors = (_dataRouterState = dataRouterState) == null ? void 0 : _dataRouterState.errors;
591
+ if (errors != null) {
592
+ let errorIndex = renderedMatches.findIndex(m => m.route.id && (errors == null ? void 0 : errors[m.route.id]) !== undefined);
593
+ !(errorIndex >= 0) ? router.UNSAFE_invariant(false, "Could not find a matching route for errors on route IDs: " + Object.keys(errors).join(",")) : void 0;
594
+ renderedMatches = renderedMatches.slice(0, Math.min(renderedMatches.length, errorIndex + 1));
595
+ }
596
+
597
+ // If we're in a partial hydration mode, detect if we need to render down to
598
+ // a given HydrateFallback while we load the rest of the hydration data
599
+ let renderFallback = false;
600
+ let fallbackIndex = -1;
601
+ if (dataRouterState && future && future.v7_partialHydration) {
602
+ for (let i = 0; i < renderedMatches.length; i++) {
603
+ let match = renderedMatches[i];
604
+ // Track the deepest fallback up until the first route without data
605
+ if (match.route.HydrateFallback || match.route.hydrateFallbackElement) {
606
+ fallbackIndex = i;
607
+ }
608
+ if (match.route.id) {
609
+ let {
610
+ loaderData,
611
+ errors
612
+ } = dataRouterState;
613
+ let needsToRunLoader = match.route.loader && loaderData[match.route.id] === undefined && (!errors || errors[match.route.id] === undefined);
614
+ if (match.route.lazy || needsToRunLoader) {
615
+ // We found the first route that's not ready to render (waiting on
616
+ // lazy, or has a loader that hasn't run yet). Flag that we need to
617
+ // render a fallback and render up until the appropriate fallback
618
+ renderFallback = true;
619
+ if (fallbackIndex >= 0) {
620
+ renderedMatches = renderedMatches.slice(0, fallbackIndex + 1);
621
+ } else {
622
+ renderedMatches = [renderedMatches[0]];
623
+ }
624
+ break;
625
+ }
626
+ }
627
+ }
628
+ }
629
+ return renderedMatches.reduceRight((outlet, match, index) => {
630
+ // Only data routers handle errors/fallbacks
631
+ let error;
632
+ let shouldRenderHydrateFallback = false;
633
+ let errorElement = null;
634
+ let hydrateFallbackElement = null;
635
+ if (dataRouterState) {
636
+ error = errors && match.route.id ? errors[match.route.id] : undefined;
637
+ errorElement = match.route.errorElement || defaultErrorElement;
638
+ if (renderFallback) {
639
+ if (fallbackIndex < 0 && index === 0) {
640
+ warningOnce("route-fallback", false, "No `HydrateFallback` element provided to render during initial hydration");
641
+ shouldRenderHydrateFallback = true;
642
+ hydrateFallbackElement = null;
643
+ } else if (fallbackIndex === index) {
644
+ shouldRenderHydrateFallback = true;
645
+ hydrateFallbackElement = match.route.hydrateFallbackElement || null;
646
+ }
647
+ }
648
+ }
649
+ let matches = parentMatches.concat(renderedMatches.slice(0, index + 1));
650
+ let getChildren = () => {
651
+ let children;
652
+ if (error) {
653
+ children = errorElement;
654
+ } else if (shouldRenderHydrateFallback) {
655
+ children = hydrateFallbackElement;
656
+ } else if (match.route.Component) {
657
+ // Note: This is a de-optimized path since React won't re-use the
658
+ // ReactElement since it's identity changes with each new
659
+ // React.createElement call. We keep this so folks can use
660
+ // `<Route Component={...}>` in `<Routes>` but generally `Component`
661
+ // usage is only advised in `RouterProvider` when we can convert it to
662
+ // `element` ahead of time.
663
+ children = /*#__PURE__*/React__namespace.createElement(match.route.Component, null);
664
+ } else if (match.route.element) {
665
+ children = match.route.element;
666
+ } else {
667
+ children = outlet;
668
+ }
669
+ return /*#__PURE__*/React__namespace.createElement(RenderedRoute, {
670
+ match: match,
671
+ routeContext: {
672
+ outlet,
673
+ matches,
674
+ isDataRoute: dataRouterState != null
675
+ },
676
+ children: children
677
+ });
678
+ };
679
+ // Only wrap in an error boundary within data router usages when we have an
680
+ // ErrorBoundary/errorElement on this route. Otherwise let it bubble up to
681
+ // an ancestor ErrorBoundary/errorElement
682
+ return dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? /*#__PURE__*/React__namespace.createElement(RenderErrorBoundary, {
683
+ location: dataRouterState.location,
684
+ revalidation: dataRouterState.revalidation,
685
+ component: errorElement,
686
+ error: error,
687
+ children: getChildren(),
688
+ routeContext: {
689
+ outlet: null,
690
+ matches,
691
+ isDataRoute: true
692
+ }
693
+ }) : getChildren();
694
+ }, null);
695
+ }
696
+ var DataRouterHook = /*#__PURE__*/function (DataRouterHook) {
697
+ DataRouterHook["UseBlocker"] = "useBlocker";
698
+ DataRouterHook["UseRevalidator"] = "useRevalidator";
699
+ DataRouterHook["UseNavigateStable"] = "useNavigate";
700
+ return DataRouterHook;
701
+ }(DataRouterHook || {});
702
+ var DataRouterStateHook = /*#__PURE__*/function (DataRouterStateHook) {
703
+ DataRouterStateHook["UseBlocker"] = "useBlocker";
704
+ DataRouterStateHook["UseLoaderData"] = "useLoaderData";
705
+ DataRouterStateHook["UseActionData"] = "useActionData";
706
+ DataRouterStateHook["UseRouteError"] = "useRouteError";
707
+ DataRouterStateHook["UseNavigation"] = "useNavigation";
708
+ DataRouterStateHook["UseRouteLoaderData"] = "useRouteLoaderData";
709
+ DataRouterStateHook["UseMatches"] = "useMatches";
710
+ DataRouterStateHook["UseRevalidator"] = "useRevalidator";
711
+ DataRouterStateHook["UseNavigateStable"] = "useNavigate";
712
+ DataRouterStateHook["UseRouteId"] = "useRouteId";
713
+ return DataRouterStateHook;
714
+ }(DataRouterStateHook || {});
715
+ function getDataRouterConsoleError(hookName) {
716
+ return hookName + " must be used within a data router. See https://reactrouter.com/v6/routers/picking-a-router.";
717
+ }
718
+ function useDataRouterContext(hookName) {
719
+ let ctx = React__namespace.useContext(DataRouterContext);
720
+ !ctx ? router.UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : void 0;
721
+ return ctx;
722
+ }
723
+ function useDataRouterState(hookName) {
724
+ let state = React__namespace.useContext(DataRouterStateContext);
725
+ !state ? router.UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : void 0;
726
+ return state;
727
+ }
728
+ function useRouteContext(hookName) {
729
+ let route = React__namespace.useContext(RouteContext);
730
+ !route ? router.UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : void 0;
731
+ return route;
732
+ }
733
+
734
+ // Internal version with hookName-aware debugging
735
+ function useCurrentRouteId(hookName) {
736
+ let route = useRouteContext(hookName);
737
+ let thisRoute = route.matches[route.matches.length - 1];
738
+ !thisRoute.route.id ? router.UNSAFE_invariant(false, hookName + " can only be used on routes that contain a unique \"id\"") : void 0;
739
+ return thisRoute.route.id;
740
+ }
741
+
742
+ /**
743
+ * Returns the ID for the nearest contextual route
744
+ */
745
+ function useRouteId() {
746
+ return useCurrentRouteId(DataRouterStateHook.UseRouteId);
747
+ }
748
+
749
+ /**
750
+ * Returns the current navigation, defaulting to an "idle" navigation when
751
+ * no navigation is in progress
752
+ */
753
+ function useNavigation() {
754
+ let state = useDataRouterState(DataRouterStateHook.UseNavigation);
755
+ return state.navigation;
756
+ }
757
+
758
+ /**
759
+ * Returns a revalidate function for manually triggering revalidation, as well
760
+ * as the current state of any manual revalidations
761
+ */
762
+ function useRevalidator() {
763
+ let dataRouterContext = useDataRouterContext(DataRouterHook.UseRevalidator);
764
+ let state = useDataRouterState(DataRouterStateHook.UseRevalidator);
765
+ return React__namespace.useMemo(() => ({
766
+ revalidate: dataRouterContext.router.revalidate,
767
+ state: state.revalidation
768
+ }), [dataRouterContext.router.revalidate, state.revalidation]);
769
+ }
770
+
771
+ /**
772
+ * Returns the active route matches, useful for accessing loaderData for
773
+ * parent/child routes or the route "handle" property
774
+ */
775
+ function useMatches() {
776
+ let {
777
+ matches,
778
+ loaderData
779
+ } = useDataRouterState(DataRouterStateHook.UseMatches);
780
+ return React__namespace.useMemo(() => matches.map(m => router.UNSAFE_convertRouteMatchToUiMatch(m, loaderData)), [matches, loaderData]);
781
+ }
782
+
783
+ /**
784
+ * Returns the loader data for the nearest ancestor Route loader
785
+ */
786
+ function useLoaderData() {
787
+ let state = useDataRouterState(DataRouterStateHook.UseLoaderData);
788
+ let routeId = useCurrentRouteId(DataRouterStateHook.UseLoaderData);
789
+ if (state.errors && state.errors[routeId] != null) {
790
+ console.error("You cannot `useLoaderData` in an errorElement (routeId: " + routeId + ")");
791
+ return undefined;
792
+ }
793
+ return state.loaderData[routeId];
794
+ }
795
+
796
+ /**
797
+ * Returns the loaderData for the given routeId
798
+ */
799
+ function useRouteLoaderData(routeId) {
800
+ let state = useDataRouterState(DataRouterStateHook.UseRouteLoaderData);
801
+ return state.loaderData[routeId];
802
+ }
803
+
804
+ /**
805
+ * Returns the action data for the nearest ancestor Route action
806
+ */
807
+ function useActionData() {
808
+ let state = useDataRouterState(DataRouterStateHook.UseActionData);
809
+ let routeId = useCurrentRouteId(DataRouterStateHook.UseLoaderData);
810
+ return state.actionData ? state.actionData[routeId] : undefined;
811
+ }
812
+
813
+ /**
814
+ * Returns the nearest ancestor Route error, which could be a loader/action
815
+ * error or a render error. This is intended to be called from your
816
+ * ErrorBoundary/errorElement to display a proper error message.
817
+ */
818
+ function useRouteError() {
819
+ var _state$errors;
820
+ let error = React__namespace.useContext(RouteErrorContext);
821
+ let state = useDataRouterState(DataRouterStateHook.UseRouteError);
822
+ let routeId = useCurrentRouteId(DataRouterStateHook.UseRouteError);
823
+
824
+ // If this was a render error, we put it in a RouteError context inside
825
+ // of RenderErrorBoundary
826
+ if (error !== undefined) {
827
+ return error;
828
+ }
829
+
830
+ // Otherwise look for errors from our data router state
831
+ return (_state$errors = state.errors) == null ? void 0 : _state$errors[routeId];
832
+ }
833
+
834
+ /**
835
+ * Returns the happy-path data from the nearest ancestor `<Await />` value
836
+ */
837
+ function useAsyncValue() {
838
+ let value = React__namespace.useContext(AwaitContext);
839
+ return value == null ? void 0 : value._data;
840
+ }
841
+
842
+ /**
843
+ * Returns the error from the nearest ancestor `<Await />` value
844
+ */
845
+ function useAsyncError() {
846
+ let value = React__namespace.useContext(AwaitContext);
847
+ return value == null ? void 0 : value._error;
848
+ }
849
+ let blockerId = 0;
850
+
851
+ /**
852
+ * Allow the application to block navigations within the SPA and present the
853
+ * user a confirmation dialog to confirm the navigation. Mostly used to avoid
854
+ * using half-filled form data. This does not handle hard-reloads or
855
+ * cross-origin navigations.
856
+ */
857
+ function useBlocker(shouldBlock) {
858
+ let {
859
+ router: router$1,
860
+ basename
861
+ } = useDataRouterContext(DataRouterHook.UseBlocker);
862
+ let state = useDataRouterState(DataRouterStateHook.UseBlocker);
863
+ let [blockerKey, setBlockerKey] = React__namespace.useState("");
864
+ let blockerFunction = React__namespace.useCallback(arg => {
865
+ if (typeof shouldBlock !== "function") {
866
+ return !!shouldBlock;
867
+ }
868
+ if (basename === "/") {
869
+ return shouldBlock(arg);
870
+ }
871
+
872
+ // If they provided us a function and we've got an active basename, strip
873
+ // it from the locations we expose to the user to match the behavior of
874
+ // useLocation
875
+ let {
876
+ currentLocation,
877
+ nextLocation,
878
+ historyAction
879
+ } = arg;
880
+ return shouldBlock({
881
+ currentLocation: _extends({}, currentLocation, {
882
+ pathname: router.stripBasename(currentLocation.pathname, basename) || currentLocation.pathname
883
+ }),
884
+ nextLocation: _extends({}, nextLocation, {
885
+ pathname: router.stripBasename(nextLocation.pathname, basename) || nextLocation.pathname
886
+ }),
887
+ historyAction
888
+ });
889
+ }, [basename, shouldBlock]);
890
+
891
+ // This effect is in charge of blocker key assignment and deletion (which is
892
+ // tightly coupled to the key)
893
+ React__namespace.useEffect(() => {
894
+ let key = String(++blockerId);
895
+ setBlockerKey(key);
896
+ return () => router$1.deleteBlocker(key);
897
+ }, [router$1]);
898
+
899
+ // This effect handles assigning the blockerFunction. This is to handle
900
+ // unstable blocker function identities, and happens only after the prior
901
+ // effect so we don't get an orphaned blockerFunction in the router with a
902
+ // key of "". Until then we just have the IDLE_BLOCKER.
903
+ React__namespace.useEffect(() => {
904
+ if (blockerKey !== "") {
905
+ router$1.getBlocker(blockerKey, blockerFunction);
906
+ }
907
+ }, [router$1, blockerKey, blockerFunction]);
908
+
909
+ // Prefer the blocker from `state` not `router.state` since DataRouterContext
910
+ // is memoized so this ensures we update on blocker state updates
911
+ return blockerKey && state.blockers.has(blockerKey) ? state.blockers.get(blockerKey) : router.IDLE_BLOCKER;
912
+ }
913
+
914
+ /**
915
+ * Stable version of useNavigate that is used when we are in the context of
916
+ * a RouterProvider.
917
+ */
918
+ function useNavigateStable() {
919
+ let {
920
+ router: router$1
921
+ } = useDataRouterContext(DataRouterHook.UseNavigateStable);
922
+ let id = useCurrentRouteId(DataRouterStateHook.UseNavigateStable);
923
+ let activeRef = React__namespace.useRef(false);
924
+ useIsomorphicLayoutEffect(() => {
925
+ activeRef.current = true;
926
+ });
927
+ let navigate = React__namespace.useCallback(function (to, options) {
928
+ if (options === void 0) {
929
+ options = {};
930
+ }
931
+ router.UNSAFE_warning(activeRef.current, navigateEffectWarning) ;
932
+
933
+ // Short circuit here since if this happens on first render the navigate
934
+ // is useless because we haven't wired up our router subscriber yet
935
+ if (!activeRef.current) return;
936
+ if (typeof to === "number") {
937
+ router$1.navigate(to);
938
+ } else {
939
+ router$1.navigate(to, _extends({
940
+ fromRouteId: id
941
+ }, options));
942
+ }
943
+ }, [router$1, id]);
944
+ return navigate;
945
+ }
946
+ const alreadyWarned$1 = {};
947
+ function warningOnce(key, cond, message) {
948
+ if (!cond && !alreadyWarned$1[key]) {
949
+ alreadyWarned$1[key] = true;
950
+ router.UNSAFE_warning(false, message) ;
951
+ }
952
+ }
953
+
954
+ const alreadyWarned = {};
955
+ function warnOnce(key, message) {
956
+ if (!alreadyWarned[message]) {
957
+ alreadyWarned[message] = true;
958
+ console.warn(message);
959
+ }
960
+ }
961
+ const logDeprecation = (flag, msg, link) => warnOnce(flag, "\u26A0\uFE0F React Router Future Flag Warning: " + msg + ". " + ("You can use the `" + flag + "` future flag to opt-in early. ") + ("For more information, see " + link + "."));
962
+ function logV6DeprecationWarnings(renderFuture, routerFuture) {
963
+ if ((renderFuture == null ? void 0 : renderFuture.v7_startTransition) === undefined) {
964
+ logDeprecation("v7_startTransition", "React Router will begin wrapping state updates in `React.startTransition` in v7", "https://reactrouter.com/v6/upgrading/future#v7_starttransition");
965
+ }
966
+ if ((renderFuture == null ? void 0 : renderFuture.v7_relativeSplatPath) === undefined && (!routerFuture || routerFuture.v7_relativeSplatPath === undefined)) {
967
+ logDeprecation("v7_relativeSplatPath", "Relative route resolution within Splat routes is changing in v7", "https://reactrouter.com/v6/upgrading/future#v7_relativesplatpath");
968
+ }
969
+ if (routerFuture) {
970
+ if (routerFuture.v7_fetcherPersist === undefined) {
971
+ logDeprecation("v7_fetcherPersist", "The persistence behavior of fetchers is changing in v7", "https://reactrouter.com/v6/upgrading/future#v7_fetcherpersist");
972
+ }
973
+ if (routerFuture.v7_normalizeFormMethod === undefined) {
974
+ logDeprecation("v7_normalizeFormMethod", "Casing of `formMethod` fields is being normalized to uppercase in v7", "https://reactrouter.com/v6/upgrading/future#v7_normalizeformmethod");
975
+ }
976
+ if (routerFuture.v7_partialHydration === undefined) {
977
+ logDeprecation("v7_partialHydration", "`RouterProvider` hydration behavior is changing in v7", "https://reactrouter.com/v6/upgrading/future#v7_partialhydration");
978
+ }
979
+ if (routerFuture.v7_skipActionErrorRevalidation === undefined) {
980
+ logDeprecation("v7_skipActionErrorRevalidation", "The revalidation behavior after 4xx/5xx `action` responses is changing in v7", "https://reactrouter.com/v6/upgrading/future#v7_skipactionerrorrevalidation");
981
+ }
982
+ }
983
+ }
984
+
985
+ /**
986
+ Webpack + React 17 fails to compile on any of the following because webpack
987
+ complains that `startTransition` doesn't exist in `React`:
988
+ * import { startTransition } from "react"
989
+ * import * as React from from "react";
990
+ "startTransition" in React ? React.startTransition(() => setState()) : setState()
991
+ * import * as React from from "react";
992
+ "startTransition" in React ? React["startTransition"](() => setState()) : setState()
993
+
994
+ Moving it to a constant such as the following solves the Webpack/React 17 issue:
995
+ * import * as React from from "react";
996
+ const START_TRANSITION = "startTransition";
997
+ START_TRANSITION in React ? React[START_TRANSITION](() => setState()) : setState()
998
+
999
+ However, that introduces webpack/terser minification issues in production builds
1000
+ in React 18 where minification/obfuscation ends up removing the call of
1001
+ React.startTransition entirely from the first half of the ternary. Grabbing
1002
+ this exported reference once up front resolves that issue.
1003
+
1004
+ See https://github.com/remix-run/react-router/issues/10579
1005
+ */
1006
+ const START_TRANSITION = "startTransition";
1007
+ const startTransitionImpl = React__namespace[START_TRANSITION];
1008
+
1009
+ /**
1010
+ * Given a Remix Router instance, render the appropriate UI
1011
+ */
1012
+ function RouterProvider(_ref) {
1013
+ let {
1014
+ fallbackElement,
1015
+ router: router$1,
1016
+ future
1017
+ } = _ref;
1018
+ let [state, setStateImpl] = React__namespace.useState(router$1.state);
1019
+ let {
1020
+ v7_startTransition
1021
+ } = future || {};
1022
+ let setState = React__namespace.useCallback(newState => {
1023
+ if (v7_startTransition && startTransitionImpl) {
1024
+ startTransitionImpl(() => setStateImpl(newState));
1025
+ } else {
1026
+ setStateImpl(newState);
1027
+ }
1028
+ }, [setStateImpl, v7_startTransition]);
1029
+
1030
+ // Need to use a layout effect here so we are subscribed early enough to
1031
+ // pick up on any render-driven redirects/navigations (useEffect/<Navigate>)
1032
+ React__namespace.useLayoutEffect(() => router$1.subscribe(setState), [router$1, setState]);
1033
+ React__namespace.useEffect(() => {
1034
+ router.UNSAFE_warning(fallbackElement == null || !router$1.future.v7_partialHydration, "`<RouterProvider fallbackElement>` is deprecated when using " + "`v7_partialHydration`, use a `HydrateFallback` component instead") ;
1035
+ // Only log this once on initial mount
1036
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1037
+ }, []);
1038
+ let navigator = React__namespace.useMemo(() => {
1039
+ return {
1040
+ createHref: router$1.createHref,
1041
+ encodeLocation: router$1.encodeLocation,
1042
+ go: n => router$1.navigate(n),
1043
+ push: (to, state, opts) => router$1.navigate(to, {
1044
+ state,
1045
+ preventScrollReset: opts == null ? void 0 : opts.preventScrollReset
1046
+ }),
1047
+ replace: (to, state, opts) => router$1.navigate(to, {
1048
+ replace: true,
1049
+ state,
1050
+ preventScrollReset: opts == null ? void 0 : opts.preventScrollReset
1051
+ })
1052
+ };
1053
+ }, [router$1]);
1054
+ let basename = router$1.basename || "/";
1055
+ let dataRouterContext = React__namespace.useMemo(() => ({
1056
+ router: router$1,
1057
+ navigator,
1058
+ static: false,
1059
+ basename
1060
+ }), [router$1, navigator, basename]);
1061
+ React__namespace.useEffect(() => logV6DeprecationWarnings(future, router$1.future), [router$1, future]);
1062
+
1063
+ // The fragment and {null} here are important! We need them to keep React 18's
1064
+ // useId happy when we are server-rendering since we may have a <script> here
1065
+ // containing the hydrated server-side staticContext (from StaticRouterProvider).
1066
+ // useId relies on the component tree structure to generate deterministic id's
1067
+ // so we need to ensure it remains the same on the client even though
1068
+ // we don't need the <script> tag
1069
+ return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(DataRouterContext.Provider, {
1070
+ value: dataRouterContext
1071
+ }, /*#__PURE__*/React__namespace.createElement(DataRouterStateContext.Provider, {
1072
+ value: state
1073
+ }, /*#__PURE__*/React__namespace.createElement(Router, {
1074
+ basename: basename,
1075
+ location: state.location,
1076
+ navigationType: state.historyAction,
1077
+ navigator: navigator,
1078
+ future: {
1079
+ v7_relativeSplatPath: router$1.future.v7_relativeSplatPath
1080
+ }
1081
+ }, state.initialized || router$1.future.v7_partialHydration ? /*#__PURE__*/React__namespace.createElement(DataRoutes, {
1082
+ routes: router$1.routes,
1083
+ future: router$1.future,
1084
+ state: state
1085
+ }) : fallbackElement))), null);
1086
+ }
1087
+ function DataRoutes(_ref2) {
1088
+ let {
1089
+ routes,
1090
+ future,
1091
+ state
1092
+ } = _ref2;
1093
+ return useRoutesImpl(routes, undefined, state, future);
1094
+ }
1095
+ /**
1096
+ * A `<Router>` that stores all entries in memory.
1097
+ *
1098
+ * @see https://reactrouter.com/v6/router-components/memory-router
1099
+ */
1100
+ function MemoryRouter(_ref3) {
1101
+ let {
1102
+ basename,
1103
+ children,
1104
+ initialEntries,
1105
+ initialIndex,
1106
+ future
1107
+ } = _ref3;
1108
+ let historyRef = React__namespace.useRef();
1109
+ if (historyRef.current == null) {
1110
+ historyRef.current = router.createMemoryHistory({
1111
+ initialEntries,
1112
+ initialIndex,
1113
+ v5Compat: true
1114
+ });
1115
+ }
1116
+ let history = historyRef.current;
1117
+ let [state, setStateImpl] = React__namespace.useState({
1118
+ action: history.action,
1119
+ location: history.location
1120
+ });
1121
+ let {
1122
+ v7_startTransition
1123
+ } = future || {};
1124
+ let setState = React__namespace.useCallback(newState => {
1125
+ v7_startTransition && startTransitionImpl ? startTransitionImpl(() => setStateImpl(newState)) : setStateImpl(newState);
1126
+ }, [setStateImpl, v7_startTransition]);
1127
+ React__namespace.useLayoutEffect(() => history.listen(setState), [history, setState]);
1128
+ React__namespace.useEffect(() => logV6DeprecationWarnings(future), [future]);
1129
+ return /*#__PURE__*/React__namespace.createElement(Router, {
1130
+ basename: basename,
1131
+ children: children,
1132
+ location: state.location,
1133
+ navigationType: state.action,
1134
+ navigator: history,
1135
+ future: future
1136
+ });
1137
+ }
1138
+ /**
1139
+ * Changes the current location.
1140
+ *
1141
+ * Note: This API is mostly useful in React.Component subclasses that are not
1142
+ * able to use hooks. In functional components, we recommend you use the
1143
+ * `useNavigate` hook instead.
1144
+ *
1145
+ * @see https://reactrouter.com/v6/components/navigate
1146
+ */
1147
+ function Navigate(_ref4) {
1148
+ let {
1149
+ to,
1150
+ replace,
1151
+ state,
1152
+ relative
1153
+ } = _ref4;
1154
+ !useInRouterContext() ? router.UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of
1155
+ // the router loaded. We can help them understand how to avoid that.
1156
+ "<Navigate> may be used only in the context of a <Router> component.") : void 0;
1157
+ let {
1158
+ future,
1159
+ static: isStatic
1160
+ } = React__namespace.useContext(NavigationContext);
1161
+ router.UNSAFE_warning(!isStatic, "<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.") ;
1162
+ let {
1163
+ matches
1164
+ } = React__namespace.useContext(RouteContext);
1165
+ let {
1166
+ pathname: locationPathname
1167
+ } = useLocation();
1168
+ let navigate = useNavigate();
1169
+
1170
+ // Resolve the path outside of the effect so that when effects run twice in
1171
+ // StrictMode they navigate to the same place
1172
+ let path = router.resolveTo(to, router.UNSAFE_getResolveToMatches(matches, future.v7_relativeSplatPath), locationPathname, relative === "path");
1173
+ let jsonPath = JSON.stringify(path);
1174
+ React__namespace.useEffect(() => navigate(JSON.parse(jsonPath), {
1175
+ replace,
1176
+ state,
1177
+ relative
1178
+ }), [navigate, jsonPath, relative, replace, state]);
1179
+ return null;
1180
+ }
1181
+ /**
1182
+ * Renders the child route's element, if there is one.
1183
+ *
1184
+ * @see https://reactrouter.com/v6/components/outlet
1185
+ */
1186
+ function Outlet(props) {
1187
+ return useOutlet(props.context);
1188
+ }
1189
+ /**
1190
+ * Declares an element that should be rendered at a certain URL path.
1191
+ *
1192
+ * @see https://reactrouter.com/v6/components/route
1193
+ */
1194
+ function Route(_props) {
1195
+ router.UNSAFE_invariant(false, "A <Route> is only ever to be used as the child of <Routes> element, " + "never rendered directly. Please wrap your <Route> in a <Routes>.") ;
1196
+ }
1197
+ /**
1198
+ * Provides location context for the rest of the app.
1199
+ *
1200
+ * Note: You usually won't render a `<Router>` directly. Instead, you'll render a
1201
+ * router that is more specific to your environment such as a `<BrowserRouter>`
1202
+ * in web browsers or a `<StaticRouter>` for server rendering.
1203
+ *
1204
+ * @see https://reactrouter.com/v6/router-components/router
1205
+ */
1206
+ function Router(_ref5) {
1207
+ let {
1208
+ basename: basenameProp = "/",
1209
+ children = null,
1210
+ location: locationProp,
1211
+ navigationType = router.Action.Pop,
1212
+ navigator,
1213
+ static: staticProp = false,
1214
+ future
1215
+ } = _ref5;
1216
+ !!useInRouterContext() ? router.UNSAFE_invariant(false, "You cannot render a <Router> inside another <Router>." + " You should never have more than one in your app.") : void 0;
1217
+
1218
+ // Preserve trailing slashes on basename, so we can let the user control
1219
+ // the enforcement of trailing slashes throughout the app
1220
+ let basename = basenameProp.replace(/^\/*/, "/");
1221
+ let navigationContext = React__namespace.useMemo(() => ({
1222
+ basename,
1223
+ navigator,
1224
+ static: staticProp,
1225
+ future: _extends({
1226
+ v7_relativeSplatPath: false
1227
+ }, future)
1228
+ }), [basename, future, navigator, staticProp]);
1229
+ if (typeof locationProp === "string") {
1230
+ locationProp = router.parsePath(locationProp);
1231
+ }
1232
+ let {
1233
+ pathname = "/",
1234
+ search = "",
1235
+ hash = "",
1236
+ state = null,
1237
+ key = "default"
1238
+ } = locationProp;
1239
+ let locationContext = React__namespace.useMemo(() => {
1240
+ let trailingPathname = router.stripBasename(pathname, basename);
1241
+ if (trailingPathname == null) {
1242
+ return null;
1243
+ }
1244
+ return {
1245
+ location: {
1246
+ pathname: trailingPathname,
1247
+ search,
1248
+ hash,
1249
+ state,
1250
+ key
1251
+ },
1252
+ navigationType
1253
+ };
1254
+ }, [basename, pathname, search, hash, state, key, navigationType]);
1255
+ router.UNSAFE_warning(locationContext != null, "<Router basename=\"" + basename + "\"> is not able to match the URL " + ("\"" + pathname + search + hash + "\" because it does not start with the ") + "basename, so the <Router> won't render anything.") ;
1256
+ if (locationContext == null) {
1257
+ return null;
1258
+ }
1259
+ return /*#__PURE__*/React__namespace.createElement(NavigationContext.Provider, {
1260
+ value: navigationContext
1261
+ }, /*#__PURE__*/React__namespace.createElement(LocationContext.Provider, {
1262
+ children: children,
1263
+ value: locationContext
1264
+ }));
1265
+ }
1266
+ /**
1267
+ * A container for a nested tree of `<Route>` elements that renders the branch
1268
+ * that best matches the current location.
1269
+ *
1270
+ * @see https://reactrouter.com/v6/components/routes
1271
+ */
1272
+ function Routes(_ref6) {
1273
+ let {
1274
+ children,
1275
+ location
1276
+ } = _ref6;
1277
+ return useRoutes(createRoutesFromChildren(children), location);
1278
+ }
1279
+ /**
1280
+ * Component to use for rendering lazily loaded data from returning defer()
1281
+ * in a loader function
1282
+ */
1283
+ function Await(_ref7) {
1284
+ let {
1285
+ children,
1286
+ errorElement,
1287
+ resolve
1288
+ } = _ref7;
1289
+ return /*#__PURE__*/React__namespace.createElement(AwaitErrorBoundary, {
1290
+ resolve: resolve,
1291
+ errorElement: errorElement
1292
+ }, /*#__PURE__*/React__namespace.createElement(ResolveAwait, null, children));
1293
+ }
1294
+ var AwaitRenderStatus = /*#__PURE__*/function (AwaitRenderStatus) {
1295
+ AwaitRenderStatus[AwaitRenderStatus["pending"] = 0] = "pending";
1296
+ AwaitRenderStatus[AwaitRenderStatus["success"] = 1] = "success";
1297
+ AwaitRenderStatus[AwaitRenderStatus["error"] = 2] = "error";
1298
+ return AwaitRenderStatus;
1299
+ }(AwaitRenderStatus || {});
1300
+ const neverSettledPromise = new Promise(() => {});
1301
+ class AwaitErrorBoundary extends React__namespace.Component {
1302
+ constructor(props) {
1303
+ super(props);
1304
+ this.state = {
1305
+ error: null
1306
+ };
1307
+ }
1308
+ static getDerivedStateFromError(error) {
1309
+ return {
1310
+ error
1311
+ };
1312
+ }
1313
+ componentDidCatch(error, errorInfo) {
1314
+ console.error("<Await> caught the following error during render", error, errorInfo);
1315
+ }
1316
+ render() {
1317
+ let {
1318
+ children,
1319
+ errorElement,
1320
+ resolve
1321
+ } = this.props;
1322
+ let promise = null;
1323
+ let status = AwaitRenderStatus.pending;
1324
+ if (!(resolve instanceof Promise)) {
1325
+ // Didn't get a promise - provide as a resolved promise
1326
+ status = AwaitRenderStatus.success;
1327
+ promise = Promise.resolve();
1328
+ Object.defineProperty(promise, "_tracked", {
1329
+ get: () => true
1330
+ });
1331
+ Object.defineProperty(promise, "_data", {
1332
+ get: () => resolve
1333
+ });
1334
+ } else if (this.state.error) {
1335
+ // Caught a render error, provide it as a rejected promise
1336
+ status = AwaitRenderStatus.error;
1337
+ let renderError = this.state.error;
1338
+ promise = Promise.reject().catch(() => {}); // Avoid unhandled rejection warnings
1339
+ Object.defineProperty(promise, "_tracked", {
1340
+ get: () => true
1341
+ });
1342
+ Object.defineProperty(promise, "_error", {
1343
+ get: () => renderError
1344
+ });
1345
+ } else if (resolve._tracked) {
1346
+ // Already tracked promise - check contents
1347
+ promise = resolve;
1348
+ status = "_error" in promise ? AwaitRenderStatus.error : "_data" in promise ? AwaitRenderStatus.success : AwaitRenderStatus.pending;
1349
+ } else {
1350
+ // Raw (untracked) promise - track it
1351
+ status = AwaitRenderStatus.pending;
1352
+ Object.defineProperty(resolve, "_tracked", {
1353
+ get: () => true
1354
+ });
1355
+ promise = resolve.then(data => Object.defineProperty(resolve, "_data", {
1356
+ get: () => data
1357
+ }), error => Object.defineProperty(resolve, "_error", {
1358
+ get: () => error
1359
+ }));
1360
+ }
1361
+ if (status === AwaitRenderStatus.error && promise._error instanceof router.AbortedDeferredError) {
1362
+ // Freeze the UI by throwing a never resolved promise
1363
+ throw neverSettledPromise;
1364
+ }
1365
+ if (status === AwaitRenderStatus.error && !errorElement) {
1366
+ // No errorElement, throw to the nearest route-level error boundary
1367
+ throw promise._error;
1368
+ }
1369
+ if (status === AwaitRenderStatus.error) {
1370
+ // Render via our errorElement
1371
+ return /*#__PURE__*/React__namespace.createElement(AwaitContext.Provider, {
1372
+ value: promise,
1373
+ children: errorElement
1374
+ });
1375
+ }
1376
+ if (status === AwaitRenderStatus.success) {
1377
+ // Render children with resolved value
1378
+ return /*#__PURE__*/React__namespace.createElement(AwaitContext.Provider, {
1379
+ value: promise,
1380
+ children: children
1381
+ });
1382
+ }
1383
+
1384
+ // Throw to the suspense boundary
1385
+ throw promise;
1386
+ }
1387
+ }
1388
+
1389
+ /**
1390
+ * @private
1391
+ * Indirection to leverage useAsyncValue for a render-prop API on `<Await>`
1392
+ */
1393
+ function ResolveAwait(_ref8) {
1394
+ let {
1395
+ children
1396
+ } = _ref8;
1397
+ let data = useAsyncValue();
1398
+ let toRender = typeof children === "function" ? children(data) : children;
1399
+ return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, toRender);
1400
+ }
1401
+
1402
+ ///////////////////////////////////////////////////////////////////////////////
1403
+ // UTILS
1404
+ ///////////////////////////////////////////////////////////////////////////////
1405
+
1406
+ /**
1407
+ * Creates a route config from a React "children" object, which is usually
1408
+ * either a `<Route>` element or an array of them. Used internally by
1409
+ * `<Routes>` to create a route config from its children.
1410
+ *
1411
+ * @see https://reactrouter.com/v6/utils/create-routes-from-children
1412
+ */
1413
+ function createRoutesFromChildren(children, parentPath) {
1414
+ if (parentPath === void 0) {
1415
+ parentPath = [];
1416
+ }
1417
+ let routes = [];
1418
+ React__namespace.Children.forEach(children, (element, index) => {
1419
+ if (! /*#__PURE__*/React__namespace.isValidElement(element)) {
1420
+ // Ignore non-elements. This allows people to more easily inline
1421
+ // conditionals in their route config.
1422
+ return;
1423
+ }
1424
+ let treePath = [...parentPath, index];
1425
+ if (element.type === React__namespace.Fragment) {
1426
+ // Transparently support React.Fragment and its children.
1427
+ routes.push.apply(routes, createRoutesFromChildren(element.props.children, treePath));
1428
+ return;
1429
+ }
1430
+ !(element.type === Route) ? router.UNSAFE_invariant(false, "[" + (typeof element.type === "string" ? element.type : element.type.name) + "] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>") : void 0;
1431
+ !(!element.props.index || !element.props.children) ? router.UNSAFE_invariant(false, "An index route cannot have child routes.") : void 0;
1432
+ let route = {
1433
+ id: element.props.id || treePath.join("-"),
1434
+ caseSensitive: element.props.caseSensitive,
1435
+ element: element.props.element,
1436
+ Component: element.props.Component,
1437
+ index: element.props.index,
1438
+ path: element.props.path,
1439
+ loader: element.props.loader,
1440
+ action: element.props.action,
1441
+ errorElement: element.props.errorElement,
1442
+ ErrorBoundary: element.props.ErrorBoundary,
1443
+ hasErrorBoundary: element.props.ErrorBoundary != null || element.props.errorElement != null,
1444
+ shouldRevalidate: element.props.shouldRevalidate,
1445
+ handle: element.props.handle,
1446
+ lazy: element.props.lazy
1447
+ };
1448
+ if (element.props.children) {
1449
+ route.children = createRoutesFromChildren(element.props.children, treePath);
1450
+ }
1451
+ routes.push(route);
1452
+ });
1453
+ return routes;
1454
+ }
1455
+
1456
+ /**
1457
+ * Renders the result of `matchRoutes()` into a React element.
1458
+ */
1459
+ function renderMatches(matches) {
1460
+ return _renderMatches(matches);
1461
+ }
1462
+
1463
+ function mapRouteProperties(route) {
1464
+ let updates = {
1465
+ // Note: this check also occurs in createRoutesFromChildren so update
1466
+ // there if you change this -- please and thank you!
1467
+ hasErrorBoundary: route.ErrorBoundary != null || route.errorElement != null
1468
+ };
1469
+ if (route.Component) {
1470
+ {
1471
+ if (route.element) {
1472
+ router.UNSAFE_warning(false, "You should not include both `Component` and `element` on your route - " + "`Component` will be used.") ;
1473
+ }
1474
+ }
1475
+ Object.assign(updates, {
1476
+ element: /*#__PURE__*/React__namespace.createElement(route.Component),
1477
+ Component: undefined
1478
+ });
1479
+ }
1480
+ if (route.HydrateFallback) {
1481
+ {
1482
+ if (route.hydrateFallbackElement) {
1483
+ router.UNSAFE_warning(false, "You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - " + "`HydrateFallback` will be used.") ;
1484
+ }
1485
+ }
1486
+ Object.assign(updates, {
1487
+ hydrateFallbackElement: /*#__PURE__*/React__namespace.createElement(route.HydrateFallback),
1488
+ HydrateFallback: undefined
1489
+ });
1490
+ }
1491
+ if (route.ErrorBoundary) {
1492
+ {
1493
+ if (route.errorElement) {
1494
+ router.UNSAFE_warning(false, "You should not include both `ErrorBoundary` and `errorElement` on your route - " + "`ErrorBoundary` will be used.") ;
1495
+ }
1496
+ }
1497
+ Object.assign(updates, {
1498
+ errorElement: /*#__PURE__*/React__namespace.createElement(route.ErrorBoundary),
1499
+ ErrorBoundary: undefined
1500
+ });
1501
+ }
1502
+ return updates;
1503
+ }
1504
+ function createMemoryRouter(routes, opts) {
1505
+ return router.createRouter({
1506
+ basename: opts == null ? void 0 : opts.basename,
1507
+ future: _extends({}, opts == null ? void 0 : opts.future, {
1508
+ v7_prependBasename: true
1509
+ }),
1510
+ history: router.createMemoryHistory({
1511
+ initialEntries: opts == null ? void 0 : opts.initialEntries,
1512
+ initialIndex: opts == null ? void 0 : opts.initialIndex
1513
+ }),
1514
+ hydrationData: opts == null ? void 0 : opts.hydrationData,
1515
+ routes,
1516
+ mapRouteProperties,
1517
+ dataStrategy: opts == null ? void 0 : opts.dataStrategy,
1518
+ patchRoutesOnNavigation: opts == null ? void 0 : opts.patchRoutesOnNavigation
1519
+ }).initialize();
1520
+ }
1521
+
1522
+ Object.defineProperty(exports, 'AbortedDeferredError', {
1523
+ enumerable: true,
1524
+ get: function () { return router.AbortedDeferredError; }
1525
+ });
1526
+ Object.defineProperty(exports, 'NavigationType', {
1527
+ enumerable: true,
1528
+ get: function () { return router.Action; }
1529
+ });
1530
+ Object.defineProperty(exports, 'createPath', {
1531
+ enumerable: true,
1532
+ get: function () { return router.createPath; }
1533
+ });
1534
+ Object.defineProperty(exports, 'defer', {
1535
+ enumerable: true,
1536
+ get: function () { return router.defer; }
1537
+ });
1538
+ Object.defineProperty(exports, 'generatePath', {
1539
+ enumerable: true,
1540
+ get: function () { return router.generatePath; }
1541
+ });
1542
+ Object.defineProperty(exports, 'isRouteErrorResponse', {
1543
+ enumerable: true,
1544
+ get: function () { return router.isRouteErrorResponse; }
1545
+ });
1546
+ Object.defineProperty(exports, 'json', {
1547
+ enumerable: true,
1548
+ get: function () { return router.json; }
1549
+ });
1550
+ Object.defineProperty(exports, 'matchPath', {
1551
+ enumerable: true,
1552
+ get: function () { return router.matchPath; }
1553
+ });
1554
+ Object.defineProperty(exports, 'matchRoutes', {
1555
+ enumerable: true,
1556
+ get: function () { return router.matchRoutes; }
1557
+ });
1558
+ Object.defineProperty(exports, 'parsePath', {
1559
+ enumerable: true,
1560
+ get: function () { return router.parsePath; }
1561
+ });
1562
+ Object.defineProperty(exports, 'redirect', {
1563
+ enumerable: true,
1564
+ get: function () { return router.redirect; }
1565
+ });
1566
+ Object.defineProperty(exports, 'redirectDocument', {
1567
+ enumerable: true,
1568
+ get: function () { return router.redirectDocument; }
1569
+ });
1570
+ Object.defineProperty(exports, 'replace', {
1571
+ enumerable: true,
1572
+ get: function () { return router.replace; }
1573
+ });
1574
+ Object.defineProperty(exports, 'resolvePath', {
1575
+ enumerable: true,
1576
+ get: function () { return router.resolvePath; }
1577
+ });
1578
+ exports.Await = Await;
1579
+ exports.MemoryRouter = MemoryRouter;
1580
+ exports.Navigate = Navigate;
1581
+ exports.Outlet = Outlet;
1582
+ exports.Route = Route;
1583
+ exports.Router = Router;
1584
+ exports.RouterProvider = RouterProvider;
1585
+ exports.Routes = Routes;
1586
+ exports.UNSAFE_DataRouterContext = DataRouterContext;
1587
+ exports.UNSAFE_DataRouterStateContext = DataRouterStateContext;
1588
+ exports.UNSAFE_LocationContext = LocationContext;
1589
+ exports.UNSAFE_NavigationContext = NavigationContext;
1590
+ exports.UNSAFE_RouteContext = RouteContext;
1591
+ exports.UNSAFE_logV6DeprecationWarnings = logV6DeprecationWarnings;
1592
+ exports.UNSAFE_mapRouteProperties = mapRouteProperties;
1593
+ exports.UNSAFE_useRouteId = useRouteId;
1594
+ exports.UNSAFE_useRoutesImpl = useRoutesImpl;
1595
+ exports.createMemoryRouter = createMemoryRouter;
1596
+ exports.createRoutesFromChildren = createRoutesFromChildren;
1597
+ exports.createRoutesFromElements = createRoutesFromChildren;
1598
+ exports.renderMatches = renderMatches;
1599
+ exports.useActionData = useActionData;
1600
+ exports.useAsyncError = useAsyncError;
1601
+ exports.useAsyncValue = useAsyncValue;
1602
+ exports.useBlocker = useBlocker;
1603
+ exports.useHref = useHref;
1604
+ exports.useInRouterContext = useInRouterContext;
1605
+ exports.useLoaderData = useLoaderData;
1606
+ exports.useLocation = useLocation;
1607
+ exports.useMatch = useMatch;
1608
+ exports.useMatches = useMatches;
1609
+ exports.useNavigate = useNavigate;
1610
+ exports.useNavigation = useNavigation;
1611
+ exports.useNavigationType = useNavigationType;
1612
+ exports.useOutlet = useOutlet;
1613
+ exports.useOutletContext = useOutletContext;
1614
+ exports.useParams = useParams;
1615
+ exports.useResolvedPath = useResolvedPath;
1616
+ exports.useRevalidator = useRevalidator;
1617
+ exports.useRouteError = useRouteError;
1618
+ exports.useRouteLoaderData = useRouteLoaderData;
1619
+ exports.useRoutes = useRoutes;
1620
+
1621
+ Object.defineProperty(exports, '__esModule', { value: true });
1622
+
1623
+ }));
1624
+ //# sourceMappingURL=react-router.development.js.map