// Prefix used to identify card messages
export const CARD_MESSAGE_PREFIX = '__CARD__';
// Helper to encode card data into a message
export function encodeCardMessage(data) {
    return `${CARD_MESSAGE_PREFIX}${JSON.stringify(data)}`;
}
// Helper to decode card data from a message
export function decodeCardMessage(content) {
    if (!content?.startsWith(CARD_MESSAGE_PREFIX)) {
        return null;
    }
    try {
        const json = content.slice(CARD_MESSAGE_PREFIX.length);
        return JSON.parse(json);
    } catch  {
        return null;
    }
}
// Check if a message is a card message
export function isCardMessage(content) {
    return content?.startsWith(CARD_MESSAGE_PREFIX) ?? false;
}
