import { defineComponent as v, useSlots as h, h as s, createVNode as e, createTextVNode as y } from "vue";
import { Space as g, Tooltip as m } from "@aplus-frontend/antdv";
import { IconApAdFillWarn as k } from "@aplus-frontend/icon";
import "../../config-provider/index.mjs";
import { ApCopy as i } from "../ap-copy/index.mjs";
import { ApImage as w } from "../ap-image/index.mjs";
import { ApProductInfoProps as b } from "./constans.mjs";
import x from "./style/index.mjs";
import { useNamespace as A } from "../../config-provider/hooks/use-namespace.mjs";
const W = /* @__PURE__ */ v({
  name: "ApProductInfo",
  props: b(),
  setup(t) {
    const {
      b: n,
      e: o,
      m: r
    } = A("ap-product-info"), c = x("ap-product-info"), p = h(), u = (l) => typeof l.value == "function" ? l.value() : l.helpMessage ? s(g.Compact, {}, [s(i, {
      text: l.value,
      link: l.link,
      textStyle: l.link ? "link" : "minor"
    }), s(m, {
      placement: "top",
      color: l.toolTipBgColor,
      title: typeof l.helpMessage == "string" ? l.helpMessage : s(l.helpMessage)
    }, () => s(k, {
      color: "#FFA940",
      style: {
        cursor: "pointer"
      }
    }))]) : s(i, {
      text: l.value,
      textStyle: l.link ? "link" : "minor",
      link: l.link,
      disableCopy: t.disableCopy
    }, l.value);
    return () => e("div", {
      class: [n(), c.value]
    }, [t.showImg && e("div", {
      class: o("img")
    }, [e(w, {
      src: t.imgSrc,
      width: 44,
      height: 44,
      preview: t.preview
    }, null)]), e("div", {
      class: [o("content")]
    }, [e("div", {
      class: o("wrap-title")
    }, [e("div", {
      class: o("title")
    }, [e(i, {
      disableCopy: t.disableCopy
    }, {
      default: () => [t.title]
    })]), e("div", {
      class: o("title-suffix")
    }, [p["title-suffix"]?.()])]), e("div", {
      class: o("row-container")
    }, [t.values.map((l, d) => {
      const a = l.col === 2, f = l.col !== 2 && d % 2 === 0;
      return e("div", {
        key: JSON.stringify(l),
        class: [o("row-item"), r(a ? "full" : "half")]
      }, [e("div", {
        class: [o("item")]
      }, [l.label && e("div", {
        class: o("label")
      }, [l.label, e("span", null, [y(":")])]), e("div", {
        class: [o("value"), !a && r("overflow")],
        title: typeof l.value != "function" ? String(l.value || "") : ""
      }, [u(l)])]), f && e("div", {
        class: o("divider"),
        style: {
          right: 0
        }
      }, [e("div", {
        class: o("divider-vertical")
      }, null)])]);
    })])])]);
  }
});
export {
  W as default
};
