import{r as d,j as p}from"./client-BbMi5ewG.js";import{c as $}from"./index-B5gX5Cyp.js";import{g as T,e as y}from"./Button-1dacbE2T.js";import{P as A}from"./index-C4Ytkwtd.js";import{a as U}from"./vendor-DDjlQeP6.js";import{a as w}from"./utils-Q0fnGDhj.js";var x={exports:{}},E={};/**
 * @license React
 * use-sync-external-store-shim.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var R;function V(){if(R)return E;R=1;var e=U();function t(n,s){return n===s&&(n!==0||1/n===1/s)||n!==n&&s!==s}var r=typeof Object.is=="function"?Object.is:t,o=e.useState,u=e.useEffect,a=e.useLayoutEffect,f=e.useDebugValue;function i(n,s){var v=s(),g=o({inst:{value:v,getSnapshot:s}}),l=g[0].inst,h=g[1];return a(function(){l.value=v,l.getSnapshot=s,c(l)&&h({inst:l})},[n,v,s]),u(function(){return c(l)&&h({inst:l}),n(function(){c(l)&&h({inst:l})})},[n]),f(v),v}function c(n){var s=n.getSnapshot;n=n.value;try{var v=s();return!r(n,v)}catch{return!0}}function m(n,s){return s()}var S=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?m:i;return E.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:S,E}var N;function D(){return N||(N=1,x.exports=V()),x.exports}var G=D();function H(){return G.useSyncExternalStore(B,()=>!0,()=>!1)}function B(){return()=>{}}var L="Avatar",[K]=$(L),[O,b]=K(L),j=d.forwardRef((e,t)=>{const{__scopeAvatar:r,...o}=e,[u,a]=d.useState("idle");return p.jsx(O,{scope:r,imageLoadingStatus:u,onImageLoadingStatusChange:a,children:p.jsx(A.span,{...o,ref:t})})});j.displayName=L;var _="AvatarImage",C=d.forwardRef((e,t)=>{const{__scopeAvatar:r,src:o,onLoadingStatusChange:u=()=>{},...a}=e,f=b(_,r),i=W(o,a),c=T(m=>{u(m),f.onImageLoadingStatusChange(m)});return y(()=>{i!=="idle"&&c(i)},[i,c]),i==="loaded"?p.jsx(A.img,{...a,ref:t,src:o}):null});C.displayName=_;var k="AvatarFallback",q=d.forwardRef((e,t)=>{const{__scopeAvatar:r,delayMs:o,...u}=e,a=b(k,r),[f,i]=d.useState(o===void 0);return d.useEffect(()=>{if(o!==void 0){const c=window.setTimeout(()=>i(!0),o);return()=>window.clearTimeout(c)}},[o]),f&&a.imageLoadingStatus!=="loaded"?p.jsx(A.span,{...u,ref:t}):null});q.displayName=k;function I(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function W(e,{referrerPolicy:t,crossOrigin:r}){const o=H(),u=d.useRef(null),a=o?(u.current||(u.current=new window.Image),u.current):null,[f,i]=d.useState(()=>I(a,e));return y(()=>{i(I(a,e))},[a,e]),y(()=>{const c=n=>()=>{i(n)};if(!a)return;const m=c("loaded"),S=c("error");return a.addEventListener("load",m),a.addEventListener("error",S),t&&(a.referrerPolicy=t),typeof r=="string"&&(a.crossOrigin=r),()=>{a.removeEventListener("load",m),a.removeEventListener("error",S)}},[a,r,t]),f}var F=j,M=C,P=q;const z=d.forwardRef(({className:e,...t},r)=>p.jsx(F,{ref:r,className:w("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));z.displayName=F.displayName;const J=d.forwardRef(({className:e,...t},r)=>p.jsx(M,{ref:r,className:w("aspect-square h-full w-full",e),...t}));J.displayName=M.displayName;const Q=d.forwardRef(({className:e,...t},r)=>p.jsx(P,{ref:r,className:w("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));Q.displayName=P.displayName;export{z as A,J as a,Q as b};
//# sourceMappingURL=avatar-BMEAZdBR.js.map
