import{d as a,K as e,u as t,L as n,j as r,M as o,N as l,O as c,Q as s,S as i,U as u,V as v,h as f,_ as p,c as g,W as d,X as m,P as y,Y as x,a as h,Z as S,$ as b}from"./index.5c1bd6c6.js";var z=a({compatConfig:{MODE:3},name:"AAvatar",inheritAttrs:!1,props:{prefixCls:String,shape:{type:String,default:"circle"},size:{type:[Number,String,Object],default:function(){return"default"}},src:String,srcset:String,icon:y.any,alt:String,gap:Number,draggable:{type:Boolean,default:void 0},crossOrigin:String,loadError:{type:Function}},slots:["icon"],setup:function(a,y){var x=y.slots,h=y.attrs,S=e(!0),b=e(!1),z=e(1),C=e(null),O=e(null),A=t("avatar",a).prefixCls,P=n(),j=r((function(){return"default"===a.size?P.value:a.size})),N=o(),k=l((function(){if("object"===c(a.size)){var e=s.find((function(a){return N.value[a]}));return a.size[e]}})),E=function(){if(C.value&&O.value){var e=C.value.offsetWidth,t=O.value.offsetWidth;if(0!==e&&0!==t){var n=a.gap,r=void 0===n?4:n;2*r<t&&(z.value=t-2*r<e?(t-2*r)/e:1)}}},T=function(){var e=a.loadError;!1!==(null==e?void 0:e())&&(S.value=!1)};return i((function(){return a.src}),(function(){u((function(){S.value=!0,z.value=1}))})),i((function(){return a.gap}),(function(){u((function(){E()}))})),v((function(){u((function(){E(),b.value=!0}))})),function(){var e,t,n,r,o=a.shape,l=a.src,c=a.alt,s=a.srcset,i=a.draggable,u=a.crossOrigin,v=f(x,a,"icon"),y=A.value,P=(p(e={},"".concat(h.class),!!h.class),p(e,y,!0),p(e,"".concat(y,"-lg"),"large"===j.value),p(e,"".concat(y,"-sm"),"small"===j.value),p(e,"".concat(y,"-").concat(o),o),p(e,"".concat(y,"-image"),l&&S.value),p(e,"".concat(y,"-icon"),v),e),N="number"==typeof j.value?{width:"".concat(j.value,"px"),height:"".concat(j.value,"px"),lineHeight:"".concat(j.value,"px"),fontSize:v?"".concat(j.value/2,"px"):"18px"}:{},W=null===(t=x.default)||void 0===t?void 0:t.call(x);if(l&&S.value)n=g("img",{draggable:i,src:l,srcset:s,onError:T,alt:c,crossorigin:u},null);else if(v)n=v;else if(b.value||1!==z.value){var H="scale(".concat(z.value,") translateX(-50%)"),M={msTransform:H,WebkitTransform:H,transform:H},w="number"==typeof j.value?{lineHeight:"".concat(j.value,"px")}:{};n=g(m,{onResize:E},{default:function(){return[g("span",{class:"".concat(y,"-string"),ref:C,style:d(d({},w),M)},[W])]}})}else n=g("span",{class:"".concat(y,"-string"),ref:C,style:{opacity:0}},[W]);return g("span",d(d({},h),{},{ref:O,class:P,style:[N,(r=!!v,k.value?{width:"".concat(k.value,"px"),height:"".concat(k.value,"px"),lineHeight:"".concat(k.value,"px"),fontSize:"".concat(r?k.value/2:18,"px")}:{}),h.style]}),[n])}}}),C=a({compatConfig:{MODE:3},name:"AAvatarGroup",inheritAttrs:!1,props:{prefixCls:String,maxCount:Number,maxStyle:{type:Object,default:void 0},maxPopoverPlacement:{type:String,default:"top"},maxPopoverTrigger:String,size:{type:[Number,String,Object],default:"default"}},setup:function(a,e){var n=e.slots,r=e.attrs,o=t("avatar-group",a),l=o.prefixCls,c=o.direction;return x(a),function(){var e,t=a.maxPopoverPlacement,o=void 0===t?"top":t,s=a.maxCount,i=a.maxStyle,u=a.maxPopoverTrigger,v=void 0===u?"hover":u,m=(p(e={},l.value,!0),p(e,"".concat(l.value,"-rtl"),"rtl"===c.value),p(e,"".concat(r.class),!!r.class),e),y=f(n,a),x=h(y).map((function(a,e){return S(a,{key:"avatar-key-".concat(e)})})),C=x.length;if(s&&s<C){var O=x.slice(0,s),A=x.slice(s,C);return O.push(g(b,{key:"avatar-popover-key",content:A,trigger:v,placement:o,overlayClassName:"".concat(l.value,"-popover")},{default:function(){return[g(z,{style:i},{default:function(){return["+".concat(C-s)]}})]}})),g("div",d(d({},r),{},{class:m,style:r.style}),[O])}return g("div",d(d({},r),{},{class:m,style:r.style}),[x])}}});z.Group=C,z.install=function(a){return a.component(z.name,z),a.component(C.name,C),a};export{z as A};
