{"ast":null,"code":"\"use strict\";\n\nvar _classCallCheck = require(\"@babel/runtime/helpers/classCallCheck\");\n\nvar _assertThisInitialized = require(\"@babel/runtime/helpers/assertThisInitialized\");\n\nvar _createClass = require(\"@babel/runtime/helpers/createClass\");\n\nvar _possibleConstructorReturn = require(\"@babel/runtime/helpers/possibleConstructorReturn\");\n\nvar _getPrototypeOf = require(\"@babel/runtime/helpers/getPrototypeOf\");\n\nvar _inherits = require(\"@babel/runtime/helpers/inherits\");\n\nvar _toConsumableArray = require(\"@babel/runtime/helpers/toConsumableArray\");\n\nfunction _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\n\nvar react_1 = require(\"react\");\n\nvar isServer = false;\n\nexports[\"default\"] = function () {\n  var mountedInstances = new Set();\n  var state;\n\n  function emitChange(component) {\n    state = component.props.reduceComponentsToState(_toConsumableArray(mountedInstances), component.props);\n\n    if (component.props.handleStateChange) {\n      component.props.handleStateChange(state);\n    }\n  }\n\n  return /*#__PURE__*/function (_react_1$Component) {\n    _inherits(_class, _react_1$Component);\n\n    var _super = _createSuper(_class);\n\n    _createClass(_class, null, [{\n      key: \"rewind\",\n      // Used when server rendering\n      value: function rewind() {\n        var recordedState = state;\n        state = undefined;\n        mountedInstances.clear();\n        return recordedState;\n      }\n    }]);\n\n    function _class(props) {\n      var _this;\n\n      _classCallCheck(this, _class);\n\n      _this = _super.call(this, props);\n\n      if (isServer) {\n        mountedInstances.add(_assertThisInitialized(_this));\n        emitChange(_assertThisInitialized(_this));\n      }\n\n      return _this;\n    }\n\n    _createClass(_class, [{\n      key: \"componentDidMount\",\n      value: function componentDidMount() {\n        mountedInstances.add(this);\n        emitChange(this);\n      }\n    }, {\n      key: \"componentDidUpdate\",\n      value: function componentDidUpdate() {\n        emitChange(this);\n      }\n    }, {\n      key: \"componentWillUnmount\",\n      value: function componentWillUnmount() {\n        mountedInstances[\"delete\"](this);\n        emitChange(this);\n      }\n    }, {\n      key: \"render\",\n      value: function render() {\n        return null;\n      }\n    }]);\n\n    return _class;\n  }(react_1.Component);\n};","map":null,"metadata":{},"sourceType":"script"}