import { watch } from 'vue';
import { useInjectCascader } from '../context.mjs';
import '../../vc-select/index.mjs';
import '../../hooks/index.mjs';
import useBaseProps from '../../vc-select/hooks/useBaseProps.mjs';
import { useState } from '../../hooks/useState.mjs';

var useActive = () => {
  const baseProps = useBaseProps();
  const { values } = useInjectCascader();
  const [activeValueCells, setActiveValueCells] = useState([]);
  watch(
    () => baseProps.open,
    () => {
      if (baseProps.open && !baseProps.multiple) {
        const firstValueCells = values.value[0];
        setActiveValueCells(firstValueCells || []);
      }
    },
    { immediate: true }
  );
  return [activeValueCells, setActiveValueCells];
};

export { useActive as default };
//# sourceMappingURL=useActive.mjs.map
