/*! * Jodit Editor PRO (https://xdsoft.net/jodit/) * See LICENSE.md in the project root for license information. * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net/jodit/pro/ */ import type { IViewBased } from "jodit/esm/types/index"; import type { VoiceEngineFactory } from "./voice-engine"; /** * Resolved voice settings the mic button needs (built by the input area from the * flat `voiceInput*` options). * * @module plugins/ai-assistant-pro/voice */ export interface IVoiceInputConfig { url?: string; apiKey?: string; defaultModel?: string; language?: string; silenceTimeoutMs?: number; autoSendSilenceMs?: number | null; /** Custom recognition engine; when set it replaces the built-in proxy engine. */ api?: VoiceEngineFactory; } /** * Read/write access to the prompt the dictated text goes into. */ export interface IVoiceInputIO { /** Raw current value (not trimmed). */ getValue(): string; /** Replace the value and optionally place the caret at `caret`. */ setValue(value: string, caret?: number): void; /** Current selection range within the value. */ getSelection(): { start: number; end: number; }; focus(): void; /** Send the current prompt (no-op if empty or a request is in flight). */ send(): void; } /** * The microphone button for the assistant input area. Toggles a * `VoiceTranscriber` session and writes interim/final transcripts into the prompt * (interim text is previewed; final phrases are appended). */ export declare class VoiceInputButton { private readonly jodit; private readonly config; private readonly io; private readonly button; private engine; /** Whether a recognition session is active. */ private listening; /** Whether a phrase is in progress (between its first interim and its final). */ private phraseActive; /** Prompt text before the caret, captured at the start of the current phrase. */ private before; /** Prompt text after the caret (or selection), captured at phrase start. */ private after; /** Pending hands-free auto-send timer id (0 = none). */ private autoSendTimer; constructor(jodit: IViewBased, config: IVoiceInputConfig, io: IVoiceInputIO); private onPromptSent; get container(): HTMLElement; setParentView(view: IViewBased): void; private toggle; private start; private reset; /** * Schedule a hands-free auto-send after `autoSendSilenceMs` of no new speech. * No-op when the option is unset/null. */ private scheduleAutoSend; private clearAutoSend; private setActive; /** * Insert the current phrase at the caret. The text around the caret (or * selection) is captured once at the start of each phrase from the live input, * so dictation lands where the cursor is, replaces any selection, and respects * manual edits / sends between phrases. Subsequent interims of the same phrase * replace its preview rather than accumulating. */ private insertPhrase; destruct(): void; }