import { useInput } from "ink";
function useInputHistory({ inputState, dispatch, isActive }) {
  useInput(
    (inputChar, key) => {
      if (!isActive || inputState.history.length === 0) return;
      if (key.upArrow) {
        dispatch({
          type: "INPUT_HISTORY_NAVIGATE",
          direction: "up"
        });
      } else if (key.downArrow) {
        dispatch({
          type: "INPUT_HISTORY_NAVIGATE",
          direction: "down"
        });
      }
    },
    { isActive }
  );
}
export {
  useInputHistory
};
