"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.linkPropTypes = exports.SkeletonStyledComponent = undefined;

var _react = require("react");

var _react2 = _interopRequireDefault(_react);

var _propTypes = require("prop-types");

var _propTypes2 = _interopRequireDefault(_propTypes);

var _reactEmotion = require("react-emotion");

var _reactEmotion2 = _interopRequireDefault(_reactEmotion);

var _gatsby = require("gatsby");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

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 _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, 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 SkeletonStyledComponent =
/*#__PURE__*/
exports.SkeletonStyledComponent = (0, _reactEmotion2["default"])(_gatsby.Link, {
  target: "eh7fx5n0"
})();
var linkPropTypes = exports.linkPropTypes = {
  href: _propTypes2["default"].string,
  to: _propTypes2["default"].string,
  target: _propTypes2["default"].string
};

var linkSkeletonPropTypes = _objectSpread({}, linkPropTypes, {
  StyledComponent: _propTypes2["default"].any
});

var linkSkeletonDefaultPropTypes = {
  StyledComponent: SkeletonStyledComponent
};

var LinkSkeleton = function LinkSkeleton(_ref) {
  var StyledComponent = _ref.StyledComponent,
      children = _ref.children,
      href = _ref.href,
      target = _ref.target,
      to = _ref.to,
      rest = _objectWithoutProperties(_ref, ["StyledComponent", "children", "href", "target", "to"]);

  if (href) {
    var ComponentAsExternalLink = StyledComponent.withComponent("a", {
      target: "eh7fx5n1"
    });
    return _react2["default"].createElement(ComponentAsExternalLink, {
      href: href,
      target: target
    }, children);
  }

  if (to) {
    return _react2["default"].createElement(StyledComponent, Object.assign({
      to: to
    }, rest), children);
  }

  return null;
};

LinkSkeleton.propTypes = linkSkeletonPropTypes;
LinkSkeleton.defaultProps = linkSkeletonDefaultPropTypes;
exports["default"] = LinkSkeleton;