Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-router-dom

Package Overview
Dependencies
Maintainers
3
Versions
462
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-router-dom - npm Package Compare versions

Comparing version 6.4.1 to 6.4.2-pre.0

11

CHANGELOG.md
# `react-router-dom`
## 6.4.2-pre.0
### Patch Changes
- fix: respect `basename` in `useFormAction` ([#9352](https://github.com/remix-run/react-router/pull/9352))
- docs: Enhance console error messages for invalid usage of data router hooks ([#9311](https://github.com/remix-run/react-router/pull/9311))
- fix: Strengthen `RouteObject`/`RouteProps` types and throw on `index` routes with `children` ([#9366](https://github.com/remix-run/react-router/pull/9366))
- Updated dependencies:
- `react-router@6.4.2-pre.0`
- `@remix-run/router@1.0.2-pre.0`
## 6.4.1

@@ -4,0 +15,0 @@

2

dist/index.d.ts

@@ -12,3 +12,3 @@ /**

export { createSearchParams };
export type { ActionFunction, ActionFunctionArgs, AwaitProps, DataRouteMatch, DataRouteObject, Fetcher, Hash, IndexRouteProps, JsonFunction, LayoutRouteProps, LoaderFunction, LoaderFunctionArgs, Location, MemoryRouterProps, NavigateFunction, NavigateOptions, NavigateProps, Navigation, Navigator, OutletProps, Params, ParamParseKey, Path, PathMatch, Pathname, PathPattern, PathRouteProps, RedirectFunction, RelativeRoutingType, RouteMatch, RouteObject, RouteProps, RouterProps, RouterProviderProps, RoutesProps, Search, ShouldRevalidateFunction, To, } from "react-router";
export type { ActionFunction, ActionFunctionArgs, AwaitProps, DataRouteMatch, DataRouteObject, Fetcher, Hash, IndexRouteObject, IndexRouteProps, JsonFunction, LayoutRouteProps, LoaderFunction, LoaderFunctionArgs, Location, MemoryRouterProps, NavigateFunction, NavigateOptions, NavigateProps, Navigation, Navigator, NonIndexRouteObject, OutletProps, Params, ParamParseKey, Path, PathMatch, Pathname, PathPattern, PathRouteProps, RedirectFunction, RelativeRoutingType, RouteMatch, RouteObject, RouteProps, RouterProps, RouterProviderProps, RoutesProps, Search, ShouldRevalidateFunction, To, } from "react-router";
export { AbortedDeferredError, Await, MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, RouterProvider, Routes, createMemoryRouter, createPath, createRoutesFromChildren, createRoutesFromElements, defer, isRouteErrorResponse, generatePath, json, matchPath, matchRoutes, parsePath, redirect, renderMatches, resolvePath, useActionData, useAsyncError, useAsyncValue, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes, } from "react-router";

@@ -15,0 +15,0 @@ /** @internal */

/**
* React Router DOM v6.4.1
* React Router DOM v6.4.2-pre.0
*

@@ -12,5 +12,5 @@ * Copyright (c) Remix Software Inc.

import * as React from 'react';
import { UNSAFE_enhanceManualRouteObjects, Router, useHref, createPath, useResolvedPath, useMatch, UNSAFE_DataRouterStateContext, useNavigate, useLocation, UNSAFE_DataRouterContext, UNSAFE_RouteContext, useMatches, useNavigation } from 'react-router';
import { UNSAFE_enhanceManualRouteObjects, Router, useHref, createPath, useResolvedPath, useMatch, UNSAFE_DataRouterStateContext, useNavigate, useLocation, UNSAFE_NavigationContext, UNSAFE_RouteContext, useMatches, useNavigation, UNSAFE_DataRouterContext } from 'react-router';
export { AbortedDeferredError, Await, MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, RouterProvider, Routes, UNSAFE_DataRouterContext, UNSAFE_DataRouterStateContext, UNSAFE_DataStaticRouterContext, UNSAFE_LocationContext, UNSAFE_NavigationContext, UNSAFE_RouteContext, UNSAFE_enhanceManualRouteObjects, createMemoryRouter, createPath, createRoutesFromChildren, createRoutesFromElements, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, renderMatches, resolvePath, useActionData, useAsyncError, useAsyncValue, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes } from 'react-router';
import { createRouter, createBrowserHistory, createHashHistory, matchPath, invariant } from '@remix-run/router';
import { createRouter, createBrowserHistory, createHashHistory, matchPath, invariant, joinPaths } from '@remix-run/router';

@@ -521,2 +521,33 @@ function _extends() {

var DataRouterHook;
(function (DataRouterHook) {
DataRouterHook["UseScrollRestoration"] = "useScrollRestoration";
DataRouterHook["UseSubmitImpl"] = "useSubmitImpl";
DataRouterHook["UseFetcher"] = "useFetcher";
})(DataRouterHook || (DataRouterHook = {}));
var DataRouterStateHook;
(function (DataRouterStateHook) {
DataRouterStateHook["UseFetchers"] = "useFetchers";
DataRouterStateHook["UseScrollRestoration"] = "useScrollRestoration";
})(DataRouterStateHook || (DataRouterStateHook = {}));
function getDataRouterConsoleError(hookName) {
return hookName + " must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.";
}
function useDataRouterContext(hookName) {
let ctx = React.useContext(UNSAFE_DataRouterContext);
!ctx ? process.env.NODE_ENV !== "production" ? invariant(false, getDataRouterConsoleError(hookName)) : invariant(false) : void 0;
return ctx;
}
function useDataRouterState(hookName) {
let state = React.useContext(UNSAFE_DataRouterStateContext);
!state ? process.env.NODE_ENV !== "production" ? invariant(false, getDataRouterConsoleError(hookName)) : invariant(false) : void 0;
return state;
}
/**

@@ -584,7 +615,5 @@ * Handles the click behavior for router `<Link>` components. This is useful if

function useSubmitImpl(fetcherKey, routeId) {
let dataRouterContext = React.useContext(UNSAFE_DataRouterContext);
!dataRouterContext ? process.env.NODE_ENV !== "production" ? invariant(false, "useSubmitImpl must be used within a Data Router") : invariant(false) : void 0;
let {
router
} = dataRouterContext;
} = useDataRouterContext(DataRouterHook.UseSubmitImpl);
let defaultAction = useFormAction();

@@ -627,9 +656,14 @@ return React.useCallback(function (target, options) {

} = _temp2 === void 0 ? {} : _temp2;
let {
basename
} = React.useContext(UNSAFE_NavigationContext);
let routeContext = React.useContext(UNSAFE_RouteContext);
!routeContext ? process.env.NODE_ENV !== "production" ? invariant(false, "useFormAction must be used inside a RouteContext") : invariant(false) : void 0;
let [match] = routeContext.matches.slice(-1);
let resolvedAction = action != null ? action : ".";
let path = useResolvedPath(resolvedAction, {
let resolvedAction = action != null ? action : "."; // Shallow clone path so we can modify it below, otherwise we modify the
// object referenced by useMemo inside useResolvedPath
let path = _extends({}, useResolvedPath(resolvedAction, {
relative
}); // Previously we set the default action to ".". The problem with this is that
})); // Previously we set the default action to ".". The problem with this is that
// `useResolvedPath(".")` excludes search params and the hash of the resolved

@@ -640,2 +674,3 @@ // URL. This is the intended behavior of when "." is specifically provided as

let location = useLocation();

@@ -661,2 +696,10 @@

path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
} // If we're operating within a basename, prepend it to the pathname prior
// to creating the form action. If this is a root navigation, then just use
// the raw basename which allows the basename to have full control over the
// presence of a trailing slash on root actions
if (basename !== "/") {
path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
}

@@ -692,7 +735,5 @@

let dataRouterContext = React.useContext(UNSAFE_DataRouterContext);
!dataRouterContext ? process.env.NODE_ENV !== "production" ? invariant(false, "useFetcher must be used within a Data Router") : invariant(false) : void 0;
let {
router
} = dataRouterContext;
} = useDataRouterContext(DataRouterHook.UseFetcher);
let route = React.useContext(UNSAFE_RouteContext);

@@ -740,4 +781,3 @@ !route ? process.env.NODE_ENV !== "production" ? invariant(false, "useFetcher must be used inside a RouteContext") : invariant(false) : void 0;

function useFetchers() {
let state = React.useContext(UNSAFE_DataRouterStateContext);
!state ? process.env.NODE_ENV !== "production" ? invariant(false, "useFetchers must be used within a DataRouterStateContext") : invariant(false) : void 0;
let state = useDataRouterState(DataRouterStateHook.UseFetchers);
return [...state.fetchers.values()];

@@ -756,16 +796,12 @@ }

} = _temp3 === void 0 ? {} : _temp3;
let location = useLocation();
let matches = useMatches();
let navigation = useNavigation();
let dataRouterContext = React.useContext(UNSAFE_DataRouterContext);
!dataRouterContext ? process.env.NODE_ENV !== "production" ? invariant(false, "useScrollRestoration must be used within a DataRouterContext") : invariant(false) : void 0;
let {
router
} = dataRouterContext;
let state = React.useContext(UNSAFE_DataRouterStateContext);
!(router != null && state != null) ? process.env.NODE_ENV !== "production" ? invariant(false, "useScrollRestoration must be used within a DataRouterStateContext") : invariant(false) : void 0;
} = useDataRouterContext(DataRouterHook.UseScrollRestoration);
let {
restoreScrollPosition,
preventScrollReset
} = state; // Trigger manual scroll restoration while we're active
} = useDataRouterState(DataRouterStateHook.UseScrollRestoration);
let location = useLocation();
let matches = useMatches();
let navigation = useNavigation(); // Trigger manual scroll restoration while we're active

@@ -772,0 +808,0 @@ React.useEffect(() => {

/**
* React Router DOM v6.4.1
* React Router DOM v6.4.2-pre.0
*

@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc.

/**
* React Router DOM v6.4.1
* React Router DOM v6.4.2-pre.0
*

@@ -12,5 +12,5 @@ * Copyright (c) Remix Software Inc.

import * as React from 'react';
import { UNSAFE_enhanceManualRouteObjects, Router, useHref, createPath, useResolvedPath, useMatch, UNSAFE_DataRouterStateContext, useNavigate, useLocation, UNSAFE_DataRouterContext, UNSAFE_RouteContext, useMatches, useNavigation } from 'react-router';
import { UNSAFE_enhanceManualRouteObjects, Router, useHref, createPath, useResolvedPath, useMatch, UNSAFE_DataRouterStateContext, useNavigate, useLocation, UNSAFE_NavigationContext, UNSAFE_RouteContext, useMatches, useNavigation, UNSAFE_DataRouterContext } from 'react-router';
export { AbortedDeferredError, Await, MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, RouterProvider, Routes, UNSAFE_DataRouterContext, UNSAFE_DataRouterStateContext, UNSAFE_DataStaticRouterContext, UNSAFE_LocationContext, UNSAFE_NavigationContext, UNSAFE_RouteContext, UNSAFE_enhanceManualRouteObjects, createMemoryRouter, createPath, createRoutesFromChildren, createRoutesFromElements, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, renderMatches, resolvePath, useActionData, useAsyncError, useAsyncValue, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes } from 'react-router';
import { createRouter, createBrowserHistory, createHashHistory, matchPath, invariant } from '@remix-run/router';
import { createRouter, createBrowserHistory, createHashHistory, matchPath, invariant, joinPaths } from '@remix-run/router';

@@ -473,2 +473,33 @@ const defaultMethod = "get";

var DataRouterHook;
(function (DataRouterHook) {
DataRouterHook["UseScrollRestoration"] = "useScrollRestoration";
DataRouterHook["UseSubmitImpl"] = "useSubmitImpl";
DataRouterHook["UseFetcher"] = "useFetcher";
})(DataRouterHook || (DataRouterHook = {}));
var DataRouterStateHook;
(function (DataRouterStateHook) {
DataRouterStateHook["UseFetchers"] = "useFetchers";
DataRouterStateHook["UseScrollRestoration"] = "useScrollRestoration";
})(DataRouterStateHook || (DataRouterStateHook = {}));
function getDataRouterConsoleError(hookName) {
return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
}
function useDataRouterContext(hookName) {
let ctx = React.useContext(UNSAFE_DataRouterContext);
!ctx ? invariant(false, getDataRouterConsoleError(hookName)) : void 0;
return ctx;
}
function useDataRouterState(hookName) {
let state = React.useContext(UNSAFE_DataRouterStateContext);
!state ? invariant(false, getDataRouterConsoleError(hookName)) : void 0;
return state;
}
/**

@@ -535,7 +566,5 @@ * Handles the click behavior for router `<Link>` components. This is useful if

function useSubmitImpl(fetcherKey, routeId) {
let dataRouterContext = React.useContext(UNSAFE_DataRouterContext);
!dataRouterContext ? invariant(false, "useSubmitImpl must be used within a Data Router") : void 0;
let {
router
} = dataRouterContext;
} = useDataRouterContext(DataRouterHook.UseSubmitImpl);
let defaultAction = useFormAction();

@@ -573,9 +602,15 @@ return React.useCallback((target, options = {}) => {

} = {}) {
let {
basename
} = React.useContext(UNSAFE_NavigationContext);
let routeContext = React.useContext(UNSAFE_RouteContext);
!routeContext ? invariant(false, "useFormAction must be used inside a RouteContext") : void 0;
let [match] = routeContext.matches.slice(-1);
let resolvedAction = action ?? ".";
let path = useResolvedPath(resolvedAction, {
relative
}); // Previously we set the default action to ".". The problem with this is that
let resolvedAction = action ?? "."; // Shallow clone path so we can modify it below, otherwise we modify the
// object referenced by useMemo inside useResolvedPath
let path = { ...useResolvedPath(resolvedAction, {
relative
})
}; // Previously we set the default action to ".". The problem with this is that
// `useResolvedPath(".")` excludes search params and the hash of the resolved

@@ -606,2 +641,10 @@ // URL. This is the intended behavior of when "." is specifically provided as

path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
} // If we're operating within a basename, prepend it to the pathname prior
// to creating the form action. If this is a root navigation, then just use
// the raw basename which allows the basename to have full control over the
// presence of a trailing slash on root actions
if (basename !== "/") {
path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
}

@@ -635,7 +678,5 @@

function useFetcher() {
let dataRouterContext = React.useContext(UNSAFE_DataRouterContext);
!dataRouterContext ? invariant(false, `useFetcher must be used within a Data Router`) : void 0;
let {
router
} = dataRouterContext;
} = useDataRouterContext(DataRouterHook.UseFetcher);
let route = React.useContext(UNSAFE_RouteContext);

@@ -684,4 +725,3 @@ !route ? invariant(false, `useFetcher must be used inside a RouteContext`) : void 0;

function useFetchers() {
let state = React.useContext(UNSAFE_DataRouterStateContext);
!state ? invariant(false, `useFetchers must be used within a DataRouterStateContext`) : void 0;
let state = useDataRouterState(DataRouterStateHook.UseFetchers);
return [...state.fetchers.values()];

@@ -699,16 +739,12 @@ }

} = {}) {
let location = useLocation();
let matches = useMatches();
let navigation = useNavigation();
let dataRouterContext = React.useContext(UNSAFE_DataRouterContext);
!dataRouterContext ? invariant(false, "useScrollRestoration must be used within a DataRouterContext") : void 0;
let {
router
} = dataRouterContext;
let state = React.useContext(UNSAFE_DataRouterStateContext);
!(router != null && state != null) ? invariant(false, "useScrollRestoration must be used within a DataRouterStateContext") : void 0;
} = useDataRouterContext(DataRouterHook.UseScrollRestoration);
let {
restoreScrollPosition,
preventScrollReset
} = state; // Trigger manual scroll restoration while we're active
} = useDataRouterState(DataRouterStateHook.UseScrollRestoration);
let location = useLocation();
let matches = useMatches();
let navigation = useNavigation(); // Trigger manual scroll restoration while we're active

@@ -715,0 +751,0 @@ React.useEffect(() => {

/**
* React Router DOM v6.4.1
* React Router DOM v6.4.2-pre.0
*

@@ -11,3 +11,3 @@ * Copyright (c) Remix Software Inc.

*/
import*as e from"react";import{UNSAFE_enhanceManualRouteObjects as t,Router as r,useHref as n,createPath as a,useResolvedPath as o,useMatch as i,UNSAFE_DataRouterStateContext as u,useNavigate as s,useLocation as l,UNSAFE_DataRouterContext as c,UNSAFE_RouteContext as f,useMatches as m,useNavigation as d}from"react-router";export{AbortedDeferredError,Await,MemoryRouter,Navigate,NavigationType,Outlet,Route,Router,RouterProvider,Routes,UNSAFE_DataRouterContext,UNSAFE_DataRouterStateContext,UNSAFE_DataStaticRouterContext,UNSAFE_LocationContext,UNSAFE_NavigationContext,UNSAFE_RouteContext,UNSAFE_enhanceManualRouteObjects,createMemoryRouter,createPath,createRoutesFromChildren,createRoutesFromElements,defer,generatePath,isRouteErrorResponse,json,matchPath,matchRoutes,parsePath,redirect,renderMatches,resolvePath,useActionData,useAsyncError,useAsyncValue,useHref,useInRouterContext,useLoaderData,useLocation,useMatch,useMatches,useNavigate,useNavigation,useNavigationType,useOutlet,useOutletContext,useParams,useResolvedPath,useRevalidator,useRouteError,useRouteLoaderData,useRoutes}from"react-router";import{createRouter as h,createBrowserHistory as p,createHashHistory as g,matchPath as y,invariant as w}from"@remix-run/router";const v="application/x-www-form-urlencoded";function b(e){return null!=e&&"string"==typeof e.tagName}function R(e=""){return new URLSearchParams("string"==typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce(((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map((e=>[r,e])):[[r,n]])}),[]))}function E(e,t,r){let n,a,o,i;if(b(u=e)&&"form"===u.tagName.toLowerCase()){let u=r.submissionTrigger;n=r.method||e.getAttribute("method")||"get",a=r.action||e.getAttribute("action")||t,o=r.encType||e.getAttribute("enctype")||v,i=new FormData(e),u&&u.name&&i.append(u.name,u.value)}else if(function(e){return b(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return b(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){let u=e.form;if(null==u)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');n=r.method||e.getAttribute("formmethod")||u.getAttribute("method")||"get",a=r.action||e.getAttribute("formaction")||u.getAttribute("action")||t,o=r.encType||e.getAttribute("formenctype")||u.getAttribute("enctype")||v,i=new FormData(u),e.name&&i.append(e.name,e.value)}else{if(b(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');if(n=r.method||"get",a=r.action||t,o=r.encType||v,e instanceof FormData)i=e;else if(i=new FormData,e instanceof URLSearchParams)for(let[t,r]of e)i.append(t,r);else if(null!=e)for(let t of Object.keys(e))i.append(t,e[t])}var u;let{protocol:s,host:l}=window.location;return{url:new URL(a,`${s}//${l}`),method:n,encType:o,formData:i}}function S(e,r){return h({basename:r?.basename,history:p({window:r?.window}),hydrationData:r?.hydrationData||window?.__staticRouterHydrationData,routes:t(e)}).initialize()}function C(e,r){return h({basename:r?.basename,history:g({window:r?.window}),hydrationData:r?.hydrationData||window?.__staticRouterHydrationData,routes:t(e)}).initialize()}function A({basename:t,children:n,window:a}){let o=e.useRef();null==o.current&&(o.current=p({window:a,v5Compat:!0}));let i=o.current,[u,s]=e.useState({action:i.action,location:i.location});return e.useLayoutEffect((()=>i.listen(s)),[i]),e.createElement(r,{basename:t,children:n,location:u.location,navigationType:u.action,navigator:i})}function x({basename:t,children:n,window:a}){let o=e.useRef();null==o.current&&(o.current=g({window:a,v5Compat:!0}));let i=o.current,[u,s]=e.useState({action:i.action,location:i.location});return e.useLayoutEffect((()=>i.listen(s)),[i]),e.createElement(r,{basename:t,children:n,location:u.location,navigationType:u.action,navigator:i})}function D({basename:t,children:n,history:a}){const[o,i]=e.useState({action:a.action,location:a.location});return e.useLayoutEffect((()=>a.listen(i)),[a]),e.createElement(r,{basename:t,children:n,location:o.location,navigationType:o.action,navigator:a})}const N=e.forwardRef((function({onClick:t,relative:r,reloadDocument:a,replace:o,state:i,target:u,to:s,preventScrollReset:l,...c},f){let m=n(s,{relative:r}),d=O(s,{replace:o,state:i,target:u,preventScrollReset:l,relative:r});return e.createElement("a",Object.assign({},c,{href:m,onClick:a?t:function(e){t&&t(e),e.defaultPrevented||d(e)},ref:f,target:u}))})),L=e.forwardRef((function({"aria-current":t="page",caseSensitive:r=!1,className:n="",end:a=!1,style:s,to:l,children:c,...f},m){let d,h=o(l),p=i({path:h.pathname,end:a,caseSensitive:r}),g=e.useContext(u)?.navigation.location,w=o(g||""),v=null!=e.useMemo((()=>g?y({path:h.pathname,end:a,caseSensitive:r},w.pathname):null),[g,h.pathname,r,a,w.pathname]),b=null!=p,R=b?t:void 0;d="function"==typeof n?n({isActive:b,isPending:v}):[n,b?"active":null,v?"pending":null].filter(Boolean).join(" ");let E="function"==typeof s?s({isActive:b,isPending:v}):s;return e.createElement(N,Object.assign({},f,{"aria-current":R,className:d,ref:m,style:E,to:l}),"function"==typeof c?c({isActive:b,isPending:v}):c)})),P=e.forwardRef(((t,r)=>e.createElement(F,Object.assign({},t,{ref:r})))),F=e.forwardRef((({reloadDocument:t,replace:r,method:n="get",action:a,onSubmit:o,fetcherKey:i,routeId:u,relative:s,...l},c)=>{let f=U(i,u),m="get"===n.toLowerCase()?"get":"post",d=k(a,{relative:s});return e.createElement("form",Object.assign({ref:c,method:m,action:d,onSubmit:t?o:e=>{if(o&&o(e),e.defaultPrevented)return;e.preventDefault();let t=e.nativeEvent.submitter;f(t||e.currentTarget,{method:n,replace:r,relative:s})}},l))}));function T({getKey:t,storageKey:r}){return function({getKey:t,storageKey:r}={}){let n=l(),a=m(),o=d(),i=e.useContext(c);i||w(!1);let{router:s}=i,f=e.useContext(u);(null==s||null==f)&&w(!1);let{restoreScrollPosition:h,preventScrollReset:p}=f;e.useEffect((()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"})),[]),g=e.useCallback((()=>{if("idle"===o.state){let e=(t?t(n,a):null)||n.key;H[e]=window.scrollY}sessionStorage.setItem(r||"react-router-scroll-positions",JSON.stringify(H)),window.history.scrollRestoration="auto"}),[r,t,o.state,n,a]),e.useEffect((()=>(window.addEventListener("beforeunload",g),()=>{window.removeEventListener("beforeunload",g)})),[g]),e.useLayoutEffect((()=>{try{let e=sessionStorage.getItem(r||"react-router-scroll-positions");e&&(H=JSON.parse(e))}catch(e){}}),[r]),e.useLayoutEffect((()=>{let e=s?.enableScrollRestoration(H,(()=>window.scrollY),t);return()=>e&&e()}),[s,t]),e.useLayoutEffect((()=>{if(!1!==h)if("number"!=typeof h){if(n.hash){let e=document.getElementById(n.hash.slice(1));if(e)return void e.scrollIntoView()}!0!==p&&window.scrollTo(0,0)}else window.scrollTo(0,h)}),[n,h,p]);var g}({getKey:t,storageKey:r}),null}function O(t,{target:r,replace:n,state:i,preventScrollReset:u,relative:c}={}){let f=s(),m=l(),d=o(t,{relative:c});return e.useCallback((e=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(e,r)){e.preventDefault();let r=void 0!==n?n:a(m)===a(d);f(t,{replace:r,state:i,preventScrollReset:u,relative:c})}}),[m,f,d,n,i,r,t,u,c])}function _(t){let r=e.useRef(R(t)),n=l(),a=e.useMemo((()=>function(e,t){let r=R(e);for(let n of t.keys())r.has(n)||t.getAll(n).forEach((e=>{r.append(n,e)}));return r}(n.search,r.current)),[n.search]),o=s(),i=e.useCallback(((e,t)=>{const r=R("function"==typeof e?e(a):e);o("?"+r,t)}),[o,a]);return[a,i]}function K(){return U()}function U(t,r){let n=e.useContext(c);n||w(!1);let{router:a}=n,o=k();return e.useCallback(((e,n={})=>{if("undefined"==typeof document)throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.");let{method:i,encType:u,formData:s,url:l}=E(e,o,n),c=l.pathname+l.search,f={replace:n.replace,formData:s,formMethod:i,formEncType:u};t?(null==r&&w(!1),a.fetch(t,r,c,f)):a.navigate(c,f)}),[o,a,t,r])}function k(t,{relative:r}={}){let n=e.useContext(f);n||w(!1);let[i]=n.matches.slice(-1),u=o(t??".",{relative:r}),s=l();if(null==t&&(u.search=s.search,u.hash=s.hash,i.route.index)){let e=new URLSearchParams(u.search);e.delete("index"),u.search=e.toString()?`?${e.toString()}`:""}return t&&"."!==t||!i.route.index||(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),a(u)}let j=0;function M(){let t=e.useContext(c);t||w(!1);let{router:r}=t,n=e.useContext(f);n||w(!1);let a=n.matches[n.matches.length-1]?.route.id;null==a&&w(!1);let[o]=e.useState((()=>String(++j))),[i]=e.useState((()=>(a||w(!1),function(t,r){return e.forwardRef(((n,a)=>e.createElement(F,Object.assign({},n,{ref:a,fetcherKey:t,routeId:r}))))}(o,a)))),[u]=e.useState((()=>e=>{r||w(!1),a||w(!1),r.fetch(o,a,e)})),s=U(o,a),l=r.getFetcher(o),m=e.useMemo((()=>({Form:i,submit:s,load:u,...l})),[l,i,s,u]);return e.useEffect((()=>()=>{r?r.deleteFetcher(o):console.warn("No fetcher available to clean up from useFetcher()")}),[r,o]),m}function I(){let t=e.useContext(u);return t||w(!1),[...t.fetchers.values()]}let H={};export{A as BrowserRouter,P as Form,x as HashRouter,N as Link,L as NavLink,T as ScrollRestoration,S as createBrowserRouter,C as createHashRouter,R as createSearchParams,D as unstable_HistoryRouter,M as useFetcher,I as useFetchers,k as useFormAction,O as useLinkClickHandler,_ as useSearchParams,K as useSubmit};
import*as e from"react";import{UNSAFE_enhanceManualRouteObjects as t,Router as r,useHref as n,createPath as o,useResolvedPath as a,useMatch as i,UNSAFE_DataRouterStateContext as s,useNavigate as u,useLocation as c,UNSAFE_NavigationContext as l,UNSAFE_RouteContext as f,useMatches as m,useNavigation as d,UNSAFE_DataRouterContext as h}from"react-router";export{AbortedDeferredError,Await,MemoryRouter,Navigate,NavigationType,Outlet,Route,Router,RouterProvider,Routes,UNSAFE_DataRouterContext,UNSAFE_DataRouterStateContext,UNSAFE_DataStaticRouterContext,UNSAFE_LocationContext,UNSAFE_NavigationContext,UNSAFE_RouteContext,UNSAFE_enhanceManualRouteObjects,createMemoryRouter,createPath,createRoutesFromChildren,createRoutesFromElements,defer,generatePath,isRouteErrorResponse,json,matchPath,matchRoutes,parsePath,redirect,renderMatches,resolvePath,useActionData,useAsyncError,useAsyncValue,useHref,useInRouterContext,useLoaderData,useLocation,useMatch,useMatches,useNavigate,useNavigation,useNavigationType,useOutlet,useOutletContext,useParams,useResolvedPath,useRevalidator,useRouteError,useRouteLoaderData,useRoutes}from"react-router";import{createRouter as p,createBrowserHistory as g,createHashHistory as y,matchPath as w,invariant as v,joinPaths as b}from"@remix-run/router";const R="application/x-www-form-urlencoded";function S(e){return null!=e&&"string"==typeof e.tagName}function E(e=""){return new URLSearchParams("string"==typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce(((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map((e=>[r,e])):[[r,n]])}),[]))}function A(e,t,r){let n,o,a,i;if(S(s=e)&&"form"===s.tagName.toLowerCase()){let s=r.submissionTrigger;n=r.method||e.getAttribute("method")||"get",o=r.action||e.getAttribute("action")||t,a=r.encType||e.getAttribute("enctype")||R,i=new FormData(e),s&&s.name&&i.append(s.name,s.value)}else if(function(e){return S(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return S(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){let s=e.form;if(null==s)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');n=r.method||e.getAttribute("formmethod")||s.getAttribute("method")||"get",o=r.action||e.getAttribute("formaction")||s.getAttribute("action")||t,a=r.encType||e.getAttribute("formenctype")||s.getAttribute("enctype")||R,i=new FormData(s),e.name&&i.append(e.name,e.value)}else{if(S(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');if(n=r.method||"get",o=r.action||t,a=r.encType||R,e instanceof FormData)i=e;else if(i=new FormData,e instanceof URLSearchParams)for(let[t,r]of e)i.append(t,r);else if(null!=e)for(let t of Object.keys(e))i.append(t,e[t])}var s;let{protocol:u,host:c}=window.location;return{url:new URL(o,`${u}//${c}`),method:n,encType:a,formData:i}}function C(e,r){return p({basename:r?.basename,history:g({window:r?.window}),hydrationData:r?.hydrationData||window?.__staticRouterHydrationData,routes:t(e)}).initialize()}function D(e,r){return p({basename:r?.basename,history:y({window:r?.window}),hydrationData:r?.hydrationData||window?.__staticRouterHydrationData,routes:t(e)}).initialize()}function x({basename:t,children:n,window:o}){let a=e.useRef();null==a.current&&(a.current=g({window:o,v5Compat:!0}));let i=a.current,[s,u]=e.useState({action:i.action,location:i.location});return e.useLayoutEffect((()=>i.listen(u)),[i]),e.createElement(r,{basename:t,children:n,location:s.location,navigationType:s.action,navigator:i})}function F({basename:t,children:n,window:o}){let a=e.useRef();null==a.current&&(a.current=y({window:o,v5Compat:!0}));let i=a.current,[s,u]=e.useState({action:i.action,location:i.location});return e.useLayoutEffect((()=>i.listen(u)),[i]),e.createElement(r,{basename:t,children:n,location:s.location,navigationType:s.action,navigator:i})}function N({basename:t,children:n,history:o}){const[a,i]=e.useState({action:o.action,location:o.location});return e.useLayoutEffect((()=>o.listen(i)),[o]),e.createElement(r,{basename:t,children:n,location:a.location,navigationType:a.action,navigator:o})}const U=e.forwardRef((function({onClick:t,relative:r,reloadDocument:o,replace:a,state:i,target:s,to:u,preventScrollReset:c,...l},f){let m=n(u,{relative:r}),d=I(u,{replace:a,state:i,target:s,preventScrollReset:c,relative:r});return e.createElement("a",Object.assign({},l,{href:m,onClick:o?t:function(e){t&&t(e),e.defaultPrevented||d(e)},ref:f,target:s}))})),L=e.forwardRef((function({"aria-current":t="page",caseSensitive:r=!1,className:n="",end:o=!1,style:u,to:c,children:l,...f},m){let d,h=a(c),p=i({path:h.pathname,end:o,caseSensitive:r}),g=e.useContext(s)?.navigation.location,y=a(g||""),v=null!=e.useMemo((()=>g?w({path:h.pathname,end:o,caseSensitive:r},y.pathname):null),[g,h.pathname,r,o,y.pathname]),b=null!=p,R=b?t:void 0;d="function"==typeof n?n({isActive:b,isPending:v}):[n,b?"active":null,v?"pending":null].filter(Boolean).join(" ");let S="function"==typeof u?u({isActive:b,isPending:v}):u;return e.createElement(U,Object.assign({},f,{"aria-current":R,className:d,ref:m,style:S,to:c}),"function"==typeof l?l({isActive:b,isPending:v}):l)})),P=e.forwardRef(((t,r)=>e.createElement(T,Object.assign({},t,{ref:r})))),T=e.forwardRef((({reloadDocument:t,replace:r,method:n="get",action:o,onSubmit:a,fetcherKey:i,routeId:s,relative:u,...c},l)=>{let f=Y(i,s),m="get"===n.toLowerCase()?"get":"post",d=$(o,{relative:u});return e.createElement("form",Object.assign({ref:l,method:m,action:d,onSubmit:t?a:e=>{if(a&&a(e),e.defaultPrevented)return;e.preventDefault();let t=e.nativeEvent.submitter;f(t||e.currentTarget,{method:n,replace:r,relative:u})}},c))}));function O({getKey:t,storageKey:r}){return function({getKey:t,storageKey:r}={}){let{router:n}=k(_.UseScrollRestoration),{restoreScrollPosition:o,preventScrollReset:a}=j(K.UseScrollRestoration),i=c(),s=m(),u=d();e.useEffect((()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"})),[]),l=e.useCallback((()=>{if("idle"===u.state){let e=(t?t(i,s):null)||i.key;V[e]=window.scrollY}sessionStorage.setItem(r||"react-router-scroll-positions",JSON.stringify(V)),window.history.scrollRestoration="auto"}),[r,t,u.state,i,s]),e.useEffect((()=>(window.addEventListener("beforeunload",l),()=>{window.removeEventListener("beforeunload",l)})),[l]),e.useLayoutEffect((()=>{try{let e=sessionStorage.getItem(r||"react-router-scroll-positions");e&&(V=JSON.parse(e))}catch(e){}}),[r]),e.useLayoutEffect((()=>{let e=n?.enableScrollRestoration(V,(()=>window.scrollY),t);return()=>e&&e()}),[n,t]),e.useLayoutEffect((()=>{if(!1!==o)if("number"!=typeof o){if(i.hash){let e=document.getElementById(i.hash.slice(1));if(e)return void e.scrollIntoView()}!0!==a&&window.scrollTo(0,0)}else window.scrollTo(0,o)}),[i,o,a]);var l}({getKey:t,storageKey:r}),null}var _,K;function k(t){let r=e.useContext(h);return r||v(!1),r}function j(t){let r=e.useContext(s);return r||v(!1),r}function I(t,{target:r,replace:n,state:i,preventScrollReset:s,relative:l}={}){let f=u(),m=c(),d=a(t,{relative:l});return e.useCallback((e=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(e,r)){e.preventDefault();let r=void 0!==n?n:o(m)===o(d);f(t,{replace:r,state:i,preventScrollReset:s,relative:l})}}),[m,f,d,n,i,r,t,s,l])}function M(t){let r=e.useRef(E(t)),n=c(),o=e.useMemo((()=>function(e,t){let r=E(e);for(let n of t.keys())r.has(n)||t.getAll(n).forEach((e=>{r.append(n,e)}));return r}(n.search,r.current)),[n.search]),a=u(),i=e.useCallback(((e,t)=>{const r=E("function"==typeof e?e(o):e);a("?"+r,t)}),[a,o]);return[o,i]}function H(){return Y()}function Y(t,r){let{router:n}=k(_.UseSubmitImpl),o=$();return e.useCallback(((e,a={})=>{if("undefined"==typeof document)throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.");let{method:i,encType:s,formData:u,url:c}=A(e,o,a),l=c.pathname+c.search,f={replace:a.replace,formData:u,formMethod:i,formEncType:s};t?(null==r&&v(!1),n.fetch(t,r,l,f)):n.navigate(l,f)}),[o,n,t,r])}function $(t,{relative:r}={}){let{basename:n}=e.useContext(l),i=e.useContext(f);i||v(!1);let[s]=i.matches.slice(-1),u={...a(t??".",{relative:r})},m=c();if(null==t&&(u.search=m.search,u.hash=m.hash,s.route.index)){let e=new URLSearchParams(u.search);e.delete("index"),u.search=e.toString()?`?${e.toString()}`:""}return t&&"."!==t||!s.route.index||(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),"/"!==n&&(u.pathname="/"===u.pathname?n:b([n,u.pathname])),o(u)}!function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmitImpl="useSubmitImpl",e.UseFetcher="useFetcher"}(_||(_={})),function(e){e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"}(K||(K={}));let z=0;function B(){let{router:t}=k(_.UseFetcher),r=e.useContext(f);r||v(!1);let n=r.matches[r.matches.length-1]?.route.id;null==n&&v(!1);let[o]=e.useState((()=>String(++z))),[a]=e.useState((()=>(n||v(!1),function(t,r){return e.forwardRef(((n,o)=>e.createElement(T,Object.assign({},n,{ref:o,fetcherKey:t,routeId:r}))))}(o,n)))),[i]=e.useState((()=>e=>{t||v(!1),n||v(!1),t.fetch(o,n,e)})),s=Y(o,n),u=t.getFetcher(o),c=e.useMemo((()=>({Form:a,submit:s,load:i,...u})),[u,a,s,i]);return e.useEffect((()=>()=>{t?t.deleteFetcher(o):console.warn("No fetcher available to clean up from useFetcher()")}),[t,o]),c}function J(){return[...j(K.UseFetchers).fetchers.values()]}let V={};export{x as BrowserRouter,P as Form,F as HashRouter,U as Link,L as NavLink,O as ScrollRestoration,C as createBrowserRouter,D as createHashRouter,E as createSearchParams,N as unstable_HistoryRouter,B as useFetcher,J as useFetchers,$ as useFormAction,I as useLinkClickHandler,M as useSearchParams,H as useSubmit};
//# sourceMappingURL=react-router-dom.production.min.js.map
/**
* React Router DOM v6.4.1
* React Router DOM v6.4.2-pre.0
*

@@ -542,2 +542,33 @@ * Copyright (c) Remix Software Inc.

var DataRouterHook;
(function (DataRouterHook) {
DataRouterHook["UseScrollRestoration"] = "useScrollRestoration";
DataRouterHook["UseSubmitImpl"] = "useSubmitImpl";
DataRouterHook["UseFetcher"] = "useFetcher";
})(DataRouterHook || (DataRouterHook = {}));
var DataRouterStateHook;
(function (DataRouterStateHook) {
DataRouterStateHook["UseFetchers"] = "useFetchers";
DataRouterStateHook["UseScrollRestoration"] = "useScrollRestoration";
})(DataRouterStateHook || (DataRouterStateHook = {}));
function getDataRouterConsoleError(hookName) {
return hookName + " must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.";
}
function useDataRouterContext(hookName) {
let ctx = React__namespace.useContext(reactRouter.UNSAFE_DataRouterContext);
!ctx ? router.invariant(false, getDataRouterConsoleError(hookName)) : void 0;
return ctx;
}
function useDataRouterState(hookName) {
let state = React__namespace.useContext(reactRouter.UNSAFE_DataRouterStateContext);
!state ? router.invariant(false, getDataRouterConsoleError(hookName)) : void 0;
return state;
}
/**

@@ -605,7 +636,5 @@ * Handles the click behavior for router `<Link>` components. This is useful if

function useSubmitImpl(fetcherKey, routeId) {
let dataRouterContext = React__namespace.useContext(reactRouter.UNSAFE_DataRouterContext);
!dataRouterContext ? router.invariant(false, "useSubmitImpl must be used within a Data Router") : void 0;
let {
router: router$1
} = dataRouterContext;
} = useDataRouterContext(DataRouterHook.UseSubmitImpl);
let defaultAction = useFormAction();

@@ -648,9 +677,14 @@ return React__namespace.useCallback(function (target, options) {

} = _temp2 === void 0 ? {} : _temp2;
let {
basename
} = React__namespace.useContext(reactRouter.UNSAFE_NavigationContext);
let routeContext = React__namespace.useContext(reactRouter.UNSAFE_RouteContext);
!routeContext ? router.invariant(false, "useFormAction must be used inside a RouteContext") : void 0;
let [match] = routeContext.matches.slice(-1);
let resolvedAction = action != null ? action : ".";
let path = reactRouter.useResolvedPath(resolvedAction, {
let resolvedAction = action != null ? action : "."; // Shallow clone path so we can modify it below, otherwise we modify the
// object referenced by useMemo inside useResolvedPath
let path = _extends({}, reactRouter.useResolvedPath(resolvedAction, {
relative
}); // Previously we set the default action to ".". The problem with this is that
})); // Previously we set the default action to ".". The problem with this is that
// `useResolvedPath(".")` excludes search params and the hash of the resolved

@@ -661,2 +695,3 @@ // URL. This is the intended behavior of when "." is specifically provided as

let location = reactRouter.useLocation();

@@ -682,2 +717,10 @@

path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
} // If we're operating within a basename, prepend it to the pathname prior
// to creating the form action. If this is a root navigation, then just use
// the raw basename which allows the basename to have full control over the
// presence of a trailing slash on root actions
if (basename !== "/") {
path.pathname = path.pathname === "/" ? basename : router.joinPaths([basename, path.pathname]);
}

@@ -713,7 +756,5 @@

let dataRouterContext = React__namespace.useContext(reactRouter.UNSAFE_DataRouterContext);
!dataRouterContext ? router.invariant(false, "useFetcher must be used within a Data Router") : void 0;
let {
router: router$1
} = dataRouterContext;
} = useDataRouterContext(DataRouterHook.UseFetcher);
let route = React__namespace.useContext(reactRouter.UNSAFE_RouteContext);

@@ -761,4 +802,3 @@ !route ? router.invariant(false, "useFetcher must be used inside a RouteContext") : void 0;

function useFetchers() {
let state = React__namespace.useContext(reactRouter.UNSAFE_DataRouterStateContext);
!state ? router.invariant(false, "useFetchers must be used within a DataRouterStateContext") : void 0;
let state = useDataRouterState(DataRouterStateHook.UseFetchers);
return [...state.fetchers.values()];

@@ -777,16 +817,12 @@ }

} = _temp3 === void 0 ? {} : _temp3;
let location = reactRouter.useLocation();
let matches = reactRouter.useMatches();
let navigation = reactRouter.useNavigation();
let dataRouterContext = React__namespace.useContext(reactRouter.UNSAFE_DataRouterContext);
!dataRouterContext ? router.invariant(false, "useScrollRestoration must be used within a DataRouterContext") : void 0;
let {
router: router$1
} = dataRouterContext;
let state = React__namespace.useContext(reactRouter.UNSAFE_DataRouterStateContext);
!(router$1 != null && state != null) ? router.invariant(false, "useScrollRestoration must be used within a DataRouterStateContext") : void 0;
router
} = useDataRouterContext(DataRouterHook.UseScrollRestoration);
let {
restoreScrollPosition,
preventScrollReset
} = state; // Trigger manual scroll restoration while we're active
} = useDataRouterState(DataRouterStateHook.UseScrollRestoration);
let location = reactRouter.useLocation();
let matches = reactRouter.useMatches();
let navigation = reactRouter.useNavigation(); // Trigger manual scroll restoration while we're active

@@ -822,5 +858,5 @@ React__namespace.useEffect(() => {

React__namespace.useLayoutEffect(() => {
let disableScrollRestoration = router$1 == null ? void 0 : router$1.enableScrollRestoration(savedScrollPositions, () => window.scrollY, getKey);
let disableScrollRestoration = router == null ? void 0 : router.enableScrollRestoration(savedScrollPositions, () => window.scrollY, getKey);
return () => disableScrollRestoration && disableScrollRestoration();
}, [router$1, getKey]); // Restore scrolling when state.restoreScrollPosition changes
}, [router, getKey]); // Restore scrolling when state.restoreScrollPosition changes

@@ -827,0 +863,0 @@ React__namespace.useLayoutEffect(() => {

/**
* React Router DOM v6.4.1
* React Router DOM v6.4.2-pre.0
*

@@ -11,3 +11,3 @@ * Copyright (c) Remix Software Inc.

*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-router"),require("@remix-run/router")):"function"==typeof define&&define.amd?define(["exports","react","react-router","@remix-run/router"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactRouterDOM={},e.React,e.ReactRouter,e.Router)}(this,(function(e,t,r,n){"use strict";function o(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var a=o(t);function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u.apply(this,arguments)}function i(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}const c="get",l="application/x-www-form-urlencoded";function s(e){return null!=e&&"string"==typeof e.tagName}function f(e){return void 0===e&&(e=""),new URLSearchParams("string"==typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce(((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map((e=>[r,e])):[[r,n]])}),[]))}function d(e,t,r){let n,o,a,u;if(s(i=e)&&"form"===i.tagName.toLowerCase()){let i=r.submissionTrigger;n=r.method||e.getAttribute("method")||c,o=r.action||e.getAttribute("action")||t,a=r.encType||e.getAttribute("enctype")||l,u=new FormData(e),i&&i.name&&u.append(i.name,i.value)}else if(function(e){return s(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return s(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){let i=e.form;if(null==i)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');n=r.method||e.getAttribute("formmethod")||i.getAttribute("method")||c,o=r.action||e.getAttribute("formaction")||i.getAttribute("action")||t,a=r.encType||e.getAttribute("formenctype")||i.getAttribute("enctype")||l,u=new FormData(i),e.name&&u.append(e.name,e.value)}else{if(s(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');if(n=r.method||c,o=r.action||t,a=r.encType||l,e instanceof FormData)u=e;else if(u=new FormData,e instanceof URLSearchParams)for(let[t,r]of e)u.append(t,r);else if(null!=e)for(let t of Object.keys(e))u.append(t,e[t])}var i;let{protocol:f,host:d}=window.location;return{url:new URL(o,f+"//"+d),method:n,encType:a,formData:u}}const m=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset"],b=["aria-current","caseSensitive","className","end","style","to","children"],p=["reloadDocument","replace","method","action","onSubmit","fetcherKey","routeId","relative"];const y=a.forwardRef((function(e,t){let{onClick:n,relative:o,reloadDocument:c,replace:l,state:s,target:f,to:d,preventScrollReset:b}=e,p=i(e,m),y=r.useHref(d,{relative:o}),h=R(d,{replace:l,state:s,target:f,preventScrollReset:b,relative:o});return a.createElement("a",u({},p,{href:y,onClick:c?n:function(e){n&&n(e),e.defaultPrevented||h(e)},ref:t,target:f}))})),h=a.forwardRef((function(e,t){let o,{"aria-current":c="page",caseSensitive:l=!1,className:s="",end:f=!1,style:d,to:m,children:p}=e,h=i(e,b),g=r.useResolvedPath(m),v=r.useMatch({path:g.pathname,end:f,caseSensitive:l}),R=a.useContext(r.UNSAFE_DataRouterStateContext),P=null==R?void 0:R.navigation.location,O=r.useResolvedPath(P||""),w=null!=a.useMemo((()=>P?n.matchPath({path:g.pathname,end:f,caseSensitive:l},O.pathname):null),[P,g.pathname,l,f,O.pathname]),j=null!=v,S=j?c:void 0;o="function"==typeof s?s({isActive:j,isPending:w}):[s,j?"active":null,w?"pending":null].filter(Boolean).join(" ");let E="function"==typeof d?d({isActive:j,isPending:w}):d;return a.createElement(y,u({},h,{"aria-current":S,className:o,ref:t,style:E,to:m}),"function"==typeof p?p({isActive:j,isPending:w}):p)})),g=a.forwardRef(((e,t)=>a.createElement(v,u({},e,{ref:t})))),v=a.forwardRef(((e,t)=>{let{reloadDocument:r,replace:n,method:o=c,action:l,onSubmit:s,fetcherKey:f,routeId:d,relative:m}=e,b=i(e,p),y=P(f,d),h="get"===o.toLowerCase()?"get":"post",g=O(l,{relative:m});return a.createElement("form",u({ref:t,method:h,action:g,onSubmit:r?s:e=>{if(s&&s(e),e.defaultPrevented)return;e.preventDefault();let t=e.nativeEvent.submitter;y(t||e.currentTarget,{method:o,replace:n,relative:m})}},b))}));function R(e,t){let{target:n,replace:o,state:u,preventScrollReset:i,relative:c}=void 0===t?{}:t,l=r.useNavigate(),s=r.useLocation(),f=r.useResolvedPath(e,{relative:c});return a.useCallback((t=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(t,n)){t.preventDefault();let n=void 0!==o?o:r.createPath(s)===r.createPath(f);l(e,{replace:n,state:u,preventScrollReset:i,relative:c})}}),[s,l,f,o,u,n,e,i,c])}function P(e,t){let o=a.useContext(r.UNSAFE_DataRouterContext);o||n.invariant(!1);let{router:u}=o,i=O();return a.useCallback((function(r,o){if(void 0===o&&(o={}),"undefined"==typeof document)throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.");let{method:a,encType:c,formData:l,url:s}=d(r,i,o),f=s.pathname+s.search,m={replace:o.replace,formData:l,formMethod:a,formEncType:c};e?(null==t&&n.invariant(!1),u.fetch(e,t,f,m)):u.navigate(f,m)}),[i,u,e,t])}function O(e,t){let{relative:o}=void 0===t?{}:t,u=a.useContext(r.UNSAFE_RouteContext);u||n.invariant(!1);let[i]=u.matches.slice(-1),c=null!=e?e:".",l=r.useResolvedPath(c,{relative:o}),s=r.useLocation();if(null==e&&(l.search=s.search,l.hash=s.hash,i.route.index)){let e=new URLSearchParams(l.search);e.delete("index"),l.search=e.toString()?"?"+e.toString():""}return e&&"."!==e||!i.route.index||(l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index"),r.createPath(l)}let w=0;const j="react-router-scroll-positions";let S={};Object.defineProperty(e,"AbortedDeferredError",{enumerable:!0,get:function(){return r.AbortedDeferredError}}),Object.defineProperty(e,"Await",{enumerable:!0,get:function(){return r.Await}}),Object.defineProperty(e,"MemoryRouter",{enumerable:!0,get:function(){return r.MemoryRouter}}),Object.defineProperty(e,"Navigate",{enumerable:!0,get:function(){return r.Navigate}}),Object.defineProperty(e,"NavigationType",{enumerable:!0,get:function(){return r.NavigationType}}),Object.defineProperty(e,"Outlet",{enumerable:!0,get:function(){return r.Outlet}}),Object.defineProperty(e,"Route",{enumerable:!0,get:function(){return r.Route}}),Object.defineProperty(e,"Router",{enumerable:!0,get:function(){return r.Router}}),Object.defineProperty(e,"RouterProvider",{enumerable:!0,get:function(){return r.RouterProvider}}),Object.defineProperty(e,"Routes",{enumerable:!0,get:function(){return r.Routes}}),Object.defineProperty(e,"UNSAFE_DataRouterContext",{enumerable:!0,get:function(){return r.UNSAFE_DataRouterContext}}),Object.defineProperty(e,"UNSAFE_DataRouterStateContext",{enumerable:!0,get:function(){return r.UNSAFE_DataRouterStateContext}}),Object.defineProperty(e,"UNSAFE_DataStaticRouterContext",{enumerable:!0,get:function(){return r.UNSAFE_DataStaticRouterContext}}),Object.defineProperty(e,"UNSAFE_LocationContext",{enumerable:!0,get:function(){return r.UNSAFE_LocationContext}}),Object.defineProperty(e,"UNSAFE_NavigationContext",{enumerable:!0,get:function(){return r.UNSAFE_NavigationContext}}),Object.defineProperty(e,"UNSAFE_RouteContext",{enumerable:!0,get:function(){return r.UNSAFE_RouteContext}}),Object.defineProperty(e,"UNSAFE_enhanceManualRouteObjects",{enumerable:!0,get:function(){return r.UNSAFE_enhanceManualRouteObjects}}),Object.defineProperty(e,"createMemoryRouter",{enumerable:!0,get:function(){return r.createMemoryRouter}}),Object.defineProperty(e,"createPath",{enumerable:!0,get:function(){return r.createPath}}),Object.defineProperty(e,"createRoutesFromChildren",{enumerable:!0,get:function(){return r.createRoutesFromChildren}}),Object.defineProperty(e,"createRoutesFromElements",{enumerable:!0,get:function(){return r.createRoutesFromElements}}),Object.defineProperty(e,"defer",{enumerable:!0,get:function(){return r.defer}}),Object.defineProperty(e,"generatePath",{enumerable:!0,get:function(){return r.generatePath}}),Object.defineProperty(e,"isRouteErrorResponse",{enumerable:!0,get:function(){return r.isRouteErrorResponse}}),Object.defineProperty(e,"json",{enumerable:!0,get:function(){return r.json}}),Object.defineProperty(e,"matchPath",{enumerable:!0,get:function(){return r.matchPath}}),Object.defineProperty(e,"matchRoutes",{enumerable:!0,get:function(){return r.matchRoutes}}),Object.defineProperty(e,"parsePath",{enumerable:!0,get:function(){return r.parsePath}}),Object.defineProperty(e,"redirect",{enumerable:!0,get:function(){return r.redirect}}),Object.defineProperty(e,"renderMatches",{enumerable:!0,get:function(){return r.renderMatches}}),Object.defineProperty(e,"resolvePath",{enumerable:!0,get:function(){return r.resolvePath}}),Object.defineProperty(e,"useActionData",{enumerable:!0,get:function(){return r.useActionData}}),Object.defineProperty(e,"useAsyncError",{enumerable:!0,get:function(){return r.useAsyncError}}),Object.defineProperty(e,"useAsyncValue",{enumerable:!0,get:function(){return r.useAsyncValue}}),Object.defineProperty(e,"useHref",{enumerable:!0,get:function(){return r.useHref}}),Object.defineProperty(e,"useInRouterContext",{enumerable:!0,get:function(){return r.useInRouterContext}}),Object.defineProperty(e,"useLoaderData",{enumerable:!0,get:function(){return r.useLoaderData}}),Object.defineProperty(e,"useLocation",{enumerable:!0,get:function(){return r.useLocation}}),Object.defineProperty(e,"useMatch",{enumerable:!0,get:function(){return r.useMatch}}),Object.defineProperty(e,"useMatches",{enumerable:!0,get:function(){return r.useMatches}}),Object.defineProperty(e,"useNavigate",{enumerable:!0,get:function(){return r.useNavigate}}),Object.defineProperty(e,"useNavigation",{enumerable:!0,get:function(){return r.useNavigation}}),Object.defineProperty(e,"useNavigationType",{enumerable:!0,get:function(){return r.useNavigationType}}),Object.defineProperty(e,"useOutlet",{enumerable:!0,get:function(){return r.useOutlet}}),Object.defineProperty(e,"useOutletContext",{enumerable:!0,get:function(){return r.useOutletContext}}),Object.defineProperty(e,"useParams",{enumerable:!0,get:function(){return r.useParams}}),Object.defineProperty(e,"useResolvedPath",{enumerable:!0,get:function(){return r.useResolvedPath}}),Object.defineProperty(e,"useRevalidator",{enumerable:!0,get:function(){return r.useRevalidator}}),Object.defineProperty(e,"useRouteError",{enumerable:!0,get:function(){return r.useRouteError}}),Object.defineProperty(e,"useRouteLoaderData",{enumerable:!0,get:function(){return r.useRouteLoaderData}}),Object.defineProperty(e,"useRoutes",{enumerable:!0,get:function(){return r.useRoutes}}),e.BrowserRouter=function(e){let{basename:t,children:o,window:u}=e,i=a.useRef();null==i.current&&(i.current=n.createBrowserHistory({window:u,v5Compat:!0}));let c=i.current,[l,s]=a.useState({action:c.action,location:c.location});return a.useLayoutEffect((()=>c.listen(s)),[c]),a.createElement(r.Router,{basename:t,children:o,location:l.location,navigationType:l.action,navigator:c})},e.Form=g,e.HashRouter=function(e){let{basename:t,children:o,window:u}=e,i=a.useRef();null==i.current&&(i.current=n.createHashHistory({window:u,v5Compat:!0}));let c=i.current,[l,s]=a.useState({action:c.action,location:c.location});return a.useLayoutEffect((()=>c.listen(s)),[c]),a.createElement(r.Router,{basename:t,children:o,location:l.location,navigationType:l.action,navigator:c})},e.Link=y,e.NavLink=h,e.ScrollRestoration=function(e){let{getKey:t,storageKey:o}=e;return function(e){let{getKey:t,storageKey:o}=void 0===e?{}:e,u=r.useLocation(),i=r.useMatches(),c=r.useNavigation(),l=a.useContext(r.UNSAFE_DataRouterContext);l||n.invariant(!1);let{router:s}=l,f=a.useContext(r.UNSAFE_DataRouterStateContext);(null==s||null==f)&&n.invariant(!1);let{restoreScrollPosition:d,preventScrollReset:m}=f;a.useEffect((()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"})),[]),b=a.useCallback((()=>{if("idle"===c.state){let e=(t?t(u,i):null)||u.key;S[e]=window.scrollY}sessionStorage.setItem(o||j,JSON.stringify(S)),window.history.scrollRestoration="auto"}),[o,t,c.state,u,i]),a.useEffect((()=>(window.addEventListener("beforeunload",b),()=>{window.removeEventListener("beforeunload",b)})),[b]),a.useLayoutEffect((()=>{try{let e=sessionStorage.getItem(o||j);e&&(S=JSON.parse(e))}catch(e){}}),[o]),a.useLayoutEffect((()=>{let e=null==s?void 0:s.enableScrollRestoration(S,(()=>window.scrollY),t);return()=>e&&e()}),[s,t]),a.useLayoutEffect((()=>{if(!1!==d)if("number"!=typeof d){if(u.hash){let e=document.getElementById(u.hash.slice(1));if(e)return void e.scrollIntoView()}!0!==m&&window.scrollTo(0,0)}else window.scrollTo(0,d)}),[u,d,m]);var b}({getKey:t,storageKey:o}),null},e.createBrowserRouter=function(e,t){var o;return n.createRouter({basename:null==t?void 0:t.basename,history:n.createBrowserHistory({window:null==t?void 0:t.window}),hydrationData:(null==t?void 0:t.hydrationData)||(null==(o=window)?void 0:o.__staticRouterHydrationData),routes:r.UNSAFE_enhanceManualRouteObjects(e)}).initialize()},e.createHashRouter=function(e,t){var o;return n.createRouter({basename:null==t?void 0:t.basename,history:n.createHashHistory({window:null==t?void 0:t.window}),hydrationData:(null==t?void 0:t.hydrationData)||(null==(o=window)?void 0:o.__staticRouterHydrationData),routes:r.UNSAFE_enhanceManualRouteObjects(e)}).initialize()},e.createSearchParams=f,e.unstable_HistoryRouter=function(e){let{basename:t,children:n,history:o}=e;const[u,i]=a.useState({action:o.action,location:o.location});return a.useLayoutEffect((()=>o.listen(i)),[o]),a.createElement(r.Router,{basename:t,children:n,location:u.location,navigationType:u.action,navigator:o})},e.useFetcher=function(){var e;let t=a.useContext(r.UNSAFE_DataRouterContext);t||n.invariant(!1);let{router:o}=t,i=a.useContext(r.UNSAFE_RouteContext);i||n.invariant(!1);let c=null==(e=i.matches[i.matches.length-1])?void 0:e.route.id;null==c&&n.invariant(!1);let[l]=a.useState((()=>String(++w))),[s]=a.useState((()=>(c||n.invariant(!1),function(e,t){return a.forwardRef(((r,n)=>a.createElement(v,u({},r,{ref:n,fetcherKey:e,routeId:t}))))}(l,c)))),[f]=a.useState((()=>e=>{o||n.invariant(!1),c||n.invariant(!1),o.fetch(l,c,e)})),d=P(l,c),m=o.getFetcher(l),b=a.useMemo((()=>u({Form:s,submit:d,load:f},m)),[m,s,d,f]);return a.useEffect((()=>()=>{o?o.deleteFetcher(l):console.warn("No fetcher available to clean up from useFetcher()")}),[o,l]),b},e.useFetchers=function(){let e=a.useContext(r.UNSAFE_DataRouterStateContext);return e||n.invariant(!1),[...e.fetchers.values()]},e.useFormAction=O,e.useLinkClickHandler=R,e.useSearchParams=function(e){let t=a.useRef(f(e)),n=r.useLocation(),o=a.useMemo((()=>function(e,t){let r=f(e);for(let e of t.keys())r.has(e)||t.getAll(e).forEach((t=>{r.append(e,t)}));return r}(n.search,t.current)),[n.search]),u=r.useNavigate(),i=a.useCallback(((e,t)=>{const r=f("function"==typeof e?e(o):e);u("?"+r,t)}),[u,o]);return[o,i]},e.useSubmit=function(){return P()},Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-router"),require("@remix-run/router")):"function"==typeof define&&define.amd?define(["exports","react","react-router","@remix-run/router"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactRouterDOM={},e.React,e.ReactRouter,e.Router)}(this,(function(e,t,r,n){"use strict";function o(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var a=o(t);function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u.apply(this,arguments)}function i(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}const c="get",l="application/x-www-form-urlencoded";function s(e){return null!=e&&"string"==typeof e.tagName}function f(e){return void 0===e&&(e=""),new URLSearchParams("string"==typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce(((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map((e=>[r,e])):[[r,n]])}),[]))}function d(e,t,r){let n,o,a,u;if(s(i=e)&&"form"===i.tagName.toLowerCase()){let i=r.submissionTrigger;n=r.method||e.getAttribute("method")||c,o=r.action||e.getAttribute("action")||t,a=r.encType||e.getAttribute("enctype")||l,u=new FormData(e),i&&i.name&&u.append(i.name,i.value)}else if(function(e){return s(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return s(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){let i=e.form;if(null==i)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');n=r.method||e.getAttribute("formmethod")||i.getAttribute("method")||c,o=r.action||e.getAttribute("formaction")||i.getAttribute("action")||t,a=r.encType||e.getAttribute("formenctype")||i.getAttribute("enctype")||l,u=new FormData(i),e.name&&u.append(e.name,e.value)}else{if(s(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');if(n=r.method||c,o=r.action||t,a=r.encType||l,e instanceof FormData)u=e;else if(u=new FormData,e instanceof URLSearchParams)for(let[t,r]of e)u.append(t,r);else if(null!=e)for(let t of Object.keys(e))u.append(t,e[t])}var i;let{protocol:f,host:d}=window.location;return{url:new URL(o,f+"//"+d),method:n,encType:a,formData:u}}const m=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset"],b=["aria-current","caseSensitive","className","end","style","to","children"],p=["reloadDocument","replace","method","action","onSubmit","fetcherKey","routeId","relative"];const h=a.forwardRef((function(e,t){let{onClick:n,relative:o,reloadDocument:c,replace:l,state:s,target:f,to:d,preventScrollReset:b}=e,p=i(e,m),h=r.useHref(d,{relative:o}),y=S(d,{replace:l,state:s,target:f,preventScrollReset:b,relative:o});return a.createElement("a",u({},p,{href:h,onClick:c?n:function(e){n&&n(e),e.defaultPrevented||y(e)},ref:t,target:f}))})),y=a.forwardRef((function(e,t){let o,{"aria-current":c="page",caseSensitive:l=!1,className:s="",end:f=!1,style:d,to:m,children:p}=e,y=i(e,b),g=r.useResolvedPath(m),v=r.useMatch({path:g.pathname,end:f,caseSensitive:l}),R=a.useContext(r.UNSAFE_DataRouterStateContext),P=null==R?void 0:R.navigation.location,O=r.useResolvedPath(P||""),w=null!=a.useMemo((()=>P?n.matchPath({path:g.pathname,end:f,caseSensitive:l},O.pathname):null),[P,g.pathname,l,f,O.pathname]),S=null!=v,j=S?c:void 0;o="function"==typeof s?s({isActive:S,isPending:w}):[s,S?"active":null,w?"pending":null].filter(Boolean).join(" ");let E="function"==typeof d?d({isActive:S,isPending:w}):d;return a.createElement(h,u({},y,{"aria-current":j,className:o,ref:t,style:E,to:m}),"function"==typeof p?p({isActive:S,isPending:w}):p)})),g=a.forwardRef(((e,t)=>a.createElement(v,u({},e,{ref:t})))),v=a.forwardRef(((e,t)=>{let{reloadDocument:r,replace:n,method:o=c,action:l,onSubmit:s,fetcherKey:f,routeId:d,relative:m}=e,b=i(e,p),h=j(f,d),y="get"===o.toLowerCase()?"get":"post",g=E(l,{relative:m});return a.createElement("form",u({ref:t,method:y,action:g,onSubmit:r?s:e=>{if(s&&s(e),e.defaultPrevented)return;e.preventDefault();let t=e.nativeEvent.submitter;h(t||e.currentTarget,{method:o,replace:n,relative:m})}},b))}));var R,P;function O(e){let t=a.useContext(r.UNSAFE_DataRouterContext);return t||n.invariant(!1),t}function w(e){let t=a.useContext(r.UNSAFE_DataRouterStateContext);return t||n.invariant(!1),t}function S(e,t){let{target:n,replace:o,state:u,preventScrollReset:i,relative:c}=void 0===t?{}:t,l=r.useNavigate(),s=r.useLocation(),f=r.useResolvedPath(e,{relative:c});return a.useCallback((t=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(t,n)){t.preventDefault();let n=void 0!==o?o:r.createPath(s)===r.createPath(f);l(e,{replace:n,state:u,preventScrollReset:i,relative:c})}}),[s,l,f,o,u,n,e,i,c])}function j(e,t){let{router:r}=O(R.UseSubmitImpl),o=E();return a.useCallback((function(a,u){if(void 0===u&&(u={}),"undefined"==typeof document)throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.");let{method:i,encType:c,formData:l,url:s}=d(a,o,u),f=s.pathname+s.search,m={replace:u.replace,formData:l,formMethod:i,formEncType:c};e?(null==t&&n.invariant(!1),r.fetch(e,t,f,m)):r.navigate(f,m)}),[o,r,e,t])}function E(e,t){let{relative:o}=void 0===t?{}:t,{basename:i}=a.useContext(r.UNSAFE_NavigationContext),c=a.useContext(r.UNSAFE_RouteContext);c||n.invariant(!1);let[l]=c.matches.slice(-1),s=null!=e?e:".",f=u({},r.useResolvedPath(s,{relative:o})),d=r.useLocation();if(null==e&&(f.search=d.search,f.hash=d.hash,l.route.index)){let e=new URLSearchParams(f.search);e.delete("index"),f.search=e.toString()?"?"+e.toString():""}return e&&"."!==e||!l.route.index||(f.search=f.search?f.search.replace(/^\?/,"?index&"):"?index"),"/"!==i&&(f.pathname="/"===f.pathname?i:n.joinPaths([i,f.pathname])),r.createPath(f)}!function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmitImpl="useSubmitImpl",e.UseFetcher="useFetcher"}(R||(R={})),function(e){e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"}(P||(P={}));let A=0;const N="react-router-scroll-positions";let C={};Object.defineProperty(e,"AbortedDeferredError",{enumerable:!0,get:function(){return r.AbortedDeferredError}}),Object.defineProperty(e,"Await",{enumerable:!0,get:function(){return r.Await}}),Object.defineProperty(e,"MemoryRouter",{enumerable:!0,get:function(){return r.MemoryRouter}}),Object.defineProperty(e,"Navigate",{enumerable:!0,get:function(){return r.Navigate}}),Object.defineProperty(e,"NavigationType",{enumerable:!0,get:function(){return r.NavigationType}}),Object.defineProperty(e,"Outlet",{enumerable:!0,get:function(){return r.Outlet}}),Object.defineProperty(e,"Route",{enumerable:!0,get:function(){return r.Route}}),Object.defineProperty(e,"Router",{enumerable:!0,get:function(){return r.Router}}),Object.defineProperty(e,"RouterProvider",{enumerable:!0,get:function(){return r.RouterProvider}}),Object.defineProperty(e,"Routes",{enumerable:!0,get:function(){return r.Routes}}),Object.defineProperty(e,"UNSAFE_DataRouterContext",{enumerable:!0,get:function(){return r.UNSAFE_DataRouterContext}}),Object.defineProperty(e,"UNSAFE_DataRouterStateContext",{enumerable:!0,get:function(){return r.UNSAFE_DataRouterStateContext}}),Object.defineProperty(e,"UNSAFE_DataStaticRouterContext",{enumerable:!0,get:function(){return r.UNSAFE_DataStaticRouterContext}}),Object.defineProperty(e,"UNSAFE_LocationContext",{enumerable:!0,get:function(){return r.UNSAFE_LocationContext}}),Object.defineProperty(e,"UNSAFE_NavigationContext",{enumerable:!0,get:function(){return r.UNSAFE_NavigationContext}}),Object.defineProperty(e,"UNSAFE_RouteContext",{enumerable:!0,get:function(){return r.UNSAFE_RouteContext}}),Object.defineProperty(e,"UNSAFE_enhanceManualRouteObjects",{enumerable:!0,get:function(){return r.UNSAFE_enhanceManualRouteObjects}}),Object.defineProperty(e,"createMemoryRouter",{enumerable:!0,get:function(){return r.createMemoryRouter}}),Object.defineProperty(e,"createPath",{enumerable:!0,get:function(){return r.createPath}}),Object.defineProperty(e,"createRoutesFromChildren",{enumerable:!0,get:function(){return r.createRoutesFromChildren}}),Object.defineProperty(e,"createRoutesFromElements",{enumerable:!0,get:function(){return r.createRoutesFromElements}}),Object.defineProperty(e,"defer",{enumerable:!0,get:function(){return r.defer}}),Object.defineProperty(e,"generatePath",{enumerable:!0,get:function(){return r.generatePath}}),Object.defineProperty(e,"isRouteErrorResponse",{enumerable:!0,get:function(){return r.isRouteErrorResponse}}),Object.defineProperty(e,"json",{enumerable:!0,get:function(){return r.json}}),Object.defineProperty(e,"matchPath",{enumerable:!0,get:function(){return r.matchPath}}),Object.defineProperty(e,"matchRoutes",{enumerable:!0,get:function(){return r.matchRoutes}}),Object.defineProperty(e,"parsePath",{enumerable:!0,get:function(){return r.parsePath}}),Object.defineProperty(e,"redirect",{enumerable:!0,get:function(){return r.redirect}}),Object.defineProperty(e,"renderMatches",{enumerable:!0,get:function(){return r.renderMatches}}),Object.defineProperty(e,"resolvePath",{enumerable:!0,get:function(){return r.resolvePath}}),Object.defineProperty(e,"useActionData",{enumerable:!0,get:function(){return r.useActionData}}),Object.defineProperty(e,"useAsyncError",{enumerable:!0,get:function(){return r.useAsyncError}}),Object.defineProperty(e,"useAsyncValue",{enumerable:!0,get:function(){return r.useAsyncValue}}),Object.defineProperty(e,"useHref",{enumerable:!0,get:function(){return r.useHref}}),Object.defineProperty(e,"useInRouterContext",{enumerable:!0,get:function(){return r.useInRouterContext}}),Object.defineProperty(e,"useLoaderData",{enumerable:!0,get:function(){return r.useLoaderData}}),Object.defineProperty(e,"useLocation",{enumerable:!0,get:function(){return r.useLocation}}),Object.defineProperty(e,"useMatch",{enumerable:!0,get:function(){return r.useMatch}}),Object.defineProperty(e,"useMatches",{enumerable:!0,get:function(){return r.useMatches}}),Object.defineProperty(e,"useNavigate",{enumerable:!0,get:function(){return r.useNavigate}}),Object.defineProperty(e,"useNavigation",{enumerable:!0,get:function(){return r.useNavigation}}),Object.defineProperty(e,"useNavigationType",{enumerable:!0,get:function(){return r.useNavigationType}}),Object.defineProperty(e,"useOutlet",{enumerable:!0,get:function(){return r.useOutlet}}),Object.defineProperty(e,"useOutletContext",{enumerable:!0,get:function(){return r.useOutletContext}}),Object.defineProperty(e,"useParams",{enumerable:!0,get:function(){return r.useParams}}),Object.defineProperty(e,"useResolvedPath",{enumerable:!0,get:function(){return r.useResolvedPath}}),Object.defineProperty(e,"useRevalidator",{enumerable:!0,get:function(){return r.useRevalidator}}),Object.defineProperty(e,"useRouteError",{enumerable:!0,get:function(){return r.useRouteError}}),Object.defineProperty(e,"useRouteLoaderData",{enumerable:!0,get:function(){return r.useRouteLoaderData}}),Object.defineProperty(e,"useRoutes",{enumerable:!0,get:function(){return r.useRoutes}}),e.BrowserRouter=function(e){let{basename:t,children:o,window:u}=e,i=a.useRef();null==i.current&&(i.current=n.createBrowserHistory({window:u,v5Compat:!0}));let c=i.current,[l,s]=a.useState({action:c.action,location:c.location});return a.useLayoutEffect((()=>c.listen(s)),[c]),a.createElement(r.Router,{basename:t,children:o,location:l.location,navigationType:l.action,navigator:c})},e.Form=g,e.HashRouter=function(e){let{basename:t,children:o,window:u}=e,i=a.useRef();null==i.current&&(i.current=n.createHashHistory({window:u,v5Compat:!0}));let c=i.current,[l,s]=a.useState({action:c.action,location:c.location});return a.useLayoutEffect((()=>c.listen(s)),[c]),a.createElement(r.Router,{basename:t,children:o,location:l.location,navigationType:l.action,navigator:c})},e.Link=h,e.NavLink=y,e.ScrollRestoration=function(e){let{getKey:t,storageKey:n}=e;return function(e){let{getKey:t,storageKey:n}=void 0===e?{}:e,{router:o}=O(R.UseScrollRestoration),{restoreScrollPosition:u,preventScrollReset:i}=w(P.UseScrollRestoration),c=r.useLocation(),l=r.useMatches(),s=r.useNavigation();a.useEffect((()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"})),[]),f=a.useCallback((()=>{if("idle"===s.state){let e=(t?t(c,l):null)||c.key;C[e]=window.scrollY}sessionStorage.setItem(n||N,JSON.stringify(C)),window.history.scrollRestoration="auto"}),[n,t,s.state,c,l]),a.useEffect((()=>(window.addEventListener("beforeunload",f),()=>{window.removeEventListener("beforeunload",f)})),[f]),a.useLayoutEffect((()=>{try{let e=sessionStorage.getItem(n||N);e&&(C=JSON.parse(e))}catch(e){}}),[n]),a.useLayoutEffect((()=>{let e=null==o?void 0:o.enableScrollRestoration(C,(()=>window.scrollY),t);return()=>e&&e()}),[o,t]),a.useLayoutEffect((()=>{if(!1!==u)if("number"!=typeof u){if(c.hash){let e=document.getElementById(c.hash.slice(1));if(e)return void e.scrollIntoView()}!0!==i&&window.scrollTo(0,0)}else window.scrollTo(0,u)}),[c,u,i]);var f}({getKey:t,storageKey:n}),null},e.createBrowserRouter=function(e,t){var o;return n.createRouter({basename:null==t?void 0:t.basename,history:n.createBrowserHistory({window:null==t?void 0:t.window}),hydrationData:(null==t?void 0:t.hydrationData)||(null==(o=window)?void 0:o.__staticRouterHydrationData),routes:r.UNSAFE_enhanceManualRouteObjects(e)}).initialize()},e.createHashRouter=function(e,t){var o;return n.createRouter({basename:null==t?void 0:t.basename,history:n.createHashHistory({window:null==t?void 0:t.window}),hydrationData:(null==t?void 0:t.hydrationData)||(null==(o=window)?void 0:o.__staticRouterHydrationData),routes:r.UNSAFE_enhanceManualRouteObjects(e)}).initialize()},e.createSearchParams=f,e.unstable_HistoryRouter=function(e){let{basename:t,children:n,history:o}=e;const[u,i]=a.useState({action:o.action,location:o.location});return a.useLayoutEffect((()=>o.listen(i)),[o]),a.createElement(r.Router,{basename:t,children:n,location:u.location,navigationType:u.action,navigator:o})},e.useFetcher=function(){var e;let{router:t}=O(R.UseFetcher),o=a.useContext(r.UNSAFE_RouteContext);o||n.invariant(!1);let i=null==(e=o.matches[o.matches.length-1])?void 0:e.route.id;null==i&&n.invariant(!1);let[c]=a.useState((()=>String(++A))),[l]=a.useState((()=>(i||n.invariant(!1),function(e,t){return a.forwardRef(((r,n)=>a.createElement(v,u({},r,{ref:n,fetcherKey:e,routeId:t}))))}(c,i)))),[s]=a.useState((()=>e=>{t||n.invariant(!1),i||n.invariant(!1),t.fetch(c,i,e)})),f=j(c,i),d=t.getFetcher(c),m=a.useMemo((()=>u({Form:l,submit:f,load:s},d)),[d,l,f,s]);return a.useEffect((()=>()=>{t?t.deleteFetcher(c):console.warn("No fetcher available to clean up from useFetcher()")}),[t,c]),m},e.useFetchers=function(){return[...w(P.UseFetchers).fetchers.values()]},e.useFormAction=E,e.useLinkClickHandler=S,e.useSearchParams=function(e){let t=a.useRef(f(e)),n=r.useLocation(),o=a.useMemo((()=>function(e,t){let r=f(e);for(let e of t.keys())r.has(e)||t.getAll(e).forEach((t=>{r.append(e,t)}));return r}(n.search,t.current)),[n.search]),u=r.useNavigate(),i=a.useCallback(((e,t)=>{const r=f("function"==typeof e?e(o):e);u("?"+r,t)}),[u,o]);return[o,i]},e.useSubmit=function(){return j()},Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=react-router-dom.production.min.js.map
{
"name": "react-router-dom",
"version": "6.4.1",
"version": "6.4.2-pre.0",
"description": "Declarative routing for React web applications",

@@ -26,4 +26,4 @@ "keywords": [

"dependencies": {
"@remix-run/router": "1.0.1",
"react-router": "6.4.1"
"@remix-run/router": "1.0.2-pre.0",
"react-router": "6.4.2-pre.0"
},

@@ -30,0 +30,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc