import { IWebchatConfiguration, IWebchatState } from "./types/webchat"; import Base from "./client/base"; import Websocket from "isomorphic-ws"; type Unsubscribe = () => void; interface WebchatEventMap { open: undefined; closed: undefined; error: unknown; text: string; message: any; update: any; unknown: any; } interface IWebchatPublic { state: IWebchatState; start: (config: IWebchatConfiguration) => Promise; stop: () => void; on(event: K, handler: (data: WebchatEventMap[K]) => void): Unsubscribe; on(event: string, handler: (data: any) => void): Unsubscribe; off(event: K, handler: (data: WebchatEventMap[K]) => void): void; off(event: string, handler: (data: any) => void): void; } declare class Webchat extends Base implements IWebchatPublic { state: IWebchatState; private connectionUrl; private websocket; private wsSettings; private lastActivityAt; private keepAliveInterval; private audioContext; private micStream; private sourceNode; private micNode; private sinkGain; private playbackLead; private nextPlaybackTime; private pendingSources; private downstreamSampleRate; private listeners; constructor(options: any); private params; start(config: IWebchatConfiguration): Promise; private create; stop(): void; private keepAlive; private setActivity; private initAudioWorklet; private teardownAudio; private float32ToPCM16; private pcm16ToFloat32; private playPcm; on(event: K, handler: (data: WebchatEventMap[K]) => void): Unsubscribe; on(event: string, handler: (data: any) => void): Unsubscribe; off(event: K, handler: (data: WebchatEventMap[K]) => void): void; off(event: string, handler: (data: any) => void): void; private emit; } export type { IWebchatPublic, WebchatEventMap }; export default Webchat;