'use client'; import { useEffect, useRef } from 'react'; import { normaliseFinal } from '../core/transcript'; import type { UseSpeechRecognitionConfig, UseSpeechRecognitionReturn } from '../types'; import { useSpeechRecognition } from './useSpeechRecognition'; export interface UseDictationConfig extends Omit { /** Controlled value the dictation is appending to. */ value: string; /** Called with the next value after each final segment lands. */ onChange: (next: string) => void; /** Joiner between the previous value and the new segment. Default ' '. */ separator?: string; } export interface UseDictationReturn extends UseSpeechRecognitionReturn { /** Convenience — same as `toggle`, named for dictation UIs. */ toggleDictation: () => Promise; } /** * Convenience adapter that pipes final transcript segments straight into * a controlled string (`