import { __assign, __rest } from "tslib";
import React, { useContext } from 'react';
import classNames from 'classnames';
import { ConfigContext } from '../config-provider/config-context';
import { getPrefixCls } from '../_utils/general';
var AvatarGroup = function (props) {
    var _a = props.gap, gap = _a === void 0 ? -15 : _a, className = props.className, style = props.style, children = props.children, customisedCls = props.prefixCls, otherProps = __rest(props, ["gap", "className", "style", "children", "prefixCls"]);
    var configContext = useContext(ConfigContext);
    var prefixCls = getPrefixCls('avatar-group', configContext.prefixCls, customisedCls);
    var cls = classNames(prefixCls, className);
    return (React.createElement("span", __assign({}, otherProps, { className: cls, style: style }), React.Children.map(children, function (child, idx) {
        var childElement = child;
        if (childElement.type.displayName === 'Avatar') {
            var childProps = {
                style: __assign(__assign({}, childElement.props.style), { marginLeft: idx === 0 ? 0 : gap }),
            };
            return React.cloneElement(childElement, childProps);
        }
        return child;
    })));
};
AvatarGroup.displayName = 'AvatarGroup';
export default AvatarGroup;
//# sourceMappingURL=avatar-group.js.map