import { defineComponent, ref, openBlock, createElementBlock, createElementVNode, toDisplayString, Fragment, renderList, unref, createBlock, withCtx, createVNode, createCommentVNode } from "vue";
import "../../../../../adapter-vue.mjs";
import { TUITranslateService } from "@tencentcloud/chat-uikit-engine";
import Overlay from "../../../../common/Overlay/index.vue.mjs";
import Drawer from "../../../../common/Drawer/index.vue.mjs";
import SimpleMessageList from "../simple-message-list/index.vue.mjs";
import { isPC, isH5, isUniFrameWork } from "../../../../../utils/env.mjs";
import { transformTextWithKeysToEmojiNames } from "../../../emoji-config/index.mjs";
const _hoisted_1 = { class: "record-title" };
const _hoisted_2 = { class: "record-abstract-container" };
const _hoisted_3 = { class: "record-footer" };
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "index",
  props: {
    renderData: {},
    disabled: { type: Boolean, default: false },
    messageItem: { default: () => ({}) }
  },
  emits: ["assignMessageIDInUniapp"],
  setup(__props, { emit: __emit }) {
    const emits = __emit;
    const props = __props;
    const isMessageListVisible = ref(false);
    function openMergeDetail() {
      if (props.disabled) {
        return;
      }
      if (!isUniFrameWork) {
        isMessageListVisible.value = true;
      } else {
        emits("assignMessageIDInUniapp", props.messageItem.ID);
      }
    }
    function closeMergeDetail() {
      isMessageListVisible.value = false;
    }
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", null, [
        createElementVNode("div", {
          class: "message-record-container",
          onClick: openMergeDetail
        }, [
          createElementVNode("div", _hoisted_1, toDisplayString(props.renderData.title), 1),
          createElementVNode("div", _hoisted_2, [
            (openBlock(true), createElementBlock(Fragment, null, renderList(props.renderData.abstractList.slice(0, 7), (item, index) => {
              return openBlock(), createElementBlock("div", {
                key: index,
                class: "record-abstract-item"
              }, toDisplayString(unref(transformTextWithKeysToEmojiNames)(item)), 1);
            }), 128))
          ]),
          createElementVNode("div", _hoisted_3, toDisplayString(unref(TUITranslateService).t("TUIChat.聊天记录")), 1)
        ]),
        !props.disabled && unref(isPC) ? (openBlock(), createBlock(Overlay, {
          key: 0,
          visible: unref(isMessageListVisible),
          onOnOverlayClick: _cache[0] || (_cache[0] = ($event) => isMessageListVisible.value = false)
        }, {
          default: withCtx(() => [
            createVNode(SimpleMessageList, {
              isMounted: unref(isMessageListVisible),
              renderData: props.renderData,
              messageID: props.messageItem.ID,
              onCloseOverlay: closeMergeDetail
            }, null, 8, ["isMounted", "renderData", "messageID"])
          ]),
          _: 1
        }, 8, ["visible"])) : !props.disabled && unref(isH5) && !unref(isUniFrameWork) ? (openBlock(), createBlock(Drawer, {
          key: 1,
          visible: unref(isMessageListVisible),
          isFullScreen: true,
          overlayColor: "transparent",
          popDirection: "right"
        }, {
          default: withCtx(() => [
            createVNode(SimpleMessageList, {
              isMounted: unref(isMessageListVisible),
              renderData: props.renderData,
              messageID: props.messageItem.ID,
              onCloseOverlay: closeMergeDetail
            }, null, 8, ["isMounted", "renderData", "messageID"])
          ]),
          _: 1
        }, 8, ["visible"])) : createCommentVNode("", true)
      ]);
    };
  }
});
export {
  _sfc_main as default
};
