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';
/** The `NativeEventEmitHandlerSlimmer` class is a TypeScript class that handles emitting native events based on event semantics. */
export class NativeEventEmitHandlerSlimmer extends VegaSlimmer {
  constructor() {
    super(...arguments);
    /**
     * The function determines whether a native event should be emitted based on the namespace of the event semantics.
     *
     * @param {EventSemantics} namespace the event semantics namespace
     * @returns {boolean} a boolean value.
     */
    this.canHandle = ({ namespace }) => {
      return namespace === 'native';
    };
    /**
     * The function emits a native event with a given detail.
     *
     * @param {unknown} detail - The `detail` parameter is a generic type `T` that represents the data or
     * information that you want to pass along with the event. It can be any type of data, such as a
     * string, number, object, or custom type.
     * @param {Event} [e] the event object
     * @returns {CustomEvent} The emitted event.
     */
    this.handle = (detail, e) => {
      if (e) {
        e.stopPropagation();
      }
      return this.nativeEvent.emit(detail);
    };
  }
}
__decorate([
  MapToComponentField()
], NativeEventEmitHandlerSlimmer.prototype, "nativeEvent", void 0);
