import { defineComponent, computed, ref, openBlock, createElementBlock, createElementVNode } from "vue";
import defaultAvatar from "../../assets/imgs/avatar.png.mjs";
const _hoisted_1 = { class: "avatar-container" };
const _hoisted_2 = ["src"];
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "Avatar",
  props: {
    imgSrc: {}
  },
  setup(__props) {
    const props = __props;
    const src = computed(() => {
      if (isError.value) {
        return defaultAvatar;
      }
      return props.imgSrc || defaultAvatar;
    });
    const isError = ref(false);
    function handleError() {
      isError.value = true;
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", _hoisted_1, [
        createElementVNode("img", {
          class: "avatar",
          src: src.value,
          onerror: handleError
        }, null, 8, _hoisted_2)
      ]);
    };
  }
});
export {
  _sfc_main as default
};
