UNPKG

45.4 kBJavaScriptView Raw
1"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
2 * react-router v7.12.0
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
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53var _chunkZ47B263Njs = require('./chunk-Z47B263N.js');
54
55// lib/dom/dom.ts
56var defaultMethod = "get";
57var defaultEncType = "application/x-www-form-urlencoded";
58function isHtmlElement(object) {
59 return typeof HTMLElement !== "undefined" && object instanceof HTMLElement;
60}
61function isButtonElement(object) {
62 return isHtmlElement(object) && object.tagName.toLowerCase() === "button";
63}
64function isFormElement(object) {
65 return isHtmlElement(object) && object.tagName.toLowerCase() === "form";
66}
67function isInputElement(object) {
68 return isHtmlElement(object) && object.tagName.toLowerCase() === "input";
69}
70function isModifiedEvent(event) {
71 return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
72}
73function shouldProcessLinkClick(event, target) {
74 return event.button === 0 && // Ignore everything but left clicks
75 (!target || target === "_self") && // Let browser handle "target=_blank" etc.
76 !isModifiedEvent(event);
77}
78function createSearchParams(init = "") {
79 return new URLSearchParams(
80 typeof init === "string" || Array.isArray(init) || init instanceof URLSearchParams ? init : Object.keys(init).reduce((memo, key) => {
81 let value = init[key];
82 return memo.concat(
83 Array.isArray(value) ? value.map((v) => [key, v]) : [[key, value]]
84 );
85 }, [])
86 );
87}
88function getSearchParamsForLocation(locationSearch, defaultSearchParams) {
89 let searchParams = createSearchParams(locationSearch);
90 if (defaultSearchParams) {
91 defaultSearchParams.forEach((_, key) => {
92 if (!searchParams.has(key)) {
93 defaultSearchParams.getAll(key).forEach((value) => {
94 searchParams.append(key, value);
95 });
96 }
97 });
98 }
99 return searchParams;
100}
101var _formDataSupportsSubmitter = null;
102function isFormDataSubmitterSupported() {
103 if (_formDataSupportsSubmitter === null) {
104 try {
105 new FormData(
106 document.createElement("form"),
107 // @ts-expect-error if FormData supports the submitter parameter, this will throw
108 0
109 );
110 _formDataSupportsSubmitter = false;
111 } catch (e) {
112 _formDataSupportsSubmitter = true;
113 }
114 }
115 return _formDataSupportsSubmitter;
116}
117var supportedFormEncTypes = /* @__PURE__ */ new Set([
118 "application/x-www-form-urlencoded",
119 "multipart/form-data",
120 "text/plain"
121]);
122function getFormEncType(encType) {
123 if (encType != null && !supportedFormEncTypes.has(encType)) {
124 _chunkZ47B263Njs.warning.call(void 0,
125 false,
126 `"${encType}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${defaultEncType}"`
127 );
128 return null;
129 }
130 return encType;
131}
132function getFormSubmissionInfo(target, basename) {
133 let method;
134 let action;
135 let encType;
136 let formData;
137 let body;
138 if (isFormElement(target)) {
139 let attr = target.getAttribute("action");
140 action = attr ? _chunkZ47B263Njs.stripBasename.call(void 0, attr, basename) : null;
141 method = target.getAttribute("method") || defaultMethod;
142 encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType;
143 formData = new FormData(target);
144 } else if (isButtonElement(target) || isInputElement(target) && (target.type === "submit" || target.type === "image")) {
145 let form = target.form;
146 if (form == null) {
147 throw new Error(
148 `Cannot submit a <button> or <input type="submit"> without a <form>`
149 );
150 }
151 let attr = target.getAttribute("formaction") || form.getAttribute("action");
152 action = attr ? _chunkZ47B263Njs.stripBasename.call(void 0, attr, basename) : null;
153 method = target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod;
154 encType = getFormEncType(target.getAttribute("formenctype")) || getFormEncType(form.getAttribute("enctype")) || defaultEncType;
155 formData = new FormData(form, target);
156 if (!isFormDataSubmitterSupported()) {
157 let { name, type, value } = target;
158 if (type === "image") {
159 let prefix = name ? `${name}.` : "";
160 formData.append(`${prefix}x`, "0");
161 formData.append(`${prefix}y`, "0");
162 } else if (name) {
163 formData.append(name, value);
164 }
165 }
166 } else if (isHtmlElement(target)) {
167 throw new Error(
168 `Cannot submit element that is not <form>, <button>, or <input type="submit|image">`
169 );
170 } else {
171 method = defaultMethod;
172 action = null;
173 encType = defaultEncType;
174 body = target;
175 }
176 if (formData && encType === "text/plain") {
177 body = formData;
178 formData = void 0;
179 }
180 return { action, method: method.toLowerCase(), encType, formData, body };
181}
182
183// lib/dom/lib.tsx
184var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react);
185var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
186try {
187 if (isBrowser) {
188 window.__reactRouterVersion = // @ts-expect-error
189 "7.12.0";
190 }
191} catch (e) {
192}
193function createBrowserRouter(routes, opts) {
194 return _chunkZ47B263Njs.createRouter.call(void 0, {
195 basename: _optionalChain([opts, 'optionalAccess', _2 => _2.basename]),
196 getContext: _optionalChain([opts, 'optionalAccess', _3 => _3.getContext]),
197 future: _optionalChain([opts, 'optionalAccess', _4 => _4.future]),
198 history: _chunkZ47B263Njs.createBrowserHistory.call(void 0, { window: _optionalChain([opts, 'optionalAccess', _5 => _5.window]) }),
199 hydrationData: _optionalChain([opts, 'optionalAccess', _6 => _6.hydrationData]) || parseHydrationData(),
200 routes,
201 mapRouteProperties: _chunkZ47B263Njs.mapRouteProperties,
202 hydrationRouteProperties: _chunkZ47B263Njs.hydrationRouteProperties,
203 dataStrategy: _optionalChain([opts, 'optionalAccess', _7 => _7.dataStrategy]),
204 patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _8 => _8.patchRoutesOnNavigation]),
205 window: _optionalChain([opts, 'optionalAccess', _9 => _9.window]),
206 unstable_instrumentations: _optionalChain([opts, 'optionalAccess', _10 => _10.unstable_instrumentations])
207 }).initialize();
208}
209function createHashRouter(routes, opts) {
210 return _chunkZ47B263Njs.createRouter.call(void 0, {
211 basename: _optionalChain([opts, 'optionalAccess', _11 => _11.basename]),
212 getContext: _optionalChain([opts, 'optionalAccess', _12 => _12.getContext]),
213 future: _optionalChain([opts, 'optionalAccess', _13 => _13.future]),
214 history: _chunkZ47B263Njs.createHashHistory.call(void 0, { window: _optionalChain([opts, 'optionalAccess', _14 => _14.window]) }),
215 hydrationData: _optionalChain([opts, 'optionalAccess', _15 => _15.hydrationData]) || parseHydrationData(),
216 routes,
217 mapRouteProperties: _chunkZ47B263Njs.mapRouteProperties,
218 hydrationRouteProperties: _chunkZ47B263Njs.hydrationRouteProperties,
219 dataStrategy: _optionalChain([opts, 'optionalAccess', _16 => _16.dataStrategy]),
220 patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _17 => _17.patchRoutesOnNavigation]),
221 window: _optionalChain([opts, 'optionalAccess', _18 => _18.window]),
222 unstable_instrumentations: _optionalChain([opts, 'optionalAccess', _19 => _19.unstable_instrumentations])
223 }).initialize();
224}
225function parseHydrationData() {
226 let state = _optionalChain([window, 'optionalAccess', _20 => _20.__staticRouterHydrationData]);
227 if (state && state.errors) {
228 state = {
229 ...state,
230 errors: deserializeErrors(state.errors)
231 };
232 }
233 return state;
234}
235function deserializeErrors(errors) {
236 if (!errors) return null;
237 let entries = Object.entries(errors);
238 let serialized = {};
239 for (let [key, val] of entries) {
240 if (val && val.__type === "RouteErrorResponse") {
241 serialized[key] = new (0, _chunkZ47B263Njs.ErrorResponseImpl)(
242 val.status,
243 val.statusText,
244 val.data,
245 val.internal === true
246 );
247 } else if (val && val.__type === "Error") {
248 if (val.__subType) {
249 let ErrorConstructor = window[val.__subType];
250 if (typeof ErrorConstructor === "function") {
251 try {
252 let error = new ErrorConstructor(val.message);
253 error.stack = "";
254 serialized[key] = error;
255 } catch (e) {
256 }
257 }
258 }
259 if (serialized[key] == null) {
260 let error = new Error(val.message);
261 error.stack = "";
262 serialized[key] = error;
263 }
264 } else {
265 serialized[key] = val;
266 }
267 }
268 return serialized;
269}
270function BrowserRouter({
271 basename,
272 children,
273 unstable_useTransitions,
274 window: window2
275}) {
276 let historyRef = React.useRef();
277 if (historyRef.current == null) {
278 historyRef.current = _chunkZ47B263Njs.createBrowserHistory.call(void 0, { window: window2, v5Compat: true });
279 }
280 let history = historyRef.current;
281 let [state, setStateImpl] = React.useState({
282 action: history.action,
283 location: history.location
284 });
285 let setState = React.useCallback(
286 (newState) => {
287 if (unstable_useTransitions === false) {
288 setStateImpl(newState);
289 } else {
290 React.startTransition(() => setStateImpl(newState));
291 }
292 },
293 [unstable_useTransitions]
294 );
295 React.useLayoutEffect(() => history.listen(setState), [history, setState]);
296 return /* @__PURE__ */ React.createElement(
297 _chunkZ47B263Njs.Router,
298 {
299 basename,
300 children,
301 location: state.location,
302 navigationType: state.action,
303 navigator: history,
304 unstable_useTransitions
305 }
306 );
307}
308function HashRouter({
309 basename,
310 children,
311 unstable_useTransitions,
312 window: window2
313}) {
314 let historyRef = React.useRef();
315 if (historyRef.current == null) {
316 historyRef.current = _chunkZ47B263Njs.createHashHistory.call(void 0, { window: window2, v5Compat: true });
317 }
318 let history = historyRef.current;
319 let [state, setStateImpl] = React.useState({
320 action: history.action,
321 location: history.location
322 });
323 let setState = React.useCallback(
324 (newState) => {
325 if (unstable_useTransitions === false) {
326 setStateImpl(newState);
327 } else {
328 React.startTransition(() => setStateImpl(newState));
329 }
330 },
331 [unstable_useTransitions]
332 );
333 React.useLayoutEffect(() => history.listen(setState), [history, setState]);
334 return /* @__PURE__ */ React.createElement(
335 _chunkZ47B263Njs.Router,
336 {
337 basename,
338 children,
339 location: state.location,
340 navigationType: state.action,
341 navigator: history,
342 unstable_useTransitions
343 }
344 );
345}
346function HistoryRouter({
347 basename,
348 children,
349 history,
350 unstable_useTransitions
351}) {
352 let [state, setStateImpl] = React.useState({
353 action: history.action,
354 location: history.location
355 });
356 let setState = React.useCallback(
357 (newState) => {
358 if (unstable_useTransitions === false) {
359 setStateImpl(newState);
360 } else {
361 React.startTransition(() => setStateImpl(newState));
362 }
363 },
364 [unstable_useTransitions]
365 );
366 React.useLayoutEffect(() => history.listen(setState), [history, setState]);
367 return /* @__PURE__ */ React.createElement(
368 _chunkZ47B263Njs.Router,
369 {
370 basename,
371 children,
372 location: state.location,
373 navigationType: state.action,
374 navigator: history,
375 unstable_useTransitions
376 }
377 );
378}
379HistoryRouter.displayName = "unstable_HistoryRouter";
380var ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
381var Link = React.forwardRef(
382 function LinkWithRef({
383 onClick,
384 discover = "render",
385 prefetch = "none",
386 relative,
387 reloadDocument,
388 replace,
389 state,
390 target,
391 to,
392 preventScrollReset,
393 viewTransition,
394 unstable_defaultShouldRevalidate,
395 ...rest
396 }, forwardedRef) {
397 let { basename, unstable_useTransitions } = React.useContext(_chunkZ47B263Njs.NavigationContext);
398 let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX.test(to);
399 let parsed = _chunkZ47B263Njs.parseToInfo.call(void 0, to, basename);
400 to = parsed.to;
401 let href = _chunkZ47B263Njs.useHref.call(void 0, to, { relative });
402 let [shouldPrefetch, prefetchRef, prefetchHandlers] = _chunkZ47B263Njs.usePrefetchBehavior.call(void 0,
403 prefetch,
404 rest
405 );
406 let internalOnClick = useLinkClickHandler(to, {
407 replace,
408 state,
409 target,
410 preventScrollReset,
411 relative,
412 viewTransition,
413 unstable_defaultShouldRevalidate,
414 unstable_useTransitions
415 });
416 function handleClick(event) {
417 if (onClick) onClick(event);
418 if (!event.defaultPrevented) {
419 internalOnClick(event);
420 }
421 }
422 let link = (
423 // eslint-disable-next-line jsx-a11y/anchor-has-content
424 /* @__PURE__ */ React.createElement(
425 "a",
426 {
427 ...rest,
428 ...prefetchHandlers,
429 href: parsed.absoluteURL || href,
430 onClick: parsed.isExternal || reloadDocument ? onClick : handleClick,
431 ref: _chunkZ47B263Njs.mergeRefs.call(void 0, forwardedRef, prefetchRef),
432 target,
433 "data-discover": !isAbsolute && discover === "render" ? "true" : void 0
434 }
435 )
436 );
437 return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React.createElement(React.Fragment, null, link, /* @__PURE__ */ React.createElement(_chunkZ47B263Njs.PrefetchPageLinks, { page: href })) : link;
438 }
439);
440Link.displayName = "Link";
441var NavLink = React.forwardRef(
442 function NavLinkWithRef({
443 "aria-current": ariaCurrentProp = "page",
444 caseSensitive = false,
445 className: classNameProp = "",
446 end = false,
447 style: styleProp,
448 to,
449 viewTransition,
450 children,
451 ...rest
452 }, ref) {
453 let path = _chunkZ47B263Njs.useResolvedPath.call(void 0, to, { relative: rest.relative });
454 let location = _chunkZ47B263Njs.useLocation.call(void 0, );
455 let routerState = React.useContext(_chunkZ47B263Njs.DataRouterStateContext);
456 let { navigator, basename } = React.useContext(_chunkZ47B263Njs.NavigationContext);
457 let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static
458 // eslint-disable-next-line react-hooks/rules-of-hooks
459 useViewTransitionState(path) && viewTransition === true;
460 let toPathname = navigator.encodeLocation ? navigator.encodeLocation(path).pathname : path.pathname;
461 let locationPathname = location.pathname;
462 let nextLocationPathname = routerState && routerState.navigation && routerState.navigation.location ? routerState.navigation.location.pathname : null;
463 if (!caseSensitive) {
464 locationPathname = locationPathname.toLowerCase();
465 nextLocationPathname = nextLocationPathname ? nextLocationPathname.toLowerCase() : null;
466 toPathname = toPathname.toLowerCase();
467 }
468 if (nextLocationPathname && basename) {
469 nextLocationPathname = _chunkZ47B263Njs.stripBasename.call(void 0, nextLocationPathname, basename) || nextLocationPathname;
470 }
471 const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
472 let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/";
473 let isPending = nextLocationPathname != null && (nextLocationPathname === toPathname || !end && nextLocationPathname.startsWith(toPathname) && nextLocationPathname.charAt(toPathname.length) === "/");
474 let renderProps = {
475 isActive,
476 isPending,
477 isTransitioning
478 };
479 let ariaCurrent = isActive ? ariaCurrentProp : void 0;
480 let className;
481 if (typeof classNameProp === "function") {
482 className = classNameProp(renderProps);
483 } else {
484 className = [
485 classNameProp,
486 isActive ? "active" : null,
487 isPending ? "pending" : null,
488 isTransitioning ? "transitioning" : null
489 ].filter(Boolean).join(" ");
490 }
491 let style = typeof styleProp === "function" ? styleProp(renderProps) : styleProp;
492 return /* @__PURE__ */ React.createElement(
493 Link,
494 {
495 ...rest,
496 "aria-current": ariaCurrent,
497 className,
498 ref,
499 style,
500 to,
501 viewTransition
502 },
503 typeof children === "function" ? children(renderProps) : children
504 );
505 }
506);
507NavLink.displayName = "NavLink";
508var Form = React.forwardRef(
509 ({
510 discover = "render",
511 fetcherKey,
512 navigate,
513 reloadDocument,
514 replace,
515 state,
516 method = defaultMethod,
517 action,
518 onSubmit,
519 relative,
520 preventScrollReset,
521 viewTransition,
522 unstable_defaultShouldRevalidate,
523 ...props
524 }, forwardedRef) => {
525 let { unstable_useTransitions } = React.useContext(_chunkZ47B263Njs.NavigationContext);
526 let submit = useSubmit();
527 let formAction = useFormAction(action, { relative });
528 let formMethod = method.toLowerCase() === "get" ? "get" : "post";
529 let isAbsolute = typeof action === "string" && ABSOLUTE_URL_REGEX.test(action);
530 let submitHandler = (event) => {
531 onSubmit && onSubmit(event);
532 if (event.defaultPrevented) return;
533 event.preventDefault();
534 let submitter = event.nativeEvent.submitter;
535 let submitMethod = _optionalChain([submitter, 'optionalAccess', _21 => _21.getAttribute, 'call', _22 => _22("formmethod")]) || method;
536 let doSubmit = () => submit(submitter || event.currentTarget, {
537 fetcherKey,
538 method: submitMethod,
539 navigate,
540 replace,
541 state,
542 relative,
543 preventScrollReset,
544 viewTransition,
545 unstable_defaultShouldRevalidate
546 });
547 if (unstable_useTransitions && navigate !== false) {
548 React.startTransition(() => doSubmit());
549 } else {
550 doSubmit();
551 }
552 };
553 return /* @__PURE__ */ React.createElement(
554 "form",
555 {
556 ref: forwardedRef,
557 method: formMethod,
558 action: formAction,
559 onSubmit: reloadDocument ? onSubmit : submitHandler,
560 ...props,
561 "data-discover": !isAbsolute && discover === "render" ? "true" : void 0
562 }
563 );
564 }
565);
566Form.displayName = "Form";
567function ScrollRestoration({
568 getKey,
569 storageKey,
570 ...props
571}) {
572 let remixContext = React.useContext(_chunkZ47B263Njs.FrameworkContext);
573 let { basename } = React.useContext(_chunkZ47B263Njs.NavigationContext);
574 let location = _chunkZ47B263Njs.useLocation.call(void 0, );
575 let matches = _chunkZ47B263Njs.useMatches.call(void 0, );
576 useScrollRestoration({ getKey, storageKey });
577 let ssrKey = React.useMemo(
578 () => {
579 if (!remixContext || !getKey) return null;
580 let userKey = getScrollRestorationKey(
581 location,
582 matches,
583 basename,
584 getKey
585 );
586 return userKey !== location.key ? userKey : null;
587 },
588 // Nah, we only need this the first time for the SSR render
589 // eslint-disable-next-line react-hooks/exhaustive-deps
590 []
591 );
592 if (!remixContext || remixContext.isSpaMode) {
593 return null;
594 }
595 let restoreScroll = ((storageKey2, restoreKey) => {
596 if (!window.history.state || !window.history.state.key) {
597 let key = Math.random().toString(32).slice(2);
598 window.history.replaceState({ key }, "");
599 }
600 try {
601 let positions = JSON.parse(sessionStorage.getItem(storageKey2) || "{}");
602 let storedY = positions[restoreKey || window.history.state.key];
603 if (typeof storedY === "number") {
604 window.scrollTo(0, storedY);
605 }
606 } catch (error) {
607 console.error(error);
608 sessionStorage.removeItem(storageKey2);
609 }
610 }).toString();
611 return /* @__PURE__ */ React.createElement(
612 "script",
613 {
614 ...props,
615 suppressHydrationWarning: true,
616 dangerouslySetInnerHTML: {
617 __html: `(${restoreScroll})(${_chunkZ47B263Njs.escapeHtml.call(void 0,
618 JSON.stringify(storageKey || SCROLL_RESTORATION_STORAGE_KEY)
619 )}, ${_chunkZ47B263Njs.escapeHtml.call(void 0, JSON.stringify(ssrKey))})`
620 }
621 }
622 );
623}
624ScrollRestoration.displayName = "ScrollRestoration";
625function getDataRouterConsoleError(hookName) {
626 return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
627}
628function useDataRouterContext(hookName) {
629 let ctx = React.useContext(_chunkZ47B263Njs.DataRouterContext);
630 _chunkZ47B263Njs.invariant.call(void 0, ctx, getDataRouterConsoleError(hookName));
631 return ctx;
632}
633function useDataRouterState(hookName) {
634 let state = React.useContext(_chunkZ47B263Njs.DataRouterStateContext);
635 _chunkZ47B263Njs.invariant.call(void 0, state, getDataRouterConsoleError(hookName));
636 return state;
637}
638function useLinkClickHandler(to, {
639 target,
640 replace: replaceProp,
641 state,
642 preventScrollReset,
643 relative,
644 viewTransition,
645 unstable_defaultShouldRevalidate,
646 unstable_useTransitions
647} = {}) {
648 let navigate = _chunkZ47B263Njs.useNavigate.call(void 0, );
649 let location = _chunkZ47B263Njs.useLocation.call(void 0, );
650 let path = _chunkZ47B263Njs.useResolvedPath.call(void 0, to, { relative });
651 return React.useCallback(
652 (event) => {
653 if (shouldProcessLinkClick(event, target)) {
654 event.preventDefault();
655 let replace = replaceProp !== void 0 ? replaceProp : _chunkZ47B263Njs.createPath.call(void 0, location) === _chunkZ47B263Njs.createPath.call(void 0, path);
656 let doNavigate = () => navigate(to, {
657 replace,
658 state,
659 preventScrollReset,
660 relative,
661 viewTransition,
662 unstable_defaultShouldRevalidate
663 });
664 if (unstable_useTransitions) {
665 React.startTransition(() => doNavigate());
666 } else {
667 doNavigate();
668 }
669 }
670 },
671 [
672 location,
673 navigate,
674 path,
675 replaceProp,
676 state,
677 target,
678 to,
679 preventScrollReset,
680 relative,
681 viewTransition,
682 unstable_defaultShouldRevalidate,
683 unstable_useTransitions
684 ]
685 );
686}
687function useSearchParams(defaultInit) {
688 _chunkZ47B263Njs.warning.call(void 0,
689 typeof URLSearchParams !== "undefined",
690 `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.`
691 );
692 let defaultSearchParamsRef = React.useRef(createSearchParams(defaultInit));
693 let hasSetSearchParamsRef = React.useRef(false);
694 let location = _chunkZ47B263Njs.useLocation.call(void 0, );
695 let searchParams = React.useMemo(
696 () => (
697 // Only merge in the defaults if we haven't yet called setSearchParams.
698 // Once we call that we want those to take precedence, otherwise you can't
699 // remove a param with setSearchParams({}) if it has an initial value
700 getSearchParamsForLocation(
701 location.search,
702 hasSetSearchParamsRef.current ? null : defaultSearchParamsRef.current
703 )
704 ),
705 [location.search]
706 );
707 let navigate = _chunkZ47B263Njs.useNavigate.call(void 0, );
708 let setSearchParams = React.useCallback(
709 (nextInit, navigateOptions) => {
710 const newSearchParams = createSearchParams(
711 typeof nextInit === "function" ? nextInit(new URLSearchParams(searchParams)) : nextInit
712 );
713 hasSetSearchParamsRef.current = true;
714 navigate("?" + newSearchParams, navigateOptions);
715 },
716 [navigate, searchParams]
717 );
718 return [searchParams, setSearchParams];
719}
720var fetcherId = 0;
721var getUniqueFetcherId = () => `__${String(++fetcherId)}__`;
722function useSubmit() {
723 let { router } = useDataRouterContext("useSubmit" /* UseSubmit */);
724 let { basename } = React.useContext(_chunkZ47B263Njs.NavigationContext);
725 let currentRouteId = _chunkZ47B263Njs.useRouteId.call(void 0, );
726 let routerFetch = router.fetch;
727 let routerNavigate = router.navigate;
728 return React.useCallback(
729 async (target, options = {}) => {
730 let { action, method, encType, formData, body } = getFormSubmissionInfo(
731 target,
732 basename
733 );
734 if (options.navigate === false) {
735 let key = options.fetcherKey || getUniqueFetcherId();
736 await routerFetch(key, currentRouteId, options.action || action, {
737 unstable_defaultShouldRevalidate: options.unstable_defaultShouldRevalidate,
738 preventScrollReset: options.preventScrollReset,
739 formData,
740 body,
741 formMethod: options.method || method,
742 formEncType: options.encType || encType,
743 flushSync: options.flushSync
744 });
745 } else {
746 await routerNavigate(options.action || action, {
747 unstable_defaultShouldRevalidate: options.unstable_defaultShouldRevalidate,
748 preventScrollReset: options.preventScrollReset,
749 formData,
750 body,
751 formMethod: options.method || method,
752 formEncType: options.encType || encType,
753 replace: options.replace,
754 state: options.state,
755 fromRouteId: currentRouteId,
756 flushSync: options.flushSync,
757 viewTransition: options.viewTransition
758 });
759 }
760 },
761 [routerFetch, routerNavigate, basename, currentRouteId]
762 );
763}
764function useFormAction(action, { relative } = {}) {
765 let { basename } = React.useContext(_chunkZ47B263Njs.NavigationContext);
766 let routeContext = React.useContext(_chunkZ47B263Njs.RouteContext);
767 _chunkZ47B263Njs.invariant.call(void 0, routeContext, "useFormAction must be used inside a RouteContext");
768 let [match] = routeContext.matches.slice(-1);
769 let path = { ..._chunkZ47B263Njs.useResolvedPath.call(void 0, action ? action : ".", { relative }) };
770 let location = _chunkZ47B263Njs.useLocation.call(void 0, );
771 if (action == null) {
772 path.search = location.search;
773 let params = new URLSearchParams(path.search);
774 let indexValues = params.getAll("index");
775 let hasNakedIndexParam = indexValues.some((v) => v === "");
776 if (hasNakedIndexParam) {
777 params.delete("index");
778 indexValues.filter((v) => v).forEach((v) => params.append("index", v));
779 let qs = params.toString();
780 path.search = qs ? `?${qs}` : "";
781 }
782 }
783 if ((!action || action === ".") && match.route.index) {
784 path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
785 }
786 if (basename !== "/") {
787 path.pathname = path.pathname === "/" ? basename : _chunkZ47B263Njs.joinPaths.call(void 0, [basename, path.pathname]);
788 }
789 return _chunkZ47B263Njs.createPath.call(void 0, path);
790}
791function useFetcher({
792 key
793} = {}) {
794 let { router } = useDataRouterContext("useFetcher" /* UseFetcher */);
795 let state = useDataRouterState("useFetcher" /* UseFetcher */);
796 let fetcherData = React.useContext(_chunkZ47B263Njs.FetchersContext);
797 let route = React.useContext(_chunkZ47B263Njs.RouteContext);
798 let routeId = _optionalChain([route, 'access', _23 => _23.matches, 'access', _24 => _24[route.matches.length - 1], 'optionalAccess', _25 => _25.route, 'access', _26 => _26.id]);
799 _chunkZ47B263Njs.invariant.call(void 0, fetcherData, `useFetcher must be used inside a FetchersContext`);
800 _chunkZ47B263Njs.invariant.call(void 0, route, `useFetcher must be used inside a RouteContext`);
801 _chunkZ47B263Njs.invariant.call(void 0,
802 routeId != null,
803 `useFetcher can only be used on routes that contain a unique "id"`
804 );
805 let defaultKey = React.useId();
806 let [fetcherKey, setFetcherKey] = React.useState(key || defaultKey);
807 if (key && key !== fetcherKey) {
808 setFetcherKey(key);
809 }
810 let { deleteFetcher, getFetcher, resetFetcher, fetch: routerFetch } = router;
811 React.useEffect(() => {
812 getFetcher(fetcherKey);
813 return () => deleteFetcher(fetcherKey);
814 }, [deleteFetcher, getFetcher, fetcherKey]);
815 let load = React.useCallback(
816 async (href, opts) => {
817 _chunkZ47B263Njs.invariant.call(void 0, routeId, "No routeId available for fetcher.load()");
818 await routerFetch(fetcherKey, routeId, href, opts);
819 },
820 [fetcherKey, routeId, routerFetch]
821 );
822 let submitImpl = useSubmit();
823 let submit = React.useCallback(
824 async (target, opts) => {
825 await submitImpl(target, {
826 ...opts,
827 navigate: false,
828 fetcherKey
829 });
830 },
831 [fetcherKey, submitImpl]
832 );
833 let reset = React.useCallback(
834 (opts) => resetFetcher(fetcherKey, opts),
835 [resetFetcher, fetcherKey]
836 );
837 let FetcherForm = React.useMemo(() => {
838 let FetcherForm2 = React.forwardRef(
839 (props, ref) => {
840 return /* @__PURE__ */ React.createElement(Form, { ...props, navigate: false, fetcherKey, ref });
841 }
842 );
843 FetcherForm2.displayName = "fetcher.Form";
844 return FetcherForm2;
845 }, [fetcherKey]);
846 let fetcher = state.fetchers.get(fetcherKey) || _chunkZ47B263Njs.IDLE_FETCHER;
847 let data = fetcherData.get(fetcherKey);
848 let fetcherWithComponents = React.useMemo(
849 () => ({
850 Form: FetcherForm,
851 submit,
852 load,
853 reset,
854 ...fetcher,
855 data
856 }),
857 [FetcherForm, submit, load, reset, fetcher, data]
858 );
859 return fetcherWithComponents;
860}
861function useFetchers() {
862 let state = useDataRouterState("useFetchers" /* UseFetchers */);
863 return Array.from(state.fetchers.entries()).map(([key, fetcher]) => ({
864 ...fetcher,
865 key
866 }));
867}
868var SCROLL_RESTORATION_STORAGE_KEY = "react-router-scroll-positions";
869var savedScrollPositions = {};
870function getScrollRestorationKey(location, matches, basename, getKey) {
871 let key = null;
872 if (getKey) {
873 if (basename !== "/") {
874 key = getKey(
875 {
876 ...location,
877 pathname: _chunkZ47B263Njs.stripBasename.call(void 0, location.pathname, basename) || location.pathname
878 },
879 matches
880 );
881 } else {
882 key = getKey(location, matches);
883 }
884 }
885 if (key == null) {
886 key = location.key;
887 }
888 return key;
889}
890function useScrollRestoration({
891 getKey,
892 storageKey
893} = {}) {
894 let { router } = useDataRouterContext("useScrollRestoration" /* UseScrollRestoration */);
895 let { restoreScrollPosition, preventScrollReset } = useDataRouterState(
896 "useScrollRestoration" /* UseScrollRestoration */
897 );
898 let { basename } = React.useContext(_chunkZ47B263Njs.NavigationContext);
899 let location = _chunkZ47B263Njs.useLocation.call(void 0, );
900 let matches = _chunkZ47B263Njs.useMatches.call(void 0, );
901 let navigation = _chunkZ47B263Njs.useNavigation.call(void 0, );
902 React.useEffect(() => {
903 window.history.scrollRestoration = "manual";
904 return () => {
905 window.history.scrollRestoration = "auto";
906 };
907 }, []);
908 usePageHide(
909 React.useCallback(() => {
910 if (navigation.state === "idle") {
911 let key = getScrollRestorationKey(location, matches, basename, getKey);
912 savedScrollPositions[key] = window.scrollY;
913 }
914 try {
915 sessionStorage.setItem(
916 storageKey || SCROLL_RESTORATION_STORAGE_KEY,
917 JSON.stringify(savedScrollPositions)
918 );
919 } catch (error) {
920 _chunkZ47B263Njs.warning.call(void 0,
921 false,
922 `Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${error}).`
923 );
924 }
925 window.history.scrollRestoration = "auto";
926 }, [navigation.state, getKey, basename, location, matches, storageKey])
927 );
928 if (typeof document !== "undefined") {
929 React.useLayoutEffect(() => {
930 try {
931 let sessionPositions = sessionStorage.getItem(
932 storageKey || SCROLL_RESTORATION_STORAGE_KEY
933 );
934 if (sessionPositions) {
935 savedScrollPositions = JSON.parse(sessionPositions);
936 }
937 } catch (e) {
938 }
939 }, [storageKey]);
940 React.useLayoutEffect(() => {
941 let disableScrollRestoration = _optionalChain([router, 'optionalAccess', _27 => _27.enableScrollRestoration, 'call', _28 => _28(
942 savedScrollPositions,
943 () => window.scrollY,
944 getKey ? (location2, matches2) => getScrollRestorationKey(location2, matches2, basename, getKey) : void 0
945 )]);
946 return () => disableScrollRestoration && disableScrollRestoration();
947 }, [router, basename, getKey]);
948 React.useLayoutEffect(() => {
949 if (restoreScrollPosition === false) {
950 return;
951 }
952 if (typeof restoreScrollPosition === "number") {
953 window.scrollTo(0, restoreScrollPosition);
954 return;
955 }
956 try {
957 if (location.hash) {
958 let el = document.getElementById(
959 decodeURIComponent(location.hash.slice(1))
960 );
961 if (el) {
962 el.scrollIntoView();
963 return;
964 }
965 }
966 } catch (e2) {
967 _chunkZ47B263Njs.warning.call(void 0,
968 false,
969 `"${location.hash.slice(
970 1
971 )}" is not a decodable element ID. The view will not scroll to it.`
972 );
973 }
974 if (preventScrollReset === true) {
975 return;
976 }
977 window.scrollTo(0, 0);
978 }, [location, restoreScrollPosition, preventScrollReset]);
979 }
980}
981function useBeforeUnload(callback, options) {
982 let { capture } = options || {};
983 React.useEffect(() => {
984 let opts = capture != null ? { capture } : void 0;
985 window.addEventListener("beforeunload", callback, opts);
986 return () => {
987 window.removeEventListener("beforeunload", callback, opts);
988 };
989 }, [callback, capture]);
990}
991function usePageHide(callback, options) {
992 let { capture } = options || {};
993 React.useEffect(() => {
994 let opts = capture != null ? { capture } : void 0;
995 window.addEventListener("pagehide", callback, opts);
996 return () => {
997 window.removeEventListener("pagehide", callback, opts);
998 };
999 }, [callback, capture]);
1000}
1001function usePrompt({
1002 when,
1003 message
1004}) {
1005 let blocker = _chunkZ47B263Njs.useBlocker.call(void 0, when);
1006 React.useEffect(() => {
1007 if (blocker.state === "blocked") {
1008 let proceed = window.confirm(message);
1009 if (proceed) {
1010 setTimeout(blocker.proceed, 0);
1011 } else {
1012 blocker.reset();
1013 }
1014 }
1015 }, [blocker, message]);
1016 React.useEffect(() => {
1017 if (blocker.state === "blocked" && !when) {
1018 blocker.reset();
1019 }
1020 }, [blocker, when]);
1021}
1022function useViewTransitionState(to, { relative } = {}) {
1023 let vtContext = React.useContext(_chunkZ47B263Njs.ViewTransitionContext);
1024 _chunkZ47B263Njs.invariant.call(void 0,
1025 vtContext != null,
1026 "`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
1027 );
1028 let { basename } = useDataRouterContext(
1029 "useViewTransitionState" /* useViewTransitionState */
1030 );
1031 let path = _chunkZ47B263Njs.useResolvedPath.call(void 0, to, { relative });
1032 if (!vtContext.isTransitioning) {
1033 return false;
1034 }
1035 let currentPath = _chunkZ47B263Njs.stripBasename.call(void 0, vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;
1036 let nextPath = _chunkZ47B263Njs.stripBasename.call(void 0, vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;
1037 return _chunkZ47B263Njs.matchPath.call(void 0, path.pathname, nextPath) != null || _chunkZ47B263Njs.matchPath.call(void 0, path.pathname, currentPath) != null;
1038}
1039
1040// lib/dom/server.tsx
1041
1042function StaticRouter({
1043 basename,
1044 children,
1045 location: locationProp = "/"
1046}) {
1047 if (typeof locationProp === "string") {
1048 locationProp = _chunkZ47B263Njs.parsePath.call(void 0, locationProp);
1049 }
1050 let action = "POP" /* Pop */;
1051 let location = {
1052 pathname: locationProp.pathname || "/",
1053 search: locationProp.search || "",
1054 hash: locationProp.hash || "",
1055 state: locationProp.state != null ? locationProp.state : null,
1056 key: locationProp.key || "default"
1057 };
1058 let staticNavigator = getStatelessNavigator();
1059 return /* @__PURE__ */ React2.createElement(
1060 _chunkZ47B263Njs.Router,
1061 {
1062 basename,
1063 children,
1064 location,
1065 navigationType: action,
1066 navigator: staticNavigator,
1067 static: true,
1068 unstable_useTransitions: false
1069 }
1070 );
1071}
1072function StaticRouterProvider({
1073 context,
1074 router,
1075 hydrate = true,
1076 nonce
1077}) {
1078 _chunkZ47B263Njs.invariant.call(void 0,
1079 router && context,
1080 "You must provide `router` and `context` to <StaticRouterProvider>"
1081 );
1082 let dataRouterContext = {
1083 router,
1084 navigator: getStatelessNavigator(),
1085 static: true,
1086 staticContext: context,
1087 basename: context.basename || "/"
1088 };
1089 let fetchersContext = /* @__PURE__ */ new Map();
1090 let hydrateScript = "";
1091 if (hydrate !== false) {
1092 let data = {
1093 loaderData: context.loaderData,
1094 actionData: context.actionData,
1095 errors: serializeErrors(context.errors)
1096 };
1097 let json = _chunkZ47B263Njs.escapeHtml.call(void 0, JSON.stringify(JSON.stringify(data)));
1098 hydrateScript = `window.__staticRouterHydrationData = JSON.parse(${json});`;
1099 }
1100 let { state } = dataRouterContext.router;
1101 return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(_chunkZ47B263Njs.DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React2.createElement(_chunkZ47B263Njs.DataRouterStateContext.Provider, { value: state }, /* @__PURE__ */ React2.createElement(_chunkZ47B263Njs.FetchersContext.Provider, { value: fetchersContext }, /* @__PURE__ */ React2.createElement(_chunkZ47B263Njs.ViewTransitionContext.Provider, { value: { isTransitioning: false } }, /* @__PURE__ */ React2.createElement(
1102 _chunkZ47B263Njs.Router,
1103 {
1104 basename: dataRouterContext.basename,
1105 location: state.location,
1106 navigationType: state.historyAction,
1107 navigator: dataRouterContext.navigator,
1108 static: dataRouterContext.static,
1109 unstable_useTransitions: false
1110 },
1111 /* @__PURE__ */ React2.createElement(
1112 DataRoutes,
1113 {
1114 routes: router.routes,
1115 future: router.future,
1116 state
1117 }
1118 )
1119 ))))), hydrateScript ? /* @__PURE__ */ React2.createElement(
1120 "script",
1121 {
1122 suppressHydrationWarning: true,
1123 nonce,
1124 dangerouslySetInnerHTML: { __html: hydrateScript }
1125 }
1126 ) : null);
1127}
1128function DataRoutes({
1129 routes,
1130 future,
1131 state
1132}) {
1133 return _chunkZ47B263Njs.useRoutesImpl.call(void 0, routes, void 0, state, void 0, future);
1134}
1135function serializeErrors(errors) {
1136 if (!errors) return null;
1137 let entries = Object.entries(errors);
1138 let serialized = {};
1139 for (let [key, val] of entries) {
1140 if (_chunkZ47B263Njs.isRouteErrorResponse.call(void 0, val)) {
1141 serialized[key] = { ...val, __type: "RouteErrorResponse" };
1142 } else if (val instanceof Error) {
1143 serialized[key] = {
1144 message: val.message,
1145 __type: "Error",
1146 // If this is a subclass (i.e., ReferenceError), send up the type so we
1147 // can re-create the same type during hydration.
1148 ...val.name !== "Error" ? {
1149 __subType: val.name
1150 } : {}
1151 };
1152 } else {
1153 serialized[key] = val;
1154 }
1155 }
1156 return serialized;
1157}
1158function getStatelessNavigator() {
1159 return {
1160 createHref,
1161 encodeLocation,
1162 push(to) {
1163 throw new Error(
1164 `You cannot use navigator.push() on the server because it is a stateless environment. This error was probably triggered when you did a \`navigate(${JSON.stringify(to)})\` somewhere in your app.`
1165 );
1166 },
1167 replace(to) {
1168 throw new Error(
1169 `You cannot use navigator.replace() on the server because it is a stateless environment. This error was probably triggered when you did a \`navigate(${JSON.stringify(to)}, { replace: true })\` somewhere in your app.`
1170 );
1171 },
1172 go(delta) {
1173 throw new Error(
1174 `You cannot use navigator.go() on the server because it is a stateless environment. This error was probably triggered when you did a \`navigate(${delta})\` somewhere in your app.`
1175 );
1176 },
1177 back() {
1178 throw new Error(
1179 `You cannot use navigator.back() on the server because it is a stateless environment.`
1180 );
1181 },
1182 forward() {
1183 throw new Error(
1184 `You cannot use navigator.forward() on the server because it is a stateless environment.`
1185 );
1186 }
1187 };
1188}
1189function createStaticHandler2(routes, opts) {
1190 return _chunkZ47B263Njs.createStaticHandler.call(void 0, routes, {
1191 ...opts,
1192 mapRouteProperties: _chunkZ47B263Njs.mapRouteProperties
1193 });
1194}
1195function createStaticRouter(routes, context, opts = {}) {
1196 let manifest = {};
1197 let dataRoutes = _chunkZ47B263Njs.convertRoutesToDataRoutes.call(void 0,
1198 routes,
1199 _chunkZ47B263Njs.mapRouteProperties,
1200 void 0,
1201 manifest
1202 );
1203 let matches = context.matches.map((match) => {
1204 let route = manifest[match.route.id] || match.route;
1205 return {
1206 ...match,
1207 route
1208 };
1209 });
1210 let msg = (method) => `You cannot use router.${method}() on the server because it is a stateless environment`;
1211 return {
1212 get basename() {
1213 return context.basename;
1214 },
1215 get future() {
1216 return {
1217 v8_middleware: false,
1218 ..._optionalChain([opts, 'optionalAccess', _29 => _29.future])
1219 };
1220 },
1221 get state() {
1222 return {
1223 historyAction: "POP" /* Pop */,
1224 location: context.location,
1225 matches,
1226 loaderData: context.loaderData,
1227 actionData: context.actionData,
1228 errors: context.errors,
1229 initialized: true,
1230 navigation: _chunkZ47B263Njs.IDLE_NAVIGATION,
1231 restoreScrollPosition: null,
1232 preventScrollReset: false,
1233 revalidation: "idle",
1234 fetchers: /* @__PURE__ */ new Map(),
1235 blockers: /* @__PURE__ */ new Map()
1236 };
1237 },
1238 get routes() {
1239 return dataRoutes;
1240 },
1241 get window() {
1242 return void 0;
1243 },
1244 initialize() {
1245 throw msg("initialize");
1246 },
1247 subscribe() {
1248 throw msg("subscribe");
1249 },
1250 enableScrollRestoration() {
1251 throw msg("enableScrollRestoration");
1252 },
1253 navigate() {
1254 throw msg("navigate");
1255 },
1256 fetch() {
1257 throw msg("fetch");
1258 },
1259 revalidate() {
1260 throw msg("revalidate");
1261 },
1262 createHref,
1263 encodeLocation,
1264 getFetcher() {
1265 return _chunkZ47B263Njs.IDLE_FETCHER;
1266 },
1267 deleteFetcher() {
1268 throw msg("deleteFetcher");
1269 },
1270 resetFetcher() {
1271 throw msg("resetFetcher");
1272 },
1273 dispose() {
1274 throw msg("dispose");
1275 },
1276 getBlocker() {
1277 return _chunkZ47B263Njs.IDLE_BLOCKER;
1278 },
1279 deleteBlocker() {
1280 throw msg("deleteBlocker");
1281 },
1282 patchRoutes() {
1283 throw msg("patchRoutes");
1284 },
1285 _internalFetchControllers: /* @__PURE__ */ new Map(),
1286 _internalSetRoutes() {
1287 throw msg("_internalSetRoutes");
1288 },
1289 _internalSetStateDoNotUseOrYouWillBreakYourApp() {
1290 throw msg("_internalSetStateDoNotUseOrYouWillBreakYourApp");
1291 }
1292 };
1293}
1294function createHref(to) {
1295 return typeof to === "string" ? to : _chunkZ47B263Njs.createPath.call(void 0, to);
1296}
1297function encodeLocation(to) {
1298 let href = typeof to === "string" ? to : _chunkZ47B263Njs.createPath.call(void 0, to);
1299 href = href.replace(/ $/, "%20");
1300 let encoded = ABSOLUTE_URL_REGEX2.test(href) ? new URL(href) : new URL(href, "http://localhost");
1301 return {
1302 pathname: encoded.pathname,
1303 search: encoded.search,
1304 hash: encoded.hash
1305 };
1306}
1307var ABSOLUTE_URL_REGEX2 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334exports.createSearchParams = createSearchParams; exports.createBrowserRouter = createBrowserRouter; exports.createHashRouter = createHashRouter; exports.BrowserRouter = BrowserRouter; exports.HashRouter = HashRouter; exports.HistoryRouter = HistoryRouter; exports.Link = Link; exports.NavLink = NavLink; exports.Form = Form; exports.ScrollRestoration = ScrollRestoration; exports.useLinkClickHandler = useLinkClickHandler; exports.useSearchParams = useSearchParams; exports.useSubmit = useSubmit; exports.useFormAction = useFormAction; exports.useFetcher = useFetcher; exports.useFetchers = useFetchers; exports.useScrollRestoration = useScrollRestoration; exports.useBeforeUnload = useBeforeUnload; exports.usePrompt = usePrompt; exports.useViewTransitionState = useViewTransitionState; exports.StaticRouter = StaticRouter; exports.StaticRouterProvider = StaticRouterProvider; exports.createStaticHandler = createStaticHandler2; exports.createStaticRouter = createStaticRouter;