Module 805945

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