UNPKG

49.1 kBJavaScriptView Raw
1/**
2 * React Router v6.4.3
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 */
11import { invariant, joinPaths, matchPath, UNSAFE_getPathContributingMatches, warning, resolveTo, parsePath, matchRoutes, Action, isRouteErrorResponse, createMemoryHistory, stripBasename, AbortedDeferredError, createRouter } from '@remix-run/router';
12export { AbortedDeferredError, Action as NavigationType, createPath, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, resolvePath } from '@remix-run/router';
13import * as React from 'react';
14
15function _extends() {
16 _extends = Object.assign ? Object.assign.bind() : function (target) {
17 for (var i = 1; i < arguments.length; i++) {
18 var source = arguments[i];
19
20 for (var key in source) {
21 if (Object.prototype.hasOwnProperty.call(source, key)) {
22 target[key] = source[key];
23 }
24 }
25 }
26
27 return target;
28 };
29 return _extends.apply(this, arguments);
30}
31
32/**
33 * Copyright (c) Facebook, Inc. and its affiliates.
34 *
35 * This source code is licensed under the MIT license found in the
36 * LICENSE file in the root directory of this source tree.
37 */
38/**
39 * inlined Object.is polyfill to avoid requiring consumers ship their own
40 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
41 */
42
43function isPolyfill(x, y) {
44 return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
45 ;
46}
47
48const is = typeof Object.is === "function" ? Object.is : isPolyfill; // Intentionally not using named imports because Rollup uses dynamic
49// dispatch for CommonJS interop named imports.
50
51const {
52 useState,
53 useEffect,
54 useLayoutEffect,
55 useDebugValue
56} = React;
57let didWarnOld18Alpha = false;
58let didWarnUncachedGetSnapshot = false; // Disclaimer: This shim breaks many of the rules of React, and only works
59// because of a very particular set of implementation details and assumptions
60// -- change any one of them and it will break. The most important assumption
61// is that updates are always synchronous, because concurrent rendering is
62// only available in versions of React that also have a built-in
63// useSyncExternalStore API. And we only use this shim when the built-in API
64// does not exist.
65//
66// Do not assume that the clever hacks used by this hook also work in general.
67// The point of this shim is to replace the need for hacks by other libraries.
68
69function useSyncExternalStore$2(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of
70// React do not expose a way to check if we're hydrating. So users of the shim
71// will need to track that themselves and return the correct value
72// from `getSnapshot`.
73getServerSnapshot) {
74 if (process.env.NODE_ENV !== "production") {
75 if (!didWarnOld18Alpha) {
76 if ("startTransition" in React) {
77 didWarnOld18Alpha = true;
78 console.error("You are using an outdated, pre-release alpha of React 18 that " + "does not support useSyncExternalStore. The " + "use-sync-external-store shim will not work correctly. Upgrade " + "to a newer pre-release.");
79 }
80 }
81 } // Read the current snapshot from the store on every render. Again, this
82 // breaks the rules of React, and only works here because of specific
83 // implementation details, most importantly that updates are
84 // always synchronous.
85
86
87 const value = getSnapshot();
88
89 if (process.env.NODE_ENV !== "production") {
90 if (!didWarnUncachedGetSnapshot) {
91 const cachedValue = getSnapshot();
92
93 if (!is(value, cachedValue)) {
94 console.error("The result of getSnapshot should be cached to avoid an infinite loop");
95 didWarnUncachedGetSnapshot = true;
96 }
97 }
98 } // Because updates are synchronous, we don't queue them. Instead we force a
99 // re-render whenever the subscribed state changes by updating an some
100 // arbitrary useState hook. Then, during render, we call getSnapshot to read
101 // the current value.
102 //
103 // Because we don't actually use the state returned by the useState hook, we
104 // can save a bit of memory by storing other stuff in that slot.
105 //
106 // To implement the early bailout, we need to track some things on a mutable
107 // object. Usually, we would put that in a useRef hook, but we can stash it in
108 // our useState hook instead.
109 //
110 // To force a re-render, we call forceUpdate({inst}). That works because the
111 // new object always fails an equality check.
112
113
114 const [{
115 inst
116 }, forceUpdate] = useState({
117 inst: {
118 value,
119 getSnapshot
120 }
121 }); // Track the latest getSnapshot function with a ref. This needs to be updated
122 // in the layout phase so we can access it during the tearing check that
123 // happens on subscribe.
124
125 useLayoutEffect(() => {
126 inst.value = value;
127 inst.getSnapshot = getSnapshot; // Whenever getSnapshot or subscribe changes, we need to check in the
128 // commit phase if there was an interleaved mutation. In concurrent mode
129 // this can happen all the time, but even in synchronous mode, an earlier
130 // effect may have mutated the store.
131
132 if (checkIfSnapshotChanged(inst)) {
133 // Force a re-render.
134 forceUpdate({
135 inst
136 });
137 } // eslint-disable-next-line react-hooks/exhaustive-deps
138
139 }, [subscribe, value, getSnapshot]);
140 useEffect(() => {
141 // Check for changes right before subscribing. Subsequent changes will be
142 // detected in the subscription handler.
143 if (checkIfSnapshotChanged(inst)) {
144 // Force a re-render.
145 forceUpdate({
146 inst
147 });
148 }
149
150 const handleStoreChange = () => {
151 // TODO: Because there is no cross-renderer API for batching updates, it's
152 // up to the consumer of this library to wrap their subscription event
153 // with unstable_batchedUpdates. Should we try to detect when this isn't
154 // the case and print a warning in development?
155 // The store changed. Check if the snapshot changed since the last time we
156 // read from the store.
157 if (checkIfSnapshotChanged(inst)) {
158 // Force a re-render.
159 forceUpdate({
160 inst
161 });
162 }
163 }; // Subscribe to the store and return a clean-up function.
164
165
166 return subscribe(handleStoreChange); // eslint-disable-next-line react-hooks/exhaustive-deps
167 }, [subscribe]);
168 useDebugValue(value);
169 return value;
170}
171
172function checkIfSnapshotChanged(inst) {
173 const latestGetSnapshot = inst.getSnapshot;
174 const prevValue = inst.value;
175
176 try {
177 const nextValue = latestGetSnapshot();
178 return !is(prevValue, nextValue);
179 } catch (error) {
180 return true;
181 }
182}
183
184/**
185 * Copyright (c) Facebook, Inc. and its affiliates.
186 *
187 * This source code is licensed under the MIT license found in the
188 * LICENSE file in the root directory of this source tree.
189 *
190 * @flow
191 */
192function useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {
193 // Note: The shim does not use getServerSnapshot, because pre-18 versions of
194 // React do not expose a way to check if we're hydrating. So users of the shim
195 // will need to track that themselves and return the correct value
196 // from `getSnapshot`.
197 return getSnapshot();
198}
199
200/**
201 * Inlined into the react-router repo since use-sync-external-store does not
202 * provide a UMD-compatible package, so we need this to be able to distribute
203 * UMD react-router bundles
204 */
205const canUseDOM = !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined");
206const isServerEnvironment = !canUseDOM;
207const shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore$2;
208const useSyncExternalStore = "useSyncExternalStore" in React ? (module => module.useSyncExternalStore)(React) : shim;
209
210// Contexts for data routers
211const DataStaticRouterContext = /*#__PURE__*/React.createContext(null);
212
213if (process.env.NODE_ENV !== "production") {
214 DataStaticRouterContext.displayName = "DataStaticRouterContext";
215}
216
217const DataRouterContext = /*#__PURE__*/React.createContext(null);
218
219if (process.env.NODE_ENV !== "production") {
220 DataRouterContext.displayName = "DataRouter";
221}
222
223const DataRouterStateContext = /*#__PURE__*/React.createContext(null);
224
225if (process.env.NODE_ENV !== "production") {
226 DataRouterStateContext.displayName = "DataRouterState";
227}
228
229const AwaitContext = /*#__PURE__*/React.createContext(null);
230
231if (process.env.NODE_ENV !== "production") {
232 AwaitContext.displayName = "Await";
233}
234
235const NavigationContext = /*#__PURE__*/React.createContext(null);
236
237if (process.env.NODE_ENV !== "production") {
238 NavigationContext.displayName = "Navigation";
239}
240
241const LocationContext = /*#__PURE__*/React.createContext(null);
242
243if (process.env.NODE_ENV !== "production") {
244 LocationContext.displayName = "Location";
245}
246
247const RouteContext = /*#__PURE__*/React.createContext({
248 outlet: null,
249 matches: []
250});
251
252if (process.env.NODE_ENV !== "production") {
253 RouteContext.displayName = "Route";
254}
255
256const RouteErrorContext = /*#__PURE__*/React.createContext(null);
257
258if (process.env.NODE_ENV !== "production") {
259 RouteErrorContext.displayName = "RouteError";
260}
261
262/**
263 * Returns the full href for the given "to" value. This is useful for building
264 * custom links that are also accessible and preserve right-click behavior.
265 *
266 * @see https://reactrouter.com/docs/en/v6/hooks/use-href
267 */
268
269function useHref(to, _temp) {
270 let {
271 relative
272 } = _temp === void 0 ? {} : _temp;
273 !useInRouterContext() ? process.env.NODE_ENV !== "production" ? invariant(false, // TODO: This error is probably because they somehow have 2 versions of the
274 // router loaded. We can help them understand how to avoid that.
275 "useHref() may be used only in the context of a <Router> component.") : invariant(false) : void 0;
276 let {
277 basename,
278 navigator
279 } = React.useContext(NavigationContext);
280 let {
281 hash,
282 pathname,
283 search
284 } = useResolvedPath(to, {
285 relative
286 });
287 let joinedPathname = pathname; // If we're operating within a basename, prepend it to the pathname prior
288 // to creating the href. If this is a root navigation, then just use the raw
289 // basename which allows the basename to have full control over the presence
290 // of a trailing slash on root links
291
292 if (basename !== "/") {
293 joinedPathname = pathname === "/" ? basename : joinPaths([basename, pathname]);
294 }
295
296 return navigator.createHref({
297 pathname: joinedPathname,
298 search,
299 hash
300 });
301}
302/**
303 * Returns true if this component is a descendant of a <Router>.
304 *
305 * @see https://reactrouter.com/docs/en/v6/hooks/use-in-router-context
306 */
307
308function useInRouterContext() {
309 return React.useContext(LocationContext) != null;
310}
311/**
312 * Returns the current location object, which represents the current URL in web
313 * browsers.
314 *
315 * Note: If you're using this it may mean you're doing some of your own
316 * "routing" in your app, and we'd like to know what your use case is. We may
317 * be able to provide something higher-level to better suit your needs.
318 *
319 * @see https://reactrouter.com/docs/en/v6/hooks/use-location
320 */
321
322function useLocation() {
323 !useInRouterContext() ? process.env.NODE_ENV !== "production" ? invariant(false, // TODO: This error is probably because they somehow have 2 versions of the
324 // router loaded. We can help them understand how to avoid that.
325 "useLocation() may be used only in the context of a <Router> component.") : invariant(false) : void 0;
326 return React.useContext(LocationContext).location;
327}
328/**
329 * Returns the current navigation action which describes how the router came to
330 * the current location, either by a pop, push, or replace on the history stack.
331 *
332 * @see https://reactrouter.com/docs/en/v6/hooks/use-navigation-type
333 */
334
335function useNavigationType() {
336 return React.useContext(LocationContext).navigationType;
337}
338/**
339 * Returns true if the URL for the given "to" value matches the current URL.
340 * This is useful for components that need to know "active" state, e.g.
341 * <NavLink>.
342 *
343 * @see https://reactrouter.com/docs/en/v6/hooks/use-match
344 */
345
346function useMatch(pattern) {
347 !useInRouterContext() ? process.env.NODE_ENV !== "production" ? invariant(false, // TODO: This error is probably because they somehow have 2 versions of the
348 // router loaded. We can help them understand how to avoid that.
349 "useMatch() may be used only in the context of a <Router> component.") : invariant(false) : void 0;
350 let {
351 pathname
352 } = useLocation();
353 return React.useMemo(() => matchPath(pattern, pathname), [pathname, pattern]);
354}
355/**
356 * The interface for the navigate() function returned from useNavigate().
357 */
358
359/**
360 * Returns an imperative method for changing the location. Used by <Link>s, but
361 * may also be used by other elements to change the location.
362 *
363 * @see https://reactrouter.com/docs/en/v6/hooks/use-navigate
364 */
365function useNavigate() {
366 !useInRouterContext() ? process.env.NODE_ENV !== "production" ? invariant(false, // TODO: This error is probably because they somehow have 2 versions of the
367 // router loaded. We can help them understand how to avoid that.
368 "useNavigate() may be used only in the context of a <Router> component.") : invariant(false) : void 0;
369 let {
370 basename,
371 navigator
372 } = React.useContext(NavigationContext);
373 let {
374 matches
375 } = React.useContext(RouteContext);
376 let {
377 pathname: locationPathname
378 } = useLocation();
379 let routePathnamesJson = JSON.stringify(UNSAFE_getPathContributingMatches(matches).map(match => match.pathnameBase));
380 let activeRef = React.useRef(false);
381 React.useEffect(() => {
382 activeRef.current = true;
383 });
384 let navigate = React.useCallback(function (to, options) {
385 if (options === void 0) {
386 options = {};
387 }
388
389 process.env.NODE_ENV !== "production" ? warning(activeRef.current, "You should call navigate() in a React.useEffect(), not when " + "your component is first rendered.") : void 0;
390 if (!activeRef.current) return;
391
392 if (typeof to === "number") {
393 navigator.go(to);
394 return;
395 }
396
397 let path = resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, options.relative === "path"); // If we're operating within a basename, prepend it to the pathname prior
398 // to handing off to history. If this is a root navigation, then we
399 // navigate to the raw basename which allows the basename to have full
400 // control over the presence of a trailing slash on root links
401
402 if (basename !== "/") {
403 path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
404 }
405
406 (!!options.replace ? navigator.replace : navigator.push)(path, options.state, options);
407 }, [basename, navigator, routePathnamesJson, locationPathname]);
408 return navigate;
409}
410const OutletContext = /*#__PURE__*/React.createContext(null);
411/**
412 * Returns the context (if provided) for the child route at this level of the route
413 * hierarchy.
414 * @see https://reactrouter.com/docs/en/v6/hooks/use-outlet-context
415 */
416
417function useOutletContext() {
418 return React.useContext(OutletContext);
419}
420/**
421 * Returns the element for the child route at this level of the route
422 * hierarchy. Used internally by <Outlet> to render child routes.
423 *
424 * @see https://reactrouter.com/docs/en/v6/hooks/use-outlet
425 */
426
427function useOutlet(context) {
428 let outlet = React.useContext(RouteContext).outlet;
429
430 if (outlet) {
431 return /*#__PURE__*/React.createElement(OutletContext.Provider, {
432 value: context
433 }, outlet);
434 }
435
436 return outlet;
437}
438/**
439 * Returns an object of key/value pairs of the dynamic params from the current
440 * URL that were matched by the route path.
441 *
442 * @see https://reactrouter.com/docs/en/v6/hooks/use-params
443 */
444
445function useParams() {
446 let {
447 matches
448 } = React.useContext(RouteContext);
449 let routeMatch = matches[matches.length - 1];
450 return routeMatch ? routeMatch.params : {};
451}
452/**
453 * Resolves the pathname of the given `to` value against the current location.
454 *
455 * @see https://reactrouter.com/docs/en/v6/hooks/use-resolved-path
456 */
457
458function useResolvedPath(to, _temp2) {
459 let {
460 relative
461 } = _temp2 === void 0 ? {} : _temp2;
462 let {
463 matches
464 } = React.useContext(RouteContext);
465 let {
466 pathname: locationPathname
467 } = useLocation();
468 let routePathnamesJson = JSON.stringify(UNSAFE_getPathContributingMatches(matches).map(match => match.pathnameBase));
469 return React.useMemo(() => resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, relative === "path"), [to, routePathnamesJson, locationPathname, relative]);
470}
471/**
472 * Returns the element of the route that matched the current location, prepared
473 * with the correct context to render the remainder of the route tree. Route
474 * elements in the tree must render an <Outlet> to render their child route's
475 * element.
476 *
477 * @see https://reactrouter.com/docs/en/v6/hooks/use-routes
478 */
479
480function useRoutes(routes, locationArg) {
481 !useInRouterContext() ? process.env.NODE_ENV !== "production" ? invariant(false, // TODO: This error is probably because they somehow have 2 versions of the
482 // router loaded. We can help them understand how to avoid that.
483 "useRoutes() may be used only in the context of a <Router> component.") : invariant(false) : void 0;
484 let dataRouterStateContext = React.useContext(DataRouterStateContext);
485 let {
486 matches: parentMatches
487 } = React.useContext(RouteContext);
488 let routeMatch = parentMatches[parentMatches.length - 1];
489 let parentParams = routeMatch ? routeMatch.params : {};
490 let parentPathname = routeMatch ? routeMatch.pathname : "/";
491 let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : "/";
492 let parentRoute = routeMatch && routeMatch.route;
493
494 if (process.env.NODE_ENV !== "production") {
495 // You won't get a warning about 2 different <Routes> under a <Route>
496 // without a trailing *, but this is a best-effort warning anyway since we
497 // cannot even give the warning unless they land at the parent route.
498 //
499 // Example:
500 //
501 // <Routes>
502 // {/* This route path MUST end with /* because otherwise
503 // it will never match /blog/post/123 */}
504 // <Route path="blog" element={<Blog />} />
505 // <Route path="blog/feed" element={<BlogFeed />} />
506 // </Routes>
507 //
508 // function Blog() {
509 // return (
510 // <Routes>
511 // <Route path="post/:id" element={<Post />} />
512 // </Routes>
513 // );
514 // }
515 let parentPath = parentRoute && parentRoute.path || "";
516 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 + "/*") + "\">."));
517 }
518
519 let locationFromContext = useLocation();
520 let location;
521
522 if (locationArg) {
523 var _parsedLocationArg$pa;
524
525 let parsedLocationArg = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
526 !(parentPathnameBase === "/" || ((_parsedLocationArg$pa = parsedLocationArg.pathname) == null ? void 0 : _parsedLocationArg$pa.startsWith(parentPathnameBase))) ? process.env.NODE_ENV !== "production" ? 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.")) : invariant(false) : void 0;
527 location = parsedLocationArg;
528 } else {
529 location = locationFromContext;
530 }
531
532 let pathname = location.pathname || "/";
533 let remainingPathname = parentPathnameBase === "/" ? pathname : pathname.slice(parentPathnameBase.length) || "/";
534 let matches = matchRoutes(routes, {
535 pathname: remainingPathname
536 });
537
538 if (process.env.NODE_ENV !== "production") {
539 process.env.NODE_ENV !== "production" ? warning(parentRoute || matches != null, "No routes matched location \"" + location.pathname + location.search + location.hash + "\" ") : void 0;
540 process.env.NODE_ENV !== "production" ? warning(matches == null || matches[matches.length - 1].route.element !== undefined, "Matched leaf route at location \"" + location.pathname + location.search + location.hash + "\" does not have an element. " + "This means it will render an <Outlet /> with a null value by default resulting in an \"empty\" page.") : void 0;
541 }
542
543 let renderedMatches = _renderMatches(matches && matches.map(match => Object.assign({}, match, {
544 params: Object.assign({}, parentParams, match.params),
545 pathname: joinPaths([parentPathnameBase, match.pathname]),
546 pathnameBase: match.pathnameBase === "/" ? parentPathnameBase : joinPaths([parentPathnameBase, match.pathnameBase])
547 })), parentMatches, dataRouterStateContext || undefined); // When a user passes in a `locationArg`, the associated routes need to
548 // be wrapped in a new `LocationContext.Provider` in order for `useLocation`
549 // to use the scoped location instead of the global location.
550
551
552 if (locationArg && renderedMatches) {
553 return /*#__PURE__*/React.createElement(LocationContext.Provider, {
554 value: {
555 location: _extends({
556 pathname: "/",
557 search: "",
558 hash: "",
559 state: null,
560 key: "default"
561 }, location),
562 navigationType: Action.Pop
563 }
564 }, renderedMatches);
565 }
566
567 return renderedMatches;
568}
569
570function DefaultErrorElement() {
571 let error = useRouteError();
572 let message = isRouteErrorResponse(error) ? error.status + " " + error.statusText : error instanceof Error ? error.message : JSON.stringify(error);
573 let stack = error instanceof Error ? error.stack : null;
574 let lightgrey = "rgba(200,200,200, 0.5)";
575 let preStyles = {
576 padding: "0.5rem",
577 backgroundColor: lightgrey
578 };
579 let codeStyles = {
580 padding: "2px 4px",
581 backgroundColor: lightgrey
582 };
583 return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("h2", null, "Unhandled Thrown Error!"), /*#__PURE__*/React.createElement("h3", {
584 style: {
585 fontStyle: "italic"
586 }
587 }, message), stack ? /*#__PURE__*/React.createElement("pre", {
588 style: preStyles
589 }, stack) : null, /*#__PURE__*/React.createElement("p", null, "\uD83D\uDCBF Hey developer \uD83D\uDC4B"), /*#__PURE__*/React.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own\xA0", /*#__PURE__*/React.createElement("code", {
590 style: codeStyles
591 }, "errorElement"), " props on\xA0", /*#__PURE__*/React.createElement("code", {
592 style: codeStyles
593 }, "<Route>")));
594}
595
596class RenderErrorBoundary extends React.Component {
597 constructor(props) {
598 super(props);
599 this.state = {
600 location: props.location,
601 error: props.error
602 };
603 }
604
605 static getDerivedStateFromError(error) {
606 return {
607 error: error
608 };
609 }
610
611 static getDerivedStateFromProps(props, state) {
612 // When we get into an error state, the user will likely click "back" to the
613 // previous page that didn't have an error. Because this wraps the entire
614 // application, that will have no effect--the error page continues to display.
615 // This gives us a mechanism to recover from the error when the location changes.
616 //
617 // Whether we're in an error state or not, we update the location in state
618 // so that when we are in an error state, it gets reset when a new location
619 // comes in and the user recovers from the error.
620 if (state.location !== props.location) {
621 return {
622 error: props.error,
623 location: props.location
624 };
625 } // If we're not changing locations, preserve the location but still surface
626 // any new errors that may come through. We retain the existing error, we do
627 // this because the error provided from the app state may be cleared without
628 // the location changing.
629
630
631 return {
632 error: props.error || state.error,
633 location: state.location
634 };
635 }
636
637 componentDidCatch(error, errorInfo) {
638 console.error("React Router caught the following error during render", error, errorInfo);
639 }
640
641 render() {
642 return this.state.error ? /*#__PURE__*/React.createElement(RouteErrorContext.Provider, {
643 value: this.state.error,
644 children: this.props.component
645 }) : this.props.children;
646 }
647
648}
649
650function RenderedRoute(_ref) {
651 let {
652 routeContext,
653 match,
654 children
655 } = _ref;
656 let dataStaticRouterContext = React.useContext(DataStaticRouterContext); // Track how deep we got in our render pass to emulate SSR componentDidCatch
657 // in a DataStaticRouter
658
659 if (dataStaticRouterContext && match.route.errorElement) {
660 dataStaticRouterContext._deepestRenderedBoundaryId = match.route.id;
661 }
662
663 return /*#__PURE__*/React.createElement(RouteContext.Provider, {
664 value: routeContext
665 }, children);
666}
667
668function _renderMatches(matches, parentMatches, dataRouterState) {
669 if (parentMatches === void 0) {
670 parentMatches = [];
671 }
672
673 if (matches == null) {
674 if (dataRouterState != null && dataRouterState.errors) {
675 // Don't bail if we have data router errors so we can render them in the
676 // boundary. Use the pre-matched (or shimmed) matches
677 matches = dataRouterState.matches;
678 } else {
679 return null;
680 }
681 }
682
683 let renderedMatches = matches; // If we have data errors, trim matches to the highest error boundary
684
685 let errors = dataRouterState == null ? void 0 : dataRouterState.errors;
686
687 if (errors != null) {
688 let errorIndex = renderedMatches.findIndex(m => m.route.id && (errors == null ? void 0 : errors[m.route.id]));
689 !(errorIndex >= 0) ? process.env.NODE_ENV !== "production" ? invariant(false, "Could not find a matching route for the current errors: " + errors) : invariant(false) : void 0;
690 renderedMatches = renderedMatches.slice(0, Math.min(renderedMatches.length, errorIndex + 1));
691 }
692
693 return renderedMatches.reduceRight((outlet, match, index) => {
694 let error = match.route.id ? errors == null ? void 0 : errors[match.route.id] : null; // Only data routers handle errors
695
696 let errorElement = dataRouterState ? match.route.errorElement || /*#__PURE__*/React.createElement(DefaultErrorElement, null) : null;
697
698 let getChildren = () => /*#__PURE__*/React.createElement(RenderedRoute, {
699 match: match,
700 routeContext: {
701 outlet,
702 matches: parentMatches.concat(renderedMatches.slice(0, index + 1))
703 }
704 }, error ? errorElement : match.route.element !== undefined ? match.route.element : outlet); // Only wrap in an error boundary within data router usages when we have an
705 // errorElement on this route. Otherwise let it bubble up to an ancestor
706 // errorElement
707
708
709 return dataRouterState && (match.route.errorElement || index === 0) ? /*#__PURE__*/React.createElement(RenderErrorBoundary, {
710 location: dataRouterState.location,
711 component: errorElement,
712 error: error,
713 children: getChildren()
714 }) : getChildren();
715 }, null);
716}
717var DataRouterHook;
718
719(function (DataRouterHook) {
720 DataRouterHook["UseRevalidator"] = "useRevalidator";
721})(DataRouterHook || (DataRouterHook = {}));
722
723var DataRouterStateHook;
724
725(function (DataRouterStateHook) {
726 DataRouterStateHook["UseLoaderData"] = "useLoaderData";
727 DataRouterStateHook["UseActionData"] = "useActionData";
728 DataRouterStateHook["UseRouteError"] = "useRouteError";
729 DataRouterStateHook["UseNavigation"] = "useNavigation";
730 DataRouterStateHook["UseRouteLoaderData"] = "useRouteLoaderData";
731 DataRouterStateHook["UseMatches"] = "useMatches";
732 DataRouterStateHook["UseRevalidator"] = "useRevalidator";
733})(DataRouterStateHook || (DataRouterStateHook = {}));
734
735function getDataRouterConsoleError(hookName) {
736 return hookName + " must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.";
737}
738
739function useDataRouterContext(hookName) {
740 let ctx = React.useContext(DataRouterContext);
741 !ctx ? process.env.NODE_ENV !== "production" ? invariant(false, getDataRouterConsoleError(hookName)) : invariant(false) : void 0;
742 return ctx;
743}
744
745function useDataRouterState(hookName) {
746 let state = React.useContext(DataRouterStateContext);
747 !state ? process.env.NODE_ENV !== "production" ? invariant(false, getDataRouterConsoleError(hookName)) : invariant(false) : void 0;
748 return state;
749}
750/**
751 * Returns the current navigation, defaulting to an "idle" navigation when
752 * no navigation is in progress
753 */
754
755
756function useNavigation() {
757 let state = useDataRouterState(DataRouterStateHook.UseNavigation);
758 return state.navigation;
759}
760/**
761 * Returns a revalidate function for manually triggering revalidation, as well
762 * as the current state of any manual revalidations
763 */
764
765function useRevalidator() {
766 let dataRouterContext = useDataRouterContext(DataRouterHook.UseRevalidator);
767 let state = useDataRouterState(DataRouterStateHook.UseRevalidator);
768 return {
769 revalidate: dataRouterContext.router.revalidate,
770 state: state.revalidation
771 };
772}
773/**
774 * Returns the active route matches, useful for accessing loaderData for
775 * parent/child routes or the route "handle" property
776 */
777
778function useMatches() {
779 let {
780 matches,
781 loaderData
782 } = useDataRouterState(DataRouterStateHook.UseMatches);
783 return React.useMemo(() => matches.map(match => {
784 let {
785 pathname,
786 params
787 } = match; // Note: This structure matches that created by createUseMatchesMatch
788 // in the @remix-run/router , so if you change this please also change
789 // that :) Eventually we'll DRY this up
790
791 return {
792 id: match.route.id,
793 pathname,
794 params,
795 data: loaderData[match.route.id],
796 handle: match.route.handle
797 };
798 }), [matches, loaderData]);
799}
800/**
801 * Returns the loader data for the nearest ancestor Route loader
802 */
803
804function useLoaderData() {
805 let state = useDataRouterState(DataRouterStateHook.UseLoaderData);
806 let route = React.useContext(RouteContext);
807 !route ? process.env.NODE_ENV !== "production" ? invariant(false, "useLoaderData must be used inside a RouteContext") : invariant(false) : void 0;
808 let thisRoute = route.matches[route.matches.length - 1];
809 !thisRoute.route.id ? process.env.NODE_ENV !== "production" ? invariant(false, "useLoaderData can only be used on routes that contain a unique \"id\"") : invariant(false) : void 0;
810 return state.loaderData[thisRoute.route.id];
811}
812/**
813 * Returns the loaderData for the given routeId
814 */
815
816function useRouteLoaderData(routeId) {
817 let state = useDataRouterState(DataRouterStateHook.UseRouteLoaderData);
818 return state.loaderData[routeId];
819}
820/**
821 * Returns the action data for the nearest ancestor Route action
822 */
823
824function useActionData() {
825 let state = useDataRouterState(DataRouterStateHook.UseActionData);
826 let route = React.useContext(RouteContext);
827 !route ? process.env.NODE_ENV !== "production" ? invariant(false, "useActionData must be used inside a RouteContext") : invariant(false) : void 0;
828 return Object.values((state == null ? void 0 : state.actionData) || {})[0];
829}
830/**
831 * Returns the nearest ancestor Route error, which could be a loader/action
832 * error or a render error. This is intended to be called from your
833 * errorElement to display a proper error message.
834 */
835
836function useRouteError() {
837 var _state$errors;
838
839 let error = React.useContext(RouteErrorContext);
840 let state = useDataRouterState(DataRouterStateHook.UseRouteError);
841 let route = React.useContext(RouteContext);
842 let thisRoute = route.matches[route.matches.length - 1]; // If this was a render error, we put it in a RouteError context inside
843 // of RenderErrorBoundary
844
845 if (error) {
846 return error;
847 }
848
849 !route ? process.env.NODE_ENV !== "production" ? invariant(false, "useRouteError must be used inside a RouteContext") : invariant(false) : void 0;
850 !thisRoute.route.id ? process.env.NODE_ENV !== "production" ? invariant(false, "useRouteError can only be used on routes that contain a unique \"id\"") : invariant(false) : void 0; // Otherwise look for errors from our data router state
851
852 return (_state$errors = state.errors) == null ? void 0 : _state$errors[thisRoute.route.id];
853}
854/**
855 * Returns the happy-path data from the nearest ancestor <Await /> value
856 */
857
858function useAsyncValue() {
859 let value = React.useContext(AwaitContext);
860 return value == null ? void 0 : value._data;
861}
862/**
863 * Returns the error from the nearest ancestor <Await /> value
864 */
865
866function useAsyncError() {
867 let value = React.useContext(AwaitContext);
868 return value == null ? void 0 : value._error;
869}
870const alreadyWarned = {};
871
872function warningOnce(key, cond, message) {
873 if (!cond && !alreadyWarned[key]) {
874 alreadyWarned[key] = true;
875 process.env.NODE_ENV !== "production" ? warning(false, message) : void 0;
876 }
877}
878
879/**
880 * Given a Remix Router instance, render the appropriate UI
881 */
882function RouterProvider(_ref) {
883 let {
884 fallbackElement,
885 router
886 } = _ref;
887 // Sync router state to our component state to force re-renders
888 let state = useSyncExternalStore(router.subscribe, () => router.state, // We have to provide this so React@18 doesn't complain during hydration,
889 // but we pass our serialized hydration data into the router so state here
890 // is already synced with what the server saw
891 () => router.state);
892 let navigator = React.useMemo(() => {
893 return {
894 createHref: router.createHref,
895 go: n => router.navigate(n),
896 push: (to, state, opts) => router.navigate(to, {
897 state,
898 preventScrollReset: opts == null ? void 0 : opts.preventScrollReset
899 }),
900 replace: (to, state, opts) => router.navigate(to, {
901 replace: true,
902 state,
903 preventScrollReset: opts == null ? void 0 : opts.preventScrollReset
904 })
905 };
906 }, [router]);
907 let basename = router.basename || "/";
908 return /*#__PURE__*/React.createElement(DataRouterContext.Provider, {
909 value: {
910 router,
911 navigator,
912 static: false,
913 // Do we need this?
914 basename
915 }
916 }, /*#__PURE__*/React.createElement(DataRouterStateContext.Provider, {
917 value: state
918 }, /*#__PURE__*/React.createElement(Router, {
919 basename: router.basename,
920 location: router.state.location,
921 navigationType: router.state.historyAction,
922 navigator: navigator
923 }, router.state.initialized ? /*#__PURE__*/React.createElement(Routes, null) : fallbackElement)));
924}
925
926/**
927 * A <Router> that stores all entries in memory.
928 *
929 * @see https://reactrouter.com/docs/en/v6/routers/memory-router
930 */
931function MemoryRouter(_ref2) {
932 let {
933 basename,
934 children,
935 initialEntries,
936 initialIndex
937 } = _ref2;
938 let historyRef = React.useRef();
939
940 if (historyRef.current == null) {
941 historyRef.current = createMemoryHistory({
942 initialEntries,
943 initialIndex,
944 v5Compat: true
945 });
946 }
947
948 let history = historyRef.current;
949 let [state, setState] = React.useState({
950 action: history.action,
951 location: history.location
952 });
953 React.useLayoutEffect(() => history.listen(setState), [history]);
954 return /*#__PURE__*/React.createElement(Router, {
955 basename: basename,
956 children: children,
957 location: state.location,
958 navigationType: state.action,
959 navigator: history
960 });
961}
962
963/**
964 * Changes the current location.
965 *
966 * Note: This API is mostly useful in React.Component subclasses that are not
967 * able to use hooks. In functional components, we recommend you use the
968 * `useNavigate` hook instead.
969 *
970 * @see https://reactrouter.com/docs/en/v6/components/navigate
971 */
972function Navigate(_ref3) {
973 let {
974 to,
975 replace,
976 state,
977 relative
978 } = _ref3;
979 !useInRouterContext() ? process.env.NODE_ENV !== "production" ? invariant(false, // TODO: This error is probably because they somehow have 2 versions of
980 // the router loaded. We can help them understand how to avoid that.
981 "<Navigate> may be used only in the context of a <Router> component.") : invariant(false) : void 0;
982 process.env.NODE_ENV !== "production" ? warning(!React.useContext(NavigationContext).static, "<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.") : void 0;
983 let dataRouterState = React.useContext(DataRouterStateContext);
984 let navigate = useNavigate();
985 React.useEffect(() => {
986 // Avoid kicking off multiple navigations if we're in the middle of a
987 // data-router navigation, since components get re-rendered when we enter
988 // a submitting/loading state
989 if (dataRouterState && dataRouterState.navigation.state !== "idle") {
990 return;
991 }
992
993 navigate(to, {
994 replace,
995 state,
996 relative
997 });
998 });
999 return null;
1000}
1001
1002/**
1003 * Renders the child route's element, if there is one.
1004 *
1005 * @see https://reactrouter.com/docs/en/v6/components/outlet
1006 */
1007function Outlet(props) {
1008 return useOutlet(props.context);
1009}
1010
1011/**
1012 * Declares an element that should be rendered at a certain URL path.
1013 *
1014 * @see https://reactrouter.com/docs/en/v6/components/route
1015 */
1016function Route(_props) {
1017 process.env.NODE_ENV !== "production" ? 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>.") : invariant(false) ;
1018}
1019
1020/**
1021 * Provides location context for the rest of the app.
1022 *
1023 * Note: You usually won't render a <Router> directly. Instead, you'll render a
1024 * router that is more specific to your environment such as a <BrowserRouter>
1025 * in web browsers or a <StaticRouter> for server rendering.
1026 *
1027 * @see https://reactrouter.com/docs/en/v6/routers/router
1028 */
1029function Router(_ref4) {
1030 let {
1031 basename: basenameProp = "/",
1032 children = null,
1033 location: locationProp,
1034 navigationType = Action.Pop,
1035 navigator,
1036 static: staticProp = false
1037 } = _ref4;
1038 !!useInRouterContext() ? process.env.NODE_ENV !== "production" ? invariant(false, "You cannot render a <Router> inside another <Router>." + " You should never have more than one in your app.") : invariant(false) : void 0; // Preserve trailing slashes on basename, so we can let the user control
1039 // the enforcement of trailing slashes throughout the app
1040
1041 let basename = basenameProp.replace(/^\/*/, "/");
1042 let navigationContext = React.useMemo(() => ({
1043 basename,
1044 navigator,
1045 static: staticProp
1046 }), [basename, navigator, staticProp]);
1047
1048 if (typeof locationProp === "string") {
1049 locationProp = parsePath(locationProp);
1050 }
1051
1052 let {
1053 pathname = "/",
1054 search = "",
1055 hash = "",
1056 state = null,
1057 key = "default"
1058 } = locationProp;
1059 let location = React.useMemo(() => {
1060 let trailingPathname = stripBasename(pathname, basename);
1061
1062 if (trailingPathname == null) {
1063 return null;
1064 }
1065
1066 return {
1067 pathname: trailingPathname,
1068 search,
1069 hash,
1070 state,
1071 key
1072 };
1073 }, [basename, pathname, search, hash, state, key]);
1074 process.env.NODE_ENV !== "production" ? warning(location != 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.") : void 0;
1075
1076 if (location == null) {
1077 return null;
1078 }
1079
1080 return /*#__PURE__*/React.createElement(NavigationContext.Provider, {
1081 value: navigationContext
1082 }, /*#__PURE__*/React.createElement(LocationContext.Provider, {
1083 children: children,
1084 value: {
1085 location,
1086 navigationType
1087 }
1088 }));
1089}
1090
1091/**
1092 * A container for a nested tree of <Route> elements that renders the branch
1093 * that best matches the current location.
1094 *
1095 * @see https://reactrouter.com/docs/en/v6/components/routes
1096 */
1097function Routes(_ref5) {
1098 let {
1099 children,
1100 location
1101 } = _ref5;
1102 let dataRouterContext = React.useContext(DataRouterContext); // When in a DataRouterContext _without_ children, we use the router routes
1103 // directly. If we have children, then we're in a descendant tree and we
1104 // need to use child routes.
1105
1106 let routes = dataRouterContext && !children ? dataRouterContext.router.routes : createRoutesFromChildren(children);
1107 return useRoutes(routes, location);
1108}
1109
1110/**
1111 * Component to use for rendering lazily loaded data from returning defer()
1112 * in a loader function
1113 */
1114function Await(_ref6) {
1115 let {
1116 children,
1117 errorElement,
1118 resolve
1119 } = _ref6;
1120 return /*#__PURE__*/React.createElement(AwaitErrorBoundary, {
1121 resolve: resolve,
1122 errorElement: errorElement
1123 }, /*#__PURE__*/React.createElement(ResolveAwait, null, children));
1124}
1125var AwaitRenderStatus;
1126
1127(function (AwaitRenderStatus) {
1128 AwaitRenderStatus[AwaitRenderStatus["pending"] = 0] = "pending";
1129 AwaitRenderStatus[AwaitRenderStatus["success"] = 1] = "success";
1130 AwaitRenderStatus[AwaitRenderStatus["error"] = 2] = "error";
1131})(AwaitRenderStatus || (AwaitRenderStatus = {}));
1132
1133const neverSettledPromise = new Promise(() => {});
1134
1135class AwaitErrorBoundary extends React.Component {
1136 constructor(props) {
1137 super(props);
1138 this.state = {
1139 error: null
1140 };
1141 }
1142
1143 static getDerivedStateFromError(error) {
1144 return {
1145 error
1146 };
1147 }
1148
1149 componentDidCatch(error, errorInfo) {
1150 console.error("<Await> caught the following error during render", error, errorInfo);
1151 }
1152
1153 render() {
1154 let {
1155 children,
1156 errorElement,
1157 resolve
1158 } = this.props;
1159 let promise = null;
1160 let status = AwaitRenderStatus.pending;
1161
1162 if (!(resolve instanceof Promise)) {
1163 // Didn't get a promise - provide as a resolved promise
1164 status = AwaitRenderStatus.success;
1165 promise = Promise.resolve();
1166 Object.defineProperty(promise, "_tracked", {
1167 get: () => true
1168 });
1169 Object.defineProperty(promise, "_data", {
1170 get: () => resolve
1171 });
1172 } else if (this.state.error) {
1173 // Caught a render error, provide it as a rejected promise
1174 status = AwaitRenderStatus.error;
1175 let renderError = this.state.error;
1176 promise = Promise.reject().catch(() => {}); // Avoid unhandled rejection warnings
1177
1178 Object.defineProperty(promise, "_tracked", {
1179 get: () => true
1180 });
1181 Object.defineProperty(promise, "_error", {
1182 get: () => renderError
1183 });
1184 } else if (resolve._tracked) {
1185 // Already tracked promise - check contents
1186 promise = resolve;
1187 status = promise._error !== undefined ? AwaitRenderStatus.error : promise._data !== undefined ? AwaitRenderStatus.success : AwaitRenderStatus.pending;
1188 } else {
1189 // Raw (untracked) promise - track it
1190 status = AwaitRenderStatus.pending;
1191 Object.defineProperty(resolve, "_tracked", {
1192 get: () => true
1193 });
1194 promise = resolve.then(data => Object.defineProperty(resolve, "_data", {
1195 get: () => data
1196 }), error => Object.defineProperty(resolve, "_error", {
1197 get: () => error
1198 }));
1199 }
1200
1201 if (status === AwaitRenderStatus.error && promise._error instanceof AbortedDeferredError) {
1202 // Freeze the UI by throwing a never resolved promise
1203 throw neverSettledPromise;
1204 }
1205
1206 if (status === AwaitRenderStatus.error && !errorElement) {
1207 // No errorElement, throw to the nearest route-level error boundary
1208 throw promise._error;
1209 }
1210
1211 if (status === AwaitRenderStatus.error) {
1212 // Render via our errorElement
1213 return /*#__PURE__*/React.createElement(AwaitContext.Provider, {
1214 value: promise,
1215 children: errorElement
1216 });
1217 }
1218
1219 if (status === AwaitRenderStatus.success) {
1220 // Render children with resolved value
1221 return /*#__PURE__*/React.createElement(AwaitContext.Provider, {
1222 value: promise,
1223 children: children
1224 });
1225 } // Throw to the suspense boundary
1226
1227
1228 throw promise;
1229 }
1230
1231}
1232/**
1233 * @private
1234 * Indirection to leverage useAsyncValue for a render-prop API on <Await>
1235 */
1236
1237
1238function ResolveAwait(_ref7) {
1239 let {
1240 children
1241 } = _ref7;
1242 let data = useAsyncValue();
1243
1244 if (typeof children === "function") {
1245 return children(data);
1246 }
1247
1248 return /*#__PURE__*/React.createElement(React.Fragment, null, children);
1249} ///////////////////////////////////////////////////////////////////////////////
1250// UTILS
1251///////////////////////////////////////////////////////////////////////////////
1252
1253/**
1254 * Creates a route config from a React "children" object, which is usually
1255 * either a `<Route>` element or an array of them. Used internally by
1256 * `<Routes>` to create a route config from its children.
1257 *
1258 * @see https://reactrouter.com/docs/en/v6/utils/create-routes-from-children
1259 */
1260
1261
1262function createRoutesFromChildren(children, parentPath) {
1263 if (parentPath === void 0) {
1264 parentPath = [];
1265 }
1266
1267 let routes = [];
1268 React.Children.forEach(children, (element, index) => {
1269 if (! /*#__PURE__*/React.isValidElement(element)) {
1270 // Ignore non-elements. This allows people to more easily inline
1271 // conditionals in their route config.
1272 return;
1273 }
1274
1275 if (element.type === React.Fragment) {
1276 // Transparently support React.Fragment and its children.
1277 routes.push.apply(routes, createRoutesFromChildren(element.props.children, parentPath));
1278 return;
1279 }
1280
1281 !(element.type === Route) ? process.env.NODE_ENV !== "production" ? 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>") : invariant(false) : void 0;
1282 !(!element.props.index || !element.props.children) ? process.env.NODE_ENV !== "production" ? invariant(false, "An index route cannot have child routes.") : invariant(false) : void 0;
1283 let treePath = [...parentPath, index];
1284 let route = {
1285 id: element.props.id || treePath.join("-"),
1286 caseSensitive: element.props.caseSensitive,
1287 element: element.props.element,
1288 index: element.props.index,
1289 path: element.props.path,
1290 loader: element.props.loader,
1291 action: element.props.action,
1292 errorElement: element.props.errorElement,
1293 hasErrorBoundary: element.props.errorElement != null,
1294 shouldRevalidate: element.props.shouldRevalidate,
1295 handle: element.props.handle
1296 };
1297
1298 if (element.props.children) {
1299 route.children = createRoutesFromChildren(element.props.children, treePath);
1300 }
1301
1302 routes.push(route);
1303 });
1304 return routes;
1305}
1306/**
1307 * Renders the result of `matchRoutes()` into a React element.
1308 */
1309
1310function renderMatches(matches) {
1311 return _renderMatches(matches);
1312}
1313/**
1314 * @private
1315 * Walk the route tree and add hasErrorBoundary if it's not provided, so that
1316 * users providing manual route arrays can just specify errorElement
1317 */
1318
1319function enhanceManualRouteObjects(routes) {
1320 return routes.map(route => {
1321 let routeClone = _extends({}, route);
1322
1323 if (routeClone.hasErrorBoundary == null) {
1324 routeClone.hasErrorBoundary = routeClone.errorElement != null;
1325 }
1326
1327 if (routeClone.children) {
1328 routeClone.children = enhanceManualRouteObjects(routeClone.children);
1329 }
1330
1331 return routeClone;
1332 });
1333}
1334
1335function createMemoryRouter(routes, opts) {
1336 return createRouter({
1337 basename: opts == null ? void 0 : opts.basename,
1338 history: createMemoryHistory({
1339 initialEntries: opts == null ? void 0 : opts.initialEntries,
1340 initialIndex: opts == null ? void 0 : opts.initialIndex
1341 }),
1342 hydrationData: opts == null ? void 0 : opts.hydrationData,
1343 routes: enhanceManualRouteObjects(routes)
1344 }).initialize();
1345} ///////////////////////////////////////////////////////////////////////////////
1346
1347export { Await, MemoryRouter, Navigate, Outlet, Route, Router, RouterProvider, Routes, DataRouterContext as UNSAFE_DataRouterContext, DataRouterStateContext as UNSAFE_DataRouterStateContext, DataStaticRouterContext as UNSAFE_DataStaticRouterContext, LocationContext as UNSAFE_LocationContext, NavigationContext as UNSAFE_NavigationContext, RouteContext as UNSAFE_RouteContext, enhanceManualRouteObjects as UNSAFE_enhanceManualRouteObjects, createMemoryRouter, createRoutesFromChildren, createRoutesFromChildren as createRoutesFromElements, renderMatches, useActionData, useAsyncError, useAsyncValue, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes };
1348//# sourceMappingURL=index.js.map