import { defineComponent, useAttrs, computed, resolveComponent, createBlock, openBlock, mergeProps, unref, createSlots, withCtx, renderSlot, createCommentVNode, createTextVNode, toDisplayString, createVNode } from 'vue';
import '../../../utils/index.mjs';
import { AVATAR_IMG, avatarProps } from './avatar.mjs';
import { createNamespace } from '../../../utils/create-namespace.mjs';

"use strict";
var _sfc_main = /* @__PURE__ */ defineComponent({
  ...{ name: "LlAvatar" },
  __name: "avatar",
  props: avatarProps,
  setup(__props) {
    const attrs = useAttrs();
    const props = __props;
    const bem = createNamespace("avatar");
    const getSrc = computed(() => props.src || props.defaultSrc || AVATAR_IMG);
    return (_ctx, _cache) => {
      const _component_ll_icon = resolveComponent("ll-icon");
      const _component_a_avatar = resolveComponent("a-avatar");
      return openBlock(), createBlock(_component_a_avatar, mergeProps(unref(attrs), {
        class: [unref(bem).b(), props.isTransform ? unref(bem).is("transform") : ""],
        src: _ctx.avatarType === "src" ? getSrc.value : ""
      }), createSlots({
        default: withCtx(() => [
          _ctx.avatarType === "text" ? renderSlot(_ctx.$slots, "default", { key: 0 }, () => [
            createTextVNode(
              toDisplayString(_ctx.text),
              1
              /* TEXT */
            )
          ]) : createCommentVNode("v-if", true)
        ]),
        _: 2
        /* DYNAMIC */
      }, [
        _ctx.avatarType === "icon" ? {
          name: "icon",
          fn: withCtx(() => [
            createVNode(_component_ll_icon, {
              "icon-name": _ctx.icon,
              color: _ctx.iconColor || `var(--default-icon)`
            }, null, 8, ["icon-name", "color"])
          ]),
          key: "0"
        } : void 0
      ]), 1040, ["class", "src"]);
    };
  }
});

export { _sfc_main as default };
//# sourceMappingURL=avatar.vue2.mjs.map
