import { a as o, u as n } from "./use-route-126c4f06.js";
import {
  H as i,
  a5 as a,
  a0 as e,
  J as l,
  I as t,
  bu as s,
  v as r,
  P as d,
  aE as c,
  aG as g,
  Q as u,
} from "./index-476be0bb.js";
const [p, b] = i("button");
const f = u(
  t({
    name: p,
    props: a({}, o, {
      tag: e("button"),
      text: String,
      icon: String,
      type: e("default"),
      size: e("normal"),
      color: String,
      block: Boolean,
      plain: Boolean,
      round: Boolean,
      square: Boolean,
      loading: Boolean,
      hairline: Boolean,
      disabled: Boolean,
      iconPrefix: String,
      nativeType: e("button"),
      loadingSize: l,
      loadingText: String,
      loadingType: String,
      iconPosition: e("left"),
    }),
    emits: ["click"],
    setup(o, { emit: i, slots: a }) {
      const e = n(),
        l = () =>
          o.loading
            ? a.loading
              ? a.loading()
              : r(
                  g,
                  {
                    size: o.loadingSize,
                    type: o.loadingType,
                    class: b("loading"),
                  },
                  null
                )
            : a.icon
            ? r("div", { class: b("icon") }, [a.icon()])
            : o.icon
            ? r(
                d,
                { name: o.icon, class: b("icon"), classPrefix: o.iconPrefix },
                null
              )
            : void 0,
        t = () => {
          let n;
          if (
            ((n = o.loading ? o.loadingText : a.default ? a.default() : o.text),
            n)
          )
            return r("span", { class: b("text") }, [n]);
        },
        u = () => {
          const { color: n, plain: i } = o;
          if (n) {
            const o = { color: i ? n : "white" };
            return (
              i || (o.background = n),
              n.includes("gradient") ? (o.border = 0) : (o.borderColor = n),
              o
            );
          }
        },
        p = (n) => {
          o.loading ? c(n) : o.disabled || (i("click", n), e());
        };
      return () => {
        const {
            tag: n,
            type: i,
            size: a,
            block: e,
            round: d,
            plain: c,
            square: g,
            loading: f,
            disabled: x,
            hairline: m,
            nativeType: y,
            iconPosition: B,
          } = o,
          S = [
            b([
              i,
              a,
              {
                plain: c,
                block: e,
                round: d,
                square: g,
                loading: f,
                disabled: x,
                hairline: m,
              },
            ]),
            { [s]: m },
          ];
        return r(
          n,
          { type: y, class: S, style: u(), disabled: x, onClick: p },
          {
            default: () => [
              r("div", { class: b("content") }, [
                "left" === B && l(),
                t(),
                "right" === B && l(),
              ]),
            ],
          }
        );
      };
    },
  })
);
export { f as B };
