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 { MapToComponentField, VegaSlimmer } from 'vega-slimmer/core';
import ChangeManager from '../../../../../helpers/change-manager/change-manager';
import { DROPDOWN_ITEM_CLICK } from '../../../../../helpers/change-manager/subject/static-subject/static-subject-title';
/**
 * Controller for the vega dropdown item states
 */
export class VegaDropdownItemClickController extends VegaSlimmer {
  /**
   * The handleClick function emits an event with the itemKey and notifies the ChangeManager with the
   * dropdown item click event and the itemKey.
   *
   * @param {MouseEvent} e - MouseEvent - The event object that contains information about the mouse
   * click event.
   */
  handleClick(e) {
    this.clickEventEmitter.emit({ itemKey: this.itemKey }, e);
    ChangeManager.notify(DROPDOWN_ITEM_CLICK, { host: this.host, detail: { itemKey: this.itemKey } });
  }
}
__decorate([
  MapToComponentField()
], VegaDropdownItemClickController.prototype, "host", void 0);
__decorate([
  MapToComponentField()
], VegaDropdownItemClickController.prototype, "itemKey", void 0);
__decorate([
  MapToComponentField()
], VegaDropdownItemClickController.prototype, "vegaClick", void 0);
__decorate([
  MapToComponentField()
], VegaDropdownItemClickController.prototype, "clickEventEmitter", void 0);
