/**
 * ldesign v0.4.2
 * (c) 2023 ldesign
 * @license MIT
 */

import { _ as _defineProperty } from '../_chunks/dep-eb20e23f.mjs';
import { isVNode, defineComponent, provide, createVNode } from 'vue';
import { useTNodeJSX } from '../hooks/tnode.mjs';
import { usePrefixClass } from '../hooks/useConfig.mjs';
import props from './avatar-group-props.mjs';
import _Avatar from './avatar.mjs';
import '../_chunks/dep-b4041200.mjs';
import '../_chunks/dep-6b22dd27.mjs';
import '../_chunks/dep-a0b4a044.mjs';
import '../_chunks/dep-c959a6fb.mjs';
import '../_chunks/dep-0f0c89ff.mjs';
import '../_chunks/dep-f6649a46.mjs';
import '../_chunks/dep-37ba476d.mjs';
import '../_chunks/dep-e3b14d70.mjs';
import '../_chunks/dep-66d6733b.mjs';
import '../_chunks/dep-be27d184.mjs';
import '../_chunks/dep-c31e1d9e.mjs';
import '../_chunks/dep-1fe0ad42.mjs';
import '../_chunks/dep-d54f2690.mjs';
import '../_chunks/dep-59c8420d.mjs';
import '../_chunks/dep-74848b92.mjs';
import '../_chunks/dep-c4e1a112.mjs';
import '../utils/render-tnode.mjs';
import '../_chunks/dep-bd03960e.mjs';
import '../_chunks/dep-44f056cd.mjs';
import '../_chunks/dep-a9c8a5d5.mjs';
import '../_chunks/dep-10085c61.mjs';
import '../_chunks/dep-1b058de3.mjs';
import '../_chunks/dep-39cc276d.mjs';
import '../_chunks/dep-8f777748.mjs';
import '../_chunks/dep-05fa17c9.mjs';
import '../_chunks/dep-92e7085e.mjs';
import '../_chunks/dep-1cf2b129.mjs';
import '../config-provider/useConfig.mjs';
import '../_chunks/dep-44417261.mjs';
import '../_chunks/dep-bf74f1c2.mjs';
import '../_chunks/dep-79821ff2.mjs';
import '../_chunks/dep-0bfbf721.mjs';
import '../_chunks/dep-ae357f26.mjs';
import '../_chunks/dep-352691c2.mjs';
import '../_chunks/dep-2cfd5b3a.mjs';
import '../_chunks/dep-c852a61a.mjs';
import '../_chunks/dep-23a0f453.mjs';
import '../_chunks/dep-99920870.mjs';
import '../_chunks/dep-c7e9ce16.mjs';
import '../_chunks/dep-3afa94cf.mjs';
import '../_chunks/dep-ba3c0b2e.mjs';
import '../_chunks/dep-ee57d235.mjs';
import '../_common/js/global-config/default-config.mjs';
import '../_common/js/global-config/locale/zh_CN.mjs';
import '../_chunks/dep-6b4aa943.mjs';
import '../_chunks/dep-d52291a9.mjs';
import '../config-provider/type.mjs';
import '../image/index.mjs';
import '../utils/withInstall.mjs';
import '../image/image.mjs';
import '../_chunks/dep-55846619.mjs';
import '../_chunks/dep-cfcedf47.mjs';
import '../_chunks/dep-b2af48ba.mjs';
import '../_chunks/dep-7acc11cb.mjs';
import '../_chunks/dep-774ac2d0.mjs';
import '@ldesign/icons-vue-next';
import '../_common/js/utils/observe.mjs';
import '../space/index.mjs';
import '../space/space.mjs';
import '../_chunks/dep-6eea369f.mjs';
import '../hooks/slot.mjs';
import '../space/props.mjs';
import '../space/style/css.mjs';
import '../space/type.mjs';
import '../image/props.mjs';
import '../image/style/css.mjs';
import '../image/type.mjs';
import './props.mjs';

function _isSlot(s) {
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
}
var _AvatarGroup = defineComponent({
  name: "TAvatarGroup",
  props: props,
  setup: function setup(props2) {
    provide("avatarGroup", props2);
    var renderTNodeJSX = useTNodeJSX();
    var AVATAR_NAME = usePrefixClass("avatar");
    var COMPONENT_NAME = usePrefixClass("avatar-group");
    var renderEllipsisAvatar = function renderEllipsisAvatar(children) {
      if ((children === null || children === void 0 ? void 0 : children.length) > props2.max) {
        var content = getEllipsisContent(children);
        var outAvatar = children.slice(0, props2.max);
        outAvatar.push(createVNode(_Avatar, {
          "class": "".concat(AVATAR_NAME.value, "__collapse"),
          "size": props2.size
        }, _isSlot(content) ? content : {
          "default": function _default() {
            return [content];
          }
        }));
        return [outAvatar];
      }
      return [children];
    };
    var getEllipsisContent = function getEllipsisContent(children) {
      return renderTNodeJSX("collapseAvatar") || "+".concat(children.length - props2.max);
    };
    return function () {
      var _ref;
      var children = renderTNodeJSX("default");
      var cascading = props2.cascading,
        max = props2.max;
      var groupClass = ["".concat(COMPONENT_NAME.value), (_ref = {}, _defineProperty(_ref, "".concat(AVATAR_NAME.value, "--offset-right"), cascading === "right-up"), _defineProperty(_ref, "".concat(AVATAR_NAME.value, "--offset-left"), cascading === "left-up"), _ref)];
      var content = max && max >= 0 ? [renderEllipsisAvatar(children)] : [children];
      return createVNode("div", {
        "class": groupClass
      }, [content]);
    };
  }
});

export { _AvatarGroup as default };
//# sourceMappingURL=group.mjs.map
