"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.StyledSubNavContainer = exports.StyledRoot = exports.StyledNavLink = exports.StyledNavItemElement = exports.StyledNavItemContainer = exports.StyledNavItem = void 0;

var React = _interopRequireWildcard(require("react"));

var _styles = require("../styles");

var _excluded = ["item"];

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

var StyledRoot = (0, _styles.styled)('nav', function (props) {
  var _props$$theme = props.$theme,
      colors = _props$$theme.colors,
      typography = _props$$theme.typography;
  return _objectSpread(_objectSpread({}, typography.font300), {}, {
    color: colors.contentPrimary,
    listStyleType: 'none',
    marginTop: 0,
    marginBottom: 0,
    marginLeft: 0,
    marginRight: 0,
    paddingTop: 0,
    paddingBottom: 0,
    paddingLeft: 0,
    paddingRight: 0
  });
});
exports.StyledRoot = StyledRoot;
StyledRoot.displayName = "StyledRoot";
StyledRoot.displayName = 'StyledRoot';
var StyledNavItemContainer = (0, _styles.styled)('li', {});
exports.StyledNavItemContainer = StyledNavItemContainer;
StyledNavItemContainer.displayName = "StyledNavItemContainer";
StyledNavItemContainer.displayName = 'StyledNavItemContainer';
var StyledNavLink = (0, _styles.styled)('a', function (_ref) {
  var $theme = _ref.$theme,
      $isFocusVisible = _ref.$isFocusVisible;
  return {
    color: 'inherit',
    outline: 'none',
    textDecoration: 'none',
    ':focus > div': $isFocusVisible ? {
      outline: "3px solid ".concat($theme.colors.borderAccent),
      outlineOffset: '-3px',
      borderLeftColor: 'transparent',
      borderTopColor: 'transparent',
      borderRightColor: 'transparent',
      borderBottomColor: 'transparent'
    } : {
      outline: 'none'
    }
  };
});
exports.StyledNavLink = StyledNavLink;
StyledNavLink.displayName = "StyledNavLink";
StyledNavLink.displayName = 'StyledNavLink'; // @ts-ignore

var StyledNavItemElement = (0, _styles.styled)('div', function (props) {
  var _ref2;

  var $active = props.$active,
      $selectable = props.$selectable,
      $level = props.$level,
      $disabled = props.$disabled,
      $theme = props.$theme,
      _props$$theme2 = props.$theme,
      colors = _props$$theme2.colors,
      sizing = _props$$theme2.sizing;
  var bgImgGradient = (0, _styles.hexToRgb)(colors.backgroundPrimary, '0.92') || '';
  var borderWidthDir = $theme.direction === 'rtl' ? 'borderRightWidth' : 'borderLeftWidth';
  var borderStyleDir = $theme.direction === 'rtl' ? 'borderRightStyle' : 'borderLeftStyle';
  var borderColorDir = $theme.direction === 'rtl' ? 'borderRightColor' : 'borderLeftColor';
  var paddingPrefixDir = $theme.direction === 'rtl' ? 'paddingRight' : 'paddingLeft';
  var paddingSuffixDir = $theme.direction === 'rtl' ? 'paddingLeft' : 'paddingRight';
  var cursor = $selectable ? 'pointer' : 'default';
  var color = $active ? colors.contentPrimary : null;
  var hoverColor = $selectable ? colors.contentPrimary : null;

  if ($disabled) {
    cursor = 'not-allowed';
    color = colors.contentStateDisabled;
    hoverColor = null;
  }

  return _ref2 = {
    backgroundColor: $active ? colors.backgroundInversePrimary : 'transparent',
    backgroundImage: $active ? "linear-gradient(0deg, ".concat(bgImgGradient, ", ").concat(bgImgGradient, ")") : null,
    boxSizing: 'border-box'
  }, _defineProperty(_ref2, borderWidthDir, '4px'), _defineProperty(_ref2, borderStyleDir, 'solid'), _defineProperty(_ref2, borderColorDir, $active ? colors.borderSelected : 'transparent'), _defineProperty(_ref2, "color", color), _defineProperty(_ref2, "cursor", cursor), _defineProperty(_ref2, "paddingTop", sizing.scale500), _defineProperty(_ref2, "paddingBottom", sizing.scale500), _defineProperty(_ref2, paddingPrefixDir, "calc(".concat(sizing.scale800, " * ").concat($level, ")")), _defineProperty(_ref2, paddingSuffixDir, sizing.scale500), _defineProperty(_ref2, ':hover', {
    color: hoverColor
  }), _defineProperty(_ref2, ':focus', {
    color: $selectable ? colors.borderSelected : null
  }), _ref2;
});
exports.StyledNavItemElement = StyledNavItemElement;
StyledNavItemElement.displayName = "StyledNavItemElement";
StyledNavItemElement.displayName = 'StyledNavItemElement'; // @ts-ignore

var StyledNavItem = (0, _styles.withWrapper)(StyledNavItemElement, function (Styled) {
  return (// eslint-disable-next-line @typescript-eslint/no-unused-vars
    function StyledNav(_ref3) {
      var item = _ref3.item,
          restProps = _objectWithoutProperties(_ref3, _excluded);

      return /*#__PURE__*/React.createElement(Styled, restProps);
    }
  );
});
exports.StyledNavItem = StyledNavItem;
var StyledSubNavContainer = (0, _styles.styled)('ul', {
  listStyleType: 'none',
  marginTop: 0,
  marginBottom: 0,
  marginLeft: 0,
  marginRight: 0,
  paddingTop: 0,
  paddingBottom: 0,
  paddingLeft: 0,
  paddingRight: 0
});
exports.StyledSubNavContainer = StyledSubNavContainer;
StyledSubNavContainer.displayName = "StyledSubNavContainer";
StyledSubNavContainer.displayName = 'StyledSubNavContainer';