'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.itemClassName = exports.isClonedItem = exports.isActiveItem = undefined;

(function () {
  var enterModule = require('react-hot-loader').enterModule;

  enterModule && enterModule(module);
})();

var _animation = require('./animation');

var isActiveItem = exports.isActiveItem = function isActiveItem() {
  var i = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  var state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  var currentIndex = state.currentIndex,
      items = state.items,
      _state$stagePadding = state.stagePadding,
      stagePadding = _state$stagePadding === undefined ? {} : _state$stagePadding;

  if (stagePadding.paddingLeft || stagePadding.paddingRight) {
    currentIndex += 1;
  }
  return currentIndex + items === i;
};

var isClonedItem = exports.isClonedItem = function isClonedItem() {
  var i = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  var state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  var infinite = state.infinite,
      items = state.items,
      _state$slides = state.slides,
      slides = _state$slides === undefined ? [] : _state$slides;

  return infinite === false && (i < items || i > slides.length + items - 1);
};

var itemClassName = exports.itemClassName = function itemClassName() {
  var i = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  var state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  var animationProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

  var isActive = isActiveItem(i, state) ? ' __active' : '';
  var isCloned = isClonedItem(i, state) ? ' __cloned' : '';
  var isAnimated = (0, _animation.isAnimatedItem)(i, animationProps) ? ' animated animated-out fadeOut' : '';

  return 'alice-carousel__stage-item' + isActive + isCloned + isAnimated;
};
;

(function () {
  var reactHotLoader = require('react-hot-loader').default;

  var leaveModule = require('react-hot-loader').leaveModule;

  if (!reactHotLoader) {
    return;
  }

  reactHotLoader.register(isActiveItem, 'isActiveItem', '/Users/mmarinich/WebstormProjects/react-alice-carousel/src/lib/utils/classnames.js');
  reactHotLoader.register(isClonedItem, 'isClonedItem', '/Users/mmarinich/WebstormProjects/react-alice-carousel/src/lib/utils/classnames.js');
  reactHotLoader.register(itemClassName, 'itemClassName', '/Users/mmarinich/WebstormProjects/react-alice-carousel/src/lib/utils/classnames.js');
  leaveModule(module);
})();

;