import { a as __rest, _ as __assign } from '../tslib.es6-faad35dc.js';
import { jsx } from 'react/jsx-runtime';
import { forwardRef } from 'react';
import { styled } from '@mui/material/styles';
import MuiInput from '@mui/material/Input';
import colors from '../theme/colors.js';
import { borderRadius } from '../theme/borders.js';
import { lineHeight } from '../theme/typography.js';
import EndAdornment from './EndAdornment.js';
import '@mui/material/Box';
import '@mui/material/InputAdornment';
import './Icon.js';
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 './Button.js';
import '../clsx.m-6243b874.js';
import '@mui/material/Button';

var getFontSize = function (_a) {
    var size = _a.size, theme = _a.theme;
    switch (size) {
        case "xs":
            return theme.typography.fontSizeXs2;
        case "sm":
            return theme.typography.fontSizeXs1;
        case "md":
            return theme.typography.fontSizeS;
        case "lg":
            return theme.typography.fontSizeM;
    }
};
var getPadding = function (_a) {
    var size = _a.size, theme = _a.theme, append = _a.$append;
    switch (size) {
        case "xs":
            return theme.spacing(1.25, append ? 0.35 : 2, 1.25, 2);
        case "sm":
            return theme.spacing(1.5, append ? 0.5 : 2, 1.5, 2);
        case "md":
            return theme.spacing(2, append ? 0.5 : 3, 2, 3);
        case "lg":
            return theme.spacing(2, append ? 0.5 : 3, 2, 3);
    }
};
var formCommonStyles = {
    borderRadius: borderRadius.sm,
    caretColor: colors.blue.main,
    lineHeight: lineHeight.xs1,
    backgroundColor: colors.gray.white,
    "&.MuiInputBase-colorSecondary": {
        backgroundColor: colors.gray[100]
    },
    "& input": {
        height: "auto"
    },
    "&.Mui-focused": {
        boxShadow: "0 0 0 3px " + colors.primary.main
    },
    "&.Mui-error": {
        boxShadow: "0 0 0 3px " + colors.negative.main
    },
    "&.Mui-disabled": {
        backgroundColor: colors.gray[300]
    }
};
var StyledInput = styled(MuiInput)(function (_a) {
    var theme = _a.theme, props = __rest(_a, ["theme"]);
    var size = props.size, $append = props.$append;
    return __assign(__assign({}, formCommonStyles), { padding: getPadding({ size: size, theme: theme, $append: $append }), fontSize: getFontSize({ size: size, theme: theme }) });
});
var Input = forwardRef(function (props, ref) {
    var _a = props.color, color = _a === void 0 ? "primary" : _a, _b = props.size, size = _b === void 0 ? "md" : _b, endAdornment = props.endAdornment, error = props.error, _c = props.overrideErrorAdornment, overrideErrorAdornment = _c === void 0 ? false : _c, actionButtonProps = props.actionButtonProps, rest = __rest(props
    // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
    , ["color", "size", "endAdornment", "error", "overrideErrorAdornment", "actionButtonProps"]);
    // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
    var append = Boolean(error || endAdornment || actionButtonProps);
    return (jsx(StyledInput, __assign({ inputRef: ref, color: color, size: size, "$append": append, className: "Input-size-" + size, endAdornment: jsx(EndAdornment, { size: size, error: error && !overrideErrorAdornment, endAdornment: overrideErrorAdornment ? endAdornment : undefined, actionButtonProps: actionButtonProps }, void 0) }, rest), void 0));
});

export { Input as default, formCommonStyles, getFontSize, getPadding };
