import { jsx } from "react/jsx-runtime";
import { useLingui } from "@lingui/react";
import react from "react";
import { useChatService } from "../../providers/chat-service.provider.js";
import { usePicker } from "../../providers/picker-provider.js";
import { DropdownPicker } from "../common/dropdown-picker.js";
function AutopilotChatInputModelPickerComponent({ useIcon }) {
    const { _ } = useLingui();
    const chatService = useChatService();
    const { models, selectedModel } = usePicker();
    const handleModelSelect = react.useCallback((option)=>{
        chatService?.setSelectedModel(option.id);
    }, [
        chatService
    ]);
    if (!models || models?.length === 0 || !selectedModel) return null;
    return /*#__PURE__*/ jsx(DropdownPicker, {
        options: models,
        selectedOption: {
            ...selectedModel,
            icon: useIcon ? 'model' : selectedModel.icon
        },
        onSelect: handleModelSelect,
        useIcon: useIcon,
        ariaLabel: _({
            id: 'autopilot-chat.input.model-selection-label'
        }),
        chatServiceInstance: chatService,
        iconVariant: "custom"
    });
}
const AutopilotChatInputModelPicker = /*#__PURE__*/ react.memo(AutopilotChatInputModelPickerComponent);
export { AutopilotChatInputModelPicker };
