"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.LinkComponent = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _react = _interopRequireDefault(require("react"));
var _link = _interopRequireDefault(require("@atlaskit/link"));
var _click = require("../../../utils/analytics/click");
var _excluded = ["href", "children", "testId", "isLinkComponent"];
var Anchor = (0, _click.withLinkClickedEvent)('a');
var LinkComponent = exports.LinkComponent = (0, _click.withLinkClickedEvent)(_link.default);
var Hyperlink = function Hyperlink(_ref) {
  var href = _ref.href,
    children = _ref.children,
    testId = _ref.testId,
    _ref$isLinkComponent = _ref.isLinkComponent,
    isLinkComponent = _ref$isLinkComponent === void 0 ? false : _ref$isLinkComponent,
    props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
  var Link = isLinkComponent ? LinkComponent : Anchor;
  return /*#__PURE__*/_react.default.createElement(Link, (0, _extends2.default)({}, isLinkComponent ? {
    testId: testId
  } : {
    'data-testid': testId
  }, {
    href: href || ''
  }, props), children);
};
var _default = exports.default = Hyperlink;