import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { GlobalStyles, IconButton } from '@mui/material';
import { composeSx } from '../../../../../utils/components';
import { AIIcon } from '../../shared/AIIcon';
import { AI_PROPERTIES } from '../../shared/constants';
import { StopIcon } from '../../shared/StopIcon';
import { useAIVariantSx } from '../../shared/useAIVariantSx';
export const AIIconButton = ({ variant = 'primary', size = 'large', icon = 'sparkles', loading = false, onStop, onClick, sx, ...rest }) => (_jsxs(_Fragment, { children: [_jsx(GlobalStyles, { styles: AI_PROPERTIES }), _jsxs(IconButton, { variant: variant, size: size, onClick: loading ? onStop : onClick, "aria-busy": loading || undefined, sx: useAIVariantSx(variant, composeSx({ width: 'fit-content', flexShrink: 0 }, sx)), ...rest, children: [loading && _jsx(StopIcon, {}), !loading && _jsx(AIIcon, { name: icon })] })] }));
