import * as react_jsx_runtime from 'react/jsx-runtime';
import { a as BlockRecord } from './types-D1b8v7EY.js';
import * as React from 'react';
import './types-GCkXbyFm.js';
import './types-B2aYk82c.js';

/** The sender of a chat message. */
type MessageRole = "user" | "assistant";
/** A single message in the chat conversation. */
interface ChatMessage$1 {
    /** Unique identifier for the message. */
    id: string;
    /** Who sent this message — the end-user or the AI assistant. */
    role: MessageRole;
    /** Ordered content blocks. Render order is array order; new block types extend the discriminated union additively. */
    blocks: BlockRecord[];
    /** Plain-text representation of the blocks, supplied by the server. Used for clipboard copy and accessibility — clay does not derive it. */
    fallbackText: string;
    /** Feedback state: `true` = helpful, `false` = not helpful, `null`/`undefined` = no feedback given. */
    isHelpful?: boolean | null;
}
/** Value provided by the Chat context to all child components. */
interface ChatContextValue {
    /** The full list of messages in the conversation. */
    messages: ChatMessage$1[];
    /** Called when the user submits a new message. Receives the raw text content. */
    onSendMessage: (content: string) => void;
    /** Whether the assistant is currently generating a response. */
    isLoading: boolean;
    /** Called when the user clicks "stop" to abort a streaming response. */
    onStop?: () => void;
    /** Called when a message's content is copied to clipboard. Receives the message ID. */
    onCopyMessage?: (messageId: string) => void;
    /** Called when the user clicks the "thumbs up" button. Receives the message ID and the new feedback value (`true` = selected, `null` = deselected). */
    onThumbUpClick?: (messageId: string, isHelpful: boolean | null) => void;
    /** Called when the user clicks the "thumbs down" button. Receives the message ID and the new feedback value (`false` = selected, `null` = deselected). */
    onThumbDownClick?: (messageId: string, isHelpful: boolean | null) => void;
}

interface ChatMessageProps {
    message: ChatMessage$1;
}
declare function ChatMessage({ message }: ChatMessageProps): react_jsx_runtime.JSX.Element;

declare const ChatContext: React.Context<ChatContextValue | null>;
declare function useChatContext(): ChatContextValue;

interface UseCopyToClipboardResult {
    isCopied: boolean;
    copy: (text: string) => void;
}
declare function useCopyToClipboard(): UseCopyToClipboardResult;

/**
 * Aggregates the clipboard text for all blocks in a message.
 *
 * Iterates `message.blocks` in order, calls `BlockServices[block.type].toClipboardText(block)`
 * for each, and joins the results with `"\n\n"` so multi-block messages have a blank line between
 * each section (matching the visual gap rendered between blocks in the chat UI).
 *
 * Block-type-specific behaviour:
 * - `TEXT` blocks: markdown stripped to plain text via `markdownToPlainText`.
 * - `ARTIFACT_REF` blocks: delegates to the registered artifact component's `toClipboardText`
 *   (e.g. the artifact title as plain text for table artifacts).
 * - Unknown block types: silently skipped (no registered service → no contribution to output).
 *
 * Falls back to `message.fallbackText` only when every block produces an empty string — this
 * guards against edge cases (empty message, all-unknown block types) while still preferring
 * the richer per-block text in the normal case.
 *
 * @param message  The chat message whose blocks should be aggregated.
 * @returns        A string suitable for writing to the system clipboard.
 */
declare function copyMessageText(message: ChatMessage$1): string;

declare const MESSAGE_ROLE: {
    readonly USER: "user";
    readonly ASSISTANT: "assistant";
};

export { ChatContext, type ChatContextValue, ChatMessage, type ChatMessage$1 as ChatMessageType, MESSAGE_ROLE, type MessageRole, copyMessageText, useChatContext, useCopyToClipboard };
