import React__default from 'react';
import { Controller } from '../../../../../@use-gesture_core@10.3.1/node_modules/@use-gesture/core/dist/use-gesture-core.esm.mjs';
import { r as registerAction, e as dragAction } from '../../../../../@use-gesture_core@10.3.1/node_modules/@use-gesture/core/dist/actions-fe213e88.esm.mjs';
export { C as ConfigResolverMap, E as EngineMap } from '../../../../../@use-gesture_core@10.3.1/node_modules/@use-gesture/core/dist/actions-fe213e88.esm.mjs';

function useRecognizers(handlers, config = {}, gestureKey, nativeHandlers) {
  const ctrl = React__default.useMemo(() => new Controller(handlers), []);
  ctrl.applyHandlers(handlers, nativeHandlers);
  ctrl.applyConfig(config, gestureKey);
  React__default.useEffect(ctrl.effect.bind(ctrl));
  React__default.useEffect(() => {
    return ctrl.clean.bind(ctrl);
  }, []);
  if (config.target === undefined) {
    return ctrl.bind.bind(ctrl);
  }
  return undefined;
}

function useDrag(handler, config) {
  registerAction(dragAction);
  return useRecognizers({
    drag: handler
  }, config || {}, 'drag');
}

export { dragAction, registerAction, useDrag };
