import{be as C,j as u,ak as I,al as D,r as g,an as F,ap as M,ah as l,b4 as N,am as z,as as U,at as m}from"./vendor-ClLR6ncd.js";const E=C(u.jsx("path",{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"}),"Person");function L(a){return I("MuiAvatar",a)}D("MuiAvatar",["root","colorDefault","circular","rounded","square","img","fallback"]);const _=["alt","children","className","component","slots","slotProps","imgProps","sizes","src","srcSet","variant"],q=a=>{const{classes:t,variant:o,colorDefault:e}=a;return U({root:["root",o,e&&"colorDefault"],img:["img"],fallback:["fallback"]},L,t)},T=m("div",{name:"MuiAvatar",slot:"Root",overridesResolver:(a,t)=>{const{ownerState:o}=a;return[t.root,t[o.variant],o.colorDefault&&t.colorDefault]}})(({theme:a})=>({position:"relative",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,width:40,height:40,fontFamily:a.typography.fontFamily,fontSize:a.typography.pxToRem(20),lineHeight:1,borderRadius:"50%",overflow:"hidden",userSelect:"none",variants:[{props:{variant:"rounded"},style:{borderRadius:(a.vars||a).shape.borderRadius}},{props:{variant:"square"},style:{borderRadius:0}},{props:{colorDefault:!0},style:l({color:(a.vars||a).palette.background.default},a.vars?{backgroundColor:a.vars.palette.Avatar.defaultBg}:l({backgroundColor:a.palette.grey[400]},a.applyStyles("dark",{backgroundColor:a.palette.grey[600]})))}]})),B=m("img",{name:"MuiAvatar",slot:"Img",overridesResolver:(a,t)=>t.img})({width:"100%",height:"100%",textAlign:"center",objectFit:"cover",color:"transparent",textIndent:1e4}),H=m(E,{name:"MuiAvatar",slot:"Fallback",overridesResolver:(a,t)=>t.fallback})({width:"75%",height:"75%"});function W({crossOrigin:a,referrerPolicy:t,src:o,srcSet:e}){const[n,s]=g.useState(!1);return g.useEffect(()=>{if(!o&&!e)return;s(!1);let i=!0;const r=new Image;return r.onload=()=>{i&&s("loaded")},r.onerror=()=>{i&&s("error")},r.crossOrigin=a,r.referrerPolicy=t,r.src=o,e&&(r.srcset=e),()=>{i=!1}},[a,t,o,e]),n}const J=g.forwardRef(function(t,o){const e=F({props:t,name:"MuiAvatar"}),{alt:n,children:s,className:i,component:r="div",slots:h={},slotProps:A={},imgProps:b,sizes:k,src:p,srcSet:f,variant:P="circular"}=e,R=M(e,_);let c=null;const S=W(l({},b,{src:p,srcSet:f})),y=p||f,x=y&&S!=="error",d=l({},e,{colorDefault:!x,component:r,variant:P}),v=q(d),[j,w]=N("img",{className:v.img,elementType:B,externalForwardedProps:{slots:h,slotProps:{img:l({},b,A.img)}},additionalProps:{alt:n,src:p,srcSet:f,sizes:k},ownerState:d});return x?c=u.jsx(j,l({},w)):s||s===0?c=s:y&&n?c=n[0]:c=u.jsx(H,{ownerState:d,className:v.fallback}),u.jsx(T,l({as:r,ownerState:d,className:z(v.root,i),ref:o},R,{children:c}))});export{J as A};
