"use strict";
const common_vendor = require("../../../../../../common/vendor.js");
require("../../../../../adapter-vue.js");
if (!Math) {
  ConvertContent();
}
const ConvertContent = () => "./convert-content.js";
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "index",
  props: {
    message: { default: () => ({}) }
  },
  setup(__props) {
    const props = __props;
    const convertVisible = common_vendor.ref(false);
    const hasConvertError = common_vendor.ref(false);
    const convertWrapperRef = common_vendor.ref();
    let isSingleConvert = true;
    common_vendor.onMounted(() => {
      common_vendor.Jt.watch(common_vendor.o.CHAT, {
        voiceToTextInfo: onMessageConvertUpdated
      });
    });
    common_vendor.onUnmounted(() => {
      common_vendor.Jt.unwatch(common_vendor.o.CHAT, {
        voiceToTextInfo: onMessageConvertUpdated
      });
    });
    function toggleErrorStatus(hasError) {
      hasConvertError.value = hasError;
    }
    function onMessageConvertUpdated(info) {
      if (info === void 0)
        return;
      isSingleConvert = false;
      const convertInfoList = info.get(props.message.conversationID) || [];
      for (let i = 0; i < convertInfoList.length; ++i) {
        const { messageID, visible } = convertInfoList[i];
        if (messageID === props.message.ID && visible !== void 0) {
          if (convertInfoList.length === 1 && visible) {
            isSingleConvert = true;
          }
          hasConvertError.value = false;
          convertVisible.value = visible;
          break;
        }
      }
    }
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.unref(convertVisible)
      }, common_vendor.unref(convertVisible) ? {
        b: common_vendor.o$1(toggleErrorStatus),
        c: common_vendor.p({
          message: props.message,
          contentVisible: common_vendor.unref(convertVisible),
          isSingleConvert: common_vendor.unref(isSingleConvert),
          convertWrapperRef: common_vendor.unref(convertWrapperRef)
        }),
        d: props.message.flow === "out" ? 1 : "",
        e: common_vendor.unref(hasConvertError) ? 1 : ""
      } : {});
    };
  }
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-5d339368"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../../../../../.sourcemap/mp-weixin/TUIKit/components/TUIChat/message-list/message-elements/message-convert/index.js.map
