"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.calcTooltips = void 0;
var _locale = require("@mirai/locale");
var _calcMinStay = require("./calcMinStay");
var _helpers = require("../../../../helpers");
var _Calendar = require("../Calendar.l10n");
const calcTooltips = function () {
  let {
    from,
    minStayDates,
    minStayType,
    rangeMinDays: propRangeMinDays,
    to,
    translate = _locale.translate
  } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  if (!(0, _locale.isDate)(from) || to && !(0, _locale.isDate)(to)) return;
  const value = {};
  const rangeMinDays = (0, _calcMinStay.calcMinStay)({
    from,
    minStayDates,
    minStayType,
    rangeMinDays: propRangeMinDays,
    to
  });
  if (minStayType !== undefined && from && !to && rangeMinDays > 1) {
    value[(0, _locale.dateFormat)(from, {
      format: _helpers.CALENDAR_FORMAT
    })] = {
      text: translate(_Calendar.L10N.LABEL_MIN_NIGHTS, {
        value: rangeMinDays
      }),
      pressable: false
    };
  }
  return value;
};
exports.calcTooltips = calcTooltips;
//# sourceMappingURL=calcTooltips.js.map