import { unref } from 'vue';
import '../../../utils/index.mjs';
import { isArray } from '@vue/shared';

const groupToolTipInjectKey = Symbol("groupToolTipKeys");
const isTriggerType = (trigger, type) => {
  if (isArray(trigger)) {
    return trigger.includes(type);
  }
  return trigger === type;
};
const whenTrigger = (trigger, type, handler) => {
  return (e) => {
    isTriggerType(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;
};

export { groupToolTipInjectKey, isTriggerType, seekParent, whenTrigger };
//# sourceMappingURL=utils.mjs.map
