Build 533169stable
Module 261056
1,812 characters · in no known chunkDependencies
Source Raw
function(e,t,n){"use strict";n.d(t,{A:()=>I});var r=n(627968),i=n(64700),s=n(311907),a=n(827734),o=n(397927),l=n(475743),u=n(775602),c=n(21161),d=n(430363),_=n(659416),f=n(823854),p=n(692593);let h=4e3,m=250,E=4,g=2;function A(e){let{userId:t,wrapperClassName:n,children:d}=e,A=(0,s.bG)([f.A],()=>f.A.getProgressForUserId(t),[t]),I=(0,s.bG)([f.A],()=>{let e=f.A.getTrackingEntryForUserId(t);return e?.presence?.phase===_.Ob.COMPLETED},[t]),T=(0,s.bG)([u.A],()=>u.A.useReducedMotion),S=(0,l.A)(A),y=(0,l.A)(I),{createMultipleConfettiAt:v}=i.useContext(c.x),N=(0,o.rdh)(a.A.colors.INTERACTIVE_BACKGROUND_HOVER).hex(),C=(0,o.rdh)(a.A.colors.INTERACTIVE_TEXT_ACTIVE).hex(),R=(0,o.rdh)(a.A.colors.CONTROL_BRAND_FOREGROUND).hex(),O=i.useRef(0),b=i.useRef(null),D=Math.max(0,Math.min(1,A??0)),L=D>=1?R:C,w=i.useMemo(()=>({backgroundImage:`conic-gradient(${L} ${Math.round(360*D)}deg, ${N} 0deg)`}),[D,L,N]),M=i.useMemo(()=>({size:{type:"static-random",minValue:E-g,maxValue:E+g},velocity:{type:"static-random",minValue:{x:-120,y:-140},maxValue:{x:120,y:-260}}}),[]),P=i.useCallback(()=>{if(T)return;let e=b.current?.getBoundingClientRect();null!=e&&v(e.left+e.width/2,e.top+e.height/2,M,m)},[M,v,T]);i.useEffect(()=>{T||(S??0)<1&&D>=1&&P()},[D,P,S,T]),i.useEffect(()=>{T||!0!==I||!0!==y&&P()},[P,I,y,T]);let x=i.useCallback(()=>{if(T||D<1)return;let e=Date.now();e-O.current<h||(O.current=e,P())},[D,P,T]);return(0,r.jsx)("div",{className:n,onMouseEnter:x,children:(0,r.jsxs)("div",{ref:b,className:p.R,children:[(0,r.jsx)("div",{className:p.h,style:w}),d]})})}function I(e){let{userId:t,wrapperClassName:n,children:i}=e,a=(0,d.Uk)("VoiceDareAvatarRing"),o=(0,s.bG)([f.A],()=>f.A.hasVoiceDareForUserId(t),[t]);return a&&o?(0,r.jsx)(A,{userId:t,wrapperClassName:n,children:i}):(0,r.jsx)("div",{className:n,children:i})}}