"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");

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

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

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

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

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

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

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

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

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

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

var _reactRedux = require("react-redux");

var _Context = _interopRequireDefault(require("./Context"));

var _SiteName = _interopRequireDefault(require("./SiteName"));

var _SiteVersion = _interopRequireDefault(require("./SiteVersion"));

/**
 * Defines a site for use by other components
 */
var Site =
/*#__PURE__*/
function (_Component) {
  (0, _inherits2.default)(Site, _Component);

  function Site() {
    var _getPrototypeOf2;

    var _this;

    (0, _classCallCheck2.default)(this, Site);

    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    _this = (0, _possibleConstructorReturn2.default)(this, (_getPrototypeOf2 = (0, _getPrototypeOf3.default)(Site)).call.apply(_getPrototypeOf2, [this].concat(args)));
    (0, _defineProperty2.default)((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)), "render", function () {
      var _this$props = _this.props,
          children = _this$props.children,
          options = _this$props.options,
          site = _this$props.site;
      return _react.default.createElement(_Context.default.Provider, {
        value: {
          options: options,
          site: site
        }
      }, _react.default.createElement(_reactRedux.Provider, {
        store: site.store
      }, children));
    });
    return _this;
  }

  return Site;
}(_react.Component);

exports.Site = Site;
(0, _defineProperty2.default)(Site, "propTypes", {
  /** Content to render. */
  children: _propTypes.default.node.isRequired,

  /** Options for use with this library. */
  options: _propTypes.default.object,

  /** StoryShare `Site`. */
  site: _propTypes.default.object.isRequired
});
(0, _defineProperty2.default)(Site, "Name", _SiteName.default);
(0, _defineProperty2.default)(Site, "Version", _SiteVersion.default);
var _default = Site;
exports.default = _default;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9hZGRvbnMvU2l0ZS9TaXRlLmpzIl0sIm5hbWVzIjpbIlNpdGUiLCJwcm9wcyIsImNoaWxkcmVuIiwib3B0aW9ucyIsInNpdGUiLCJzdG9yZSIsIkNvbXBvbmVudCIsIlByb3BUeXBlcyIsIm5vZGUiLCJpc1JlcXVpcmVkIiwib2JqZWN0IiwiTmFtZSIsIlZlcnNpb24iXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUE7O0FBQ0E7O0FBQ0E7O0FBRUE7O0FBQ0E7O0FBQ0E7O0FBRUE7OztJQUdhQSxJOzs7Ozs7Ozs7Ozs7Ozs7OzsrSEFnQkYsWUFBTTtBQUFBLHdCQUN1QixNQUFLQyxLQUQ1QjtBQUFBLFVBQ0xDLFFBREssZUFDTEEsUUFESztBQUFBLFVBQ0tDLE9BREwsZUFDS0EsT0FETDtBQUFBLFVBQ2NDLElBRGQsZUFDY0EsSUFEZDtBQUViLGFBQ0UsNkJBQUMsZ0JBQUQsQ0FBUyxRQUFUO0FBQWtCLFFBQUEsS0FBSyxFQUFHO0FBQUVELFVBQUFBLE9BQU8sRUFBUEEsT0FBRjtBQUFXQyxVQUFBQSxJQUFJLEVBQUpBO0FBQVg7QUFBMUIsU0FDRSw2QkFBQyxvQkFBRDtBQUFlLFFBQUEsS0FBSyxFQUFHQSxJQUFJLENBQUNDO0FBQTVCLFNBQ0lILFFBREosQ0FERixDQURGO0FBT0QsSzs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