import { jsx } from 'react/jsx-runtime';
import React__default from 'react';
import { cn } from '../../../utils/cn.js';
import { useTimelineContext } from './Timeline.js';
import { useTimelineItemContext } from './TimelineItem.js';

const TimelineContent = React__default.forwardRef(({ children, className, ...props }, ref) => {
    const { theme, layout, align } = useTimelineContext();
    const { isLast, index } = useTimelineItemContext();
    const isHorizontal = layout === "horizontal";
    // For alternate layout, determine text alignment
    const isAlternateRight = align === "alternate" && index % 2 !== 0;
    return (jsx("div", { ref: ref, className: cn(isHorizontal ? theme.contentStyleHorizontal : theme.contentStyle, 
        // Remove bottom padding on last item
        !isHorizontal && isLast && "pb-0", 
        // Align text based on side in alternate mode
        !isHorizontal && isAlternateRight && "text-right", !isHorizontal && align === "right" && "text-right", className), ...props, children: children }));
});
TimelineContent.displayName = "TimelineContent";

export { TimelineContent };
