'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var vue = require('vue');
require('../../../utils/index.js');
var shared = require('@vue/shared');

const groupToolTipInjectKey = Symbol("groupToolTipKeys");
const isTriggerType = (trigger, type) => {
  if (shared.isArray(trigger)) {
    return trigger.includes(type);
  }
  return trigger === type;
};
const whenTrigger = (trigger, type, handler) => {
  return (e) => {
    isTriggerType(vue.unref(trigger), type) && handler(e);
  };
};
const seekParent = (e, className, root) => {
  var _a;
  const curTarget = e.target;
  if ((_a = Array.from(curTarget.classList)) == null ? void 0 : _a.includes(className)) {
    return curTarget;
  }
  let nextParent = curTarget.parentNode;
  let elementDom = null;
  while (!elementDom) {
    if (Array.from(nextParent.classList).includes(className)) {
      elementDom = nextParent;
      break;
    }
    if (document.body === nextParent || nextParent === root) {
      elementDom = null;
      break;
    }
    nextParent = nextParent.parentNode;
  }
  return elementDom;
};

exports.groupToolTipInjectKey = groupToolTipInjectKey;
exports.isTriggerType = isTriggerType;
exports.seekParent = seekParent;
exports.whenTrigger = whenTrigger;
//# sourceMappingURL=utils.js.map
