'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var vue = require('vue');

const _hoisted_1 = ["src"];
var _sfc_main = /* @__PURE__ */ vue.defineComponent({
  ...{
    name: "svgIcon"
  },
  __name: "svgicon",
  props: {
    // svg 图标组件名字
    name: {
      type: String
    },
    // svg 大小
    size: {
      type: Number,
      default: () => 14
    },
    // svg 颜色
    color: {
      type: String
    }
  },
  setup(__props) {
    const props = __props;
    const linesString = ["https", "http", "/src", "/assets", "data:image", window.__env__.VITE_PUBLIC_PATH];
    const getIconName = vue.computed(() => {
      return props?.name;
    });
    const isShowIconSvg = vue.computed(() => {
      return props?.name?.startsWith("ele-");
    });
    const isShowIconImg = vue.computed(() => {
      return linesString.find((str) => props.name?.startsWith(str));
    });
    const setIconSvgStyle = vue.computed(() => {
      return `font-size: ${props.size}px;color: ${props.color};`;
    });
    const setIconImgOutStyle = vue.computed(() => {
      return `width: ${props.size}px;height: ${props.size}px;display: inline-block;overflow: hidden;`;
    });
    const setIconSvgInsStyle = vue.computed(() => {
      const filterStyle = [];
      const compatibles = ["-webkit", "-ms", "-o", "-moz"];
      compatibles.forEach((j) => filterStyle.push(`${j}-filter: drop-shadow(${props.color} ${props.size}px 0);`));
      return `width: ${props.size}px;height: ${props.size}px;position: relative;left: -${props.size}px;${filterStyle.join("")}`;
    });
    return (_ctx, _cache) => {
      return isShowIconSvg.value ? (vue.openBlock(), vue.createElementBlock(
        "i",
        {
          key: 0,
          class: "el-icon",
          style: vue.normalizeStyle(setIconSvgStyle.value)
        },
        [
          (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(getIconName.value)))
        ],
        4
        /* STYLE */
      )) : isShowIconImg.value ? (vue.openBlock(), vue.createElementBlock(
        "div",
        {
          key: 1,
          style: vue.normalizeStyle(setIconImgOutStyle.value)
        },
        [
          vue.createElementVNode("img", {
            src: getIconName.value,
            style: vue.normalizeStyle(setIconSvgInsStyle.value)
          }, null, 12, _hoisted_1)
        ],
        4
        /* STYLE */
      )) : (vue.openBlock(), vue.createElementBlock(
        "i",
        {
          key: 2,
          class: vue.normalizeClass(getIconName.value),
          style: vue.normalizeStyle(setIconSvgStyle.value)
        },
        null,
        6
        /* CLASS, STYLE */
      ));
    };
  }
});

exports.default = _sfc_main;
