import * as _vue from "vue";

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

import { inject } from 'vue';
import PropTypes from '../_util/vue-types';
import { ConfigConsumerProps } from '../config-provider';
export default {
  name: 'ACheckableTag',
  props: {
    prefixCls: PropTypes.string,
    checked: PropTypes.bool,
    onChange: PropTypes.func,
    'onUpdate:checked': PropTypes.func
  },
  setup: function setup() {
    return {
      configProvider: inject('configProvider', ConfigConsumerProps)
    };
  },
  computed: {
    classes: function classes() {
      var _ref;

      var checked = this.checked,
          customizePrefixCls = this.prefixCls;
      var getPrefixCls = this.configProvider.getPrefixCls;
      var prefixCls = getPrefixCls('tag', customizePrefixCls);
      return _ref = {}, _defineProperty(_ref, "".concat(prefixCls), true), _defineProperty(_ref, "".concat(prefixCls, "-checkable"), true), _defineProperty(_ref, "".concat(prefixCls, "-checkable-checked"), checked), _ref;
    }
  },
  methods: {
    handleClick: function handleClick() {
      var checked = this.checked;
      this.$emit('update:checked', !checked);
      this.$emit('change', !checked);
    }
  },
  render: function render() {
    var classes = this.classes,
        handleClick = this.handleClick,
        $slots = this.$slots;
    return _vue.createVNode("div", {
      "class": classes,
      "onClick": handleClick
    }, [$slots.default && $slots.default()]);
  }
};