"use strict";
const common_vendor = require("../../../../common/vendor.js");
const uni_modules_uviewPro_libs_index = require("../../libs/index.js");
require("../../libs/util/logger.js");
require("../../libs/config/theme-tokens.js");
const uni_modules_uviewPro_components_uIcon_types = require("./types.js");
const __default__ = {
  name: "u-icon",
  options: {
    addGlobalClass: true,
    virtualHost: true,
    styleIsolation: "shared"
  }
};
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  ...__default__,
  props: uni_modules_uviewPro_components_uIcon_types.IconProps,
  emits: ["click", "touchstart"],
  setup(__props, { emit: __emit }) {
    const emit = __emit;
    const props = __props;
    const iconClass = common_vendor.computed(() => {
      let classes = [];
      classes.push(props.customPrefix + "-" + props.name);
      if (props.customPrefix === "uicon") {
        classes.push("u-iconfont");
      } else {
        classes.push(props.customPrefix);
      }
      if (props.showDecimalIcon && props.inactiveColor && uni_modules_uviewPro_libs_index.$u.config.type.includes(props.inactiveColor)) {
        classes.push("u-icon__icon--" + props.inactiveColor);
      } else if (props.color && uni_modules_uviewPro_libs_index.$u.config.type.includes(props.color)) {
        classes.push("u-icon__icon--" + props.color);
      }
      return classes;
    });
    const iconStyle = common_vendor.computed(() => {
      const style = {
        fontSize: props.size === "inherit" ? "inherit" : uni_modules_uviewPro_libs_index.$u.addUnit(props.size),
        fontWeight: props.bold ? "bold" : "normal",
        // 某些特殊情况需要设置一个到顶部的距离，才能更好的垂直居中
        top: uni_modules_uviewPro_libs_index.$u.addUnit(props.top)
      };
      if (props.showDecimalIcon && props.inactiveColor && !uni_modules_uviewPro_libs_index.$u.config.type.includes(props.inactiveColor)) {
        style.color = props.inactiveColor;
      } else if (props.color && !uni_modules_uviewPro_libs_index.$u.config.type.includes(props.color)) {
        style.color = props.color;
      }
      return style;
    });
    const isImg = common_vendor.computed(() => {
      return props.name.indexOf("/") !== -1;
    });
    const imgStyle = common_vendor.computed(() => {
      const style = {
        width: props.width ? uni_modules_uviewPro_libs_index.$u.addUnit(props.width) : uni_modules_uviewPro_libs_index.$u.addUnit(props.size),
        height: props.height ? uni_modules_uviewPro_libs_index.$u.addUnit(props.height) : uni_modules_uviewPro_libs_index.$u.addUnit(props.size)
      };
      return style;
    });
    const decimalIconStyle = common_vendor.computed(() => {
      const style = {
        fontSize: props.size === "inherit" ? "inherit" : uni_modules_uviewPro_libs_index.$u.addUnit(props.size),
        fontWeight: props.bold ? "bold" : "normal",
        // 某些特殊情况需要设置一个到顶部的距离，才能更好的垂直居中
        top: uni_modules_uviewPro_libs_index.$u.addUnit(props.top),
        width: props.percent + "%"
      };
      if (props.color && !uni_modules_uviewPro_libs_index.$u.config.type.includes(props.color)) {
        style.color = props.color;
      }
      return style;
    });
    const decimalIconClass = common_vendor.computed(() => {
      let classes = [];
      classes.push(props.customPrefix + "-" + props.name);
      if (props.customPrefix === "uicon") {
        classes.push("u-iconfont");
      } else {
        classes.push(props.customPrefix);
      }
      if (props.color && uni_modules_uviewPro_libs_index.$u.config.type.includes(props.color)) {
        classes.push("u-icon__icon--" + props.color);
      } else {
        classes.push("u-icon__icon--primary");
      }
      return classes;
    });
    const labelStyle = common_vendor.computed(() => {
      return {
        color: props.labelColor,
        fontSize: uni_modules_uviewPro_libs_index.$u.addUnit(props.labelSize),
        marginLeft: props.labelPos === "right" ? uni_modules_uviewPro_libs_index.$u.addUnit(props.space || props.marginLeft) : 0,
        marginTop: props.labelPos === "bottom" ? uni_modules_uviewPro_libs_index.$u.addUnit(props.space || props.marginTop) : 0,
        marginRight: props.labelPos === "left" ? uni_modules_uviewPro_libs_index.$u.addUnit(props.space || props.marginRight) : 0,
        marginBottom: props.labelPos === "top" ? uni_modules_uviewPro_libs_index.$u.addUnit(props.space || props.marginBottom) : 0
      };
    });
    function onClick(event) {
      emit("click", props.index || event);
    }
    function onTouchstart(event) {
      emit("touchstart", props.index || event);
    }
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: isImg.value
      }, isImg.value ? {
        b: props.name,
        c: _ctx.imgMode,
        d: common_vendor.s(imgStyle.value)
      } : common_vendor.e({
        e: _ctx.showDecimalIcon
      }, _ctx.showDecimalIcon ? {
        f: common_vendor.s(common_vendor.unref(uni_modules_uviewPro_libs_index.$u).toStyle(decimalIconStyle.value)),
        g: common_vendor.n(decimalIconClass.value),
        h: _ctx.hoverClass
      } : {}, {
        i: common_vendor.n(iconClass.value),
        j: common_vendor.s(common_vendor.unref(uni_modules_uviewPro_libs_index.$u).toStyle(iconStyle.value)),
        k: _ctx.hoverClass,
        l: common_vendor.o(onTouchstart, "b7")
      }), {
        m: _ctx.label !== ""
      }, _ctx.label !== "" ? {
        n: common_vendor.t(_ctx.label),
        o: common_vendor.s(labelStyle.value)
      } : {}, {
        p: common_vendor.s(common_vendor.unref(uni_modules_uviewPro_libs_index.$u).toStyle(_ctx.customStyle)),
        q: common_vendor.o(onClick, "37"),
        r: common_vendor.n("u-icon--" + _ctx.labelPos),
        s: common_vendor.n(_ctx.customClass)
      });
    };
  }
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-b4d1c4b2"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uview-pro/components/u-icon/u-icon.js.map
