/** * Parser Module * * Parse WhatsApp, iMessage, Telegram, LINE, and Facebook Messenger exports into * structured messages. */ import type { ChatSource, MediaType, ParsedMessage, ParseResult, ParserOptions } from '../types'; export { parseIMessageChat, parseIMessageChatStream } from './imessage'; export { type IMessageJsonChat, type IMessageJsonChatEntry, type IMessageJsonChatMeta, type IMessageJsonManifest, type IMessageJsonMessage, isIMessageJsonChat, isIMessageJsonManifest, parseIMessageJsonBundle } from './imessage-json'; export { isLineExport, parseLineChat, parseLineChatStream } from './line'; export { isMessengerExport, parseMessengerExport } from './messenger'; export { isTelegramExport, parseTelegramExport } from './telegram'; export { detectFormat, parseWhatsAppChat, parseWhatsAppChatStream } from './whatsapp'; /** Maximum characters per message chunk */ export declare const MAX_CHUNK_LENGTH = 280; /** Minimum characters for a chunk to be worth splitting */ export declare const MIN_CHUNK_LENGTH = 32; /** Common fields for creating chunked messages */ interface ChunkableMessageData { readonly startId: number; readonly timestamp: Date; readonly sender: string; readonly rawLine: string; readonly source: ChatSource; readonly urls: readonly string[]; readonly hasMedia: boolean; readonly mediaType?: MediaType | undefined; } /** * Create ParsedMessage array from chunked content. * Shared logic used by both WhatsApp and iMessage parsers. */ export declare function createChunkedMessages(chunks: readonly string[], data: ChunkableMessageData): ParsedMessage[]; /** * Split a long message into chunks of ≤280 characters. * * Chunk format: * - Single chunk (≤280 chars): returns content as-is * - First chunk: "message start…" * - Middle chunks: "…middle content…" * - Last chunk: "…message end" * * Splits at word boundaries when possible to avoid cutting words mid-stream. * Won't split if the result would create a chunk smaller than MIN_CHUNK_LENGTH. */ export declare function chunkMessage(content: string, maxLen?: number, minLen?: number): string[]; /** * Normalize apostrophe variants to straight apostrophe (U+0027). * * WhatsApp and iMessage exports often use curly apostrophes which don't match * regex patterns that use straight apostrophes (e.g., "Let's" vs "Let's"). * * Handles: * - ' (U+2019) Right Single Quotation Mark (most common in iOS) * - ' (U+2018) Left Single Quotation Mark * - ʼ (U+02BC) Modifier Letter Apostrophe * - ` (U+0060) Grave Accent (backtick, sometimes used as apostrophe) */ export declare function normalizeApostrophes(text: string): string; /** * Extract all URLs from message content. */ export declare function extractUrls(content: string): string[]; /** * Detect the chat source from content. */ export declare function detectChatSource(content: string): ChatSource; /** * Parse a chat export (auto-detect format). */ export declare function parseChat(raw: string, options?: ParserOptions): ParsedMessage[]; /** * Parse a chat export and return detailed results. */ export declare function parseChatWithStats(raw: string, options?: ParserOptions): ParseResult; /** * Parse a chat export (streaming, auto-detect format). * Note: For streaming, caller must provide the source type since we can't peek ahead. */ export declare function parseChatStream(lines: AsyncIterable, source: ChatSource, options?: ParserOptions): AsyncIterable; //# sourceMappingURL=index.d.ts.map