var b=Object.defineProperty,$=Object.defineProperties;var E=Object.getOwnPropertyDescriptors;var c=Object.getOwnPropertySymbols;var q=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable;var l=(e,r,a)=>r in e?b(e,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[r]=a,s=(e,r)=>{for(var a in r||(r={}))q.call(r,a)&&l(e,a,r[a]);if(c)for(var a of c(r))w.call(r,a)&&l(e,a,r[a]);return e},u=(e,r)=>$(e,E(r));import{R as A,aa as x,r as i,j as f,ab as m}from"./vendor.e6eaca24.js";import{b as S}from"./index.c6944236.js";import"./lodash.default.91c04a21.js";var p=window.publicPath+"assets/default-avatar.a1f2bf2b.svg";function g(e){return e.endsWith("/")?e:`${e}/`}function y(e,r){switch(e.type){case"gravatar":return`${g(window.gravatarCdn||S.serverPreference.misc.gravatarCdn)}avatar/${e.key}?size=${r}&default=404`;case"qq":let a;return r<=40?a=1:r<=100?a=3:r<=140?a=4:a=5,`https://q1.qlogo.cn/g?b=qq&nk=${e.key}&s=${a}`;case"github":return`${g(window.ghAvatarCdn||"https://github.com")}${e.key}.png?size=${r}`}}const R=e=>{const[r,a]=i.exports.useState(!1),v=e.imageSize||{mini:35,tiny:80,small:150,medium:300,large:450,big:600,huge:800,massive:960}[e.size]||80,t=y(e.userAvatar,Math.ceil(window.devicePixelRatio*v)),n=i.exports.useRef();i.exports.useEffect(()=>{n.current=t}),n.current!==t&&r&&a(!1);const o=Object.fromEntries(Object.entries(e).filter(([h])=>!["userAvatar","placeholder","imageSize","errorRef"].includes(h)));function d(){a(!0),e.onError&&e.onError()}return r||e.placeholder?f(m,s({src:p},o)):f(m,u(s({src:t},o),{onError:d}))};var P=A.memo(R,x.isEqual);export{P as U}