text: "use strict";
  
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
  
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  
  exports.__esModule = true;
  exports.default = void 0;
  
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
  
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
  
  var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
  
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
  
  var _isUndefined2 = _interopRequireDefault(require("lodash/isUndefined"));
  
  var _get2 = _interopRequireDefault(require("lodash/get"));
  
  var React = _interopRequireWildcard(require("react"));
  
  var _propTypes = _interopRequireDefault(require("prop-types"));
  
  var _classnames = _interopRequireDefault(require("classnames"));
  
  var _setStatic = _interopRequireDefault(require("recompose/setStatic"));
  
  var _shallowEqual = _interopRequireDefault(require("rsuite-utils/lib/utils/shallowEqual"));
  
  var _NavItem = _interopRequireDefault(require("./NavItem"));
  
  var _utils = require("./utils");
  
  var _prefix = require("./utils/prefix");
  
  var Nav =
  /*#__PURE__*/
  function (_React$Component) {
    (0, _inheritsLoose2.default)(Nav, _React$Component);
  
    function Nav() {
      return _React$Component.apply(this, arguments) || this;
    }
  
    var _proto = Nav.prototype;
  
    _proto.render = function render() {
      var _classNames;
  
      var _this$props = this.props,
          classPrefix = _this$props.classPrefix,
          appearance = _this$props.appearance,
          vertical = _this$props.vertical,
          justified = _this$props.justified,
          reversed = _this$props.reversed,
          pullRight = _this$props.pullRight,
          className = _this$props.className,
          children = _this$props.children,
          props = (0, _objectWithoutPropertiesLoose2.default)(_this$props, ["classPrefix", "appearance", "vertical", "justified", "reversed", "pullRight", "className", "children"]);
      var _this$context = this.context,
          navbar = _this$context.navbar,
          sidenav = _this$context.sidenav,
          expanded = _this$context.expanded,
          _this$context$activeK = _this$context.activeKey,
          activeKey = _this$context$activeK === void 0 ? props.activeKey : _this$context$activeK,
          _this$context$onSelec = _this$context.onSelect,
          onSelect = _this$context$onSelec === void 0 ? props.onSelect : _this$context$onSelec;
      var addPrefix = (0, _utils.prefix)(classPrefix);
      var globalClassNamePrefix = (0, _prefix.getClassNamePrefix)();
      var classes = (0, _classnames.default)(classPrefix, addPrefix(appearance), className, (_classNames = {}, _classNames[globalClassNamePrefix + "navbar-nav"] = navbar, _classNames[globalClassNamePrefix + "navbar-right"] = pullRight, _classNames[globalClassNamePrefix + "sidenav-nav"] = sidenav, _classNames[addPrefix('horizontal')] = navbar || !vertical && !sidenav, _classNames[addPrefix('vertical')] = vertical || sidenav, _classNames[addPrefix('justified')] = justified, _classNames[addPrefix('reversed')] = reversed, _classNames));
      var hasWaterline = appearance !== 'default';
  
      var items = _utils.ReactChildren.mapCloneElement(children, function (item) {
        var _item$props = item.props,
            eventKey = _item$props.eventKey,
            active = _item$props.active,
            rest = (0, _objectWithoutPropertiesLoose2.default)(_item$props, ["eventKey", "active"]);
        var displayName = (0, _get2.default)(item, ['type', 'displayName']);
  
        if (displayName === 'NavItem') {
          return (0, _extends2.default)({}, rest, {
            onSelect: onSelect,
            hasTooltip: sidenav && !expanded,
            active: (0, _isUndefined2.default)(activeKey) ? active : (0, _shallowEqual.default)(activeKey, eventKey)
          });
        } else if (displayName === 'Dropdown') {
          return (0, _extends2.default)({}, rest, {
            onSelect: onSelect,
            activeKey: activeKey,
            componentClass: 'li'
          });
        }
  
        return null;
      });
  
      var unhandled = (0, _utils.getUnhandledProps)(Nav, props);
      return React.createElement("div", (0, _extends2.default)({}, unhandled, {
        className: classes
      }), React.createElement("ul", null, items), hasWaterline && React.createElement("div", {
        className: addPrefix('waterline')
      }));
    };
  
    return Nav;
  }(React.Component);
  
  (0, _defineProperty2.default)(Nav, "defaultProps", {
    appearance: 'default'
  });
  (0, _defineProperty2.default)(Nav, "contextTypes", {
    expanded: _propTypes.default.bool,
    navbar: _propTypes.default.bool,
    sidenav: _propTypes.default.bool,
    activeKey: _propTypes.default.any,
    onSelect: _propTypes.default.func
  });
  (0, _defineProperty2.default)(Nav, "handledProps", ["activeKey", "appearance", "children", "className", "classPrefix", "justified", "onSelect", "pullRight", "reversed", "vertical"]);
  var EnhancedNav = (0, _utils.defaultProps)({
    classPrefix: 'nav'
  })(Nav);
  (0, _setStatic.default)('Item', _NavItem.default)(EnhancedNav);
  var _default = EnhancedNav;
  exports.default = _default;