text: 'use strict';
  
  Object.defineProperty(exports, "__esModule", {
      value: true
  });
  
  var _extends2 = require('babel-runtime/helpers/extends');
  
  var _extends3 = _interopRequireDefault(_extends2);
  
  var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
  
  var _defineProperty3 = _interopRequireDefault(_defineProperty2);
  
  var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
  
  var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  
  var _createClass2 = require('babel-runtime/helpers/createClass');
  
  var _createClass3 = _interopRequireDefault(_createClass2);
  
  var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
  
  var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
  
  var _inherits2 = require('babel-runtime/helpers/inherits');
  
  var _inherits3 = _interopRequireDefault(_inherits2);
  
  var _react = require('react');
  
  var React = _interopRequireWildcard(_react);
  
  var _propTypes = require('prop-types');
  
  var _propTypes2 = _interopRequireDefault(_propTypes);
  
  var _classnames = require('classnames');
  
  var _classnames2 = _interopRequireDefault(_classnames);
  
  var _rcAnimate = require('rc-animate');
  
  var _rcAnimate2 = _interopRequireDefault(_rcAnimate);
  
  var _omit = require('omit.js');
  
  var _omit2 = _interopRequireDefault(_omit);
  
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
  
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  
  var __rest = undefined && undefined.__rest || function (s, e) {
      var t = {};
      for (var p in s) {
          if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
      }if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
          if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]];
      }return t;
  };
  
  var Spin = function (_React$Component) {
      (0, _inherits3['default'])(Spin, _React$Component);
  
      function Spin(props) {
          (0, _classCallCheck3['default'])(this, Spin);
  
          var _this = (0, _possibleConstructorReturn3['default'])(this, (Spin.__proto__ || Object.getPrototypeOf(Spin)).call(this, props));
  
          var spinning = props.spinning;
          _this.state = {
              spinning: spinning
          };
          return _this;
      }
  
      (0, _createClass3['default'])(Spin, [{
          key: 'isNestedPattern',
          value: function isNestedPattern() {
              return !!(this.props && this.props.children);
          }
      }, {
          key: 'componentDidMount',
          value: function componentDidMount() {
              var _this2 = this;
  
              var _props = this.props,
                  spinning = _props.spinning,
                  delay = _props.delay;
  
              if (spinning && delay && !isNaN(Number(delay))) {
                  this.setState({ spinning: false });
                  this.delayTimeout = window.setTimeout(function () {
                      return _this2.setState({ spinning: spinning });
                  }, delay);
              }
          }
      }, {
          key: 'componentWillUnmount',
          value: function componentWillUnmount() {
              if (this.debounceTimeout) {
                  clearTimeout(this.debounceTimeout);
              }
              if (this.delayTimeout) {
                  clearTimeout(this.delayTimeout);
              }
          }
      }, {
          key: 'componentWillReceiveProps',
          value: function componentWillReceiveProps(nextProps) {
              var _this3 = this;
  
              var currentSpinning = this.props.spinning;
              var spinning = nextProps.spinning;
              var delay = this.props.delay;
  
              if (this.debounceTimeout) {
                  clearTimeout(this.debounceTimeout);
              }
              if (currentSpinning && !spinning) {
                  this.debounceTimeout = window.setTimeout(function () {
                      return _this3.setState({ spinning: spinning });
                  }, 200);
                  if (this.delayTimeout) {
                      clearTimeout(this.delayTimeout);
                  }
              } else {
                  if (spinning && delay && !isNaN(Number(delay))) {
                      if (this.delayTimeout) {
                          clearTimeout(this.delayTimeout);
                      }
                      this.delayTimeout = window.setTimeout(function () {
                          return _this3.setState({ spinning: spinning });
                      }, delay);
                  } else {
                      this.setState({ spinning: spinning });
                  }
              }
          }
      }, {
          key: 'renderIndicator',
          value: function renderIndicator() {
              var _props2 = this.props,
                  prefixCls = _props2.prefixCls,
                  indicator = _props2.indicator;
  
              var dotClassName = prefixCls + '-dot';
              if (React.isValidElement(indicator)) {
                  return React.cloneElement(indicator, {
                      className: (0, _classnames2['default'])(indicator.props.className, dotClassName)
                  });
              }
              return React.createElement(
                  'span',
                  { className: (0, _classnames2['default'])(dotClassName, prefixCls + '-dot-spin') },
                  React.createElement('i', null),
                  React.createElement('i', null),
                  React.createElement('i', null),
                  React.createElement('i', null)
              );
          }
      }, {
          key: 'render',
          value: function render() {
              var _classNames;
  
              var _a = this.props,
                  className = _a.className,
                  size = _a.size,
                  prefixCls = _a.prefixCls,
                  tip = _a.tip,
                  wrapperClassName = _a.wrapperClassName,
                  restProps = __rest(_a, ["className", "size", "prefixCls", "tip", "wrapperClassName"]);var spinning = this.state.spinning;
  
              var spinClassName = (0, _classnames2['default'])(prefixCls, (_classNames = {}, (0, _defineProperty3['default'])(_classNames, prefixCls + '-sm', size === 'small'), (0, _defineProperty3['default'])(_classNames, prefixCls + '-lg', size === 'large'), (0, _defineProperty3['default'])(_classNames, prefixCls + '-spinning', spinning), (0, _defineProperty3['default'])(_classNames, prefixCls + '-show-text', !!tip), _classNames), className);
              // fix https://fb.me/react-unknown-prop
              var divProps = (0, _omit2['default'])(restProps, ['spinning', 'delay', 'indicator']);
              var spinElement = React.createElement(
                  'div',
                  (0, _extends3['default'])({}, divProps, { className: spinClassName }),
                  this.renderIndicator(),
                  tip ? React.createElement(
                      'div',
                      { className: prefixCls + '-text' },
                      tip
                  ) : null
              );
              if (this.isNestedPattern()) {
                  var _classNames2;
  
                  var animateClassName = prefixCls + '-nested-loading';
                  if (wrapperClassName) {
                      animateClassName += ' ' + wrapperClassName;
                  }
                  var containerClassName = (0, _classnames2['default'])((_classNames2 = {}, (0, _defineProperty3['default'])(_classNames2, prefixCls + '-container', true), (0, _defineProperty3['default'])(_classNames2, prefixCls + '-blur', spinning), _classNames2));
                  return React.createElement(
                      _rcAnimate2['default'],
                      (0, _extends3['default'])({}, divProps, { component: 'div', className: animateClassName, style: null, transitionName: 'fade' }),
                      spinning && React.createElement(
                          'div',
                          { key: 'loading' },
                          spinElement
                      ),
                      React.createElement(
                          'div',
                          { className: containerClassName, key: 'container' },
                          this.props.children
                      )
                  );
              }
              return spinElement;
          }
      }]);
      return Spin;
  }(React.Component);
  
  exports['default'] = Spin;
  
  Spin.defaultProps = {
      prefixCls: 'ant-spin',
      spinning: true,
      size: 'default',
      wrapperClassName: ''
  };
  Spin.propTypes = {
      prefixCls: _propTypes2['default'].string,
      className: _propTypes2['default'].string,
      spinning: _propTypes2['default'].bool,
      size: _propTypes2['default'].oneOf(['small', 'default', 'large']),
      wrapperClassName: _propTypes2['default'].string,
      indicator: _propTypes2['default'].node
  };
  module.exports = exports['default'];