import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { Box, Text } from "ink";
import { StatusBadge } from "./design/StatusBadge.js";
import TextInput from "./TextInput.js";
export function VimTextInput(props) {
    const { mode = "insert", showMode = true, ...inputProps } = props;
    const model = vimModeModel(mode);
    const showCursor = inputProps.showCursor ?? model.cursorVisible;
    return (_jsxs(Box, { flexDirection: "row", children: [showMode && (_jsxs(_Fragment, { children: [_jsx(StatusBadge, { label: model.label, tone: model.tone }), _jsx(Text, { children: " " })] })), _jsx(TextInput, { ...inputProps, showCursor: showCursor })] }));
}
export function vimModeModel(mode) {
    if (mode === "normal") {
        return { label: "NOR", tone: "warning", acceptsText: false, cursorVisible: true };
    }
    if (mode === "replace") {
        return { label: "REP", tone: "error", acceptsText: true, cursorVisible: true };
    }
    return { label: "INS", tone: "success", acceptsText: true, cursorVisible: true };
}
export default VimTextInput;
