import { LitElement, PropertyValues } from 'lit';
import { AudioRecordingStatus } from '../audio-recording-item/audio-recording-item.js';
import '../icon-button/icon-button.js';
import '../input-chip/input-chip.js';
import '../button/button.js';
import '../audio-recording-item/audio-recording-item.js';
import '../../icons/icon-up-iec.js';
import '../../icons/icon-screen-shot.js';
import '../../icons/icon-image.js';
import '../../icons/icon-attachment.js';
import '../../icons/icon-com-microphone.js';
import '../../icons/icon-arrow-up-google.js';
import '../../icons/icon-check-google.js';
import '../../icons/icon-close-google.js';
import '../../icons/icon-delete.js';
import '../../icons/icon-media-pause.js';
import '../../icons/icon-media-play.js';
/**
 * Textarea field type determines messaging-specific features.
 */
export declare enum TextareaFieldType {
    /** Rich text field without send button */
    Rich = "rich",
    /** Message field with send button */
    Message = "message"
}
/**
 * Voice action types for the consolidated voice-action event.
 */
export declare enum VoiceAction {
    Start = "start",
    Cancel = "cancel",
    Confirm = "confirm",
    Delete = "delete",
    Pause = "pause",
    Resume = "resume",
    Transcribe = "transcribe",
    Send = "send",
    PlaybackToggle = "playback-toggle"
}
/**
 * Detail for the voice-action event.
 */
export interface VoiceActionDetail {
    /** The type of voice action */
    action: VoiceAction;
    /** For playback-toggle: the desired playing state */
    playing?: boolean;
}
/**
 * Attachment object for file chips.
 */
export interface Attachment {
    /** Unique identifier for removal */
    id: string;
    /** Display text */
    label: string;
    /** Whether to show an icon in the chip */
    showIcon?: boolean;
}
/**
 * `<obc-textarea-field>` – A multi-line text input component with toolbar, voice recording, and attachments for composing messages or notes.
 *
 * Provides a flexible textarea for composing extended text content, with optional toolbar actions (screenshot, image, attachment), voice recording UI, file attachment chips, and form features like labels and validation. Use the `type` property to switch between rich text mode (for forms/notes) and message mode (for chat-style messaging with a send button).
 *
 * ## Features
 *
 * - **Field types:**
 *   - `rich` (default): Multi-line input without a send button, suitable for forms or note-taking.
 *   - `message`: Includes a send button for chat-style messaging interfaces.
 * - **Toolbar actions:**
 *   - Add (+): Generic action for adding content.
 *   - Screenshot: Capture and attach a screenshot.
 *   - Image: Attach an image file.
 *   - Attachment: Attach any file type.
 *   - Toolbar visibility is controlled by `showToolbar`.
 * - **Voice recording:**
 *   - Microphone button to start voice recording (UI only—parent handles audio capture).
 *   - Displays `<obc-audio-recording-item>` waveform during recording.
 *   - Different controls for Rich vs Message types (see Voice Recording Flow below).
 *   - Visibility is controlled by `showVoiceRecording`.
 * - **Attachments:**
 *   - Display file attachments as removable chips below the input.
 *   - Each chip can be removed, firing `attachment-remove`.
 * - **Form features:**
 *   - Optional label with required indicator.
 *   - Error state with error message display.
 *   - Disabled state prevents all interaction.
 *   - Optional leading icon slot.
 * - **Keyboard support:**
 *   - Ctrl/Cmd + Enter sends the message (Message type only).
 *
 * ## Voice Recording Flow
 *
 * The component provides UI for voice recording but does NOT handle actual audio capture.
 * The parent application is responsible for managing the recording state, audio levels, and duration.
 *
 * **Recording status states:**
 * - `recording`: Active recording with live waveform visualization.
 * - `playback`: Recording is paused/stopped and user can preview the recorded audio with a slider and play/pause button.
 *   Use this state when the user pauses recording to allow them to review before confirming/sending.
 *
 * **Rich type recording controls:**
 * - Cancel (X): Fires `voice-action` with `action: 'cancel'` — parent should set `recording=false`.
 * - Pause/Mic: Fires `voice-action` with `action: 'pause'` or `action: 'resume'`.
 * - Confirm (checkmark): Fires `voice-action` with `action: 'confirm'` — parent should transcribe and append to `value`.
 *
 * **Message type recording controls:**
 * - Delete (trash): Fires `voice-action` with `action: 'delete'` — parent should set `recording=false`.
 * - Transcribe button: Fires `voice-action` with `action: 'transcribe'` — parent should convert audio to text.
 * - Pause/Mic: Fires `voice-action` with `action: 'pause'` or `action: 'resume'`.
 * - Send: Fires `voice-action` with `action: 'send'` — parent should send as voice message.
 *
 * **Playback mode:**
 * When `recordingStatus="playback"`, the component shows a progress slider instead of the waveform.
 * The parent should update `playbackPosition` (0-1) as audio plays and handle `voice-action`
 * with `action: 'playback-toggle'` and `playing: boolean` to control playback.
 *
 * ## Usage Guidelines
 *
 * Use `<obc-textarea-field>` for composing messages, notes, or any multi-line text input that benefits from media attachments or voice recording. Choose `type="message"` for chat interfaces where users expect a send button, or `type="rich"` for forms and note-taking where submission is handled separately.
 *
 * For voice recording, the parent application must:
 * 1. Listen for `voice-action` with `action: 'start'` and begin audio capture.
 * 2. Set `recording=true` and update `audioLevels` and `recordingDuration` as recording progresses.
 * 3. Handle other `voice-action` events (pause/resume/cancel/confirm/send/transcribe) appropriately.
 * 4. For playback preview, set `recordingStatus="playback"` and update `playbackPosition`.
 * 5. Handle `voice-action` with `action: 'playback-toggle'` and use `event.detail.playing` to control audio playback.
 * 6. Set `recording=false` when recording ends (the component automatically resets `recordingStatus` and `playbackPosition`).
 *
 * **Keywords:** textarea, text input, message composer, chat input, voice message, file attachment, multi-line input, form field
 *
 * ## Slots
 *
 * | Name           | Rendered when…         | Purpose                                       |
 * | -------------- | ---------------------- | --------------------------------------------- |
 * | `leading-icon` | `hasLeadingIcon=true`  | Displays a contextual icon before the input.  |
 *
 * ## Events
 * - `input` – Fired when the textarea value changes.
 * - `change` – Fired when the textarea value changes and loses focus (blur).
 * - `blur` – Fired when the textarea loses focus (blur).
 * - `send-click` – Fired when the send button is clicked (Message type only), with the current value.
 * - `add-click` – Fired when the add (+) button is clicked.
 * - `screenshot-click` – Fired when the screenshot button is clicked.
 * - `image-click` – Fired when the image button is clicked.
 * - `attachment-click` – Fired when the attachment button is clicked.
 * - `voice-action` – Fired for all voice recording actions. The `detail.action` specifies the action type:
 *   - `start`: Microphone button clicked to start recording.
 *   - `cancel`: Cancel (X) clicked during recording (Rich type).
 *   - `confirm`: Confirm (checkmark) clicked after recording (Rich type).
 *   - `delete`: Delete (trash) clicked during recording (Message type).
 *   - `pause`: Pause clicked during recording.
 *   - `resume`: Resume/mic clicked to continue recording.
 *   - `transcribe`: Transcribe clicked (Message type).
 *   - `send`: Send clicked during recording (Message type).
 *   - `playback-toggle`: Play/pause toggled on recorded audio preview. Includes `detail.playing` boolean.
 * - `attachment-remove` – Fired when an attachment chip's remove button is clicked.
 *
 * ## Example
 *
 * ```html
 * <obc-textarea-field
 *   type="message"
 *   label="Message"
 *   placeholder="Type a message..."
 *   .attachments=${[{id: '1', label: 'document.pdf', showIcon: true}]}
 *   hasLeadingIcon
 *   @send-click=${(e) => console.log('Send:', e.detail.value)}
 *   @attachment-remove=${(e) => console.log('Remove:', e.detail.id)}
 * >
 *   <obi-com-microphone slot="leading-icon"></obi-com-microphone>
 * </obc-textarea-field>
 * ```
 *
 * ---
 *
 * @slot leading-icon - Displays a contextual icon before the input when `hasLeadingIcon` is true.
 *
 * @fires change {CustomEvent<{value: string}>} Fired on change when value has changed.
 * @fires input {CustomEvent<{value: string}>} Fired on input when value changes.
 * @fires blur {CustomEvent<void>} Fired on blur.
 * @fires send-click {CustomEvent<{value: string}>} Fired when the send button is clicked (Message type only).
 * @fires add-click {CustomEvent<void>} Fired when the add (+) button is clicked.
 * @fires screenshot-click {CustomEvent<void>} Fired when the screenshot button is clicked.
 * @fires image-click {CustomEvent<void>} Fired when the image button is clicked.
 * @fires attachment-click {CustomEvent<void>} Fired when the attachment button is clicked.
 * @fires voice-action {CustomEvent<VoiceActionDetail>} Fired for all voice recording actions. Check detail.action for the action type.
 * @fires attachment-remove {CustomEvent<{id: string}>} Fired when an attachment chip is removed.
 */
export declare class ObcTextareaField extends LitElement {
    /**
     * Field type: 'rich' (no send button) or 'message' (with send button).
     */
    type: TextareaFieldType;
    /**
     * The current text value of the input field.
     */
    value: string;
    /**
     * If true, the textarea will not update its value from external changes while focused.
     */
    rejectUpdatesOnFocus: boolean;
    /**
     * If true, the value will only be initially set from the external model and not updated on subsequent changes.
     */
    rejectUpdates: boolean;
    /**
     * If true, the textarea will not update its value if the value is the same as the previous value.
     * Useful to avoid React re-rendering resetting the value.
     */
    rejectDuplicateUpdates: boolean;
    /**
     * Placeholder text shown when the input is empty.
     */
    placeholder: string;
    /**
     * Label text displayed above the input field.
     */
    label: string;
    /**
     * Error text displayed below the field when `error` is true.
     */
    errorText: string;
    /**
     * Maximum number of characters allowed in the textarea.
     */
    maxlength?: number;
    /**
     * Disables the input field and all actions.
     */
    disabled: boolean;
    /**
     * Shows error state with visual highlight.
     */
    error: boolean;
    /**
     * Shows a required indicator next to the label.
     */
    required: boolean;
    /**
     * Shows the label above the input field.
     */
    showLabel: boolean;
    /**
     * Shows the toolbar with action buttons.
     */
    showToolbar: boolean;
    /**
     * Shows the voice recording button.
     */
    showVoiceRecording: boolean;
    /**
     * Shows a leading icon before the input field.
     */
    hasLeadingIcon: boolean;
    /**
     * Whether voice recording is currently active.
     * When true, shows the audio-recording-item instead of textarea.
     */
    recording: boolean;
    /**
     * Current recording duration in seconds.
     */
    recordingDuration: number;
    /**
     * Array of audio level values (0-1) for waveform visualization.
     * New values should be added to the end (right side) and old values shift left.
     */
    audioLevels: number[];
    /**
     * Recording status passed to audio-recording-item.
     * Use 'recording' during active recording, and 'playback' when paused
     * to allow the user to preview the recorded audio with a slider.
     * Automatically reset to 'recording' when `recording` becomes false.
     */
    recordingStatus: AudioRecordingStatus;
    /**
     * Current playback position (0-1) for playback mode.
     * Only relevant when recordingStatus is 'playback'.
     */
    playbackPosition: number;
    /**
     * Array of file attachments displayed as removable chips.
     */
    attachments: Attachment[];
    private _focused;
    private _statusAnnouncement;
    private _isPlayingRecording;
    private _previousValue;
    private _previousInputElementValue;
    private _textarea?;
    private _firstActionButton?;
    willUpdate(changedProperties: PropertyValues): void;
    protected updated(changedProperties: Map<string, unknown>): void;
    private _pendingAnnouncementId;
    /**
     * Announces a status message to screen readers via the aria-live region.
     * Uses a unique ID to prevent rapid calls from dropping messages.
     */
    private announceStatus;
    /**
     * Safely focuses an element after a frame, checking that the component is still connected.
     */
    private safeFocus;
    private get isMessageType();
    private get hasContent();
    private get canSend();
    private get showTitle();
    private get isPausedOrPlayback();
    private get shouldShowToolbar();
    private get isEmpty();
    private emit;
    private emitIfEnabled;
    private handleInput;
    private handleKeyDown;
    private handleFocus;
    private handleBlur;
    private handleSendClick;
    private handleAddClick;
    private handleScreenshotClick;
    private handleImageClick;
    private handleAttachmentClick;
    private emitVoiceAction;
    private handleVoiceRecordingStart;
    private handleVoiceRecordingCancel;
    private handleVoiceRecordingConfirm;
    private handleVoiceRecordingDelete;
    private handleVoiceRecordingPause;
    private handleVoiceRecordingResume;
    private handleVoiceTranscribe;
    private handleVoiceSend;
    private handleVoicePlaybackToggle;
    private handleAttachmentRemove;
    private renderTitle;
    private renderLeadingIcon;
    private get shouldUpdateValue();
    private renderTextarea;
    private fireChangeEvent;
    private renderAttachments;
    private renderAudioRecordingItem;
    private renderToolbar;
    private renderNormalToolbar;
    private renderRecordingToolbar;
    private renderPauseResumeButton;
    private renderRichRecordingToolbar;
    private renderMessageRecordingToolbar;
    private renderErrorText;
    /**
     * Renders a visually hidden live region for screen reader announcements.
     * Uses role="status" with aria-live="polite" to announce recording state changes
     * without interrupting the user.
     */
    private renderStatusAnnouncement;
    render(): import('lit-html').TemplateResult<1>;
    static styles: import('lit').CSSResult;
}
declare global {
    interface HTMLElementTagNameMap {
        'obc-textarea-field': ObcTextareaField;
    }
}
//# sourceMappingURL=textarea-field.d.ts.map