"use strict";
const common_vendor = require("../../../../../common/vendor.js");
require("../../../../adapter-vue.js");
const TUIKit_components_TUIContact_utils_index = require("../../utils/index.js");
const TUIKit_utils_env = require("../../../../utils/env.js");
if (!Math) {
  Avatar();
}
const Avatar = () => "../../../common/Avatar/index.js";
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "index",
  props: {
    item: { default: () => ({}) },
    displayOnlineStatus: { type: Boolean, default: false }
  },
  setup(__props) {
    const props = __props;
    const userOnlineStatusMap = common_vendor.inject("userOnlineStatusMap");
    const isOnline = common_vendor.ref(false);
    const groupType = {
      [common_vendor.qt.TYPES.GRP_WORK]: "Work",
      [common_vendor.qt.TYPES.GRP_AVCHATROOM]: "AVChatRoom",
      [common_vendor.qt.TYPES.GRP_PUBLIC]: "Public",
      [common_vendor.qt.TYPES.GRP_MEETING]: "Meeting",
      [common_vendor.qt.TYPES.GRP_COMMUNITY]: "Community"
    };
    const otherContentForSow = common_vendor.computed(() => {
      var _a, _b, _c, _d, _e, _f, _g, _h, _i;
      let content = "";
      if (((_a = props.item) == null ? void 0 : _a.type) === ((_c = (_b = common_vendor.qt) == null ? void 0 : _b.TYPES) == null ? void 0 : _c.SNS_APPLICATION_SENT_TO_ME) || ((_d = props.item) == null ? void 0 : _d.type) === ((_f = (_e = common_vendor.qt) == null ? void 0 : _e.TYPES) == null ? void 0 : _f.SNS_APPLICATION_SENT_BY_ME)) {
        content = ((_g = props.item) == null ? void 0 : _g.wording) || "";
      } else if ((_h = props.item) == null ? void 0 : _h.groupID) {
        content = `ID:${(_i = props.item) == null ? void 0 : _i.groupID}`;
      }
      return content;
    });
    const groupTypeForShow = common_vendor.computed(() => {
      var _a, _b;
      let type = "";
      if ((_a = props.item) == null ? void 0 : _a.groupID) {
        type = groupType[(_b = props.item) == null ? void 0 : _b.type];
      }
      return type;
    });
    const showApplicationStatus = common_vendor.computed(() => {
      var _a, _b, _c, _d, _e, _f;
      if (((_a = props.item) == null ? void 0 : _a.type) === ((_c = (_b = common_vendor.qt) == null ? void 0 : _b.TYPES) == null ? void 0 : _c.SNS_APPLICATION_SENT_BY_ME)) {
        return {
          style: "text",
          label: "等待验证"
        };
      } else if (((_d = props.item) == null ? void 0 : _d.type) === ((_f = (_e = common_vendor.qt) == null ? void 0 : _e.TYPES) == null ? void 0 : _f.SNS_APPLICATION_SENT_TO_ME)) {
        return {
          style: "button",
          label: "同意",
          onClick: () => {
            var _a2;
            TUIKit_components_TUIContact_utils_index.acceptFriendApplication((_a2 = props.item) == null ? void 0 : _a2.userID);
          }
        };
      }
      return false;
    });
    common_vendor.watch(
      () => userOnlineStatusMap == null ? void 0 : userOnlineStatusMap.value,
      () => {
        isOnline.value = getOnlineStatus();
      },
      {
        immediate: true,
        deep: true
      }
    );
    function getOnlineStatus() {
      var _a, _b, _c;
      return !!(props.displayOnlineStatus && (userOnlineStatusMap == null ? void 0 : userOnlineStatusMap.value) && ((_a = props.item) == null ? void 0 : _a.userID) && ((_c = (_b = userOnlineStatusMap.value) == null ? void 0 : _b[props.item.userID]) == null ? void 0 : _c.statusType) === common_vendor.qt.TYPES.USER_STATUS_ONLINE);
    }
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.p({
          useSkeletonAnimation: true,
          url: common_vendor.unref(TUIKit_components_TUIContact_utils_index.generateAvatar)(props.item)
        }),
        b: props.displayOnlineStatus && props.item
      }, props.displayOnlineStatus && props.item ? {
        c: common_vendor.unref(isOnline) ? 1 : "",
        d: !common_vendor.unref(isOnline) ? 1 : ""
      } : {}, {
        e: common_vendor.t(common_vendor.unref(TUIKit_components_TUIContact_utils_index.generateName)(props.item)),
        f: common_vendor.unref(otherContentForSow)
      }, common_vendor.unref(otherContentForSow) ? {
        g: common_vendor.t(common_vendor.unref(otherContentForSow))
      } : {}, {
        h: common_vendor.unref(groupTypeForShow)
      }, common_vendor.unref(groupTypeForShow) ? {
        i: common_vendor.t(common_vendor.unref(groupTypeForShow))
      } : {}, {
        j: common_vendor.unref(showApplicationStatus)
      }, common_vendor.unref(showApplicationStatus) ? common_vendor.e({
        k: common_vendor.unref(showApplicationStatus).style === "text"
      }, common_vendor.unref(showApplicationStatus).style === "text" ? {
        l: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`TUIContact.${common_vendor.unref(showApplicationStatus).label}`))
      } : common_vendor.unref(showApplicationStatus).style === "button" ? {
        n: common_vendor.t(common_vendor.unref(common_vendor.Wt).t(`TUIContact.${common_vendor.unref(showApplicationStatus).label}`)),
        o: common_vendor.o$1(
          //@ts-ignore
          (...args) => common_vendor.unref(showApplicationStatus).onClick && common_vendor.unref(showApplicationStatus).onClick(...args)
        )
      } : {}, {
        m: common_vendor.unref(showApplicationStatus).style === "button"
      }) : {}, {
        p: common_vendor.n(!common_vendor.unref(TUIKit_utils_env.isPC) && "tui-contact-list-card-h5")
      });
    };
  }
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-cbb84739"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../../../../.sourcemap/mp-weixin/TUIKit/components/TUIContact/contact-list/contact-list-item/index.js.map
