Loading
function(e,l,t){t.d(l,{A:()=>A,s:()=>a});var n,r=t(17928),s=t(228366),i=t(967198),o=t(977997),a=((n={}).GENTLE_AMBIENT="GENTLE_AMBIENT",n.GENTLE_AMBIENT_WITH_INTRO="GENTLE_AMBIENT_WITH_INTRO",n.HIGH_CONTRAST="HIGH_CONTRAST",n);let E={},d={},c=null;function u(e){null!=d[e]&&(clearTimeout(d[e]),delete d[e])}function _(e){u(e),d[e]=setTimeout(()=>{let l=E[e];null!=l&&(E[e]={...l,style:"GENTLE_AMBIENT"},h.emitChange()),delete d[e]},2e3)}function I(){for(let e of Object.keys(d))clearTimeout(d[e]);d={},E={}}function T(){return I(),!0}class N extends r.Ay.Store{static displayName="VoiceChannelAnimationStateStore";initialize(){this.waitFor(o.A,i.A)}getAnimationStyle(e){return E[e]?.style??"GENTLE_AMBIENT"}getUserCount(e){return E[e]?.userCount??0}}let h=new N(s.h,{VOICE_STATE_UPDATES:function(e){let{voiceStates:l}=e,t=i.A.getGuildId();t!==c&&null!=t&&(c=t);let n={};for(let e of l)e.guildId===t&&(null!=e.oldChannelId&&(n[e.oldChannelId]=(n[e.oldChannelId]??0)-1),null!=e.channelId&&(n[e.channelId]=(n[e.channelId]??0)+1));let r=!1;for(let[e,l]of Object.entries(n))(function(e,l){let t=E[e],n=t?.userCount??0,r=Math.max(0,n+l);return 0===n&&r>0?(E[e]={style:"GENTLE_AMBIENT_WITH_INTRO",userCount:r},_(e),!0):n>0&&r>n?(E[e]={style:"HIGH_CONTRAST",userCount:r},_(e),!0):0===r?(u(e),delete E[e],!0):null!=t&&r!==n&&(E[e]={...t,userCount:r},!0)})(e,l)&&(r=!0);return r},CHANNEL_SELECT:function(e){let{guildId:l}=e;if(l===c||null==l)return!1;c=l,I();let t=o.A.getVoiceStates(l),n={};for(let e of Object.values(t))null!=e.channelId&&(n[e.channelId]=(n[e.channelId]??0)+1);for(let[e,l]of Object.entries(n))l>0&&(E[e]={style:"GENTLE_AMBIENT",userCount:l});return!0},CONNECTION_OPEN:T,LOGOUT:T}),A=h}