"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Link = void 0;

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));

var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));

var _styledComponents = _interopRequireDefault(require("styled-components"));

require("polished");

var _Typography = require("../../Typography");

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

var http = /^https?/;

var hrefProps = function hrefProps(_ref) {
  var _ref$href = _ref.href,
      href = _ref$href === void 0 ? '' : _ref$href,
      props = (0, _objectWithoutProperties2["default"])(_ref, ["href"]);
  return _objectSpread({
    as: 'a',
    rel: http.test(href) ? 'noopener nofollow' : null
  }, props);
};

var Link = (0, _styledComponents["default"])(_Typography.Typography).attrs(hrefProps).withConfig({
  displayName: "src__Link",
  componentId: "g680z7-0"
})(["text-decoration:none;cursor:pointer;outline:0;&,&:link,&:hover,&:active,&:focus,&:visited{color:", ";}&:hover{text-decoration:underline;}"], function (_ref2) {
  var theme = _ref2.theme,
      color = _ref2.color,
      hue = _ref2.hue;
  return theme.getPaletteColor(color, hue);
});
exports.Link = Link;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIj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