Loading
function(e,t,n){"use strict";n.d(t,{dT:()=>q,Ay:()=>J});var l=n(627968),i=n(64700),s=n(503698),r=n.n(s),a=n(837381),o=n(17928),u=n(451988),c=n(661531),d=n(990078),m=n(939249),h=n(983851),p=n(27232),f=n(505930),g=n(782134),E=n(194261),A=n(307301),C=n(834730),x=n(890856),I=n(565645),_=n(775602),S=n(688810),y=n(21161),v=n(850992),T=n(319993),N=n(735438),j=n(835245),b=n(104142),R=n(407781),P=n(287809),L=n(194486),M=n(651175);let O=i.forwardRef(function(e,t){let{sound:n,containerDimensions:s}=e,r=(0,o.bG)([P.default],()=>P.default.getCurrentUser()),a=(0,o.bG)([_.Ay],()=>_.Ay.useReducedMotion),[u,c]=i.useState([]),d=u.length<50,m=n?.emojiId!=null||n?.emojiName!=null,h=i.useCallback(()=>{if(!a&&d&&m&&null!=r){let e=(0,b.Br)({id:n.emojiId,name:n.emojiName??"",animated:!1}),t=null!=n.emojiId,l=L.B.PREMIUM,i=(0,N.random)(b.Bf[l].length,!1),s={id:(0,j.A)(),animationId:i,animationType:l,shouldResize:t,url:e,userId:r.id};c(e=>[...e,s])}},[a,d,m,r,n]);i.useImperativeHandle(t,()=>({addAnimation:h}));let p=i.useCallback(e=>{c(t=>{let n=[...t],l=n.findIndex(t=>t.id===e);return n.splice(l,1),n})},[]);return a||!m?null:(0,l.jsx)("div",{className:M.z,style:{width:s.width,height:s.height},children:u.map(e=>(0,l.jsx)(R.A,{containerDimensions:s,effect:e,onComplete:p},e.id))})});var w=n(885386),k=n(967198),D=n(174459),U=n(796774),G=n(209932),F=n(807348),V=n(813564),B=n(792348),H=n(496502),W=n(652215),K=n(536283),Y=n(257645),z=n(375708),Z=n(757718);function q(e){let{disabled:t=!1,onClick:n,text:i,children:s,tooltipPosition:a="top",ref:o}=e;return(0,l.jsx)(d.m,{text:i,position:a,children:(0,l.jsx)(m.D,{innerRef:o,"aria-label":i,className:r()(Z.zr,{[Z.$9]:t}),onClick:n,children:s})})}function $(e){let{sound:t,disabled:n=!1}=e,{analyticsLocations:s}=(0,S.Ay)(),a=(0,o.bG)([G.A],()=>G.A.isFavoriteSound(t.soundId),[t.soundId]),u=i.useCallback(e=>{e.stopPropagation(),e.currentTarget.blur(),a?(0,U.eS)(t.soundId):((0,V.Ni)({sound:t,location:{...s,object:W.ZSU.SOUNDBOARD_SOUND}}),(0,U.Rp)(t.soundId))},[a,t,s]);return(0,l.jsx)(q,{disabled:n,onClick:u,text:z.intl.formatToPlainString(a?z.t.lQLsjc:z.t.Y5DOs4,{emojiName:t.emojiName,soundName:t.name}),children:a?(0,l.jsx)(p.G,{size:"xs",className:r()(Z.Wo,Z.gj),color:c.A.unsafe_rawColors.PLATFORM_GOLD.css}):(0,l.jsx)(f.y,{size:"xs",color:"currentColor",className:Z.Wo})})}let J=i.forwardRef(function(e,t){var n,s,c;let m,{sound:p,channel:f,containerClassName:S,className:N,focused:j,forceSecondaryActions:b=!1,interactive:R=!0,enableSecondaryActions:L=!1,suppressPlaySound:M,onMouseEnter:U,onSelectItem:G,analyticsLocations:J,buttonOverlay:X=F.If.PLAY,showLockForDisabledSound:Q=!0,inNitroLockedSection:ee=!1,isAnimated:et=!0,isPlayingSoundOverride:en,isSoundmoji:el,soundmojiVisualEffectRef:ei,tooltipOverride:es,...er}=e,{name:ea,emojiId:eo,emojiName:eu}=p,ec=(0,o.bG)([P.default],()=>P.default.getCurrentUser()),ed=(0,H.v)(p,f?.guild_id),{playSoundboardSound:em,previewSound:eh,isPlayingSound:ep}=(0,B.A)(p,f?.id??null,(el?w.HO.getSetting():w.dG.getSetting()?.volume)??100,!el&&f?.isVocal()?Y.a.VOICE:Y.a.DEFAULT),{createMultipleConfettiAt:ef}=i.useContext(y.x),eg=i.useRef(null),eE=(n=p.soundId,s=eg.current,i.useMemo(()=>{if(null==s||"1"!==n)return{x:0,y:0};let e=s.getBoundingClientRect();return{x:e.left+e.width/2,y:e.top+e.height/2}},[s,n])),eA=(0,o.bG)([_.Ay],()=>_.Ay.useReducedMotion),eC=i.useRef(.01),ex=i.useRef(new u.IX),eI="1"===p.soundId,e_=`sound-${p.soundId}`,eS=(0,a.rm)(e_),ey=null!=eo||null!=eu,ev=!(0,V.Ir)(ec,p,f)&&!el,eT=b||L&&!ev,eN=v.LW.useStore().bottomPosition??0,ej=eg.current?.getBoundingClientRect().bottom??0,[eb,eR]=i.useState(!1),eP=i.useCallback(()=>{eR(!0)},[]),eL=i.useCallback(()=>{eR(!1)},[]),eM=ev&&Q;function eO(e){(eI&&!eA&&(eC.current=Math.min(eC.current+.01,.1),Math.random()<eC.current&&ef(eE.x,eE.y,void 0,void 0,{sprite:K.dR})),null!=G)?G(e):M||em(J)}let ew=(0,l.jsx)("div",{onMouseEnter:eP,onMouseLeave:eL,children:function(e){let{sound:t,previewSound:n,disabled:i=!1,tooltipPosition:s="top"}=e,r=(0,o.bG)([k.A],()=>k.A.getGuildId());return(0,l.jsx)(q,{tooltipPosition:s,disabled:i,onClick:function(e){D.default.track(W.HAw.EXPRESSION_PICKER_SOUNDBOARD_SOUND_PREVIEWED,{sound_id:t.soundId,sound_name:t.name,sound_guild_id:t.guildId,location_guild_id:r}),e.stopPropagation(),e.currentTarget.blur(),n()},text:z.intl.formatToPlainString(z.t["/8fYO5"],{emojiName:t.emojiName,soundName:t.name}),children:(0,l.jsx)(h.H,{size:"md",color:"currentColor",className:Z.Wo})})}({sound:p,previewSound:eh,disabled:ev&&!b})});function ek(e){return M||ev?eM?(0,l.jsx)(E.X,{size:"xs",color:"currentColor",className:r()(Z.C4,Z.hz,e,{[Z.hn]:ey})}):null:(0,l.jsx)(g.u,{size:"xs",color:"currentColor",className:r()(Z.C4,e)})}let eD=(0,l.jsx)("div",{onMouseEnter:eP,onMouseLeave:eL,children:(0,l.jsx)($,{sound:p,disabled:!R&&!b})});i.useEffect(()=>{let e=ex.current;return eI&&e.start(1e3,()=>{eC.current=Math.max(eC.current-.01,.01)}),()=>e.stop()},[eI]);let eU=(c=eg.current,null==(m=c?.parentElement?.getBoundingClientRect())?{width:0,height:0}:{width:m.width,height:m.height});return(0,l.jsxs)("li",{ref:t,className:r()(Z.H,S),onMouseEnter:U,children:[(0,l.jsx)(d.m,{"aria-label":null!=es?p.name:void 0,__unsupportedReactNodeAsText:es??p.name,position:ej+50>eN?"top":"bottom",shouldShow:!eb,delay:500,children:(0,l.jsxs)(x.s,{...er,buttonProps:{...eS,id:e_,role:"button"},"aria-label":z.intl.formatToPlainString(z.t.tuMUJ2,{emojiName:p.emojiName,soundName:p.name}),className:r()(Z.aG,{[Z.CS]:et,[Z.he]:en??ep,[Z.ju]:M,[Z.wT]:R,[Z.$9]:!R&&!b,[Z.Au]:ev&&!b,[Z.fx]:!R&&b,[Z.in]:R&&j},N),onClick:e=>{eO?.(e)},onContextMenu:L&&!ev?ed:void 0,children:[(0,l.jsxs)("div",{className:r()(Z.KM,{[Z.hn]:ey}),"aria-hidden":!0,ref:eg,children:[ey&&(0,l.jsx)(I.A,{emojiId:eo,emojiName:eu,className:Z.Zg}),(0,l.jsx)(C.E,{variant:"text-xs/medium",color:R?void 0:"text-muted",className:r()(Z.TW,{[Z.hn]:ey}),children:ea})]}),function(){switch(X){case F.If.ADD:return(0,l.jsxs)("div",{className:Z.ec,children:[(0,l.jsx)("div",{className:Z.LQ}),(0,l.jsxs)("div",{className:Z.O5,children:[ew,(0,l.jsxs)("div",{className:Z.c9,children:[(0,l.jsx)(A.j,{size:"md",color:"currentColor",className:Z.y_}),(0,l.jsx)(C.E,{variant:"text-xs/medium",color:"text-strong",children:z.intl.string(z.t.QqqXLY)})]}),eT&&eD]})]});case F.If.NONE:return null;case F.If.PLAY:case F.If.SOUNDMOJI:default:return eM&&!ee?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:Z.LQ}),ek(Z.B3),(0,l.jsx)("div",{className:Z.d7,children:(0,l.jsxs)("div",{className:Z.O5,children:[eT&&ew,eT&&eD]})})]}):(0,l.jsxs)("div",{className:Z.d7,children:[(0,l.jsx)("div",{className:r()({[Z.LQ]:!M})}),(0,l.jsx)("div",{className:Z.O5,children:X===F.If.SOUNDMOJI?(0,l.jsx)(T.Ay,{sound:p,channel:f,setTooltipShowing:eR}):(0,l.jsxs)(l.Fragment,{children:[eT&&ew,ek(),eT&&eD]})})]})}}()]})}),!p.available&&(0,l.jsx)(d.m,{text:z.intl.string(z.t.MDOXJR),shouldShow:!eb,children:(0,l.jsx)("div",{className:Z.ET,children:!ee&&(0,l.jsxs)("div",{className:Z.ld,children:[ew,eD]})})}),!0===el&&(0,l.jsx)(O,{sound:p,containerDimensions:eU,ref:ei})]})})}