import { _ as __assign } from '../tslib.es6-faad35dc.js';
import { k as keyframes, c as css, a as jsx } from '../emotion-react.esm-620e240d.js';
import { useMemo } from 'react';
import { styled } from '@mui/material/styles';
import MuiBox from '@mui/material/Box';
import { c as clsx } from '../clsx.m-6243b874.js';
import Icon from './Icon.js';
import Typography from './Typography.js';
import 'react/jsx-runtime';
import '../icons/ArrowLeft.js';
import '../icons/ArrowRight.js';
import '../icons/CloseCircle.js';
import '../icons/InfoCircle.js';
import '../icons/ErrorCircle.js';
import '../icons/Attention.js';
import '../icons/HelpCircle.js';
import '../icons/Document.js';
import '../icons/DocumentText.js';
import '../icons/Lock.js';
import '../icons/Delete.js';
import '../icons/Users.js';
import '../icons/Stakefish.js';
import '../icons/Sound.js';
import '../icons/Beacon.js';
import '../icons/TriangleRight.js';
import '../icons/TriangleLeft.js';
import '../icons/TriangleUp.js';
import '../icons/TriangleDown.js';
import '../icons/Sent.js';
import '../icons/Download.js';
import '../icons/Faster.js';
import '../icons/Slower.js';
import '../icons/Usb.js';
import '../icons/Key.js';
import '../icons/Edit.js';
import '../icons/Expand.js';
import '../icons/Collapse.js';
import '../icons/Success.js';
import '../icons/SuccessCircle.js';
import '../icons/Fail.js';
import '../icons/Desktop.js';
import '../icons/Mobile.js';
import '../icons/Loading.js';
import '../icons/Upload.js';
import '../icons/Check.js';
import '../icons/ChevronLeft.js';
import '../icons/ChevronRight.js';
import '../icons/Plus.js';
import '../icons/Minus.js';
import '../icons/Globe.js';
import '../icons/Link.js';
import '../icons/Copy.js';
import '../icons/Medium.js';
import '../icons/Twitter.js';
import '../icons/Telegram.js';
import '../icons/Eth.js';
import '../icons/Sort.js';
import '../icons/Close.js';
import '../icons/DollarSign.js';
import '../icons/Search.js';
import '../icons/Range.js';
import '../icons/Instagram.js';
import '../icons/LinkedIn.js';
import '../icons/Reddit.js';
import '../icons/YouTube.js';
import '../icons/Chrome.js';
import '../icons/CloudConnect.js';
import '../icons/Update.js';
import '../icons/Menu.js';
import '../icons/Settings.js';
import '../_commonjsHelpers-1789f0cf.js';
import '@mui/material/Typography';
import '../theme/typography.js';

var PREFIX = "StepIcon";
var classes = {
    root: "" + PREFIX,
    active: PREFIX + "-active",
    completed: PREFIX + "-completed",
    loading: PREFIX + "-loading"
};
var Root = styled("div")(function (_a) {
    var _b;
    var theme = _a.theme;
    return (_b = {
            display: "flex",
            justifyContent: "center",
            alignItems: "center",
            width: theme.spacing(5),
            height: theme.spacing(5),
            borderRadius: theme.borders.radius.rounded,
            border: "5px solid " + theme.palette.gray.white,
            boxSizing: "content-box",
            backgroundColor: theme.palette.gray[100]
        },
        _b["&." + classes.active + ", &." + classes.completed] = {
            backgroundColor: theme.palette.primary.main
        },
        _b);
});
var LoadingIconBox = styled(MuiBox)({
    display: "flex",
    alignItems: "center"
});
var rotateEffect = keyframes({
    "0%": {
        transform: "rotate(0deg)"
    },
    "100%": {
        transform: "rotate(360deg)"
    }
});
var animatedIcon = css({
    "& .icon": {
        willChange: "transform",
        transformOrigin: "center",
        animation: rotateEffect + " 1.5s linear infinite"
    }
});
var getElementState = function (props) {
    var error = props.error, completed = props.completed, loading = props.loading;
    if (!completed) {
        return loading ? "loading" : "active";
    }
    return error ? "error" : "success";
};
var StepIcon = function (_a) {
    var active = _a.active, error = _a.error, completed = _a.completed, loading = _a.loading, icon = _a.icon;
    var className = clsx([
        classes.root,
        active && classes.active,
        completed && classes.completed,
        loading && classes.loading
    ]);
    var renderers = useMemo(function () { return ({
        active: jsx(Typography, __assign({ variant: "title4" }, { children: icon }), void 0),
        loading: (jsx(LoadingIconBox, __assign({ css: animatedIcon }, { children: jsx(Icon, { iconKey: "loading", size: "sm" }, void 0) }), void 0)),
        error: jsx(Icon, { iconKey: "fail", size: "sm" }, void 0),
        success: jsx(Icon, { iconKey: "check", size: "xs1" }, void 0)
    }); }, []);
    return jsx(Root, __assign({ className: className }, { children: renderers[getElementState({ active: active, error: error, completed: completed, loading: loading })] }), void 0);
};

export { StepIcon as default };
