"use strict";
const common_vendor = require("../../../../../common/vendor.js");
require("../../../../adapter-vue.js");
const TUIKit_utils_typeCheck = require("../../../../utils/type-check.js");
const TUIKit_constant = require("../../../../constant.js");
const common_assets = require("../../../../../common/assets.js");
if (!Math) {
  Icon();
}
const Icon = () => "../../../common/Icon.js";
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "message-custom",
  props: {
    messageItem: { default: void 0 },
    content: { default: void 0 }
  },
  setup(__props) {
    common_vendor.ref("123");
    const props = __props;
    const custom = common_vendor.ref();
    const message = common_vendor.ref();
    const extension = common_vendor.ref();
    const customData = common_vendor.ref({
      businessID: ""
    });
    common_vendor.watchEffect(() => {
      custom.value = props.content;
      message.value = props.messageItem;
      const { payload } = props.messageItem;
      customData.value = payload.data || "";
      customData.value = TUIKit_utils_typeCheck.JSONToObject(payload.data);
      if (payload.data === TUIKit_constant.CHAT_MSG_CUSTOM_TYPE.SERVICE) {
        extension.value = TUIKit_utils_typeCheck.JSONToObject(payload.extension);
      }
    });
    const openLink = (url) => {
      window.open(url);
    };
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.unref(customData).businessID === common_vendor.unref(TUIKit_constant.CHAT_MSG_CUSTOM_TYPE).SERVICE
      }, common_vendor.unref(customData).businessID === common_vendor.unref(TUIKit_constant.CHAT_MSG_CUSTOM_TYPE).SERVICE ? common_vendor.e({
        b: common_vendor.t(common_vendor.unref(extension).title),
        c: common_vendor.unref(extension).hyperlinks_text
      }, common_vendor.unref(extension).hyperlinks_text ? {
        d: common_vendor.t(common_vendor.unref(extension).hyperlinks_text.key),
        e: common_vendor.unref(extension).hyperlinks_text.value
      } : {}, {
        f: common_vendor.unref(extension).item && common_vendor.unref(extension).item.length > 0
      }, common_vendor.unref(extension).item && common_vendor.unref(extension).item.length > 0 ? {
        g: common_vendor.f(common_vendor.unref(extension).item, (item, index, i0) => {
          return common_vendor.e({
            a: common_vendor.unref(TUIKit_utils_typeCheck.isUrl)(item.value)
          }, common_vendor.unref(TUIKit_utils_typeCheck.isUrl)(item.value) ? {
            b: common_vendor.t(item.key),
            c: item.value
          } : {
            d: common_vendor.t(item.key)
          }, {
            e: index
          });
        })
      } : {}, {
        h: common_vendor.t(common_vendor.unref(extension).description)
      }) : common_vendor.unref(customData).businessID === common_vendor.unref(TUIKit_constant.CHAT_MSG_CUSTOM_TYPE).EVALUATE ? {
        j: common_vendor.t(common_vendor.unref(common_vendor.Wt).t("message.custom.对本次服务评价")),
        k: common_vendor.f(Math.max(common_vendor.unref(customData).score, 0), (item, index, i0) => {
          return {
            a: "abd5dfdc-0-" + i0,
            b: index
          };
        }),
        l: common_vendor.p({
          file: common_vendor.unref(common_assets.star)
        }),
        m: common_vendor.t(common_vendor.unref(customData).comment)
      } : common_vendor.unref(customData).businessID === common_vendor.unref(TUIKit_constant.CHAT_MSG_CUSTOM_TYPE).ORDER ? {
        o: common_vendor.unref(customData).imageUrl,
        p: common_vendor.t(common_vendor.unref(customData).title),
        q: common_vendor.t(common_vendor.unref(customData).description),
        r: common_vendor.t(common_vendor.unref(customData).price),
        s: common_vendor.o$1(($event) => openLink(common_vendor.unref(customData).link))
      } : common_vendor.unref(customData).businessID === common_vendor.unref(TUIKit_constant.CHAT_MSG_CUSTOM_TYPE).LINK ? {
        v: common_vendor.t(common_vendor.unref(customData).text),
        w: common_vendor.t(common_vendor.unref(common_vendor.Wt).t("message.custom.查看详情>>")),
        x: common_vendor.unref(customData).link
      } : common_vendor.unref(customData).businessID === common_vendor.unref(TUIKit_constant.CHAT_MSG_CUSTOM_TYPE).PK ? {
        z: common_vendor.t(common_vendor.unref(customData).title),
        A: common_vendor.t(common_vendor.unref(customData).buttonText1),
        B: common_vendor.t(common_vendor.unref(customData).buttonText2)
      } : {
        C: _ctx.content.custom
      }, {
        i: common_vendor.unref(customData).businessID === common_vendor.unref(TUIKit_constant.CHAT_MSG_CUSTOM_TYPE).EVALUATE,
        n: common_vendor.unref(customData).businessID === common_vendor.unref(TUIKit_constant.CHAT_MSG_CUSTOM_TYPE).ORDER,
        t: common_vendor.unref(customData).businessID === common_vendor.unref(TUIKit_constant.CHAT_MSG_CUSTOM_TYPE).LINK,
        y: common_vendor.unref(customData).businessID === common_vendor.unref(TUIKit_constant.CHAT_MSG_CUSTOM_TYPE).PK
      });
    };
  }
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-abd5dfdc"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../../../../.sourcemap/mp-weixin/TUIKit/components/TUIChat/message-list/message-elements/message-custom.js.map
