import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useTheme, useThemeControls } from '../../../theme';
import { SplitButton } from '../../core/SplitButton';
import { ClockCounterClockwiseIcon, GearSixIcon, MoonIcon, SunIcon, PlusIcon } from '@phosphor-icons/react';
export const ChatHeader = ({ onNewSession, onToggleSettings, isSettingsOpen, onToggleSessions, isSessionsOpen }) => {
    const theme = useTheme();
    const { themeName, toggleTheme, canToggle } = useThemeControls();
    const ThemeToggleIcon = themeName === 'dark' ? SunIcon : MoonIcon;
    const themeToggleLabel = themeName === 'dark' ? 'Switch to light mode' : 'Switch to dark mode';
    return (_jsxs("div", { className: theme.chatHeader.container, children: [_jsx("div", { className: 'flex min-w-0 flex-1 items-center gap-2', children: onToggleSessions ? (_jsx(SplitButton, { onPrimaryClick: onNewSession, onSecondaryClick: onToggleSessions, primaryIcon: (_jsx("svg", { className: 'h-3 w-3', fill: 'none', stroke: 'currentColor', viewBox: '0 0 24 24', children: _jsx("path", { strokeLinecap: 'round', strokeLinejoin: 'round', strokeWidth: 2, d: 'M12 4v16m8-8H4' }) })), primaryLabel: 'New Chat', primaryTitle: 'Start a new chat session', primaryAriaLabel: 'Start a new chat session', secondaryIcon: _jsx(ClockCounterClockwiseIcon, { size: 18 }), secondaryTitle: isSessionsOpen ? 'Hide session history' : 'Show session history', secondaryAriaLabel: isSessionsOpen ? 'Hide session history' : 'Show session history', secondaryAriaControls: 'chat-session-history', secondaryPressed: Boolean(isSessionsOpen), secondaryClassName: 'px-2.5' })) : (_jsxs("button", { onClick: onNewSession, className: theme.chatHeader.secondaryButton, title: 'Start a new chat session', children: [_jsx(PlusIcon, { size: 18, "aria-hidden": 'true' }), "New Chat"] })) }), _jsxs("div", { className: 'flex items-center gap-2', children: [_jsx("button", { type: 'button', onClick: onToggleSettings, className: theme.chatHeader.secondaryButton, "aria-pressed": isSettingsOpen, "aria-controls": 'playground-settings-panel', "aria-label": isSettingsOpen ? 'Hide settings' : 'Show settings', title: isSettingsOpen ? 'Hide settings' : 'Settings', children: _jsx(GearSixIcon, { size: 18, weight: 'regular', "aria-hidden": 'true' }) }), _jsx("button", { type: 'button', onClick: toggleTheme, className: theme.chatHeader.secondaryButton, title: themeToggleLabel, "aria-label": themeToggleLabel, "aria-pressed": themeName === 'dark', disabled: !canToggle, children: _jsx(ThemeToggleIcon, { size: 18, weight: 'regular', "aria-hidden": 'true' }) })] })] }));
};
export default ChatHeader;
