var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { VegaSlimmer, MapToComponentMethod, MapToComponentField } from 'vega-slimmer/core';
/**
 * Controller to determine if the calendar should render dual months or not.
 *    It will set isDualMonths to false if it's a mobile device, otherwise it will check the dualMonths prop or if the mode is range.
 */
export class VegaDatePickerCalendarIsDualMonthsController extends VegaSlimmer {
  /** componentWillLoad */
  componentWillLoad() {
    this.setIsDualMonths();
  }
  /**
   * Watch for changes in the mode prop to determine if we need to update the isDualMonths field.
   *  If the mode changes, we will re-evaluate whether we should render dual months or not.
   */
  watchMode() {
    this.setIsDualMonths();
  }
  /**
   * Watch for changes in the dualMonths prop to determine if we need to update the isDualMonths field.
   */
  watchDualMonths() {
    this.setIsDualMonths();
  }
  /**
   * Sets the isDualMonths field based on the device type, dualMonths prop, and mode.
   *  If it's a mobile device, it will always set isDualMonths to false. Otherwise, it will set it to the value of the dualMonths prop if it's defined, or true if the mode is 'range'.
   */
  setIsDualMonths() {
    if (this.isMobileDevice) {
      this.isDualMonths = false;
    }
    else {
      this.isDualMonths =
        typeof this.dualMonths === 'boolean' ? this.dualMonths : this.mode === 'range';
    }
  }
}
__decorate([
  MapToComponentField()
], VegaDatePickerCalendarIsDualMonthsController.prototype, "mode", void 0);
__decorate([
  MapToComponentField()
], VegaDatePickerCalendarIsDualMonthsController.prototype, "dualMonths", void 0);
__decorate([
  MapToComponentField({ writable: true })
], VegaDatePickerCalendarIsDualMonthsController.prototype, "isDualMonths", void 0);
__decorate([
  MapToComponentField()
], VegaDatePickerCalendarIsDualMonthsController.prototype, "isMobileDevice", void 0);
__decorate([
  MapToComponentMethod('componentWillLoad')
], VegaDatePickerCalendarIsDualMonthsController.prototype, "componentWillLoad", null);
__decorate([
  MapToComponentMethod('watchMode')
], VegaDatePickerCalendarIsDualMonthsController.prototype, "watchMode", null);
__decorate([
  MapToComponentMethod('watchDualMonths')
], VegaDatePickerCalendarIsDualMonthsController.prototype, "watchDualMonths", null);
