text: "use strict";
  
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  exports["default"] = getCalendarDaySettings;
  
  var _getPhrase = _interopRequireDefault(require("./getPhrase"));
  
  var _constants = require("../constants");
  
  function isSelected(modifiers) {
    return modifiers.has('selected') || modifiers.has('selected-span') || modifiers.has('selected-start') || modifiers.has('selected-end');
  }
  
  function shouldUseDefaultCursor(modifiers) {
    return modifiers.has('blocked-minimum-nights') || modifiers.has('blocked-calendar') || modifiers.has('blocked-out-of-range');
  }
  
  function isHoveredSpan(modifiers) {
    if (isSelected(modifiers)) return false;
    return modifiers.has('hovered-span') || modifiers.has('after-hovered-start');
  }
  
  function getAriaLabel(phrases, modifiers, day, ariaLabelFormat) {
    var chooseAvailableDate = phrases.chooseAvailableDate,
        dateIsUnavailable = phrases.dateIsUnavailable,
        dateIsSelected = phrases.dateIsSelected,
        dateIsSelectedAsStartDate = phrases.dateIsSelectedAsStartDate,
        dateIsSelectedAsEndDate = phrases.dateIsSelectedAsEndDate;
    var formattedDate = {
      date: day.format(ariaLabelFormat)
    };
  
    if (modifiers.has('selected-start') && dateIsSelectedAsStartDate) {
      return (0, _getPhrase["default"])(dateIsSelectedAsStartDate, formattedDate);
    }
  
    if (modifiers.has('selected-end') && dateIsSelectedAsEndDate) {
      return (0, _getPhrase["default"])(dateIsSelectedAsEndDate, formattedDate);
    }
  
    if (isSelected(modifiers) && dateIsSelected) {
      return (0, _getPhrase["default"])(dateIsSelected, formattedDate);
    }
  
    if (modifiers.has(_constants.BLOCKED_MODIFIER)) {
      return (0, _getPhrase["default"])(dateIsUnavailable, formattedDate);
    }
  
    return (0, _getPhrase["default"])(chooseAvailableDate, formattedDate);
  }
  
  function getCalendarDaySettings(day, ariaLabelFormat, daySize, modifiers, phrases) {
    return {
      ariaLabel: getAriaLabel(phrases, modifiers, day, ariaLabelFormat),
      hoveredSpan: isHoveredSpan(modifiers),
      isOutsideRange: modifiers.has('blocked-out-of-range'),
      selected: isSelected(modifiers),
      useDefaultCursor: shouldUseDefaultCursor(modifiers),
      daySizeStyles: {
        width: daySize,
        height: daySize - 1
      }
    };
  }