text: 'use strict';
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
  
  exports.cancelEvent = cancelEvent;
  exports.getCustomProps = getCustomProps;
  exports.getFirstDayOfMonth = getFirstDayOfMonth;
  exports.getDaysInMonth = getDaysInMonth;
  exports.getModifiersFromProps = getModifiersFromProps;
  exports.getFirstDayOfWeekFromProps = getFirstDayOfWeekFromProps;
  exports.getModifiersForDay = getModifiersForDay;
  exports.getMonthsDiff = getMonthsDiff;
  exports.getWeekArray = getWeekArray;
  exports.startOfMonth = startOfMonth;
  
  var _DateUtils = require('./DateUtils');
  
  var _LocaleUtils = require('./LocaleUtils');
  
  function cancelEvent(e) {
    e.preventDefault();
    e.stopPropagation();
  }
  
  function getCustomProps(props, propTypes) {
    var customProps = {};
    Object.keys(props).filter(function (propName) {
      return !{}.hasOwnProperty.call(propTypes, propName);
    }).forEach(function (propName) {
      customProps[propName] = props[propName];
    });
    return customProps;
  }
  
  function getFirstDayOfMonth(d) {
    return new Date(d.getFullYear(), d.getMonth(), 1, 12);
  }
  
  function getDaysInMonth(d) {
    var resultDate = getFirstDayOfMonth(d);
  
    resultDate.setMonth(resultDate.getMonth() + 1);
    resultDate.setDate(resultDate.getDate() - 1);
  
    return resultDate.getDate();
  }
  
  function getModifiersFromProps(props) {
    var modifiers = _extends({}, props.modifiers);
    if (props.selectedDays) {
      modifiers.selected = props.selectedDays;
    }
    if (props.disabledDays) {
      modifiers.disabled = props.disabledDays;
    }
    return modifiers;
  }
  
  function getFirstDayOfWeekFromProps(props) {
    var firstDayOfWeek = props.firstDayOfWeek,
        _props$locale = props.locale,
        locale = _props$locale === undefined ? 'en' : _props$locale,
        _props$localeUtils = props.localeUtils,
        localeUtils = _props$localeUtils === undefined ? {} : _props$localeUtils;
  
    if (!isNaN(firstDayOfWeek)) {
      return firstDayOfWeek;
    }
    if (localeUtils.getFirstDayOfWeek) {
      return localeUtils.getFirstDayOfWeek(locale);
    }
    return 0;
  }
  
  function getModifiersForDay(d) {
    var modifierFunctions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  
    return Object.keys(modifierFunctions).reduce(function (modifiers, modifier) {
      var func = modifierFunctions[modifier];
      if (func(d)) {
        modifiers.push(modifier);
      }
      return modifiers;
    }, []);
  }
  
  function getMonthsDiff(d1, d2) {
    return d2.getMonth() - d1.getMonth() + 12 * (d2.getFullYear() - d1.getFullYear());
  }
  
  function getWeekArray(d) {
    var firstDayOfWeek = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (0, _LocaleUtils.getFirstDayOfWeek)();
    var fixedWeeks = arguments[2];
  
    var daysInMonth = getDaysInMonth(d);
    var dayArray = [];
  
    var week = [];
    var weekArray = [];
  
    for (var i = 1; i <= daysInMonth; i += 1) {
      dayArray.push(new Date(d.getFullYear(), d.getMonth(), i, 12));
    }
  
    dayArray.forEach(function (day) {
      if (week.length > 0 && day.getDay() === firstDayOfWeek) {
        weekArray.push(week);
        week = [];
      }
      week.push(day);
      if (dayArray.indexOf(day) === dayArray.length - 1) {
        weekArray.push(week);
      }
    });
  
    // unshift days to start the first week
    var firstWeek = weekArray[0];
    for (var _i = 7 - firstWeek.length; _i > 0; _i -= 1) {
      var outsideDate = (0, _DateUtils.clone)(firstWeek[0]);
      outsideDate.setDate(firstWeek[0].getDate() - 1);
      firstWeek.unshift(outsideDate);
    }
  
    // push days until the end of the last week
    var lastWeek = weekArray[weekArray.length - 1];
    for (var _i2 = lastWeek.length; _i2 < 7; _i2 += 1) {
      var _outsideDate = (0, _DateUtils.clone)(lastWeek[lastWeek.length - 1]);
      _outsideDate.setDate(lastWeek[lastWeek.length - 1].getDate() + 1);
      lastWeek.push(_outsideDate);
    }
  
    // add extra weeks to reach 6 weeks
    if (fixedWeeks && weekArray.length < 6) {
      var lastExtraWeek = void 0;
  
      for (var _i3 = weekArray.length; _i3 < 6; _i3 += 1) {
        lastExtraWeek = weekArray[weekArray.length - 1];
        var lastDay = lastExtraWeek[lastExtraWeek.length - 1];
        var extraWeek = [];
  
        for (var j = 0; j < 7; j += 1) {
          var _outsideDate2 = (0, _DateUtils.clone)(lastDay);
          _outsideDate2.setDate(lastDay.getDate() + j + 1);
          extraWeek.push(_outsideDate2);
        }
  
        weekArray.push(extraWeek);
      }
    }
  
    return weekArray;
  }
  
  function startOfMonth(d) {
    var newDate = (0, _DateUtils.clone)(d);
    newDate.setDate(1);
    newDate.setHours(12, 0, 0, 0); // always set noon to avoid time zone issues
    return newDate;
  }
  //# sourceMappingURL=Helpers.js.map