const e=require("../_util/classNames.js"),t=require("../_util/props-util/index.js"),n=require("../config-provider/hooks/useConfigInject.js"),r=require("../_util/vue-types/index.js"),i=require("../_util/transition.js"),a=require("../_util/vnode.js"),o=require("../_util/colors.js"),s=require("../_util/isNumeric.js"),c=require("./style/index.js"),l=require("./Ribbon.js"),u=require("./ScrollNumber.js");let d=require("vue");function f(){return{count:r.default.any.def(null),showZero:{type:Boolean,default:void 0},overflowCount:{type:Number,default:99},dot:{type:Boolean,default:void 0},prefixCls:String,scrollNumberPrefixCls:String,status:{type:String},size:{type:String,default:`default`},color:String,text:r.default.any,offset:Array,numberStyle:{type:Object,default:void 0},title:String}}var p=(0,d.defineComponent)({compatConfig:{MODE:3},name:`ABadge`,Ribbon:l.default,inheritAttrs:!1,props:f(),slots:Object,setup(r,{slots:l,attrs:f}){let{prefixCls:p,direction:m}=n.default(`badge`,r),[h,g]=c.default(p),_=(0,d.computed)(()=>r.count>r.overflowCount?`${r.overflowCount}+`:r.count),v=(0,d.computed)(()=>_.value===`0`||_.value===0),y=(0,d.computed)(()=>r.count===null||v.value&&!r.showZero),b=(0,d.computed)(()=>(r.status!==null&&r.status!==void 0||r.color!==null&&r.color!==void 0)&&y.value),x=(0,d.computed)(()=>r.dot&&!v.value),S=(0,d.computed)(()=>x.value?``:_.value),C=(0,d.computed)(()=>(S.value===null||S.value===void 0||S.value===``||v.value&&!r.showZero)&&!x.value),w=(0,d.ref)(r.count),T=(0,d.ref)(S.value),E=(0,d.ref)(x.value);(0,d.watch)([()=>r.count,S,x],()=>{C.value||(w.value=r.count,T.value=S.value,E.value=x.value)},{immediate:!0});let D=(0,d.computed)(()=>o.isPresetColor(r.color,!1)),O=(0,d.computed)(()=>({[`${p.value}-status-dot`]:b.value,[`${p.value}-status-${r.status}`]:!!r.status,[`${p.value}-color-${r.color}`]:D.value})),k=(0,d.computed)(()=>r.color&&!D.value?{background:r.color,color:r.color}:{}),A=(0,d.computed)(()=>({[`${p.value}-dot`]:E.value,[`${p.value}-count`]:!E.value,[`${p.value}-count-sm`]:r.size===`small`,[`${p.value}-multiple-words`]:!E.value&&T.value&&T.value.toString().length>1,[`${p.value}-status-${r.status}`]:!!r.status,[`${p.value}-color-${r.color}`]:D.value}));return()=>{let{offset:n,title:o,color:c}=r,_=f.style,v=t.getPropsSlot(l,r,`text`),y=p.value,x=w.value,S=t.flattenChildren(l.default?.());S=S.length?S:null;let E=!!(!C.value||l.count),j=(()=>{if(!n)return{..._};let e={marginTop:s.default(n[1])?`${n[1]}px`:n[1]};return m.value===`rtl`?e.left=`${Number.parseInt(n[0],10)}px`:e.right=`${-Number.parseInt(n[0],10)}px`,{...e,..._}})(),M=o??(typeof x==`string`||typeof x==`number`?x:void 0),N=E||!v?null:(0,d.createVNode)(`span`,{class:`${y}-status-text`},[v]),P=typeof x==`object`||x===void 0&&l.count?a.cloneElement(x??l.count?.(),{style:j},!1):null,F=e.default(y,{[`${y}-status`]:b.value,[`${y}-not-a-wrapper`]:!S,[`${y}-rtl`]:m.value===`rtl`},f.class,g.value);if(!S&&b.value){let e=j.color;return h((0,d.createVNode)(`span`,{...f,class:F,style:j},[(0,d.createVNode)(`span`,{class:O.value,style:k.value},null),(0,d.createVNode)(`span`,{style:{color:e},class:`${y}-status-text`},[v])]))}let I=i.getTransitionProps(S?`${y}-zoom`:``,{appear:!1}),L={...j,...r.numberStyle};return c&&!D.value&&(L=L||{},L.background=c),h((0,d.createVNode)(`span`,{...f,class:F},[S,(0,d.createVNode)(d.Transition,I,{default:()=>[(0,d.withDirectives)((0,d.createVNode)(u.default,{prefixCls:r.scrollNumberPrefixCls,show:E,class:A.value,count:T.value,title:M,style:L,key:`scrollNumber`},{default:()=>[P]}),[[d.vShow,E]])]}),N]))}}});exports.badgeProps=f,exports.default=p;