import '@das-fed/ui/packages/components/tag/style.css';
import { withInstall as S } from "@das-fed/utils/with-install/index";
import { setThemeRule as E } from "@das-fed/web/packages/theme/index";
import { defineComponent as N, computed as e, ref as n, watch as A, nextTick as L, createElementBlock as x, openBlock as f, createVNode as R, unref as h, mergeProps as V, withCtx as B, renderSlot as I, createBlock as z, createCommentVNode as y, createElementVNode as O, normalizeStyle as T, toDisplayString as _ } from "vue";
import { DasTooltip as P } from "@das-fed/ui/packages/components/tooltip/index";
import { ElTag as j } from "element-plus";
import "element-plus/es/components/tag/style/css";
const q = { class: "das-ui-tag" }, G = {
  inheritAttrs: !1
}, H = /* @__PURE__ */ N({
  ...G,
  __name: "Index",
  props: {
    round: { type: Boolean, default: !0 },
    effect: { default: "dark" },
    type: { default: "" },
    toolTip: { type: Boolean, default: !1 },
    toolTipLabel: { default: "" },
    width: { default: "" },
    maxWidth: { default: "" }
  },
  setup(l, { expose: i }) {
    const t = l, a = e(() => t.type || ""), s = ["success", "info", "warning", "danger", ""], k = e(() => s.includes(a.value) ? null : `el-tag--${a.value}`), w = e(() => s.includes(a.value) ? a.value : ""), o = e(() => t.effect || "dark"), p = ["dark", "light", "plain"], b = e(() => p.includes(o.value) ? null : `el-tag--${o.value}`), F = e(() => p.includes(o.value) ? o.value : "dark"), g = e(() => t.round), W = e(() => o.value === "list" ? !g.value : g.value), u = n(), d = e(() => t.maxWidth ? t.maxWidth : t.width), $ = e(() => {
      if (t.maxWidth)
        return `max-width:${t.width}`;
      if (t.width)
        return `width:${t.width}`;
    }), m = e(() => {
      if (t.maxWidth)
        return `max-width:${Number(String(d.value).split("px")[0]) - 36}px`;
      if (t.width)
        return `width:${Number(String(d.value).split("px")[0]) - 36}px`;
    }), c = n(!0);
    A(
      () => u.value,
      (r, C) => {
        if (t.toolTip && r) {
          const D = Number(String(d.value).split("px")[0]) - 36;
          L(() => {
            u.value.scrollWidth <= D && (c.value = !1);
          });
        }
      }
    );
    const v = n(null);
    return i({
      /** das-tag */
      $refTag: v
    }), (r, C) => (f(), x("div", q, [
      R(h(j), V({
        ref_key: "$refTag",
        ref: v
      }, r.$attrs, {
        effect: F.value,
        style: $.value,
        round: W.value,
        type: w.value,
        class: [k.value, b.value]
      }), {
        default: B(() => [
          I(r.$slots, "default", {}, void 0, !0),
          t.toolTip && t.toolTipLabel && c.value ? (f(), z(h(P), {
            key: 0,
            content: t.toolTipLabel,
            placement: "top"
          }, {
            default: B(() => [
              O(
                "div",
                {
                  class: "text-nowrap",
                  ref_key: "textRef",
                  ref: u,
                  style: T(m.value)
                },
                _(t.toolTipLabel),
                5
                /* TEXT, STYLE */
              )
            ]),
            _: 1
            /* STABLE */
          }, 8, ["content"])) : y("v-if", !0),
          c.value ? y("v-if", !0) : (f(), x(
            "div",
            {
              key: 1,
              style: T(m.value)
            },
            _(t.toolTipLabel),
            5
            /* TEXT, STYLE */
          ))
        ]),
        _: 3
        /* FORWARDED */
      }, 16, ["effect", "style", "round", "type", "class"])
    ]));
  }
}), J = (l, i) => {
  const t = l.__vccOpts || l;
  for (const [a, s] of i)
    t[a] = s;
  return t;
}, K = /* @__PURE__ */ J(H, [["__scopeId", "data-v-feb09848"]]), M = {
  // 默认配置
  "--das-ui-tag-default-font-size": "12px",
  "--das-ui-tag-default-color": "#16B0F1",
  "--das-ui-tag-detault-text-color": "#fff",
  "--das-ui-tag-detault-border-color": "none",
  // 成功状态配置
  "--das-ui-tag-dark-success-color": "#1BA854",
  "--das-ui-tag-plain-success-color": "#26B175",
  "--das-ui-tag-text-success-color": "#1BA854",
  // 进行中状态配置
  "--das-ui-tag-dark-process-color": "#276FF5",
  "--das-ui-tag-plain-process-color": "#55A0F5",
  "--das-ui-tag-text-process-color": "#5582F3",
  // 警示状态配置
  "--das-ui-tag-dark-warning-color": "#FF991C",
  "--das-ui-tag-plain-warning-color": "#ED812B",
  "--das-ui-tag-text-warning-color": "#FF991C",
  // 危险状态配置
  "--das-ui-tag-dark-danger-color": "#FB2323",
  "--das-ui-tag-plain-danger-color": "#FD6C6A",
  "--das-ui-tag-text-danger-color": "#FB2323",
  // 废弃状态配置
  "--das-ui-tag-dark-info-color": "#B2B2B2",
  "--das-ui-tag-plain-info-color": "#BBBBBB",
  "--das-ui-tag-text-info-color": "#B2B2B2",
  // 暂存状态配置
  "--das-ui-tag-dark-temporary-color": "#666666",
  "--das-ui-tag-plain-temporary-color": "#666666",
  "--das-ui-tag-text-temporary-color": "#666666",
  // 列表类型配置
  "--das-ui-tag-list-text-color": "#212121",
  "--das-ui-tag-list-border-color": "#D9D9D9",
  "--das-ui-tag-list-border-active-color": "#5582F3",
  "--das-ui-tag-list-close-icon-color": "#999"
};
E(M);
const et = S(K);
export {
  et as DasTag,
  et as default
};
