1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | (function (global, factory) {
|
12 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@remix-run/router'), require('react')) :
|
13 | typeof define === 'function' && define.amd ? define(['exports', '@remix-run/router', 'react'], factory) :
|
14 | (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ReactRouter = {}, global.RemixRouter, global.React));
|
15 | })(this, (function (exports, router, React) { '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 = _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 |
|
42 | for (var key in source) {
|
43 | if (Object.prototype.hasOwnProperty.call(source, key)) {
|
44 | target[key] = source[key];
|
45 | }
|
46 | }
|
47 | }
|
48 |
|
49 | return target;
|
50 | };
|
51 | return _extends.apply(this, arguments);
|
52 | }
|
53 |
|
54 | |
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 | |
61 |
|
62 |
|
63 |
|
64 |
|
65 | function isPolyfill(x, y) {
|
66 | return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y
|
67 | ;
|
68 | }
|
69 |
|
70 | const is = typeof Object.is === "function" ? Object.is : isPolyfill;
|
71 |
|
72 |
|
73 | const {
|
74 | useState,
|
75 | useEffect,
|
76 | useLayoutEffect,
|
77 | useDebugValue
|
78 | } = React__namespace;
|
79 | let didWarnOld18Alpha = false;
|
80 | let didWarnUncachedGetSnapshot = false;
|
81 |
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 |
|
91 | function useSyncExternalStore$2(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of
|
92 | // React do not expose a way to check if we're hydrating. So users of the shim
|
93 |
|
94 |
|
95 | getServerSnapshot) {
|
96 | {
|
97 | if (!didWarnOld18Alpha) {
|
98 | if ("startTransition" in React__namespace) {
|
99 | didWarnOld18Alpha = true;
|
100 | 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.");
|
101 | }
|
102 | }
|
103 | }
|
104 |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 | const value = getSnapshot();
|
110 |
|
111 | {
|
112 | if (!didWarnUncachedGetSnapshot) {
|
113 | const cachedValue = getSnapshot();
|
114 |
|
115 | if (!is(value, cachedValue)) {
|
116 | console.error("The result of getSnapshot should be cached to avoid an infinite loop");
|
117 | didWarnUncachedGetSnapshot = true;
|
118 | }
|
119 | }
|
120 | }
|
121 |
|
122 |
|
123 |
|
124 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 |
|
136 | const [{
|
137 | inst
|
138 | }, forceUpdate] = useState({
|
139 | inst: {
|
140 | value,
|
141 | getSnapshot
|
142 | }
|
143 | });
|
144 |
|
145 |
|
146 |
|
147 | useLayoutEffect(() => {
|
148 | inst.value = value;
|
149 | inst.getSnapshot = getSnapshot;
|
150 |
|
151 |
|
152 |
|
153 |
|
154 | if (checkIfSnapshotChanged(inst)) {
|
155 |
|
156 | forceUpdate({
|
157 | inst
|
158 | });
|
159 | }
|
160 |
|
161 | }, [subscribe, value, getSnapshot]);
|
162 | useEffect(() => {
|
163 |
|
164 |
|
165 | if (checkIfSnapshotChanged(inst)) {
|
166 |
|
167 | forceUpdate({
|
168 | inst
|
169 | });
|
170 | }
|
171 |
|
172 | const handleStoreChange = () => {
|
173 |
|
174 |
|
175 |
|
176 |
|
177 |
|
178 |
|
179 | if (checkIfSnapshotChanged(inst)) {
|
180 |
|
181 | forceUpdate({
|
182 | inst
|
183 | });
|
184 | }
|
185 | };
|
186 |
|
187 |
|
188 | return subscribe(handleStoreChange);
|
189 | }, [subscribe]);
|
190 | useDebugValue(value);
|
191 | return value;
|
192 | }
|
193 |
|
194 | function checkIfSnapshotChanged(inst) {
|
195 | const latestGetSnapshot = inst.getSnapshot;
|
196 | const prevValue = inst.value;
|
197 |
|
198 | try {
|
199 | const nextValue = latestGetSnapshot();
|
200 | return !is(prevValue, nextValue);
|
201 | } catch (error) {
|
202 | return true;
|
203 | }
|
204 | }
|
205 |
|
206 | |
207 |
|
208 |
|
209 |
|
210 |
|
211 |
|
212 |
|
213 |
|
214 | function useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {
|
215 |
|
216 |
|
217 |
|
218 |
|
219 | return getSnapshot();
|
220 | }
|
221 |
|
222 | |
223 |
|
224 |
|
225 |
|
226 |
|
227 | const canUseDOM = !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined");
|
228 | const isServerEnvironment = !canUseDOM;
|
229 | const shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore$2;
|
230 | const useSyncExternalStore = "useSyncExternalStore" in React__namespace ? (module => module.useSyncExternalStore)(React__namespace) : shim;
|
231 |
|
232 | const DataRouterContext = React__namespace.createContext(null);
|
233 |
|
234 | {
|
235 | DataRouterContext.displayName = "DataRouter";
|
236 | }
|
237 |
|
238 | const DataRouterStateContext = React__namespace.createContext(null);
|
239 |
|
240 | {
|
241 | DataRouterStateContext.displayName = "DataRouterState";
|
242 | }
|
243 |
|
244 | const AwaitContext = React__namespace.createContext(null);
|
245 |
|
246 | {
|
247 | AwaitContext.displayName = "Await";
|
248 | }
|
249 |
|
250 | const NavigationContext = React__namespace.createContext(null);
|
251 |
|
252 | {
|
253 | NavigationContext.displayName = "Navigation";
|
254 | }
|
255 |
|
256 | const LocationContext = React__namespace.createContext(null);
|
257 |
|
258 | {
|
259 | LocationContext.displayName = "Location";
|
260 | }
|
261 |
|
262 | const RouteContext = React__namespace.createContext({
|
263 | outlet: null,
|
264 | matches: []
|
265 | });
|
266 |
|
267 | {
|
268 | RouteContext.displayName = "Route";
|
269 | }
|
270 |
|
271 | const RouteErrorContext = React__namespace.createContext(null);
|
272 |
|
273 | {
|
274 | RouteErrorContext.displayName = "RouteError";
|
275 | }
|
276 |
|
277 | |
278 |
|
279 |
|
280 |
|
281 |
|
282 |
|
283 |
|
284 | function useHref(to, _temp) {
|
285 | let {
|
286 | relative
|
287 | } = _temp === void 0 ? {} : _temp;
|
288 | !useInRouterContext() ? router.invariant(false,
|
289 |
|
290 | "useHref() may be used only in the context of a <Router> component.") : void 0;
|
291 | let {
|
292 | basename,
|
293 | navigator
|
294 | } = React__namespace.useContext(NavigationContext);
|
295 | let {
|
296 | hash,
|
297 | pathname,
|
298 | search
|
299 | } = useResolvedPath(to, {
|
300 | relative
|
301 | });
|
302 | let joinedPathname = pathname;
|
303 |
|
304 |
|
305 |
|
306 |
|
307 | if (basename !== "/") {
|
308 | joinedPathname = pathname === "/" ? basename : router.joinPaths([basename, pathname]);
|
309 | }
|
310 |
|
311 | return navigator.createHref({
|
312 | pathname: joinedPathname,
|
313 | search,
|
314 | hash
|
315 | });
|
316 | }
|
317 | |
318 |
|
319 |
|
320 |
|
321 |
|
322 |
|
323 | function useInRouterContext() {
|
324 | return React__namespace.useContext(LocationContext) != null;
|
325 | }
|
326 | |
327 |
|
328 |
|
329 |
|
330 |
|
331 |
|
332 |
|
333 |
|
334 |
|
335 |
|
336 |
|
337 | function useLocation() {
|
338 | !useInRouterContext() ? router.invariant(false,
|
339 |
|
340 | "useLocation() may be used only in the context of a <Router> component.") : void 0;
|
341 | return React__namespace.useContext(LocationContext).location;
|
342 | }
|
343 | |
344 |
|
345 |
|
346 |
|
347 |
|
348 |
|
349 |
|
350 | function useNavigationType() {
|
351 | return React__namespace.useContext(LocationContext).navigationType;
|
352 | }
|
353 | |
354 |
|
355 |
|
356 |
|
357 |
|
358 |
|
359 |
|
360 |
|
361 | function useMatch(pattern) {
|
362 | !useInRouterContext() ? router.invariant(false,
|
363 |
|
364 | "useMatch() may be used only in the context of a <Router> component.") : void 0;
|
365 | let {
|
366 | pathname
|
367 | } = useLocation();
|
368 | return React__namespace.useMemo(() => router.matchPath(pattern, pathname), [pathname, pattern]);
|
369 | }
|
370 | |
371 |
|
372 |
|
373 |
|
374 | |
375 |
|
376 |
|
377 |
|
378 |
|
379 |
|
380 | function useNavigate() {
|
381 | !useInRouterContext() ? router.invariant(false,
|
382 |
|
383 | "useNavigate() may be used only in the context of a <Router> component.") : void 0;
|
384 | let {
|
385 | basename,
|
386 | navigator
|
387 | } = React__namespace.useContext(NavigationContext);
|
388 | let {
|
389 | matches
|
390 | } = React__namespace.useContext(RouteContext);
|
391 | let {
|
392 | pathname: locationPathname
|
393 | } = useLocation();
|
394 | let routePathnamesJson = JSON.stringify(router.UNSAFE_getPathContributingMatches(matches).map(match => match.pathnameBase));
|
395 | let activeRef = React__namespace.useRef(false);
|
396 | React__namespace.useEffect(() => {
|
397 | activeRef.current = true;
|
398 | });
|
399 | let navigate = React__namespace.useCallback(function (to, options) {
|
400 | if (options === void 0) {
|
401 | options = {};
|
402 | }
|
403 |
|
404 | router.warning(activeRef.current, "You should call navigate() in a React.useEffect(), not when " + "your component is first rendered.") ;
|
405 | if (!activeRef.current) return;
|
406 |
|
407 | if (typeof to === "number") {
|
408 | navigator.go(to);
|
409 | return;
|
410 | }
|
411 |
|
412 | let path = router.resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, options.relative === "path");
|
413 |
|
414 |
|
415 |
|
416 |
|
417 | if (basename !== "/") {
|
418 | path.pathname = path.pathname === "/" ? basename : router.joinPaths([basename, path.pathname]);
|
419 | }
|
420 |
|
421 | (!!options.replace ? navigator.replace : navigator.push)(path, options.state, options);
|
422 | }, [basename, navigator, routePathnamesJson, locationPathname]);
|
423 | return navigate;
|
424 | }
|
425 | const OutletContext = React__namespace.createContext(null);
|
426 | |
427 |
|
428 |
|
429 |
|
430 |
|
431 |
|
432 | function useOutletContext() {
|
433 | return React__namespace.useContext(OutletContext);
|
434 | }
|
435 | |
436 |
|
437 |
|
438 |
|
439 |
|
440 |
|
441 |
|
442 | function useOutlet(context) {
|
443 | let outlet = React__namespace.useContext(RouteContext).outlet;
|
444 |
|
445 | if (outlet) {
|
446 | return React__namespace.createElement(OutletContext.Provider, {
|
447 | value: context
|
448 | }, outlet);
|
449 | }
|
450 |
|
451 | return outlet;
|
452 | }
|
453 | |
454 |
|
455 |
|
456 |
|
457 |
|
458 |
|
459 |
|
460 | function useParams() {
|
461 | let {
|
462 | matches
|
463 | } = React__namespace.useContext(RouteContext);
|
464 | let routeMatch = matches[matches.length - 1];
|
465 | return routeMatch ? routeMatch.params : {};
|
466 | }
|
467 | |
468 |
|
469 |
|
470 |
|
471 |
|
472 |
|
473 | function useResolvedPath(to, _temp2) {
|
474 | let {
|
475 | relative
|
476 | } = _temp2 === void 0 ? {} : _temp2;
|
477 | let {
|
478 | matches
|
479 | } = React__namespace.useContext(RouteContext);
|
480 | let {
|
481 | pathname: locationPathname
|
482 | } = useLocation();
|
483 | let routePathnamesJson = JSON.stringify(router.UNSAFE_getPathContributingMatches(matches).map(match => match.pathnameBase));
|
484 | return React__namespace.useMemo(() => router.resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, relative === "path"), [to, routePathnamesJson, locationPathname, relative]);
|
485 | }
|
486 | |
487 |
|
488 |
|
489 |
|
490 |
|
491 |
|
492 |
|
493 |
|
494 |
|
495 | function useRoutes(routes, locationArg) {
|
496 | !useInRouterContext() ? router.invariant(false,
|
497 |
|
498 | "useRoutes() may be used only in the context of a <Router> component.") : void 0;
|
499 | let {
|
500 | navigator
|
501 | } = React__namespace.useContext(NavigationContext);
|
502 | let dataRouterStateContext = React__namespace.useContext(DataRouterStateContext);
|
503 | let {
|
504 | matches: parentMatches
|
505 | } = React__namespace.useContext(RouteContext);
|
506 | let routeMatch = parentMatches[parentMatches.length - 1];
|
507 | let parentParams = routeMatch ? routeMatch.params : {};
|
508 | let parentPathname = routeMatch ? routeMatch.pathname : "/";
|
509 | let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : "/";
|
510 | let parentRoute = routeMatch && routeMatch.route;
|
511 |
|
512 | {
|
513 |
|
514 |
|
515 |
|
516 |
|
517 |
|
518 |
|
519 |
|
520 |
|
521 |
|
522 |
|
523 |
|
524 |
|
525 |
|
526 |
|
527 |
|
528 |
|
529 |
|
530 |
|
531 |
|
532 |
|
533 | let parentPath = parentRoute && parentRoute.path || "";
|
534 | 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 + "/*") + "\">."));
|
535 | }
|
536 |
|
537 | let locationFromContext = useLocation();
|
538 | let location;
|
539 |
|
540 | if (locationArg) {
|
541 | var _parsedLocationArg$pa;
|
542 |
|
543 | let parsedLocationArg = typeof locationArg === "string" ? router.parsePath(locationArg) : locationArg;
|
544 | !(parentPathnameBase === "/" || ((_parsedLocationArg$pa = parsedLocationArg.pathname) == null ? void 0 : _parsedLocationArg$pa.startsWith(parentPathnameBase))) ? router.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;
|
545 | location = parsedLocationArg;
|
546 | } else {
|
547 | location = locationFromContext;
|
548 | }
|
549 |
|
550 | let pathname = location.pathname || "/";
|
551 | let remainingPathname = parentPathnameBase === "/" ? pathname : pathname.slice(parentPathnameBase.length) || "/";
|
552 | let matches = router.matchRoutes(routes, {
|
553 | pathname: remainingPathname
|
554 | });
|
555 |
|
556 | {
|
557 | router.warning(parentRoute || matches != null, "No routes matched location \"" + location.pathname + location.search + location.hash + "\" ") ;
|
558 | router.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.") ;
|
559 | }
|
560 |
|
561 | let renderedMatches = _renderMatches(matches && matches.map(match => Object.assign({}, match, {
|
562 | params: Object.assign({}, parentParams, match.params),
|
563 | pathname: router.joinPaths([parentPathnameBase,
|
564 | navigator.encodeLocation ? navigator.encodeLocation(match.pathname).pathname : match.pathname]),
|
565 | pathnameBase: match.pathnameBase === "/" ? parentPathnameBase : router.joinPaths([parentPathnameBase,
|
566 | navigator.encodeLocation ? navigator.encodeLocation(match.pathnameBase).pathname : match.pathnameBase])
|
567 | })), parentMatches, dataRouterStateContext || undefined);
|
568 |
|
569 |
|
570 |
|
571 |
|
572 | if (locationArg && renderedMatches) {
|
573 | return React__namespace.createElement(LocationContext.Provider, {
|
574 | value: {
|
575 | location: _extends({
|
576 | pathname: "/",
|
577 | search: "",
|
578 | hash: "",
|
579 | state: null,
|
580 | key: "default"
|
581 | }, location),
|
582 | navigationType: router.Action.Pop
|
583 | }
|
584 | }, renderedMatches);
|
585 | }
|
586 |
|
587 | return renderedMatches;
|
588 | }
|
589 |
|
590 | function DefaultErrorElement() {
|
591 | let error = useRouteError();
|
592 | let message = router.isRouteErrorResponse(error) ? error.status + " " + error.statusText : error instanceof Error ? error.message : JSON.stringify(error);
|
593 | let stack = error instanceof Error ? error.stack : null;
|
594 | let lightgrey = "rgba(200,200,200, 0.5)";
|
595 | let preStyles = {
|
596 | padding: "0.5rem",
|
597 | backgroundColor: lightgrey
|
598 | };
|
599 | let codeStyles = {
|
600 | padding: "2px 4px",
|
601 | backgroundColor: lightgrey
|
602 | };
|
603 | return React__namespace.createElement(React__namespace.Fragment, null, React__namespace.createElement("h2", null, "Unhandled Thrown Error!"), React__namespace.createElement("h3", {
|
604 | style: {
|
605 | fontStyle: "italic"
|
606 | }
|
607 | }, message), stack ? React__namespace.createElement("pre", {
|
608 | style: preStyles
|
609 | }, stack) : null, React__namespace.createElement("p", null, "\uD83D\uDCBF Hey developer \uD83D\uDC4B"), React__namespace.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own\xA0", React__namespace.createElement("code", {
|
610 | style: codeStyles
|
611 | }, "errorElement"), " props on\xA0", React__namespace.createElement("code", {
|
612 | style: codeStyles
|
613 | }, "<Route>")));
|
614 | }
|
615 |
|
616 | class RenderErrorBoundary extends React__namespace.Component {
|
617 | constructor(props) {
|
618 | super(props);
|
619 | this.state = {
|
620 | location: props.location,
|
621 | error: props.error
|
622 | };
|
623 | }
|
624 |
|
625 | static getDerivedStateFromError(error) {
|
626 | return {
|
627 | error: error
|
628 | };
|
629 | }
|
630 |
|
631 | static getDerivedStateFromProps(props, state) {
|
632 |
|
633 |
|
634 |
|
635 |
|
636 |
|
637 |
|
638 |
|
639 |
|
640 | if (state.location !== props.location) {
|
641 | return {
|
642 | error: props.error,
|
643 | location: props.location
|
644 | };
|
645 | }
|
646 |
|
647 |
|
648 |
|
649 |
|
650 |
|
651 | return {
|
652 | error: props.error || state.error,
|
653 | location: state.location
|
654 | };
|
655 | }
|
656 |
|
657 | componentDidCatch(error, errorInfo) {
|
658 | console.error("React Router caught the following error during render", error, errorInfo);
|
659 | }
|
660 |
|
661 | render() {
|
662 | return this.state.error ? React__namespace.createElement(RouteContext.Provider, {
|
663 | value: this.props.routeContext
|
664 | }, React__namespace.createElement(RouteErrorContext.Provider, {
|
665 | value: this.state.error,
|
666 | children: this.props.component
|
667 | })) : this.props.children;
|
668 | }
|
669 |
|
670 | }
|
671 |
|
672 | function RenderedRoute(_ref) {
|
673 | let {
|
674 | routeContext,
|
675 | match,
|
676 | children
|
677 | } = _ref;
|
678 | let dataRouterContext = React__namespace.useContext(DataRouterContext);
|
679 |
|
680 |
|
681 | if (dataRouterContext && dataRouterContext.static && dataRouterContext.staticContext && match.route.errorElement) {
|
682 | dataRouterContext.staticContext._deepestRenderedBoundaryId = match.route.id;
|
683 | }
|
684 |
|
685 | return React__namespace.createElement(RouteContext.Provider, {
|
686 | value: routeContext
|
687 | }, children);
|
688 | }
|
689 |
|
690 | function _renderMatches(matches, parentMatches, dataRouterState) {
|
691 | if (parentMatches === void 0) {
|
692 | parentMatches = [];
|
693 | }
|
694 |
|
695 | if (matches == null) {
|
696 | if (dataRouterState != null && dataRouterState.errors) {
|
697 |
|
698 |
|
699 | matches = dataRouterState.matches;
|
700 | } else {
|
701 | return null;
|
702 | }
|
703 | }
|
704 |
|
705 | let renderedMatches = matches;
|
706 |
|
707 | let errors = dataRouterState == null ? void 0 : dataRouterState.errors;
|
708 |
|
709 | if (errors != null) {
|
710 | let errorIndex = renderedMatches.findIndex(m => m.route.id && (errors == null ? void 0 : errors[m.route.id]));
|
711 | !(errorIndex >= 0) ? router.invariant(false, "Could not find a matching route for the current errors: " + errors) : void 0;
|
712 | renderedMatches = renderedMatches.slice(0, Math.min(renderedMatches.length, errorIndex + 1));
|
713 | }
|
714 |
|
715 | return renderedMatches.reduceRight((outlet, match, index) => {
|
716 | let error = match.route.id ? errors == null ? void 0 : errors[match.route.id] : null;
|
717 |
|
718 | let errorElement = dataRouterState ? match.route.errorElement || React__namespace.createElement(DefaultErrorElement, null) : null;
|
719 | let matches = parentMatches.concat(renderedMatches.slice(0, index + 1));
|
720 |
|
721 | let getChildren = () => React__namespace.createElement(RenderedRoute, {
|
722 | match: match,
|
723 | routeContext: {
|
724 | outlet,
|
725 | matches
|
726 | }
|
727 | }, error ? errorElement : match.route.element !== undefined ? match.route.element : outlet);
|
728 |
|
729 |
|
730 |
|
731 |
|
732 | return dataRouterState && (match.route.errorElement || index === 0) ? React__namespace.createElement(RenderErrorBoundary, {
|
733 | location: dataRouterState.location,
|
734 | component: errorElement,
|
735 | error: error,
|
736 | children: getChildren(),
|
737 | routeContext: {
|
738 | outlet: null,
|
739 | matches
|
740 | }
|
741 | }) : getChildren();
|
742 | }, null);
|
743 | }
|
744 | var DataRouterHook;
|
745 |
|
746 | (function (DataRouterHook) {
|
747 | DataRouterHook["UseBlocker"] = "useBlocker";
|
748 | DataRouterHook["UseRevalidator"] = "useRevalidator";
|
749 | })(DataRouterHook || (DataRouterHook = {}));
|
750 |
|
751 | var DataRouterStateHook;
|
752 |
|
753 | (function (DataRouterStateHook) {
|
754 | DataRouterStateHook["UseLoaderData"] = "useLoaderData";
|
755 | DataRouterStateHook["UseActionData"] = "useActionData";
|
756 | DataRouterStateHook["UseRouteError"] = "useRouteError";
|
757 | DataRouterStateHook["UseNavigation"] = "useNavigation";
|
758 | DataRouterStateHook["UseRouteLoaderData"] = "useRouteLoaderData";
|
759 | DataRouterStateHook["UseMatches"] = "useMatches";
|
760 | DataRouterStateHook["UseRevalidator"] = "useRevalidator";
|
761 | })(DataRouterStateHook || (DataRouterStateHook = {}));
|
762 |
|
763 | function getDataRouterConsoleError(hookName) {
|
764 | return hookName + " must be used within a data router. See https://reactrouter.com/routers/picking-a-router.";
|
765 | }
|
766 |
|
767 | function useDataRouterContext(hookName) {
|
768 | let ctx = React__namespace.useContext(DataRouterContext);
|
769 | !ctx ? router.invariant(false, getDataRouterConsoleError(hookName)) : void 0;
|
770 | return ctx;
|
771 | }
|
772 |
|
773 | function useDataRouterState(hookName) {
|
774 | let state = React__namespace.useContext(DataRouterStateContext);
|
775 | !state ? router.invariant(false, getDataRouterConsoleError(hookName)) : void 0;
|
776 | return state;
|
777 | }
|
778 |
|
779 | function useRouteContext(hookName) {
|
780 | let route = React__namespace.useContext(RouteContext);
|
781 | !route ? router.invariant(false, getDataRouterConsoleError(hookName)) : void 0;
|
782 | return route;
|
783 | }
|
784 |
|
785 | function useCurrentRouteId(hookName) {
|
786 | let route = useRouteContext(hookName);
|
787 | let thisRoute = route.matches[route.matches.length - 1];
|
788 | !thisRoute.route.id ? router.invariant(false, hookName + " can only be used on routes that contain a unique \"id\"") : void 0;
|
789 | return thisRoute.route.id;
|
790 | }
|
791 | |
792 |
|
793 |
|
794 |
|
795 |
|
796 |
|
797 | function useNavigation() {
|
798 | let state = useDataRouterState(DataRouterStateHook.UseNavigation);
|
799 | return state.navigation;
|
800 | }
|
801 | |
802 |
|
803 |
|
804 |
|
805 |
|
806 | function useRevalidator() {
|
807 | let dataRouterContext = useDataRouterContext(DataRouterHook.UseRevalidator);
|
808 | let state = useDataRouterState(DataRouterStateHook.UseRevalidator);
|
809 | return {
|
810 | revalidate: dataRouterContext.router.revalidate,
|
811 | state: state.revalidation
|
812 | };
|
813 | }
|
814 | |
815 |
|
816 |
|
817 |
|
818 |
|
819 | function useMatches() {
|
820 | let {
|
821 | matches,
|
822 | loaderData
|
823 | } = useDataRouterState(DataRouterStateHook.UseMatches);
|
824 | return React__namespace.useMemo(() => matches.map(match => {
|
825 | let {
|
826 | pathname,
|
827 | params
|
828 | } = match;
|
829 |
|
830 |
|
831 |
|
832 | return {
|
833 | id: match.route.id,
|
834 | pathname,
|
835 | params,
|
836 | data: loaderData[match.route.id],
|
837 | handle: match.route.handle
|
838 | };
|
839 | }), [matches, loaderData]);
|
840 | }
|
841 | |
842 |
|
843 |
|
844 |
|
845 | function useLoaderData() {
|
846 | let state = useDataRouterState(DataRouterStateHook.UseLoaderData);
|
847 | let routeId = useCurrentRouteId(DataRouterStateHook.UseLoaderData);
|
848 |
|
849 | if (state.errors && state.errors[routeId] != null) {
|
850 | console.error("You cannot `useLoaderData` in an errorElement (routeId: " + routeId + ")");
|
851 | return undefined;
|
852 | }
|
853 |
|
854 | return state.loaderData[routeId];
|
855 | }
|
856 | |
857 |
|
858 |
|
859 |
|
860 | function useRouteLoaderData(routeId) {
|
861 | let state = useDataRouterState(DataRouterStateHook.UseRouteLoaderData);
|
862 | return state.loaderData[routeId];
|
863 | }
|
864 | |
865 |
|
866 |
|
867 |
|
868 | function useActionData() {
|
869 | let state = useDataRouterState(DataRouterStateHook.UseActionData);
|
870 | let route = React__namespace.useContext(RouteContext);
|
871 | !route ? router.invariant(false, "useActionData must be used inside a RouteContext") : void 0;
|
872 | return Object.values((state == null ? void 0 : state.actionData) || {})[0];
|
873 | }
|
874 | |
875 |
|
876 |
|
877 |
|
878 |
|
879 |
|
880 | function useRouteError() {
|
881 | var _state$errors;
|
882 |
|
883 | let error = React__namespace.useContext(RouteErrorContext);
|
884 | let state = useDataRouterState(DataRouterStateHook.UseRouteError);
|
885 | let routeId = useCurrentRouteId(DataRouterStateHook.UseRouteError);
|
886 |
|
887 |
|
888 | if (error) {
|
889 | return error;
|
890 | }
|
891 |
|
892 |
|
893 | return (_state$errors = state.errors) == null ? void 0 : _state$errors[routeId];
|
894 | }
|
895 | |
896 |
|
897 |
|
898 |
|
899 | function useAsyncValue() {
|
900 | let value = React__namespace.useContext(AwaitContext);
|
901 | return value == null ? void 0 : value._data;
|
902 | }
|
903 | |
904 |
|
905 |
|
906 |
|
907 | function useAsyncError() {
|
908 | let value = React__namespace.useContext(AwaitContext);
|
909 | return value == null ? void 0 : value._error;
|
910 | }
|
911 |
|
912 |
|
913 | let blockerKey = "blocker-singleton";
|
914 | |
915 |
|
916 |
|
917 |
|
918 |
|
919 |
|
920 |
|
921 | function useBlocker(shouldBlock) {
|
922 | let {
|
923 | router
|
924 | } = useDataRouterContext(DataRouterHook.UseBlocker);
|
925 | let blockerFunction = React__namespace.useCallback(args => {
|
926 | return typeof shouldBlock === "function" ? !!shouldBlock(args) : !!shouldBlock;
|
927 | }, [shouldBlock]);
|
928 | let blocker = router.getBlocker(blockerKey, blockerFunction);
|
929 |
|
930 | React__namespace.useEffect(() => () => router.deleteBlocker(blockerKey), [router]);
|
931 | return blocker;
|
932 | }
|
933 | const alreadyWarned = {};
|
934 |
|
935 | function warningOnce(key, cond, message) {
|
936 | if (!cond && !alreadyWarned[key]) {
|
937 | alreadyWarned[key] = true;
|
938 | router.warning(false, message) ;
|
939 | }
|
940 | }
|
941 |
|
942 | |
943 |
|
944 |
|
945 | function RouterProvider(_ref) {
|
946 | let {
|
947 | fallbackElement,
|
948 | router
|
949 | } = _ref;
|
950 |
|
951 | let state = useSyncExternalStore(router.subscribe, () => router.state,
|
952 |
|
953 |
|
954 | () => router.state);
|
955 | let navigator = React__namespace.useMemo(() => {
|
956 | return {
|
957 | createHref: router.createHref,
|
958 | encodeLocation: router.encodeLocation,
|
959 | go: n => router.navigate(n),
|
960 | push: (to, state, opts) => router.navigate(to, {
|
961 | state,
|
962 | preventScrollReset: opts == null ? void 0 : opts.preventScrollReset
|
963 | }),
|
964 | replace: (to, state, opts) => router.navigate(to, {
|
965 | replace: true,
|
966 | state,
|
967 | preventScrollReset: opts == null ? void 0 : opts.preventScrollReset
|
968 | })
|
969 | };
|
970 | }, [router]);
|
971 | let basename = router.basename || "/";
|
972 |
|
973 |
|
974 |
|
975 |
|
976 |
|
977 |
|
978 | return React__namespace.createElement(React__namespace.Fragment, null, React__namespace.createElement(DataRouterContext.Provider, {
|
979 | value: {
|
980 | router,
|
981 | navigator,
|
982 | static: false,
|
983 |
|
984 | basename
|
985 | }
|
986 | }, React__namespace.createElement(DataRouterStateContext.Provider, {
|
987 | value: state
|
988 | }, React__namespace.createElement(Router, {
|
989 | basename: router.basename,
|
990 | location: router.state.location,
|
991 | navigationType: router.state.historyAction,
|
992 | navigator: navigator
|
993 | }, router.state.initialized ? React__namespace.createElement(Routes, null) : fallbackElement))), null);
|
994 | }
|
995 |
|
996 | |
997 |
|
998 |
|
999 |
|
1000 |
|
1001 | function MemoryRouter(_ref2) {
|
1002 | let {
|
1003 | basename,
|
1004 | children,
|
1005 | initialEntries,
|
1006 | initialIndex
|
1007 | } = _ref2;
|
1008 | let historyRef = React__namespace.useRef();
|
1009 |
|
1010 | if (historyRef.current == null) {
|
1011 | historyRef.current = router.createMemoryHistory({
|
1012 | initialEntries,
|
1013 | initialIndex,
|
1014 | v5Compat: true
|
1015 | });
|
1016 | }
|
1017 |
|
1018 | let history = historyRef.current;
|
1019 | let [state, setState] = React__namespace.useState({
|
1020 | action: history.action,
|
1021 | location: history.location
|
1022 | });
|
1023 | React__namespace.useLayoutEffect(() => history.listen(setState), [history]);
|
1024 | return React__namespace.createElement(Router, {
|
1025 | basename: basename,
|
1026 | children: children,
|
1027 | location: state.location,
|
1028 | navigationType: state.action,
|
1029 | navigator: history
|
1030 | });
|
1031 | }
|
1032 |
|
1033 | |
1034 |
|
1035 |
|
1036 |
|
1037 |
|
1038 |
|
1039 |
|
1040 |
|
1041 |
|
1042 | function Navigate(_ref3) {
|
1043 | let {
|
1044 | to,
|
1045 | replace,
|
1046 | state,
|
1047 | relative
|
1048 | } = _ref3;
|
1049 | !useInRouterContext() ? router.invariant(false,
|
1050 |
|
1051 | "<Navigate> may be used only in the context of a <Router> component.") : void 0;
|
1052 | router.warning(!React__namespace.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.") ;
|
1053 | let dataRouterState = React__namespace.useContext(DataRouterStateContext);
|
1054 | let navigate = useNavigate();
|
1055 | React__namespace.useEffect(() => {
|
1056 |
|
1057 |
|
1058 |
|
1059 | if (dataRouterState && dataRouterState.navigation.state !== "idle") {
|
1060 | return;
|
1061 | }
|
1062 |
|
1063 | navigate(to, {
|
1064 | replace,
|
1065 | state,
|
1066 | relative
|
1067 | });
|
1068 | });
|
1069 | return null;
|
1070 | }
|
1071 |
|
1072 | |
1073 |
|
1074 |
|
1075 |
|
1076 |
|
1077 | function Outlet(props) {
|
1078 | return useOutlet(props.context);
|
1079 | }
|
1080 |
|
1081 | |
1082 |
|
1083 |
|
1084 |
|
1085 |
|
1086 | function Route(_props) {
|
1087 | router.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>.") ;
|
1088 | }
|
1089 |
|
1090 | |
1091 |
|
1092 |
|
1093 |
|
1094 |
|
1095 |
|
1096 |
|
1097 |
|
1098 |
|
1099 | function Router(_ref4) {
|
1100 | let {
|
1101 | basename: basenameProp = "/",
|
1102 | children = null,
|
1103 | location: locationProp,
|
1104 | navigationType = router.Action.Pop,
|
1105 | navigator,
|
1106 | static: staticProp = false
|
1107 | } = _ref4;
|
1108 | !!useInRouterContext() ? router.invariant(false, "You cannot render a <Router> inside another <Router>." + " You should never have more than one in your app.") : void 0;
|
1109 |
|
1110 |
|
1111 | let basename = basenameProp.replace(/^\/*/, "/");
|
1112 | let navigationContext = React__namespace.useMemo(() => ({
|
1113 | basename,
|
1114 | navigator,
|
1115 | static: staticProp
|
1116 | }), [basename, navigator, staticProp]);
|
1117 |
|
1118 | if (typeof locationProp === "string") {
|
1119 | locationProp = router.parsePath(locationProp);
|
1120 | }
|
1121 |
|
1122 | let {
|
1123 | pathname = "/",
|
1124 | search = "",
|
1125 | hash = "",
|
1126 | state = null,
|
1127 | key = "default"
|
1128 | } = locationProp;
|
1129 | let location = React__namespace.useMemo(() => {
|
1130 | let trailingPathname = router.stripBasename(pathname, basename);
|
1131 |
|
1132 | if (trailingPathname == null) {
|
1133 | return null;
|
1134 | }
|
1135 |
|
1136 | return {
|
1137 | pathname: trailingPathname,
|
1138 | search,
|
1139 | hash,
|
1140 | state,
|
1141 | key
|
1142 | };
|
1143 | }, [basename, pathname, search, hash, state, key]);
|
1144 | router.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.") ;
|
1145 |
|
1146 | if (location == null) {
|
1147 | return null;
|
1148 | }
|
1149 |
|
1150 | return React__namespace.createElement(NavigationContext.Provider, {
|
1151 | value: navigationContext
|
1152 | }, React__namespace.createElement(LocationContext.Provider, {
|
1153 | children: children,
|
1154 | value: {
|
1155 | location,
|
1156 | navigationType
|
1157 | }
|
1158 | }));
|
1159 | }
|
1160 |
|
1161 | |
1162 |
|
1163 |
|
1164 |
|
1165 |
|
1166 |
|
1167 | function Routes(_ref5) {
|
1168 | let {
|
1169 | children,
|
1170 | location
|
1171 | } = _ref5;
|
1172 | let dataRouterContext = React__namespace.useContext(DataRouterContext);
|
1173 |
|
1174 |
|
1175 |
|
1176 | let routes = dataRouterContext && !children ? dataRouterContext.router.routes : createRoutesFromChildren(children);
|
1177 | return useRoutes(routes, location);
|
1178 | }
|
1179 |
|
1180 | |
1181 |
|
1182 |
|
1183 |
|
1184 | function Await(_ref6) {
|
1185 | let {
|
1186 | children,
|
1187 | errorElement,
|
1188 | resolve
|
1189 | } = _ref6;
|
1190 | return React__namespace.createElement(AwaitErrorBoundary, {
|
1191 | resolve: resolve,
|
1192 | errorElement: errorElement
|
1193 | }, React__namespace.createElement(ResolveAwait, null, children));
|
1194 | }
|
1195 | var AwaitRenderStatus;
|
1196 |
|
1197 | (function (AwaitRenderStatus) {
|
1198 | AwaitRenderStatus[AwaitRenderStatus["pending"] = 0] = "pending";
|
1199 | AwaitRenderStatus[AwaitRenderStatus["success"] = 1] = "success";
|
1200 | AwaitRenderStatus[AwaitRenderStatus["error"] = 2] = "error";
|
1201 | })(AwaitRenderStatus || (AwaitRenderStatus = {}));
|
1202 |
|
1203 | const neverSettledPromise = new Promise(() => {});
|
1204 |
|
1205 | class AwaitErrorBoundary extends React__namespace.Component {
|
1206 | constructor(props) {
|
1207 | super(props);
|
1208 | this.state = {
|
1209 | error: null
|
1210 | };
|
1211 | }
|
1212 |
|
1213 | static getDerivedStateFromError(error) {
|
1214 | return {
|
1215 | error
|
1216 | };
|
1217 | }
|
1218 |
|
1219 | componentDidCatch(error, errorInfo) {
|
1220 | console.error("<Await> caught the following error during render", error, errorInfo);
|
1221 | }
|
1222 |
|
1223 | render() {
|
1224 | let {
|
1225 | children,
|
1226 | errorElement,
|
1227 | resolve
|
1228 | } = this.props;
|
1229 | let promise = null;
|
1230 | let status = AwaitRenderStatus.pending;
|
1231 |
|
1232 | if (!(resolve instanceof Promise)) {
|
1233 |
|
1234 | status = AwaitRenderStatus.success;
|
1235 | promise = Promise.resolve();
|
1236 | Object.defineProperty(promise, "_tracked", {
|
1237 | get: () => true
|
1238 | });
|
1239 | Object.defineProperty(promise, "_data", {
|
1240 | get: () => resolve
|
1241 | });
|
1242 | } else if (this.state.error) {
|
1243 |
|
1244 | status = AwaitRenderStatus.error;
|
1245 | let renderError = this.state.error;
|
1246 | promise = Promise.reject().catch(() => {});
|
1247 |
|
1248 | Object.defineProperty(promise, "_tracked", {
|
1249 | get: () => true
|
1250 | });
|
1251 | Object.defineProperty(promise, "_error", {
|
1252 | get: () => renderError
|
1253 | });
|
1254 | } else if (resolve._tracked) {
|
1255 |
|
1256 | promise = resolve;
|
1257 | status = promise._error !== undefined ? AwaitRenderStatus.error : promise._data !== undefined ? AwaitRenderStatus.success : AwaitRenderStatus.pending;
|
1258 | } else {
|
1259 |
|
1260 | status = AwaitRenderStatus.pending;
|
1261 | Object.defineProperty(resolve, "_tracked", {
|
1262 | get: () => true
|
1263 | });
|
1264 | promise = resolve.then(data => Object.defineProperty(resolve, "_data", {
|
1265 | get: () => data
|
1266 | }), error => Object.defineProperty(resolve, "_error", {
|
1267 | get: () => error
|
1268 | }));
|
1269 | }
|
1270 |
|
1271 | if (status === AwaitRenderStatus.error && promise._error instanceof router.AbortedDeferredError) {
|
1272 |
|
1273 | throw neverSettledPromise;
|
1274 | }
|
1275 |
|
1276 | if (status === AwaitRenderStatus.error && !errorElement) {
|
1277 |
|
1278 | throw promise._error;
|
1279 | }
|
1280 |
|
1281 | if (status === AwaitRenderStatus.error) {
|
1282 |
|
1283 | return React__namespace.createElement(AwaitContext.Provider, {
|
1284 | value: promise,
|
1285 | children: errorElement
|
1286 | });
|
1287 | }
|
1288 |
|
1289 | if (status === AwaitRenderStatus.success) {
|
1290 |
|
1291 | return React__namespace.createElement(AwaitContext.Provider, {
|
1292 | value: promise,
|
1293 | children: children
|
1294 | });
|
1295 | }
|
1296 |
|
1297 |
|
1298 | throw promise;
|
1299 | }
|
1300 |
|
1301 | }
|
1302 | |
1303 |
|
1304 |
|
1305 |
|
1306 |
|
1307 |
|
1308 | function ResolveAwait(_ref7) {
|
1309 | let {
|
1310 | children
|
1311 | } = _ref7;
|
1312 | let data = useAsyncValue();
|
1313 | let toRender = typeof children === "function" ? children(data) : children;
|
1314 | return React__namespace.createElement(React__namespace.Fragment, null, toRender);
|
1315 | }
|
1316 |
|
1317 |
|
1318 |
|
1319 | |
1320 |
|
1321 |
|
1322 |
|
1323 |
|
1324 |
|
1325 |
|
1326 |
|
1327 |
|
1328 | function createRoutesFromChildren(children, parentPath) {
|
1329 | if (parentPath === void 0) {
|
1330 | parentPath = [];
|
1331 | }
|
1332 |
|
1333 | let routes = [];
|
1334 | React__namespace.Children.forEach(children, (element, index) => {
|
1335 | if (! React__namespace.isValidElement(element)) {
|
1336 |
|
1337 |
|
1338 | return;
|
1339 | }
|
1340 |
|
1341 | if (element.type === React__namespace.Fragment) {
|
1342 |
|
1343 | routes.push.apply(routes, createRoutesFromChildren(element.props.children, parentPath));
|
1344 | return;
|
1345 | }
|
1346 |
|
1347 | !(element.type === Route) ? router.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;
|
1348 | !(!element.props.index || !element.props.children) ? router.invariant(false, "An index route cannot have child routes.") : void 0;
|
1349 | let treePath = [...parentPath, index];
|
1350 | let route = {
|
1351 | id: element.props.id || treePath.join("-"),
|
1352 | caseSensitive: element.props.caseSensitive,
|
1353 | element: element.props.element,
|
1354 | index: element.props.index,
|
1355 | path: element.props.path,
|
1356 | loader: element.props.loader,
|
1357 | action: element.props.action,
|
1358 | errorElement: element.props.errorElement,
|
1359 | hasErrorBoundary: element.props.errorElement != null,
|
1360 | shouldRevalidate: element.props.shouldRevalidate,
|
1361 | handle: element.props.handle
|
1362 | };
|
1363 |
|
1364 | if (element.props.children) {
|
1365 | route.children = createRoutesFromChildren(element.props.children, treePath);
|
1366 | }
|
1367 |
|
1368 | routes.push(route);
|
1369 | });
|
1370 | return routes;
|
1371 | }
|
1372 | |
1373 |
|
1374 |
|
1375 |
|
1376 | function renderMatches(matches) {
|
1377 | return _renderMatches(matches);
|
1378 | }
|
1379 | |
1380 |
|
1381 |
|
1382 |
|
1383 |
|
1384 |
|
1385 | function enhanceManualRouteObjects(routes) {
|
1386 | return routes.map(route => {
|
1387 | let routeClone = _extends({}, route);
|
1388 |
|
1389 | if (routeClone.hasErrorBoundary == null) {
|
1390 | routeClone.hasErrorBoundary = routeClone.errorElement != null;
|
1391 | }
|
1392 |
|
1393 | if (routeClone.children) {
|
1394 | routeClone.children = enhanceManualRouteObjects(routeClone.children);
|
1395 | }
|
1396 |
|
1397 | return routeClone;
|
1398 | });
|
1399 | }
|
1400 |
|
1401 | function createMemoryRouter(routes, opts) {
|
1402 | return router.createRouter({
|
1403 | basename: opts == null ? void 0 : opts.basename,
|
1404 | history: router.createMemoryHistory({
|
1405 | initialEntries: opts == null ? void 0 : opts.initialEntries,
|
1406 | initialIndex: opts == null ? void 0 : opts.initialIndex
|
1407 | }),
|
1408 | hydrationData: opts == null ? void 0 : opts.hydrationData,
|
1409 | routes: enhanceManualRouteObjects(routes)
|
1410 | }).initialize();
|
1411 | }
|
1412 |
|
1413 | Object.defineProperty(exports, 'AbortedDeferredError', {
|
1414 | enumerable: true,
|
1415 | get: function () { return router.AbortedDeferredError; }
|
1416 | });
|
1417 | Object.defineProperty(exports, 'NavigationType', {
|
1418 | enumerable: true,
|
1419 | get: function () { return router.Action; }
|
1420 | });
|
1421 | Object.defineProperty(exports, 'createPath', {
|
1422 | enumerable: true,
|
1423 | get: function () { return router.createPath; }
|
1424 | });
|
1425 | Object.defineProperty(exports, 'defer', {
|
1426 | enumerable: true,
|
1427 | get: function () { return router.defer; }
|
1428 | });
|
1429 | Object.defineProperty(exports, 'generatePath', {
|
1430 | enumerable: true,
|
1431 | get: function () { return router.generatePath; }
|
1432 | });
|
1433 | Object.defineProperty(exports, 'isRouteErrorResponse', {
|
1434 | enumerable: true,
|
1435 | get: function () { return router.isRouteErrorResponse; }
|
1436 | });
|
1437 | Object.defineProperty(exports, 'json', {
|
1438 | enumerable: true,
|
1439 | get: function () { return router.json; }
|
1440 | });
|
1441 | Object.defineProperty(exports, 'matchPath', {
|
1442 | enumerable: true,
|
1443 | get: function () { return router.matchPath; }
|
1444 | });
|
1445 | Object.defineProperty(exports, 'matchRoutes', {
|
1446 | enumerable: true,
|
1447 | get: function () { return router.matchRoutes; }
|
1448 | });
|
1449 | Object.defineProperty(exports, 'parsePath', {
|
1450 | enumerable: true,
|
1451 | get: function () { return router.parsePath; }
|
1452 | });
|
1453 | Object.defineProperty(exports, 'redirect', {
|
1454 | enumerable: true,
|
1455 | get: function () { return router.redirect; }
|
1456 | });
|
1457 | Object.defineProperty(exports, 'resolvePath', {
|
1458 | enumerable: true,
|
1459 | get: function () { return router.resolvePath; }
|
1460 | });
|
1461 | exports.Await = Await;
|
1462 | exports.MemoryRouter = MemoryRouter;
|
1463 | exports.Navigate = Navigate;
|
1464 | exports.Outlet = Outlet;
|
1465 | exports.Route = Route;
|
1466 | exports.Router = Router;
|
1467 | exports.RouterProvider = RouterProvider;
|
1468 | exports.Routes = Routes;
|
1469 | exports.UNSAFE_DataRouterContext = DataRouterContext;
|
1470 | exports.UNSAFE_DataRouterStateContext = DataRouterStateContext;
|
1471 | exports.UNSAFE_LocationContext = LocationContext;
|
1472 | exports.UNSAFE_NavigationContext = NavigationContext;
|
1473 | exports.UNSAFE_RouteContext = RouteContext;
|
1474 | exports.UNSAFE_enhanceManualRouteObjects = enhanceManualRouteObjects;
|
1475 | exports.createMemoryRouter = createMemoryRouter;
|
1476 | exports.createRoutesFromChildren = createRoutesFromChildren;
|
1477 | exports.createRoutesFromElements = createRoutesFromChildren;
|
1478 | exports.renderMatches = renderMatches;
|
1479 | exports.unstable_useBlocker = useBlocker;
|
1480 | exports.useActionData = useActionData;
|
1481 | exports.useAsyncError = useAsyncError;
|
1482 | exports.useAsyncValue = useAsyncValue;
|
1483 | exports.useHref = useHref;
|
1484 | exports.useInRouterContext = useInRouterContext;
|
1485 | exports.useLoaderData = useLoaderData;
|
1486 | exports.useLocation = useLocation;
|
1487 | exports.useMatch = useMatch;
|
1488 | exports.useMatches = useMatches;
|
1489 | exports.useNavigate = useNavigate;
|
1490 | exports.useNavigation = useNavigation;
|
1491 | exports.useNavigationType = useNavigationType;
|
1492 | exports.useOutlet = useOutlet;
|
1493 | exports.useOutletContext = useOutletContext;
|
1494 | exports.useParams = useParams;
|
1495 | exports.useResolvedPath = useResolvedPath;
|
1496 | exports.useRevalidator = useRevalidator;
|
1497 | exports.useRouteError = useRouteError;
|
1498 | exports.useRouteLoaderData = useRouteLoaderData;
|
1499 | exports.useRoutes = useRoutes;
|
1500 |
|
1501 | Object.defineProperty(exports, '__esModule', { value: true });
|
1502 |
|
1503 | }));
|
1504 |
|