import { jsx } from 'react/jsx-runtime';
import React__default from 'react';
import { cn } from '../../../utils/cn.js';
import { formatTimestamp } from '../../../utils/dateUtils.js';
import { useMessageContext } from './MessageContext.js';
import { messageTheme } from './Message.theme.js';

const MessageTimestamp = React__default.forwardRef(({ timestamp, className, ...props }, ref) => {
    const { variant } = useMessageContext();
    // Get variant-specific theme
    const variantTheme = messageTheme.variants[variant];
    // Build timestamp style using theme structure
    const timestampStyle = cn(messageTheme.timestampStyle, variantTheme.timestampModifier, className);
    return (jsx("div", { ref: ref, className: timestampStyle, ...props, children: jsx("time", { dateTime: typeof timestamp === 'string' ? timestamp : timestamp.toISOString(), className: "select-none", children: formatTimestamp(timestamp) }) }));
});
MessageTimestamp.displayName = 'Message.Timestamp';

export { MessageTimestamp };
