"use strict";
const common_vendor = require("../../../../../../common/vendor.js");
require("../../../../../adapter-vue.js");
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "message-abstract-file",
  props: {
    contentText: { default: () => [] },
    messageContent: { default: () => ({}) },
    displayType: { default: "bubble" }
  },
  setup(__props) {
    const props = __props;
    const contentText = common_vendor.ref(props.contentText);
    const typeIcon = common_vendor.computed(() => {
      var _a;
      const fileUrl = (_a = props == null ? void 0 : props.messageContent) == null ? void 0 : _a.url;
      const index = fileUrl == null ? void 0 : fileUrl.lastIndexOf(".");
      const type = fileUrl == null ? void 0 : fileUrl.substring(index + 1);
      return handleFileIconForShow(type);
    });
    const fileSize = common_vendor.computed(() => {
      var _a;
      return (_a = props == null ? void 0 : props.messageContent) == null ? void 0 : _a.size;
    });
    const handleFileIconForShow = (type) => {
      const urlBase = "https://web.sdk.qcloud.com/component/TUIKit/assets/file-";
      const fileTypes = [
        "image",
        "pdf",
        "text",
        "ppt",
        "presentation",
        "sheet",
        "zip",
        "word",
        "video",
        "unknown"
      ];
      let url = "";
      let iconType = "";
      fileTypes == null ? void 0 : fileTypes.forEach((typeName) => {
        if (type == null ? void 0 : type.includes(typeName)) {
          url = urlBase + typeName + ".svg";
          iconType = typeName;
        }
      });
      return {
        iconSrc: url ? url : urlBase + "unknown.svg",
        iconType: iconType ? iconType : "unknown"
      };
    };
    return (_ctx, _cache) => {
      return {
        a: common_vendor.unref(typeIcon).iconSrc,
        b: common_vendor.f(common_vendor.unref(contentText), (contentItem, index, i0) => {
          return {
            a: common_vendor.t(contentItem.text),
            b: index,
            c: common_vendor.n(contentItem && contentItem.isHighlight ? "highlight" : "normal")
          };
        }),
        c: common_vendor.t(common_vendor.unref(fileSize)),
        d: common_vendor.n(`message-abstract-file-${_ctx.displayType}`)
      };
    };
  }
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-e3774db0"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../../../../../.sourcemap/mp-weixin/TUIKit/components/TUISearch/search-result/search-result-item/message-abstract/message-abstract-file.js.map
