"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const index = require("../../../hooks/use-namespace/index.js");
const index$1 = require("../../icon/index.js");
const button = require("./button.js");
const useButton = require("./use-button.js");
const buttonCustom = require("./button-custom.js");
const Vue = require("vue");
var button_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ Vue.defineComponent({
  name: "ElButton",
  __name: "button",
  props: button.buttonProps,
  emits: button.buttonEmits,
  setup(__props, { expose: __expose, emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const buttonStyle = buttonCustom.useButtonCustomStyle(props);
    const ns = index.useNamespace("button");
    const { _ref, _size, _type, _disabled, _props, _plain, _round, _text, _dashed, shouldAddSpace, handleClick } = useButton.useButton(props, emit);
    const buttonKls = Vue.computed(() => [
      ns.b(),
      ns.m(_type.value),
      ns.m(_size.value),
      ns.is("disabled", _disabled.value),
      ns.is("loading", props.loading),
      ns.is("plain", _plain.value),
      ns.is("round", _round.value),
      ns.is("circle", props.circle),
      ns.is("text", _text.value),
      ns.is("dashed", _dashed.value),
      ns.is("link", props.link),
      ns.is("has-bg", props.bg)
    ]);
    __expose({
      ref: _ref,
      size: _size,
      type: _type,
      disabled: _disabled,
      shouldAddSpace
    });
    return (_ctx, _cache) => {
      return Vue.openBlock(), Vue.createBlock(Vue.resolveDynamicComponent(__props.tag), Vue.mergeProps({
        ref_key: "_ref",
        ref: _ref
      }, Vue.unref(_props), {
        class: buttonKls.value,
        style: Vue.unref(buttonStyle),
        onClick: Vue.unref(handleClick)
      }), {
        default: Vue.withCtx(() => [__props.loading ? (Vue.openBlock(), Vue.createElementBlock(Vue.Fragment, { key: 0 }, [_ctx.$slots.loading ? Vue.renderSlot(_ctx.$slots, "loading", { key: 0 }) : (Vue.openBlock(), Vue.createBlock(Vue.unref(index$1.ElIcon), {
          key: 1,
          class: Vue.normalizeClass(Vue.unref(ns).is("loading"))
        }, {
          default: Vue.withCtx(() => [(Vue.openBlock(), Vue.createBlock(Vue.resolveDynamicComponent(__props.loadingIcon)))]),
          _: 1
        }, 8, ["class"]))], 64)) : __props.icon || _ctx.$slots.icon ? (Vue.openBlock(), Vue.createBlock(Vue.unref(index$1.ElIcon), { key: 1 }, {
          default: Vue.withCtx(() => [__props.icon ? (Vue.openBlock(), Vue.createBlock(Vue.resolveDynamicComponent(__props.icon), { key: 0 })) : Vue.renderSlot(_ctx.$slots, "icon", { key: 1 })]),
          _: 3
        })) : Vue.createCommentVNode("v-if", true), _ctx.$slots.default ? (Vue.openBlock(), Vue.createElementBlock("span", {
          key: 2,
          class: Vue.normalizeClass({ [Vue.unref(ns).em("text", "expand")]: Vue.unref(shouldAddSpace) })
        }, [Vue.renderSlot(_ctx.$slots, "default")], 2)) : Vue.createCommentVNode("v-if", true)]),
        _: 3
      }, 16, [
        "class",
        "style",
        "onClick"
      ]);
    };
  }
});
exports.default = button_vue_vue_type_script_setup_true_lang_default;
