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
459
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.0-pre.7 to 6.4.0-pre.8

16

CHANGELOG.md
# react-router-dom
## 6.4.0-pre.8
### Patch Changes
- fix: Make path resolution trailing slash agnostic (#8861)
- fix: export ActionFunctionArgs/LoaderFunctionArgs up through router packages (#8975)
- Updated dependencies
- react-router@6.4.0-pre.8
## 6.4.0-pre.7

@@ -7,3 +16,3 @@

- 26302209: Respect the `<Link replace>` prop if it is defined (#8779)
- Respect the `<Link replace>` prop if it is defined (#8779)
- Updated dependencies

@@ -16,3 +25,4 @@ - `react-router@6.4.0-pre.7`

- react-router@6.4.0-pre.6
- Updated dependencies
- `react-router@6.4.0-pre.6`

@@ -25,3 +35,3 @@ ## 6.4.0-pre.5

- Updated dependencies
- react-router@6.4.0-pre.5
- `react-router@6.4.0-pre.5`

@@ -28,0 +38,0 @@ ## 6.4.0-pre.4

2

dist/index.d.ts

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

export { createSearchParams };
export type { ActionFunction, DataMemoryRouterProps, DataRouteMatch, Fetcher, Hash, IndexRouteProps, JsonFunction, LayoutRouteProps, LoaderFunction, Location, MemoryRouterProps, NavigateFunction, NavigateOptions, NavigateProps, Navigation, Navigator, OutletProps, Params, ParamParseKey, Path, PathMatch, Pathname, PathPattern, PathRouteProps, RedirectFunction, RouteMatch, RouteObject, RouteProps, RouterProps, RoutesProps, Search, ShouldRevalidateFunction, To, } from "react-router";
export type { ActionFunction, ActionFunctionArgs, DataMemoryRouterProps, DataRouteMatch, Fetcher, Hash, IndexRouteProps, JsonFunction, LayoutRouteProps, LoaderFunction, LoaderFunctionArgs, Location, MemoryRouterProps, NavigateFunction, NavigateOptions, NavigateProps, Navigation, Navigator, OutletProps, Params, ParamParseKey, Path, PathMatch, Pathname, PathPattern, PathRouteProps, RedirectFunction, RouteMatch, RouteObject, RouteProps, RouterProps, RoutesProps, Search, ShouldRevalidateFunction, To, } from "react-router";
export { DataMemoryRouter, MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, Routes, createPath, createRoutesFromChildren, isRouteErrorResponse, generatePath, json, matchPath, matchRoutes, parsePath, redirect, renderMatches, resolvePath, useActionData, 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.0-pre.7
* React Router DOM v6.4.0-pre.8
*

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

let opts = {
// If replace is not specified, we'll default to false for GET and
// true otherwise
replace: options.replace != null ? options.replace === true : method !== "get",
replace: options.replace,
formData,

@@ -605,0 +603,0 @@ formMethod: method,

/**
* React Router DOM v6.4.0-pre.7
* React Router DOM v6.4.0-pre.8
*

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

/**
* React Router DOM v6.4.0-pre.7
* React Router DOM v6.4.0-pre.8
*

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

let opts = {
// If replace is not specified, we'll default to false for GET and
// true otherwise
replace: options.replace != null ? options.replace === true : method !== "get",
replace: options.replace,
formData,

@@ -554,0 +552,0 @@ formMethod: method,

/**
* React Router DOM v6.4.0-pre.7
* React Router DOM v6.4.0-pre.8
*

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

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

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

let opts = {
// If replace is not specified, we'll default to false for GET and
// true otherwise
replace: options.replace != null ? options.replace === true : method !== "get",
replace: options.replace,
formData,

@@ -627,0 +625,0 @@ formMethod: method,

/**
* React Router DOM v6.4.0-pre.7
* React Router DOM v6.4.0-pre.8
*

@@ -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.set(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","reloadDocument","replace","state","target","to","resetScroll"],b=["aria-current","caseSensitive","className","end","style","to","children"],p=["replace","method","action","onSubmit","fetcherKey","routeId"];const y=a.forwardRef((function(e,t){let{onClick:n,reloadDocument:o,replace:c,state:l,target:s,to:f,resetScroll:d}=e,b=i(e,m),p=r.useHref(f),y=R(f,{replace:c,state:l,target:s,resetScroll:d});return a.createElement("a",u({},b,{href:p,onClick:function(e){n&&n(e),e.defaultPrevented||o||y(e)},ref:t,target:s}))})),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,w=r.useResolvedPath(P||""),O=null!=a.useMemo((()=>P?n.matchPath({path:g.pathname,end:f,caseSensitive:l},w.pathname):null),[P,g.pathname,l,f,w.pathname]),j=null!=v,S=j?c:void 0;o="function"==typeof s?s({isActive:j,isPending:O}):[s,j?"active":null,O?"pending":null].filter(Boolean).join(" ");let E="function"==typeof d?d({isActive:j,isPending:O}):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:O}):p)})),g=a.forwardRef(((e,t)=>a.createElement(v,u({},e,{ref:t})))),v=a.forwardRef(((e,t)=>{let{replace:r,method:n=c,action:o=".",onSubmit:l,fetcherKey:s,routeId:f}=e,d=i(e,p),m=P(s,f),b="get"===n.toLowerCase()?"get":"post",y=w(o);return a.createElement("form",u({ref:t,method:b,action:y,onSubmit:e=>{if(l&&l(e),e.defaultPrevented)return;e.preventDefault();let t=e.nativeEvent.submitter;m(t||e.currentTarget,{method:n,replace:r})}},d))}));function R(e,t){let{target:n,replace:o,state:u,resetScroll:i}=void 0===t?{}:t,c=r.useNavigate(),l=r.useLocation(),s=r.useResolvedPath(e);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(l)===r.createPath(s);c(e,{replace:n,state:u,resetScroll:i})}}),[l,c,s,o,u,n,e,i])}function P(e,t){let o=a.useContext(r.UNSAFE_DataRouterContext),u=w();return a.useCallback((function(r,a){if(void 0===a&&(a={}),null==o&&n.invariant(!1),"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(r,u,a),f=s.pathname+s.search,m={replace:null!=a.replace?!0===a.replace:"get"!==i,formData:l,formMethod:i,formEncType:c};e?(null==t&&n.invariant(!1),o.fetch(e,t,f,m)):o.navigate(f,m)}),[u,o,e,t])}function w(e){void 0===e&&(e=".");let t=a.useContext(r.UNSAFE_RouteContext);t||n.invariant(!1);let[o]=t.matches.slice(-1),{pathname:u,search:i}=r.useResolvedPath(e);return"."===e&&o.route.index&&(i=i?i.replace(/^\?/,"?index&"):"?index"),u+i}let O=0;const j="react-router-scroll-positions";let S={};Object.defineProperty(e,"DataMemoryRouter",{enumerable:!0,get:function(){return r.DataMemoryRouter}}),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,"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_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,"createPath",{enumerable:!0,get:function(){return r.createPath}}),Object.defineProperty(e,"createRoutesFromChildren",{enumerable:!0,get:function(){return r.createRoutesFromChildren}}),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,"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,"useRenderDataRouter",{enumerable:!0,get:function(){return r.useRenderDataRouter}}),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.DataBrowserRouter=function(e){let{children:t,fallbackElement:o,hydrationData:a,routes:u,window:i}=e;return r.useRenderDataRouter({children:t,fallbackElement:o,routes:u,createRouter:e=>n.createBrowserRouter({routes:e,hydrationData:a,window:i})})},e.DataHashRouter=function(e){let{children:t,hydrationData:o,fallbackElement:a,routes:u,window:i}=e;return r.useRenderDataRouter({children:t,fallbackElement:a,routes:u,createRouter:e=>n.createHashRouter({routes:e,hydrationData:o,window:i})})},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=a.useContext(r.UNSAFE_DataRouterContext),c=a.useContext(r.UNSAFE_DataRouterStateContext);(null==i||null==c)&&n.invariant(!1);let{restoreScrollPosition:l,resetScrollPosition:s}=c;a.useEffect((()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"})),[]),f=a.useCallback((()=>{if("idle"===(null==c?void 0:c.navigation.state)){let e=(t?t(c.location,c.matches):null)||c.location.key;S[e]=window.scrollY}sessionStorage.setItem(o||j,JSON.stringify(S)),window.history.scrollRestoration="auto"}),[o,t,c.navigation.state,c.location,c.matches]),a.useEffect((()=>(window.addEventListener("beforeunload",f),()=>{window.removeEventListener("beforeunload",f)})),[f]),a.useLayoutEffect((()=>{try{let e=sessionStorage.getItem(o||j);e&&(S=JSON.parse(e))}catch(e){}}),[o]),a.useLayoutEffect((()=>{let e=null==i?void 0:i.enableScrollRestoration(S,(()=>window.scrollY),t);return()=>e&&e()}),[i,t]),a.useLayoutEffect((()=>{if(!1!==l)if("number"!=typeof l){if(u.hash){let e=document.getElementById(u.hash.slice(1));if(e)return void e.scrollIntoView()}!1!==s&&window.scrollTo(0,0)}else window.scrollTo(0,l)}),[u,l,s]);var f}({getKey:t,storageKey:o}),null},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 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(++O))),[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=P(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(){let e=a.useContext(r.UNSAFE_DataRouterStateContext);return e||n.invariant(!1),[...e.fetchers.values()]},e.useFormAction=w,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.set(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","reloadDocument","replace","state","target","to","resetScroll"],b=["aria-current","caseSensitive","className","end","style","to","children"],p=["replace","method","action","onSubmit","fetcherKey","routeId"];const y=a.forwardRef((function(e,t){let{onClick:n,reloadDocument:o,replace:c,state:l,target:s,to:f,resetScroll:d}=e,b=i(e,m),p=r.useHref(f),y=R(f,{replace:c,state:l,target:s,resetScroll:d});return a.createElement("a",u({},b,{href:p,onClick:function(e){n&&n(e),e.defaultPrevented||o||y(e)},ref:t,target:s}))})),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,w=r.useResolvedPath(P||""),O=null!=a.useMemo((()=>P?n.matchPath({path:g.pathname,end:f,caseSensitive:l},w.pathname):null),[P,g.pathname,l,f,w.pathname]),j=null!=v,S=j?c:void 0;o="function"==typeof s?s({isActive:j,isPending:O}):[s,j?"active":null,O?"pending":null].filter(Boolean).join(" ");let E="function"==typeof d?d({isActive:j,isPending:O}):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:O}):p)})),g=a.forwardRef(((e,t)=>a.createElement(v,u({},e,{ref:t})))),v=a.forwardRef(((e,t)=>{let{replace:r,method:n=c,action:o=".",onSubmit:l,fetcherKey:s,routeId:f}=e,d=i(e,p),m=P(s,f),b="get"===n.toLowerCase()?"get":"post",y=w(o);return a.createElement("form",u({ref:t,method:b,action:y,onSubmit:e=>{if(l&&l(e),e.defaultPrevented)return;e.preventDefault();let t=e.nativeEvent.submitter;m(t||e.currentTarget,{method:n,replace:r})}},d))}));function R(e,t){let{target:n,replace:o,state:u,resetScroll:i}=void 0===t?{}:t,c=r.useNavigate(),l=r.useLocation(),s=r.useResolvedPath(e);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(l)===r.createPath(s);c(e,{replace:n,state:u,resetScroll:i})}}),[l,c,s,o,u,n,e,i])}function P(e,t){let o=a.useContext(r.UNSAFE_DataRouterContext),u=w();return a.useCallback((function(r,a){if(void 0===a&&(a={}),null==o&&n.invariant(!1),"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(r,u,a),f=s.pathname+s.search,m={replace:a.replace,formData:l,formMethod:i,formEncType:c};e?(null==t&&n.invariant(!1),o.fetch(e,t,f,m)):o.navigate(f,m)}),[u,o,e,t])}function w(e){void 0===e&&(e=".");let t=a.useContext(r.UNSAFE_RouteContext);t||n.invariant(!1);let[o]=t.matches.slice(-1),{pathname:u,search:i}=r.useResolvedPath(e);return"."===e&&o.route.index&&(i=i?i.replace(/^\?/,"?index&"):"?index"),u+i}let O=0;const j="react-router-scroll-positions";let S={};Object.defineProperty(e,"DataMemoryRouter",{enumerable:!0,get:function(){return r.DataMemoryRouter}}),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,"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_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,"createPath",{enumerable:!0,get:function(){return r.createPath}}),Object.defineProperty(e,"createRoutesFromChildren",{enumerable:!0,get:function(){return r.createRoutesFromChildren}}),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,"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,"useRenderDataRouter",{enumerable:!0,get:function(){return r.useRenderDataRouter}}),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.DataBrowserRouter=function(e){let{children:t,fallbackElement:o,hydrationData:a,routes:u,window:i}=e;return r.useRenderDataRouter({children:t,fallbackElement:o,routes:u,createRouter:e=>n.createBrowserRouter({routes:e,hydrationData:a,window:i})})},e.DataHashRouter=function(e){let{children:t,hydrationData:o,fallbackElement:a,routes:u,window:i}=e;return r.useRenderDataRouter({children:t,fallbackElement:a,routes:u,createRouter:e=>n.createHashRouter({routes:e,hydrationData:o,window:i})})},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=a.useContext(r.UNSAFE_DataRouterContext),c=a.useContext(r.UNSAFE_DataRouterStateContext);(null==i||null==c)&&n.invariant(!1);let{restoreScrollPosition:l,resetScrollPosition:s}=c;a.useEffect((()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"})),[]),f=a.useCallback((()=>{if("idle"===(null==c?void 0:c.navigation.state)){let e=(t?t(c.location,c.matches):null)||c.location.key;S[e]=window.scrollY}sessionStorage.setItem(o||j,JSON.stringify(S)),window.history.scrollRestoration="auto"}),[o,t,c.navigation.state,c.location,c.matches]),a.useEffect((()=>(window.addEventListener("beforeunload",f),()=>{window.removeEventListener("beforeunload",f)})),[f]),a.useLayoutEffect((()=>{try{let e=sessionStorage.getItem(o||j);e&&(S=JSON.parse(e))}catch(e){}}),[o]),a.useLayoutEffect((()=>{let e=null==i?void 0:i.enableScrollRestoration(S,(()=>window.scrollY),t);return()=>e&&e()}),[i,t]),a.useLayoutEffect((()=>{if(!1!==l)if("number"!=typeof l){if(u.hash){let e=document.getElementById(u.hash.slice(1));if(e)return void e.scrollIntoView()}!1!==s&&window.scrollTo(0,0)}else window.scrollTo(0,l)}),[u,l,s]);var f}({getKey:t,storageKey:o}),null},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 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(++O))),[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=P(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(){let e=a.useContext(r.UNSAFE_DataRouterStateContext);return e||n.invariant(!1),[...e.fetchers.values()]},e.useFormAction=w,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})}));
//# sourceMappingURL=react-router-dom.production.min.js.map
{
"name": "react-router-dom",
"version": "6.4.0-pre.7",
"version": "6.4.0-pre.8",
"description": "Declarative routing for React web applications",

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

"dependencies": {
"react-router": "6.4.0-pre.7"
"react-router": "6.4.0-pre.8"
},

@@ -29,0 +29,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