import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Box, Text } from 'ink';
const MAX_VISIBLE_OPTIONS = 8;
export function ReasoningEffortPickerPanel({ query, options, activeReasoningEffort, highlightedIndex, }) {
    const { visibleOptions, startIndex } = getVisibleOptions(options, highlightedIndex);
    return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsx(Text, { dimColor: true, children: "Reasoning effort picker" }), _jsx(Text, { dimColor: true, children: query ? `Search: ${query}` : 'Type after /reasoning set to filter. Use up/down or Tab to choose.' }), visibleOptions.length > 0 ?
                visibleOptions.map((option, index) => {
                    const absoluteIndex = startIndex + index;
                    const isHighlighted = absoluteIndex === highlightedIndex;
                    const isActive = option.id === (activeReasoningEffort ?? 'default');
                    const marker = isHighlighted ? '◉' : '○';
                    const suffix = [
                        isActive ? '(current)' : undefined,
                        option.disabled ? `(${option.disabledReason ?? 'unavailable'})` : undefined,
                    ].filter(Boolean).join(' ');
                    return (_jsx(Text, { color: isHighlighted ? 'cyan' : option.disabled ? 'yellow' : undefined, dimColor: !isHighlighted && !option.disabled, children: `${marker} ${option.label}${suffix ? ` ${suffix}` : ''} - ${option.description}` }, option.id));
                })
                : _jsx(Text, { dimColor: true, children: "No matching reasoning efforts." })] }));
}
function getVisibleOptions(options, highlightedIndex) {
    if (options.length <= MAX_VISIBLE_OPTIONS) {
        return { visibleOptions: options, startIndex: 0 };
    }
    const half = Math.floor(MAX_VISIBLE_OPTIONS / 2);
    const startIndex = Math.min(Math.max(0, highlightedIndex - half), Math.max(0, options.length - MAX_VISIBLE_OPTIONS));
    return {
        visibleOptions: options.slice(startIndex, startIndex + MAX_VISIBLE_OPTIONS),
        startIndex,
    };
}
//# sourceMappingURL=ReasoningEffortPickerPanel.js.map