Build 589089stable
Module 445913
1,929 characters · in f775fa8554dc0472.js, 21a2377b7ee529e6.jsDependencies
Source Raw
function(e,r,s){s.d(r,{A:()=>R});var t,a=s(477900),n=s(582128),c=s(17928),u=s(661531),i=s(602853),l=s(475743),o=s(775602),E=s(21161),d=s(430363),A=((t={})[t.OFFERED=0]="OFFERED",t[t.ACCEPTED=1]="ACCEPTED",t[t.RUNNING=2]="RUNNING",t[t.COMPLETED=3]="COMPLETED",t[t.FAILED=4]="FAILED",t[t.CANCELLED=5]="CANCELLED",t),C=s(823854),h=s(714089);function N(e){let{userId:r,wrapperClassName:s,children:t}=e,d=(0,c.bG)([C.A],()=>C.A.getProgressForUserId(r),[r]),N=(0,c.bG)([C.A],()=>{let e=C.A.getTrackingEntryForUserId(r);return e?.presence?.phase===A.COMPLETED},[r]),R=(0,c.bG)([o.Ay],()=>o.Ay.useReducedMotion),D=(0,l.Ay)(d),m=(0,l.Ay)(N),{createMultipleConfettiAt:x}=n.useContext(E.x),p=(0,i.r)(u.A.colors.INTERACTIVE_BACKGROUND_HOVER).hex(),I=(0,i.r)(u.A.colors.INTERACTIVE_TEXT_ACTIVE).hex(),T=(0,i.r)(u.A.colors.CONTROL_BRAND_FOREGROUND).hex(),g=n.useRef(0),f=n.useRef(null),y=Math.max(0,Math.min(1,d??0)),O=y>=1?T:I,F=n.useMemo(()=>({backgroundImage:`conic-gradient(${O} ${Math.round(360*y)}deg, ${p} 0deg)`}),[y,O,p]),L=n.useMemo(()=>({size:{type:"static-random",minValue:2,maxValue:6},velocity:{type:"static-random",minValue:{x:-120,y:-140},maxValue:{x:120,y:-260}}}),[]),M=n.useCallback(()=>{if(R)return;let e=f.current?.getBoundingClientRect();null!=e&&x(e.left+e.width/2,e.top+e.height/2,L,250)},[L,x,R]);n.useEffect(()=>{R||(D??0)<1&&y>=1&&M()},[y,M,D,R]),n.useEffect(()=>{R||!0!==N||!0!==m&&M()},[M,N,m,R]);let V=n.useCallback(()=>{if(R||y<1)return;let e=Date.now();e-g.current<4e3||(g.current=e,M())},[y,M,R]);return(0,a.jsx)("div",{className:s,onMouseEnter:V,children:(0,a.jsxs)("div",{ref:f,className:h.R,children:[(0,a.jsx)("div",{className:h.h,style:F}),t]})})}function R(e){let{userId:r,wrapperClassName:s,children:t}=e,n=(0,d.Uk)("VoiceDareAvatarRing"),u=(0,c.bG)([C.A],()=>C.A.hasVoiceDareForUserId(r),[r]);return n&&u?(0,a.jsx)(N,{userId:r,wrapperClassName:s,children:t}):(0,a.jsx)("div",{className:s,children:t})}}