"use strict";
const common_vendor = require("../../../../../common/vendor.js");
require("../../../../adapter-vue.js");
const TUIKit_components_TUISearch_utils = require("../../utils.js");
const TUIKit_components_TUISearch_type = require("../../type.js");
const TUIKit_utils_env = require("../../../../utils/env.js");
if (!Math) {
  (MessageAbstractText + MessageAbstractFile + MessageAbstractCustom + MessageAbstractImage + MessageAbstractVideo)();
}
const MessageAbstractText = () => "./message-abstract/message-abstract-text.js";
const MessageAbstractFile = () => "./message-abstract/message-abstract-file.js";
const MessageAbstractCustom = () => "./message-abstract/message-abstract-custom.js";
const MessageAbstractImage = () => "./message-abstract/message-abstract-image.js";
const MessageAbstractVideo = () => "./message-abstract/message-abstract-video.js";
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "index",
  props: {
    listItem: { default: () => ({}) },
    listItemContent: { default: () => ({}) },
    type: { default: "allMessage" },
    displayType: { default: "info" },
    keywordList: { default: () => [] }
  },
  emits: ["showResultDetail", "navigateToChatPosition"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emits = __emit;
    const TYPES = common_vendor.ref(common_vendor.qt.TYPES);
    const avatarForShow = common_vendor.ref("");
    const nameForShow = common_vendor.ref("");
    const contentForShow = common_vendor.ref([]);
    const timeForShow = common_vendor.ref("");
    const isHovering = common_vendor.ref(false);
    common_vendor.watchEffect(() => {
      var _a, _b;
      avatarForShow.value = TUIKit_components_TUISearch_utils.generateSearchResultAvatar(props.listItem);
      nameForShow.value = TUIKit_components_TUISearch_utils.generateSearchResultShowName(props.listItem, props == null ? void 0 : props.listItemContent);
      contentForShow.value = TUIKit_components_TUISearch_utils.generateSearchResultShowContent(
        props.listItem,
        props.type,
        props.keywordList,
        (props == null ? void 0 : props.displayType) === "info"
      );
      timeForShow.value = ((_a = props.listItem) == null ? void 0 : _a.time) ? TUIKit_components_TUISearch_utils.generateSearchResultTime(((_b = props.listItem) == null ? void 0 : _b.time) * 1e3) : "";
    });
    const onResultItemClicked = () => {
      var _a;
      if (props.type === "contact" || props.type === "group") {
        TUIKit_components_TUISearch_utils.enterConversation(props.listItem);
      } else {
        if (props.displayType === "info" && !((_a = props.listItem) == null ? void 0 : _a.ID)) {
          emits("showResultDetail", true, props.type, props.listItem);
        } else {
          navigateToChatPosition();
        }
      }
    };
    const setHoverStatus = (status) => {
      isHovering.value = status;
    };
    const navigateToChatPosition = () => {
      emits("navigateToChatPosition", props.listItem);
    };
    const getMessageAbstractType = (message) => {
      return (message == null ? void 0 : message.type) ? common_vendor.Wt.t(`TUISearch.${TUIKit_components_TUISearch_type.messageTypeAbstractMap[message.type]}`) : common_vendor.Wt.t(`TUISearch.[合并消息]`);
    };
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: _ctx.displayType === "info" || _ctx.displayType === "bubble"
      }, _ctx.displayType === "info" || _ctx.displayType === "bubble" ? common_vendor.e({
        b: common_vendor.n(_ctx.displayType + "-left-avatar"),
        c: common_vendor.unref(avatarForShow) || "",
        d: common_vendor.n(_ctx.displayType + "-left"),
        e: common_vendor.t(common_vendor.unref(nameForShow)),
        f: common_vendor.n(_ctx.displayType + "-main-name"),
        g: _ctx.displayType === "info" || _ctx.listItem.type === common_vendor.unref(TYPES).MSG_TEXT
      }, _ctx.displayType === "info" || _ctx.listItem.type === common_vendor.unref(TYPES).MSG_TEXT ? {
        h: common_vendor.p({
          content: common_vendor.unref(contentForShow),
          highlightType: _ctx.displayType === "info" ? "font" : "background",
          displayType: _ctx.displayType
        })
      } : _ctx.listItem.type === common_vendor.unref(TYPES).MSG_FILE ? {
        j: common_vendor.p({
          contentText: common_vendor.unref(contentForShow),
          messageContent: _ctx.listItemContent,
          displayType: _ctx.displayType
        })
      } : _ctx.listItem.type === common_vendor.unref(TYPES).MSG_IMAGE ? {} : _ctx.listItem.type === common_vendor.unref(TYPES).MSG_VIDEO ? {} : _ctx.listItem.type === common_vendor.unref(TYPES).MSG_CUSTOM ? {
        n: common_vendor.p({
          contentText: common_vendor.unref(contentForShow),
          message: _ctx.listItem,
          messageContent: _ctx.listItemContent
        })
      } : {
        o: common_vendor.t(getMessageAbstractType(_ctx.listItem))
      }, {
        i: _ctx.listItem.type === common_vendor.unref(TYPES).MSG_FILE,
        k: _ctx.listItem.type === common_vendor.unref(TYPES).MSG_IMAGE,
        l: _ctx.listItem.type === common_vendor.unref(TYPES).MSG_VIDEO,
        m: _ctx.listItem.type === common_vendor.unref(TYPES).MSG_CUSTOM,
        p: common_vendor.n(_ctx.displayType + "-main-content"),
        q: common_vendor.n(_ctx.displayType + "-main"),
        r: common_vendor.t(common_vendor.unref(timeForShow)),
        s: common_vendor.n(_ctx.displayType + "-right-time"),
        t: _ctx.displayType === "bubble" && common_vendor.unref(isHovering)
      }, _ctx.displayType === "bubble" && common_vendor.unref(isHovering) ? {
        v: common_vendor.t(common_vendor.unref(common_vendor.Wt).t("TUISearch.定位到聊天位置")),
        w: common_vendor.n(_ctx.displayType + "-right-to"),
        x: common_vendor.o$1(navigateToChatPosition)
      } : {}, {
        y: common_vendor.n(_ctx.displayType + "-right"),
        z: common_vendor.n(_ctx.displayType)
      }) : _ctx.displayType === "file" ? common_vendor.e({
        B: common_vendor.n(_ctx.displayType + "-header-avatar"),
        C: common_vendor.unref(avatarForShow),
        D: common_vendor.t(common_vendor.unref(nameForShow)),
        E: common_vendor.n(_ctx.displayType + "-header-name"),
        F: common_vendor.unref(isHovering)
      }, common_vendor.unref(isHovering) ? {
        G: common_vendor.t(common_vendor.unref(common_vendor.Wt).t("TUISearch.定位到聊天位置")),
        H: common_vendor.n(_ctx.displayType + "-header-to"),
        I: common_vendor.o$1(navigateToChatPosition)
      } : {}, {
        J: common_vendor.t(common_vendor.unref(timeForShow)),
        K: common_vendor.n(_ctx.displayType + "-header-time"),
        L: common_vendor.n(_ctx.displayType + "-header"),
        M: common_vendor.p({
          contentText: common_vendor.unref(contentForShow),
          messageContent: _ctx.listItemContent,
          displayType: "bubble"
        }),
        N: common_vendor.n(_ctx.displayType + "-main-content"),
        O: common_vendor.n(_ctx.displayType)
      }) : _ctx.displayType === "image" ? common_vendor.e({
        Q: _ctx.listItem.type === common_vendor.unref(TYPES).MSG_IMAGE
      }, _ctx.listItem.type === common_vendor.unref(TYPES).MSG_IMAGE ? {
        R: common_vendor.p({
          messageContent: _ctx.listItemContent
        })
      } : _ctx.listItem.type === common_vendor.unref(TYPES).MSG_VIDEO ? {
        T: common_vendor.p({
          messageContent: _ctx.listItemContent
        })
      } : {}, {
        S: _ctx.listItem.type === common_vendor.unref(TYPES).MSG_VIDEO,
        U: common_vendor.unref(isHovering)
      }, common_vendor.unref(isHovering) ? {
        V: common_vendor.t(common_vendor.unref(common_vendor.Wt).t("TUISearch.定位到聊天位置"))
      } : {}, {
        W: common_vendor.o$1(navigateToChatPosition),
        X: common_vendor.n(_ctx.displayType)
      }) : {}, {
        A: _ctx.displayType === "file",
        P: _ctx.displayType === "image",
        Y: common_vendor.n(!common_vendor.unref(TUIKit_utils_env.isPC) && "search-result-list-item-h5"),
        Z: common_vendor.n("search-result-list-item-" + _ctx.displayType),
        aa: common_vendor.n(common_vendor.unref(isHovering) && "hover-" + _ctx.displayType),
        ab: common_vendor.o$1(onResultItemClicked),
        ac: common_vendor.o$1(($event) => setHoverStatus(true)),
        ad: common_vendor.o$1(($event) => setHoverStatus(false))
      });
    };
  }
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-64f261e1"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../../../../.sourcemap/mp-weixin/TUIKit/components/TUISearch/search-result/search-result-item/index.js.map
