import { extractAppMessageType, extractXmlValue, normalizeAppMessageContent, extractXmlAttribute } from './xmlExtractor' import { formatForwardChatRecordContent } from './forwardRecordParser' import { parseVoipMessage } from './voipParser' import { getTransferPrefix } from './transferParser' import { formatEmojiSemanticText } from './fileAppParser' export function stripSenderPrefix(content: string): string { return content.replace(/^[\s]*([a-zA-Z0-9_-]+):(?!\/\/)/, '') } export function parseDurationSeconds(value: string): number | null { const numeric = Number(value) if (!Number.isFinite(numeric) || numeric <= 0) return null if (numeric >= 1000) return Math.round(numeric / 1000) return Math.round(numeric) } export function cleanSystemMessage(content: string): string { if (!content) return '[系统消息]' const sysmsgTextMatch = /]*>([\s\S]*?)<\/sysmsg>/i.exec(content) if (sysmsgTextMatch) { content = sysmsgTextMatch[1] } const revokeMatch = /<\/replacemsg>/i.exec(content) if (revokeMatch) { return revokeMatch[1].trim() } const patMatch = /