text: 'use strict';
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  
  var _propTypes = require('prop-types');
  
  var _propTypes2 = _interopRequireDefault(_propTypes);
  
  var _react = require('react');
  
  var _react2 = _interopRequireDefault(_react);
  
  var _getNetworkLink = require('./utils/getNetworkLink');
  
  var _getNetworkLink2 = _interopRequireDefault(_getNetworkLink);
  
  var _windowOpen = require('./utils/windowOpen');
  
  var _windowOpen2 = _interopRequireDefault(_windowOpen);
  
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  
  function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  
  var ShareButton = function (_React$PureComponent) {
    _inherits(ShareButton, _React$PureComponent);
  
    function ShareButton() {
      var _ref;
  
      var _temp, _this, _ret;
  
      _classCallCheck(this, ShareButton);
  
      for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }
  
      return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = ShareButton.__proto__ || Object.getPrototypeOf(ShareButton)).call.apply(_ref, [this].concat(args))), _this), _this.onClick = function (e) {
        e.preventDefault();
  
        var _this$props = _this.props,
            url = _this$props.url,
            network = _this$props.network,
            text = _this$props.text,
            longtext = _this$props.longtext,
            link = _this$props.link,
            media = _this$props.media;
  
        var networkLink = link ? link : (0, _getNetworkLink2.default)({ network: network, url: url, text: text, longtext: longtext, media: media });
  
        _this.openShareWindow(networkLink);
      }, _this.openShareWindow = function (link) {
        (0, _windowOpen2.default)(link);
      }, _temp), _possibleConstructorReturn(_this, _ret);
    }
  
    _createClass(ShareButton, [{
      key: 'render',
      value: function render() {
        var _props = this.props,
            network = _props.network,
            children = _props.children,
            className = _props.className;
  
  
        return _react2.default.createElement(
          'button',
          {
            className: className + ' rcs-button',
            'aria-label': 'Share on ' + network,
            onClick: this.onClick
          },
          children
        );
      }
    }]);
  
    return ShareButton;
  }(_react2.default.PureComponent);
  
  ShareButton.propTypes = {
    network: _propTypes2.default.string.isRequired,
    url: _propTypes2.default.string.isRequired,
    children: _propTypes2.default.node.isRequired,
    link: _propTypes2.default.string,
    text: _propTypes2.default.string,
    longtext: _propTypes2.default.string,
    media: function media(props, propName, componentName) {
      var key = props['network'].toLowerCase();
      if (key === 'pinterest' && props[propName] === undefined) {
        return new Error('The prop \'' + propName + '\' is marked as required in \'' + componentName + '\' for the \'Pinterest\' network, but it\'s value is \'undefined\'.');
      }
    },
    className: _propTypes2.default.string,
    htmlAttributes: _propTypes2.default.object
  };
  
  ShareButton.defaultProps = {
    link: '',
    text: '',
    longtext: '',
    className: ''
  };
  
  exports.default = ShareButton;