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,EAAK,iBAET,IAGA,KAAK,SAAS,CACZ,KAAM,EACN,cAAe,CAAC,IAGd,KAAK,MAAM,KACb,EAAK,OAET,GACC,CACD,IAAK,4BACL,MAAO,SAAmC,GACpC,EAAU,IACZ,KAAK,MAAM,KAAK,QAEhB,KAAK,MAAM,KAAK,MAEpB,GACC,CACD,IAAK,wBACL,MAAO,WAEL,OAAO,CACT,GACC,CACD,IAAK,uBACL,MAAO,WACL,KAAK,MAAM,KAAK,MAClB,GACC,CACD,IAAK,kBACL,MAAO,WACL,MAAO,CACL,YAAa,KAAK,MAAM,QAE5B,GACC,CACD,IAAK,SACL,MAAO,WACL,OAAO,QAAiB,QAAE,cAAc,EAAmB,SAAS,CAAE,IAAK,YACxE,KAAK,MAAO,KAAK,MAAM,cAAe,CACvC,QAAS,KAAK,MAAM,UAExB,KAGK,CACR,CAzFc,CAyFZ,QAAiB,QAAE,WActB,OAZA,EAAS,UAAY,CACnB,IAAK,QAAiB,QAAE,UAAU,MAGpC,EAAS,aAAe,CACtB,KAAK,GAGP,EAAS,kBAAoB,CAC3B,YAAa,QAAiB,QAAE,UAAU,KAGrC,CACT,CACF,EAEA,OAAO,QAAU,QAAiB","file":"/npm/react-mainloop@0.6.0/dist/Animator.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/react-mainloop@0.6.0/dist/Animator.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use strict';\n\nvar _get = require('babel-runtime/helpers/get')['default'];\n\nvar _inherits = require('babel-runtime/helpers/inherits')['default'];\n\nvar _createClass = require('babel-runtime/helpers/create-class')['default'];\n\nvar _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];\n\nvar _extends = require('babel-runtime/helpers/extends')['default'];\n\nvar _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];\n\nObject.defineProperty(exports, '__esModule', {\n  value: true\n});\n\nvar _react = require('react');\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _mainloopJs = require('mainloop.js');\n\nvar _mainloopJs2 = _interopRequireDefault(_mainloopJs);\n\nvar FPS = 60;\nvar TIMESTEP = 1000 / FPS;\nvar MAX_FPS = 60;\n\nvar noop = function noop() {};\n\n/**\n * A wrapper to animate a given component.\n * All props are passed down to the child component.\n *\n * The getUpdate callback takes a reference to the animated component's backing instance,\n * and returns the update function.\n *\n * The update function takes the elapsed time (in milliseconds) since the last update,\n * and returns the props and context for the animated component.\n *\n * @param  {ReactComponent} AnimatedComponent\n * @param  {function} userUpdate\n * @param {function} userBegin\n * @return {ReactComponent} An animated version of the given component.\n */\n\nexports['default'] = function () {\n  var timestep = arguments.length <= 0 || arguments[0] === undefined ? TIMESTEP : arguments[0];\n  var maxFPS = arguments.length <= 1 || arguments[1] === undefined ? MAX_FPS : arguments[1];\n  return function (AnimatedComponent, userUpdate, userBegin) {\n    var Animator = (function (_React$Component) {\n      _inherits(Animator, _React$Component);\n\n      function Animator(props) {\n        _classCallCheck(this, Animator);\n\n        _get(Object.getPrototypeOf(Animator.prototype), 'constructor', this).call(this, props);\n\n        this.state = {\n          animatedProps: {}\n        };\n      }\n\n      _createClass(Animator, [{\n        key: 'componentDidMount',\n        value: function componentDidMount() {\n          var _this = this;\n\n          var begin = userBegin || noop,\n              update = function update(delta) {\n            var _userUpdate = userUpdate(delta);\n\n            var context = _userUpdate.context;\n            var props = _userUpdate.props;\n\n            _this.setState({\n              context: context,\n              animatedProps: props\n            });\n          },\n              draw = function draw() {\n            return (/* interpolationPercentage */_this.forceUpdate()\n            );\n          },\n              endOfFrame = function endOfFrame( /*fps*/_, panic) {\n            // TODO let user supply callback for this\n            if (panic) {\n              loop.resetFrameDelta();\n            }\n          },\n              loop = _mainloopJs2['default'].setMaxAllowedFPS(maxFPS).setSimulationTimestep(timestep).setBegin(begin).setUpdate(update).setDraw(draw).setEnd(endOfFrame);\n\n          this.setState({\n            loop: loop,\n            animatedProps: {}\n          });\n\n          if (this.props.run) {\n            loop.start();\n          }\n        }\n      }, {\n        key: 'componentWillReceiveProps',\n        value: function componentWillReceiveProps(nextProps) {\n          if (nextProps.run) {\n            this.state.loop.start();\n          } else {\n            this.state.loop.stop();\n          }\n        }\n      }, {\n        key: 'shouldComponentUpdate',\n        value: function shouldComponentUpdate() {\n          // doesn't affect initial render\n          return false; // take control of when we render using forceUpdate\n        }\n      }, {\n        key: 'componentWillUnmount',\n        value: function componentWillUnmount() {\n          this.state.loop.stop();\n        }\n      }, {\n        key: 'getChildContext',\n        value: function getChildContext() {\n          return {\n            animContext: this.state.context\n          };\n        }\n      }, {\n        key: 'render',\n        value: function render() {\n          return _react2['default'].createElement(AnimatedComponent, _extends({ ref: 'animated'\n          }, this.props, this.state.animatedProps, {\n            context: this.state.context\n          }));\n        }\n      }]);\n\n      return Animator;\n    })(_react2['default'].Component);\n\n    Animator.propTypes = {\n      run: _react2['default'].PropTypes.bool\n    };\n\n    Animator.defaultProps = {\n      run: true\n    };\n\n    Animator.childContextTypes = {\n      animContext: _react2['default'].PropTypes.any\n    };\n\n    return Animator;\n  };\n};\n\nmodule.exports = exports['default'];"]}