"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PromptInput = PromptInput;
const jsx_runtime_1 = require("react/jsx-runtime");
const PromptInputFull_1 = require("./PromptInputFull.js");
const PromptInputSimple_1 = require("./PromptInputSimple.js");
const PromptInputWithPanels_1 = require("./PromptInputWithPanels.js");
const PromptInputWithSuggestions_1 = require("./PromptInputWithSuggestions.js");
const usePromptInput_1 = require("./usePromptInput.js");
require("./PromptInput.css");
/**
 * PromptInput component - a flexible input component for chat interfaces
 * with support for simple and full views, attachments, suggestions, and expandable panels
 *
 * @param props - Component props
 * @returns React component
 */
function PromptInput(props) {
    const { view = 'simple', onSend, onCancel, initialValue, disabled = false, status = 'ready', maxLength, headerProps, bodyProps, footerProps, suggestionsProps, topPanel, bottomPanel, className, qa, } = props;
    const hookState = (0, usePromptInput_1.usePromptInput)({
        onSend,
        onCancel,
        initialValue,
        disabled,
        status,
        maxLength,
    });
    // Handle suggestion click with custom handler or default to input change
    const handleSuggestionClick = (suggestion) => {
        if (suggestionsProps === null || suggestionsProps === void 0 ? void 0 : suggestionsProps.onSuggestionClick) {
            suggestionsProps.onSuggestionClick(suggestion);
        }
        else {
            hookState.handleChange(suggestion);
        }
    };
    const isFullView = view === 'full';
    // Prepare suggestions props with wrapped handler
    const wrappedSuggestionsProps = suggestionsProps
        ? Object.assign(Object.assign({}, suggestionsProps), { onSuggestionClick: handleSuggestionClick }) : undefined;
    return ((0, jsx_runtime_1.jsx)(PromptInputWithSuggestions_1.PromptInputWithSuggestions, { suggestionsProps: wrappedSuggestionsProps, children: (0, jsx_runtime_1.jsx)(PromptInputWithPanels_1.PromptInputWithPanels, { topPanel: topPanel, bottomPanel: bottomPanel, children: isFullView ? ((0, jsx_runtime_1.jsx)(PromptInputFull_1.PromptInputFull, { hookState: hookState, headerProps: headerProps, bodyProps: bodyProps, footerProps: footerProps, className: className, qa: qa })) : ((0, jsx_runtime_1.jsx)(PromptInputSimple_1.PromptInputSimple, { hookState: hookState, bodyProps: bodyProps, footerProps: footerProps, className: className, qa: qa })) }) }));
}
//# sourceMappingURL=PromptInput.js.map
