/**
 * tdesign v0.41.7
 * (c) 2022 tdesign
 * @license MIT
 */

import { getPropsApiByEvent } from './helper.js';
import '@babel/runtime/helpers/objectWithoutProperties';
import '@babel/runtime/helpers/slicedToArray';
import '@babel/runtime/helpers/defineProperty';
import 'lodash/camelCase';

function emitEvent(vm, eventName) {
  var emitEventName;
  var emitEventMethodName;

  if (typeof eventName === "string") {
    emitEventName = eventName;
    emitEventMethodName = getPropsApiByEvent(eventName);
  } else {
    emitEventName = eventName.event;
    emitEventMethodName = eventName.method;
  }

  for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
    args[_key - 2] = arguments[_key];
  }

  if (vm.$listeners["".concat(emitEventName)]) {
    vm.$emit.apply(vm, [emitEventName].concat(args));
  }

  if (typeof vm.$props[emitEventMethodName] === "function") {
    var _vm$$props;

    (_vm$$props = vm.$props)[emitEventMethodName].apply(_vm$$props, args);
  }
}

export { emitEvent };
//# sourceMappingURL=event.js.map
