Loading
function(e,t,n){"use strict";n.d(t,{A:()=>ix}),n(321073);var i,s,l=n(477900),r=n(582128),a=n(503698),o=n.n(a),c=n(649852),u=n.n(c),d=n(788413),m=n(17928),f=n(554146),E=n(319060),I=n(305866),g=n(554375),h=n(820284),p=n(212245),A=n(964486),_=n(765548),N=n(793574),C=n(666860),x=n(688810),y=n(379848),j=n(236285),T=n(770335),O=n(934499),S=n(331322),b=n(866665),R=n(408278),v=n(477155),L=n(403581),P=n(661531),M=n(297264),D=n(62010),w=n(465794),k=n(683973),U=n(287809),G=n(474090),F=n(182159),J=n(118057),V=n(834730),K=n(847374),B=n(320448),H=n(834040),W=n(499373),X=n(559106),z=n(442433),Z=n(788026),Y=n(915089),$=n(60587),q=n(732447),Q=n(105292),ee=n(126904);let et=r.memo(function(e){let{pack:t,isPinned:i,onAddPack:s,onRemovePack:a,onSelectEmoji:c}=e,u=r.useId(),d=r.useId(),[m,f]=r.useState(!1),E=Q.intl.string(m?Q.t.iTcuma:Q.t.dcl9MQ),I=Q.intl.string(i?q.default["2zxYCx"]:q.default.Tvdb5N),g=r.useMemo(()=>t.emojis.filter(e=>e.available),[t.emojis]),h=r.useMemo(()=>[g.length],[g.length]),p=(0,Y.GV)(),{getContainerProps:A,getItemProps:_,getRowProps:N}=(0,J.A)({navId:p,columnCounts:h,onSelect:(e,n,i)=>{let s=g[e];null!=s&&t.available&&c(s,e,{isFinalSelection:!i.shiftKey,toggleFavorite:i.altKey})}}),C=A();return(0,l.jsxs)("section",{"aria-labelledby":u,className:ee.nM,children:[(0,l.jsxs)(S.B,{align:"center",direction:"horizontal",gap:4,justify:"space-between",children:[(0,l.jsxs)(S.B,{align:"center",className:ee.DD,direction:"horizontal",gap:4,children:[(0,l.jsx)(M.D,{className:ee.UU,id:u,variant:"text-xs/bold",children:t.name}),(0,l.jsx)(V.E,{color:"text-subtle",variant:"text-xs/medium",children:Q.intl.format(q.default.UA8cNe,{count:g.length})}),(0,l.jsx)(b.m,{text:E,children:(0,l.jsx)(R.K,{"aria-controls":d,"aria-describedby":u,"aria-expanded":m,"aria-label":E,icon:m?K.a:B._,onClick:()=>f(e=>!e),size:"sm",variant:"icon-only"})})]}),(0,l.jsx)(b.m,{text:I,children:(0,l.jsx)(R.K,{"aria-label":I,icon:i?H.MinusIcon:W.T,onClick:()=>i?a(t):s(t),size:"sm",variant:"secondary"})})]}),(0,l.jsx)("div",{id:d,...C,"aria-label":t.name,className:o()(ee.gm,{[ee.jE]:m}),tabIndex:t.available&&g.length>0?C.tabIndex:-1,children:(0,l.jsx)("div",{className:ee.nI,...N(0),children:g.map((e,i)=>{let{ref:s,...r}=_(i,0);return(0,l.jsx)(b.m,{text:`:${e.name}:`,ariaHidden:!0,asContainer:!0,children:(0,l.jsx)(X.vN,{children:(0,l.jsx)("button",{...r,ref:s,"aria-label":`:${e.name}:`,className:ee.Z8,"data-type":$.g.EMOJI,"data-id":e.id,"data-name":e.name,"data-animated":e.animated?"true":null,disabled:!t.available,onClick:t=>{t.stopPropagation(),c(e,i,{isFinalSelection:!t.shiftKey,toggleFavorite:t.altKey})},onContextMenu:e=>{let t=e.currentTarget;(0,z.L3)(e,async()=>{let{default:e}=await Promise.all([n.e("638221"),n.e("73500"),n.e("496715"),n.e("904774"),n.e("446132")]).then(n.bind(n,233503));return n=>(0,l.jsx)(e,{...n,target:t,showFavoriteOnly:!0})})},type:"button",children:(0,l.jsx)(Z.A,{animated:e.animated,alt:"",className:ee.Zg,emojiId:e.id,emojiName:e.name})})})},e.id)})})})]})});var en=n(202541),ei=n(429800);function es(e){let{onBack:t,onSelectEmoji:n}=e,i=Q.intl.string(q.default.Nwj3fK),s=r.useRef(null),a=(0,m.bG)([F.A],()=>F.A.getPacks()),o=(0,m.bG)([U.default],()=>U.default.getCurrentUser()),c=(0,G.ki)(o,en.PremiumTypes.TIER_2);r.useLayoutEffect(()=>{s.current?.focus()},[]);let u=(0,k.k)().pinnedEmojiPacks?.packIds,d=r.useCallback(e=>{(0,O.Ls)(e.id)},[]),f=r.useCallback(e=>{(0,O.M5)(e.id)},[]);return(0,l.jsxs)("div",{className:ei.kL,children:[(0,l.jsx)("div",{"aria-hidden":!0,className:ei.Tp}),(0,l.jsx)("div",{className:ei.wx,children:(0,l.jsxs)(S.B,{align:"center",direction:"horizontal",gap:8,justify:"space-between",wrap:!0,children:[(0,l.jsxs)(S.B,{align:"center",direction:"horizontal",gap:10,fullWidth:!1,children:[(0,l.jsx)(b.m,{position:"right",text:i,children:(0,l.jsx)(R.K,{"aria-label":i,buttonRef:s,icon:v.r,onClick:t,size:"sm",variant:"icon-only"})}),(0,l.jsxs)(S.B,{align:"center",direction:"horizontal",gap:4,fullWidth:!1,children:[(0,l.jsx)(L.t,{color:P.A.colors.TEXT_DEFAULT,size:"xs"}),(0,l.jsxs)(S.B,{align:"center",direction:"horizontal",gap:8,fullWidth:!1,children:[(0,l.jsx)(M.D,{variant:"heading-md/semibold",children:Q.intl.string(q.default["0+5+Oy"])}),(0,l.jsx)(D.E,{type:"beta",variant:"primary"})]})]})]}),c?null:(0,l.jsx)(w.A,{buttonTextOverride:Q.intl.string(Q.t.hIVbiP),size:"sm",subscriptionTier:en.pe.TIER_2})]})}),(0,l.jsx)("div",{className:ei.p_,children:a.map((e,t)=>(0,l.jsxs)(r.Fragment,{children:[t>0?(0,l.jsx)("hr",{className:ei.yF}):null,(0,l.jsx)(et,{isPinned:u?.includes(e.id)===!0,pack:e,onAddPack:d,onRemovePack:f,onSelectEmoji:n})]},e.id))})]})}var el=n(617617);let er=[];var ea=n(536637),eo=n.n(ea),ec=n(73153),eu=n(935208);let ed={lastSeenNewlyAddedEmojiIds:{}},em=ed,ef={};function eE(){for(let e in ef)em.lastSeenNewlyAddedEmojiIds[e]=ef[e]}class eI extends m.Ay.PersistedStore{static displayName="NewlyAddedEmojiStore";static persistKey="NewlyAddedEmojiStore";static migrations=[e=>{let t=e.lastSeenNewlyAddedEmojiIds,n={};for(let e in t){let i=t[e];n[e]={id:i,lastSeen:Date.now(),acknowledged:!1}}return{lastSeenNewlyAddedEmojiIds:n}}];initialize(e){em=e??ed}getState(){return em}getLastSeenEmojiByGuild(e){return em.lastSeenNewlyAddedEmojiIds[e]}isNewerThanLastSeen(e,t){if(null==e||null==t)return!1;let n=this.getLastSeenEmojiByGuild(e);if(null==n||eu.default.compare(t,n.id)>0)return!0;{let e=eo()(n.lastSeen);return eo()().isBefore(e.add(2,"weeks"))&&!n.acknowledged}}}let eg=new eI(ec.h,{LOGOUT:function(){em=ed,ef={}},NEWLY_ADDED_EMOJI_SEEN_ACKNOWLEDGED:function(e){let{guildId:t,emojiId:n}=e,i=ef[t]??em.lastSeenNewlyAddedEmojiIds[t];null==i||0>eu.default.compare(i.id,n)?ef[t]={id:n,lastSeen:Date.now(),acknowledged:!0}:ef[t]={...i,acknowledged:!0}},NEWLY_ADDED_EMOJI_SEEN_PENDING:function(e){let{guildId:t,emojiId:n}=e,i=ef[t]??em.lastSeenNewlyAddedEmojiIds[t];(null==i||0>eu.default.compare(i.id,n))&&(ef[t]={id:n,lastSeen:Date.now(),acknowledged:!1})},NEWLY_ADDED_EMOJI_SEEN_UPDATED:eE,CLEAR_CACHES:function(){em=ed,eE()},CONNECTION_CLOSED:eE});var eh=n(451731),ep=n(850992),eA=n(151271),e_=n(887695),eN=n(562708),eC=n(462887),ex=n(939249),ey=n(789645),ej=n(696986),eT=n(736653),eO=n(139286),eS=n(976860),eb=n(71393),eR=n(384684),ev=n(985242),eL=n(652215),eP=n(746080),eM=n(196404);function eD(e){let t,{onClose:i,guildId:s,emojiId:r}=e,a=(t=(0,eT.Ay)(),(0,eC.q)(t)?n(454333):n(674463)),{analyticsLocations:o}=(0,x.Ay)(N.A.GUILD_ROLE_SUBSCRIPTION_EMOJI_PICKER_UPSELL);(0,eO.A)({type:eN.ImpressionTypes.MODAL,name:eN.ImpressionNames.ROLE_SUBSCRIPTION_EMOJI_UPSELL,properties:{location_stack:o,emoji_guild_id:s,emoji_id:r??null}});let c=(0,m.bG)([eb.A],()=>eb.A.getGuild(s)),u=(0,m.bG)([eR.A],()=>null!=s&&eR.A.getUserSubscriptionRoles(s).size>0),d=u?Q.intl.string(Q.t.GoLM9z):Q.intl.formatToPlainString(Q.t["h0u/Hi"],{serverName:c?.name}),f=u?Q.intl.string(Q.t.PjZ7Db):Q.intl.string(Q.t.p8FG1D);return(0,l.jsxs)("div",{className:eM.kL,children:[(0,l.jsx)("div",{className:eM.Tp}),(0,l.jsxs)("div",{className:eM.Qs,children:[(0,l.jsx)(ex.D,{className:eM.b,"aria-label":Q.intl.string(Q.t.cpT0Cq),onClick:i,children:(0,l.jsx)(ey.P,{size:"xs",color:"currentColor","aria-label":Q.intl.string(Q.t.cpT0Cq),className:eM.yP})}),(0,l.jsx)("img",{alt:"",src:a,className:eM.Tn}),(0,l.jsx)(ej.h,{size:22}),(0,l.jsx)(M.D,{color:"text-strong",variant:"heading-lg/extrabold",className:eM.wx,children:Q.intl.string(Q.t.cBjkcx)}),(0,l.jsx)(ej.h,{size:4}),(0,l.jsx)(V.E,{color:"text-default",variant:"text-md/normal",className:eM.h_,children:d}),(0,l.jsx)(ej.h,{size:24}),(0,l.jsx)(ev.A,{text:f,onClick:function(){(0,eS.pX)(eL.BVt.CHANNEL(s,eP.VV.ROLE_SUBSCRIPTIONS),{sourceLocationStack:o})}})]})]})}var ew=n(450510),ek=n(75678),eU=n(253932),eG=n(808728),eF=n(174459),eJ=n(240248),eV=n(822123),eK=n(734057),eB=n(309010),eH=n(690521),eW=n(818645),eX=n(316884),ez=n(307731),eZ=n(698279);function eY(e){let{intention:t,containerWidth:n,rowSize:i,isBurstReaction:s,analyticsObject:l}=e,r=eK.A.getChannel(eB.Ay.getChannelId()),a=r?.getGuildId(),o=t===ez.EmojiIntention.REACTION?j.Ay.emojiReactionFrecencyWithoutFetchingLatest.frequently.slice():j.Ay.emojiFrecencyWithoutFetchingLatest.frequently.slice(),c=null!=r?j.Ay.getDisambiguatedEmojiContext(r.getGuildId()).favoriteEmojisWithoutFetchingLatest:[],u=t===ez.EmojiIntention.REACTION?j.Ay.emojiReactionFrecencyWithoutFetchingLatest.numFrequentlyItems:j.Ay.emojiFrecencyWithoutFetchingLatest.numFrequentlyItems,d=o.slice(0,u),m=null!=a?j.Ay.getGuildEmoji(a):[],f=j.Ay.getDisambiguatedEmojiContext(r?.getGuildId()).getCustomEmoji(),{topEmojis:E,newlyAddedEmojis:I}=(0,eX.b)({guildId:r?.getGuildId(),pickerIntention:t}),{visibleTopEmojis:g,visibleNewlyAddedEmojis:h}=(0,eW.W)({topEmojis:E,newlyAddedEmojis:I,rowSize:i});C.Ay.trackWithMetadata(t===ez.EmojiIntention.REACTION?eL.HAw.REACTION_PICKER_OPENED:eL.HAw.EXPRESSION_PICKER_OPENED,{width:n,tab:eZ.kx.EMOJI,badged:!1,num_expressions_favorites:c.length,num_animated_expressions_favorites:c.filter(e=>e?.animated).length,num_custom_expressions_favorites:c.filter(eH.Ay.isCustomEmoji).length,num_standard_expressions_favorites:c.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(eH.Ay.isCustomEmoji).length,num_standard_expressions_frecent:d.filter(e=>null==e.id).length,num_current_guild_expressions:m.length,num_custom_expressions_total:f.size,num_expressions_top_server:g.length,num_animated_expressions_top_server:g.filter(e=>e.animated).length,num_expressions_newly_added:h.length,num_animated_expressions_newly_added:h.filter(e=>e.animated).length,...t===ez.EmojiIntention.REACTION&&{is_burst:s},...null!=l&&{location_object:l}})}var e$=n(206248),eq=n(724651),eQ=n(732280),e0=n(783420),e1=n(24482);let e2={object:eL.ZSU.BUTTON_CTA,section:eL.JJy.SUPER_REACTION_PICKER};function e3(e){let{targetElementRef:t,shouldShow:n,onDismiss:i}=e,s=Q.intl.string(Q.t.eikz43),r=(0,eQ.V)(),a=(0,eq.O)(),o=r?.subscriptionTrial,c=null!=o||null!=a,u=o?.skuId??en.pe.TIER_2,d=c?null!=a?Q.intl.formatToPlainString(Q.t.bkQ4bH,{percent:a.discount.amount}):(0,e1.FY)({intervalType:o?.interval,intervalCount:o?.intervalCount}):Q.intl.string(Q.t.sEAnVH);return(0,l.jsx)(e0.A,{subscriptionTier:u,premiumModalAnalyticsLocation:e2,onSubscribeModalClose:e=>{e&&i()},children:e=>{let{onClick:r}=e;return(0,l.jsx)(e$.H,{targetElementRef:t,shouldShow:n,onRequestClose:i,position:"bottom",assetUrl:"https://cdn.discordapp.com/assets/22_211_SuperReactions_GTM_Hero_v09.mp4",disableMediaViewer:!0,badge:c?{type:"free_trial",variant:"expressive"}:void 0,title:Q.intl.string(Q.t.N4SCJ0),body:s,action:{text:d,variant:"expressive",icon:L.t,onClick:r}})}})}var e5=n(200589),e4=n(435558),e8=n.n(e4),e6=n(837381),e7=n(460905),e9=n(775602),te=n(713517),tt=n(498032),tn=n(131607),ti=n(49999),ts=n(938612);function tl(e){let{onClick:t,listItemId:n}=e,i=Q.intl.string(q.default["3D0GLv"]),s=(0,e6.rm)(n),[r,a]=(0,tn.kn)([f.M.DEFAULT_EMOJIS_PACKS_DISCOVERY_DOT]),o=r===f.M.DEFAULT_EMOJIS_PACKS_DISCOVERY_DOT;return(0,l.jsx)("div",{className:ts.nM,children:(0,l.jsxs)("div",{className:ts.Jn,children:[(0,l.jsx)(b.m,{ariaHidden:!0,position:"right",text:i,children:(0,l.jsx)(ex.D,{...s,"aria-label":o?`${i}, ${Q.intl.string(Q.t.y2b7CA)}`:i,className:ts.x6,onClick:function(){o&&a(ti.i.TAKE_ACTION),t()},children:(0,l.jsx)(W.T,{size:"md",color:"currentColor"})})}),o&&(0,l.jsx)(tt.N,{className:ts.aW,size:"md",cutout:"base-lower"})]})})}var tr=n(88218),ta=n(407698),to=n(941971),tc=n(531685),tu=n(406810),td=n(27232),tm=n(369606),tf=n(413249),tE=n(141060),tI=n(687966),tg=n(115979),th=n(524501),tp=n(926268),tA=n(138134),t_=n(732139);let tN=r.memo(function(e){let{categoryId:t,...n}=e,i=function(e){switch(e){case t_.R2.RECENT:return tu.ClockIcon;case t_.R2.FAVORITES:return td.StarIcon;case t_.R2.TOP_GUILD_EMOJI:return tm.TrophyIcon;case t_.R2.PEOPLE:return e7.n;case t_.R2.NATURE:return tf.p;case t_.R2.FOOD:return tE.i;case t_.R2.ACTIVITY:return tI.GameControllerIcon;case t_.R2.TRAVEL:return tg.h;case t_.R2.OBJECTS:return th.D;case t_.R2.SYMBOLS:return tp.HeartIcon;case t_.R2.FLAGS:return tA.FlagIcon;case t_.R2.PREMIUM_UPSELL:return L.t;default:return}}(t);return null==i?null:(0,l.jsx)(i,{color:"currentColor",...n})});var tC=n(724511),tx=n(132500),ty=n(7584),tj=n(526292),tT=n(711014),tO=((i={})[i.EMOJI=0]="EMOJI",i[i.EXPAND_OR_COLLAPSE_EMOJIS=1]="EXPAND_OR_COLLAPSE_EMOJIS",i);let tS=[ez.EmojiDisabledReasons.DISALLOW_EXTERNAL,ez.EmojiDisabledReasons.DISALLOW_CUSTOM];var tb=((s={})[s.PREMIUM=0]="PREMIUM",s[s.ROLE_SUBSCRIPTION=1]="ROLE_SUBSCRIPTION",s),tR=n(342379);let tv="expression-guild-",{itemIdForIndex:tL}=(0,tr.J)(tv),tP=`${tv}view-emoji-packs`,tM=(0,eJ.xI)(E.A.EMOJI_PICKER_CONSTANTS_GUILD_CATEGORY_ICON_SIZE),tD=(0,eJ.xI)(E.A.EMOJI_PICKER_CONSTANTS_GUILD_CATEGORY_ICON_MARGIN_VERICAL),tw=(0,eJ.xI)(E.A.EMOJI_PICKER_CONSTANTS_UNICODE_CATEGORY_ICON_SIZE),tk=(0,eJ.xI)(E.A.EMOJI_PICKER_CONSTANTS_UNICODE_CATEGORY_ICON_MARGIN_VERTICAL),tU=(0,eJ.xI)(E.A.EMOJI_PICKER_CONSTANTS_UNICODE_CATEGORY_ICON_PADDING),tG=(0,eJ.xI)(tR.__invalid_unicodeCategoryShortcutHeight),tF=(0,eJ.xI)(E.A.EMOJI_PICKER_CONSTANTS_CATEGORY_SEPARATOR_SIZE),tJ=(0,eJ.xI)(E.A.EMOJI_PICKER_CONSTANTS_CATEGORY_SEPARATOR_MARGIN_VERTICAL),tV=tw+tD+2*tU,tK=tF+2*tJ,tB=tM+tD,tH=tB+tK,tW=tw+tk+2*tU,tX=tw+2*tU+2*tD+tF;function tz(e){let{activeIndex:t,categoryIndex:n,analyticsContext:i,categories:s,category:a,handleCategorySelect:c,isWindowFocused:u,useReducedMotion:d}=e,m=r.useRef(null),{isHoveringOrFocusing:f}=(0,te.A)(m),E=(0,e6.rm)(tL(n)),I=a.type===t_.s.GUILD||a.type===t_.s.PACK?null:a.id,g=t===n,h=!d&&u,p=a.type===t_.s.GUILD?a.guild:null,A=a.type===t_.s.PACK?a.pack:null,_=(0,l.jsxs)(ex.D,{innerRef:m,...E,"aria-label":a.type===t_.s.PACK?a.pack.name:(0,eV.wt)(a,p),className:o()({[tR.ZG]:null!=p,[tR.td]:null!=A,[tR.Bj]:null==p&&null==A,[tR.s6]:null==p&&null==A&&g,[tR.xg]:a.type===t_.s.RECENT}),onClick:()=>{null!=p&&eF.default.track(eL.HAw.EXPRESSION_PICKER_CATEGORY_SELECTED,{location:i?.location,tab:eZ.kx.EMOJI,guild_id:p.id}),c(n)},children:[(0,l.jsx)("div",{className:tR.a$,children:(0,l.jsx)(to.A,{hovered:f,selected:g,size:"small"})}),a.type===t_.s.GUILD?(0,l.jsx)(tC.A,{guild:a.guild,isSelected:g,shouldAnimate:h,isLocked:a.isNitroLocked}):null,null!=A?(0,l.jsx)(Z.A,{alt:"",animated:!d,shouldAnimate:h,className:tR.ty,emojiId:A.representativeEmojiId}):null,null==p&&null!=I?(0,l.jsx)(tN,{categoryId:I,className:tR.Yl,height:tw,width:tw,size:"custom"}):null]}),N=s[n+1],C=s[n-1],x=null!=A&&null!=C&&C.type!==t_.s.PACK,y=null!=A&&N?.type!==t_.s.PACK,j=null!=N&&a.type===t_.s.GUILD&&N.type!==t_.s.GUILD;return null!=p?(0,l.jsxs)(r.Fragment,{children:[(0,l.jsx)(ta.Q,{guild:p,children:_}),j?(0,l.jsx)("hr",{className:tR.ny},"separator"):null]}):null!=A?(0,l.jsxs)(r.Fragment,{children:[x?(0,l.jsx)("hr",{className:tR.ny}):null,(0,l.jsx)(b.m,{ariaHidden:!0,position:"right",text:A.name,children:_}),y?(0,l.jsx)("hr",{className:tR.ny}):null]}):_}let tZ=e=>{let{className:t,emojiListRef:n,sectionDescriptors:i,intention:s,channel:a,fallbackGuildId:c,showOnlyUnicode:u=!1,pinnedPacks:d,onViewEmojiPacks:f}=e,E=ep.Om.useStore(e=>e.activeCategoryIndex),I=function(e){let{emojiListRef:t}=e,n=(0,eA.RQ)(e=>e.searchQuery),i=r.useCallback(e=>t.current?.scrollToSectionTop(e),[t]);return r.useCallback(e=>{""!==n?((0,eA.Ri)(""),ep.Om.setActiveCategoryIndex(e)):i(e)},[i,n])}({sectionDescriptors:i,emojiListRef:n}),g=(0,p.p)(),h=(0,eV.ss)(s,a,{guildId:a?.guild_id??c}),A=r.useMemo(()=>(0,e5.t)(u?(0,eV.CQ)():h,d),[h,d,u]),_=r.useRef(null),N=(0,m.bG)([tc.A],()=>tc.A.isFocused()),C=(0,m.bG)([e9.Ay],()=>e9.Ay.useReducedMotion,[]),x=r.useMemo(()=>e8().memoize((e,t)=>{let n=A[t];if(null!=n)return(0,l.jsx)(tz,{activeIndex:E,analyticsContext:g,categories:A,category:n,categoryIndex:t,handleCategorySelect:I,isWindowFocused:N,useReducedMotion:C},t)},(e,t)=>t),[E,g,A,I,N,C]),y=r.useMemo(()=>[8,8,0,8],[]),j=null!=f?tX:0,T=r.useMemo(()=>{if(null!=f)return function(){return(0,l.jsx)(tl,{listItemId:tP,onClick:f},"view-emoji-packs")}},[f]),O=r.useCallback((e,t)=>{let n=A[t];if(n.type===t_.s.RECENT)return tV;if(n.type===t_.s.PACK){let e=A[t-1],n=A[t+1];return tB+(Number(null!=e&&e.type!==t_.s.PACK)+Number(n?.type!==t_.s.PACK))*tK}if(n.type===t_.s.GUILD){let e=A[t+1];return null!=e&&e.type!==t_.s.GUILD?tH:tB}return tW},[A]),{nonUnicodeCategoryCount:S,firstUnicodeCategoryIndex:b,firstUnicodeCategoryOffsetTop:R,rowCountBySection:v}=r.useMemo(()=>{let e=0,t=0,n=0,i=0;A.forEach(s=>{s.type===t_.s.GUILD||s.type===t_.s.PACK?(t+=1,n+=1):s.type===t_.s.UNICODE?i+=1:(e+=1,t+=1)});let s=[e,n,i],l=A.some(e=>e.type===t_.s.PACK)?A[0]?.type===t_.s.PACK?1:2:0,r=j+tV+t*tB+tH+l*tK;return{nonUnicodeCategoryCount:t,firstUnicodeCategoryIndex:t,firstUnicodeCategoryOffsetTop:r,rowCountBySection:s}},[A,j]),[L,P]=r.useState(!0);r.useLayoutEffect(()=>{P(S>=7)},[S]);let M=r.useCallback(e=>{let t=_.current?.getListDimensions();null==t||(e+t.height-tF>=R?P(!1):P(!0))},[R]),D=r.useCallback(e=>{e(b),_.current?.scrollTo(R)},[R,b]),w=r.useCallback((e,t)=>{let n=A[e];if(null==n)return 0;let i=L?tG:0;if(n.type===t_.s.RECENT)return t?0:tk;if(n.type===t_.s.PACK)return t?i:tD;if(n.type===t_.s.GUILD){let n=A[e+1];return null!=n&&n.type!==t_.s.GUILD?t?tF+-2*tJ+tD+i:tD:t?i:tD}return t?tD+i:2*tD},[A,L]),k=r.useMemo(()=>function(e,t){return(0,l.jsx)(r.Fragment,{children:t},e)},[]),U=L?"shortcut":"hiddenshortcut";return(0,l.jsx)(tr.A,{categoryListRef:_,expressionsListRef:n,className:t,store:ep.Om,categories:A,listPadding:y,onScroll:M,renderCategoryListItem:x,renderSection:k,rowCount:A.length,categoryHeight:O,getScrollOffsetForIndex:w,rowCountBySection:v,navId:"emoji-picker-categories",itemIdPrefix:tv,renderListHeader:T,listHeaderHeight:j,children:e=>S>=7&&(0,l.jsx)(ex.D,{"aria-hidden":!L,"aria-label":Q.intl.string(Q.t.dT0ctw),className:o()(tR.KB,{[tR.h_]:!L}),tabIndex:L?0:-1,onClick:()=>D(e),children:(0,l.jsx)(e7.n,{size:"custom",color:"currentColor",height:tw,width:tw})},U)})};var tY=n(860197);let t$=function(e){let{markAsDismissed:t}=e;return(0,l.jsxs)(V.E,{variant:"text-xs/medium",color:"text-default",className:tY.iE,children:[(0,l.jsx)(tp.HeartIcon,{size:"md",color:"currentColor",className:tY.Kk}),(0,l.jsx)("div",{className:tY.Qs,children:(0,l.jsx)(V.E,{variant:"text-xs/normal",children:Q.intl.string(Q.t.xdRf69)})}),(0,l.jsx)(ex.D,{onClick:()=>t(ti.i.UNKNOWN),children:(0,l.jsx)(ey.P,{size:"md",color:"currentColor",className:tY.VN})})]})};var tq=n(399513),tQ=n(717421),t0=n(343032),t1=n(683063),t2=n(748798);let t3={tension:750,mass:2.5,friction:70};function t5(e){let{checked:t,onClick:n,buttonRef:i}=e,s=(0,m.bG)([e9.Ay],()=>e9.Ay.useReducedMotion),a=U.default.getCurrentUser(),c=null!=a&&!(0,e1.TW)(a),u=c?[]:[f.M.SUPER_REACTION_TOGGLE_EDUCATION_DESKTOP],[d,E]=(0,tn.kn)(u),[I,g]=r.useState(!1),[h,p]=(0,tQ.z)(()=>({})),A=(0,tq.animated)(t0.i);r.useEffect(()=>{let e=d===f.M.SUPER_REACTION_TOGGLE_EDUCATION_DESKTOP;e&&(E(ti.i.DISMISS),setTimeout(()=>g(e),200))},[d,E]);let _=I?Q.intl.string(Q.t["Osi/uy"]):t&&!c?Q.intl.string(Q.t["5cRA/b"]):Q.intl.string(Q.t.buV4av),N=I?Q.intl.string(Q.t.ORK94p):void 0;return(0,l.jsx)(t1.u,{position:"top",title:N,body:_,asset:(0,l.jsx)(L.t,{size:"md",color:"currentColor"}),assetSize:20,forceOpen:I,children:(0,l.jsx)(ex.D,{innerRef:i,"aria-label":_,"aria-pressed":t,onClick:function(){p({from:{rotate:t?"360deg":"0deg"},to:{rotate:t?"0deg":"360deg"},config:t3}),n?.(),g(!1)},focusProps:{enabled:!1},className:o()(t2.Pf,{[t2.wM]:t}),children:(0,l.jsx)(A,{style:s?void 0:h,size:"custom",width:20,height:20,color:t?"white":"currentColor",className:t2.Kk})})})}var t4=n(821609),t8=n(644508),t6=n(824832),t7=n(267102),t9=n(242812);function ne(e){let{channel:t,closePopout:n}=e,i=r.useRef(null),s=r.useRef(0),[a,o]=r.useState(!1),[c,u]=r.useState(!1),d=(0,t7.Us)()===eL.BRT.OVERLAY,m=c||a,f=r.useCallback(async(e,i,l)=>{u(!0),n(),await (0,t8.f)({userImage:{data:e,file:i,image:l},guildId:t?.guild_id??null,analyticsLocation:{section:eL.JJy.EXPRESSION_PICKER,page:t?.guild_id!=null?eL.liQ.GUILD_CHANNEL:eL.liQ.DM_CHANNEL}}),s.current+=1,u(!1)},[t,n]);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(b.m,{asContainer:!0,text:d?Q.intl.string(Q.t.RMbedC):null,children:(0,l.jsx)(t4.$,{text:Q.intl.string(Q.t.iMJO37),variant:"secondary",onClick:function(){i.current?.activateUploadDialogue()},disabled:m||d})}),(0,l.jsx)("div",{className:t9.F,children:(0,l.jsx)(t6.Ay,{ref:i,onChange:f,setLoading:o,disabled:m},s.current)})]})}n(667532);var nt=n(833272),nn=n(82495),ni=n(260762),ns=n(650583),nl=n(683829);let nr=(0,Y.Ld)(),na=nt.A.convert.fromCodePoint("1f44f"),no=(0,eJ.xI)(E.A.EMOJI_PICKER_CONSTANTS_DIVERSITY_EMOJI_SIZE);function nc(e){switch(nt.A.convert.toCodePoint(e)){case"1f3fb":return Q.intl.string(Q.t["BVK5b/"]);case"1f3fc":return Q.intl.string(Q.t.xJWOK8);case"1f3fd":return Q.intl.string(Q.t["MB+T5g"]);case"1f3fe":return Q.intl.string(Q.t.MODud2);case"1f3ff":return Q.intl.string(Q.t["0uzqsc"]);default:return Q.intl.string(Q.t.bGN1ow)}}let nu=e=>{let{fade:t,surrogate:n,onClick:i,delay:s,index:r}=e,a=(0,e6.rm)(`item-${r}`),o=eH.Ay.getURL(na+n),c=(0,tQ.z)({opacity:1,from:{opacity:+!t},delay:s},"animate-always");return(0,l.jsx)(ex.D,{...a,role:"option","aria-selected":0===r,onClick:()=>i(n),className:nl.B6,children:(0,l.jsx)(tq.animated.div,{"aria-label":nc(n),className:nl.g4,style:{backgroundImage:`url("${o}")`,...c}})})};function nd(e){let{id:t,selectedSurrogate:n,onClick:i}=e,s=(0,ni.A)("diversity"),a=(0,tQ.z)({height:(no+14)*(ty.W$.length+1),from:{height:no+14},config:{duration:125}}),o=r.useRef(s);r.useEffect(()=>{o.current.focusFirstVisibleItem()},[]);let c=["",...ty.W$];return e8().remove(c,e=>e===n),c.unshift(n),(0,l.jsx)(e6.hD,{navigator:s,children:(0,l.jsx)(e6.PR,{children:e=>{let{ref:n,...s}=e;return(0,l.jsx)(tq.animated.div,{...s,id:t,ref:n,className:nl.J6,style:a,role:"listbox",children:c.map((e,t)=>(0,l.jsx)(nu,{index:t,fade:0!==t,delay:20*t,surrogate:e,onClick:i},t))})}})})}let nm=function(e){let{searchBarRef:t,selectedSurrogate:n,className:i}=e,s=eH.Ay.getURL(na+n),[a,c]=r.useState(!1),u=(0,nn.A)(null,()=>c(!1)),d=r.useRef(null);return(0,l.jsxs)("div",{ref:u,className:o()(nl.fx,i),children:[(0,l.jsx)(ex.D,{innerRef:d,className:nl.Dj,onClick:function(){c(!0)},"aria-label":Q.intl.formatToPlainString(Q.t["2SfnMp"],{skinTone:nc(n)}),"aria-haspopup":!0,"aria-expanded":a,"aria-controls":nr,tabIndex:a?-1:0,children:(0,l.jsx)("div",{className:nl.g4,style:{backgroundImage:`url("${s}")`}})}),a?(0,l.jsx)("div",{onKeyDown:function(e){e.key===ns.dh.ESCAPE?(e.stopPropagation(),c(!1),null!=d.current&&d.current.focus()):"Tab"===e.key&&c(!1)},children:(0,l.jsx)(nd,{id:nr,selectedSurrogate:n,onClick:function(e){(0,g.dK)(e),c(!1),t.current?.focus()}})}):null]})};var nf=n(462180),nE=n(602034),nI=n(683438);let ng=r.memo(function(e){let{emojiListRef:t,gridNavigatorId:n,onKeyDown:i,onFocus:s,autoFocus:a,defaultSearchPlaceholder:o,ref:c}=e,u=r.useRef(null),d=(0,eA.RQ)(e=>e.searchQuery),[m,f,E]=ep.Om.useStore(e=>[e.inspectedExpressionPosition,e.searchPlaceholder,e.hasInteracted],nf.x),I=r.useCallback(e=>{ep.Om.setActiveCategoryIndex(""===e?0:-1),ep.Om.setInspectedExpressionPosition(0,0),ep.Om.setSearchPlaceholder(null),(0,eA.Ri)(e),t.current?.scrollTo(0)},[t]),g=r.useCallback(()=>{I("")},[I]);return r.useImperativeHandle(c,()=>({focus:()=>u.current?.focus()})),(0,l.jsx)(nI.I,{autoFocus:a,query:d,ref:u,placeholder:f??o,onClear:g,onKeyDown:function(e){switch(e.key){case ns.dh.ARROW_LEFT:case ns.dh.ARROW_RIGHT:case ns.dh.ARROW_UP:case ns.dh.ARROW_DOWN:document.activeElement!==e.target&&e.preventDefault()}i(e)},onFocus:s,onChange:I,inputProps:{role:"combobox","aria-label":Q.intl.string(Q.t.tCauZX),"aria-haspopup":"grid","aria-autocomplete":"list","aria-controls":n,"aria-expanded":!0,...E?{"aria-activedescendant":(0,nE.Aq)(n,m.columnIndex,m.rowIndex)}:void 0}})});var nh=n(381575);let np=function(e){let{channel:t,accessory:n,pickerIntention:i,headerClassName:s,emojiListRef:r,onKeyDown:a,onFocus:c,autoFocus:u,searchBarRef:d,diversitySurrogate:m,isBurstReaction:f,onBurstReactionToggle:E,burstToggleRef:I,renderHeader:g,showAddEmojiButton:h=!0,closePopout:p}=e,A=(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(ng,{emojiListRef:r,gridNavigatorId:t_.lq,onKeyDown:a,ref:d,onFocus:c,autoFocus:u,defaultSearchPlaceholder:(0,eV.wT)(i,f)}),i===ez.EmojiIntention.REACTION?(0,l.jsx)(t5,{checked:f,onClick:E,buttonRef:I}):null,n??(0,l.jsx)(nm,{searchBarRef:d,className:nh.fx,selectedSurrogate:m}),i!==ez.EmojiIntention.NO_CUSTOM_EMOJI&&h?(0,l.jsx)(ne,{channel:t,closePopout:p}):null]});return(0,l.jsx)("div",{className:o()(nh.wx,s),children:null!=g?g(A):A})};var nA=n(182922),n_=n(363195),nN=n(486020),nC=n(977566);function nx(e){return null!=e&&"animated"in e}let ny=r.memo(function(e){let t,i,{className:s,emojiGrid:a,guildId:o,pickerIntention:c,channel:u}=e,d=ep.Om.useStore(e=>e.inspectedExpressionPosition),f=r.useMemo(()=>{let{rowIndex:e,columnIndex:t}=d;return a[e]?.[t]},[a,d]);switch(f?.type){case tO.EMOJI:t=f?.emoji;break;case tO.EXPAND_OR_COLLAPSE_EMOJIS:t={type:"EXPAND_OR_COLLAPSE_EMOJI",guildId:f?.guildId,allNamesString:f?.name};break;default:t=null}let E=(0,m.bG)([eb.A],()=>null!==t&&t.type===T.i.GUILD?eb.A.getGuild(t.guildId):null,[t]),I=(0,m.bG)([tc.A],()=>tc.A.isFocused()),g=(0,m.bG)([e9.Ay],()=>e9.Ay.useReducedMotion,[]),h=eU.Sf.useSetting(),p=(0,eV.O7)(o,nx(t)?t:null),A=(0,m.bG)([j.Ay],()=>j.Ay.expandedSectionsByGuildIds),{newlyAddedEmojis:_}=(0,eX.A)(o,c),N=f?.type===tO.EMOJI?f.subCategory:t_.tm.NONE;if(r.useEffect(()=>{let e=Date.now();return()=>{Date.now()-e>=250&&nx(t)&&N!==t_.tm.NONE&&(N===t_.tm.NEWLY_ADDED_EMOJI&&null!==t&&t.type===T.i.GUILD&&(0,eh.mz)(t.guildId,_[0].id),null!=d.source&&(0,eV.yB)({emoji:t,subCategory:N,position:f.columnIndex+1,newlyAddedHighlight:N===t_.tm.NEWLY_ADDED_EMOJI&&eg.isNewerThanLastSeen(o,t.id)}))}}),null==t)return null;let C=function(e,t){let{allowAnimatedEmoji:i,sectionsExpandedFromThreeRows:s,theme:r}=t;if(nx(e)){let t=null!=e.id?nN.Ay.getEmojiURL({id:e.id,animated:i&&e.animated,size:28}):e.url;return""===t?(0,l.jsx)(V.E,{variant:"text-md/normal",className:nC.J_,children:"surrogates"in e?e.surrogates:null}):(0,l.jsx)("img",{alt:(0,eH.N)(e)??"",src:t,className:nC.Zg})}if("EXPAND_OR_COLLAPSE_EMOJI"!==e.type)return null;{let t=n(619508),i=n(404828),a=n(600003),o=n(318121);return s.has(e.guildId)?(0,l.jsx)("img",{className:nC.Kk,src:(0,eC.M)(r)?a:o,alt:""}):(0,l.jsx)("img",{className:nC.Kk,src:(0,eC.M)(r)?t:i,alt:""})}}(t,{allowAnimatedEmoji:h,sectionsExpandedFromThreeRows:A,theme:n_.A.theme}),x=null!=E?(0,l.jsx)(tC.A,{className:nC.__invalid_guildIcon,guild:E,shouldAnimate:!g&&I}):null;i="EXPAND_OR_COLLAPSE_EMOJI"===t.type?A.has(t.guildId)?Q.intl.string(Q.t["/K2RDH"]):Q.intl.string(Q.t.NZI2Zk):(0,eH.N)(t);let y=function(e){let{inspectedEmoji:t,guild:n}=e,i=nx(t);return null!=n&&i?Q.intl.format(Q.t.KFW2aY,{guildName:n.name}):null}({inspectedEmoji:t,channel:u,guildId:o,intention:c,guild:E});return(0,l.jsx)(nA.A,{className:s,graphicPrimary:C,graphicSecondary:x,titlePrimary:i,titleSecondary:y,isFavorite:p,emojiSubCategory:N})});n(30146);var nj=n(607399),nT=n(123292),nO=n(765178),nS=n(537652),nb=n(962125),nR=n(240864),nv=n(286509),nL=n(89366),nP=n(10392),nM=n(82498),nD=n(202639),nw=n(414872),nk=n(285373),nU=n(304072),nG=n(189551),nF=n(594061),nJ=n(771104),nV=n(147421),nK=n(723702),nB=n(140735),nH=n(194261),nW=n(703413);let nX=e=>{let{src:t,alt:n,size:i,"aria-label":s,className:a}=e,c=r.useRef(null),u=r.useRef(!1),d=u.current?nW.S:nW.Y;return(0,l.jsx)("img",{className:o()(d,a),alt:n,src:t,ref:c,"aria-label":s,style:{backgroundSize:i,height:i,width:i},onLoad:u.current?void 0:e=>{(e.currentTarget?.ownerDocument?.defaultView??window).requestAnimationFrame(()=>{null!=c.current&&(u.current=!0,c.current.classList.remove(nW.Y),c.current.classList.add(nW.S))})}})};var nz=n(955388);let nZ=e8().memoize(e=>`${e*ez.EmojiSprites.NonDiversityPerRow}px ${e*Math.ceil(ty.Ay.numNonDiversitySprites/ez.EmojiSprites.NonDiversityPerRow)}px`),nY=e8().memoize(e=>`${e*ez.EmojiSprites.DiversityPerRow}px ${e*Math.ceil(ty.Ay.numDiversitySprites/ez.EmojiSprites.DiversityPerRow)}px`),n$=r.memo(function(e){let{emoji:t,size:i,surrogateCodePoint:s,allowAnimatedEmoji:a,"aria-label":c,isLocked:u}=e,d=(()=>{if(!t.useSpriteSheet){let e=null==t.id?t.url:nN.Ay.getEmojiURL({id:t.id,animated:a&&t.animated,size:ez.EMOJI_URL_BASE_SIZE});return null!=e?(0,l.jsx)(nX,{className:nz.N1,"aria-label":c,src:e,size:i,alt:(0,eH.N)(t)??""}):null}return(0,l.jsx)("div",{className:o()(nz.xA,{[nz.N1]:u}),style:function(e,t,i){let s,l,r;if(!e.useSpriteSheet)return;let a=null!=e.index?e.index:0;e.hasDiversity?(s=n(12303)(`./spritesheet-${t}-${i}.png.js`).default,l=nY(i),r=ez.EmojiSprites.DiversityPerRow):(s=n(145519)(`./spritesheet-emoji-${i}.png.js`).default,l=nZ(i),r=ez.EmojiSprites.NonDiversityPerRow);let o=-a%r*i,c=-Math.floor(a/r)*i;return{backgroundImage:`url('${s}')`,backgroundPosition:`${o}px ${c}px`,backgroundSize:l,height:i,width:i}}(t,s,i),children:(0,l.jsx)(nB.A,{children:c})})})();return(0,l.jsxs)(r.Fragment,{children:[d,u?(0,l.jsx)("div",{className:nz.iD,style:{width:i,height:i},children:(0,l.jsx)(nH.LockIcon,{size:"xs",color:"currentColor",className:nz.fi})}):null]})});var nq=n(537911);function nQ(e){let t,{emoji:n,isFavorite:i,isLargeSize:s,isMediumSize:r,isInspected:a,isDisabled:c,showPulse:u,columnIndex:d,rowIndex:f,size:E,surrogateCodePoint:I,allowAnimatedEmoji:g,selectedItemClassName:h,inNitroLockedSection:p,ref:A,..._}=e,N=(0,m.bG)([eb.A],()=>n.type===T.i.GUILD?eb.A.getGuild(n.guildId):void 0,[n]);return(0,l.jsx)(X.vN,{children:(0,l.jsx)("button",{..._,className:o()(nq._X,{[nq.lG]:s,[nq.Lh]:r,[nq.Bx]:a,[h??""]:a,[nq.TV]:u}),"data-type":$.g.EMOJI,"data-id":n.id,"data-name":n.name,"data-surrogates":"surrogates"in n?n.surrogates:null,"data-animated":n.animated?"true":null,ref:A,children:(0,l.jsx)(n$,{"aria-label":(t=(0,eH.N)(n),(N?.name!=null&&(t=Q.intl.formatToPlainString(Q.t["nXv4/B"],{names:t,guildName:N.name})),i)?Q.intl.formatToPlainString(Q.t["9FI9Z0"],{names:t}):t),columnIndex:d,rowIndex:f,emoji:n,size:E,surrogateCodePoint:I,allowAnimatedEmoji:g,isLocked:c&&!p})})})}function n0(e){let{descriptor:t,emojiItemKey:i,isInspected:s,rowIndex:a,channelGuildId:o,onInspect:c,onSelect:u,isScrolling:d,isUsingKeyboardNavigation:f,showEmojiFavoriteTooltip:E,surrogateCodePoint:I,selectedItemClassName:g,getEmojiItemProps:h,isMediumSize:p,isLargeSize:A,pulseItemKey:_,allowAnimatedEmoji:N,setPulseItemKey:C,messageId:x,isBurstReaction:y,rowPosition:O,inNitroLockedSection:S}=e,[R,v]=r.useState(""),L=(0,m.bG)([e9.Ay],()=>e9.Ay.useReducedMotion),P=(0,m.bG)([j.Ay],()=>j.Ay.getDisambiguatedEmojiContext(o),[o]),M=r.useRef(null),{emoji:D,size:w,isDisabled:k,columnIndex:U}=t;function G(){d.current||f.current||c(t)}let{ref:F,tabIndex:J,onFocus:V,...K}=h(U,a)??{},B=R!==`${U}:${a}`?(0,l.jsx)(nQ,{ref:F,emoji:D,isFavorite:P.isFavoriteEmojiWithoutFetchingLatest(D),isLargeSize:A,isMediumSize:p,isInspected:s,isDisabled:k,showPulse:_===i,allowAnimatedEmoji:N,onFocus:V??G,onMouseMove:G,onClick:e=>{if(null!=M.current&&null!=O&&null!=x&&!e.shiftKey&&null!=D.name&&y&&!L&&N){let e=null==D.id?ty.Ay.convertNameToSurrogate(D.name):D.name,t=M.current.getBoundingClientRect();t.x=O.x+(U+1)*w,v(`${U}:${a}`),(0,nV.h)(x,e,D.id,t)}!function(e){if(e.stopPropagation(),d.current||f.current)return;let n=e.altKey;n&&!j.Ay.getDisambiguatedEmojiContext().isFavoriteEmojiWithoutFetchingLatest(D)&&C(i),(0,ew.sF)(ew._2.FAVORITE_EMOJI_TOOLTIP),u(t,{isFinalSelection:!e.shiftKey,toggleFavorite:n})}(e)},onContextMenu:function(e){(0,z.L3)(e,async()=>{let{default:e}=await Promise.all([n.e("638221"),n.e("73500"),n.e("496715"),n.e("904774"),n.e("446132")]).then(n.bind(n,233503));return t=>(0,l.jsx)(e,{...t,showFavoriteOnly:D.type===T.i.PACK})})},tabIndex:J,columnIndex:U,rowIndex:a,size:w,surrogateCodePoint:I,selectedItemClassName:g,inNitroLockedSection:S}):null;return(0,r.createElement)("li",{...K,key:i,ref:M},E?(0,l.jsx)(b.m,{text:Q.intl.formatToPlainString(Q.t.glqNsf,{key:(0,nK.isMac)()?"Opt":"Alt"}),position:"top",delay:200,children:B}):B)}let n1=e=>{let{emojiDescriptors:t,emojiSize:i,onSelect:s,onInspect:a,surrogateCodePoint:c,getEmojiItemProps:u,getEmojiRowProps:d,isScrolling:m,isUsingKeyboardNavigation:f,rowIndex:E,allowAnimatedEmoji:I,showEmojiFavoriteTooltip:g,channelGuildId:h,category:p,selectedItemClassName:A,messageId:_,isBurstReaction:N,inNitroLockedSection:C,handleScrollUpOnSectionCollapse:x}=e,y=n(619508),j=n(404828),O=n(600003),S=n(318121),b=n(443336),R=n(258901),v=n(135974),L=n(8013),P=(0,eT.Ay)(),M=ep.Om.getState(),[D,w]=r.useState(M.inspectedExpressionPosition),[k,U]=(0,nU.A)(null,300),G=r.useRef(null);r.useEffect(()=>ep.Om.subscribe(e=>e.inspectedExpressionPosition,e=>w(e)),[]),r.useEffect(()=>{nF.bW.loadIfNecessary()},[]);let F=i===t_.as.LARGE,J=i===t_.as.MEDIUM;function K(e){let t=`${e.rowIndex}c${e.columnIndex}`;switch(e.type){case tO.EXPAND_OR_COLLAPSE_EMOJIS:{let{visibleRowIndex:n,columnIndex:i}=e,c=D.rowIndex===n&&D.columnIndex===i,d=e.sectionCollapsedToThreeRows?c?(0,eC.M)(P)?R:L:(0,eC.M)(P)?y:j:c?(0,eC.M)(P)?b:v:(0,eC.M)(P)?O:S,I=Q.intl.string(e.sectionCollapsedToThreeRows?Q.t.NZI2Zk:Q.t["/K2RDH"]);return function(){let{onMouseEnter:n,onMouseLeave:i,handleSelect:s,icon:c,ariaLabel:d,shouldShowRoundHighlight:I}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{visibleRowIndex:g,columnIndex:h}=e,{ref:p,tabIndex:_,onFocus:N,...C}=u(h,E)??{},x=D.rowIndex===g&&D.columnIndex===h;function y(){m.current||f.current||a(e)}return(0,r.createElement)("li",{...C,key:t},(0,l.jsx)(X.vN,{children:(0,l.jsx)("button",{"aria-label":d,ref:p,className:o()(nq._X,{[nq.lG]:F,[nq.Lh]:J,[nq.Bx]:x&&!I,[A??""]:x,[nq.TV]:k===t}),onFocus:N??y,onMouseOver:y,onMouseEnter:n,onMouseLeave:i,onClick:s,tabIndex:_,children:c})}))}({handleSelect:function(t){e.type!==tO.EXPAND_OR_COLLAPSE_EMOJIS||(t.stopPropagation(),m.current||f.current||(s(e,{isFinalSelection:!0,toggleFavorite:!1}),(0,nG.G)(e.guildId),e.sectionCollapsedToThreeRows||x(),eF.default.track(eL.HAw.EMOJI_PICKER_THREE_ROW_COLLAPSE_TOGGLED,{collapsed:e.sectionCollapsedToThreeRows,guild_id:e.guildId})))},icon:(0,l.jsx)("img",{className:nq.Kk,src:d,alt:""}),ariaLabel:I,shouldShowRoundHighlight:!0})}case tO.EMOJI:{let{columnIndex:n,visibleRowIndex:i}=e,r=D.rowIndex===i&&D.columnIndex===n;return(0,l.jsx)(n0,{rowIndex:E,descriptor:e,emojiItemKey:t,isInspected:r,isScrolling:m,isUsingKeyboardNavigation:f,surrogateCodePoint:c,allowAnimatedEmoji:I,selectedItemClassName:A,onSelect:s,onInspect:a,channelGuildId:h,getEmojiItemProps:u,isMediumSize:J,isLargeSize:F,pulseItemKey:k,setPulseItemKey:U,showEmojiFavoriteTooltip:g,messageId:_,isBurstReaction:N,rowPosition:G?.current?.getBoundingClientRect(),inNitroLockedSection:C},t)}}}function B(e){return(0,l.jsx)("ul",{...d(E),className:o()(nq.ND,{[nq.HO]:F,[nq.X$]:J}),ref:G,children:e.map(K)})}if(p!==t_.s.TOP_GUILD_EMOJI)return B(t);let H=t.filter(e=>e.subCategory===t_.tm.TOP_GUILD_EMOJI||e.subCategory===t_.tm.NEWLY_ADDED_EMOJI&&e.emoji.type===T.i.GUILD&&!eg.isNewerThanLastSeen(e.emoji.guildId,e.emoji.id)),W=t.filter(e=>e.subCategory===t_.tm.NEWLY_ADDED_EMOJI&&e.emoji.type===T.i.GUILD&&eg.isNewerThanLastSeen(e.emoji.guildId,e.emoji.id));return 0===W.length?B(t):(0,l.jsxs)("div",{className:nq.Ng,children:[(0,l.jsx)("div",{className:o()(nq.V6,{[nq.$3]:0===H.length}),children:B(H)}),(0,l.jsxs)("div",{className:nq.bc,children:[(0,l.jsx)("div",{className:o()(nq.eE,{[nq.eM]:1===W.length,[nq.Wk]:H.length>0}),children:B(W)}),(0,l.jsxs)("div",{className:o()(nq.lD,{[nq.EI]:F,[nq.qU]:J,[nq.Wk]:H.length>0}),children:[(0,l.jsx)(nJ.A,{foreground:nq.rI}),(0,l.jsx)(V.E,{variant:"text-xs/semibold",color:"text-overlay-light",children:Q.intl.string(Q.t.y2b7CA)})]})]})]})};var n2=n(618723);let n3=(0,eJ.xI)(E.A.EMOJI_PICKER_CONSTANTS_EMOJI_LIST_PADDING_TOP),n5=(0,eJ.xI)(E.A.EMOJI_PICKER_CONSTANTS_EMOJI_LIST_PADDING_RIGHT),n4=(0,eJ.xI)(E.A.EMOJI_PICKER_CONSTANTS_EMOJI_LIST_PADDING_BOTTOM),n8=(0,eJ.xI)(E.A.EMOJI_PICKER_CONSTANTS_EMOJI_LIST_SEARCH_RESULTS_PADDING_TOP),n6=(0,eJ.xI)(E.A.EXPRESSION_PICKER_CONSTANTS_EXPRESSION_PICKER_LIST_SECTION_HEADING_HEIGHT),n7=(0,eJ.xI)(E.A.EMOJI_PICKER_CONSTANTS_EMOJI_SECTION_MARGIN_BOTTOM),n9=(0,eJ.xI)(E.A.EMOJI_PICKER_CONSTANTS_EMOJI_CONTAINER_PADDING_VERTICAL),ie=r.memo(function(e){let t,n,{diversitySurrogate:i,emojiGrid:s,emojiListRef:a,emojiSize:c,onEmojiSelect:u,onRemovePack:d,setUpsellConfigs:f,sectionDescriptors:E,rowCountBySection:I,collapsedSections:g,setCollapsedSections:h,getEmojiItemProps:A,getEmojiRowProps:_,rowCount:C,isUsingKeyboardNavigation:y,channelGuildId:j,messageId:T,isBurstReaction:O,listHeaderClassName:S}=e,b=r.useRef(!1),R=ep.Om.useStore(e=>e.activeCategoryIndex),v=(0,eA.RQ)(e=>e.searchQuery),P=eU.Sf.useSetting(),M=(0,m.bG)([U.default],()=>U.default.getCurrentUser()),D=(0,G.ki)(M),{location:w}=(0,p.p)(),{analyticsLocations:k}=(0,x.Ay)(),[F,J]=r.useState(0),[K,B]=r.useState(!1),{listPadding:H,renderRow:W,renderSection:X,renderSectionHeader:z,renderSectionFooter:Z,sectionMarginBottom:Y,sectionHeaderHeight:ee,sectionFooterHeight:et}=function(e){let{collapsedSections:t,diversitySurrogate:n,emojiGrid:i,emojiSize:s,onEmojiSelect:a,onRemovePack:c,searchQuery:u,sectionDescriptors:d,setCollapsedSections:f,getEmojiItemProps:E,getEmojiRowProps:I,isScrolling:g,isUsingKeyboardNavigation:h,allowAnimatedEmoji:A,channelGuildId:_,messageId:N,isBurstReaction:C,listHeaderClassName:x,activeSectionIndex:y,emojiListRef:j}=e,T=(0,p.p)(),O=r.useRef(eL.An1),S=r.useMemo(()=>""!==n?nt.A.convert.toCodePoint(n):"",[n]),b=r.useCallback(e=>{let t=d[e],n=d[e+1];return e>=d.length-1?t.isNitroLocked:t.isNitroLocked&&!n.isNitroLocked},[d]),R=r.useCallback(e=>{if(e>=d.length-1)return!1;let t=d[e],n=d[e+1];return!t.isNitroLocked&&n.isNitroLocked},[d]),v=r.useCallback(function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=new Set(t),s=t.has(e);s?i.delete(e):i.add(e),null!=n&&eF.default.track(eL.HAw.EXPRESSION_PICKER_CATEGORY_COLLAPSE_TOGGLED,{location:T.location,tab:eZ.kx.EMOJI,collapsed:!s,guild_id:n.id}),f(i)},[T,t,f]),P=r.useCallback(e=>{let{columnIndex:t,visibleRowIndex:n}=e,i=e.type===tO.EMOJI?(0,eH.N)(e.emoji):e.name;O.current!==eL.An1&&window.cancelAnimationFrame(O.current),O.current=window.requestAnimationFrame(()=>{ep.Om.setInspectedExpressionPosition(t,n,$.t.MOUSE_EVENT),ep.Om.setSearchPlaceholder(i),O.current=eL.An1})},[]),M=(0,m.bG)([ew.HP],()=>ew.HP.hasHotspot(ew._2.FAVORITE_EMOJI_TOOLTIP),[]),D=r.useMemo(()=>e8().memoize((e,t)=>{let n=i[e],r=d[t.sectionIndex];return(0,l.jsx)(n1,{emojiDescriptors:n,emojiSize:s,surrogateCodePoint:S,onInspect:P,onSelect:a,getEmojiItemProps:E,getEmojiRowProps:I,isScrolling:g,isUsingKeyboardNavigation:h,rowIndex:e,allowAnimatedEmoji:A,showEmojiFavoriteTooltip:M,channelGuildId:_,category:r.sectionId,selectedItemClassName:n2.__invalid_selectedItem,messageId:N,isBurstReaction:C,inNitroLockedSection:r.isNitroLocked,handleScrollUpOnSectionCollapse:function(){j.current?.scrollToSectionTop(t.sectionIndex,{animate:!0})}},e)}),[i,d,s,S,P,a,E,I,g,h,A,M,_,N,C,j]);r.useEffect(()=>()=>D.cache?.clear?.(),[D]);let w=r.useMemo(()=>e8().memoize(e=>{let n=d[e];if(null==n)return;let{guild:i,pack:s,categoryId:r,type:a,sectionId:u}=n;if(a===t_.s.SEARCH_RESULTS)return;let m=function(e){let{type:t,guild:n,categoryId:i}=e;return t===t_.s.PACK?(0,l.jsx)(L.t,{size:"custom",color:"currentColor",height:16,width:16}):t===t_.s.GUILD?null==n?null:(0,l.jsx)(tC.A,{guild:n,height:16,width:16}):null==i?null:(0,l.jsx)(tN,{categoryId:i,height:16,width:16,size:"custom"})}(n),f=s?.name??i?.name;null!=r&&(f=(0,eV.Nu)(r,i?.name));let E=y===e,I=n.isNitroLocked,g=I&&!E,h=I&&E,p=a===t_.s.PACK?(0,l.jsx)("div",{className:n2.uE,children:(0,l.jsx)(nT.Q,{text:Q.intl.string(q.default["2zxYCx"]),textVariant:"text-sm/medium",variant:"secondary","aria-label":`${Q.intl.string(q.default["2zxYCx"])} ${s.name}`,onKeyDown:e=>{e.key!==ns.dh.ESCAPE&&e.stopPropagation()},onClick:()=>c(s.id)})}):void 0;return(0,l.jsx)(nv.A,{className:o()(n2.wx,x,{[n2.RA]:g,[n2.sp]:h}),icon:m,isCollapsed:t.has(u),onClick:()=>v(u,i),trailing:p,children:f},u)}),[d,t,v,x,y,c]),k=(0,tj.k0)(),U=r.useCallback((e,n)=>{let i=d[e],s=R(e),r=b(e),a=i.type===t_.s.PACK&&0===i.count;return(0,l.jsx)("div",{role:"rowgroup",className:o()(n2.Wy,{[n2.YD]:e===d.length-1,[n2.jl]:t.has(i.sectionId)||a,[n2.cW]:i.isNitroLocked,[n2.T5]:s||r}),children:n},e)},[t,d,R,b]),G=r.useCallback(e=>R(e)?k?(0,l.jsx)(nw.ap,{}):(0,l.jsx)(nw.Ay,{}):b(e)?(0,l.jsx)("div",{className:n2.pQ}):null,[R,b,k]),F=r.useCallback(e=>R(e)?41:33*!!b(e),[R,b]),J=r.useCallback(e=>e===d.length-1||t.has(d[e]?.sectionId)||d[e]?.type===t_.s.PACK&&d[e]?.count===0||R(e)||b(e)?0:n7,[t,d,R,b]);return{listPadding:r.useMemo(()=>[""!==u?n8:n3,n5,n4,0],[u]),renderRow:D,renderSection:U,renderSectionHeader:w,renderSectionFooter:G,sectionMarginBottom:J,sectionHeaderHeight:r.useCallback(e=>d[e].type===t_.s.SEARCH_RESULTS?0:n6,[d]),sectionFooterHeight:F}}({collapsedSections:g,diversitySurrogate:i,emojiGrid:s,emojiSize:c,onEmojiSelect:u,onRemovePack:d,searchQuery:v,sectionDescriptors:E,setCollapsedSections:h,getEmojiItemProps:A,getEmojiRowProps:_,isScrolling:b,isUsingKeyboardNavigation:y,allowAnimatedEmoji:P,channelGuildId:j,messageId:T,isBurstReaction:O,listHeaderClassName:S,activeSectionIndex:F,emojiListRef:a}),ei=r.useCallback(e=>{let t=a.current?.getSectionDescriptors();null==t||J(Math.max(t.findLastIndex(t=>t.offset.top<=e),0))},[a]);r.useLayoutEffect(()=>{ei(a.current?.getScrollerNode()?.scrollTop??0)},[a,ei,E,I,v]);let es=(0,e_.Fk)({activeCategoryIndex:R,isScrolling:b,listRef:a,onActiveCategoryIndexChange:function(e){""===v&&ep.Om.setActiveCategoryIndex(e)},scrollOffset:0,searchQuery:v,disableForSearch:!1});(0,e_.FV)({searchQuery:v,activeCategoryIndex:R,listRef:a});let el=r.useCallback(e=>{es(e),ei(e),it({emojiListRef:a,sectionDescriptors:E,scrollTop:e,searchQuery:v,setShowUpsell:B})},[es,ei,a,E,v,B]),er=E.length>0;r.useEffect(()=>{K&&(eF.default.track(eL.HAw.PREMIUM_UPSELL_VIEWED,{type:en.e.EMOJI_PICKER_FLOATING_UPSELL,location:w,location_stack:k}),(0,nP.sq)(eL.U7l.PREMIUM_UPSELL_VIEWED,k,()=>(0,nM.uq)(en.e.EMOJI_PICKER_FLOATING_UPSELL)))},[w,k,K]),r.useEffect(()=>{""!==v&&B(!1)},[v]);let ea=r.useRef(null);return r.useEffect(()=>(clearTimeout(ea.current),ea.current=setTimeout(()=>{er?nO.O.announce(Q.intl.string(Q.t.uZ4F2O),"polite"):nO.O.announce(Q.intl.string(Q.t.IxxiKF),"assertive"),ea.current=null},200),()=>{clearTimeout(ea.current)}),[er,v]),(0,l.jsxs)("div",{className:n2.AD,children:[er?(0,l.jsx)(nb.A,{role:"none presentation",className:n2.p_,listPadding:H,onScroll:el,renderRow:W,renderSection:X,renderSectionHeader:z,renderSectionFooter:Z,rowCount:C,rowCountBySection:I,rowHeight:c+2*n9,sectionHeaderHeight:ee,sectionMarginBottom:Y,sectionFooterHeight:et,stickyHeaders:!0,ref:a}):(0,l.jsx)(nS.A,{message:(0,l.jsx)(V.E,{variant:"text-md/normal",color:"text-muted",children:Q.intl.string(Q.t.IxxiKF)}),className:n2.BZ}),D||nj.Fr?null:(0,l.jsx)(nD.d,{showUpsell:K,text:(t=(0,e1.Dd)(en.PremiumTypes.TIER_2),Q.intl.format(Q.t.gMVjeS,{nitroTierName:t,onClick:()=>{f({type:tb.PREMIUM,emojiDescriptor:void 0})}})),button:(n=(0,nL.qD)(),(0,e1.LE)(n,en.pe.TIER_2)??Q.intl.string(Q.t.BmJkbd)),buttonAnalyticsObject:{section:eL.JJy.EMOJI_PICKER_FLOATING_UPSELL},leadingAction:(0,l.jsx)(nk.l,{size:"sm",className:n2.ij,location:N.A.PREMIUM_WISHLIST_EMOJI_UPSELL})})]})}),it=e8().throttle(function(e){let{emojiListRef:t,sectionDescriptors:n,scrollTop:i,searchQuery:s,setShowUpsell:l}=e;l((0,nR.s)({listRef:t,searchQuery:s,nitroLockedSectionStates:n,scrollTop:i}).areOnlyNitroLockedSectionsVisible)},300,{leading:!1,trailing:!0});var ii=n(506774),is=n(28863),il=n(277984),ir=n(404374),ia=n(780964),io=n(766075),ic=n(166403),iu=n(506150);let id="premiumRetentionEmojiPickerNotice",im=ii.w.get(id),iE=function(e){let{closePopout:t,channel:n}=e,[i,s]=r.useState(!1),{subscription:a,hasFetchedSubscriptions:o}=(0,m.cf)([ic.A],()=>({subscription:ic.A.getPremiumSubscription(),hasFetchedSubscriptions:ic.A.hasFetchedSubscriptions()}));if(r.useEffect(()=>{o||(0,il.hP)()},[o]),null==a||!(0,e1.PK)(a.status)||i)return null;let c=a.status===eL.Dmq.PAST_DUE?(0,e1.ji)(a).expiresDate:eo()(a.currentPeriodStart).add(en.ph),u=`${a.id}:${c.toISOString()}`;if(im===u)return null;let d=e1.Ay.getPremiumType(a.planId)===en.PremiumTypes.TIER_0?ir.k0.PREMIUM_TIER_0:e1.Ay.getPremiumType(a.planId)===en.PremiumTypes.TIER_1?ir.k0.PREMIUM_TIER_1:ir.k0.PREMIUM_TIER_2;return(0,l.jsxs)(V.E,{variant:"text-xs/medium",color:"text-default",className:iu.g$,children:[(0,l.jsx)(L.t,{size:"md",className:iu.lu,color:d}),(0,l.jsxs)("div",{className:iu.Xn,children:[(0,l.jsx)(V.E,{variant:"text-xs/normal",children:Q.intl.format(Q.t.bTMjiO,{planName:e1.Ay.getTierDisplayNameByPlanId(a.planId),endsAt:c.toDate()})}),(0,l.jsx)("div",{children:(0,l.jsx)(is.Anchor,{onClick:()=>{(0,eV.xf)(n),t(),(0,io.openUserSettings)(ia.X.NITRO_PANEL)},children:Q.intl.string(Q.t.W3aavh)})})]}),(0,l.jsx)(ex.D,{onClick:()=>{ii.w.set(id,u),im=u,s(!0)},children:(0,l.jsx)(ey.P,{size:"md",color:"currentColor",className:iu.YF})})]})};var iI=n(148361);let ig=(0,eJ.xI)(E.A.EMOJI_PICKER_CONSTANTS_EMOJI_CONTAINER_PADDING_HORIZONTAL),ih=(0,eJ.xI)(E.A.EMOJI_PICKER_CONSTANTS_EMOJI_LIST_PADDING_LEFT);function ip(e){return e.stopPropagation()}function iA(e,t){ep.Om.setInspectedExpressionPosition(e,t,$.t.GRID_NAVIGATOR_EVENT)}let i_=u()(eV.bo,200),iN=u()(eV.Wi,200),iC={section:void 0,openPopoutType:void 0,popoutLocation:void 0},ix=r.memo(function(e){let t,n,i,s,a,{pickerIntention:c,channel:u,guildId:E,closePopout:S,emojiSize:b=t_.as.MEDIUM,hasTabWrapper:R=!1,onSelectEmoji:v,containerWidth:L,onNavigateAway:P,persistSearch:M,className:D,headerClassName:w,analyticsOverride:k=iC,searchProps:J={},wrapper:V,shouldHidePickerActions:K=!1,messageId:B,renderHeader:H,listHeaderClassName:W,categoryListClassName:X,showOnlyUnicode:z=!1,showAddEmojiButton:Z,ref:Y,isViewingEmojiPacks:q=!1,onViewEmojiPacksChange:ee}=e,{onFocus:et,onKeyDown:ei,autoFocus:ea=!0,accessory:eo}=J,ec=(0,m.bG)([eG.Ay],()=>null!=E?eG.Ay.getDefaultChannel(E):null,[E]),[eu,ed]=r.useState(null),em=r.useRef(""),ef=(0,eA.RQ)(e=>e.searchQuery),eE=r.useRef(null),eI=r.useRef(null),eN=r.useRef(null),eC=null!=ee&&!z&&(0,e5.z)(c),ex=r.useCallback(e=>{eN.current?.focus(),(0,O.M5)(e)},[]),ey=(t=(0,m.bG)([F.A],()=>eC?F.A.getPacks():er,[eC]),n=(0,m.bG)([el.A],()=>eC?el.A.frecencyWithoutFetchingLatest.pinnedEmojiPacks?.packIds:void 0,[eC]),r.useMemo(()=>eC&&null!=n&&0!==n.length?n.map(e=>t.find(t=>t.id===e)).filter(e=>null!=e):er,[eC,t,n]));null==u&&null!=ec&&(u=ec);let ej=u?.getGuildId()??E??null,[eT,eO]=r.useState(!1),eS=r.useRef(null),eR=U.default.getCurrentUser(),ev=(0,G.ki)(eR),eP=eT&&ev;r.useImperativeHandle(Y,()=>({onPickerOpen:tr}));let{location:eM}=(0,p.p)(),{page:eJ,section:eK,object:eB,openPopoutType:eZ,popoutLocation:e$}=k,eq=r.useMemo(()=>({...eM,section:eK??eL.JJy.EMOJI_PICKER_POPOUT}),[eM,eK]),{analyticsLocations:eQ}=(0,x.Ay)(N.A.EMOJI_PICKER),{diversitySurrogate:e0}=(0,m.cf)([j.Ay],()=>({diversitySurrogate:j.Ay.diversitySurrogate})),e1=(0,eV.sL)(ef,u,c,z),e2=null==e1?0:e1.locked.length+e1.unlocked.length,e4=eU.iM.useSetting(),e6=r.useMemo(()=>new Set(e4),[e4]),e7=r.useCallback(e=>{eU.iM.updateSetting(Array.from(e))},[]),e9=(0,e_.oV)({gridWrapperRef:eE,containerWidth:L,showingEmptyState:q,listPaddingLeft:ih,listScrollbarWidth:8}),{rowCountBySection:te,sectionDescriptors:tt,emojiGrid:tn,columnCounts:ts}=function(e){let{channel:t,fallbackGuildId:n,collapsedSections:i,pickerIntention:s,emojiSearchResults:l,gridWidth:a,emojiPaddingHorizontal:o,emojiSpriteSize:c,pinnedPacks:u,showOnlyUnicode:d}=e,f=(0,m.bG)([j.Ay],()=>j.Ay.categories),E=r.useMemo(()=>d?ty.Ay.getCategories():f,[f,d]),I=(0,m.bG)([eb.A],()=>eb.A.getGuild(t?.getGuildId()),[t]),g=t?.getGuildId()??n,h=(0,m.bG)([j.Ay],()=>j.Ay.getDisambiguatedEmojiContext(g),[g]),p=(0,eV.XI)(g),A=(0,eV.Fj)(g),_=(0,eV.QZ)(g),{topEmojis:N,newlyAddedEmojis:C}=(0,eX.A)(g,s),x=(0,m.yK)([tT.Ay],()=>tT.Ay.getFlattenedGuildIds(),[]),y=(0,m.bG)([j.Ay],()=>j.Ay.expandedSectionsByGuildIds),T=(0,m.bG)([U.default],()=>U.default.getCurrentUser()),O=(0,G.ki)(T),S=(0,G.ki)(T,en.PremiumTypes.TIER_2),b=(0,tj.k0)(),R=h.getGroupedCustomEmoji();return r.useMemo(()=>{let e=[],n=[],r=[],d=[],m=0,f=0;if(null!=h&&null!=a){let T=Math.floor(a/(c+2*o)),v=3*T;function g(l,a){let o=new Map,u=i.has(a.sectionId),[E,I]=e8().partition(l,e=>{let n=eH.Ay.isEmojiDisabled({emoji:e,channel:t,intention:s});return o.set(e,n),!n}),g=E.concat(I),h=a.guild,p=g.length>v&&null!=h&&a.isNitroLocked,A=p&&!y.has(h.id);A&&g.splice(v-1);let _=Math.ceil((p?g.length+1:g.length)/T),x=[];for(let e=0;e<_;e++){let t=e*T,n=t+T,i=g.slice(t,n).map((e,t)=>({type:0,emoji:e,size:c,isDisabled:o.get(e),rowIndex:f,columnIndex:t,visibleRowIndex:m,category:a.type,subCategory:a.sectionId===t_.s.TOP_GUILD_EMOJI?(0,eV.DA)(N,C,e.id??e.uniqueName??e.name):t_.tm.NONE}));if(x.push(i),!u){if(p&&e===_-1){let t=x[e];t.push({type:1,guildId:h.id,name:Q.intl.string(Q.t.NZI2Zk),size:c,rowIndex:e,columnIndex:t.length,visibleRowIndex:m,sectionCollapsedToThreeRows:A})}d.push(i.length),r.push(i),m++}f++}let j={...a,count:l.length};n.push(j),e.push(u?0:_)}if(null!=l)0!==l.unlocked.length&&g(l.unlocked,{type:t_.s.SEARCH_RESULTS,sectionId:t_.s.SEARCH_RESULTS,count:l.unlocked.length,isNitroLocked:!1}),0!==l.locked.length&&g(l.locked,{type:t_.s.PREMIUM_UPSELL,categoryId:t_.R2.PREMIUM_UPSELL,sectionId:t_.s.PREMIUM_UPSELL,count:l.locked.length,isNitroLocked:!O});else{let e=E.includes(t_.R2.CUSTOM)?t_.R2.CUSTOM:ty.Ay.getCategories()[0];for(let n of E){if(n===e)for(let e of u){let t=e8().compact(e.emojis.map(e=>{let{id:t}=e;return h.getById(t)}));g(t,{type:t_.s.PACK,pack:e,sectionId:`pack:${e.id}`,count:t.length,isNitroLocked:!S})}if(n===t_.R2.CUSTOM){function j(e){let i=R.get(e);if(null==i)return;let l=i.filter(n=>!tS.includes(eH.Ay.getEmojiUnavailableReason({emoji:n,channel:t??eG.Ay.getDefaultChannel(e),intention:s})));if(0===l.length)return;let r=eb.A.getGuild(e),a=b||!O&&eH.Ay.isEmojiCategoryNitroLocked({categoryEmojis:l,channel:t,intention:s});g(l,{categoryId:n,guild:r,type:t_.s.GUILD,sectionId:null!=r?r.id:(0,tx.A)(),count:l.length,isNitroLocked:a})}if(null!=I&&j(I.id),(0,ez.isExternalEmojiAllowedForIntention)(s))for(let e of x)(null==I||I.id!==e)&&j(e)}else if(n===t_.R2.TOP_GUILD_EMOJI){if(null!=I){let{allEmojis:e}=(0,eW.W)({topEmojis:N,newlyAddedEmojis:C});e.length>0&&g(e,{categoryId:n,guild:eb.A.getGuild(I.id),type:t_.s.TOP_GUILD_EMOJI,sectionId:t_.s.TOP_GUILD_EMOJI,count:e.length,isNitroLocked:!1})}}else if(n===t_.R2.RECENT){let e=(s===ez.EmojiIntention.REACTION?_:A).filter(e=>!eH.Ay.isEmojiFiltered({emoji:e,channel:t,intention:s}));g(e,{categoryId:n,type:t_.s.RECENT,sectionId:t_.s.RECENT,count:e.length,isNitroLocked:!1})}else if(n===t_.R2.FAVORITES){let e=p.filter(e=>!eH.Ay.isEmojiFiltered({emoji:e,channel:t,intention:s}));0!==e.length&&g(e,{categoryId:n,type:t_.s.FAVORITES,sectionId:t_.s.FAVORITES,count:e.length,isNitroLocked:!1})}else{let e=ty.Ay.getByCategory(n);null!=e&&g(e,{categoryId:n,type:t_.s.UNICODE,sectionId:n,count:e.length,isNitroLocked:!1})}}}}return{columnCounts:d,emojiGrid:r,rowCountBySection:e,sectionDescriptors:n}},[h,a,c,o,l,i,R,y,t,s,N,C,O,S,E,I,x,u,_,A,p,b])}({gridWidth:e9,fallbackGuildId:ej,channel:u,pickerIntention:c,emojiSearchResults:e1,collapsedSections:e6,emojiPaddingHorizontal:ig,emojiSpriteSize:b,pinnedPacks:ey,showOnlyUnicode:z}),{newlyAddedEmojis:tl}=(0,eX.A)(ej,c);i=r.useRef({intention:c,isBurstReaction:eT,analyticsObject:eB}),r.useEffect(()=>{i.current.intention===ez.EmojiIntention.REACTION&&eY(i.current)},[]);let tr=r.useCallback(()=>{let e=tl.length>0?tl[0].id:null;(0,eh.uV)(ej,e),eY({intention:c,isBurstReaction:eT,analyticsObject:eB})},[tl,ej,c,eT,eB]),ta=r.useCallback(()=>{S(),P?.(),(0,ek.A)({subscriptionTier:en.pe.TIER_2,analyticsLocations:[...eQ,N.A.EMOJI_PACKS],analyticsObject:{...eq,object:eL.ZSU.EMOJI}})},[eq,eQ,S,P]),to=function(e){let{pickerIntention:t,selectedChannel:n,fallbackGuildId:i,onSelectEmoji:s,setUpsellConfigs:l,emojiSelectAnalytics:a,trackEmojiFavorited:o}=e,c=(0,m.bG)([j.Ay],()=>j.Ay.getDisambiguatedEmojiContext(n?.getGuildId()??i),[i,n]);return r.useCallback((e,i)=>{if(0===e.type){let{emoji:r}=e;if(null==r)return;let u=eH.Ay.getEmojiUnavailableReason({emoji:r,channel:n,intention:t});if(i.toggleFavorite)return void(c.isFavoriteEmojiWithoutFetchingLatest(r)||null!=u?(0,g.Sw)(r):(o?.(e),(0,g.V4)(r)));if(u!==ez.EmojiDisabledReasons.GUILD_SUBSCRIPTION_UNAVAILABLE){if(u===ez.EmojiDisabledReasons.PREMIUM_LOCKED){a?.(e,u),l({type:0,emojiDescriptor:e});return}if(u===ez.EmojiDisabledReasons.ROLE_SUBSCRIPTION_LOCKED&&r.type===T.i.GUILD){a?.(e,u),l({type:1,guildId:r.guildId,emojiId:r.id});return}u!==ez.EmojiDisabledReasons.ROLE_SUBSCRIPTION_UNAVAILABLE&&(a?.(e),s({emoji:r,willClose:i.isFinalSelection,isBurst:i.isBurst}))}}},[n,t,s,l,c,a,o])}({pickerIntention:c,selectedChannel:u,fallbackGuildId:ej,closePopout:S,onSelectEmoji:v,setUpsellConfigs:e=>{e?.type===tb.PREMIUM&&e.emojiDescriptor?.emoji?.type===T.i.PACK?ta():ed(e)},emojiSelectAnalytics:(e,t)=>{""!==ef?(0,eV.Wf)({emoji:e.emoji,location:{...eq,object:eL.ZSU.EMOJI},searchQuery:ef,isLocked:null!=t,intention:c,messageId:B}):(0,eV._7)({emoji:e.emoji,location:{...eq,object:eB??eL.ZSU.EMOJI,...null!=eJ&&{page:eJ}},pickerIntention:c,category:e.category,subCategory:e.subCategory,position:e.columnIndex+1,newlyAddedHighlight:e.subCategory===t_.tm.NEWLY_ADDED_EMOJI&&eg.isNewerThanLastSeen(ej,e.emoji.id),isBurstReaction:eT,messageId:B,lockedReason:t,visibleRowIndex:e.visibleRowIndex})},trackEmojiFavorited:e=>{(0,eV.C5)({emoji:e.emoji,location:{...eq,object:eL.ZSU.EMOJI}})}}),tc=r.useCallback(()=>{S(),P?.()},[S,P]),{getItemProps:tu,getRowProps:td,gridContainerProps:tm,handleGridContainerKeyDown:tf,isUsingKeyboardNavigation:tE}=function(e){let{analyticsLocation:t,pickerIntention:n,columnCounts:i,onSelectEmoji:s,onSelectPackEmoji:l,emojiGrid:a,emojiList:o,channelGuildId:c,isBurstReaction:u}=e,f=(0,m.bG)([j.Ay],()=>j.Ay.getDisambiguatedEmojiContext(c),[c]),E=r.useCallback((e,i)=>{if(e.type===tO.EMOJI){if(e.emoji.type===T.i.PACK)return void l(e,{isFinalSelection:!i.shiftKey,toggleFavorite:i.altKey,isBurst:u});if(null!=e.emoji&&i.altKey)return void(f.isFavoriteEmojiWithoutFetchingLatest(e.emoji)?(0,g.Sw)(e.emoji):((0,eV.C5)({emoji:e.emoji,location:{...t,object:eL.ZSU.EMOJI}}),(0,g.V4)(e.emoji)));let r={page:null!=c?eL.liQ.GUILD_CHANNEL:eL.liQ.DM_CHANNEL,section:eL.JJy.EMOJI_PICKER_POPOUT,object:eL.ZSU.EMOJI};u&&(r={page:null!=c?eL.liQ.GUILD_CHANNEL:eL.liQ.DM_CHANNEL,section:eL.JJy.EMOJI_PICKER_POPOUT,object:eL.ZSU.EMOJI}),(0,eV._7)({emoji:e.emoji,location:r,pickerIntention:n,category:e.category,subCategory:e.subCategory,newlyAddedHighlight:e.subCategory===t_.tm.NEWLY_ADDED_EMOJI&&eg.isNewerThanLastSeen(c,e.emoji.id)}),s({emoji:e.emoji,willClose:!i.shiftKey,isBurst:u})}},[s,l,c,n,f,t,u]),{gridDispatch:I,getItemProps:h,getRowProps:p,gridContainerProps:A,handleGridContainerKeyDown:_,isUsingKeyboardNavigation:N}=(0,e_.Ff)({columnCounts:i,gridNavigatorId:t_.lq,itemGrid:a,itemList:o,onGridNavigatorItemSelect:E,onGridNavigatorPositionChange:iA});return r.useEffect(()=>ep.Om.subscribe(e=>e.inspectedExpressionPosition,e=>{if(null==e)return;let{columnIndex:t,rowIndex:n,source:i}=e;i!==$.t.GRID_NAVIGATOR_EVENT&&I({type:d.n.SET_FOCUSED_POSITION,x:t,y:n})}),[I]),{getItemProps:h,getRowProps:p,gridContainerProps:A,handleGridContainerKeyDown:_,isUsingKeyboardNavigation:N}}({pickerIntention:c,analyticsLocation:eq,columnCounts:ts,onSelectEmoji:v,onSelectPackEmoji:to,emojiGrid:tn,emojiList:eI,channelGuildId:ej,isBurstReaction:eP});((e,t)=>{let[n,i]=r.useState(null);r.useEffect(()=>{null!=n&&(t.current?.scrollToSectionTop(n),i(null))},[t,n]),r.useEffect(()=>{i(ep.Om.getState().activeCategoryIndex)},[e])})(L,eI),r.useLayoutEffect(()=>{ea&&eN.current?.focus()},[L,e0,eN,ea]),s=r.useRef(q),r.useEffect(()=>{ea&&s.current&&!q&&eN.current?.focus(),s.current=q},[ea,q,eN]),r.useEffect(()=>{M||(0,eA.Ri)("")},[M]),r.useEffect(()=>(eF.default.track(eL.HAw.OPEN_POPOUT,{type:eZ??"Emoji Picker",guild_id:ej,location:e$,...(0,C.dI)(u)}),()=>{i_.cancel(),iN.cancel()}),[eZ,ej,e$,u]),(0,A.Ay)(()=>((0,eV.V$)({intention:c,location:eq}),em.current=ef,ep.Om.resetStoreState)),r.useEffect(()=>()=>(0,ew.sF)(ew._2.FAVORITE_EMOJI_TOOLTIP),[]),r.useLayoutEffect(()=>{let{columnIndex:e,rowIndex:t}=ep.Om.getState().inspectedExpressionPosition;tn[t]?.[e]==null&&0!==e&&ep.Om.setInspectedExpressionPosition(0,0)},[tn]),r.useEffect(()=>{if(""===em.current&&""!==ef&&(0,eV.EG)(eq,c),""!==ef&&em.current!==ef){let e=ep.Om.getAnalyticsId();0===e2?i_({location:eq,searchQuery:ef,intention:c,loadId:e}):iN({totalResults:e2,numEmojiLocked:e1?.locked.length??0,location:eq,searchQuery:ef,intention:c,loadId:e})}em.current=ef},[ef,eq,e2,e1,c]);let tI=V??(R?"div":I.l),tg=null!=e9;function th(e,t){to(e,{...t,isBurst:eP})}eu?.type===tb.PREMIUM?a=(0,l.jsx)(iI.default,{onUpsellClicked:tc,emojiDescriptor:eu.emojiDescriptor,pickerIntention:c,analyticsLocation:eq,onClose:()=>ed(null),channel:u}):eu?.type===tb.ROLE_SUBSCRIPTION&&(a=(0,l.jsx)(eD,{onClose:()=>ed(null),guildId:eu.guildId,emojiId:eu.emojiId}));let tp=(0,_.A)((e,t,n)=>{th({type:tO.EMOJI,emoji:e,isDisabled:!e.available,size:b,rowIndex:0,columnIndex:t,visibleRowIndex:0,category:t_.s.PACK,subCategory:t_.tm.NONE},n)}),tA=(0,l.jsx)(np,{channel:u,pickerIntention:c,emojiListRef:eI,onKeyDown:e=>{tf?.(e),ei?.(e)},searchBarRef:eN,onFocus:et,autoFocus:ea,accessory:eo,headerClassName:w,diversitySurrogate:e0,isBurstReaction:eT,onBurstReactionToggle:function(){eO(!eT),eN.current?.focus()},burstToggleRef:eS,renderHeader:H,showAddEmojiButton:Z,closePopout:S}),tN=[];j.Ay.hasFavoriteEmojis(ej)||tN.push(f.M.EMOJI_PICKER_FAVORITE_EMOJIS_TIP);let tC=(0,l.jsxs)(r.Fragment,{children:[R?tA:null,(0,l.jsxs)("div",{className:nh.uK,ref:eE,children:[(0,l.jsx)(iE,{channel:u,closePopout:S}),(0,l.jsx)(y.Ay,{contentTypes:tN,children:e=>{let{visibleContent:t,markAsDismissed:n}=e;if(t===f.M.EMOJI_PICKER_FAVORITE_EMOJIS_TIP)return(0,l.jsx)(t$,{markAsDismissed:()=>n(ti.i.UNKNOWN)})}}),K?null:(0,l.jsx)("div",{className:nh.Iy,id:t_.lq,...tm,children:tg?(0,l.jsx)(ie,{collapsedSections:e6,diversitySurrogate:e0,emojiGrid:tn,emojiListRef:eI,emojiSize:b,getEmojiItemProps:tu,getEmojiRowProps:td,gridWidth:e9,isUsingKeyboardNavigation:tE,onEmojiSelect:th,onRemovePack:ex,setUpsellConfigs:ed,rowCount:tn.length,rowCountBySection:te,sectionDescriptors:tt,setCollapsedSections:e7,channelGuildId:ej,messageId:B,isBurstReaction:eP,listHeaderClassName:W}):null})]}),(0,l.jsx)(ny,{emojiGrid:tn,className:nh.qV,guildId:ej,pickerIntention:c,channel:u}),a,c===ez.EmojiIntention.REACTION?(0,l.jsx)(e3,{targetElementRef:eS,shouldShow:eT&&!ev,onDismiss:()=>eO(!1)}):null]}),tR=(0,l.jsx)(h.A,{...eq,children:(0,l.jsxs)(tI,{id:t_.Do,"aria-labelledby":R&&!q?t_.k1:void 0,role:R&&!q?"tabpanel":void 0,className:o()(nh.iE,{[nh.r6]:R,[nh.cB]:eP}),children:[R||q?null:tA,(0,l.jsx)("div",{className:o()(nh.Fb,D,{[nh.eW]:q&&!R}),onScroll:ip,children:q?(0,l.jsx)(es,{onBack:()=>ee?.(!1),onSelectEmoji:tp}):tC}),K||q?null:(0,l.jsx)(tZ,{className:o()(nh.jv,X),emojiListRef:eI,sectionDescriptors:tt,intention:c,channel:u,fallbackGuildId:ej,showOnlyUnicode:z,pinnedPacks:ey,onViewEmojiPacks:eC?()=>ee?.(!0):void 0})]})});return(0,l.jsx)(x.f5,{value:eQ,children:tR})})}