"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("vue"),x=require("@ant-design/icons-vue/CloseOutlined"),O=require("../_util/classNames.js"),h=require("../_util/colors.js"),j=require("../_util/type.js"),k=require("../_util/vue-types/index.js"),w=require("../_util/wave/index.js"),B=require("../config-provider/hooks/useConfigInject.js"),a=require("./CheckableTag.js"),F=require("./style/index.js"),y=()=>({prefixCls:String,color:{type:String},closable:{type:Boolean,default:!1},closeIcon:k.default.any,visible:{type:Boolean,default:void 0},onClose:{type:Function},onClick:j.eventType(),"onUpdate:visible":Function,icon:k.default.any,bordered:{type:Boolean,default:!0}}),n=l.defineComponent({compatConfig:{MODE:3},name:"ATag",inheritAttrs:!1,props:y(),slots:Object,setup(e,{slots:c,emit:s,attrs:i}){const{prefixCls:o,direction:m}=B.default("tag",e),[N,q]=F.default(o),u=l.shallowRef(!0);l.watchEffect(()=>{e.visible!==void 0&&(u.value=e.visible)});const d=t=>{t.stopPropagation(),s("update:visible",!1),s("close",t),!t.defaultPrevented&&e.visible===void 0&&(u.value=!1)},r=l.computed(()=>h.isPresetColor(e.color)||h.isPresetStatusColor(e.color)),$=l.computed(()=>O.default(o.value,q.value,{[`${o.value}-${e.color}`]:r.value,[`${o.value}-has-color`]:e.color&&!r.value,[`${o.value}-hidden`]:!u.value,[`${o.value}-rtl`]:m.value==="rtl",[`${o.value}-borderless`]:!e.bordered})),S=t=>{s("click",t)};return()=>{const{icon:t=c.icon?.(),color:f,closeIcon:v=c.closeIcon?.(),closable:I=!1}=e,P=()=>I?v?l.createVNode("span",{class:`${o.value}-close-icon`,onClick:d},[v]):l.createVNode(x,{class:`${o.value}-close-icon`,onClick:d},null):null,T={backgroundColor:f&&!r.value?f:void 0},C=t||null,g=c.default?.(),V=C?l.createVNode(l.Fragment,null,[C,l.createVNode("span",null,[g])]):g,p=e.onClick!==void 0,b=l.createVNode("span",{...i,onClick:S,class:[$.value,i.class],style:[T,i.style]},[V,P()]);return N(p?l.createVNode(w.default,null,{default:()=>[b]}):b)}}});n.CheckableTag=a.default;n.install=function(e){return e.component(n.name,n),e.component(a.default.name,a.default),e};exports.CheckableTag=a.default;exports.default=n;exports.tagProps=y;
