import * as n from "react";
import v from "../../../../rc-util/es/hooks/useEvent.mjs";
import "../../../../rc-util/es/hooks/useLayoutEffect.mjs";
import "../../../../rc-util/node_modules/react-is/index.mjs";
import "../../../../rc-util/es/warning.mjs";
import s from "../../../../rc-util/es/raf.mjs";
import h from "./WaveEffect.mjs";
import "../../config-provider/index.mjs";
import w from "../../theme/useToken.mjs";
import { TARGET_CLS as l } from "./interface.mjs";
import { ConfigContext as W } from "../../config-provider/context.mjs";
function q(c, f, m) {
  const {
    wave: o
  } = n.useContext(W), [, a, i] = w(), u = v((e) => {
    const t = c.current;
    if (o != null && o.disabled || !t)
      return;
    const p = t.querySelector(`.${l}`) || t, {
      showEffect: d
    } = o || {};
    (d || h)(p, {
      className: f,
      token: a,
      component: m,
      event: e,
      hashId: i
    });
  }), r = n.useRef();
  return (e) => {
    s.cancel(r.current), r.current = s(() => {
      u(e);
    });
  };
}
export {
  q as default
};
