content: var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
  
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  
  function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  
  import warning from 'warning';
  import React from 'react';
  import PropTypes from 'prop-types';
  import matchPath from './matchPath';
  
  /**
   * The public API for matching a single path and rendering.
   */
  
  var Route = function (_React$Component) {
    _inherits(Route, _React$Component);
  
    function Route() {
      var _temp, _this, _ret;
  
      _classCallCheck(this, Route);
  
      for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }
  
      return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.state = {
        match: _this.computeMatch(_this.props, _this.context.router)
      }, _temp), _possibleConstructorReturn(_this, _ret);
    }
  
    Route.prototype.getChildContext = function getChildContext() {
      return {
        router: _extends({}, this.context.router, {
          route: {
            location: this.props.location || this.context.router.route.location,
            match: this.state.match
          }
        })
      };
    };
  
    Route.prototype.computeMatch = function computeMatch(_ref, _ref2) {
      var computedMatch = _ref.computedMatch,
          location = _ref.location,
          path = _ref.path,
          strict = _ref.strict,
          exact = _ref.exact;
      var route = _ref2.route;
  
      if (computedMatch) return computedMatch; // <Switch> already computed the match for us
  
      var pathname = (location || route.location).pathname;
  
      return path ? matchPath(pathname, { path: path, strict: strict, exact: exact }) : route.match;
    };
  
    Route.prototype.componentWillMount = function componentWillMount() {
      var _props = this.props,
          component = _props.component,
          render = _props.render,
          children = _props.children;
  
  
      warning(!(component && render), 'You should not use <Route component> and <Route render> in the same route; <Route render> will be ignored');
  
      warning(!(component && children), 'You should not use <Route component> and <Route children> in the same route; <Route children> will be ignored');
  
      warning(!(render && children), 'You should not use <Route render> and <Route children> in the same route; <Route children> will be ignored');
    };
  
    Route.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps, nextContext) {
      warning(!(nextProps.location && !this.props.location), '<Route> elements should not change from uncontrolled to controlled (or vice versa). You initially used no "location" prop and then provided one on a subsequent render.');
  
      warning(!(!nextProps.location && this.props.location), '<Route> elements should not change from controlled to uncontrolled (or vice versa). You provided a "location" prop initially but omitted it on a subsequent render.');
  
      this.setState({
        match: this.computeMatch(nextProps, nextContext.router)
      });
    };
  
    Route.prototype.render = function render() {
      var match = this.state.match;
      var _props2 = this.props,
          children = _props2.children,
          component = _props2.component,
          render = _props2.render;
      var _context$router = this.context.router,
          history = _context$router.history,
          route = _context$router.route,
          staticContext = _context$router.staticContext;
  
      var location = this.props.location || route.location;
      var props = { match: match, location: location, history: history, staticContext: staticContext };
  
      return component ? // component prop gets first priority, only called if there's a match
      match ? React.createElement(component, props) : null : render ? // render prop is next, only called if there's a match
      match ? render(props) : null : children ? // children come last, always called
      typeof children === 'function' ? children(props) : !Array.isArray(children) || children.length ? // Preact defaults to empty children array
      React.Children.only(children) : null : null;
    };
  
    return Route;
  }(React.Component);
  
  Route.propTypes = {
    computedMatch: PropTypes.object, // private, from <Switch>
    path: PropTypes.string,
    exact: PropTypes.bool,
    strict: PropTypes.bool,
    component: PropTypes.func,
    render: PropTypes.func,
    children: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
    location: PropTypes.object
  };
  Route.contextTypes = {
    router: PropTypes.shape({
      history: PropTypes.object.isRequired,
      route: PropTypes.object.isRequired,
      staticContext: PropTypes.object
    })
  };
  Route.childContextTypes = {
    router: PropTypes.object.isRequired
  };
  
  
  export default Route;