import { watch } from 'vue';
import '../../../../hooks/index.mjs';
import useBaseProps from '../../../vc-select/src/hooks/useBaseProps.mjs';
import { useInjectCascader } from '../context.mjs';
import { useState } from '../../../../hooks/use-state/index.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
