import{_ as t,o as e,p as s,w as a,aq as i,a4 as o,B as l,k as n,t as r,v as d,C as u,i as p}from"./index-2PZN6pGH.js";const f=t({name:"UniBadge",emits:["click"],props:{type:{type:String,default:"error"},inverted:{type:Boolean,default:!1},isDot:{type:Boolean,default:!1},maxNum:{type:Number,default:99},absolute:{type:String,default:""},offset:{type:Array,default:()=>[0,0]},text:{type:[String,Number],default:""},size:{type:String,default:"small"},customStyle:{type:Object,default:()=>({})}},data:()=>({}),computed:{width(){return 8*String(this.text).length+12},classNames(){const{inverted:t,type:e,size:s,absolute:a}=this;return[t?"uni-badge--"+e+"-inverted":"","uni-badge--"+e,"uni-badge--"+s,a?"uni-badge--absolute":""].join(" ")},positionStyle(){if(!this.absolute)return{};let t=this.width/2,e=10;this.isDot&&(t=5,e=5);const s=`${-t+this.offset[0]}px`,a=`${-e+this.offset[1]}px`,i={rightTop:{right:s,top:a},rightBottom:{right:s,bottom:a},leftBottom:{left:s,bottom:a},leftTop:{left:s,top:a}},o=i[this.absolute];return o||i.rightTop},dotStyle(){return this.isDot?{width:"10px",minWidth:"0",height:"10px",padding:"0",borderRadius:"10px"}:{}},displayValue(){const{isDot:t,text:e,maxNum:s}=this;return t?"":Number(e)>s?`${s}+`:e}},methods:{onClick(){this.$emit("click")}}},[["render",function(t,f,c,h,m,y){const g=u,b=p;return e(),s(b,{class:"uni-badge--x"},{default:a((()=>[i(t.$slots,"default",{},void 0,!0),c.text?(e(),s(g,{key:0,class:o([y.classNames,"uni-badge"]),style:l([y.positionStyle,c.customStyle,y.dotStyle]),onClick:f[0]||(f[0]=t=>y.onClick())},{default:a((()=>[n(r(y.displayValue),1)])),_:1},8,["class","style"])):d("",!0)])),_:3})}],["__scopeId","data-v-1ca6063a"]]);export{f as _};
