import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
import { defineComponent, computed, resolveComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, renderSlot, createCommentVNode, createVNode, withModifiers } from 'vue';
import getPrefixCls from '../_util/getPrefixCls';
import { useTheme } from '../_theme/useTheme';
import CloseCircleFilled from '../icon/CloseCircleFilled';
import CloseCircleOutlined from '../icon/CloseCircleOutlined';
import { CLOSE_EVENT } from '../_util/constants';
import { tagProps } from './props';

function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
const prefixCls = getPrefixCls('tag');
var script = defineComponent({
  name: 'FTag',
  components: {
    CloseCircleFilled,
    CloseCircleOutlined
  },
  props: _objectSpread({}, tagProps),
  emits: ['click', CLOSE_EVENT],
  setup(props, _ref) {
    let {
      emit
    } = _ref;
    useTheme();
    const classes = computed(() => ({
      [prefixCls]: true,
      [`${prefixCls}-type--${props.type}`]: props.type,
      [`${prefixCls}-size--${props.size}`]: props.size,
      [`${prefixCls}-effect--${props.effect}`]: props.effect,
      'is-bordered': props.bordered
    }));
    const handleClose = event => {
      emit(CLOSE_EVENT, event);
    };
    const handleClick = event => {
      emit('click', event);
    };
    return {
      prefixCls,
      classes,
      handleClose,
      handleClick
    };
  }
});

function render(_ctx, _cache, $props, $setup, $data, $options) {
  const _component_CloseCircleOutlined = resolveComponent("CloseCircleOutlined");
  const _component_CloseCircleFilled = resolveComponent("CloseCircleFilled");
  return openBlock(), createElementBlock("div", {
    class: normalizeClass(_ctx.classes),
    style: normalizeStyle({
      backgroundColor: _ctx.backgroundColor
    }),
    onClick: _cache[0] || (_cache[0] = function () {
      return _ctx.handleClick && _ctx.handleClick(...arguments);
    })
  }, [_ctx.$slots.icon ? renderSlot(_ctx.$slots, "icon", {
    key: 0
  }) : createCommentVNode("v-if", true), renderSlot(_ctx.$slots, "default"), _ctx.closable ? (openBlock(), createElementBlock("div", {
    key: 1,
    class: normalizeClass(`${_ctx.prefixCls}__close`)
  }, [createVNode(_component_CloseCircleOutlined, {
    class: "outlined",
    onClick: withModifiers(_ctx.handleClose, ["stop"])
  }, null, 8 /* PROPS */, ["onClick"]), createVNode(_component_CloseCircleFilled, {
    class: "filled",
    onClick: withModifiers(_ctx.handleClose, ["stop"])
  }, null, 8 /* PROPS */, ["onClick"])], 2 /* CLASS */)) : createCommentVNode("v-if", true)], 6 /* CLASS, STYLE */);
}

script.render = render;
script.__file = "components/tag/tag.vue";

export { script as default };
