import * as _btst_stack_plugins_client from '@btst/stack/plugins/client';
import * as react from 'react';
import * as _btst_yar from '@btst/yar';
import { QueryClient } from '@tanstack/react-query';
import { S as SerializedConversation, a as SerializedMessage } from '../../../shared/stack.Be1QIHEn.js';
import { A as AiChatMode } from '../../../shared/stack.DaOcgmrM.js';
export { a as AiChatPluginOverrides, b as AllowedFileType, i as ChatInput, C as ChatInterface, e as ChatLayout, f as ChatLayoutProps, h as ChatMessage, g as ChatSidebar, D as DEFAULT_ALLOWED_FILE_TYPES, j as ToolCallDisplay, T as ToolCallProps, d as ToolCallRenderer, c as ToolCallState } from '../../../shared/stack.DaOcgmrM.js';
export { UIMessage } from 'ai';
import 'react/jsx-runtime';

/**
 * Context passed to route hooks
 */
interface RouteContext {
    /** Current route path */
    path: string;
    /** Route parameters (e.g., { id: "abc123" }) */
    params?: Record<string, string>;
    /** Whether rendering on server (true) or client (false) */
    isSSR: boolean;
    /** Additional context properties */
    [key: string]: any;
}
/**
 * Context passed to loader hooks
 */
interface LoaderContext {
    /** Current route path */
    path: string;
    /** Route parameters (e.g., { id: "abc123" }) */
    params?: Record<string, string>;
    /** Whether rendering on server (true) or client (false) */
    isSSR: boolean;
    /** Base URL for API calls */
    apiBaseURL: string;
    /** Path where the API is mounted */
    apiBasePath: string;
    /** Optional headers for the request */
    headers?: Headers;
    /** Additional context properties */
    [key: string]: any;
}
/**
 * Configuration for AI Chat client plugin
 */
interface AiChatClientConfig {
    /** Base URL for API calls (e.g., "http://localhost:3000") */
    apiBaseURL: string;
    /** Path where the API is mounted (e.g., "/api/data") */
    apiBasePath: string;
    /** Base URL of your site for SEO meta tags */
    siteBaseURL: string;
    /** Path where pages are mounted (e.g., "/pages") */
    siteBasePath: string;
    /** React Query client instance for caching */
    queryClient: QueryClient;
    /**
     * Plugin mode - should match backend config
     * - 'authenticated': Full chat with conversation history (default)
     * - 'public': Simple widget mode, no persistence, no sidebar
     * @default 'authenticated'
     */
    mode?: AiChatMode;
    /** Optional SEO configuration for meta tags */
    seo?: {
        /** Site name for Open Graph tags */
        siteName?: string;
        /** Default description */
        description?: string;
        /** Locale for Open Graph (e.g., "en_US") */
        locale?: string;
        /** Default image URL for social sharing */
        defaultImage?: string;
    };
    /** Optional hooks for customizing behavior */
    hooks?: AiChatClientHooks;
    /** Optional headers for SSR (e.g., forwarding cookies) */
    headers?: Headers;
}
/**
 * Hooks for AI Chat client plugin
 * All hooks are optional and allow consumers to customize behavior
 */
interface AiChatClientHooks {
    /**
     * Called before loading conversations list. Return false to cancel loading.
     * @param context - Loader context with path, params, etc.
     */
    beforeLoadConversations?: (context: LoaderContext) => Promise<boolean> | boolean;
    /**
     * Called after conversations are loaded. Return false to cancel further processing.
     * @param conversations - Array of loaded conversations or null
     * @param context - Loader context
     */
    afterLoadConversations?: (conversations: SerializedConversation[] | null, context: LoaderContext) => Promise<boolean> | boolean;
    /**
     * Called before loading a single conversation. Return false to cancel loading.
     * @param id - Conversation ID being loaded
     * @param context - Loader context
     */
    beforeLoadConversation?: (id: string, context: LoaderContext) => Promise<boolean> | boolean;
    /**
     * Called after a conversation is loaded. Return false to cancel further processing.
     * @param conversation - Loaded conversation or null if not found
     * @param id - Conversation ID that was requested
     * @param context - Loader context
     */
    afterLoadConversation?: (conversation: (SerializedConversation & {
        messages: SerializedMessage[];
    }) | null, id: string, context: LoaderContext) => Promise<boolean> | boolean;
    /**
     * Called when a loading error occurs
     * @param error - The error that occurred
     * @param context - Loader context
     */
    onLoadError?: (error: Error, context: LoaderContext) => Promise<void> | void;
}
/**
 * AI Chat client plugin
 * Provides routes, components, and React Query hooks for AI chat
 *
 * @param config - Configuration including queryClient, baseURL, and optional hooks
 */
declare const aiChatClientPlugin: (config: AiChatClientConfig) => _btst_stack_plugins_client.ClientPlugin<Record<string, never>, {
    chat: {
        (inputCtx_0?: _btst_yar.InputContext<"/chat", _btst_yar.RouteOptions> | undefined): {
            PageComponent?: react.ComponentType<unknown> | undefined;
            LoadingComponent?: react.ComponentType<unknown> | undefined;
            ErrorComponent?: react.ComponentType<unknown> | undefined;
            loader?: (() => Promise<void>) | undefined;
            meta?: (() => ({
                title: string;
                name?: undefined;
                content?: undefined;
                property?: undefined;
            } | {
                name: string;
                content: string;
                title?: undefined;
                property?: undefined;
            } | {
                property: string;
                content: string;
                title?: undefined;
                name?: undefined;
            })[]) | undefined;
            extra?: (() => any) | undefined;
        };
        options: _btst_yar.RouteOptions | undefined;
        path: "/chat";
        meta: _btst_yar.RouteMeta | undefined;
    };
}>;

export { aiChatClientPlugin };
export type { AiChatClientConfig, AiChatClientHooks, LoaderContext, RouteContext };
