react-router-dom 6.26.2 → 7.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,1821 +0,0 @@
1
- /**
2
- * React Router DOM v6.26.2
3
- *
4
- * Copyright (c) Remix Software Inc.
5
- *
6
- * This source code is licensed under the MIT license found in the
7
- * LICENSE.md file in the root directory of this source tree.
8
- *
9
- * @license MIT
10
- */
11
- (function (global, factory) {
12
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('react-dom'), require('react-router'), require('@remix-run/router')) :
13
- typeof define === 'function' && define.amd ? define(['exports', 'react', 'react-dom', 'react-router', '@remix-run/router'], factory) :
14
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ReactRouterDOM = {}, global.React, global.ReactDOM, global.ReactRouter, global.RemixRouter));
15
- })(this, (function (exports, React, ReactDOM, reactRouter, router) { 'use strict';
16
-
17
- function _interopNamespace(e) {
18
- if (e && e.__esModule) return e;
19
- var n = Object.create(null);
20
- if (e) {
21
- Object.keys(e).forEach(function (k) {
22
- if (k !== 'default') {
23
- var d = Object.getOwnPropertyDescriptor(e, k);
24
- Object.defineProperty(n, k, d.get ? d : {
25
- enumerable: true,
26
- get: function () { return e[k]; }
27
- });
28
- }
29
- });
30
- }
31
- n["default"] = e;
32
- return Object.freeze(n);
33
- }
34
-
35
- var React__namespace = /*#__PURE__*/_interopNamespace(React);
36
- var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
37
-
38
- function _extends() {
39
- _extends = Object.assign ? Object.assign.bind() : function (target) {
40
- for (var i = 1; i < arguments.length; i++) {
41
- var source = arguments[i];
42
- for (var key in source) {
43
- if (Object.prototype.hasOwnProperty.call(source, key)) {
44
- target[key] = source[key];
45
- }
46
- }
47
- }
48
- return target;
49
- };
50
- return _extends.apply(this, arguments);
51
- }
52
- function _objectWithoutPropertiesLoose(source, excluded) {
53
- if (source == null) return {};
54
- var target = {};
55
- var sourceKeys = Object.keys(source);
56
- var key, i;
57
- for (i = 0; i < sourceKeys.length; i++) {
58
- key = sourceKeys[i];
59
- if (excluded.indexOf(key) >= 0) continue;
60
- target[key] = source[key];
61
- }
62
- return target;
63
- }
64
-
65
- const defaultMethod = "get";
66
- const defaultEncType = "application/x-www-form-urlencoded";
67
- function isHtmlElement(object) {
68
- return object != null && typeof object.tagName === "string";
69
- }
70
- function isButtonElement(object) {
71
- return isHtmlElement(object) && object.tagName.toLowerCase() === "button";
72
- }
73
- function isFormElement(object) {
74
- return isHtmlElement(object) && object.tagName.toLowerCase() === "form";
75
- }
76
- function isInputElement(object) {
77
- return isHtmlElement(object) && object.tagName.toLowerCase() === "input";
78
- }
79
- function isModifiedEvent(event) {
80
- return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
81
- }
82
- function shouldProcessLinkClick(event, target) {
83
- return event.button === 0 && (
84
- // Ignore everything but left clicks
85
- !target || target === "_self") &&
86
- // Let browser handle "target=_blank" etc.
87
- !isModifiedEvent(event) // Ignore clicks with modifier keys
88
- ;
89
- }
90
-
91
- /**
92
- * Creates a URLSearchParams object using the given initializer.
93
- *
94
- * This is identical to `new URLSearchParams(init)` except it also
95
- * supports arrays as values in the object form of the initializer
96
- * instead of just strings. This is convenient when you need multiple
97
- * values for a given key, but don't want to use an array initializer.
98
- *
99
- * For example, instead of:
100
- *
101
- * let searchParams = new URLSearchParams([
102
- * ['sort', 'name'],
103
- * ['sort', 'price']
104
- * ]);
105
- *
106
- * you can do:
107
- *
108
- * let searchParams = createSearchParams({
109
- * sort: ['name', 'price']
110
- * });
111
- */
112
- function createSearchParams(init) {
113
- if (init === void 0) {
114
- init = "";
115
- }
116
- return new URLSearchParams(typeof init === "string" || Array.isArray(init) || init instanceof URLSearchParams ? init : Object.keys(init).reduce((memo, key) => {
117
- let value = init[key];
118
- return memo.concat(Array.isArray(value) ? value.map(v => [key, v]) : [[key, value]]);
119
- }, []));
120
- }
121
- function getSearchParamsForLocation(locationSearch, defaultSearchParams) {
122
- let searchParams = createSearchParams(locationSearch);
123
- if (defaultSearchParams) {
124
- // Use `defaultSearchParams.forEach(...)` here instead of iterating of
125
- // `defaultSearchParams.keys()` to work-around a bug in Firefox related to
126
- // web extensions. Relevant Bugzilla tickets:
127
- // https://bugzilla.mozilla.org/show_bug.cgi?id=1414602
128
- // https://bugzilla.mozilla.org/show_bug.cgi?id=1023984
129
- defaultSearchParams.forEach((_, key) => {
130
- if (!searchParams.has(key)) {
131
- defaultSearchParams.getAll(key).forEach(value => {
132
- searchParams.append(key, value);
133
- });
134
- }
135
- });
136
- }
137
- return searchParams;
138
- }
139
-
140
- // Thanks https://github.com/sindresorhus/type-fest!
141
-
142
- // One-time check for submitter support
143
- let _formDataSupportsSubmitter = null;
144
- function isFormDataSubmitterSupported() {
145
- if (_formDataSupportsSubmitter === null) {
146
- try {
147
- new FormData(document.createElement("form"),
148
- // @ts-expect-error if FormData supports the submitter parameter, this will throw
149
- 0);
150
- _formDataSupportsSubmitter = false;
151
- } catch (e) {
152
- _formDataSupportsSubmitter = true;
153
- }
154
- }
155
- return _formDataSupportsSubmitter;
156
- }
157
-
158
- /**
159
- * Submit options shared by both navigations and fetchers
160
- */
161
-
162
- /**
163
- * Submit options available to fetchers
164
- */
165
-
166
- /**
167
- * Submit options available to navigations
168
- */
169
-
170
- const supportedFormEncTypes = new Set(["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"]);
171
- function getFormEncType(encType) {
172
- if (encType != null && !supportedFormEncTypes.has(encType)) {
173
- router.UNSAFE_warning(false, "\"" + encType + "\" is not a valid `encType` for `<Form>`/`<fetcher.Form>` " + ("and will default to \"" + defaultEncType + "\"")) ;
174
- return null;
175
- }
176
- return encType;
177
- }
178
- function getFormSubmissionInfo(target, basename) {
179
- let method;
180
- let action;
181
- let encType;
182
- let formData;
183
- let body;
184
- if (isFormElement(target)) {
185
- // When grabbing the action from the element, it will have had the basename
186
- // prefixed to ensure non-JS scenarios work, so strip it since we'll
187
- // re-prefix in the router
188
- let attr = target.getAttribute("action");
189
- action = attr ? router.stripBasename(attr, basename) : null;
190
- method = target.getAttribute("method") || defaultMethod;
191
- encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType;
192
- formData = new FormData(target);
193
- } else if (isButtonElement(target) || isInputElement(target) && (target.type === "submit" || target.type === "image")) {
194
- let form = target.form;
195
- if (form == null) {
196
- throw new Error("Cannot submit a <button> or <input type=\"submit\"> without a <form>");
197
- }
198
-
199
- // <button>/<input type="submit"> may override attributes of <form>
200
-
201
- // When grabbing the action from the element, it will have had the basename
202
- // prefixed to ensure non-JS scenarios work, so strip it since we'll
203
- // re-prefix in the router
204
- let attr = target.getAttribute("formaction") || form.getAttribute("action");
205
- action = attr ? router.stripBasename(attr, basename) : null;
206
- method = target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod;
207
- encType = getFormEncType(target.getAttribute("formenctype")) || getFormEncType(form.getAttribute("enctype")) || defaultEncType;
208
-
209
- // Build a FormData object populated from a form and submitter
210
- formData = new FormData(form, target);
211
-
212
- // If this browser doesn't support the `FormData(el, submitter)` format,
213
- // then tack on the submitter value at the end. This is a lightweight
214
- // solution that is not 100% spec compliant. For complete support in older
215
- // browsers, consider using the `formdata-submitter-polyfill` package
216
- if (!isFormDataSubmitterSupported()) {
217
- let {
218
- name,
219
- type,
220
- value
221
- } = target;
222
- if (type === "image") {
223
- let prefix = name ? name + "." : "";
224
- formData.append(prefix + "x", "0");
225
- formData.append(prefix + "y", "0");
226
- } else if (name) {
227
- formData.append(name, value);
228
- }
229
- }
230
- } else if (isHtmlElement(target)) {
231
- throw new Error("Cannot submit element that is not <form>, <button>, or " + "<input type=\"submit|image\">");
232
- } else {
233
- method = defaultMethod;
234
- action = null;
235
- encType = defaultEncType;
236
- body = target;
237
- }
238
-
239
- // Send body for <Form encType="text/plain" so we encode it into text
240
- if (formData && encType === "text/plain") {
241
- body = formData;
242
- formData = undefined;
243
- }
244
- return {
245
- action,
246
- method: method.toLowerCase(),
247
- encType,
248
- formData,
249
- body
250
- };
251
- }
252
-
253
- const _excluded = ["onClick", "relative", "reloadDocument", "replace", "state", "target", "to", "preventScrollReset", "unstable_viewTransition"],
254
- _excluded2 = ["aria-current", "caseSensitive", "className", "end", "style", "to", "unstable_viewTransition", "children"],
255
- _excluded3 = ["fetcherKey", "navigate", "reloadDocument", "replace", "state", "method", "action", "onSubmit", "relative", "preventScrollReset", "unstable_viewTransition"];
256
- //#endregion
257
- // HEY YOU! DON'T TOUCH THIS VARIABLE!
258
- //
259
- // It is replaced with the proper version at build time via a babel plugin in
260
- // the rollup config.
261
- //
262
- // Export a global property onto the window for React Router detection by the
263
- // Core Web Vitals Technology Report. This way they can configure the `wappalyzer`
264
- // to detect and properly classify live websites as being built with React Router:
265
- // https://github.com/HTTPArchive/wappalyzer/blob/main/src/technologies/r.json
266
- const REACT_ROUTER_VERSION = "6";
267
- try {
268
- window.__reactRouterVersion = REACT_ROUTER_VERSION;
269
- } catch (e) {
270
- // no-op
271
- }
272
-
273
- ////////////////////////////////////////////////////////////////////////////////
274
- //#region Routers
275
- ////////////////////////////////////////////////////////////////////////////////
276
- function createBrowserRouter(routes, opts) {
277
- return router.createRouter({
278
- basename: opts == null ? void 0 : opts.basename,
279
- future: _extends({}, opts == null ? void 0 : opts.future, {
280
- v7_prependBasename: true
281
- }),
282
- history: router.createBrowserHistory({
283
- window: opts == null ? void 0 : opts.window
284
- }),
285
- hydrationData: (opts == null ? void 0 : opts.hydrationData) || parseHydrationData(),
286
- routes,
287
- mapRouteProperties: reactRouter.UNSAFE_mapRouteProperties,
288
- unstable_dataStrategy: opts == null ? void 0 : opts.unstable_dataStrategy,
289
- unstable_patchRoutesOnNavigation: opts == null ? void 0 : opts.unstable_patchRoutesOnNavigation,
290
- window: opts == null ? void 0 : opts.window
291
- }).initialize();
292
- }
293
- function createHashRouter(routes, opts) {
294
- return router.createRouter({
295
- basename: opts == null ? void 0 : opts.basename,
296
- future: _extends({}, opts == null ? void 0 : opts.future, {
297
- v7_prependBasename: true
298
- }),
299
- history: router.createHashHistory({
300
- window: opts == null ? void 0 : opts.window
301
- }),
302
- hydrationData: (opts == null ? void 0 : opts.hydrationData) || parseHydrationData(),
303
- routes,
304
- mapRouteProperties: reactRouter.UNSAFE_mapRouteProperties,
305
- unstable_dataStrategy: opts == null ? void 0 : opts.unstable_dataStrategy,
306
- unstable_patchRoutesOnNavigation: opts == null ? void 0 : opts.unstable_patchRoutesOnNavigation,
307
- window: opts == null ? void 0 : opts.window
308
- }).initialize();
309
- }
310
- function parseHydrationData() {
311
- var _window;
312
- let state = (_window = window) == null ? void 0 : _window.__staticRouterHydrationData;
313
- if (state && state.errors) {
314
- state = _extends({}, state, {
315
- errors: deserializeErrors(state.errors)
316
- });
317
- }
318
- return state;
319
- }
320
- function deserializeErrors(errors) {
321
- if (!errors) return null;
322
- let entries = Object.entries(errors);
323
- let serialized = {};
324
- for (let [key, val] of entries) {
325
- // Hey you! If you change this, please change the corresponding logic in
326
- // serializeErrors in react-router-dom/server.tsx :)
327
- if (val && val.__type === "RouteErrorResponse") {
328
- serialized[key] = new router.UNSAFE_ErrorResponseImpl(val.status, val.statusText, val.data, val.internal === true);
329
- } else if (val && val.__type === "Error") {
330
- // Attempt to reconstruct the right type of Error (i.e., ReferenceError)
331
- if (val.__subType) {
332
- let ErrorConstructor = window[val.__subType];
333
- if (typeof ErrorConstructor === "function") {
334
- try {
335
- // @ts-expect-error
336
- let error = new ErrorConstructor(val.message);
337
- // Wipe away the client-side stack trace. Nothing to fill it in with
338
- // because we don't serialize SSR stack traces for security reasons
339
- error.stack = "";
340
- serialized[key] = error;
341
- } catch (e) {
342
- // no-op - fall through and create a normal Error
343
- }
344
- }
345
- }
346
- if (serialized[key] == null) {
347
- let error = new Error(val.message);
348
- // Wipe away the client-side stack trace. Nothing to fill it in with
349
- // because we don't serialize SSR stack traces for security reasons
350
- error.stack = "";
351
- serialized[key] = error;
352
- }
353
- } else {
354
- serialized[key] = val;
355
- }
356
- }
357
- return serialized;
358
- }
359
-
360
- //#endregion
361
-
362
- ////////////////////////////////////////////////////////////////////////////////
363
- //#region Contexts
364
- ////////////////////////////////////////////////////////////////////////////////
365
- const ViewTransitionContext = /*#__PURE__*/React__namespace.createContext({
366
- isTransitioning: false
367
- });
368
- {
369
- ViewTransitionContext.displayName = "ViewTransition";
370
- }
371
-
372
- // TODO: (v7) Change the useFetcher data from `any` to `unknown`
373
-
374
- const FetchersContext = /*#__PURE__*/React__namespace.createContext(new Map());
375
- {
376
- FetchersContext.displayName = "Fetchers";
377
- }
378
-
379
- //#endregion
380
-
381
- ////////////////////////////////////////////////////////////////////////////////
382
- //#region Components
383
- ////////////////////////////////////////////////////////////////////////////////
384
-
385
- /**
386
- Webpack + React 17 fails to compile on any of the following because webpack
387
- complains that `startTransition` doesn't exist in `React`:
388
- * import { startTransition } from "react"
389
- * import * as React from from "react";
390
- "startTransition" in React ? React.startTransition(() => setState()) : setState()
391
- * import * as React from from "react";
392
- "startTransition" in React ? React["startTransition"](() => setState()) : setState()
393
-
394
- Moving it to a constant such as the following solves the Webpack/React 17 issue:
395
- * import * as React from from "react";
396
- const START_TRANSITION = "startTransition";
397
- START_TRANSITION in React ? React[START_TRANSITION](() => setState()) : setState()
398
-
399
- However, that introduces webpack/terser minification issues in production builds
400
- in React 18 where minification/obfuscation ends up removing the call of
401
- React.startTransition entirely from the first half of the ternary. Grabbing
402
- this exported reference once up front resolves that issue.
403
-
404
- See https://github.com/remix-run/react-router/issues/10579
405
- */
406
- const START_TRANSITION = "startTransition";
407
- const startTransitionImpl = React__namespace[START_TRANSITION];
408
- const FLUSH_SYNC = "flushSync";
409
- const flushSyncImpl = ReactDOM__namespace[FLUSH_SYNC];
410
- const USE_ID = "useId";
411
- const useIdImpl = React__namespace[USE_ID];
412
- function startTransitionSafe(cb) {
413
- if (startTransitionImpl) {
414
- startTransitionImpl(cb);
415
- } else {
416
- cb();
417
- }
418
- }
419
- function flushSyncSafe(cb) {
420
- if (flushSyncImpl) {
421
- flushSyncImpl(cb);
422
- } else {
423
- cb();
424
- }
425
- }
426
- class Deferred {
427
- // @ts-expect-error - no initializer
428
-
429
- // @ts-expect-error - no initializer
430
-
431
- constructor() {
432
- this.status = "pending";
433
- this.promise = new Promise((resolve, reject) => {
434
- this.resolve = value => {
435
- if (this.status === "pending") {
436
- this.status = "resolved";
437
- resolve(value);
438
- }
439
- };
440
- this.reject = reason => {
441
- if (this.status === "pending") {
442
- this.status = "rejected";
443
- reject(reason);
444
- }
445
- };
446
- });
447
- }
448
- }
449
-
450
- /**
451
- * Given a Remix Router instance, render the appropriate UI
452
- */
453
- function RouterProvider(_ref) {
454
- let {
455
- fallbackElement,
456
- router: router$1,
457
- future
458
- } = _ref;
459
- let [state, setStateImpl] = React__namespace.useState(router$1.state);
460
- let [pendingState, setPendingState] = React__namespace.useState();
461
- let [vtContext, setVtContext] = React__namespace.useState({
462
- isTransitioning: false
463
- });
464
- let [renderDfd, setRenderDfd] = React__namespace.useState();
465
- let [transition, setTransition] = React__namespace.useState();
466
- let [interruption, setInterruption] = React__namespace.useState();
467
- let fetcherData = React__namespace.useRef(new Map());
468
- let {
469
- v7_startTransition
470
- } = future || {};
471
- let optInStartTransition = React__namespace.useCallback(cb => {
472
- if (v7_startTransition) {
473
- startTransitionSafe(cb);
474
- } else {
475
- cb();
476
- }
477
- }, [v7_startTransition]);
478
- let setState = React__namespace.useCallback((newState, _ref2) => {
479
- let {
480
- deletedFetchers,
481
- unstable_flushSync: flushSync,
482
- unstable_viewTransitionOpts: viewTransitionOpts
483
- } = _ref2;
484
- deletedFetchers.forEach(key => fetcherData.current.delete(key));
485
- newState.fetchers.forEach((fetcher, key) => {
486
- if (fetcher.data !== undefined) {
487
- fetcherData.current.set(key, fetcher.data);
488
- }
489
- });
490
- let isViewTransitionUnavailable = router$1.window == null || router$1.window.document == null || typeof router$1.window.document.startViewTransition !== "function";
491
-
492
- // If this isn't a view transition or it's not available in this browser,
493
- // just update and be done with it
494
- if (!viewTransitionOpts || isViewTransitionUnavailable) {
495
- if (flushSync) {
496
- flushSyncSafe(() => setStateImpl(newState));
497
- } else {
498
- optInStartTransition(() => setStateImpl(newState));
499
- }
500
- return;
501
- }
502
-
503
- // flushSync + startViewTransition
504
- if (flushSync) {
505
- // Flush through the context to mark DOM elements as transition=ing
506
- flushSyncSafe(() => {
507
- // Cancel any pending transitions
508
- if (transition) {
509
- renderDfd && renderDfd.resolve();
510
- transition.skipTransition();
511
- }
512
- setVtContext({
513
- isTransitioning: true,
514
- flushSync: true,
515
- currentLocation: viewTransitionOpts.currentLocation,
516
- nextLocation: viewTransitionOpts.nextLocation
517
- });
518
- });
519
-
520
- // Update the DOM
521
- let t = router$1.window.document.startViewTransition(() => {
522
- flushSyncSafe(() => setStateImpl(newState));
523
- });
524
-
525
- // Clean up after the animation completes
526
- t.finished.finally(() => {
527
- flushSyncSafe(() => {
528
- setRenderDfd(undefined);
529
- setTransition(undefined);
530
- setPendingState(undefined);
531
- setVtContext({
532
- isTransitioning: false
533
- });
534
- });
535
- });
536
- flushSyncSafe(() => setTransition(t));
537
- return;
538
- }
539
-
540
- // startTransition + startViewTransition
541
- if (transition) {
542
- // Interrupting an in-progress transition, cancel and let everything flush
543
- // out, and then kick off a new transition from the interruption state
544
- renderDfd && renderDfd.resolve();
545
- transition.skipTransition();
546
- setInterruption({
547
- state: newState,
548
- currentLocation: viewTransitionOpts.currentLocation,
549
- nextLocation: viewTransitionOpts.nextLocation
550
- });
551
- } else {
552
- // Completed navigation update with opted-in view transitions, let 'er rip
553
- setPendingState(newState);
554
- setVtContext({
555
- isTransitioning: true,
556
- flushSync: false,
557
- currentLocation: viewTransitionOpts.currentLocation,
558
- nextLocation: viewTransitionOpts.nextLocation
559
- });
560
- }
561
- }, [router$1.window, transition, renderDfd, fetcherData, optInStartTransition]);
562
-
563
- // Need to use a layout effect here so we are subscribed early enough to
564
- // pick up on any render-driven redirects/navigations (useEffect/<Navigate>)
565
- React__namespace.useLayoutEffect(() => router$1.subscribe(setState), [router$1, setState]);
566
-
567
- // When we start a view transition, create a Deferred we can use for the
568
- // eventual "completed" render
569
- React__namespace.useEffect(() => {
570
- if (vtContext.isTransitioning && !vtContext.flushSync) {
571
- setRenderDfd(new Deferred());
572
- }
573
- }, [vtContext]);
574
-
575
- // Once the deferred is created, kick off startViewTransition() to update the
576
- // DOM and then wait on the Deferred to resolve (indicating the DOM update has
577
- // happened)
578
- React__namespace.useEffect(() => {
579
- if (renderDfd && pendingState && router$1.window) {
580
- let newState = pendingState;
581
- let renderPromise = renderDfd.promise;
582
- let transition = router$1.window.document.startViewTransition(async () => {
583
- optInStartTransition(() => setStateImpl(newState));
584
- await renderPromise;
585
- });
586
- transition.finished.finally(() => {
587
- setRenderDfd(undefined);
588
- setTransition(undefined);
589
- setPendingState(undefined);
590
- setVtContext({
591
- isTransitioning: false
592
- });
593
- });
594
- setTransition(transition);
595
- }
596
- }, [optInStartTransition, pendingState, renderDfd, router$1.window]);
597
-
598
- // When the new location finally renders and is committed to the DOM, this
599
- // effect will run to resolve the transition
600
- React__namespace.useEffect(() => {
601
- if (renderDfd && pendingState && state.location.key === pendingState.location.key) {
602
- renderDfd.resolve();
603
- }
604
- }, [renderDfd, transition, state.location, pendingState]);
605
-
606
- // If we get interrupted with a new navigation during a transition, we skip
607
- // the active transition, let it cleanup, then kick it off again here
608
- React__namespace.useEffect(() => {
609
- if (!vtContext.isTransitioning && interruption) {
610
- setPendingState(interruption.state);
611
- setVtContext({
612
- isTransitioning: true,
613
- flushSync: false,
614
- currentLocation: interruption.currentLocation,
615
- nextLocation: interruption.nextLocation
616
- });
617
- setInterruption(undefined);
618
- }
619
- }, [vtContext.isTransitioning, interruption]);
620
- React__namespace.useEffect(() => {
621
- router.UNSAFE_warning(fallbackElement == null || !router$1.future.v7_partialHydration, "`<RouterProvider fallbackElement>` is deprecated when using " + "`v7_partialHydration`, use a `HydrateFallback` component instead") ;
622
- // Only log this once on initial mount
623
- // eslint-disable-next-line react-hooks/exhaustive-deps
624
- }, []);
625
- let navigator = React__namespace.useMemo(() => {
626
- return {
627
- createHref: router$1.createHref,
628
- encodeLocation: router$1.encodeLocation,
629
- go: n => router$1.navigate(n),
630
- push: (to, state, opts) => router$1.navigate(to, {
631
- state,
632
- preventScrollReset: opts == null ? void 0 : opts.preventScrollReset
633
- }),
634
- replace: (to, state, opts) => router$1.navigate(to, {
635
- replace: true,
636
- state,
637
- preventScrollReset: opts == null ? void 0 : opts.preventScrollReset
638
- })
639
- };
640
- }, [router$1]);
641
- let basename = router$1.basename || "/";
642
- let dataRouterContext = React__namespace.useMemo(() => ({
643
- router: router$1,
644
- navigator,
645
- static: false,
646
- basename
647
- }), [router$1, navigator, basename]);
648
- let routerFuture = React__namespace.useMemo(() => ({
649
- v7_relativeSplatPath: router$1.future.v7_relativeSplatPath
650
- }), [router$1.future.v7_relativeSplatPath]);
651
-
652
- // The fragment and {null} here are important! We need them to keep React 18's
653
- // useId happy when we are server-rendering since we may have a <script> here
654
- // containing the hydrated server-side staticContext (from StaticRouterProvider).
655
- // useId relies on the component tree structure to generate deterministic id's
656
- // so we need to ensure it remains the same on the client even though
657
- // we don't need the <script> tag
658
- return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(reactRouter.UNSAFE_DataRouterContext.Provider, {
659
- value: dataRouterContext
660
- }, /*#__PURE__*/React__namespace.createElement(reactRouter.UNSAFE_DataRouterStateContext.Provider, {
661
- value: state
662
- }, /*#__PURE__*/React__namespace.createElement(FetchersContext.Provider, {
663
- value: fetcherData.current
664
- }, /*#__PURE__*/React__namespace.createElement(ViewTransitionContext.Provider, {
665
- value: vtContext
666
- }, /*#__PURE__*/React__namespace.createElement(reactRouter.Router, {
667
- basename: basename,
668
- location: state.location,
669
- navigationType: state.historyAction,
670
- navigator: navigator,
671
- future: routerFuture
672
- }, state.initialized || router$1.future.v7_partialHydration ? /*#__PURE__*/React__namespace.createElement(MemoizedDataRoutes, {
673
- routes: router$1.routes,
674
- future: router$1.future,
675
- state: state
676
- }) : fallbackElement))))), null);
677
- }
678
-
679
- // Memoize to avoid re-renders when updating `ViewTransitionContext`
680
- const MemoizedDataRoutes = /*#__PURE__*/React__namespace.memo(DataRoutes);
681
- function DataRoutes(_ref3) {
682
- let {
683
- routes,
684
- future,
685
- state
686
- } = _ref3;
687
- return reactRouter.UNSAFE_useRoutesImpl(routes, undefined, state, future);
688
- }
689
- /**
690
- * A `<Router>` for use in web browsers. Provides the cleanest URLs.
691
- */
692
- function BrowserRouter(_ref4) {
693
- let {
694
- basename,
695
- children,
696
- future,
697
- window
698
- } = _ref4;
699
- let historyRef = React__namespace.useRef();
700
- if (historyRef.current == null) {
701
- historyRef.current = router.createBrowserHistory({
702
- window,
703
- v5Compat: true
704
- });
705
- }
706
- let history = historyRef.current;
707
- let [state, setStateImpl] = React__namespace.useState({
708
- action: history.action,
709
- location: history.location
710
- });
711
- let {
712
- v7_startTransition
713
- } = future || {};
714
- let setState = React__namespace.useCallback(newState => {
715
- v7_startTransition && startTransitionImpl ? startTransitionImpl(() => setStateImpl(newState)) : setStateImpl(newState);
716
- }, [setStateImpl, v7_startTransition]);
717
- React__namespace.useLayoutEffect(() => history.listen(setState), [history, setState]);
718
- return /*#__PURE__*/React__namespace.createElement(reactRouter.Router, {
719
- basename: basename,
720
- children: children,
721
- location: state.location,
722
- navigationType: state.action,
723
- navigator: history,
724
- future: future
725
- });
726
- }
727
- /**
728
- * A `<Router>` for use in web browsers. Stores the location in the hash
729
- * portion of the URL so it is not sent to the server.
730
- */
731
- function HashRouter(_ref5) {
732
- let {
733
- basename,
734
- children,
735
- future,
736
- window
737
- } = _ref5;
738
- let historyRef = React__namespace.useRef();
739
- if (historyRef.current == null) {
740
- historyRef.current = router.createHashHistory({
741
- window,
742
- v5Compat: true
743
- });
744
- }
745
- let history = historyRef.current;
746
- let [state, setStateImpl] = React__namespace.useState({
747
- action: history.action,
748
- location: history.location
749
- });
750
- let {
751
- v7_startTransition
752
- } = future || {};
753
- let setState = React__namespace.useCallback(newState => {
754
- v7_startTransition && startTransitionImpl ? startTransitionImpl(() => setStateImpl(newState)) : setStateImpl(newState);
755
- }, [setStateImpl, v7_startTransition]);
756
- React__namespace.useLayoutEffect(() => history.listen(setState), [history, setState]);
757
- return /*#__PURE__*/React__namespace.createElement(reactRouter.Router, {
758
- basename: basename,
759
- children: children,
760
- location: state.location,
761
- navigationType: state.action,
762
- navigator: history,
763
- future: future
764
- });
765
- }
766
- /**
767
- * A `<Router>` that accepts a pre-instantiated history object. It's important
768
- * to note that using your own history object is highly discouraged and may add
769
- * two versions of the history library to your bundles unless you use the same
770
- * version of the history library that React Router uses internally.
771
- */
772
- function HistoryRouter(_ref6) {
773
- let {
774
- basename,
775
- children,
776
- future,
777
- history
778
- } = _ref6;
779
- let [state, setStateImpl] = React__namespace.useState({
780
- action: history.action,
781
- location: history.location
782
- });
783
- let {
784
- v7_startTransition
785
- } = future || {};
786
- let setState = React__namespace.useCallback(newState => {
787
- v7_startTransition && startTransitionImpl ? startTransitionImpl(() => setStateImpl(newState)) : setStateImpl(newState);
788
- }, [setStateImpl, v7_startTransition]);
789
- React__namespace.useLayoutEffect(() => history.listen(setState), [history, setState]);
790
- return /*#__PURE__*/React__namespace.createElement(reactRouter.Router, {
791
- basename: basename,
792
- children: children,
793
- location: state.location,
794
- navigationType: state.action,
795
- navigator: history,
796
- future: future
797
- });
798
- }
799
- {
800
- HistoryRouter.displayName = "unstable_HistoryRouter";
801
- }
802
- const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
803
- const ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
804
-
805
- /**
806
- * The public API for rendering a history-aware `<a>`.
807
- */
808
- const Link = /*#__PURE__*/React__namespace.forwardRef(function LinkWithRef(_ref7, ref) {
809
- let {
810
- onClick,
811
- relative,
812
- reloadDocument,
813
- replace,
814
- state,
815
- target,
816
- to,
817
- preventScrollReset,
818
- unstable_viewTransition
819
- } = _ref7,
820
- rest = _objectWithoutPropertiesLoose(_ref7, _excluded);
821
- let {
822
- basename
823
- } = React__namespace.useContext(reactRouter.UNSAFE_NavigationContext);
824
-
825
- // Rendered into <a href> for absolute URLs
826
- let absoluteHref;
827
- let isExternal = false;
828
- if (typeof to === "string" && ABSOLUTE_URL_REGEX.test(to)) {
829
- // Render the absolute href server- and client-side
830
- absoluteHref = to;
831
-
832
- // Only check for external origins client-side
833
- if (isBrowser) {
834
- try {
835
- let currentUrl = new URL(window.location.href);
836
- let targetUrl = to.startsWith("//") ? new URL(currentUrl.protocol + to) : new URL(to);
837
- let path = router.stripBasename(targetUrl.pathname, basename);
838
- if (targetUrl.origin === currentUrl.origin && path != null) {
839
- // Strip the protocol/origin/basename for same-origin absolute URLs
840
- to = path + targetUrl.search + targetUrl.hash;
841
- } else {
842
- isExternal = true;
843
- }
844
- } catch (e) {
845
- // We can't do external URL detection without a valid URL
846
- router.UNSAFE_warning(false, "<Link to=\"" + to + "\"> contains an invalid URL which will probably break " + "when clicked - please update to a valid URL path.") ;
847
- }
848
- }
849
- }
850
-
851
- // Rendered into <a href> for relative URLs
852
- let href = reactRouter.useHref(to, {
853
- relative
854
- });
855
- let internalOnClick = useLinkClickHandler(to, {
856
- replace,
857
- state,
858
- target,
859
- preventScrollReset,
860
- relative,
861
- unstable_viewTransition
862
- });
863
- function handleClick(event) {
864
- if (onClick) onClick(event);
865
- if (!event.defaultPrevented) {
866
- internalOnClick(event);
867
- }
868
- }
869
- return (
870
- /*#__PURE__*/
871
- // eslint-disable-next-line jsx-a11y/anchor-has-content
872
- React__namespace.createElement("a", _extends({}, rest, {
873
- href: absoluteHref || href,
874
- onClick: isExternal || reloadDocument ? onClick : handleClick,
875
- ref: ref,
876
- target: target
877
- }))
878
- );
879
- });
880
- {
881
- Link.displayName = "Link";
882
- }
883
- /**
884
- * A `<Link>` wrapper that knows if it's "active" or not.
885
- */
886
- const NavLink = /*#__PURE__*/React__namespace.forwardRef(function NavLinkWithRef(_ref8, ref) {
887
- let {
888
- "aria-current": ariaCurrentProp = "page",
889
- caseSensitive = false,
890
- className: classNameProp = "",
891
- end = false,
892
- style: styleProp,
893
- to,
894
- unstable_viewTransition,
895
- children
896
- } = _ref8,
897
- rest = _objectWithoutPropertiesLoose(_ref8, _excluded2);
898
- let path = reactRouter.useResolvedPath(to, {
899
- relative: rest.relative
900
- });
901
- let location = reactRouter.useLocation();
902
- let routerState = React__namespace.useContext(reactRouter.UNSAFE_DataRouterStateContext);
903
- let {
904
- navigator,
905
- basename
906
- } = React__namespace.useContext(reactRouter.UNSAFE_NavigationContext);
907
- let isTransitioning = routerState != null &&
908
- // Conditional usage is OK here because the usage of a data router is static
909
- // eslint-disable-next-line react-hooks/rules-of-hooks
910
- useViewTransitionState(path) && unstable_viewTransition === true;
911
- let toPathname = navigator.encodeLocation ? navigator.encodeLocation(path).pathname : path.pathname;
912
- let locationPathname = location.pathname;
913
- let nextLocationPathname = routerState && routerState.navigation && routerState.navigation.location ? routerState.navigation.location.pathname : null;
914
- if (!caseSensitive) {
915
- locationPathname = locationPathname.toLowerCase();
916
- nextLocationPathname = nextLocationPathname ? nextLocationPathname.toLowerCase() : null;
917
- toPathname = toPathname.toLowerCase();
918
- }
919
- if (nextLocationPathname && basename) {
920
- nextLocationPathname = router.stripBasename(nextLocationPathname, basename) || nextLocationPathname;
921
- }
922
-
923
- // If the `to` has a trailing slash, look at that exact spot. Otherwise,
924
- // we're looking for a slash _after_ what's in `to`. For example:
925
- //
926
- // <NavLink to="/users"> and <NavLink to="/users/">
927
- // both want to look for a / at index 6 to match URL `/users/matt`
928
- const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
929
- let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/";
930
- let isPending = nextLocationPathname != null && (nextLocationPathname === toPathname || !end && nextLocationPathname.startsWith(toPathname) && nextLocationPathname.charAt(toPathname.length) === "/");
931
- let renderProps = {
932
- isActive,
933
- isPending,
934
- isTransitioning
935
- };
936
- let ariaCurrent = isActive ? ariaCurrentProp : undefined;
937
- let className;
938
- if (typeof classNameProp === "function") {
939
- className = classNameProp(renderProps);
940
- } else {
941
- // If the className prop is not a function, we use a default `active`
942
- // class for <NavLink />s that are active. In v5 `active` was the default
943
- // value for `activeClassName`, but we are removing that API and can still
944
- // use the old default behavior for a cleaner upgrade path and keep the
945
- // simple styling rules working as they currently do.
946
- className = [classNameProp, isActive ? "active" : null, isPending ? "pending" : null, isTransitioning ? "transitioning" : null].filter(Boolean).join(" ");
947
- }
948
- let style = typeof styleProp === "function" ? styleProp(renderProps) : styleProp;
949
- return /*#__PURE__*/React__namespace.createElement(Link, _extends({}, rest, {
950
- "aria-current": ariaCurrent,
951
- className: className,
952
- ref: ref,
953
- style: style,
954
- to: to,
955
- unstable_viewTransition: unstable_viewTransition
956
- }), typeof children === "function" ? children(renderProps) : children);
957
- });
958
- {
959
- NavLink.displayName = "NavLink";
960
- }
961
-
962
- /**
963
- * Form props shared by navigations and fetchers
964
- */
965
-
966
- /**
967
- * Form props available to fetchers
968
- */
969
-
970
- /**
971
- * Form props available to navigations
972
- */
973
-
974
- /**
975
- * A `@remix-run/router`-aware `<form>`. It behaves like a normal form except
976
- * that the interaction with the server is with `fetch` instead of new document
977
- * requests, allowing components to add nicer UX to the page as the form is
978
- * submitted and returns with data.
979
- */
980
- const Form = /*#__PURE__*/React__namespace.forwardRef((_ref9, forwardedRef) => {
981
- let {
982
- fetcherKey,
983
- navigate,
984
- reloadDocument,
985
- replace,
986
- state,
987
- method = defaultMethod,
988
- action,
989
- onSubmit,
990
- relative,
991
- preventScrollReset,
992
- unstable_viewTransition
993
- } = _ref9,
994
- props = _objectWithoutPropertiesLoose(_ref9, _excluded3);
995
- let submit = useSubmit();
996
- let formAction = useFormAction(action, {
997
- relative
998
- });
999
- let formMethod = method.toLowerCase() === "get" ? "get" : "post";
1000
- let submitHandler = event => {
1001
- onSubmit && onSubmit(event);
1002
- if (event.defaultPrevented) return;
1003
- event.preventDefault();
1004
- let submitter = event.nativeEvent.submitter;
1005
- let submitMethod = (submitter == null ? void 0 : submitter.getAttribute("formmethod")) || method;
1006
- submit(submitter || event.currentTarget, {
1007
- fetcherKey,
1008
- method: submitMethod,
1009
- navigate,
1010
- replace,
1011
- state,
1012
- relative,
1013
- preventScrollReset,
1014
- unstable_viewTransition
1015
- });
1016
- };
1017
- return /*#__PURE__*/React__namespace.createElement("form", _extends({
1018
- ref: forwardedRef,
1019
- method: formMethod,
1020
- action: formAction,
1021
- onSubmit: reloadDocument ? onSubmit : submitHandler
1022
- }, props));
1023
- });
1024
- {
1025
- Form.displayName = "Form";
1026
- }
1027
- /**
1028
- * This component will emulate the browser's scroll restoration on location
1029
- * changes.
1030
- */
1031
- function ScrollRestoration(_ref10) {
1032
- let {
1033
- getKey,
1034
- storageKey
1035
- } = _ref10;
1036
- useScrollRestoration({
1037
- getKey,
1038
- storageKey
1039
- });
1040
- return null;
1041
- }
1042
- {
1043
- ScrollRestoration.displayName = "ScrollRestoration";
1044
- }
1045
- //#endregion
1046
-
1047
- ////////////////////////////////////////////////////////////////////////////////
1048
- //#region Hooks
1049
- ////////////////////////////////////////////////////////////////////////////////
1050
- var DataRouterHook = /*#__PURE__*/function (DataRouterHook) {
1051
- DataRouterHook["UseScrollRestoration"] = "useScrollRestoration";
1052
- DataRouterHook["UseSubmit"] = "useSubmit";
1053
- DataRouterHook["UseSubmitFetcher"] = "useSubmitFetcher";
1054
- DataRouterHook["UseFetcher"] = "useFetcher";
1055
- DataRouterHook["useViewTransitionState"] = "useViewTransitionState";
1056
- return DataRouterHook;
1057
- }(DataRouterHook || {});
1058
- var DataRouterStateHook = /*#__PURE__*/function (DataRouterStateHook) {
1059
- DataRouterStateHook["UseFetcher"] = "useFetcher";
1060
- DataRouterStateHook["UseFetchers"] = "useFetchers";
1061
- DataRouterStateHook["UseScrollRestoration"] = "useScrollRestoration";
1062
- return DataRouterStateHook;
1063
- }(DataRouterStateHook || {}); // Internal hooks
1064
- function getDataRouterConsoleError(hookName) {
1065
- return hookName + " must be used within a data router. See https://reactrouter.com/routers/picking-a-router.";
1066
- }
1067
- function useDataRouterContext(hookName) {
1068
- let ctx = React__namespace.useContext(reactRouter.UNSAFE_DataRouterContext);
1069
- !ctx ? router.UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : void 0;
1070
- return ctx;
1071
- }
1072
- function useDataRouterState(hookName) {
1073
- let state = React__namespace.useContext(reactRouter.UNSAFE_DataRouterStateContext);
1074
- !state ? router.UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : void 0;
1075
- return state;
1076
- }
1077
-
1078
- // External hooks
1079
-
1080
- /**
1081
- * Handles the click behavior for router `<Link>` components. This is useful if
1082
- * you need to create custom `<Link>` components with the same click behavior we
1083
- * use in our exported `<Link>`.
1084
- */
1085
- function useLinkClickHandler(to, _temp) {
1086
- let {
1087
- target,
1088
- replace: replaceProp,
1089
- state,
1090
- preventScrollReset,
1091
- relative,
1092
- unstable_viewTransition
1093
- } = _temp === void 0 ? {} : _temp;
1094
- let navigate = reactRouter.useNavigate();
1095
- let location = reactRouter.useLocation();
1096
- let path = reactRouter.useResolvedPath(to, {
1097
- relative
1098
- });
1099
- return React__namespace.useCallback(event => {
1100
- if (shouldProcessLinkClick(event, target)) {
1101
- event.preventDefault();
1102
-
1103
- // If the URL hasn't changed, a regular <a> will do a replace instead of
1104
- // a push, so do the same here unless the replace prop is explicitly set
1105
- let replace = replaceProp !== undefined ? replaceProp : reactRouter.createPath(location) === reactRouter.createPath(path);
1106
- navigate(to, {
1107
- replace,
1108
- state,
1109
- preventScrollReset,
1110
- relative,
1111
- unstable_viewTransition
1112
- });
1113
- }
1114
- }, [location, navigate, path, replaceProp, state, target, to, preventScrollReset, relative, unstable_viewTransition]);
1115
- }
1116
-
1117
- /**
1118
- * A convenient wrapper for reading and writing search parameters via the
1119
- * URLSearchParams interface.
1120
- */
1121
- function useSearchParams(defaultInit) {
1122
- router.UNSAFE_warning(typeof URLSearchParams !== "undefined", "You cannot use the `useSearchParams` hook in a browser that does not " + "support the URLSearchParams API. If you need to support Internet " + "Explorer 11, we recommend you load a polyfill such as " + "https://github.com/ungap/url-search-params.") ;
1123
- let defaultSearchParamsRef = React__namespace.useRef(createSearchParams(defaultInit));
1124
- let hasSetSearchParamsRef = React__namespace.useRef(false);
1125
- let location = reactRouter.useLocation();
1126
- let searchParams = React__namespace.useMemo(() =>
1127
- // Only merge in the defaults if we haven't yet called setSearchParams.
1128
- // Once we call that we want those to take precedence, otherwise you can't
1129
- // remove a param with setSearchParams({}) if it has an initial value
1130
- getSearchParamsForLocation(location.search, hasSetSearchParamsRef.current ? null : defaultSearchParamsRef.current), [location.search]);
1131
- let navigate = reactRouter.useNavigate();
1132
- let setSearchParams = React__namespace.useCallback((nextInit, navigateOptions) => {
1133
- const newSearchParams = createSearchParams(typeof nextInit === "function" ? nextInit(searchParams) : nextInit);
1134
- hasSetSearchParamsRef.current = true;
1135
- navigate("?" + newSearchParams, navigateOptions);
1136
- }, [navigate, searchParams]);
1137
- return [searchParams, setSearchParams];
1138
- }
1139
-
1140
- /**
1141
- * Submits a HTML `<form>` to the server without reloading the page.
1142
- */
1143
-
1144
- /**
1145
- * Submits a fetcher `<form>` to the server without reloading the page.
1146
- */
1147
-
1148
- function validateClientSideSubmission() {
1149
- if (typeof document === "undefined") {
1150
- throw new Error("You are calling submit during the server render. " + "Try calling submit within a `useEffect` or callback instead.");
1151
- }
1152
- }
1153
- let fetcherId = 0;
1154
- let getUniqueFetcherId = () => "__" + String(++fetcherId) + "__";
1155
-
1156
- /**
1157
- * Returns a function that may be used to programmatically submit a form (or
1158
- * some arbitrary data) to the server.
1159
- */
1160
- function useSubmit() {
1161
- let {
1162
- router
1163
- } = useDataRouterContext(DataRouterHook.UseSubmit);
1164
- let {
1165
- basename
1166
- } = React__namespace.useContext(reactRouter.UNSAFE_NavigationContext);
1167
- let currentRouteId = reactRouter.UNSAFE_useRouteId();
1168
- return React__namespace.useCallback(function (target, options) {
1169
- if (options === void 0) {
1170
- options = {};
1171
- }
1172
- validateClientSideSubmission();
1173
- let {
1174
- action,
1175
- method,
1176
- encType,
1177
- formData,
1178
- body
1179
- } = getFormSubmissionInfo(target, basename);
1180
- if (options.navigate === false) {
1181
- let key = options.fetcherKey || getUniqueFetcherId();
1182
- router.fetch(key, currentRouteId, options.action || action, {
1183
- preventScrollReset: options.preventScrollReset,
1184
- formData,
1185
- body,
1186
- formMethod: options.method || method,
1187
- formEncType: options.encType || encType,
1188
- unstable_flushSync: options.unstable_flushSync
1189
- });
1190
- } else {
1191
- router.navigate(options.action || action, {
1192
- preventScrollReset: options.preventScrollReset,
1193
- formData,
1194
- body,
1195
- formMethod: options.method || method,
1196
- formEncType: options.encType || encType,
1197
- replace: options.replace,
1198
- state: options.state,
1199
- fromRouteId: currentRouteId,
1200
- unstable_flushSync: options.unstable_flushSync,
1201
- unstable_viewTransition: options.unstable_viewTransition
1202
- });
1203
- }
1204
- }, [router, basename, currentRouteId]);
1205
- }
1206
-
1207
- // v7: Eventually we should deprecate this entirely in favor of using the
1208
- // router method directly?
1209
- function useFormAction(action, _temp2) {
1210
- let {
1211
- relative
1212
- } = _temp2 === void 0 ? {} : _temp2;
1213
- let {
1214
- basename
1215
- } = React__namespace.useContext(reactRouter.UNSAFE_NavigationContext);
1216
- let routeContext = React__namespace.useContext(reactRouter.UNSAFE_RouteContext);
1217
- !routeContext ? router.UNSAFE_invariant(false, "useFormAction must be used inside a RouteContext") : void 0;
1218
- let [match] = routeContext.matches.slice(-1);
1219
- // Shallow clone path so we can modify it below, otherwise we modify the
1220
- // object referenced by useMemo inside useResolvedPath
1221
- let path = _extends({}, reactRouter.useResolvedPath(action ? action : ".", {
1222
- relative
1223
- }));
1224
-
1225
- // If no action was specified, browsers will persist current search params
1226
- // when determining the path, so match that behavior
1227
- // https://github.com/remix-run/remix/issues/927
1228
- let location = reactRouter.useLocation();
1229
- if (action == null) {
1230
- // Safe to write to this directly here since if action was undefined, we
1231
- // would have called useResolvedPath(".") which will never include a search
1232
- path.search = location.search;
1233
-
1234
- // When grabbing search params from the URL, remove any included ?index param
1235
- // since it might not apply to our contextual route. We add it back based
1236
- // on match.route.index below
1237
- let params = new URLSearchParams(path.search);
1238
- if (params.has("index") && params.get("index") === "") {
1239
- params.delete("index");
1240
- path.search = params.toString() ? "?" + params.toString() : "";
1241
- }
1242
- }
1243
- if ((!action || action === ".") && match.route.index) {
1244
- path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
1245
- }
1246
-
1247
- // If we're operating within a basename, prepend it to the pathname prior
1248
- // to creating the form action. If this is a root navigation, then just use
1249
- // the raw basename which allows the basename to have full control over the
1250
- // presence of a trailing slash on root actions
1251
- if (basename !== "/") {
1252
- path.pathname = path.pathname === "/" ? basename : router.joinPaths([basename, path.pathname]);
1253
- }
1254
- return reactRouter.createPath(path);
1255
- }
1256
- // TODO: (v7) Change the useFetcher generic default from `any` to `unknown`
1257
- /**
1258
- * Interacts with route loaders and actions without causing a navigation. Great
1259
- * for any interaction that stays on the same page.
1260
- */
1261
- function useFetcher(_temp3) {
1262
- var _route$matches;
1263
- let {
1264
- key
1265
- } = _temp3 === void 0 ? {} : _temp3;
1266
- let {
1267
- router: router$1
1268
- } = useDataRouterContext(DataRouterHook.UseFetcher);
1269
- let state = useDataRouterState(DataRouterStateHook.UseFetcher);
1270
- let fetcherData = React__namespace.useContext(FetchersContext);
1271
- let route = React__namespace.useContext(reactRouter.UNSAFE_RouteContext);
1272
- let routeId = (_route$matches = route.matches[route.matches.length - 1]) == null ? void 0 : _route$matches.route.id;
1273
- !fetcherData ? router.UNSAFE_invariant(false, "useFetcher must be used inside a FetchersContext") : void 0;
1274
- !route ? router.UNSAFE_invariant(false, "useFetcher must be used inside a RouteContext") : void 0;
1275
- !(routeId != null) ? router.UNSAFE_invariant(false, "useFetcher can only be used on routes that contain a unique \"id\"") : void 0;
1276
-
1277
- // Fetcher key handling
1278
- // OK to call conditionally to feature detect `useId`
1279
- // eslint-disable-next-line react-hooks/rules-of-hooks
1280
- let defaultKey = useIdImpl ? useIdImpl() : "";
1281
- let [fetcherKey, setFetcherKey] = React__namespace.useState(key || defaultKey);
1282
- if (key && key !== fetcherKey) {
1283
- setFetcherKey(key);
1284
- } else if (!fetcherKey) {
1285
- // We will only fall through here when `useId` is not available
1286
- setFetcherKey(getUniqueFetcherId());
1287
- }
1288
-
1289
- // Registration/cleanup
1290
- React__namespace.useEffect(() => {
1291
- router$1.getFetcher(fetcherKey);
1292
- return () => {
1293
- // Tell the router we've unmounted - if v7_fetcherPersist is enabled this
1294
- // will not delete immediately but instead queue up a delete after the
1295
- // fetcher returns to an `idle` state
1296
- router$1.deleteFetcher(fetcherKey);
1297
- };
1298
- }, [router$1, fetcherKey]);
1299
-
1300
- // Fetcher additions
1301
- let load = React__namespace.useCallback((href, opts) => {
1302
- !routeId ? router.UNSAFE_invariant(false, "No routeId available for fetcher.load()") : void 0;
1303
- router$1.fetch(fetcherKey, routeId, href, opts);
1304
- }, [fetcherKey, routeId, router$1]);
1305
- let submitImpl = useSubmit();
1306
- let submit = React__namespace.useCallback((target, opts) => {
1307
- submitImpl(target, _extends({}, opts, {
1308
- navigate: false,
1309
- fetcherKey
1310
- }));
1311
- }, [fetcherKey, submitImpl]);
1312
- let FetcherForm = React__namespace.useMemo(() => {
1313
- let FetcherForm = /*#__PURE__*/React__namespace.forwardRef((props, ref) => {
1314
- return /*#__PURE__*/React__namespace.createElement(Form, _extends({}, props, {
1315
- navigate: false,
1316
- fetcherKey: fetcherKey,
1317
- ref: ref
1318
- }));
1319
- });
1320
- {
1321
- FetcherForm.displayName = "fetcher.Form";
1322
- }
1323
- return FetcherForm;
1324
- }, [fetcherKey]);
1325
-
1326
- // Exposed FetcherWithComponents
1327
- let fetcher = state.fetchers.get(fetcherKey) || router.IDLE_FETCHER;
1328
- let data = fetcherData.get(fetcherKey);
1329
- let fetcherWithComponents = React__namespace.useMemo(() => _extends({
1330
- Form: FetcherForm,
1331
- submit,
1332
- load
1333
- }, fetcher, {
1334
- data
1335
- }), [FetcherForm, submit, load, fetcher, data]);
1336
- return fetcherWithComponents;
1337
- }
1338
-
1339
- /**
1340
- * Provides all fetchers currently on the page. Useful for layouts and parent
1341
- * routes that need to provide pending/optimistic UI regarding the fetch.
1342
- */
1343
- function useFetchers() {
1344
- let state = useDataRouterState(DataRouterStateHook.UseFetchers);
1345
- return Array.from(state.fetchers.entries()).map(_ref11 => {
1346
- let [key, fetcher] = _ref11;
1347
- return _extends({}, fetcher, {
1348
- key
1349
- });
1350
- });
1351
- }
1352
- const SCROLL_RESTORATION_STORAGE_KEY = "react-router-scroll-positions";
1353
- let savedScrollPositions = {};
1354
-
1355
- /**
1356
- * When rendered inside a RouterProvider, will restore scroll positions on navigations
1357
- */
1358
- function useScrollRestoration(_temp4) {
1359
- let {
1360
- getKey,
1361
- storageKey
1362
- } = _temp4 === void 0 ? {} : _temp4;
1363
- let {
1364
- router: router$1
1365
- } = useDataRouterContext(DataRouterHook.UseScrollRestoration);
1366
- let {
1367
- restoreScrollPosition,
1368
- preventScrollReset
1369
- } = useDataRouterState(DataRouterStateHook.UseScrollRestoration);
1370
- let {
1371
- basename
1372
- } = React__namespace.useContext(reactRouter.UNSAFE_NavigationContext);
1373
- let location = reactRouter.useLocation();
1374
- let matches = reactRouter.useMatches();
1375
- let navigation = reactRouter.useNavigation();
1376
-
1377
- // Trigger manual scroll restoration while we're active
1378
- React__namespace.useEffect(() => {
1379
- window.history.scrollRestoration = "manual";
1380
- return () => {
1381
- window.history.scrollRestoration = "auto";
1382
- };
1383
- }, []);
1384
-
1385
- // Save positions on pagehide
1386
- usePageHide(React__namespace.useCallback(() => {
1387
- if (navigation.state === "idle") {
1388
- let key = (getKey ? getKey(location, matches) : null) || location.key;
1389
- savedScrollPositions[key] = window.scrollY;
1390
- }
1391
- try {
1392
- sessionStorage.setItem(storageKey || SCROLL_RESTORATION_STORAGE_KEY, JSON.stringify(savedScrollPositions));
1393
- } catch (error) {
1394
- router.UNSAFE_warning(false, "Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (" + error + ").") ;
1395
- }
1396
- window.history.scrollRestoration = "auto";
1397
- }, [storageKey, getKey, navigation.state, location, matches]));
1398
-
1399
- // Read in any saved scroll locations
1400
- if (typeof document !== "undefined") {
1401
- // eslint-disable-next-line react-hooks/rules-of-hooks
1402
- React__namespace.useLayoutEffect(() => {
1403
- try {
1404
- let sessionPositions = sessionStorage.getItem(storageKey || SCROLL_RESTORATION_STORAGE_KEY);
1405
- if (sessionPositions) {
1406
- savedScrollPositions = JSON.parse(sessionPositions);
1407
- }
1408
- } catch (e) {
1409
- // no-op, use default empty object
1410
- }
1411
- }, [storageKey]);
1412
-
1413
- // Enable scroll restoration in the router
1414
- // eslint-disable-next-line react-hooks/rules-of-hooks
1415
- React__namespace.useLayoutEffect(() => {
1416
- let getKeyWithoutBasename = getKey && basename !== "/" ? (location, matches) => getKey( // Strip the basename to match useLocation()
1417
- _extends({}, location, {
1418
- pathname: router.stripBasename(location.pathname, basename) || location.pathname
1419
- }), matches) : getKey;
1420
- let disableScrollRestoration = router$1 == null ? void 0 : router$1.enableScrollRestoration(savedScrollPositions, () => window.scrollY, getKeyWithoutBasename);
1421
- return () => disableScrollRestoration && disableScrollRestoration();
1422
- }, [router$1, basename, getKey]);
1423
-
1424
- // Restore scrolling when state.restoreScrollPosition changes
1425
- // eslint-disable-next-line react-hooks/rules-of-hooks
1426
- React__namespace.useLayoutEffect(() => {
1427
- // Explicit false means don't do anything (used for submissions)
1428
- if (restoreScrollPosition === false) {
1429
- return;
1430
- }
1431
-
1432
- // been here before, scroll to it
1433
- if (typeof restoreScrollPosition === "number") {
1434
- window.scrollTo(0, restoreScrollPosition);
1435
- return;
1436
- }
1437
-
1438
- // try to scroll to the hash
1439
- if (location.hash) {
1440
- let el = document.getElementById(decodeURIComponent(location.hash.slice(1)));
1441
- if (el) {
1442
- el.scrollIntoView();
1443
- return;
1444
- }
1445
- }
1446
-
1447
- // Don't reset if this navigation opted out
1448
- if (preventScrollReset === true) {
1449
- return;
1450
- }
1451
-
1452
- // otherwise go to the top on new locations
1453
- window.scrollTo(0, 0);
1454
- }, [location, restoreScrollPosition, preventScrollReset]);
1455
- }
1456
- }
1457
-
1458
- /**
1459
- * Setup a callback to be fired on the window's `beforeunload` event. This is
1460
- * useful for saving some data to `window.localStorage` just before the page
1461
- * refreshes.
1462
- *
1463
- * Note: The `callback` argument should be a function created with
1464
- * `React.useCallback()`.
1465
- */
1466
- function useBeforeUnload(callback, options) {
1467
- let {
1468
- capture
1469
- } = options || {};
1470
- React__namespace.useEffect(() => {
1471
- let opts = capture != null ? {
1472
- capture
1473
- } : undefined;
1474
- window.addEventListener("beforeunload", callback, opts);
1475
- return () => {
1476
- window.removeEventListener("beforeunload", callback, opts);
1477
- };
1478
- }, [callback, capture]);
1479
- }
1480
-
1481
- /**
1482
- * Setup a callback to be fired on the window's `pagehide` event. This is
1483
- * useful for saving some data to `window.localStorage` just before the page
1484
- * refreshes. This event is better supported than beforeunload across browsers.
1485
- *
1486
- * Note: The `callback` argument should be a function created with
1487
- * `React.useCallback()`.
1488
- */
1489
- function usePageHide(callback, options) {
1490
- let {
1491
- capture
1492
- } = options || {};
1493
- React__namespace.useEffect(() => {
1494
- let opts = capture != null ? {
1495
- capture
1496
- } : undefined;
1497
- window.addEventListener("pagehide", callback, opts);
1498
- return () => {
1499
- window.removeEventListener("pagehide", callback, opts);
1500
- };
1501
- }, [callback, capture]);
1502
- }
1503
-
1504
- /**
1505
- * Wrapper around useBlocker to show a window.confirm prompt to users instead
1506
- * of building a custom UI with useBlocker.
1507
- *
1508
- * Warning: This has *a lot of rough edges* and behaves very differently (and
1509
- * very incorrectly in some cases) across browsers if user click addition
1510
- * back/forward navigations while the confirm is open. Use at your own risk.
1511
- */
1512
- function usePrompt(_ref12) {
1513
- let {
1514
- when,
1515
- message
1516
- } = _ref12;
1517
- let blocker = reactRouter.useBlocker(when);
1518
- React__namespace.useEffect(() => {
1519
- if (blocker.state === "blocked") {
1520
- let proceed = window.confirm(message);
1521
- if (proceed) {
1522
- // This timeout is needed to avoid a weird "race" on POP navigations
1523
- // between the `window.history` revert navigation and the result of
1524
- // `window.confirm`
1525
- setTimeout(blocker.proceed, 0);
1526
- } else {
1527
- blocker.reset();
1528
- }
1529
- }
1530
- }, [blocker, message]);
1531
- React__namespace.useEffect(() => {
1532
- if (blocker.state === "blocked" && !when) {
1533
- blocker.reset();
1534
- }
1535
- }, [blocker, when]);
1536
- }
1537
-
1538
- /**
1539
- * Return a boolean indicating if there is an active view transition to the
1540
- * given href. You can use this value to render CSS classes or viewTransitionName
1541
- * styles onto your elements
1542
- *
1543
- * @param href The destination href
1544
- * @param [opts.relative] Relative routing type ("route" | "path")
1545
- */
1546
- function useViewTransitionState(to, opts) {
1547
- if (opts === void 0) {
1548
- opts = {};
1549
- }
1550
- let vtContext = React__namespace.useContext(ViewTransitionContext);
1551
- !(vtContext != null) ? router.UNSAFE_invariant(false, "`unstable_useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. " + "Did you accidentally import `RouterProvider` from `react-router`?") : void 0;
1552
- let {
1553
- basename
1554
- } = useDataRouterContext(DataRouterHook.useViewTransitionState);
1555
- let path = reactRouter.useResolvedPath(to, {
1556
- relative: opts.relative
1557
- });
1558
- if (!vtContext.isTransitioning) {
1559
- return false;
1560
- }
1561
- let currentPath = router.stripBasename(vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;
1562
- let nextPath = router.stripBasename(vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;
1563
-
1564
- // Transition is active if we're going to or coming from the indicated
1565
- // destination. This ensures that other PUSH navigations that reverse
1566
- // an indicated transition apply. I.e., on the list view you have:
1567
- //
1568
- // <NavLink to="/details/1" unstable_viewTransition>
1569
- //
1570
- // If you click the breadcrumb back to the list view:
1571
- //
1572
- // <NavLink to="/list" unstable_viewTransition>
1573
- //
1574
- // We should apply the transition because it's indicated as active going
1575
- // from /list -> /details/1 and therefore should be active on the reverse
1576
- // (even though this isn't strictly a POP reverse)
1577
- return router.matchPath(path.pathname, nextPath) != null || router.matchPath(path.pathname, currentPath) != null;
1578
- }
1579
-
1580
- //#endregion
1581
-
1582
- Object.defineProperty(exports, 'AbortedDeferredError', {
1583
- enumerable: true,
1584
- get: function () { return reactRouter.AbortedDeferredError; }
1585
- });
1586
- Object.defineProperty(exports, 'Await', {
1587
- enumerable: true,
1588
- get: function () { return reactRouter.Await; }
1589
- });
1590
- Object.defineProperty(exports, 'MemoryRouter', {
1591
- enumerable: true,
1592
- get: function () { return reactRouter.MemoryRouter; }
1593
- });
1594
- Object.defineProperty(exports, 'Navigate', {
1595
- enumerable: true,
1596
- get: function () { return reactRouter.Navigate; }
1597
- });
1598
- Object.defineProperty(exports, 'NavigationType', {
1599
- enumerable: true,
1600
- get: function () { return reactRouter.NavigationType; }
1601
- });
1602
- Object.defineProperty(exports, 'Outlet', {
1603
- enumerable: true,
1604
- get: function () { return reactRouter.Outlet; }
1605
- });
1606
- Object.defineProperty(exports, 'Route', {
1607
- enumerable: true,
1608
- get: function () { return reactRouter.Route; }
1609
- });
1610
- Object.defineProperty(exports, 'Router', {
1611
- enumerable: true,
1612
- get: function () { return reactRouter.Router; }
1613
- });
1614
- Object.defineProperty(exports, 'Routes', {
1615
- enumerable: true,
1616
- get: function () { return reactRouter.Routes; }
1617
- });
1618
- Object.defineProperty(exports, 'UNSAFE_DataRouterContext', {
1619
- enumerable: true,
1620
- get: function () { return reactRouter.UNSAFE_DataRouterContext; }
1621
- });
1622
- Object.defineProperty(exports, 'UNSAFE_DataRouterStateContext', {
1623
- enumerable: true,
1624
- get: function () { return reactRouter.UNSAFE_DataRouterStateContext; }
1625
- });
1626
- Object.defineProperty(exports, 'UNSAFE_LocationContext', {
1627
- enumerable: true,
1628
- get: function () { return reactRouter.UNSAFE_LocationContext; }
1629
- });
1630
- Object.defineProperty(exports, 'UNSAFE_NavigationContext', {
1631
- enumerable: true,
1632
- get: function () { return reactRouter.UNSAFE_NavigationContext; }
1633
- });
1634
- Object.defineProperty(exports, 'UNSAFE_RouteContext', {
1635
- enumerable: true,
1636
- get: function () { return reactRouter.UNSAFE_RouteContext; }
1637
- });
1638
- Object.defineProperty(exports, 'UNSAFE_useRouteId', {
1639
- enumerable: true,
1640
- get: function () { return reactRouter.UNSAFE_useRouteId; }
1641
- });
1642
- Object.defineProperty(exports, 'createMemoryRouter', {
1643
- enumerable: true,
1644
- get: function () { return reactRouter.createMemoryRouter; }
1645
- });
1646
- Object.defineProperty(exports, 'createPath', {
1647
- enumerable: true,
1648
- get: function () { return reactRouter.createPath; }
1649
- });
1650
- Object.defineProperty(exports, 'createRoutesFromChildren', {
1651
- enumerable: true,
1652
- get: function () { return reactRouter.createRoutesFromChildren; }
1653
- });
1654
- Object.defineProperty(exports, 'createRoutesFromElements', {
1655
- enumerable: true,
1656
- get: function () { return reactRouter.createRoutesFromElements; }
1657
- });
1658
- Object.defineProperty(exports, 'defer', {
1659
- enumerable: true,
1660
- get: function () { return reactRouter.defer; }
1661
- });
1662
- Object.defineProperty(exports, 'generatePath', {
1663
- enumerable: true,
1664
- get: function () { return reactRouter.generatePath; }
1665
- });
1666
- Object.defineProperty(exports, 'isRouteErrorResponse', {
1667
- enumerable: true,
1668
- get: function () { return reactRouter.isRouteErrorResponse; }
1669
- });
1670
- Object.defineProperty(exports, 'json', {
1671
- enumerable: true,
1672
- get: function () { return reactRouter.json; }
1673
- });
1674
- Object.defineProperty(exports, 'matchPath', {
1675
- enumerable: true,
1676
- get: function () { return reactRouter.matchPath; }
1677
- });
1678
- Object.defineProperty(exports, 'matchRoutes', {
1679
- enumerable: true,
1680
- get: function () { return reactRouter.matchRoutes; }
1681
- });
1682
- Object.defineProperty(exports, 'parsePath', {
1683
- enumerable: true,
1684
- get: function () { return reactRouter.parsePath; }
1685
- });
1686
- Object.defineProperty(exports, 'redirect', {
1687
- enumerable: true,
1688
- get: function () { return reactRouter.redirect; }
1689
- });
1690
- Object.defineProperty(exports, 'redirectDocument', {
1691
- enumerable: true,
1692
- get: function () { return reactRouter.redirectDocument; }
1693
- });
1694
- Object.defineProperty(exports, 'renderMatches', {
1695
- enumerable: true,
1696
- get: function () { return reactRouter.renderMatches; }
1697
- });
1698
- Object.defineProperty(exports, 'replace', {
1699
- enumerable: true,
1700
- get: function () { return reactRouter.replace; }
1701
- });
1702
- Object.defineProperty(exports, 'resolvePath', {
1703
- enumerable: true,
1704
- get: function () { return reactRouter.resolvePath; }
1705
- });
1706
- Object.defineProperty(exports, 'useActionData', {
1707
- enumerable: true,
1708
- get: function () { return reactRouter.useActionData; }
1709
- });
1710
- Object.defineProperty(exports, 'useAsyncError', {
1711
- enumerable: true,
1712
- get: function () { return reactRouter.useAsyncError; }
1713
- });
1714
- Object.defineProperty(exports, 'useAsyncValue', {
1715
- enumerable: true,
1716
- get: function () { return reactRouter.useAsyncValue; }
1717
- });
1718
- Object.defineProperty(exports, 'useBlocker', {
1719
- enumerable: true,
1720
- get: function () { return reactRouter.useBlocker; }
1721
- });
1722
- Object.defineProperty(exports, 'useHref', {
1723
- enumerable: true,
1724
- get: function () { return reactRouter.useHref; }
1725
- });
1726
- Object.defineProperty(exports, 'useInRouterContext', {
1727
- enumerable: true,
1728
- get: function () { return reactRouter.useInRouterContext; }
1729
- });
1730
- Object.defineProperty(exports, 'useLoaderData', {
1731
- enumerable: true,
1732
- get: function () { return reactRouter.useLoaderData; }
1733
- });
1734
- Object.defineProperty(exports, 'useLocation', {
1735
- enumerable: true,
1736
- get: function () { return reactRouter.useLocation; }
1737
- });
1738
- Object.defineProperty(exports, 'useMatch', {
1739
- enumerable: true,
1740
- get: function () { return reactRouter.useMatch; }
1741
- });
1742
- Object.defineProperty(exports, 'useMatches', {
1743
- enumerable: true,
1744
- get: function () { return reactRouter.useMatches; }
1745
- });
1746
- Object.defineProperty(exports, 'useNavigate', {
1747
- enumerable: true,
1748
- get: function () { return reactRouter.useNavigate; }
1749
- });
1750
- Object.defineProperty(exports, 'useNavigation', {
1751
- enumerable: true,
1752
- get: function () { return reactRouter.useNavigation; }
1753
- });
1754
- Object.defineProperty(exports, 'useNavigationType', {
1755
- enumerable: true,
1756
- get: function () { return reactRouter.useNavigationType; }
1757
- });
1758
- Object.defineProperty(exports, 'useOutlet', {
1759
- enumerable: true,
1760
- get: function () { return reactRouter.useOutlet; }
1761
- });
1762
- Object.defineProperty(exports, 'useOutletContext', {
1763
- enumerable: true,
1764
- get: function () { return reactRouter.useOutletContext; }
1765
- });
1766
- Object.defineProperty(exports, 'useParams', {
1767
- enumerable: true,
1768
- get: function () { return reactRouter.useParams; }
1769
- });
1770
- Object.defineProperty(exports, 'useResolvedPath', {
1771
- enumerable: true,
1772
- get: function () { return reactRouter.useResolvedPath; }
1773
- });
1774
- Object.defineProperty(exports, 'useRevalidator', {
1775
- enumerable: true,
1776
- get: function () { return reactRouter.useRevalidator; }
1777
- });
1778
- Object.defineProperty(exports, 'useRouteError', {
1779
- enumerable: true,
1780
- get: function () { return reactRouter.useRouteError; }
1781
- });
1782
- Object.defineProperty(exports, 'useRouteLoaderData', {
1783
- enumerable: true,
1784
- get: function () { return reactRouter.useRouteLoaderData; }
1785
- });
1786
- Object.defineProperty(exports, 'useRoutes', {
1787
- enumerable: true,
1788
- get: function () { return reactRouter.useRoutes; }
1789
- });
1790
- Object.defineProperty(exports, 'UNSAFE_ErrorResponseImpl', {
1791
- enumerable: true,
1792
- get: function () { return router.UNSAFE_ErrorResponseImpl; }
1793
- });
1794
- exports.BrowserRouter = BrowserRouter;
1795
- exports.Form = Form;
1796
- exports.HashRouter = HashRouter;
1797
- exports.Link = Link;
1798
- exports.NavLink = NavLink;
1799
- exports.RouterProvider = RouterProvider;
1800
- exports.ScrollRestoration = ScrollRestoration;
1801
- exports.UNSAFE_FetchersContext = FetchersContext;
1802
- exports.UNSAFE_ViewTransitionContext = ViewTransitionContext;
1803
- exports.UNSAFE_useScrollRestoration = useScrollRestoration;
1804
- exports.createBrowserRouter = createBrowserRouter;
1805
- exports.createHashRouter = createHashRouter;
1806
- exports.createSearchParams = createSearchParams;
1807
- exports.unstable_HistoryRouter = HistoryRouter;
1808
- exports.unstable_usePrompt = usePrompt;
1809
- exports.unstable_useViewTransitionState = useViewTransitionState;
1810
- exports.useBeforeUnload = useBeforeUnload;
1811
- exports.useFetcher = useFetcher;
1812
- exports.useFetchers = useFetchers;
1813
- exports.useFormAction = useFormAction;
1814
- exports.useLinkClickHandler = useLinkClickHandler;
1815
- exports.useSearchParams = useSearchParams;
1816
- exports.useSubmit = useSubmit;
1817
-
1818
- Object.defineProperty(exports, '__esModule', { value: true });
1819
-
1820
- }));
1821
- //# sourceMappingURL=react-router-dom.development.js.map