"use strict";
const common_vendor = require("../../../../../common/vendor.js");
require("../../../../adapter-vue.js");
const common_assets = require("../../../../../common/assets.js");
const TUIKit_components_TUIChat_utils_utils = require("../../utils/utils.js");
const TUIKit_utils_env = require("../../../../utils/env.js");
if (!Math) {
  (RadioSelect + Avatar + Icon + ReadStatus + MessageTranslate + MessageConvert + MessageQuote)();
}
const Icon = () => "../../../common/Icon.js";
const ReadStatus = () => "./read-status/index.js";
const MessageQuote = () => "./message-quote/index.js";
const Avatar = () => "../../../common/Avatar/index.js";
const MessageTranslate = () => "./message-translate/index.js";
const MessageConvert = () => "./message-convert/index.js";
const RadioSelect = () => "../../../common/RadioSelect/index.js";
const riskImageReplaceUrl = "https://web.sdk.qcloud.com/component/TUIKit/assets/has_risk_default.png";
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "message-bubble",
  props: {
    messageItem: { default: () => ({}) },
    content: { default: () => ({}) },
    classNameList: { default: () => [] },
    blinkMessageIDList: { default: () => [] },
    isMultipleSelectMode: { type: Boolean, default: false },
    isAudioPlayed: { type: Boolean, default: false },
    multipleSelectedMessageIDList: { default: () => [] }
  },
  emits: ["resendMessage", "blinkMessage", "setReadReceiptPanelVisible", "changeSelectMessageIDList", "scrollTo"],
  setup(__props, { emit: __emit }) {
    const emits = __emit;
    const props = __props;
    const TYPES = common_vendor.qt.TYPES;
    const needLoadingIconMessageType = [
      TYPES.MSG_LOCATION,
      TYPES.MSG_TEXT,
      TYPES.MSG_CUSTOM,
      TYPES.MSG_MERGER,
      TYPES.MSG_FACE
    ];
    const { blinkMessageIDList, messageItem: message } = common_vendor.toRefs(props);
    const isMultipleSelected = common_vendor.computed(() => {
      return props.multipleSelectedMessageIDList.includes(message.value.ID);
    });
    const isDisplayUnplayMark = common_vendor.computed(() => {
      return message.value.flow === "in" && message.value.status === "success" && message.value.type === TYPES.MSG_AUDIO && !props.isAudioPlayed;
    });
    const containerClassNameList = common_vendor.computed(() => {
      return [
        "message-bubble",
        isMultipleSelected.value ? "multiple-selected" : "",
        ...props.classNameList
      ];
    });
    const isNoPadding = common_vendor.computed(() => {
      return [TYPES.MSG_IMAGE, TYPES.MSG_VIDEO, TYPES.MSG_MERGER].includes(message.value.type);
    });
    const riskContentText = common_vendor.computed(() => {
      let content = common_vendor.Wt.t("TUIChat.涉及敏感内容") + ", ";
      if (message.value.flow === "out") {
        content += common_vendor.Wt.t("TUIChat.发送失败");
      } else {
        content += common_vendor.Wt.t(
          message.value.type === TYPES.MSG_AUDIO ? "TUIChat.无法收听" : "TUIChat.无法查看"
        );
      }
      return content;
    });
    const isBlink = common_vendor.computed(() => {
      var _a, _b;
      if ((_a = message.value) == null ? void 0 : _a.ID) {
        return (_b = blinkMessageIDList == null ? void 0 : blinkMessageIDList.value) == null ? void 0 : _b.includes(message.value.ID);
      }
      return false;
    });
    function toggleMultipleSelect(isSelected) {
      emits("changeSelectMessageIDList", {
        type: isSelected ? "add" : "remove",
        messageID: message.value.ID
      });
    }
    function resendMessage() {
      var _a;
      if (!((_a = message.value) == null ? void 0 : _a.hasRiskContent)) {
        emits("resendMessage");
      }
    }
    function blinkMessage(messageID) {
      emits("blinkMessage", messageID);
    }
    function scrollTo(scrollHeight) {
      emits("scrollTo", scrollHeight);
    }
    function openReadUserPanel() {
      emits("setReadReceiptPanelVisible", true, message.value);
    }
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: props.isMultipleSelectMode
      }, props.isMultipleSelectMode ? {
        b: common_vendor.o$1(toggleMultipleSelect),
        c: common_vendor.p({
          isSelected: common_vendor.unref(isMultipleSelected)
        })
      } : {}, {
        d: common_vendor.p({
          useSkeletonAnimation: true,
          url: common_vendor.unref(message).avatar || ""
        }),
        e: common_vendor.unref(message).flow === "in" && common_vendor.unref(message).conversationType === "GROUP"
      }, common_vendor.unref(message).flow === "in" && common_vendor.unref(message).conversationType === "GROUP" ? {
        f: common_vendor.t(props.content.showName)
      } : {}, {
        g: (common_vendor.unref(message).type === common_vendor.unref(TYPES).MSG_IMAGE || common_vendor.unref(message).type === common_vendor.unref(TYPES).MSG_VIDEO) && common_vendor.unref(message).hasRiskContent
      }, (common_vendor.unref(message).type === common_vendor.unref(TYPES).MSG_IMAGE || common_vendor.unref(message).type === common_vendor.unref(TYPES).MSG_VIDEO) && common_vendor.unref(message).hasRiskContent ? {
        h: common_vendor.n(!common_vendor.unref(TUIKit_utils_env.isPC) && "message-risk-replace-h5"),
        i: riskImageReplaceUrl
      } : {}, {
        j: common_vendor.unref(message).hasRiskContent
      }, common_vendor.unref(message).hasRiskContent ? {
        k: common_vendor.t(common_vendor.unref(riskContentText))
      } : {}, {
        l: common_vendor.n(common_vendor.unref(message).flow === "out" ? "content-out" : "content-in"),
        m: common_vendor.n(common_vendor.unref(message).hasRiskContent && "content-has-risk"),
        n: common_vendor.n(common_vendor.unref(isNoPadding) ? "content-no-padding" : ""),
        o: common_vendor.n(common_vendor.unref(isNoPadding) && common_vendor.unref(isBlink) ? "blink-shadow" : ""),
        p: common_vendor.n(!common_vendor.unref(isNoPadding) && common_vendor.unref(isBlink) ? "blink-content" : ""),
        q: common_vendor.unref(isDisplayUnplayMark)
      }, common_vendor.unref(isDisplayUnplayMark) ? {} : {}, {
        r: common_vendor.unref(message).status === "fail" || common_vendor.unref(message).hasRiskContent
      }, common_vendor.unref(message).status === "fail" || common_vendor.unref(message).hasRiskContent ? {
        s: common_vendor.o$1(($event) => resendMessage())
      } : {}, {
        t: common_vendor.unref(message).status === "unSend" && needLoadingIconMessageType.includes(common_vendor.unref(message).type)
      }, common_vendor.unref(message).status === "unSend" && needLoadingIconMessageType.includes(common_vendor.unref(message).type) ? {
        v: common_vendor.p({
          file: common_vendor.unref(common_assets.loadingIcon),
          width: "15px",
          height: "15px"
        })
      } : {}, {
        w: common_vendor.o$1(openReadUserPanel),
        x: common_vendor.p({
          message: common_vendor.unref(TUIKit_components_TUIChat_utils_utils.shallowCopyMessage)(common_vendor.unref(message))
        }),
        y: common_vendor.n(common_vendor.unref(message).flow === "out" && "message-body-main-reverse"),
        z: common_vendor.o$1(() => {
        }),
        A: common_vendor.n(common_vendor.unref(message).flow === "in" ? "" : "reverse"),
        B: common_vendor.n(common_vendor.unref(message).flow === "out" ? "reverse" : "flex-row"),
        C: common_vendor.p({
          message: common_vendor.unref(message)
        }),
        D: common_vendor.n(common_vendor.unref(message).flow === "out" ? "reverse" : "flex-row"),
        E: common_vendor.p({
          message: common_vendor.unref(message)
        }),
        F: common_vendor.n(common_vendor.unref(message).flow === "out" ? "reverse" : "flex-row"),
        G: common_vendor.o$1(blinkMessage),
        H: common_vendor.o$1(scrollTo),
        I: common_vendor.p({
          message: common_vendor.unref(message)
        }),
        J: common_vendor.unref(message).flow === "out" ? 1 : "",
        K: common_vendor.n(common_vendor.unref(containerClassNameList))
      });
    };
  }
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-51fb22b7"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../../../../.sourcemap/mp-weixin/TUIKit/components/TUIChat/message-list/message-elements/message-bubble.js.map
