Loading
function(e,t,n){"use strict";n.d(t,{A:()=>n5}),n(321073);var l,i,s=n(627968),r=n(64700),a=n(503698),o=n.n(a),u=n(111956),c=n.n(u),d=n(788413),m=n(17928),h=n(554146),p=n(319060),f=n(305866),g=n(554375),E=n(820284),A=n(212245),C=n(964486),x=n(793574),I=n(95561),_=n(688810),S=n(379848),y=n(159273),v=n(989349),T=n.n(v),N=n(228366),j=n(935208);let b={lastSeenNewlyAddedEmojiIds:{}},R=b,P={};function L(){for(let e in P)R.lastSeenNewlyAddedEmojiIds[e]=P[e]}class M extends m.Ay.PersistedStore{static displayName="NewlyAddedEmojiStore";static persistKey="NewlyAddedEmojiStore";static migrations=[e=>{let t=e.lastSeenNewlyAddedEmojiIds,n={};for(let e in t){let l=t[e];n[e]={id:l,lastSeen:Date.now(),acknowledged:!1}}return{lastSeenNewlyAddedEmojiIds:n}}];initialize(e){R=e??b}getState(){return R}getLastSeenEmojiByGuild(e){return R.lastSeenNewlyAddedEmojiIds[e]}isNewerThanLastSeen(e,t){if(null==e||null==t)return!1;let n=this.getLastSeenEmojiByGuild(e);if(null==n||j.default.compare(t,n.id)>0)return!0;{let e=T()(n.lastSeen);return T()().isBefore(e.add(2,"weeks"))&&!n.acknowledged}}}let O=new M(N.h,{LOGOUT:function(){R=b,P={}},NEWLY_ADDED_EMOJI_SEEN_ACKNOWLEDGED:function(e){let{guildId:t,emojiId:n}=e,l=P[t]??R.lastSeenNewlyAddedEmojiIds[t];null==l||0>j.default.compare(l.id,n)?P[t]={id:n,lastSeen:Date.now(),acknowledged:!0}:P[t]={...l,acknowledged:!0}},NEWLY_ADDED_EMOJI_SEEN_PENDING:function(e){let{guildId:t,emojiId:n}=e,l=P[t]??R.lastSeenNewlyAddedEmojiIds[t];(null==l||0>j.default.compare(l.id,n))&&(P[t]={id:n,lastSeen:Date.now(),acknowledged:!1})},NEWLY_ADDED_EMOJI_SEEN_UPDATED:L,CLEAR_CACHES:function(){R=b,L()},CONNECTION_CLOSED:L});var w=n(451731),k=n(850992),D=n(151271),U=n(60587),G=n(464651),F=n(562708),V=n(462887),B=n(939249),H=n(789645),W=n(696986),K=n(534514),Y=n(834730),z=n(736653),Z=n(139286),q=n(976860),$=n(71393),J=n(384684),X=n(985242),Q=n(652215),ee=n(746080),et=n(375708),en=n(271019);function el(e){let t,{onClose:l,guildId:i,emojiId:r}=e,a=(t=(0,z.Ay)(),(0,V.q)(t)?n(454333):n(674463)),{analyticsLocations:o}=(0,_.Ay)(x.A.GUILD_ROLE_SUBSCRIPTION_EMOJI_PICKER_UPSELL);(0,Z.A)({type:F.ImpressionTypes.MODAL,name:F.ImpressionNames.ROLE_SUBSCRIPTION_EMOJI_UPSELL,properties:{location_stack:o,emoji_guild_id:i,emoji_id:r??null}});let u=(0,m.bG)([$.A],()=>$.A.getGuild(i)),c=(0,m.bG)([J.A],()=>null!=i&&J.A.getUserSubscriptionRoles(i).size>0),d=c?et.intl.string(et.t.GoLM9z):et.intl.formatToPlainString(et.t["h0u/Hi"],{serverName:u?.name}),h=c?et.intl.string(et.t.PjZ7Db):et.intl.string(et.t.p8FG1D);return(0,s.jsxs)("div",{className:en.kL,children:[(0,s.jsx)("div",{className:en.Tp}),(0,s.jsxs)("div",{className:en.Qs,children:[(0,s.jsx)(B.D,{className:en.b,"aria-label":et.intl.string(et.t.cpT0Cq),onClick:l,children:(0,s.jsx)(H.P,{size:"xs",color:"currentColor","aria-label":et.intl.string(et.t.cpT0Cq),className:en.yP})}),(0,s.jsx)("img",{alt:"",src:a,className:en.Tn}),(0,s.jsx)(W.h,{size:22}),(0,s.jsx)(K.D,{color:"text-strong",variant:"heading-lg/extrabold",className:en.wx,children:et.intl.string(et.t.cBjkcx)}),(0,s.jsx)(W.h,{size:4}),(0,s.jsx)(Y.E,{color:"text-default",variant:"text-md/normal",className:en.h_,children:d}),(0,s.jsx)(W.h,{size:24}),(0,s.jsx)(X.A,{text:h,onClick:function(){(0,q.pX)(Q.BVt.CHANNEL(i,ee.VV.ROLE_SUBSCRIPTIONS),{sourceLocationStack:o})}})]})]})}var ei=n(450510),es=n(885386),er=n(808728),ea=n(287809),eo=n(174459),eu=n(474090),ec=n(240248),ed=n(822123),em=n(734057),eh=n(309010),ep=n(690521),ef=n(818645),eg=n(316884),eE=n(307731),eA=n(698279);function eC(e){let{intention:t,containerWidth:n,rowSize:l,isBurstReaction:i,analyticsObject:s}=e,r=em.A.getChannel(eh.A.getChannelId()),a=r?.getGuildId(),o=t===eE.EmojiIntention.REACTION?y.Ay.emojiReactionFrecencyWithoutFetchingLatest.frequently.slice():y.Ay.emojiFrecencyWithoutFetchingLatest.frequently.slice(),u=null!=r?y.Ay.getDisambiguatedEmojiContext(r.getGuildId()).favoriteEmojisWithoutFetchingLatest:[],c=t===eE.EmojiIntention.REACTION?y.Ay.emojiReactionFrecencyWithoutFetchingLatest.numFrequentlyItems:y.Ay.emojiFrecencyWithoutFetchingLatest.numFrequentlyItems,d=o.slice(0,c),m=null!=a?y.Ay.getGuildEmoji(a):[],h=y.Ay.getDisambiguatedEmojiContext(r?.getGuildId()).getCustomEmoji(),{topEmojis:p,newlyAddedEmojis:f}=(0,eg.b)({guildId:r?.getGuildId(),pickerIntention:t}),{visibleTopEmojis:g,visibleNewlyAddedEmojis:E}=(0,ef.W)({topEmojis:p,newlyAddedEmojis:f,rowSize:l});I.Ay.trackWithMetadata(t===eE.EmojiIntention.REACTION?Q.HAw.REACTION_PICKER_OPENED:Q.HAw.EXPRESSION_PICKER_OPENED,{width:n,tab:eA.kx.EMOJI,badged:!1,num_expressions_favorites:u.length,num_animated_expressions_favorites:u.filter(e=>e?.animated).length,num_custom_expressions_favorites:u.filter(ep.Ay.isCustomEmoji).length,num_standard_expressions_favorites:u.filter(e=>null==e.id).length,num_expressions_frecent:d.length,num_animated_expressions_frecent:d.filter(e=>e?.animated).length,num_custom_expressions_frecent:d.filter(ep.Ay.isCustomEmoji).length,num_standard_expressions_frecent:d.filter(e=>null==e.id).length,num_current_guild_expressions:m.length,num_custom_expressions_total:h.size,num_expressions_top_server:g.length,num_animated_expressions_top_server:g.filter(e=>e.animated).length,num_expressions_newly_added:E.length,num_animated_expressions_newly_added:E.filter(e=>e.animated).length,...t===eE.EmojiIntention.REACTION&&{is_burst:i},...null!=s&&{location_object:s}})}var ex=n(403581),eI=n(775602),e_=n(607470),eS=n(422936),ey=n(234419),ev=n(725807),eT=n(811611),eN=n(788868),ej=n(151867);function eb(e){let{onDismiss:t}=e,n=(0,m.bG)([eI.Ay],()=>eI.Ay.useReducedMotion),l=et.intl.string(et.t.eikz43),i=(0,ey.V)(),r=(0,eS.O)(),a=i?.subscription_trial!=null||null!=r,u={object:Q.ZSU.BUTTON_CTA,section:Q.JJy.SUPER_REACTION_PICKER};return(0,s.jsxs)("div",{className:ej.iE,children:[(0,s.jsx)(B.D,{onClick:t,className:ej.b,"aria-label":et.intl.string(et.t.WAI6xu),children:(0,s.jsx)(H.P,{size:"md",color:"currentColor"})}),(0,s.jsxs)("div",{className:ej.Qs,children:[(0,s.jsx)("div",{className:ej.jo,children:(0,s.jsx)(e_.A,{className:o()(ej.vK,{[ej.Vk]:a}),src:"https://cdn.discordapp.com/assets/22_211_SuperReactions_GTM_Hero_v09.mp4",loop:!0,autoPlay:!n,muted:!0,controls:!0,disablePictureInPicture:!0})}),a?(0,s.jsx)(eT.Ay,{type:eN.e.BURST_REACTION_QUICK_ACTION_UPSELL,subscriptionTier:i?.subscription_trial?.sku_id??eN.pe.TIER_2,headingText:et.intl.string(et.t.Wfl5zp),analyticsLocationObject:u,discountOffer:r,trialOffer:i,children:l}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:ej.wx,children:[(0,s.jsx)(ex.t,{size:"custom",color:"currentColor",className:ej.ax,width:32,height:32}),(0,s.jsx)(K.D,{className:ej.TK,variant:"heading-xl/bold",children:et.intl.string(et.t.Wfl5zp)})]}),(0,s.jsx)(Y.E,{className:ej.Fb,variant:"text-md/normal",children:l}),(0,s.jsx)("div",{className:ej.sk,children:(0,s.jsx)(ev.A,{subscriptionTier:eN.pe.TIER_2,textOptions:{textOverride:et.intl.string(et.t.sEAnVH)}})})]})]})]})}var eR=n(735438),eP=n.n(eR),eL=n(837381),eM=n(460905),eO=n(802019),ew=n(407698),ek=n(531685),eD=n(406810),eU=n(27232),eG=n(369606),eF=n(413249),eV=n(141060),eB=n(687966),eH=n(115979),eW=n(524501),eK=n(926268),eY=n(138134),ez=n(7807),eZ=n(732139);let eq=r.memo(function(e){let{categoryId:t,...n}=e,l=function(e){switch(e){case eZ.R2.RECENT:return eD.O;case eZ.R2.FAVORITES:return eU.G;case eZ.R2.TOP_GUILD_EMOJI:return eG.O;case eZ.R2.PEOPLE:return eM.n;case eZ.R2.NATURE:return eF.p;case eZ.R2.FOOD:return eV.i;case eZ.R2.ACTIVITY:return eB._;case eZ.R2.TRAVEL:return eH.h;case eZ.R2.OBJECTS:return eW.D;case eZ.R2.SYMBOLS:return eK.C;case eZ.R2.FLAGS:return eY.i;case eZ.R2.PREMIUM_UPSELL:return ex.t;case eZ.R2.SOUNDMOJI:return ez.J;default:return}}(t);return null==l?null:(0,s.jsx)(l,{color:"currentColor",...n})});var e$=n(724511),eJ=n(835245),eX=n(770335),eQ=n(7584),e0=n(526292),e1=n(926972),e2=n(711014);let e3=(0,n(945810).mj)({name:"2026-06-emoji-frecent-test",kind:"user",defaultConfig:{maxFrequentEmojis:null},variations:{1:{maxFrequentEmojis:9},2:{maxFrequentEmojis:18}}});var e4=((l={})[l.EMOJI=0]="EMOJI",l[l.EXPAND_OR_COLLAPSE_EMOJIS=1]="EXPAND_OR_COLLAPSE_EMOJIS",l[l.SOUNDMOJI=2]="SOUNDMOJI",l);let e6=[eE.EmojiDisabledReasons.DISALLOW_EXTERNAL,eE.EmojiDisabledReasons.DISALLOW_CUSTOM];var e5=((i={})[i.PREMIUM=0]="PREMIUM",i[i.ROLE_SUBSCRIPTION=1]="ROLE_SUBSCRIPTION",i),e7=n(619182);let e8=(0,ec.xI)(p.A.EMOJI_PICKER_CONSTANTS_GUILD_CATEGORY_ICON_SIZE),e9=(0,ec.xI)(p.A.EMOJI_PICKER_CONSTANTS_GUILD_CATEGORY_ICON_MARGIN_VERICAL),te=(0,ec.xI)(p.A.EMOJI_PICKER_CONSTANTS_UNICODE_CATEGORY_ICON_SIZE),tt=(0,ec.xI)(p.A.EMOJI_PICKER_CONSTANTS_UNICODE_CATEGORY_ICON_MARGIN_VERTICAL),tn=(0,ec.xI)(p.A.EMOJI_PICKER_CONSTANTS_UNICODE_CATEGORY_ICON_PADDING),tl=(0,ec.xI)(e7.__invalid_unicodeCategoryShortcutHeight),ti=(0,ec.xI)(p.A.EMOJI_PICKER_CONSTANTS_CATEGORY_SEPARATOR_SIZE),ts=(0,ec.xI)(p.A.EMOJI_PICKER_CONSTANTS_CATEGORY_SEPARATOR_MARGIN_VERTICAL),tr=te+e9+2*tn,ta=e8+e9,to=ta+(ti+2*ts),tu=te+tt+2*tn;function tc(e){let{activeIndex:t,categoryIndex:n,analyticsContext:l,categories:i,category:a,handleCategorySelect:u,isWindowFocused:c,useReducedMotion:d}=e,m=(0,eL.rm)(`expression-guild-${n}`),h=a.type===eZ.s.GUILD?null:a.id,p=t===n,f=a.type===eZ.s.GUILD?a.guild:null,g=(0,s.jsxs)(B.D,{...m,"aria-label":(0,ed.wt)(a,f),className:o()({[e7.ZG]:null!=f,[e7.Bj]:null==f,[e7.s6]:null==f&&p,[e7.xg]:a.type===eZ.s.RECENT}),onClick:()=>{null!=f&&eo.default.track(Q.HAw.EXPRESSION_PICKER_CATEGORY_SELECTED,{location:l?.location,tab:eA.kx.EMOJI,guild_id:f.id}),u(n)},children:[null!=f?(0,s.jsx)(e$.A,{guild:f,isSelected:p,shouldAnimate:!d&&c,isLocked:a.isNitroLocked}):null,null==f&&null!=h?(0,s.jsx)(eq,{categoryId:h,className:e7.Yl,height:te,width:te,size:"custom"}):null]}),E=i[n+1],A=null!=E&&a.type===eZ.s.GUILD&&E.type!==eZ.s.GUILD;return null!=f?(0,s.jsxs)(r.Fragment,{children:[(0,s.jsx)(ew.Q,{guild:f,children:(0,s.jsx)("div",{children:g})}),A?(0,s.jsx)("hr",{className:e7.ny},"separator"):null]}):g}let td=e=>{let{className:t,emojiListRef:n,sectionDescriptors:l,intention:i,channel:a,fallbackGuildId:u,shouldShowSoundmojiInEmojiPicker:c=!1,showOnlyUnicode:d=!1}=e,h=k.Om.useStore(e=>e.activeCategoryIndex),p=function(e){let{emojiListRef:t}=e,n=(0,D.RQ)(e=>e.searchQuery),l=r.useCallback(e=>t.current?.scrollToSectionTop(e),[t]);return r.useCallback(e=>{""!==n?((0,D.Ri)(""),k.Om.setActiveCategoryIndex(e)):l(e)},[l,n])}({sectionDescriptors:l,emojiListRef:n}),f=(0,A.p)(),g=(0,ed.ss)(i,a,a?.guild_id??u,c),E=r.useMemo(()=>d?(0,ed.CQ)():g,[g,d]),C=r.useRef(null),x=(0,m.bG)([ek.A],()=>ek.A.isFocused()),I=(0,m.bG)([eI.Ay],()=>eI.Ay.useReducedMotion,[]),_=r.useMemo(()=>eP().memoize((e,t)=>{let n=E[t];if(null!=n)return(0,s.jsx)(tc,{activeIndex:h,analyticsContext:f,categories:E,category:n,categoryIndex:t,handleCategorySelect:p,isWindowFocused:x,useReducedMotion:I},t)}),[h,f,E,p,x,I]),S=r.useMemo(()=>[8,8,0,8],[]),y=r.useCallback((e,t)=>{let n=E[t];if(n.type===eZ.s.RECENT)return tr;if(n.type===eZ.s.GUILD){let e=E[t+1];return null!=e&&e.type!==eZ.s.GUILD?to:ta}return tu},[E]),{nonUnicodeCategoryCount:v,firstUnicodeCategoryIndex:T,firstUnicodeCategoryOffsetTop:N,rowCountBySection:j}=r.useMemo(()=>{let e=0,t=0,n=0,l=0;E.forEach(i=>{i.type===eZ.s.GUILD?(t+=1,n+=1):i.type===eZ.s.UNICODE?l+=1:(e+=1,t+=1)});let i=tr+t*ta+to;return{nonUnicodeCategoryCount:t,firstUnicodeCategoryIndex:t,firstUnicodeCategoryOffsetTop:i,rowCountBySection:[e,n,l]}},[E]),[b,R]=r.useState(!0);r.useLayoutEffect(()=>{R(v>=7)},[v]);let P=r.useCallback(e=>{let t=C.current?.getListDimensions();null==t||(e+t.height-ti>=N?R(!1):R(!0))},[N]),L=r.useCallback(e=>{e(T),C.current?.scrollTo(N)},[N,T]),M=r.useCallback((e,t)=>{let n=E[e];if(null==n)return 0;let l=b?tl:0;if(n.type===eZ.s.RECENT)return t?0:tt;if(n.type===eZ.s.GUILD){let n=E[e+1];return null!=n&&n.type!==eZ.s.GUILD?t?ti+-2*ts+e9+l:e9:t?l:e9}return t?e9+l:2*e9},[E,b]),O=r.useMemo(()=>function(e,t){return(0,s.jsx)(r.Fragment,{children:t},e)},[]),w=b?"shortcut":"hiddenshortcut";return(0,s.jsx)(eO.A,{categoryListRef:C,expressionsListRef:n,className:t,store:k.Om,categories:E,listPadding:S,onScroll:P,renderCategoryListItem:_,renderSection:O,rowCount:E.length,categoryHeight:y,getScrollOffsetForIndex:M,rowCountBySection:j,children:e=>v>=7&&(0,s.jsx)(B.D,{"aria-hidden":!b,"aria-label":et.intl.string(et.t.dT0ctw),className:o()(e7.KB,{[e7.h_]:!b}),tabIndex:b?0:-1,onClick:()=>L(e),children:(0,s.jsx)(eM.n,{size:"custom",color:"currentColor",height:te,width:te})},w)})};var tm=n(49999),th=n(868836);let tp=function(e){let{markAsDismissed:t}=e;return(0,s.jsxs)("div",{className:th.iE,children:[(0,s.jsx)(eK.C,{size:"md",color:"currentColor",className:th.Kk}),(0,s.jsx)("div",{className:th.Qs,children:(0,s.jsx)(Y.E,{variant:"text-xs/normal",children:et.intl.string(et.t.xdRf69)})}),(0,s.jsx)(B.D,{onClick:()=>t(tm.i.UNKNOWN),children:(0,s.jsx)(H.P,{size:"md",color:"currentColor",className:th.VN})})]})};var tf=n(308186),tg=n(459192),tE=n(717421),tA=n(343032),tC=n(131607),tx=n(428262),tI=n(337889);let t_={tension:750,mass:2.5,friction:70};function tS(e){let{checked:t,onClick:n}=e,l=(0,m.bG)([eI.Ay],()=>eI.Ay.useReducedMotion),i=ea.default.getCurrentUser(),a=null!=i&&!(0,tx.TW)(i),u=a?[]:[h.M.SUPER_REACTION_TOGGLE_EDUCATION_DESKTOP],[c,d]=(0,tC.kn)(u),[p,f]=r.useState(!1),[g,E]=(0,tE.z)(()=>({})),A=(0,tf.animated)(tA.i);r.useEffect(()=>{let e=c===h.M.SUPER_REACTION_TOGGLE_EDUCATION_DESKTOP;e&&(d(tm.i.DISMISS),setTimeout(()=>f(e),200))},[c,d]);let C=p?et.intl.string(et.t["Osi/uy"]):t&&!a?et.intl.string(et.t["5cRA/b"]):et.intl.string(et.t.buV4av),x=p?et.intl.string(et.t.ORK94p):void 0;return(0,s.jsx)(tg.u,{position:"top",title:x,body:C,asset:(0,s.jsx)(ex.t,{size:"md",color:"currentColor"}),assetSize:20,forceOpen:p,children:(0,s.jsx)(B.D,{"aria-label":C,"aria-pressed":t,onClick:function(){E({from:{rotate:t?"360deg":"0deg"},to:{rotate:t?"0deg":"360deg"},config:t_}),n?.(),f(!1)},focusProps:{enabled:!1},className:o()(tI.Pf,{[tI.wM]:t}),children:(0,s.jsx)(A,{style:l?void 0:g,size:"custom",width:20,height:20,color:t?"white":"currentColor",className:tI.Kk})})})}var ty=n(821609),tv=n(644508),tT=n(824832),tN=n(638263);function tj(e){let{channel:t}=e,n=r.useRef(null),l=r.useRef(0),[i,a]=r.useState(!1),[o,u]=r.useState(!1),c=o||i,d=r.useCallback(async(e,n,i)=>{u(!0),await (0,tv.f)({userImage:{data:e,file:n,image:i},guildId:t?.guild_id??null,analyticsLocation:{section:Q.JJy.EXPRESSION_PICKER,page:t?.guild_id!=null?Q.liQ.GUILD_CHANNEL:Q.liQ.DM_CHANNEL}}),l.current+=1,u(!1)},[t]);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ty.$,{text:et.intl.string(et.t.iMJO37),variant:"secondary",onClick:function(){n.current?.activateUploadDialogue()},disabled:c}),(0,s.jsx)("div",{className:tN.F,children:(0,s.jsx)(tT.Ay,{ref:n,onChange:d,setLoading:a,disabled:c},l.current)})]})}n(667532);var tb=n(833272),tR=n(82495),tP=n(260762),tL=n(915089),tM=n(650583),tO=n(46274);let tw=(0,tL.Ld)(),tk=tb.A.convert.fromCodePoint("1f44f"),tD=(0,ec.xI)(p.A.EMOJI_PICKER_CONSTANTS_DIVERSITY_EMOJI_SIZE);function tU(e){switch(tb.A.convert.toCodePoint(e)){case"1f3fb":return et.intl.string(et.t["BVK5b/"]);case"1f3fc":return et.intl.string(et.t.xJWOK8);case"1f3fd":return et.intl.string(et.t["MB+T5g"]);case"1f3fe":return et.intl.string(et.t.MODud2);case"1f3ff":return et.intl.string(et.t["0uzqsc"]);default:return et.intl.string(et.t.bGN1ow)}}let tG=e=>{let{fade:t,surrogate:n,onClick:l,delay:i,index:r}=e,a=(0,eL.rm)(`item-${r}`),o=ep.Ay.getURL(tk+n),u=(0,tE.z)({opacity:1,from:{opacity:+!t},delay:i},"animate-always");return(0,s.jsx)(B.D,{...a,role:"option","aria-selected":0===r,onClick:()=>l(n),className:tO.B6,children:(0,s.jsx)(tf.animated.div,{"aria-label":tU(n),className:tO.g4,style:{backgroundImage:`url("${o}")`,...u}})})},tF=e=>{let{id:t,selectedSurrogate:n,onClick:l}=e,i=(0,tP.A)("diversity"),a=(0,tE.z)({height:(tD+14)*(eQ.W$.length+1),from:{height:tD+14},config:{duration:125}}),o=r.useRef(i);r.useEffect(()=>{o.current.focusFirstVisibleItem()},[]);let u=["",...eQ.W$];return eP().remove(u,e=>e===n),u.unshift(n),(0,s.jsx)(eL.hD,{navigator:i,children:(0,s.jsx)(eL.PR,{children:e=>{let{ref:n,...i}=e;return(0,s.jsx)(tf.animated.div,{...i,id:t,ref:n,className:tO.J6,style:a,role:"listbox",children:u.map((e,t)=>(0,s.jsx)(tG,{index:t,fade:0!==t,delay:20*t,surrogate:e,onClick:l},t))})}})})},tV=function(e){let{searchBarRef:t,selectedSurrogate:n,className:l}=e,i=ep.Ay.getURL(tk+n),[a,u]=r.useState(!1),c=(0,tR.A)(null,()=>u(!1)),d=r.useRef(null);return(0,s.jsxs)("div",{ref:c,className:o()(tO.fx,l),children:[(0,s.jsx)(B.D,{innerRef:d,className:tO.Dj,onClick:function(){u(!0)},"aria-label":et.intl.formatToPlainString(et.t["2SfnMp"],{skinTone:tU(n)}),"aria-haspopup":!0,"aria-expanded":a,"aria-controls":tw,tabIndex:a?-1:0,children:(0,s.jsx)("div",{className:tO.g4,style:{backgroundImage:`url("${i}")`}})}),a?(0,s.jsx)("div",{onKeyDown:function(e){e.key===tM.dh.ESCAPE?(e.stopPropagation(),u(!1),null!=d.current&&d.current.focus()):"Tab"===e.key&&u(!1)},children:(0,s.jsx)(tF,{id:tw,selectedSurrogate:n,onClick:function(e){(0,g.dK)(e),u(!1),t.current?.focus()}})}):null]})};var tB=n(942381),tH=n(602034),tW=n(892547);let tK=r.forwardRef(function(e,t){let{emojiListRef:n,gridNavigatorId:l,onKeyDown:i,onFocus:a,autoFocus:o,defaultSearchPlaceholder:u}=e,c=r.useRef(null),d=(0,D.RQ)(e=>e.searchQuery),[m,h,p]=k.Om.useStore(e=>[e.inspectedExpressionPosition,e.searchPlaceholder,e.hasInteracted],tB.x),f=r.useCallback(e=>{k.Om.setActiveCategoryIndex(""===e?0:-1),k.Om.setInspectedExpressionPosition(0,0),k.Om.setSearchPlaceholder(null),(0,D.Ri)(e),n.current?.scrollTo(0)},[n]),g=r.useCallback(()=>{f("")},[f]);return r.useImperativeHandle(t,()=>({focus:()=>c.current?.focus()})),(0,s.jsx)(tW.I,{autoFocus:o,query:d,ref:c,placeholder:h??u,onClear:g,onKeyDown:function(e){switch(e.key){case tM.dh.ARROW_LEFT:case tM.dh.ARROW_RIGHT:case tM.dh.ARROW_UP:case tM.dh.ARROW_DOWN:document.activeElement!==e.target&&e.preventDefault()}i(e)},onFocus:a,onChange:f,inputProps:{"aria-label":et.intl.string(et.t.tCauZX),"aria-haspopup":"grid","aria-controls":l,"aria-expanded":!0,...p?{"aria-activedescendant":(0,tH.Aq)(l,m.columnIndex,m.rowIndex)}:void 0}})}),tY=r.memo(tK);var tz=n(873426);let tZ=function(e){let{channel:t,accessory:n,pickerIntention:l,headerClassName:i,emojiListRef:r,onKeyDown:a,onFocus:u,autoFocus:c,searchBarRef:d,diversitySurrogate:m,isBurstReaction:h,onBurstReactionToggle:p,renderHeader:f,showAddEmojiButton:g=!0}=e,E=(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(tY,{emojiListRef:r,gridNavigatorId:eZ.lq,onKeyDown:a,ref:d,onFocus:u,autoFocus:c,defaultSearchPlaceholder:(0,ed.wT)(l,h)}),l===eE.EmojiIntention.REACTION?(0,s.jsx)(tS,{checked:h,onClick:p}):null,n??(0,s.jsx)(tV,{searchBarRef:d,className:tz.fx,selectedSurrogate:m}),l!==eE.EmojiIntention.NO_CUSTOM_EMOJI&&g?(0,s.jsx)(tj,{channel:t}):null]});return(0,s.jsx)("div",{className:o()(tz.wx,i),children:null!=f?f(E):E})};var tq=n(182922),t$=n(363195),tJ=n(486020),tX=n(854469);function tQ(e){return null!=e&&"animated"in e}let t0=r.memo(function(e){let t,l,{className:i,emojiGrid:a,guildId:o,pickerIntention:u,channel:c}=e,d=k.Om.useStore(e=>e.inspectedExpressionPosition),h=r.useMemo(()=>{let{rowIndex:e,columnIndex:t}=d;return a[e]?.[t]},[a,d]);switch(h?.type){case e4.EMOJI:t=h?.emoji;break;case e4.EXPAND_OR_COLLAPSE_EMOJIS:t={type:"EXPAND_OR_COLLAPSE_EMOJI",guildId:h?.guildId,allNamesString:h?.name};break;case e4.SOUNDMOJI:default:t=null}let p=(0,m.bG)([$.A],()=>null!==t&&t.type===eX.i.GUILD?$.A.getGuild(t.guildId):null,[t]),f=(0,m.bG)([ek.A],()=>ek.A.isFocused()),g=(0,m.bG)([eI.Ay],()=>eI.Ay.useReducedMotion,[]),E=es.Sf.useSetting(),A=(0,ed.O7)(o,tQ(t)?t:null),C=(0,m.bG)([y.Ay],()=>y.Ay.expandedSectionsByGuildIds),{newlyAddedEmojis:x}=(0,eg.A)(o,u),I=h?.type===e4.EMOJI?h.subCategory:eZ.tm.NONE;if(r.useEffect(()=>{let e=Date.now();return()=>{Date.now()-e>=250&&tQ(t)&&I!==eZ.tm.NONE&&(I===eZ.tm.NEWLY_ADDED_EMOJI&&null!==t&&t.type===eX.i.GUILD&&(0,w.mz)(t.guildId,x[0].id),null!=d.source&&(0,ed.yB)({emoji:t,subCategory:I,position:h.columnIndex+1,newlyAddedHighlight:I===eZ.tm.NEWLY_ADDED_EMOJI&&O.isNewerThanLastSeen(o,t.id)}))}}),null==t)return null;let _=function(e,t){let{allowAnimatedEmoji:l,sectionsExpandedFromThreeRows:i,theme:r}=t;if(tQ(e)){let t=null!=e.id?tJ.Ay.getEmojiURL({id:e.id,animated:l&&e.animated,size:28}):e.url;return""===t?(0,s.jsx)(Y.E,{variant:"text-md/normal",className:tX.J_,children:"surrogates"in e?e.surrogates:null}):(0,s.jsx)("img",{alt:(0,ep.N)(e)??"",src:t,className:tX.Zg})}if("EXPAND_OR_COLLAPSE_EMOJI"!==e.type)return null;{let t=n(619508),l=n(404828),a=n(600003),o=n(318121);return i.has(e.guildId)?(0,s.jsx)("img",{className:tX.Kk,src:(0,V.M)(r)?a:o,alt:""}):(0,s.jsx)("img",{className:tX.Kk,src:(0,V.M)(r)?t:l,alt:""})}}(t,{allowAnimatedEmoji:E,sectionsExpandedFromThreeRows:C,theme:t$.A.theme}),S=null!=p?(0,s.jsx)(e$.A,{className:tX.__invalid_guildIcon,guild:p,shouldAnimate:!g&&f}):null;l="EXPAND_OR_COLLAPSE_EMOJI"===t.type?C.has(t.guildId)?et.intl.string(et.t["/K2RDH"]):et.intl.string(et.t.NZI2Zk):(0,ep.N)(t);let v=function(e){let{inspectedEmoji:t,guild:n}=e,l=tQ(t);return null!=n&&l?et.intl.format(et.t.KFW2aY,{guildName:n.name}):null}({inspectedEmoji:t,channel:c,guildId:o,intention:u,guild:p});return(0,s.jsx)(tq.A,{className:i,graphicPrimary:_,graphicSecondary:S,titlePrimary:l,titleSecondary:v,isFavorite:A,emojiSubCategory:I})});var t1=n(607399),t2=n(537652),t3=n(962125),t4=n(240864),t6=n(286509),t5=n(89366),t7=n(754998),t8=n(202639),t9=n(414872),ne=n(400669),nt=n(909536),nn=n(187322),nl=n(304072),ni=n(189551),ns=n(289873),nr=n(796774),na=n(209932),no=n(805945),nu=n(576705);n(980504);var nc=n(818348),nd=n(219920);let nm=r.memo(function(e){let t,n,l,i,{channelId:a,onSelectSoundmoji:o}=e,u=(0,m.bG)([na.A],()=>!na.A.isFetching()&&!na.A.hasFetchedAllSounds(),[]),c=(0,m.bG)([em.A],()=>em.A.getChannel(a)),d=(t=(0,m.bG)([ea.default],()=>tx.Ay.canUseSoundboardEverywhere(ea.default.getCurrentUser())),n=(0,m.bG)([na.A],()=>na.A.getSoundsForGuild("0")),l=(0,m.yK)([$.A],()=>$.A.getGuildIds()),i=r.useMemo(()=>nu.A.can(nc.xB.USE_EXTERNAL_SOUNDS,c),[c]),r.useMemo(()=>{let e=[];if(t&&i){let t=l.flatMap(e=>na.A.getSoundsForGuild(e)?.filter(e=>e.available)??[]);e.push(...eP().sampleSize(t,4))}else if(c?.guild_id!=null){let t=na.A.getSoundsForGuild(c?.guild_id)?.filter(e=>e.available);e.push(...eP().sampleSize(t,4))}return e.length<4&&e.push(...eP().sampleSize(n??[],4-e.length)),e},[i,c?.guild_id,n,l,t]));return(r.useEffect(()=>{(0,nr.E7)()},[u]),0===d.length)?(0,s.jsx)(ns.y,{}):(0,s.jsx)("div",{className:nd.q,children:d.map((e,t)=>(0,s.jsx)(no.Ay,{suppressPlaySound:!0,enableSecondaryActions:!0,isSoundmoji:!0,sound:e,channel:c,onSelectItem:t=>o?.(e,!t.shiftKey)},t))})});var nh=n(594061),np=n(771104),nf=n(990078),ng=n(442433),nE=n(147421),nA=n(723702),nC=n(140735),nx=n(194261),nI=n(881274);let n_=e=>{let{src:t,alt:n,size:l,"aria-label":i,className:a}=e,u=r.useRef(null),c=r.useRef(!1),d=c.current?nI.S:nI.Y;return(0,s.jsx)("img",{className:o()(d,a),alt:n,src:t,ref:u,"aria-label":i,style:{backgroundSize:l,height:l,width:l},onLoad:c.current?void 0:e=>{(e.currentTarget?.ownerDocument?.defaultView??window).requestAnimationFrame(()=>{null!=u.current&&(c.current=!0,u.current.classList.remove(nI.Y),u.current.classList.add(nI.S))})}})};var nS=n(297547);let ny=eP().memoize(e=>`${e*eE.EmojiSprites.NonDiversityPerRow}px ${e*Math.ceil(eQ.Ay.numNonDiversitySprites/eE.EmojiSprites.NonDiversityPerRow)}px`),nv=eP().memoize(e=>`${e*eE.EmojiSprites.DiversityPerRow}px ${e*Math.ceil(eQ.Ay.numDiversitySprites/eE.EmojiSprites.DiversityPerRow)}px`),nT=r.memo(function(e){let{emoji:t,size:l,surrogateCodePoint:i,allowAnimatedEmoji:a,"aria-label":u,isLocked:c}=e,d=(()=>{if(!t.useSpriteSheet){let e=null==t.id?t.url:tJ.Ay.getEmojiURL({id:t.id,animated:a&&t.animated,size:eE.EMOJI_URL_BASE_SIZE});return null!=e?(0,s.jsx)(n_,{className:nS.N1,"aria-label":u,src:e,size:l,alt:(0,ep.N)(t)??""}):null}return(0,s.jsx)("div",{className:o()(nS.xA,{[nS.N1]:c}),style:function(e,t,l){let i,s,r;if(!e.useSpriteSheet)return;let a=null!=e.index?e.index:0;e.hasDiversity?(i=n(12303)(`./spritesheet-${t}-${l}.png.js`).default,s=nv(l),r=eE.EmojiSprites.DiversityPerRow):(i=n(145519)(`./spritesheet-emoji-${l}.png.js`).default,s=ny(l),r=eE.EmojiSprites.NonDiversityPerRow);let o=-a%r*l,u=-Math.floor(a/r)*l;return{backgroundImage:`url('${i}')`,backgroundPosition:`${o}px ${u}px`,backgroundSize:s,height:l,width:l}}(t,i,l),children:(0,s.jsx)(nC.A,{children:u})})})();return(0,s.jsxs)(r.Fragment,{children:[d,c?(0,s.jsx)("div",{className:nS.iD,children:(0,s.jsx)(nx.X,{size:"xs",color:"currentColor",className:nS.fi})}):null]})});var nN=n(6376);let nj=r.forwardRef(function(e,t){let n,{emoji:l,isFavorite:i,isLargeSize:r,isMediumSize:a,isInspected:u,isDisabled:c,showPulse:d,columnIndex:h,rowIndex:p,size:f,surrogateCodePoint:g,allowAnimatedEmoji:E,selectedItemClassName:A,inNitroLockedSection:C,...x}=e,I=(0,m.bG)([$.A],()=>l.type===eX.i.GUILD?$.A.getGuild(l.guildId):void 0,[l]);return(0,s.jsx)(nn.vN,{children:(0,s.jsx)("button",{...x,className:o()(nN._X,{[nN.lG]:r,[nN.Lh]:a,[nN.Bx]:u,[A??""]:u,[nN.TV]:d}),"data-type":U.g.EMOJI,"data-id":l.id,"data-name":l.name,"data-surrogates":"surrogates"in l?l.surrogates:null,"data-animated":l.animated?"true":null,ref:t,children:(0,s.jsx)(nT,{"aria-label":(n=(0,ep.N)(l),(I?.name!=null&&(n=et.intl.formatToPlainString(et.t["nXv4/B"],{names:n,guildName:I.name})),i)?et.intl.formatToPlainString(et.t["9FI9Z0"],{names:n}):n),columnIndex:h,rowIndex:p,emoji:l,size:f,surrogateCodePoint:g,allowAnimatedEmoji:E,isLocked:c&&!C})})})});function nb(e){let{descriptor:t,emojiItemKey:l,isInspected:i,rowIndex:a,channelGuildId:o,onInspect:u,onSelect:c,isScrolling:d,isUsingKeyboardNavigation:h,showEmojiFavoriteTooltip:p,surrogateCodePoint:f,selectedItemClassName:g,getEmojiItemProps:E,isMediumSize:A,isLargeSize:C,pulseItemKey:x,allowAnimatedEmoji:I,setPulseItemKey:_,messageId:S,isBurstReaction:v,rowPosition:T,inNitroLockedSection:N}=e,[j,b]=r.useState(""),R=(0,m.bG)([eI.Ay],()=>eI.Ay.useReducedMotion),P=(0,m.bG)([y.Ay],()=>y.Ay.getDisambiguatedEmojiContext(o),[o]),L=r.useRef(null),{emoji:M,size:O,isDisabled:w,columnIndex:k}=t;function D(){d.current||h.current||u(t)}let{ref:U,tabIndex:G,onFocus:F,...V}=E(k,a)??{},B=j!==`${k}:${a}`?(0,s.jsx)(nj,{ref:U,emoji:M,isFavorite:P.isFavoriteEmojiWithoutFetchingLatest(M),isLargeSize:C,isMediumSize:A,isInspected:i,isDisabled:w,showPulse:x===l,allowAnimatedEmoji:I,onFocus:F??D,onMouseMove:D,onClick:e=>{if(null!=L.current&&null!=T&&null!=S&&!e.shiftKey&&null!=M.name&&v&&!R&&I){let e=null==M.id?eQ.Ay.convertNameToSurrogate(M.name):M.name,t=L.current.getBoundingClientRect();t.x=T.x+(k+1)*O,b(`${k}:${a}`),(0,nE.h)(S,e,M.id,t)}!function(e){if(e.stopPropagation(),d.current||h.current)return;let n=e.altKey;n&&!y.Ay.getDisambiguatedEmojiContext().isFavoriteEmojiWithoutFetchingLatest(M)&&_(l),(0,ei.sF)(ei._2.FAVORITE_EMOJI_TOOLTIP),c(t,{isFinalSelection:!e.shiftKey,toggleFavorite:n})}(e)},onContextMenu:function(e){(0,ng.L3)(e,async()=>{let{default:e}=await Promise.all([n.e("4774"),n.e("46132")]).then(n.bind(n,233503));return t=>(0,s.jsx)(e,{...t})})},tabIndex:G,columnIndex:k,rowIndex:a,size:O,surrogateCodePoint:f,selectedItemClassName:g,inNitroLockedSection:N}):null;return(0,r.createElement)("li",{...V,key:l,ref:L},p?(0,s.jsx)(nf.m,{text:et.intl.formatToPlainString(et.t.glqNsf,{key:(0,nA.isMac)()?"Opt":"Alt"}),position:"top",delay:200,children:B}):B)}let nR=e=>{let{emojiDescriptors:t,emojiSize:l,onSelect:i,onSelectSoundmoji:a,onInspect:u,surrogateCodePoint:c,getEmojiItemProps:d,getEmojiRowProps:m,isScrolling:h,isUsingKeyboardNavigation:p,rowIndex:f,allowAnimatedEmoji:g,showEmojiFavoriteTooltip:E,channelGuildId:A,category:C,selectedItemClassName:x,channelId:I,messageId:_,isBurstReaction:S,inNitroLockedSection:y,handleScrollUpOnSectionCollapse:v}=e,T=n(619508),N=n(404828),j=n(600003),b=n(318121),R=n(443336),P=n(258901),L=n(135974),M=n(8013),w=(0,z.Ay)(),D=k.Om.getState(),[U,G]=r.useState(D.inspectedExpressionPosition),[F,B]=(0,nl.A)(null,300),H=r.useRef(null);r.useEffect(()=>k.Om.subscribe(e=>e.inspectedExpressionPosition,e=>G(e)),[]),r.useEffect(()=>{nh.bW.loadIfNecessary()},[]);let W=l===eZ.as.LARGE,K=l===eZ.as.MEDIUM;function Z(e){let t=`${e.rowIndex}c${e.columnIndex}`;switch(e.type){case e4.EXPAND_OR_COLLAPSE_EMOJIS:{let{visibleRowIndex:n,columnIndex:l}=e,a=U.rowIndex===n&&U.columnIndex===l,c=e.sectionCollapsedToThreeRows?a?(0,V.M)(w)?P:M:(0,V.M)(w)?T:N:a?(0,V.M)(w)?R:L:(0,V.M)(w)?j:b,m=et.intl.string(e.sectionCollapsedToThreeRows?et.t.NZI2Zk:et.t["/K2RDH"]);return function(){let{onMouseEnter:n,onMouseLeave:l,handleSelect:i,icon:a,ariaLabel:c,shouldShowRoundHighlight:m}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{visibleRowIndex:g,columnIndex:E}=e,{ref:A,tabIndex:C,onFocus:I,..._}=d(E,f)??{},S=U.rowIndex===g&&U.columnIndex===E;function y(){h.current||p.current||u(e)}return(0,r.createElement)("li",{..._,key:t},(0,s.jsx)(nn.vN,{children:(0,s.jsx)("button",{"aria-label":c,ref:A,className:o()(nN._X,{[nN.lG]:W,[nN.Lh]:K,[nN.Bx]:S&&!m,[x??""]:S,[nN.TV]:F===t}),onFocus:I??y,onMouseOver:y,onMouseEnter:n,onMouseLeave:l,onClick:i,tabIndex:C,children:a})}))}({handleSelect:t=>{t.stopPropagation(),h.current||p.current||(i(e,{isFinalSelection:!0,toggleFavorite:!1}),(0,ni.G)(e.guildId),e.sectionCollapsedToThreeRows||v(),eo.default.track(Q.HAw.EMOJI_PICKER_THREE_ROW_COLLAPSE_TOGGLED,{collapsed:e.sectionCollapsedToThreeRows,guild_id:e.guildId}))},icon:(0,s.jsx)("img",{className:nN.Kk,src:c,alt:""}),ariaLabel:m,shouldShowRoundHighlight:!0})}case e4.EMOJI:{let{columnIndex:n,visibleRowIndex:l}=e,r=U.rowIndex===l&&U.columnIndex===n;return(0,s.jsx)(nb,{rowIndex:f,descriptor:e,emojiItemKey:t,isInspected:r,isScrolling:h,isUsingKeyboardNavigation:p,surrogateCodePoint:c,allowAnimatedEmoji:g,selectedItemClassName:x,onSelect:i,onInspect:u,channelGuildId:A,getEmojiItemProps:d,isMediumSize:K,isLargeSize:W,pulseItemKey:F,setPulseItemKey:B,showEmojiFavoriteTooltip:E,messageId:_,isBurstReaction:S,rowPosition:H?.current?.getBoundingClientRect(),inNitroLockedSection:y},t)}case e4.SOUNDMOJI:return}}function q(e){return(0,s.jsx)("ul",{...m(f),className:o()(nN.ND,{[nN.HO]:W,[nN.X$]:K}),ref:H,children:e.map(Z)})}if(C===eZ.R2.SOUNDMOJI)return(0,s.jsx)("ul",{className:nN.ND,ref:H,children:(0,s.jsx)(nm,{channelId:I,onSelectSoundmoji:a})});if(C!==eZ.s.TOP_GUILD_EMOJI)return q(t);let $=t.filter(e=>e.subCategory===eZ.tm.TOP_GUILD_EMOJI||e.subCategory===eZ.tm.NEWLY_ADDED_EMOJI&&e.emoji.type===eX.i.GUILD&&!O.isNewerThanLastSeen(e.emoji.guildId,e.emoji.id)),J=t.filter(e=>e.subCategory===eZ.tm.NEWLY_ADDED_EMOJI&&e.emoji.type===eX.i.GUILD&&O.isNewerThanLastSeen(e.emoji.guildId,e.emoji.id));return 0===J.length?q(t):(0,s.jsxs)("div",{className:nN.Ng,children:[(0,s.jsx)("div",{className:o()(nN.V6,{[nN.$3]:0===$.length}),children:q($)}),(0,s.jsxs)("div",{className:nN.bc,children:[(0,s.jsx)("div",{className:o()(nN.eE,{[nN.eM]:1===J.length,[nN.Wk]:$.length>0}),children:q(J)}),(0,s.jsxs)("div",{className:o()(nN.lD,{[nN.EI]:W,[nN.qU]:K,[nN.Wk]:$.length>0}),children:[(0,s.jsx)(np.A,{foreground:nN.rI}),(0,s.jsx)(Y.E,{variant:"text-xs/semibold",color:"always-white",children:et.intl.string(et.t.y2b7CA)})]})]})]})};var nP=n(98090);let nL=(0,ec.xI)(p.A.EMOJI_PICKER_CONSTANTS_EMOJI_LIST_PADDING_TOP),nM=(0,ec.xI)(p.A.EMOJI_PICKER_CONSTANTS_EMOJI_LIST_PADDING_RIGHT),nO=(0,ec.xI)(p.A.EMOJI_PICKER_CONSTANTS_EMOJI_LIST_PADDING_BOTTOM),nw=(0,ec.xI)(p.A.EMOJI_PICKER_CONSTANTS_EMOJI_LIST_SEARCH_RESULTS_PADDING_TOP),nk=(0,ec.xI)(p.A.EXPRESSION_PICKER_CONSTANTS_EXPRESSION_PICKER_LIST_SECTION_HEADING_HEIGHT),nD=(0,ec.xI)(p.A.EMOJI_PICKER_CONSTANTS_EMOJI_SECTION_MARGIN_BOTTOM),nU=(0,ec.xI)(p.A.EMOJI_PICKER_CONSTANTS_EMOJI_CONTAINER_PADDING_VERTICAL),nG=r.memo(function(e){let t,n,{diversitySurrogate:l,emojiGrid:i,emojiListRef:a,emojiSize:u,onEmojiSelect:c,onSelectSoundmoji:d,setUpsellConfigs:h,sectionDescriptors:p,rowCountBySection:f,collapsedSections:g,setCollapsedSections:E,getEmojiItemProps:C,getEmojiRowProps:I,rowCount:S,isUsingKeyboardNavigation:y,channelGuildId:v,channelId:T,messageId:N,isBurstReaction:j,listHeaderClassName:b}=e,R=r.useRef(!1),P=k.Om.useStore(e=>e.activeCategoryIndex),L=(0,D.RQ)(e=>e.searchQuery),M=es.Sf.useSetting(),O=(0,m.bG)([ea.default],()=>ea.default.getCurrentUser()),w=(0,eu.ki)(O),F=(0,nt.St)("emoji_picker_floating_upsell"),V=(0,t7.$)("emoji_picker_floating_upsell"),{location:H}=(0,A.p)(),{analyticsLocations:W}=(0,_.Ay)(),[K,Y]=r.useState(0),[z,Z]=r.useState(!1),{listPadding:q,renderRow:$,renderSection:J,renderSectionHeader:X,renderSectionFooter:ee,sectionMarginBottom:en,sectionHeaderHeight:el,sectionFooterHeight:er}=(e=>{let{collapsedSections:t,diversitySurrogate:n,emojiGrid:l,emojiSize:i,onEmojiSelect:a,onSelectSoundmoji:u,searchQuery:c,sectionDescriptors:d,setCollapsedSections:h,getEmojiItemProps:p,getEmojiRowProps:f,isScrolling:g,isUsingKeyboardNavigation:E,allowAnimatedEmoji:C,channelGuildId:x,channelId:I,messageId:_,isBurstReaction:S,listHeaderClassName:y,activeSectionIndex:v,emojiListRef:T}=e,N=(0,A.p)(),j=r.useRef(Q.An1),b=r.useMemo(()=>""!==n?tb.A.convert.toCodePoint(n):"",[n]),R=r.useCallback(e=>{let t=d[e],n=d[e+1];return e>=d.length-1?t.isNitroLocked:t.isNitroLocked&&!n.isNitroLocked},[d]),P=r.useCallback(e=>{if(e>=d.length-1)return!1;let t=d[e],n=d[e+1];return!t.isNitroLocked&&n.isNitroLocked},[d]),L=r.useCallback(function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,l=new Set(t),i=t.has(e);i?l.delete(e):l.add(e),null!=n&&eo.default.track(Q.HAw.EXPRESSION_PICKER_CATEGORY_COLLAPSE_TOGGLED,{location:N.location,tab:eA.kx.EMOJI,collapsed:!i,guild_id:n.id}),e===eZ.R2.SOUNDMOJI&&eo.default.track(Q.HAw.SOUNDMOJI_EMOJI_PICKER_SECTION_TOGGLED,{collapsed:!i}),h(l)},[N,t,h]),M=r.useCallback(e=>{let{columnIndex:t,visibleRowIndex:n}=e,l=e.type===e4.SOUNDMOJI?null:e.type===e4.EMOJI?(0,ep.N)(e.emoji):e.name;j.current!==Q.An1&&window.cancelAnimationFrame(j.current),j.current=window.requestAnimationFrame(()=>{k.Om.setInspectedExpressionPosition(t,n,U.t.MOUSE_EVENT),k.Om.setSearchPlaceholder(l),j.current=Q.An1})},[]),O=(0,m.bG)([ei.HP],()=>ei.HP.hasHotspot(ei._2.FAVORITE_EMOJI_TOOLTIP),[]),w=r.useMemo(()=>eP().memoize((e,t)=>{let n=l[e],r=d[t.sectionIndex];return(0,s.jsx)(nR,{emojiDescriptors:n,emojiSize:i,surrogateCodePoint:b,onInspect:M,onSelect:a,onSelectSoundmoji:u,getEmojiItemProps:p,getEmojiRowProps:f,isScrolling:g,isUsingKeyboardNavigation:E,rowIndex:e,allowAnimatedEmoji:C,showEmojiFavoriteTooltip:O,channelGuildId:x,category:r.sectionId,selectedItemClassName:nP.__invalid_selectedItem,channelId:I,messageId:_,isBurstReaction:S,inNitroLockedSection:r.isNitroLocked,handleScrollUpOnSectionCollapse:function(){T.current?.scrollToSectionTop(t.sectionIndex,{animate:!0})}},e)}),[l,d,i,b,M,a,u,p,f,g,E,C,O,x,I,_,S,T]);r.useEffect(()=>()=>w.cache?.clear?.(),[w]);let G=r.useMemo(()=>eP().memoize(e=>{let n=d[e];if(null==n)return;let{guild:l,categoryId:i,type:r,sectionId:a}=n;if(r===eZ.s.SEARCH_RESULTS)return;let u=r===eZ.s.GUILD?null!=l?(0,s.jsx)(e$.A,{guild:l,height:16,width:16}):null:null!=i?(0,s.jsx)(eq,{categoryId:i,height:16,width:16,size:"custom"}):null,c=l?.name;null!=i&&(c=(0,ed.Nu)(i,l?.name));let m=v===e,h=n.isNitroLocked,p=h&&!m,f=h&&m,g=r===eZ.s.SOUNDMOJI?(0,s.jsx)(B.D,{className:nP.f3,onClick:()=>{(0,D.U)(eA.kx.SOUNDBOARD),eo.default.track(Q.HAw.SOUNDMOJI_EMOJI_PICKER_VIEW_ALL_CLICK)},children:et.intl.string(et.t.rUEjBe)}):void 0;return(0,s.jsx)(t6.A,{className:o()(nP.wx,y,{[nP.RA]:p,[nP.sp]:f}),icon:u,isCollapsed:t.has(a),onClick:()=>L(a,l),trailing:g,children:c},a)}),[d,t,L,y,v]),F=(0,e0.k0)(),V=r.useCallback((e,n)=>{let l=d[e],i=P(e),r=R(e);return(0,s.jsx)("div",{className:o()(nP.Wy,{[nP.YD]:e===d.length-1,[nP.jl]:t.has(l.sectionId),[nP.cW]:l.isNitroLocked,[nP.T5]:i||r}),children:n},e)},[t,d,P,R]),H=r.useCallback(e=>P(e)?F?(0,s.jsx)(t9.ap,{}):(0,s.jsx)(t9.Ay,{}):R(e)?(0,s.jsx)("div",{className:nP.pQ}):null,[P,R,F]),W=r.useCallback(e=>P(e)?41:33*!!R(e),[P,R]),K=r.useCallback(e=>e===d.length-1||t.has(d[e]?.sectionId)||P(e)||R(e)?0:nD,[t,d,P,R]);return{listPadding:r.useMemo(()=>[""!==c?nw:nL,nM,nO,0],[c]),renderRow:w,renderSection:V,renderSectionHeader:G,renderSectionFooter:H,sectionMarginBottom:K,sectionHeaderHeight:r.useCallback(e=>d[e].type===eZ.s.SEARCH_RESULTS?0:nk,[d]),sectionFooterHeight:W}})({collapsedSections:g,diversitySurrogate:l,emojiGrid:i,emojiSize:u,onEmojiSelect:c,onSelectSoundmoji:d,searchQuery:L,sectionDescriptors:p,setCollapsedSections:E,getEmojiItemProps:C,getEmojiRowProps:I,isScrolling:R,isUsingKeyboardNavigation:y,allowAnimatedEmoji:M,channelGuildId:v,channelId:T,messageId:N,isBurstReaction:j,listHeaderClassName:b,activeSectionIndex:K,emojiListRef:a}),ec=(0,G.Fk)({activeCategoryIndex:P,isScrolling:R,listRef:a,onActiveCategoryIndexChange:function(e){Y(e),""===L&&k.Om.setActiveCategoryIndex(e)},scrollOffset:0,searchQuery:L,disableForSearch:!1});(0,G.FV)({searchQuery:L,activeCategoryIndex:P,listRef:a});let em=r.useCallback(e=>{ec(e),nF({emojiListRef:a,sectionDescriptors:p,scrollTop:e,searchQuery:L,setShowUpsell:Z})},[ec,a,p,L,Z]),eh=p.length>0;return r.useEffect(()=>{z&&eo.default.track(Q.HAw.PREMIUM_UPSELL_VIEWED,{type:eN.e.EMOJI_PICKER_FLOATING_UPSELL,location:H,location_stack:W})},[H,W,z]),r.useEffect(()=>{""!==L&&Z(!1)},[L]),(0,s.jsxs)("div",{className:nP.AD,children:[eh?(0,s.jsx)(t3.A,{role:"none presentation",className:nP.p_,listPadding:q,onScroll:em,renderRow:$,renderSection:J,renderSectionHeader:X,renderSectionFooter:ee,rowCount:S,rowCountBySection:f,rowHeight:u+2*nU,sectionHeaderHeight:el,sectionMarginBottom:en,sectionFooterHeight:er,stickyHeaders:!0,ref:a}):(0,s.jsx)(t2.A,{message:et.intl.string(et.t.IxxiKF),className:nP.BZ}),w||t1.Fr?null:(0,s.jsx)(t8.d,{showUpsell:z,text:(t=(0,tx.Dd)(eN.PremiumTypes.TIER_2),et.intl.format(et.t.gMVjeS,{nitroTierName:t,onClick:()=>{h({type:e5.PREMIUM,emojiDescriptor:void 0})}})),button:(n=(0,t5.qD)(),(0,tx.LE)(n,eN.pe.TIER_2)??et.intl.string(et.t.BmJkbd)),buttonAnalyticsObject:{section:Q.JJy.EMOJI_PICKER_FLOATING_UPSELL},subscribeButtonVariantOverride:V,leadingAction:F?(0,s.jsx)(ne.l,{size:"sm",className:nP.ij,location:x.A.PREMIUM_WISHLIST_EMOJI_UPSELL}):void 0})]})}),nF=eP().throttle(function(e){let{emojiListRef:t,sectionDescriptors:n,scrollTop:l,searchQuery:i,setShowUpsell:s}=e;s((0,t4.s)({listRef:t,searchQuery:i,nitroLockedSectionStates:n,scrollTop:l}).areOnlyNitroLockedSectionsVisible)},300,{leading:!1,trailing:!0});var nV=n(506774),nB=n(349288),nH=n(753390),nW=n(404374),nK=n(780964),nY=n(766075),nz=n(166403),nZ=n(542863);let nq="premiumRetentionEmojiPickerNotice",n$=nV.w.get(nq),nJ=e=>{let{closePopout:t,channel:n}=e,[l,i]=r.useState(!1),{subscription:a,hasFetchedSubscriptions:o}=(0,m.cf)([nz.A],()=>({subscription:nz.A.getPremiumSubscription(),hasFetchedSubscriptions:nz.A.hasFetchedSubscriptions()}));if(r.useEffect(()=>{o||(0,nH.hP)()},[o]),null==a||!(0,tx.PK)(a.status)||l)return null;let u=a.status===Q.Dmq.PAST_DUE?(0,tx.ji)(a).expiresDate:T()(a.currentPeriodStart).add(eN.ph),c=`${a.id}:${u.toISOString()}`;if(n$===c)return null;let d=tx.Ay.getPremiumType(a.planId)===eN.PremiumTypes.TIER_0?nW.k0.PREMIUM_TIER_0:tx.Ay.getPremiumType(a.planId)===eN.PremiumTypes.TIER_1?nW.k0.PREMIUM_TIER_1:nW.k0.PREMIUM_TIER_2;return(0,s.jsxs)("div",{className:nZ.g$,children:[(0,s.jsx)(ex.t,{size:"md",className:nZ.lu,color:d}),(0,s.jsxs)("div",{className:nZ.Xn,children:[(0,s.jsx)(Y.E,{variant:"text-xs/normal",children:et.intl.format(et.t.bTMjiO,{planName:tx.Ay.getTierDisplayNameByPlanId(a.planId),endsAt:u.toDate()})}),(0,s.jsx)("div",{children:(0,s.jsx)(nB.Anchor,{onClick:()=>{(0,ed.xf)(n),t(),(0,nY.openUserSettings)(nK.X.NITRO_PANEL)},children:et.intl.string(et.t.W3aavh)})})]}),(0,s.jsx)(B.D,{onClick:()=>{nV.w.set(nq,c),n$=c,i(!0)},children:(0,s.jsx)(H.P,{size:"md",color:"currentColor",className:nZ.YF})})]})};var nX=n(148361);let nQ=(0,ec.xI)(p.A.EMOJI_PICKER_CONSTANTS_EMOJI_CONTAINER_PADDING_HORIZONTAL),n0=(0,ec.xI)(p.A.EMOJI_PICKER_CONSTANTS_EMOJI_LIST_PADDING_LEFT);function n1(e){return e.stopPropagation()}function n2(e,t){k.Om.setInspectedExpressionPosition(e,t,U.t.GRID_NAVIGATOR_EVENT)}let n3=c()(ed.bo,200),n4=c()(ed.Wi,200),n6={section:void 0,openPopoutType:void 0,popoutLocation:void 0},n5=r.memo(r.forwardRef(function(e,t){let n,l,{pickerIntention:i,channel:a,guildId:u,closePopout:c,emojiSize:p=eZ.as.MEDIUM,hasTabWrapper:v=!1,onSelectEmoji:T,onSelectSoundmoji:N,containerWidth:j,onNavigateAway:b,persistSearch:R,className:P,headerClassName:L,analyticsOverride:M=n6,searchProps:F={},wrapper:V,shouldHidePickerActions:B=!1,messageId:H,renderHeader:W,listHeaderClassName:K,categoryListClassName:Y,shouldShowSoundmojiInEmojiPicker:z=!1,showOnlyUnicode:Z=!1,showAddEmojiButton:q}=e,{onFocus:J,onKeyDown:X,autoFocus:ee=!0,accessory:en}=F,ec=(0,m.bG)([er.Ay],()=>null!=u?er.Ay.getDefaultChannel(u):null,[u]),[em,eh]=r.useState(null),eA=r.useRef(""),ex=(0,D.RQ)(e=>e.searchQuery),eI=r.useRef(null),e_=r.useRef(null),eS=r.useRef(null);null==a&&null!=ec&&(a=ec);let ey=a?.getGuildId()??u??null,[ev,eT]=r.useState(!1),eN=ea.default.getCurrentUser(),ej=(0,eu.ki)(eN);r.useImperativeHandle(t,()=>({onPickerOpen:e8}));let{location:eR}=(0,A.p)(),{page:eL,section:eM,object:eO,openPopoutType:ew,popoutLocation:ek}=M,eD=r.useMemo(()=>({...eR,section:eM??Q.JJy.EMOJI_PICKER_POPOUT}),[eR,eM]),{analyticsLocations:eU}=(0,_.Ay)(x.A.EMOJI_PICKER),{diversitySurrogate:eG}=(0,m.cf)([y.Ay],()=>({diversitySurrogate:y.Ay.diversitySurrogate})),eF=(0,ed.sL)(ex,a,i,Z),eV=null==eF?0:eF.locked.length+eF.unlocked.length,eB=es.iM.useSetting(),eH=r.useMemo(()=>new Set(eB),[eB]),eW=r.useCallback(e=>{es.iM.updateSetting(Array.from(e))},[]),eK=(0,G.oV)({gridWrapperRef:eI,containerWidth:j,listPaddingLeft:n0,listScrollbarWidth:8}),{rowCountBySection:eY,sectionDescriptors:ez,emojiGrid:eq,columnCounts:e$}=function(e){let{channel:t,fallbackGuildId:n,collapsedSections:l,pickerIntention:i,emojiSearchResults:s,gridWidth:a,emojiPaddingHorizontal:o,emojiSpriteSize:u,shouldShowSoundmojiInEmojiPicker:c,showOnlyUnicode:d}=e,h=(0,m.bG)([y.Ay],()=>y.Ay.categories),p=r.useMemo(()=>d?eQ.Ay.getCategories():h,[h,d]),f=(0,m.bG)([$.A],()=>$.A.getGuild(t?.getGuildId()),[t]),g=t?.getGuildId()??n,E=(0,m.bG)([y.Ay],()=>y.Ay.getDisambiguatedEmojiContext(g),[g]),A=(0,ed.XI)(g),C=(0,ed.Fj)(g),x=(0,ed.QZ)(g),{topEmojis:I,newlyAddedEmojis:_}=(0,eg.A)(g,i),S=(0,m.yK)([e2.Ay],()=>e2.Ay.getFlattenedGuildIds(),[]),v=(0,m.bG)([y.Ay],()=>y.Ay.expandedSectionsByGuildIds),T=(0,m.bG)([ea.default],()=>ea.default.getCurrentUser()),N=(0,eu.ki)(T),j=(0,e0.k0)(),b=E.getGroupedCustomEmoji(),R=(0,e1.Ym)({location:"useEmojiGrid"}),P=function(e){let{location:t}=e;return e3.useConfig({location:t}).maxFrequentEmojis}({location:"useEmojiGrid"});return r.useMemo(()=>{let e=[],n=[],r=[],d=[],m=0,h=0;if(null!=E&&null!=a){let E=Math.floor(a/(u+2*o)),y=3*E;function g(s,a){let o=new Map,c=l.has(a.sectionId),[p,f]=eP().partition(s,e=>{let n=ep.Ay.isEmojiDisabled({emoji:e,channel:t,intention:i});return o.set(e,n),!n}),g=p.concat(f),A=a.guild,C=g.length>y&&null!=A&&a.isNitroLocked,x=C&&!v.has(A.id);x&&g.splice(y-1);let S=Math.ceil((C?g.length+1:g.length)/E),T=[];for(let e=0;e<S;e++){let t=e*E,n=t+E,l=g.slice(t,n).map((e,t)=>({type:0,emoji:e,size:u,isDisabled:o.get(e),rowIndex:h,columnIndex:t,visibleRowIndex:m,category:a.type,subCategory:a.sectionId===eZ.s.TOP_GUILD_EMOJI?(0,ed.DA)(I,_,e.id??e.uniqueName??e.name):eZ.tm.NONE}));if(T.push(l),!c){if(C&&e===S-1){let t=T[e];t.push({type:1,guildId:A.id,name:et.intl.string(et.t.NZI2Zk),size:u,rowIndex:e,columnIndex:t.length,visibleRowIndex:m,sectionCollapsedToThreeRows:x})}d.push(l.length),r.push(l),m++}h++}let N={...a,count:s.length};n.push(N),e.push(c?0:S)}if(null!=s)0!==s.unlocked.length&&g(s.unlocked,{type:eZ.s.SEARCH_RESULTS,sectionId:eZ.s.SEARCH_RESULTS,count:s.unlocked.length,isNitroLocked:!1}),0!==s.locked.length&&g(s.locked,{type:eZ.s.PREMIUM_UPSELL,categoryId:eZ.R2.PREMIUM_UPSELL,sectionId:eZ.s.PREMIUM_UPSELL,count:s.locked.length,isNitroLocked:!N});else{if(R&&c){let t=[{type:2,rowIndex:h,columnIndex:0,visibleRowIndex:m}];n.push({type:eZ.s.SOUNDMOJI,categoryId:eZ.R2.SOUNDMOJI,sectionId:"soundmoji",count:t.length,isNitroLocked:!1});let i=l.has(eZ.R2.SOUNDMOJI);!i&&(d.push(t.length),r.push(t),m++),e.push(+!i),h++}for(let e of p)if(e===eZ.R2.CUSTOM){let n=n=>{let l=b.get(n);if(null==l)return;let s=l.filter(e=>!e6.includes(ep.Ay.getEmojiUnavailableReason({emoji:e,channel:t??er.Ay.getDefaultChannel(n),intention:i})));if(0===s.length)return;let r=$.A.getGuild(n),a=j||!N&&ep.Ay.isEmojiCategoryNitroLocked({categoryEmojis:s,channel:t,intention:i});g(s,{categoryId:e,guild:r,type:eZ.s.GUILD,sectionId:null!=r?r.id:(0,eJ.A)(),count:s.length,isNitroLocked:a})};if(null!=f&&n(f.id),(0,eE.isExternalEmojiAllowedForIntention)(i))for(let e of S)(null==f||f.id!==e)&&n(e)}else if(e===eZ.R2.TOP_GUILD_EMOJI){if(null!=f){let{allEmojis:t}=(0,ef.W)({topEmojis:I,newlyAddedEmojis:_});t.length>0&&g(t,{categoryId:e,guild:$.A.getGuild(f.id),type:eZ.s.TOP_GUILD_EMOJI,sectionId:eZ.s.TOP_GUILD_EMOJI,count:t.length,isNitroLocked:!1})}}else if(e===eZ.R2.RECENT){let n=(i===eE.EmojiIntention.REACTION?x:C).filter(e=>!ep.Ay.isEmojiFiltered({emoji:e,channel:t,intention:i}));N||null==P||(n=n.slice(0,P)),g(n,{categoryId:e,type:eZ.s.RECENT,sectionId:eZ.s.RECENT,count:n.length,isNitroLocked:!1})}else if(e===eZ.R2.FAVORITES){let n=A.filter(e=>!ep.Ay.isEmojiFiltered({emoji:e,channel:t,intention:i}));0!==n.length&&g(n,{categoryId:e,type:eZ.s.FAVORITES,sectionId:eZ.s.FAVORITES,count:n.length,isNitroLocked:!1})}else{let t=eQ.Ay.getByCategory(e);null!=t&&g(t,{categoryId:e,type:eZ.s.UNICODE,sectionId:e,count:t.length,isNitroLocked:!1})}}}return{columnCounts:d,emojiGrid:r,rowCountBySection:e,sectionDescriptors:n}},[E,a,u,o,s,l,b,v,t,i,I,_,N,p,f,S,x,C,A,j,R,c,P])}({gridWidth:eK,fallbackGuildId:ey,channel:a,pickerIntention:i,emojiSearchResults:eF,collapsedSections:eH,emojiPaddingHorizontal:nQ,emojiSpriteSize:p,shouldShowSoundmojiInEmojiPicker:z,showOnlyUnicode:Z}),{newlyAddedEmojis:e7}=(0,eg.A)(ey,i);n=r.useRef({intention:i,isBurstReaction:ev,analyticsObject:eO}),r.useEffect(()=>{n.current.intention===eE.EmojiIntention.REACTION&&eC(n.current)},[]);let e8=r.useCallback(()=>{let e=e7.length>0?e7[0].id:null;(0,w.uV)(ey,e),eC({intention:i,isBurstReaction:ev,analyticsObject:eO})},[e7,ey,i,ev,eO]),e9=function(e){let{pickerIntention:t,selectedChannel:n,fallbackGuildId:l,onSelectEmoji:i,setUpsellConfigs:s,emojiSelectAnalytics:a,trackEmojiFavorited:o}=e,u=(0,m.bG)([y.Ay],()=>y.Ay.getDisambiguatedEmojiContext(n?.getGuildId()??l),[l,n]);return r.useCallback((e,l)=>{if(0===e.type){let{emoji:r}=e;if(null==r)return;let c=ep.Ay.getEmojiUnavailableReason({emoji:r,channel:n,intention:t});if(l.toggleFavorite)return void(u.isFavoriteEmojiWithoutFetchingLatest(r)||null!=c?(0,g.Sw)(r):(o?.(e),(0,g.V4)(r)));if(c!==eE.EmojiDisabledReasons.GUILD_SUBSCRIPTION_UNAVAILABLE){if(c===eE.EmojiDisabledReasons.PREMIUM_LOCKED)return void s({type:0,emojiDescriptor:e});if(c===eE.EmojiDisabledReasons.ROLE_SUBSCRIPTION_LOCKED&&r.type===eX.i.GUILD)return void s({type:1,guildId:r.guildId,emojiId:r.id});c!==eE.EmojiDisabledReasons.ROLE_SUBSCRIPTION_UNAVAILABLE&&(a?.(e),i({emoji:r,willClose:l.isFinalSelection,isBurst:l.isBurst}))}}},[n,t,i,s,u,a,o])}({pickerIntention:i,selectedChannel:a,fallbackGuildId:ey,closePopout:c,onSelectEmoji:T,setUpsellConfigs:eh,emojiSelectAnalytics:e=>{""!==ex?(0,ed.Wf)({emoji:e.emoji,location:{...eD,object:Q.ZSU.EMOJI},searchQuery:ex,intention:i,messageId:H}):(0,ed._7)({emoji:e.emoji,location:{...eD,object:eO??Q.ZSU.EMOJI,...null!=eL&&{page:eL}},pickerIntention:i,category:e.category,subCategory:e.subCategory,position:e.columnIndex+1,newlyAddedHighlight:e.subCategory===eZ.tm.NEWLY_ADDED_EMOJI&&O.isNewerThanLastSeen(ey,e.emoji.id),isBurstReaction:ev,messageId:H})},trackEmojiFavorited:e=>{(0,ed.C5)({emoji:e.emoji,location:{...eD,object:Q.ZSU.EMOJI}})}}),te=r.useCallback(()=>{c(),b?.()},[c,b]),{getItemProps:tt,getRowProps:tn,gridContainerProps:tl,handleGridContainerKeyDown:ti,isUsingKeyboardNavigation:ts}=function(e){let{analyticsLocation:t,pickerIntention:n,columnCounts:l,onSelectEmoji:i,emojiGrid:s,emojiList:a,channelGuildId:o,isBurstReaction:u}=e,c=(0,m.bG)([y.Ay],()=>y.Ay.getDisambiguatedEmojiContext(o),[o]),h=r.useCallback((e,l)=>{if(e.type===e4.EMOJI){if(null!=e.emoji&&l.altKey)return void(c.isFavoriteEmojiWithoutFetchingLatest(e.emoji)?(0,g.Sw)(e.emoji):((0,ed.C5)({emoji:e.emoji,location:{...t,object:Q.ZSU.EMOJI}}),(0,g.V4)(e.emoji)));let s={page:null!=o?Q.liQ.GUILD_CHANNEL:Q.liQ.DM_CHANNEL,section:Q.JJy.EMOJI_PICKER_POPOUT,object:Q.ZSU.EMOJI};u&&(s={page:null!=o?Q.liQ.GUILD_CHANNEL:Q.liQ.DM_CHANNEL,section:Q.JJy.EMOJI_PICKER_POPOUT,object:Q.ZSU.EMOJI}),(0,ed._7)({emoji:e.emoji,location:s,pickerIntention:n,category:e.category,subCategory:e.subCategory,newlyAddedHighlight:e.subCategory===eZ.tm.NEWLY_ADDED_EMOJI&&O.isNewerThanLastSeen(o,e.emoji.id)}),i({emoji:e.emoji,willClose:!l.shiftKey,isBurst:u})}},[i,o,n,c,t,u]),{gridDispatch:p,getItemProps:f,getRowProps:E,gridContainerProps:A,handleGridContainerKeyDown:C,isUsingKeyboardNavigation:x}=(0,G.Ff)({columnCounts:l,gridNavigatorId:eZ.lq,itemGrid:s,itemList:a,onGridNavigatorItemSelect:h,onGridNavigatorPositionChange:n2});return r.useEffect(()=>k.Om.subscribe(e=>e.inspectedExpressionPosition,e=>{if(null==e)return;let{columnIndex:t,rowIndex:n,source:l}=e;l!==U.t.GRID_NAVIGATOR_EVENT&&p({type:d.n.SET_FOCUSED_POSITION,x:t,y:n})}),[p]),{getItemProps:f,getRowProps:E,gridContainerProps:A,handleGridContainerKeyDown:C,isUsingKeyboardNavigation:x}}({pickerIntention:i,analyticsLocation:eD,columnCounts:e$,onSelectEmoji:T,emojiGrid:eq,emojiList:e_,channelGuildId:ey,isBurstReaction:ev});((e,t)=>{let[n,l]=r.useState(null);r.useEffect(()=>{null!=n&&(t.current?.scrollToSectionTop(n),l(null))},[t,n]),r.useEffect(()=>{l(k.Om.getState().activeCategoryIndex)},[e])})(j,e_),r.useLayoutEffect(()=>{ee&&eS.current?.focus()},[j,eG,eS,ee]),r.useEffect(()=>{R||(0,D.Ri)("")},[R]),r.useEffect(()=>(eo.default.track(Q.HAw.OPEN_POPOUT,{type:ew??"Emoji Picker",guild_id:ey,location:ek,...(0,I.dI)(a)}),()=>{n3.cancel(),n4.cancel()}),[ew,ey,ek,a]),(0,C.Ay)(()=>((0,ed.V$)({intention:i,location:eD}),eA.current=ex,k.Om.resetStoreState)),r.useEffect(()=>()=>(0,ei.sF)(ei._2.FAVORITE_EMOJI_TOOLTIP),[]),r.useLayoutEffect(()=>{let{columnIndex:e,rowIndex:t}=k.Om.getState().inspectedExpressionPosition;eq[t]?.[e]==null&&0!==e&&k.Om.setInspectedExpressionPosition(0,0)},[eq]),r.useEffect(()=>{if(""===eA.current&&""!==ex&&(0,ed.EG)(eD,i),""!==ex&&eA.current!==ex){let e=k.Om.getAnalyticsId();0===eV?n3({location:eD,searchQuery:ex,intention:i,loadId:e}):n4({totalResults:eV,numEmojiLocked:eF?.locked.length??0,location:eD,searchQuery:ex,intention:i,loadId:e})}eA.current=ex},[ex,eD,eV,eF,i]);let tr=V??(v?"div":f.l),ta=null!=eK;em?.type===e5.PREMIUM?l=(0,s.jsx)(nX.default,{onUpsellClicked:te,emojiDescriptor:em.emojiDescriptor,pickerIntention:i,analyticsLocation:eD,onClose:()=>eh(null),channel:a}):em?.type===e5.ROLE_SUBSCRIPTION?l=(0,s.jsx)(el,{onClose:()=>eh(null),guildId:em.guildId,emojiId:em.emojiId}):ev&&!ej&&(l=(0,s.jsx)(eb,{onDismiss:()=>eT(!1)}));let to=(0,s.jsx)(tZ,{channel:a,pickerIntention:i,emojiListRef:e_,onKeyDown:e=>{ti?.(e),X?.(e)},searchBarRef:eS,onFocus:J,autoFocus:ee,accessory:en,headerClassName:L,diversitySurrogate:eG,isBurstReaction:ev,onBurstReactionToggle:function(){eT(!ev),eS.current?.focus()},renderHeader:W,showAddEmojiButton:q}),tu=[];i===eE.EmojiIntention.REACTION&&tu.push(h.M.SUPER_REACTIONS_NITRO_MARKETING),y.Ay.hasFavoriteEmojis(ey)||tu.push(h.M.EMOJI_PICKER_FAVORITE_EMOJIS_TIP);let tc=(0,s.jsx)(E.A,{...eD,children:(0,s.jsxs)(tr,{id:eZ.Do,"aria-labelledby":v?eZ.k1:void 0,role:v?"tabpanel":void 0,className:o()(tz.iE,{[tz.r6]:v,[tz.cB]:ev&&ej}),children:[v?null:to,(0,s.jsxs)("div",{className:o()(tz.Fb,P),onScroll:n1,children:[v?to:null,(0,s.jsxs)("div",{className:tz.uK,ref:eI,children:[(0,s.jsx)(nJ,{channel:a,closePopout:c}),(0,s.jsx)(S.Ay,{contentTypes:tu,children:e=>{let{visibleContent:t,markAsDismissed:n}=e;if(t===h.M.EMOJI_PICKER_FAVORITE_EMOJIS_TIP)return(0,s.jsx)(tp,{markAsDismissed:()=>n(tm.i.UNKNOWN)})}}),B?null:(0,s.jsx)("div",{className:tz.Iy,id:eZ.lq,...tl,children:ta?(0,s.jsx)(nG,{collapsedSections:eH,diversitySurrogate:eG,emojiGrid:eq,emojiListRef:e_,emojiSize:p,getEmojiItemProps:tt,getEmojiRowProps:tn,gridWidth:eK,isUsingKeyboardNavigation:ts,onEmojiSelect:function(e,t){e9(e,{...t,isBurst:ev})},onSelectSoundmoji:N,setUpsellConfigs:eh,rowCount:eq.length,rowCountBySection:eY,sectionDescriptors:ez,setCollapsedSections:eW,channelGuildId:ey,channelId:a?.id,messageId:H,isBurstReaction:ev,listHeaderClassName:K}):null})]}),(0,s.jsx)(t0,{emojiGrid:eq,className:tz.qV,guildId:ey,pickerIntention:i,channel:a}),l]}),B?null:(0,s.jsx)(td,{className:o()(tz.jv,Y),emojiListRef:e_,sectionDescriptors:ez,intention:i,channel:a,fallbackGuildId:ey,shouldShowSoundmojiInEmojiPicker:z,showOnlyUnicode:Z})]})});return(0,s.jsx)(_.f5,{value:eU,children:tc})}))}