export declare class ChatBubbleSnippet extends HTMLElement { private shadow; private client; private chatView; private container; private isExpanded; private isMinimized; private translationsOverride; private resolvedTranslations; private chatQueryRewriteOverride; private handleBubbleClick; private handleCloseClick; private handleMinimizeClick; private handleClearClick; static get observedAttributes(): readonly ["api-url", "placeholder", "theme", "hide-branding", "translations", "chat-query-rewrite"]; constructor(); connectedCallback(): void; disconnectedCallback(): void; attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void; /** * Get the current translations object. */ get translations(): Translations | null; /** * Override AI Search query rewriting on subsequent chat turns. Setting * `null` falls back to parsing the `chat-query-rewrite` attribute. */ get chatQueryRewrite(): SearchSnippetProps['chatQueryRewrite'] | null; set chatQueryRewrite(value: SearchSnippetProps['chatQueryRewrite'] | null | undefined); /** * Override any user-facing string. Omitted keys fall back to English defaults. */ set translations(value: Translations | null | undefined); private syncTranslationsFromAttribute; private rerenderAfterTranslationsChange; private getProps; private resolveChatQueryRewrite; private initializeClient; private render; private getBubbleStyles; private getBaseHTML; private attachEventListeners; private removeEventListeners; private toggleChat; private closeChat; private toggleMinimize; private initializeChatView; private updateTheme; private cleanup; clearChat(): void; sendMessage(content: string): Promise; getMessages(): Message[]; } export declare class ChatPageSnippet extends HTMLElement { private shadow; private client; private chatView; private container; private sessions; private currentSessionId; private sidebarCollapsed; private translationsOverride; private resolvedTranslations; private chatQueryRewriteOverride; private handleClearClick; private handleNewChatClick; private handleToggleSidebarClick; private handleChatListClick; private handleMessageEvent; static get observedAttributes(): readonly ["api-url", "placeholder", "theme", "hide-branding", "translations", "chat-query-rewrite"]; constructor(); connectedCallback(): void; disconnectedCallback(): void; attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void; /** * Get the current translations object. */ get translations(): Translations | null; /** * Override AI Search query rewriting on subsequent chat turns. Setting * `null` falls back to parsing the `chat-query-rewrite` attribute. */ get chatQueryRewrite(): SearchSnippetProps['chatQueryRewrite'] | null; set chatQueryRewrite(value: SearchSnippetProps['chatQueryRewrite'] | null | undefined); /** * Override any user-facing string. Omitted keys fall back to English defaults. */ set translations(value: Translations | null | undefined); private syncTranslationsFromAttribute; /** * Replace the stored title of any still-default-titled session with the * current `newChatButton` translation, so the sidebar reflects the active * language after a translations change. */ private refreshDefaultSessionTitles; private rerenderAfterTranslationsChange; private getProps; private resolveChatQueryRewrite; private initializeClient; private render; private getPageStyles; private getBaseHTML; private attachEventListeners; private removeEventListeners; private setupView; private generateSessionId; private loadSessions; private saveSessions; private saveCurrentSession; private updateSessionTitle; private createNewChat; private switchToSession; private deleteSession; private clearCurrentChat; private toggleSidebar; private onChatListClick; private renderChatList; private renderChatListItem; private formatDate; private escapeHTML; private updateTheme; private cleanup; clearChat(): void; sendMessage(content: string): Promise; getMessages(): Message[]; getSessions(): ChatSession[]; getCurrentSession(): ChatSession | null; } declare interface ChatSession { id: string; title: string; messages: Message[]; createdAt: number; updatedAt: number; /** * True while the session still carries the default (auto-generated) title. * Set to false once auto-titled from the first user message, or explicitly * renamed. Absent on sessions persisted before this field existed; those * are treated as having a default title iff the title string still matches * the current `newChatButton` translation (legacy behavior). */ titleIsDefault?: boolean; } declare interface Message { id: string; role: 'user' | 'assistant' | 'system'; content: string; timestamp: number; metadata?: Record; } /** * Main component properties */ declare interface SearchSnippetProps { /** Required: AI Search API endpoint */ apiUrl: string; /** Input placeholder text */ placeholder?: string; /** Maximum search results to request from the API */ maxResults?: number; /** Maximum search results to render in the UI (caps the visible list and drives the "see more" affordance) */ maxRenderResults?: number; /** Input debounce delay in milliseconds (search-bar only) */ debounceMs?: number; /** Color scheme */ theme?: Theme; /** Hide the "Powered by Cloudflare AI Search" branding */ hideBranding?: boolean; /** Show URL in search results (default: false) */ showUrl?: boolean; /** Show date in search results when timestamp is present (default: false) */ showDate?: boolean; /** Hide thumbnails in search results (default: false) */ hideThumbnails?: boolean; /** URL template for "See more" link. The search query is appended URL-encoded. Example: "https://example.com/search?q=" */ seeMore?: string; /** * Group rendered results by this item metadata field (e.g. "group" or * "product"). Groups are ordered by the first result that appears in each, * and results within a group keep their relevance order. */ groupBy?: string; /** * Disable sending search / click / view-more analytics events to the * `/stats` endpoint. Defaults to `false` (analytics enabled). */ disableAnalytics?: boolean; /** * Override any user-facing string. Omitted keys fall back to English defaults. * * @example * ```ts * element.translations = { placeholder: 'Busca aquí...' }; * ``` */ translations?: Translations; /** * Customize AI Search query rewriting on subsequent chat turns. * * Query rewriting is automatically enabled from the second user message * onward (the first message has no history to rewrite from). Use this to * override the model, the rewrite prompt, or to disable the feature. * * @example * ```ts * element.chatQueryRewrite = { enabled: false }; * element.chatQueryRewrite = { model: 'openai/gpt-5-mini' }; * element.chatQueryRewrite = { rewritePrompt: 'Rewrite the latest user message...' }; * ``` */ chatQueryRewrite?: { /** Override the auto-enable behavior. Defaults to true on subsequent turns. */ enabled?: boolean; /** Override the rewriter model. Defaults to '@cf/meta/llama-3.3-70b-instruct-fp8-fast'. */ model?: string; /** Override the system prompt sent as `rewrite_prompt`. Defaults to a built-in prompt. */ rewritePrompt?: string; }; } declare type Theme = 'light' | 'dark' | 'auto'; /** * Translation utilities for component user-facing strings. * * Users override any subset of translations via the `translations` attribute * (JSON string) or property (plain object). Missing keys fall back to the * built-in English defaults. * * @example * ```html * * ``` * * @example * ```ts * element.translations = { placeholder: 'Busca aquí...' }; * ``` */ /** * All user-facing strings rendered by the snippet components. * * All keys are optional; unspecified keys fall back to English defaults. * Strings can contain `{name}` tokens that are interpolated at render time. */ declare interface Translations { /** Aria label for loading spinners. Default: "Loading" */ loadingAriaLabel?: string; /** Bold prefix for error messages. Default: "Error:" */ errorPrefix?: string; /** Message shown when the `api-url` attribute is missing. */ missingApiUrlError?: string; /** Branding prefix before the product link. Default: "Powered by" */ poweredBy?: string; /** Branding link label. Default: "Cloudflare AI Search" */ poweredByLinkLabel?: string; /** Search input placeholder text. */ placeholder?: string; /** Search submit button text and aria-label. */ searchButtonLabel?: string; /** Aria-label for the search input on the bar variant. */ searchInputAriaLabel?: string; /** Aria-label for the modal results list. */ searchResultsAriaLabel?: string; /** Title shown before a user enters a query (bar variant). */ emptyStateTitle?: string; /** Description shown before a user enters a query (bar variant). */ emptyStateDescription?: string; /** Description shown before a user enters a query (modal variant). */ modalEmptyStateDescription?: string; /** Title shown when a search returns no results (bar variant). */ noResultsTitle?: string; /** Description shown when a search returns no results (bar variant). Supports `{query}`. */ noResultsDescription?: string; /** Title shown when a search returns no results (modal variant). */ modalNoResultsTitle?: string; /** Description shown when a search returns no results (modal variant). Supports `{query}`. */ modalNoResultsDescription?: string; /** Bar results count when exactly 1 result. Supports `{n}`. */ resultsCount?: string; /** Bar results count when multiple results. Supports `{n}`. */ resultsCountPlural?: string; /** Bar/modal results count when truncated. Supports `{n}` and `{total}`. */ resultsCountOverflow?: string; /** Modal footer results count when exactly 1 result. Supports `{n}`. */ modalResultsCount?: string; /** Modal footer results count when multiple results. Supports `{n}`. */ modalResultsCountPlural?: string; /** Modal footer count shown with the zero-results state. */ modalResultsCountZero?: string; /** Modal footer text shown with the error state. */ modalResultsCountError?: string; /** Label for the "see more" link when `see-more` is configured. */ seeMoreResults?: string; /** Group header label for results missing the `group-by` metadata field. Default: "Other" */ groupOther?: string; /** Heading above favorite results in the initial modal. */ favoriteResults?: string; /** Heading above results recently opened from the modal. */ recentResults?: string; /** Accessible label for a result's favorite button. */ addFavorite?: string; /** Accessible label for a favorited result's remove button. */ removeFavorite?: string; /** Modal footer hint next to the ↑ ↓ keys. */ navigateHint?: string; /** Modal footer hint next to the ↵ key. */ selectHint?: string; /** Modal footer hint next to the Esc key. */ closeHint?: string; /** Chat header title. */ chatTitle?: string; /** Chat input placeholder text. */ chatPlaceholder?: string; /** Aria-label for the chat textarea. */ chatInputAriaLabel?: string; /** Chat send button text. */ sendButtonLabel?: string; /** Chat send button aria-label. */ sendButtonAriaLabel?: string; /** Empty chat state title. */ chatEmptyTitle?: string; /** Empty chat state description. */ chatEmptyDescription?: string; /** User message avatar text. Default: "U" */ userAvatar?: string; /** Assistant message avatar text. Default: "AI" */ assistantAvatar?: string; /** Fallback for chat errors with no message. */ unknownError?: string; /** Aria-label for the floating chat bubble button. */ openChatAriaLabel?: string; /** Aria-label for the clear-history icon button. */ clearHistoryAriaLabel?: string; /** Aria-label for the minimize icon button. */ minimizeAriaLabel?: string; /** Aria-label for the close icon button. */ closeAriaLabel?: string; /** Sidebar heading on the chat-page variant. */ historyTitle?: string; /** New-chat button label. */ newChatButton?: string; /** Clear-chat header button label. */ clearChatButton?: string; /** Tooltip for the sidebar toggle button. */ toggleSidebarTitle?: string; /** Tooltip for a per-session delete button. */ deleteChatTitle?: string; /** Empty sessions list message. */ noChatsYet?: string; /** Label for "one day ago" in the sessions list. */ yesterday?: string; /** Relative timestamp for < 1 minute ago. */ justNow?: string; /** Relative timestamp for exactly 1 minute ago. Supports `{n}`. */ minuteAgo?: string; /** Relative timestamp for 2-59 minutes ago. Supports `{n}`. */ minutesAgo?: string; /** Relative timestamp for exactly 1 hour ago. Supports `{n}`. */ hourAgo?: string; /** Relative timestamp for 2-23 hours ago. Supports `{n}`. */ hoursAgo?: string; /** Cycling loading messages shown during search/streaming. Provide the full array to override. */ loadingMessages?: string[]; } export { }