text: import { useRef, useState, useLayoutEffect, createElement, forwardRef, useCallback, useMemo } from 'react';
  import { createBrowserHistory, createHashHistory, createPath } from 'history';
  import { Router, useHref, useNavigate, useLocation, useResolvedPath, useBlocker } from 'react-router';
  export { MemoryRouter, Navigate, Outlet, Route, Router, Routes, UNSAFE_LocationContext, UNSAFE_NavigatorContext, UNSAFE_RouteContext, createRoutesFromArray, createRoutesFromChildren, generatePath, matchPath, matchRoutes, resolvePath, useBlocker, useHref, useInRouterContext, useLocation, useMatch, useNavigate, useOutlet, useParams, useResolvedPath, useRoutes } from 'react-router';
  
  function warning(cond, message) {
    if (!cond) {
      // eslint-disable-next-line no-console
      if (typeof console !== "undefined") console.warn(message);
  
      try {
        // Welcome to debugging React Router!
        //
        // This error is thrown as a convenience so you can more easily
        // find the source for a warning that appears in the console by
        // enabling "pause on exceptions" in your JavaScript debugger.
        throw new Error(message); // eslint-disable-next-line no-empty
      } catch (e) {}
    }
  } ////////////////////////////////////////////////////////////////////////////////
  /**
   * A <Router> for use in web browsers. Provides the cleanest URLs.
   */
  
  function BrowserRouter({
    children,
    window
  }) {
    let historyRef = useRef();
  
    if (historyRef.current == null) {
      historyRef.current = createBrowserHistory({
        window
      });
    }
  
    let history = historyRef.current;
    let [state, setState] = useState({
      action: history.action,
      location: history.location
    });
    useLayoutEffect(() => history.listen(setState), [history]);
    return /*#__PURE__*/createElement(Router, {
      children: children,
      action: state.action,
      location: state.location,
      navigator: history
    });
  }
  /**
   * A <Router> for use in web browsers. Stores the location in the hash
   * portion of the URL so it is not sent to the server.
   */
  
  function HashRouter({
    children,
    window
  }) {
    let historyRef = useRef();
  
    if (historyRef.current == null) {
      historyRef.current = createHashHistory({
        window
      });
    }
  
    let history = historyRef.current;
    let [state, setState] = useState({
      action: history.action,
      location: history.location
    });
    useLayoutEffect(() => history.listen(setState), [history]);
    return /*#__PURE__*/createElement(Router, {
      children: children,
      action: state.action,
      location: state.location,
      navigator: history
    });
  }
  
  function isModifiedEvent(event) {
    return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
  }
  /**
   * The public API for rendering a history-aware <a>.
   */
  
  
  const Link = /*#__PURE__*/forwardRef(function LinkWithRef({
    onClick,
    replace: replaceProp = false,
    state,
    target,
    to,
    ...rest
  }, ref) {
    let href = useHref(to);
    let navigate = useNavigate();
    let location = useLocation();
    let path = useResolvedPath(to);
  
    function handleClick(event) {
      if (onClick) onClick(event);
  
      if (!event.defaultPrevented && // onClick prevented default
      event.button === 0 && ( // Ignore everything but left clicks
      !target || target === "_self") && // Let browser handle "target=_blank" etc.
      !isModifiedEvent(event) // Ignore clicks with modifier keys
      ) {
          event.preventDefault(); // If the URL hasn't changed, a regular <a> will do a replace instead of
          // a push, so do the same here.
  
          let replace = !!replaceProp || createPath(location) === createPath(path);
          navigate(to, {
            replace,
            state
          });
        }
    }
  
    return (
      /*#__PURE__*/
      // eslint-disable-next-line jsx-a11y/anchor-has-content
      createElement("a", { ...rest,
        href: href,
        onClick: handleClick,
        ref: ref,
        target: target
      })
    );
  });
  
  {
    Link.displayName = "Link";
  }
  /**
   * A <Link> wrapper that knows if it's "active" or not.
   */
  
  
  const NavLink = /*#__PURE__*/forwardRef(function NavLinkWithRef({
    "aria-current": ariaCurrentProp = "page",
    activeClassName = "active",
    activeStyle,
    caseSensitive = false,
    className: classNameProp = "",
    end = false,
    style: styleProp,
    to,
    ...rest
  }, ref) {
    let location = useLocation();
    let path = useResolvedPath(to);
    let locationPathname = location.pathname;
    let toPathname = path.pathname;
  
    if (!caseSensitive) {
      locationPathname = locationPathname.toLowerCase();
      toPathname = toPathname.toLowerCase();
    }
  
    let isActive = end ? locationPathname === toPathname : locationPathname.startsWith(toPathname);
    let ariaCurrent = isActive ? ariaCurrentProp : undefined;
    let className = [classNameProp, isActive ? activeClassName : null].filter(Boolean).join(" ");
    let style = { ...styleProp,
      ...(isActive ? activeStyle : null)
    };
    return /*#__PURE__*/createElement(Link, { ...rest,
      "aria-current": ariaCurrent,
      className: className,
      ref: ref,
      style: style,
      to: to
    });
  });
  
  {
    NavLink.displayName = "NavLink";
  }
  /**
   * A declarative interface for showing a window.confirm dialog with the given
   * message when the user tries to navigate away from the current page.
   *
   * This also serves as a reference implementation for anyone who wants to
   * create their own custom prompt component.
   */
  
  
  function Prompt({
    message,
    when
  }) {
    usePrompt(message, when);
    return null;
  } ////////////////////////////////////////////////////////////////////////////////
  // HOOKS
  ////////////////////////////////////////////////////////////////////////////////
  
  /**
   * Prevents navigation away from the current page using a window.confirm prompt
   * with the given message.
   */
  
  function usePrompt(message, when = true) {
    let blocker = useCallback(tx => {
      if (window.confirm(message)) tx.retry();
    }, [message]);
    useBlocker(blocker, when);
  }
  /**
   * A convenient wrapper for reading and writing search parameters via the
   * URLSearchParams interface.
   */
  
  function useSearchParams(defaultInit) {
     warning(typeof URLSearchParams !== "undefined", `You cannot use the \`useSearchParams\` hook in a browser that does not ` + `support the URLSearchParams API. If you need to support Internet ` + `Explorer 11, we recommend you load a polyfill such as ` + `https://github.com/ungap/url-search-params\n\n` + `If you're unsure how to load polyfills, we recommend you check out ` + `https://polyfill.io/v3/ which provides some recommendations about how ` + `to load polyfills only for users that need them, instead of for every ` + `user.`) ;
    let defaultSearchParamsRef = useRef(createSearchParams(defaultInit));
    let location = useLocation();
    let searchParams = useMemo(() => {
      let searchParams = createSearchParams(location.search);
  
      for (let key of defaultSearchParamsRef.current.keys()) {
        if (!searchParams.has(key)) {
          defaultSearchParamsRef.current.getAll(key).forEach(value => {
            searchParams.append(key, value);
          });
        }
      }
  
      return searchParams;
    }, [location.search]);
    let navigate = useNavigate();
    let setSearchParams = useCallback((nextInit, navigateOptions) => {
      navigate("?" + createSearchParams(nextInit), navigateOptions);
    }, [navigate]);
    return [searchParams, setSearchParams];
  }
  /**
   * Creates a URLSearchParams object using the given initializer.
   *
   * This is identical to `new URLSearchParams(init)` except it also
   * supports arrays as values in the object form of the initializer
   * instead of just strings. This is convenient when you need multiple
   * values for a given key, but don't want to use an array initializer.
   *
   * For example, instead of:
   *
   *   let searchParams = new URLSearchParams([
   *     ['sort', 'name'],
   *     ['sort', 'price']
   *   ]);
   *
   * you can do:
   *
   *   let searchParams = createSearchParams({
   *     sort: ['name', 'price']
   *   });
   */
  
  function createSearchParams(init = "") {
    return new URLSearchParams(typeof init === "string" || Array.isArray(init) || init instanceof URLSearchParams ? init : Object.keys(init).reduce((memo, key) => {
      let value = init[key];
      return memo.concat(Array.isArray(value) ? value.map(v => [key, v]) : [[key, value]]);
    }, []));
  }
  
  export { BrowserRouter, HashRouter, Link, NavLink, Prompt, createSearchParams, usePrompt, useSearchParams };
  //# sourceMappingURL=react-router-dom.development.js.map
  