Build 545032stable
Module 475152
9,553 characters · in f5739c4e2bea586d.jsDependencies
Required by (0)none
Lazily required by (0)none
Requires (57)
758417928207426031764700142703224640232835235986287809289873297413299072317097321073343686363195364522375708386467406704408278454719462887475825478840486020495544503698505527562153565645576705627968649963652215688810690521696451734057735438775602778712789645793574815807834730841549935208939249945810956703966327969043975732990078994500
Lazily requires (0)none
Source Raw
function(e,t,s){s.d(t,{default:()=>eh}),s(321073),s(142703);var n=s(627968),l=s(64700),i=s(503698),a=s.n(i),r=s(735438),o=s.n(r),d=s(317097),c=s(17928),u=s(990078),m=s(408278),h=s(224640),g=s(20742),j=s(462887),x=s(834730),p=s(939249),A=s(778712),f=s(789645),b=s(289873),N=s(475825),v=s(364522),M=s(565645),S=s(297413),C=s(966327),I=s(775602),R=s(793574),E=s(688810),T=s(235986),y=s(7584),_=s(478840),U=s(969043),k=s(386467),G=s(505527),w=s(299072),B=s(60317),L=s(406704),D=s(454719),H=s(975732),P=s(363195),z=s(495544),O=s(734057),W=s(696451),$=s(956703),Z=s(232835),V=s(576705),X=s(994500),q=s(287809),Q=s(486020),F=s(690521),K=s(562153),J=s(935208),Y=s(841549),ee=s(649963),et=s(815807);let es=(0,s(945810).mj)({name:"2026-02-reactions-click-to-profile",kind:"user",defaultConfig:{enabled:!1},variations:{1:{enabled:!0}}});var en=s(652215),el=s(375708),ei=s(343686),ea=s(818050);function er(e){return null==e.id?y.Ay.convertSurrogateToName(e.name):`:${e.name}:`}let eo=e=>{let{emoji:t,channelId:s,messageId:i}=e,[r,o]=l.useState(!0),[d,c]=l.useState([]),u=l.useMemo(()=>{if(null==d||d.length<1)return;let e=(0,B.eT)(t,d[0],s,{emojiSize:w.x.LARGE,messageId:i});return(0,n.jsx)(w.A,{className:ei.__invalid_effect,effect:e,emojiSize:w.x.LARGE,onComplete:()=>o(!1)})},[d,t,s,i]);return l.useEffect(()=>{let e=!1;return o(!0),!async function(){let s=await (0,F.D_)(t);Array.isArray(s)&&s.length>0&&!e&&c(s)}(),()=>{e=!0}},[t]),(0,n.jsxs)("div",{className:ei.sb,children:[u,(0,n.jsx)(M.A,{className:a()(ei.h_,{[ei.bD]:r}),emojiId:t.id,emojiName:t.name,animated:t.animated,size:"reaction"}),(0,n.jsx)(x.E,{variant:"text-md/medium",children:er(t)})]})},ed=l.memo(function(e){let{emoji:t,count:s,isSelected:i,setSelected:r,reactionType:o,colors:c}=e,m=l.useMemo(()=>er(t),[t]),h=l.useMemo(()=>{var e,s;let l;return e=ei.Zg,s=a()(ei.Zg,ei.at),null!=(l=null==t.id?F.Ay.getURL(t.name):Q.Ay.getEmojiURL({id:t.id,animated:t.animated,size:24}))&&""!==l?(0,n.jsx)("img",{className:e,src:l,alt:t.name}):(0,n.jsx)("span",{className:s,children:t.name})},[t]),g=o===G.v.BURST,j=g?el.t.VmiNjd:el.t["cNfs1/"],A=el.intl.formatToPlainString(j,{name:m,n:s}),f=l.useMemo(()=>{let e={};if(g){let{backgroundColor:t="",opacity:s=1}=c??{};i?(e.background=(0,d.xp)(t,s)??"",e.border=`1px solid ${(0,d.xp)(t,1.1*s)??""}`):(e.background=(0,d.xp)(t,.025)??"",e.border=`1px solid ${(0,d.xp)(t,.05)??""}`)}return e},[g,c,i]),b=l.useMemo(()=>{let e={};if(g){let{accentColor:t=""}=c??{};e.color=t}return e},[g,c]),N=l.useCallback(()=>{r({emoji:t,reactionType:o})},[t,o,r]);return(0,n.jsx)(u.m,{position:"left",__unsupportedReactNodeAsText:m,asContainer:!0,children:(0,n.jsxs)(p.D,{className:a()({[ei.X_]:!i,[ei.HS]:i}),"aria-label":A,"aria-selected":i,onClick:N,style:f,children:[h,(0,n.jsx)(x.E,{variant:"text-sm/bold",style:b,children:s})]})})});function ec(e){let{emoji:t,user:s,message:l,channel:i,guildId:r,reactionType:o,onRemoveReactor:d,clickToProfileEnabled:u}=e,{analyticsLocations:h}=(0,E.Ay)(R.A.MESSAGE_REACTIONS),g=(0,c.bG)([z.default],()=>z.default.getId()),j=(0,c.bG)([q.default],()=>q.default.getUser(s.id),[s]),b=(0,L.Id)(i),N=(0,c.bG)([V.A],()=>V.A.can(en.xBc.MANAGE_MESSAGES,i)&&b)||g===s.id,v=(0,c.bG)([W.Ay,O.A,X.A],()=>K.Ay.getName(r,i.id,s));async function M(){await (0,D.A)(s.id,s.getAvatarURL(r??void 0,80),{guildId:r??void 0,channelId:i.id}),(0,H.openUserProfileModal)({userId:s.id,guildId:r??void 0,channelId:i.id,messageId:l.id,sourceAnalyticsLocations:h})}function I(){ee.et({channelId:i.id,messageId:l.id,emoji:t,location:ee.qN.MESSAGE,userId:s.id,options:{burst:o===G.v.BURST}}),d?.()}return u?(0,n.jsxs)(T.A,{className:ei.Px,align:T.A.Align.CENTER,children:[(0,n.jsx)(p.D,{className:ei.Z7,onClick:M,onContextMenu:e=>(0,Y.wQ)(e,s,i),children:(0,n.jsxs)(T.A,{align:T.A.Align.CENTER,children:[(0,n.jsx)(T.A.Child,{wrap:!0,grow:0,shrink:0,className:ea.Gf,children:(0,n.jsx)(C.A,{"aria-hidden":!0,user:j??s,size:A._3.SIZE_32})}),(0,n.jsxs)(T.A.Child,{className:ei.Bi,children:[(0,n.jsx)(x.E,{tag:"strong",variant:"text-md/medium",className:ei.UU,children:null!=v&&""!==v&&(0,n.jsx)("span",{className:ei.Ci,children:v})}),(0,n.jsx)(S.A,{user:s,className:null!=v&&""!==v?ei.rW:null,usernameClass:a()(ei.Xh,ei.Ci),discriminatorClass:ei.D2,forceUsername:!0})]})]})}),N&&(0,n.jsx)("div",{className:ei.TF,children:(0,n.jsx)(m.K,{onClick:I,"aria-label":el.intl.string(el.t["+BdaDn"]),icon:f.P,size:"sm",variant:"icon-only"})})]}):(0,n.jsxs)(T.A,{className:ei.Px,onContextMenu:e=>(0,Y.wQ)(e,s,i),align:T.A.Align.CENTER,tabIndex:0,"aria-label":s.username,children:[(0,n.jsx)(T.A.Child,{wrap:!0,grow:0,shrink:0,className:ea.Gf,children:(0,n.jsx)(C.A,{user:j??s,size:A._3.SIZE_32})}),(0,n.jsxs)(T.A.Child,{className:ei.Bi,children:[(0,n.jsx)(x.E,{tag:"strong",variant:"text-md/medium",className:ei.UU,children:null!=v&&""!==v&&(0,n.jsx)("span",{className:ei.Ci,children:v})}),(0,n.jsx)(S.A,{user:s,className:null!=v&&""!==v?ei.rW:null,usernameClass:a()(ei.Xh,ei.Ci),discriminatorClass:ei.D2,forceUsername:!0})]}),N&&(0,n.jsx)("div",{className:ei.TF,children:(0,n.jsx)(m.K,{onClick:I,"aria-label":el.intl.string(el.t["+BdaDn"]),icon:f.P,size:"sm",variant:"icon-only"})})]})}class eu extends l.PureComponent{scrollerRef=l.createRef();state={lastId:null,loadingMore:!0};componentDidMount(){this.loadMore()}componentDidUpdate(e){o().isEqual(this.props.reaction,e.reaction)&&this.props.reactionType===e.reactionType||this.setState({lastId:null,loadingMore:!1},()=>this.loadMore())}handleScroll=()=>{let{current:e}=this.scrollerRef;if(null==e)return;let t=e.getScrollerState();t.scrollTop+t.offsetHeight>=t.scrollHeight-52&&this.props.hasMore&&!this.state.loadingMore&&this.loadMore()};loadMore(){let{message:e,reaction:t,reactionType:s}=this.props,{lastId:n}=this.state;this.setState({loadingMore:!0}),ee.ao({channelId:e.getChannelId(),messageId:e.id,emoji:t.emoji,limit:en.WxW,after:n,type:s}).then(e=>this.setState({loadingMore:!1,lastId:e[e.length-1]?.id}))}renderSection(){return null}getRowHeight=(e,t)=>{let{reactors:s}=this.props;return 1===e?52*(0===t):52*(0===e&&(0===t&&0===s.length||null!=this.props.reactors[t]))};renderRow=e=>{let{section:t,row:s}=e,{message:l,guildId:i,channel:a,reaction:r,reactors:o,reactionType:d,clickToProfileEnabled:c}=this.props,u=o[s];return 1===t?0===s?(0,n.jsx)(b.y,{className:ei.u1},"hasMore"):null:0===o.length&&this.state.loadingMore?(0,n.jsx)(b.y,{className:ei.u1},"loadingMore"):null!=u&&(0,n.jsx)(ec,{message:l,emoji:r.emoji,guildId:i,channel:a,user:u,reaction:r,reactionType:d,clickToProfileEnabled:c},u.id)};render(){let{hasMore:e,reactors:t,reaction:s,message:l,reactionType:i}=this.props,a=[];return 0===t.length&&this.state.loadingMore?a.push(1):(a.push(t.length),e&&a.push(1)),(0,n.jsxs)("div",{className:ei.Ro,children:[i===G.v.BURST&&(0,n.jsx)(eo,{emoji:s.emoji,channelId:l.getChannelId(),messageId:l.id}),(0,n.jsx)(N.Ei,{className:ei.OV,fade:!0,ref:this.scrollerRef,sections:a,sectionHeight:0,rowHeight:this.getRowHeight,renderRow:this.renderRow,renderSection:this.renderSection,onScroll:e?this.handleScroll:void 0})]})}}let em=c.Ay.connectStores([$.A],e=>{let{message:t,reaction:s,reactionType:n}=e,l=$.A.getReactions(t.getChannelId(),t.id,s.emoji,en.WxW,n);if(null==l)return{reactors:[],hasMore:!1};let i=Array.from(l.values()),a=(n===G.v.BURST?s.burst_count:s.count)>i.length;return{reactors:i,hasMore:a}})(eu);function eh(e){let{message:t,selectedReaction:s,onClose:i,transitionState:a,"aria-label":r=el.intl.string(el.t.gHp0C4)}=e,o=(0,c.bG)([O.A],()=>O.A.getChannel(t.getChannelId())),d=o?.getGuildId(),{enabled:u}=es.useConfig({location:"MessageReactions"}),m=(0,c.bG)([Z.A,U.A],()=>{let e=Z.A.getMessage(t.getChannelId(),t.id)??U.A.getMessage(J.default.castMessageIdAsChannelId(t.id))?.firstMessage;return null!=e?e.reactions:[]},[t]),x=l.useMemo(()=>{let e=[];return m.forEach(t=>{t.burst_count>0&&e.push({...t,count:0}),t.count>0&&e.push({...t,burst_count:0})}),e.sort((e,t)=>{let s=e.burst_count>0?e.burst_count:e.count;return(t.burst_count>0?t.burst_count:t.count)-s}),e},[m]),p=x[0],[A,f]=function(e,t,s){let[n,i]=l.useState(e??t);return l.useEffect(()=>{null!=n&&null==s.find(e=>{let t=null!=e.me_vote?G.v.VOTE:e.burst_count>0?G.v.BURST:G.v.NORMAL,s=(0,et.i6)(e.emoji,n.emoji),l=t===n.reactionType;return s&&l})&&i(t)},[n,i,s,t]),[n,i]}(s,null!=p?{emoji:p.emoji,reactionType:p.burst_count>0?G.v.BURST:G.v.NORMAL}:null,x),N=l.useMemo(()=>null==A?null:m.find(e=>(0,et.i6)(e.emoji,A.emoji))??null,[m,A]),M=(0,c.bG)([I.A],()=>I.A.saturation),S=(0,c.bG)([P.A],()=>(0,j.M)(P.A.theme));if(l.useEffect(()=>{(0===m.length||null==A&&null==N)&&setImmediate(i)},[i,m.length,N,A]),null==A||null==N)return(0,n.jsx)(b.y,{});if(null==o)throw Error("MessageReactions.render: Message does not have a channelId");return(0,n.jsx)(k.A.Provider,{value:d??void 0,children:(0,n.jsxs)(h.d,{transitionState:a,size:"md",onClose:i,"aria-label":r,children:[(0,n.jsx)(g.rQ,{title:el.intl.string(el.t.gHp0C4)}),(0,n.jsx)("div",{className:ei.jH}),(0,n.jsxs)("div",{className:ei.kL,children:[(0,n.jsx)(v.Ip,{className:ei.XG,fade:!0,children:x.map(e=>{let t=e.burst_count>0;return(0,n.jsx)(ed,{isSelected:eg(A,e,t?G.v.BURST:G.v.NORMAL),setSelected:f,reactionType:t?G.v.BURST:G.v.NORMAL,emoji:e.emoji,count:t?e.burst_count:e.count,colors:null!=e.burst_colors?(0,_.V)(e.burst_colors,M,S):void 0},`${t?"burst-":"normal-"}${e.emoji.id??""}:${e.emoji.name}`)})}),(0,n.jsx)(em,{message:t,reaction:N,guildId:d,channel:o,reactionType:A.reactionType,clickToProfileEnabled:u})]})]})})}let eg=(e,t,s)=>o().isEqual(e.emoji,t.emoji)&&e.reactionType===s}