import { d as IflytekClientConfig, e as IflytekClientEvents, f as IflytekPhase, A as AudioRecorder } from '../types-C4bbgHHW.js';
export { a as IflytekAudioFrame, j as IflytekErrorPayload, h as IflytekReadyPayload, i as IflytekResultPayload, I as IflytekServerConfig, b as IflytekStartPayload, c as IflytekStopPayload, g as IflytekTransport } from '../types-C4bbgHHW.js';

/**
 * 讯飞语音转文字 — 客户端核心类
 *
 * 纯逻辑、无 UI 依赖。管理：
 *   本地 PCM 录音 → 通过 transport（Socket.IO）传输到服务端适配层 → 接收转写结果
 *
 * 状态机：idle → connecting → recording → stopping → idle
 */

declare class IflytekSTT {
    private transport;
    private recorder;
    private sampleRate;
    private language;
    private domain;
    private accent;
    private readyTimeout;
    private stopWaitTimeout;
    private debug;
    private events;
    private session;
    private bound;
    private lastPressTime;
    private handleReady;
    private handleResult;
    private handleError;
    constructor(config: IflytekClientConfig);
    /** 注册事件回调 */
    on(events: IflytekClientEvents): this;
    /** 当前阶段 */
    get phase(): IflytekPhase;
    /** 当前会话 ID */
    get sessionId(): string | null;
    /** 是否正在录音（connecting / recording / stopping） */
    get isActive(): boolean;
    /**
     * 开始录音。
     * 对应 onPressIn / 按钮按下。
     * 返回 true 表示成功启动，false 表示被忽略（去抖 / 已有活跃会话）。
     */
    start(): boolean;
    /**
     * 停止录音。
     * 对应 onPressOut / 按钮松开。
     */
    stop(): void;
    /** 强制终止当前会话（页面卸载 / 引擎切换时调用） */
    abort(): void;
    /** 完全释放资源，解除 transport 监听 */
    dispose(): void;
    private _onReady;
    private _onResult;
    private _onError;
    private _onAudioData;
    private sendFinal;
    private destroy;
    private setPhase;
    private bindTransport;
    private unbindTransport;
    private log;
}

/**
 * 基于 Web Audio API 的 AudioRecorder 实现
 *
 * 适用于浏览器环境（Next.js 客户端 / Electron 渲染进程）。
 * 输出与 React Native PCM 库一致的 base64 编码 16-bit PCM 数据。
 *
 * @example
 * ```ts
 * import { IflytekSTT, WebAudioRecorder } from "sa2kit/iflytek";
 *
 * const recorder = new WebAudioRecorder();
 * const stt = new IflytekSTT({ transport: socket, recorder });
 * ```
 */

declare class WebAudioRecorder implements AudioRecorder {
    private stream;
    private audioCtx;
    private sourceNode;
    private workletNode;
    private processorNode;
    private callback;
    private sampleRate;
    private bufferSize;
    private running;
    init(options: {
        sampleRate: number;
        channels: number;
        bitsPerSample: number;
        audioSource: number;
        bufferSize: number;
    }): void;
    on(event: "data", callback: (base64Chunk: string) => void): {
        remove: () => void;
    };
    start(): void;
    stop(): void;
    private startAsync;
    private cleanup;
    private float32ToBase64PCM16;
    private closestPow2;
}

export { AudioRecorder, IflytekClientConfig, IflytekClientEvents, IflytekPhase, IflytekSTT, WebAudioRecorder };
