import {
  useLocation
} from "../chunk.3LWSN4DC.js";
import {
  Link,
  NavLink
} from "../chunk.43AVWB5L.js";
import {
  Prompt,
  React,
  Redirect,
  Route,
  Router,
  Switch,
  _objectWithoutPropertiesLoose,
  context,
  generatePath,
  historyContext,
  import_hoist_non_react_statics,
  import_prop_types,
  matchPath,
  tiny_invariant_esm_default,
  useContext
} from "../chunk.IOTCVWDR.js";
import {
  _extends
} from "../chunk.JNDOIKBN.js";
import "../chunk.DYBFOFDN.js";
import "../chunk.NFF22PP7.js";

// node_modules/react-router/esm/react-router.js
function withRouter(Component) {
  var displayName = "withRouter(" + (Component.displayName || Component.name) + ")";
  var C = function C2(props) {
    var wrappedComponentRef = props.wrappedComponentRef, remainingProps = _objectWithoutPropertiesLoose(props, ["wrappedComponentRef"]);
    return React.createElement(context.Consumer, null, function(context2) {
      !context2 ? process.env.NODE_ENV !== "production" ? tiny_invariant_esm_default(false, "You should not use <" + displayName + " /> outside a <Router>") : tiny_invariant_esm_default(false) : void 0;
      return React.createElement(Component, _extends({}, remainingProps, context2, {
        ref: wrappedComponentRef
      }));
    });
  };
  C.displayName = displayName;
  C.WrappedComponent = Component;
  if (process.env.NODE_ENV !== "production") {
    C.propTypes = {
      wrappedComponentRef: import_prop_types.default.oneOfType([import_prop_types.default.string, import_prop_types.default.func, import_prop_types.default.object])
    };
  }
  return import_hoist_non_react_statics.default(C, Component);
}
function useHistory() {
  if (process.env.NODE_ENV !== "production") {
    !(typeof useContext === "function") ? process.env.NODE_ENV !== "production" ? tiny_invariant_esm_default(false, "You must use React >= 16.8 in order to use useHistory()") : tiny_invariant_esm_default(false) : void 0;
  }
  return useContext(historyContext);
}
function useParams() {
  if (process.env.NODE_ENV !== "production") {
    !(typeof useContext === "function") ? process.env.NODE_ENV !== "production" ? tiny_invariant_esm_default(false, "You must use React >= 16.8 in order to use useParams()") : tiny_invariant_esm_default(false) : void 0;
  }
  var match = useContext(context).match;
  return match ? match.params : {};
}
function useRouteMatch(path) {
  if (process.env.NODE_ENV !== "production") {
    !(typeof useContext === "function") ? process.env.NODE_ENV !== "production" ? tiny_invariant_esm_default(false, "You must use React >= 16.8 in order to use useRouteMatch()") : tiny_invariant_esm_default(false) : void 0;
  }
  var location = useLocation();
  var match = useContext(context).match;
  return path ? matchPath(location.pathname, path) : match;
}
export {
  Link,
  NavLink,
  Prompt,
  Redirect,
  Route,
  Router,
  Switch,
  generatePath,
  matchPath,
  useHistory,
  useLocation,
  useParams,
  useRouteMatch,
  withRouter
};
