Build 545032stable
Module 729666
12,702 characters · in f08fed5b39d8e5b5.jsDependencies
Lazily required by (0)none
Requires (59)
32031792849999608096470086379131607136722151271155718186111211401234320240248287809321073338854355622374200375499375708380619406704427262428262500049503698522602554146559647576705597770598071604121607399617617627968652215688810696451697744698279744682751188767089775602793574795816807098852218861382877624927813931664935208939249942381989837990078
Source Raw
function(e,t,n){"use strict";n.d(t,{A:()=>ej}),n(321073);var l=n(627968),i=n(64700),s=n(607399),r=n(17928),a=n(155718),o=n(775602),c=n(861382),u=n(136722),d=n(406704),h=n(696451),m=n(576705),p=n(287809),f=n(652215),g=n(86379),x=n(503698),A=n.n(x),C=n(939249),E=n(697744),I=n(795816),y=n(211401),S=n(989837),v=n(500049),N=n(598071),_=n(60809),T=n(375708),j=n(224840);let b=i.forwardRef(function(e,t){let{type:n,channelId:s}=e,a=(0,r.bG)([S.A],()=>S.A.shouldShowPopup()&&S.A.activeViewType()===n&&S.A.activeChannelId()===s),{Component:o,events:c,play:u}=(0,E.c)(),d=i.useContext(N.Ay);i.useEffect(()=>{let e=()=>{c.onMouseEnter()};return d.on("command-sentinel-typed",e),()=>{d.off("command-sentinel-typed",e)}},[d,c]);let h=i.useCallback(()=>{a?y.k(v.Se.DISMISSED):(y.R(v.s4.TEXT,n,void 0,s),I.LK()),u()},[a,n,s,u]),m=(0,l.jsx)(o,{size:"refresh_sm",color:"currentColor"});return(0,l.jsx)("div",{className:A()(j.UD,_.KG),ref:t,children:(0,l.jsx)(C.D,{tabIndex:0,className:A()(j.x6,{[j.rK]:a}),onClick:h,"aria-label":T.intl.string(T.t.erHFxI),"aria-expanded":a,"aria-haspopup":"dialog",focusProps:{offset:{top:4,bottom:4,left:-4,right:-4}},...c,children:m})})}),R=i.memo(function(e){let{type:t,channelId:n}=e;return(0,l.jsx)(b,{type:t,channelId:n})});var O=n(374200),M=n(852218),L=n(931664),w=n(522602),k=n(428262),P=n(942381),D=n(375499),U=n(151271),G=n(355622),V=n(698279),F=n(266599);let H=i.memo(i.forwardRef(function(e,t){let{disabled:n,type:s,channelId:r}=e,[a,o,c,u]=(0,U.RQ)(e=>[e.activeView,e.activeViewType,e.pickerId,e.activeChannelId],P.x),d=s===G.oU.NORMAL,h=i.useCallback(()=>{(0,U.r$)(V.kx.EMOJI,s,r)},[s,r]);return n?null:(0,l.jsx)("div",{className:A()(V.VQ,F.UD),ref:t,children:(0,l.jsx)(D.A,{className:F.Z8,onClick:h,active:a===V.kx.EMOJI&&o===s&&u===r,"aria-controls":c,tabIndex:0,focusProps:{offset:{top:4,bottom:4,left:-4,right:-4}},canShowNUXPremiumTooltip:d})})}));var B=n(3203),W=n(990078),K=n(617617),z=n(234320),Z=n(767089);let Y=i.memo(i.forwardRef(function(e,t){let{disabled:n,type:s,channel:a}=e,[o,c]=i.useState(!1),u=(0,r.bG)([K.A],()=>o&&Object.values(K.A.frecencyWithoutFetchingLatest.favoriteGifs?.gifs??{}).length<=2),[d,h,m,p]=(0,U.RQ)(e=>[e.activeView,e.activeViewType,e.pickerId,e.activeChannelId],P.x),g=i.useRef(0),x=i.useCallback(()=>{c(!0),clearTimeout(g.current),g.current=setTimeout(()=>{c(!1),g.current=0},2e3)},[]);(0,z.Vo)({event:f.jej.FAVORITE_GIF,handler:x});let C=i.useCallback(()=>{(0,U.r$)(V.kx.GIF,s,a.id)},[s,a.id]),{Component:E,events:I,play:y}=(0,B.V)();if(n)return null;let S=d===V.kx.GIF&&h===s&&p===a.id;return(0,l.jsx)(W.m,{text:T.intl.string(u?T.t.mE2e8A:T.t.nffuyb),shouldShow:u,forceOpen:u,children:(0,l.jsx)("div",{ref:t,className:A()(V.VQ,F.UD),children:(0,l.jsx)(Z.A,{className:F.x6,onMouseEnter:I.onMouseEnter,onMouseLeave:I.onMouseLeave,onClick:()=>{C(),y()},isActive:S,pulse:o,"aria-label":T.intl.string(T.t.PtVpk2),"aria-expanded":S,"aria-haspopup":"dialog","aria-controls":m,children:(0,l.jsx)(E,{size:"refresh_sm",color:"currentColor"})})})})}));var q=n(744682);let J={all:{name:"all",start:0,duration:66}},$=()=>{let e=i.useRef(null),t=i.useCallback(()=>{null!=e.current&&e.current.play("all")},[]),s=i.useCallback(()=>{null!=e.current&&e.current.play("all")},[]),r=i.useCallback(()=>{null!=e.current&&e.current.stopIfPlaying("all")},[]),a=i.useCallback(t=>(0,l.jsx)(q.P,{...t,src:()=>n.e("56591").then(n.t.bind(n,640114,19)),ref:e,markers:J}),[]);return{events:{onMouseEnter:s,onMouseLeave:r},play:t,getDuration:i.useCallback(()=>e.current?.getDuration(),[]),getCurrentFrame:i.useCallback(()=>e.current?.getCurrentFrame()??null,[]),Component:a}};var X=n(793574),Q=n(688810),ee=n(751188),et=n(427262);let en=i.memo(function(e){let{disabled:t,channel:n}=e,{analyticsLocations:i}=(0,Q.Ay)(X.A.GIFT_BUTTON),s=(0,et.R1)(n),{Component:r,events:a,play:o}=$(),{openGiftModal:c,shouldShowWishlistModal:u,shouldShowGiftSelectionModal:d}=(0,ee.$)({giftRecipient:s,analyticsLocations:i,analyticsObject:{page:n.isPrivate()?f.liQ.DM_CHANNEL:f.liQ.GUILD_CHANNEL,section:f.JJy.CHANNEL_TEXT_AREA,object:f.ZSU.BUTTON_ICON,objectType:f.AnalyticsObjectTypes.GIFT},location:"gift-button"});return t?null:(0,l.jsx)(W.m,{ariaHidden:u||d,text:T.intl.string(u||d?T.t.TW4JV0:T.t.sWtWDX),children:(0,l.jsx)(Z.A,{className:F.x6,isActive:!1,"aria-label":T.intl.string(u||d?T.t.TW4JV0:T.t.Z1RnTk),"aria-haspopup":"dialog",onClick:()=>{c(),o()},...a,children:(0,l.jsx)(r,{size:"refresh_sm",color:"currentColor"})})})});var el=n(877624),ei=n(554146),es=n(604121),er=n(597770),ea=n(131607),eo=n(380619),ec=n(338854),eu=n(807098),ed=n(49999);function eh(e){let{onComplete:t,onCheckItOutClick:n,markAsDismissed:s,coachmarkConfig:r,children:a}=e,o=(0,eu.T)(r?.asset),c=i.useRef(null),u=i.useRef(null),[d,h]=i.useState(0);i.useEffect(()=>{let e=()=>{let e=c.current,t=u.current;if(null==e||null==t)return;let n=e.getBoundingClientRect(),l=t.getBoundingClientRect();h(n.left+n.width/2-(l.left+l.width/2))},t=new ResizeObserver(e),n=c.current,l=u.current;return null!=n&&t.observe(n),null!=l&&(t.observe(l),e()),()=>t.disconnect()},[]);let m={text:T.intl.string(T.t.RzWDqY),onClick:()=>{n(),t(),s(ed.i.TAKE_ACTION)}};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{ref:c,children:a}),(0,l.jsx)(ec.H,{targetElementRef:c,shouldShow:!0,position:"top",align:"center",title:r?.header??"",body:r?.body??"",assetUrl:o??"",action:m,caretConfig:{align:"custom",customOffset:d},onRequestClose:()=>{t(),s(ed.i.USER_DISMISS)},popoverRef:u})]})}var em=n(186111),ep=n(927813),ef=n(935208),eg=n(240248),ex=n(849353);function eA(e){let t=i.useCallback(()=>Promise.resolve({default:e.boxAnimationUrl}),[e.boxAnimationUrl]);return(0,l.jsx)(Z.A,{className:F.x6,"aria-label":T.intl.string(T.t.Z1RnTk),isActive:!1,noHover:!0,onClick:e.onClick,children:(0,l.jsx)("div",{className:ex.zc,children:e.hovered?(0,l.jsx)(es.a,{className:ex.Hl,importData:t}):(0,l.jsx)(er.o,{})})})}function eC(e){let{Component:t,events:n,play:s}=$(),r=i.useCallback(()=>Promise.resolve({default:e.trinketAnimationUrl}),[e.trinketAnimationUrl]),a=i.useCallback(()=>Promise.resolve({default:e.trinketGlowAnimationUrl}),[e.trinketGlowAnimationUrl]);return(0,l.jsx)(Z.A,{className:F.x6,"aria-label":T.intl.string(T.t.Z1RnTk),isActive:!1,noHover:!0,onClick:()=>{s(),e.onClick?.()},...n,children:(0,l.jsxs)("div",{className:ex.zc,children:[(0,l.jsx)(t,{className:ex.is,color:"currentColor"}),e.hovered&&(0,l.jsxs)(l.Fragment,{children:[null!=e.trinketAnimationUrl&&(0,l.jsx)(es.a,{className:ex.rY,importData:r}),null!=e.trinketGlowAnimationUrl&&(0,l.jsx)(es.a,{className:ex.c5,importData:a})]})]})})}let eE=ep.A.Millis.DAYS_30,eI=i.memo(function(e){let{disabled:t,channel:n}=e,{analyticsLocations:s}=(0,Q.Ay)(X.A.GIFT_BUTTON),[a,o]=i.useState(!1),c=(0,r.bG)([em.A],()=>!em.A?.hasLayers()),u=(0,r.bG)([p.default],()=>p.default.getCurrentUser()),d=null!=u?ef.default.age(u.id):0,h=(0,r.bG)([O.A],()=>{let e=O.A.getMarketingComponentByType(el.C.GIFT_ICON);return null==e||"giftIcon"!==e.properties.properties.oneofKind?null:e.properties.properties.giftIcon}),m=(0,r.bG)([O.A],()=>{let e=O.A.getMarketingComponentByType(el.C.GIFT_ICON_COACHMARK);return null==e||"giftIconCoachmark"!==e.properties.properties.oneofKind?null:e.properties.properties.giftIconCoachmark}),g=h?.gradient,x=null!=g&&null!=g.colors&&g.colors.length>=2?(0,eo.K5)({gradient:g.colors,angle:g.angle??void 0},{defaultAngle:180}):void 0,C=i.useMemo(()=>{if(x?.background!=null)return{"--custom-promotion-gradient":x.background}},[x]),E=!(0,eg.uJ)(h?.boxAnimationUrl),I=(!(0,eg.uJ)(h?.trinketAnimationUrl)||!(0,eg.uJ)(h?.trinketGlowAnimationUrl))&&!E,y=(0,r.bG)([O.A],()=>O.A.getGiftPromotion()?.id),S=null!=m&&!t&&c&&d>=eE&&null!=y,[v,N]=(0,ea.Cc)(S?ei.M.GIFTING_PROMOTION_DESKTOP_FIRST_TIME_COACHMARK:null,y??""),_=null!=v,T=a||_,j=(0,et.R1)(n),{openGiftModal:b}=(0,ee.$)({giftRecipient:j,analyticsLocations:s,analyticsObject:{page:n.isPrivate()?f.liQ.DM_CHANNEL:f.liQ.GUILD_CHANNEL,section:f.JJy.CHANNEL_TEXT_AREA,object:f.ZSU.GIFTING_PROMOTION_BUTTON,objectType:f.AnalyticsObjectTypes.GIFT},wishlistAnalyticsObject:{page:n.isPrivate()?f.liQ.DM_CHANNEL:f.liQ.GUILD_CHANNEL,section:f.JJy.CHANNEL_TEXT_AREA,object:f.ZSU.BUTTON_ICON,objectType:f.AnalyticsObjectTypes.GIFT},location:"gift-promotion-button"});if(t)return null;let R=()=>{o(!1),N(ed.i.TAKE_ACTION),b()},M=E&&h?.boxAnimationUrl!=null?(0,l.jsx)(eA,{boxAnimationUrl:h.boxAnimationUrl,hovered:T,onClick:R}):I?(0,l.jsx)(eC,{trinketAnimationUrl:h?.trinketAnimationUrl??null,trinketGlowAnimationUrl:h?.trinketGlowAnimationUrl??null,hovered:T,onClick:R}):(0,l.jsx)(en,{disabled:t,channel:n});return(0,l.jsx)("div",{className:A()(ex.kL,{[ex.DM]:T}),style:C,onMouseEnter:()=>{a||o(!0)},onMouseLeave:()=>{o(!1)},children:_?(0,l.jsx)(eh,{onComplete:()=>o(!1),onCheckItOutClick:b,markAsDismissed:N,coachmarkConfig:m,children:M}):M})});var ey=n(559647),eS=n(10388);let ev=i.memo(function(e){let{onClick:t,disabled:n=!1}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:eS.me}),(0,l.jsx)("div",{className:eS.kL,children:(0,l.jsx)("div",{className:eS.UD,children:(0,l.jsx)(Z.A,{className:eS.x6,childClassName:A()(eS.Z4,{[eS.r9]:n,[eS.xb]:!n}),onClick:t,disabled:n,isActive:!1,noHover:n,"aria-label":T.intl.string(T.t.oeb1vg),children:(0,l.jsx)(ey.l,{size:"xs",color:"currentColor",className:eS.AO})})})})]})}),eN={click:{name:"click",start:0,duration:66},hover:{name:"hover",start:90,duration:40}},e_=i.memo(i.forwardRef(function(e,t){let s,r,a,o,c,{disabled:u,type:d,channel:h}=e,[m,p,f,g]=(0,U.RQ)(e=>[e.activeView,e.pickerId,e.activeChannelId,e.activeViewType],P.x),x=m===V.kx.STICKER&&g===d&&f===h.id,C=i.useCallback(()=>{(0,U.r$)(V.kx.STICKER,d,h.id)},[d,h.id]),{Component:E,events:I,play:y}=(s=i.useRef(null),r=i.useCallback(()=>{null!=s.current&&s.current.play("click")},[]),a=i.useCallback(()=>{null!=s.current&&s.current.play("hover")},[]),o=i.useCallback(()=>{null!=s.current&&s.current.stopIfPlaying("hover")},[]),c=i.useCallback(e=>(0,l.jsx)(q.P,{...e,src:()=>n.e("2890").then(n.t.bind(n,279825,19)),ref:s,markers:eN}),[]),{events:{onMouseEnter:a,onMouseLeave:o},play:r,getDuration:i.useCallback(()=>s.current?.getDuration(),[]),getCurrentFrame:i.useCallback(()=>s.current?.getCurrentFrame()??null,[]),Component:c});return u?null:(0,l.jsx)("div",{className:A()(V.VQ,F.UD),ref:t,children:(0,l.jsx)(Z.A,{className:A()(F.x6,F.KE),...I,onClick:()=>{C(),y()},isActive:x,"aria-label":T.intl.string(T.t.rZpidU),"aria-expanded":x,"aria-haspopup":"dialog","aria-controls":p,sparkle:!1,children:(0,l.jsx)(E,{size:"refresh_sm",color:"currentColor"})})})}));function eT(e){let{disabled:t,channel:n}=e;return(0,r.bG)([O.A],()=>Object.keys(O.A.promotionsByType[M.pt.GIFT_PROMOTION]).length>0)?(0,l.jsx)(eI,{disabled:t,channel:n}):(0,l.jsx)(en,{disabled:t,channel:n})}let ej=i.memo(function(e){var t,n,i;let{type:x,disabled:A,channel:C,handleSubmit:E,isEmpty:I,showAllButtons:y}=e,S=(0,r.bG)([o.A],()=>o.A.isSubmitButtonEnabled),v=(t=C.id,n=x,i=I,(0,r.bG)([L.A,w.A],()=>{let e=L.A.getStickerPreview(t,n.drafts.type),l=null!=e&&e.length>0;return 0===w.A.getUploads(t,n.drafts.type).length&&i&&!l})),{activeCommand:N,activeCommandOption:_}=(0,r.cf)([c.A],()=>({activeCommand:c.A.getActiveCommand(C.id),activeCommandOption:c.A.getActiveOption(C.id)})),T=(0,g.dw)(),j=[],b=!C.isDM()||void 0===C.recipients||C.recipients.length>1,O=(0,r.bG)([p.default],()=>b?null:p.default.getUser(C.recipients[0])),M=function(e){let{channel:t,chatInputType:n}=e,l=n.commands?.enabled??!1,i=function(e){let t=e.getGuildId(),n=(0,r.bG)([h.Ay,p.default],()=>{let e=p.default.getCurrentUser();return(null!=t&&null!=e?h.Ay.getMember(t,e.id)?.isPending:null)??!1}),{messagesDisabled:l}=(0,r.cf)([m.A],()=>{let t=e.isPrivate(),l=m.A.computePermissions(e),i=u.zy(l,f.xBc.SEND_MESSAGES),s=(0,d.UJ)(e);return{messagesDisabled:n||!t&&!i||s}},[e,n]);return!l}(t),{activeCommand:s}=(0,r.cf)([c.A],()=>({activeCommand:l?c.A.getActiveCommand(t.id):null}));return l&&i&&null==s}({channel:C,chatInputType:x}),P=x.submit?.button!=null&&(x.submit?.ignorePreference||S);return(!s.Fr&&(x.gifts?.button!=null&&null==N&&!T&&(null==O||k.Ay.isPremiumEligible(O))&&j.push((0,l.jsx)(eT,{disabled:A,channel:C},"gift")),x.gifs?.button!=null&&null==N&&y&&j.push((0,l.jsx)(Y,{disabled:A,type:x,channel:C},"gif")),x.stickers?.button!=null&&null==N&&y&&j.push((0,l.jsx)(e_,{disabled:A,type:x,channel:C},"sticker"))),x.emojis?.button!=null&&(null==N||null!=_&&_.type!==a.n4.ATTACHMENT)&&j.push((0,l.jsx)(H,{disabled:A,type:x,channelId:C.id},"emoji")),M&&j.push((0,l.jsx)(R,{channelId:C.id,type:x},"appLauncher")),P&&j.push((0,l.jsx)(ev,{onClick:E,disabled:A||v},"submit")),0===j.length)?null:(0,l.jsx)("div",{className:F.Uo,children:j})})}