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, MapToComponentField, MapToComponentMethod } from 'vega-slimmer/core';
/** The `VegaTimePickerInputMaskController` class is responsible for initializing an input mask based on the time format and mode. */
export class VegaTimePickerInputMaskController extends VegaSlimmer {
  /**
   * The function initializes an input mask based on the time format and mode.
   */
  initInputMask() {
    const maskConfig = {
      type: 'custom',
      options: {
        mask: this.timeFormat === '12-hour' ? 'xx:xx xx' : 'xx:xx',
        slot: 'x',
        accept: this.timeFormat === '12-hour' ? /[0-9|A|P|M]/ : /\d/,
      },
    };
    if (this.mode === 'range') {
      this.rangeInputRenderer.getStartInputRef().maskConfig = maskConfig;
      this.rangeInputRenderer.getEndInputRef().maskConfig = maskConfig;
    }
    else {
      this.singleInputRenderer.getInputRef().maskConfig = maskConfig;
    }
  }
}
__decorate([
  MapToComponentField()
], VegaTimePickerInputMaskController.prototype, "timeFormat", void 0);
__decorate([
  MapToComponentField()
], VegaTimePickerInputMaskController.prototype, "mode", void 0);
__decorate([
  MapToComponentField()
], VegaTimePickerInputMaskController.prototype, "singleInputRenderer", void 0);
__decorate([
  MapToComponentField()
], VegaTimePickerInputMaskController.prototype, "rangeInputRenderer", void 0);
__decorate([
  MapToComponentMethod('componentDidLoad')
], VegaTimePickerInputMaskController.prototype, "initInputMask", null);
