import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, createElementVNode, unref, withDirectives, renderSlot, createBlock, createCommentVNode, toDisplayString, createTextVNode, createVNode } from "vue";
import SvgIcon from "./SvgIcon.vue.mjs";
import ArrowUpIcon from "../icons/ArrowUpIcon.vue.mjs";
import { IconButtonLayout } from "../../../constants/room.mjs";
import { isMobile } from "../../../utils/environment.mjs";
import UnSupportIcon from "../icons/UnSupportIcon.vue.mjs";
import vTap from "../../../directives/vTap.mjs";
const _hoisted_1 = { class: "icon-button-container" };
const _hoisted_2 = { class: "title" };
const _hoisted_3 = { class: "title" };
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "IconButton",
  props: {
    title: { default: "" },
    hasMore: { type: Boolean, default: false },
    hideHoverEffect: { type: Boolean, default: false },
    disabled: { type: Boolean, default: false },
    isActive: { type: Boolean, default: false },
    layout: { default: IconButtonLayout.VERTICAl },
    icon: { default: null },
    isNotSupport: { type: Boolean, default: false },
    theme: { default: void 0 }
  },
  emits: ["click-icon", "click-more"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const themeClass = computed(
      () => props.theme ? `tui-theme-${props.theme}` : ""
    );
    const iconContentClass = computed(() => {
      if (props.layout === IconButtonLayout.HORIZONTAL) {
        return "icon-content-horizontal";
      }
      return "icon-content-vertical";
    });
    const handleClickEvent = () => {
      emit("click-icon");
    };
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: normalizeClass([themeClass.value])
      }, [
        createElementVNode("div", _hoisted_1, [
          unref(isMobile) ? withDirectives((openBlock(), createElementBlock("div", {
            key: 0,
            class: normalizeClass(["icon-content", iconContentClass.value, `${_ctx.disabled && "disabled"}`])
          }, [
            renderSlot(_ctx.$slots, "default", {}, void 0, true),
            _ctx.icon ? (openBlock(), createBlock(SvgIcon, {
              key: 0,
              icon: _ctx.icon
            }, null, 8, ["icon"])) : createCommentVNode("", true),
            createElementVNode("span", _hoisted_2, toDisplayString(_ctx.title), 1)
          ], 2)), [
            [unref(vTap), handleClickEvent]
          ]) : (openBlock(), createElementBlock("div", {
            key: 1,
            class: normalizeClass(["icon-content", iconContentClass.value, `${_ctx.disabled && "disabled"}`]),
            onClick: handleClickEvent
          }, [
            renderSlot(_ctx.$slots, "default", {}, void 0, true),
            _ctx.icon ? (openBlock(), createBlock(SvgIcon, {
              key: 0,
              icon: _ctx.icon
            }, null, 8, ["icon"])) : createCommentVNode("", true),
            _ctx.isNotSupport ? (openBlock(), createBlock(SvgIcon, {
              key: 1,
              class: "unsupport-icon",
              icon: UnSupportIcon
            })) : createCommentVNode("", true),
            createElementVNode("span", _hoisted_3, [
              createTextVNode(toDisplayString(_ctx.title) + " ", 1),
              renderSlot(_ctx.$slots, "title", {}, void 0, true)
            ])
          ], 2)),
          _ctx.hasMore ? (openBlock(), createElementBlock("div", {
            key: 2,
            ref: "moreSpanRef",
            class: "icon-arrow",
            onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("click-more"))
          }, [
            createVNode(SvgIcon, { icon: ArrowUpIcon })
          ], 512)) : createCommentVNode("", true)
        ])
      ], 2);
    };
  }
});
export {
  _sfc_main as default
};
