text: import _extends from '@babel/runtime/helpers/esm/extends';
  import _objectWithoutPropertiesLoose from '@babel/runtime/helpers/esm/objectWithoutPropertiesLoose';
  import { forwardRef, useMemo, useEffect, createElement } from 'react';
  import { useThree, useFrame } from '@react-three/fiber';
  import { MapControls as MapControls$1 } from 'three-stdlib';
  
  const MapControls = /*#__PURE__*/forwardRef((props = {
    enableDamping: true
  }, ref) => {
    const {
      camera
    } = props,
          rest = _objectWithoutPropertiesLoose(props, ["camera"]);
  
    const invalidate = useThree(({
      invalidate
    }) => invalidate);
    const defaultCamera = useThree(({
      camera
    }) => camera);
    const domElement = useThree(({
      gl
    }) => gl.domElement);
    const explCamera = camera || defaultCamera;
    const controls = useMemo(() => new MapControls$1(explCamera), [explCamera]);
    useEffect(() => {
      controls.connect(domElement);
      controls.addEventListener('change', invalidate);
      return () => {
        controls.dispose();
        controls.removeEventListener('change', invalidate);
      };
    }, [controls, invalidate, domElement]);
    useFrame(() => controls.update());
    return /*#__PURE__*/createElement("primitive", _extends({
      ref: ref,
      dispose: undefined,
      object: controls,
      enableDamping: true
    }, rest));
  });
  
  export { MapControls };
  