Build 555975stable
Module 138617
32,290 characters · in abe64d994b0c71cc.jsDependencies
Required by (19)
Lazily required by (0)none
Requires (143)
13721468845513297179282520131408314984716760809647006725968935735107499595561105330118517123583128934131552135261135621136722139286140735143236148355150934151271151282155718168186174459176781177640187322192308210978221933224964228366232835234320252263252545256265266599267889268218278351282214284009285796286509287809289873305070307731309010321073355026355622375499375708392054392553406704442433448702463930464651465532486319488926495544503698511274522602536283537652559908562708575293576705579940598071607399612394620141625494625928627968630816631576638128650019652215659280664929688810696451698279702841703244713654721768723702731231734057735438746388747926749314750506763754765671775602793574802019820066821102822610827669834730842209850992857071861382885386911385915089922016926321931664935063939249942381962125967144976860989837990078
Source Raw
function(e,t,n){"use strict";n.d(t,{HG:()=>t9,Sk:()=>ns,C:()=>t5,v7:()=>nn,Zx:()=>t7,L0:()=>nl,N_:()=>ne,MD:()=>nr,Ay:()=>no,uW:()=>na,NO:()=>t8,ck:()=>ni,ml:()=>nt,Vu:()=>t4});var l=n(627968),i=n(64700),s=n(503698),r=n.n(s),a=n(143236),o=n(284009),c=n.n(o),u=n(942381),d=n(607399),h=n(136722),m=n(17928),p=n(192308),f=n(187322),g=n(511274),x=n(465532),A=n(765671),E=n(775602),C=n(793574),I=n(688810),y=n(177640),S=n(989837),v=n(289873),N=n(268218),_=n(750506),T=n(60809),j=n(375708),b=n(131552);let R={width:500,height:T.$V},O=(0,N.Fe)({createPromise:()=>Promise.all([n.e("37412"),n.e("81539"),n.e("72414"),n.e("39713"),n.e("23531"),n.e("15680"),n.e("71626"),n.e("38916"),n.e("34552"),n.e("93103"),n.e("71210"),n.e("88342"),n.e("37977"),n.e("42451"),n.e("98965"),n.e("71273"),n.e("80854"),n.e("35395"),n.e("43780"),n.e("35313"),n.e("54975"),n.e("8362"),n.e("54625"),n.e("71133"),n.e("49697"),n.e("27773"),n.e("52229"),n.e("84870"),n.e("18024"),n.e("61268"),n.e("78195"),n.e("22261"),n.e("41701"),n.e("74021"),n.e("83518"),n.e("37065"),n.e("22094"),n.e("61764"),n.e("59848"),n.e("68974"),n.e("56385"),n.e("59132"),n.e("89203"),n.e("35621")]).then(n.bind(n,854379)),webpackId:854379,renderLoader:()=>(0,l.jsx)("div",{className:b.R4,style:R,children:(0,l.jsx)(v.y,{})})}),M={height:T.$V},w=i.memo(function(e){let{positionTargetRef:t,align:n,...i}=e;return(0,l.jsx)("span",{style:T.sK,children:(0,l.jsx)(_.nE,{className:b.T8,targetRef:t,position:"top",align:n??"right",spacing:24,autoInvert:!0,nudgeAlignIntoViewport:!0,clickTrap:!0,children:e=>{let{isPositioned:t}=e;return(0,l.jsx)("section",{className:b.V6,role:"dialog",style:M,"aria-label":j.intl.string(j.t["3CNGLK"]),children:t&&(0,l.jsx)(O,{...i})})}})})});var L=n(861382),k=n(735438),P=n.n(k),D=n(537652),U=n(155718),V=n(95561),G=n(659280),F=n(579940),H=n(962125),B=n(915089),W=n(850992),K=n(464651),z=n(286509),Z=n(721768),Y=n(842209),q=n(210978),J=n(392054),$=n(168186),X=n(990078),Q=n(939249),ee=n(802019),et=n(664929),en=n(282214);let el=[16,8,8,8];function ei(e){let{className:t,channel:n,sections:s,activeCategoryIndex:a,filteredSectionId:o,onSectionClick:c,applicationCommandListRef:u}=e,d=i.useRef(null),h=i.useCallback((e,t)=>{let n=8;return s[t+1]?.type===J.Hf.BUILT_IN&&(n+=8),32+n},[s]),m=i.useCallback((e,t)=>t?8*(s[e+1]?.type!==J.Hf.BUILT_IN):8*(0!==e),[s]),p=i.useCallback((e,t)=>{let i=s[t];if(null==i)return;let r=(0,et.Rg)(i),u=4*(i.type===J.Hf.BUILT_IN),d=32-2*u,h=(0,l.jsx)(r,{channel:n,section:i,isSelected:null!=o?i.id===o:a===t,padding:u,width:d,height:d,selectable:!0}),m=i.type!==J.Hf.BUILT_IN&&t<s.length-1&&s[t+1].type===J.Hf.BUILT_IN;return(0,l.jsxs)("div",{className:en.uW,children:[(0,l.jsx)(X.m,{text:i.name,position:"right",asContainer:!0,children:(0,l.jsx)(Q.D,{"aria-label":i.name,onClick:()=>{c(i)},children:h})}),m?(0,l.jsx)("hr",{className:en.zQ}):null]},i.id)},[a,n,c,s,o]);return 0===s.length?null:(0,l.jsx)("div",{className:r()(t,en.iE),children:(0,l.jsx)(ee.A,{categoryListRef:d,expressionsListRef:u,store:W.LS,categories:s,className:en.p_,renderCategoryListItem:p,rowCount:s.length,categoryHeight:h,listPadding:el,getScrollOffsetForIndex:m})})}var es=n(746388),er=n(73510),ea=n(652215),eo=n(13297),ec=n(911385);let eu=[8,8,0,8],ed=P().debounce(()=>{(0,V.zV)(ea.HAw.APPLICATION_COMMAND_BROWSER_SCROLLED)},300),eh=i.forwardRef(function(e,t){let{channel:n,canOnlyUseTextCommands:s}=e,a=i.useRef(!1),o=i.useRef(0),[c,u]=i.useState(0),d=i.useRef(null),[h,m]=i.useState(!1),p=W.LS.useStore(e=>e.activeCategoryIndex);i.useEffect(()=>{(0,V.zV)(ea.HAw.APPLICATION_COMMAND_BROWSER_OPENED)},[]);let{sectionDescriptors:f,activeSections:g,commandsByActiveSection:x,hasMoreAfter:A,commands:E,filteredSectionId:C,scrollDown:I,filterSection:y}=Y.cu({context:{channel:n,type:"channel"},filters:{commandTypes:[U.kc.CHAT],builtIns:s?q.n.ONLY_TEXT:q.n.ALLOW,applicationCommands:!s},options:{placeholderCount:7,limit:er.Hi,includeFrecency:!0},allowFetch:!0}),S=(0,K.Fk)({activeCategoryIndex:p,isScrolling:a,listRef:d,onActiveCategoryIndexChange:e=>{let t=g[e];if(null!=t){let e=f.findIndex(e=>e.id===t.id);W.LS.setActiveCategoryIndex(e)}},scrollOffset:20,searchQuery:""}),v=e=>{let t=g.length,n=x.reduce((e,t)=>e+t.data.length,0)-7*!!A;A&&e+420>48*t+56*n-512&&I(),S(e),ed(),o.current=e},N=i.useRef(v);i.useEffect(()=>{N.current=v}),i.useEffect(()=>{N.current(o.current)},[E]);let _=i.useCallback(e=>e!==g.length-1||A?16:0,[g.length,A]),T=x.map(e=>e.data.length);i.useEffect(()=>{null!=d.current&&h&&null!=c&&d.current.scrollRowIntoView(c)},[h,c]),i.useLayoutEffect(()=>{null!=C&&d.current?.scrollToSectionTop(0)},[E,C]);let b=i.useCallback(e=>{e.id===C||e.id===er.Ik.FRECENCY?(y(null),d.current?.scrollToSectionTop(0)):y(e.id)},[y,C]),R=i.useCallback((e,t,l)=>{Z.Gf({channelId:n.id,command:e,section:t,location:J.Oh.DISCOVERY,triggerSection:l})},[n.id]);i.useImperativeHandle(t,()=>({onTabOrEnter:e=>{if(null==c)return!e&&(u(0),!0);if(null==c)return!1;let t=0,n=0;for(let e of x)if(t=n,c<(n+=e.data.length)){let n=e.data[c-t],l=f.find(e=>e.id===n.applicationId);R(n,l,(0,$.$S)(e.section));break}return!0},onMoveSelection:e=>{if(0===E.length)return!0;let t=7*!!A,n=E.length+t,l=null==c?0:c+e;return l>=n?l=n-1:l<0&&(l=0),u(l),m(!0),!0}}),[E.length,x,A,f,R,c]);let O=i.useCallback(e=>{let t=g[e];if(null==t)return null;let i=(0,et.Rg)(t),s=(0,l.jsx)(i,{channel:n,section:t,width:16,height:16,padding:0});return(0,l.jsx)(z.A,{className:eo.Km,icon:s,children:t.name},e)},[n,g]),M=i.useCallback((e,t)=>{let n=e===g.length-1,i=g[e],{data:s}=x[e];return(0,l.jsxs)("ul",{role:"group","aria-label":i.name,className:r()(eo.Wy,{[eo.YD]:n}),children:[t,0===s.length&&(0,l.jsx)(D.A,{message:j.intl.format(j.t.WoQXT6,{applicationName:i.name}),noResultsImageURL:ec,className:eo.qK})]},e)},[g,x]),w=i.useCallback((e,t)=>{let i=x[t.sectionIndex],s=i.data[t.sectionRowIndex],r=`${i.section.id}:${s?.id??e}`;if(null==s||i.section.id!==s.applicationId&&i.section.id!==er.Ik.FRECENCY||s.inputType===J.y$.PLACEHOLDER)return(0,l.jsx)(es.A,{},r);let a=f.find(e=>e.id===s.applicationId);return(0,l.jsx)(G.Ay.NewCommand,{index:e,command:s,channel:n,className:eo.D5,selected:c===e,showImage:i.section.id!==s.applicationId,section:a,onClick:()=>R(s,a,(0,$.$S)(i.section)),onHover:()=>{u(null),m(!1)}},r)},[n,x,R,f,c]),L=(0,B.GV)();return(0,F.gf)(L,!0,(0,G.aI)(c)),i.useEffect(()=>()=>{(0,F.nQ)()},[]),(0,l.jsxs)(G.Ay,{id:L,className:eo.x9,innerClassName:eo.iE,onMouseDown:em,children:[(0,l.jsx)(ei,{className:eo.H$,channel:n,sections:f,filteredSectionId:C,activeCategoryIndex:p,onSectionClick:b,applicationCommandListRef:d}),(0,l.jsx)(H.A,{role:"listbox",className:eo.p_,listPadding:eu,onScroll:v,renderRow:w,renderSection:M,renderSectionHeader:O,rowCount:g.length,rowCountBySection:T,rowHeight:56,sectionHeaderHeight:32,sectionMarginBottom:_,ref:d,stickyHeaders:!0})]})});function em(e){e.preventDefault()}var ep=n(702841),ef=n(305070),eg=n(31498),ex=n(598071),eA=n(151271),eE=n(731231),eC=n(256265),eI=n(703244),ey=n(857071),eS=n(135621),ev=n(105330),eN=n(495544),e_=n(559908),eT=n(620141),ej=n(224964),eb=n(31408),eR=n(536283);function eO(e){let{editorHeight:t,textValue:n,channelId:l}=e,s=i.useRef(n),r=(0,ev.l)({editorHeight:t}),a=(0,ej.A)(),o=(0,m.bG)([e_.Ay,eN.default],()=>e_.Ay.isComboing(eN.default.getId(),l)),c=r?.left??0,u=(r?.top??0)-16,d=0===n.length,h=i.useMemo(()=>.05>Math.random(),[d]);return i.useEffect(()=>{0!==n.length&&n!==s.current&&o&&(a.fire(c,u,h?{sprite:eR.dR}:null),s.current=n)},[n,o,c,u,h,a]),null}function eM(e){return(0,l.jsx)(eT.A,{confettiLocation:eb.k.CHAT_INPUT,children:(0,l.jsx)(eO,{...e})})}var ew=n(931664),eL=n(631576),ek=n(68935),eP=n(406704),eD=n(885386),eU=n(696451),eV=n(576705),eG=n(309010),eF=n(638128),eH=n(522602),eB=n(287809),eW=n(821102),eK=n(174459),ez=n(234320),eZ=n(625494),eY=n(488926),eq=n(723702),eJ=n(486319),e$=n(355622),eX=n(392553),eQ=n(834730),e0=n(140735),e1=n(176781),e2=n(463930),e6=n(935063),e3=n(252545),e7=n(650019),e4=n(763754),e8=n(967144),e5=n(118517),e9=n(976860),te=n(747926),tt=n(232835),tn=n(285796),tl=n(630816);function ti(e){let{onClick:t,"aria-label":n}=e;return(0,l.jsx)(Q.D,{className:tl.b,onClick:t,"aria-label":n,children:(0,l.jsx)(tn.a,{size:"md",color:"currentColor",className:tl.u})})}var ts=n(1468);let tr="channel-reply-bar-a11y-description";function ta(e){let{channel:t,message:n,replyChainLength:s}=e,r=i.useRef(s);return i.useEffect(()=>{r.current=s}),i.useEffect(()=>{(0,V.zV)(ea.HAw.THREAD_NUDGE_SHOWN,{type:"Reply Chain (3)",reply_chain_length:r.current+1,channel_id:t.id,guild_id:t.guild_id})},[t]),(0,l.jsxs)(Q.D,{onClick:function(){(0,e5.Jx)(t.id),(0,te.Tv)(t,n,"Reply Chain Nudge")},className:ts._r,focusProps:{offset:{right:-4,left:-4}},children:[(0,l.jsx)(eQ.E,{color:"text-default",className:ts.Qq,variant:"text-sm/normal",children:j.intl.format(j.t.B3V0FM,{count:Math.min(10,s+1)})}),(0,l.jsx)(eQ.E,{color:"text-link",className:ts.NG,variant:"text-sm/semibold",children:j.intl.string(j.t.rBIGBL)})]})}function to(e){let t,n,{reply:s,chatInputType:a}=e,{channel:o,message:c,shouldMention:u,showMentionToggle:d,mediaMention:h}=s,{guildId:p,nick:f,colorString:g,colorStrings:x,colorRoleName:A,authorId:E,displayNameStyles:C}=(0,e4.Ay)(c),I=(0,e8.gn)(p,E,x),y=(0,e3.a)({displayNameStyles:C}),S=(0,e7.A)(h,c.attachments),v=(t=o.id,n=c.id,(0,m.bG)([tt.A],()=>{let e=n;for(let n=0;n<10;n++){let l=tt.A.getMessage(t,e);if(l?.type!==ea.lAJ.REPLY||null==l.messageReference)return n;e=l.messageReference.message_id}return 10},[t,n])),N=(0,eP.n)(o,c),_=a.showThreadPromptOnReply&&v>=2&&N;return(0,l.jsx)("div",{className:ts.e1,children:(0,l.jsxs)("div",{className:ts.kL,children:[(0,l.jsxs)("div",{className:ts.eU,children:[(0,l.jsx)(e0.A,{id:tr,children:j.intl.formatToPlainString(j.t.EpJL4E,{username:f})}),(0,l.jsx)(Q.D,{onClick:()=>(0,e9.pX)(ea.BVt.CHANNEL(o.getGuildId(),o.id,c.id)),focusProps:{offset:{top:-8,right:-4,bottom:-8,left:-4}},children:(0,l.jsx)(eQ.E,{color:"text-default",className:r()(ts.Qq,ts.Fn),variant:"text-sm/normal",children:j.intl.format(j.t["8E4GxS"],{userHook:(e,t)=>(0,l.jsxs)(i.Fragment,{children:["\xa0",S?.title!=null?(0,l.jsxs)("span",{className:ts.H8,children:[S.isClip&&(0,l.jsx)(e1.x,{size:"xs",color:"currentColor",className:ts.gS}),(0,l.jsx)(eQ.E,{variant:"text-sm/semibold",color:"text-default",className:ts.NV,children:S.title}),(0,l.jsxs)(eQ.E,{variant:"text-sm/normal",color:"text-link",children:["@",S.timestamp]})]}):(0,l.jsx)(e2.g,{className:ts.UU,name:f,colorString:g,colorStrings:I,roleName:A,displayNameStylesFont:y})]},t)})})}),(0,l.jsxs)("div",{className:ts.o1,children:[d&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(X.m,{asContainer:!0,text:u?j.intl.string(j.t.DH2o6R):j.intl.string(j.t.utGGIY),children:(0,l.jsx)(Q.D,{role:"switch","aria-checked":u,onClick:function(e){e.stopPropagation(),(0,e5.vz)(o.id,!u)},children:(0,l.jsxs)(eQ.E,{variant:"text-sm/bold",color:u?"text-link":"text-muted",className:ts.Z4,children:[(0,l.jsx)(e6.X,{size:"md",color:"currentColor","aria-label":j.intl.string(j.t.P8tvKG),className:ts.mM}),u?j.intl.string(j.t.p9jC2r):j.intl.string(j.t.U7f3bK)]})})}),(0,l.jsx)("div",{className:ts.me,"aria-hidden":!0})]}),(0,l.jsx)(ti,{onClick:function(e){e.stopPropagation(),(0,e5.Jx)(o.id)},"aria-label":j.intl.string(j.t.jSnJGT)})]})]}),_&&(0,l.jsx)(ta,{channel:o,message:c,replyChainLength:v})]})})}var tc=n(749314),tu=n(148355),td=n(74995);let th=i.memo(function(e){let{channelId:t,chatInputType:n}=e,[s,r]=i.useState(null),a=(0,m.bG)([ew.A],()=>ew.A.getStickerPreview(t,n.drafts.type));return n.stickers?.allowSending&&null!=a&&0!==a.length?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:td.Tz,children:a.map(e=>(0,l.jsxs)("div",{className:td.dp,children:[(0,l.jsx)(Q.D,{onFocus:()=>r(e.id),onBlur:()=>r(null),className:td.b,"aria-label":j.intl.formatToPlainString(j.t.BGAQRd,{name:e.name}),onClick:()=>(0,eL.x5)(t,n.drafts.type),children:(0,l.jsx)("div",{className:td.Nk,children:(0,l.jsx)(tn.a,{size:"md",color:"currentColor",className:td.ut})})}),(0,l.jsx)(tu.A,{isInteracting:s===e.id,className:td.UV,size:48,sticker:e})]},e.id))}),(0,l.jsx)(tc.A,{className:td.R})]}):null});var tm=n(612394);n(321073);var tp=n(442433);n(827669);var tf=n(448702);function tg(e){let t,s,a,{className:o,activeCommand:c,activeOption:u,optionStates:d,channelId:h}=e,m=i.useCallback(e=>{let t=c?.rootCommand?.id;null==t?e.preventDefault():(0,tp.L3)(e,async()=>{let{default:e}=await n.e("15687").then(n.bind(n,646938));return n=>(0,l.jsx)(e,{...n,id:t,label:j.intl.string(j.t.oJ1Muw)})})},[c?.rootCommand?.id]),p=i.useCallback(()=>{Z.Gf({channelId:h,command:null,section:null})},[h]);if(null==c)return null;if(null!=u){let e=d[u.name].lastValidationResult;t=u.displayName,s=u.displayDescription,a=e?.success?null:e?.error}else t=`/${c.displayName}`,s=c.displayDescription,a=null;return(0,l.jsxs)("div",{className:r()(o,tf.M0),onContextMenu:m,children:[(0,l.jsxs)("div",{className:tf.iz,children:[(0,l.jsx)("span",{className:tf.UU,children:t}),null!=a?(0,l.jsx)("span",{className:tf.z3,children:a}):(0,l.jsx)("span",{className:tf.h_,children:s})]}),(0,l.jsx)("div",{className:tf.o1,children:(0,l.jsx)(ti,{onClick:p,"aria-label":j.intl.string(j.t.cpT0Cq)})})]})}var tx=n(228366),tA=n(734057);let tE=new Set;class tC extends m.Ay.PersistedStore{static displayName="PTOStore";static persistKey="PTOStore";initialize(e){this.waitFor(tA.A,eU.Ay,eG.A,eB.default),null!=e&&(tE=new Set(e))}hasId(e){return tE.has(e)}getState(){return[...tE]}}let tI=new tC(tx.h,{}),ty=()=>{let e=eG.A.getChannelId();if(null==e)return;let t=tA.A.getChannel(e);null!=t&&t.isPrivate()&&(tE.has(t.getRecipientId())||(tE.add(t.getRecipientId()),tI.emitChange()))},tS=()=>(0,l.jsxs)("div",{className:ts.eU,children:[(0,l.jsx)(eQ.E,{variant:"text-sm/medium",className:r()(ts.Qq,ts.Fn),children:j.intl.string(j.t["2UvR1E"])}),(0,l.jsx)("div",{className:ts.o1,children:(0,l.jsx)(ti,{onClick:ty,"aria-label":j.intl.string(j.t.cpT0Cq)})})]});var tv=n(278351);let tN=e=>{let{error:t}=e;return(0,l.jsxs)("div",{className:tv.M,children:[(0,l.jsx)(eQ.E,{variant:"text-xs/bold",color:"text-strong",children:j.intl.string(j.t["4VDCG0"])}),t?(0,l.jsx)(eQ.E,{variant:"text-xs/medium",className:tv.z,children:j.intl.string(j.t.qNorwt)}):(0,l.jsx)(eQ.E,{variant:"text-xs/medium",color:"text-muted",children:j.intl.string(j.t["260qZS"])})]})};var t_=n(25201),tT=n(926321),tj=n(221933);function tb(e){var t,n;let{channelId:i}=e,s=(0,t_.vR)(i);if(null==s)return null;let a=s.rolling,o=(t=a,n=s.results,t?j.intl.string(j.t["x/FIRX"]):null==n?"":j.intl.formatToPlainString(j.t.xU4pF1,{total:n.reduce((e,t)=>e+t,0)}));return(0,l.jsx)("div",{className:r()(tj.kL,{[tj.Kd]:!s.dismissing}),children:(0,l.jsxs)("div",{className:tj.Qs,children:[(0,l.jsx)(tT.j,{size:"md",className:r()({[tj.su]:a})}),(0,l.jsx)(eQ.E,{color:"text-default",variant:"text-sm/normal",children:o})]})})}var tR=n(575293),tO=n(151282),tM=n(1372);function tw(e){let{pendingScheduledMessage:t}=e,{channelId:n,scheduledTimestamp:i}=t;return(0,l.jsx)("div",{className:tM.e1,children:(0,l.jsx)("div",{className:tM.kL,children:(0,l.jsxs)("div",{className:tM.g3,children:[(0,l.jsx)(eQ.E,{color:"text-default",className:r()(tM.Qq,tM.a3),variant:"text-sm/normal",children:j.intl.formatToPlainString(j.t["MQcRX/"],{timestamp:new Date(i).valueOf()})}),(0,l.jsx)("div",{className:tM.o1,children:(0,l.jsx)(ti,{onClick:function(e){e.stopPropagation(),(0,tO.Ps)(n)},"aria-label":j.intl.string(j.t.cpT0Cq)})})]})})})}var tL=n(266599);function tk(e){let{bars:t}=e,n=t.stacked.map((e,t)=>(0,l.jsx)("div",{children:e},t)),s=t.floating.map((e,t)=>(0,l.jsx)(i.Fragment,{children:e},t));return 0===n.length&&0===s.length?null:(0,l.jsxs)(i.Fragment,{children:[s.length>0&&(0,l.jsx)("div",{className:tL.Vq,children:s}),n.length>0&&(0,l.jsx)("div",{className:tL.MD,children:n})]})}var tP=n(123583),tD=n(562708),tU=n(150934),tV=n(139286),tG=n(47167),tF=n(713654),tH=n(252263),tB=n(8455),tW=n(67259),tK=n(355026);function tz(e){let{thread:t,pendingScheduledMessage:n}=e,s=(0,tB.Vp)({location:"ThreadsAlsoSendToChannelArea"}),[r,a]=(0,m.yK)([tA.A,tW.A],()=>[t.isThread()?tA.A.getChannel(t.parent_id):null,tW.A.getAlsoSendToChannel(t.id)]),o=(0,tG.Ay)(r),c=i.useCallback(e=>{eK.default.track(ea.HAw.MESSAGE_ALSO_SEND_TO_CHANNEL_TOGGLED,{value:e,guild_id:t.guild_id,channel_id:t.id}),(0,tH.B)({channelId:t.id,enabled:e})},[t]);if((0,tV.A)({name:tD.ImpressionNames.MESSAGE_ALSO_SEND_TO_CHANNEL,type:tD.ImpressionTypes.VIEW},{disableTrack:null==r||!s.enabled},[r,s.enabled]),!s.enabled||null==r)return null;let u=(0,tF.gU)(r),d=j.intl.format(j.t.UqL10G,{callToActionHook:(e,t)=>(0,l.jsx)(eQ.E,{variant:"text-sm/normal",color:"text-subtle",lineClamp:1,className:tK.Pf,children:j.intl.string(j.t.Pi3JW7)},t),channelName:o,channelNameHook:(e,t)=>(0,l.jsxs)(eQ.E,{variant:"text-sm/normal",color:"text-subtle",lineClamp:1,className:tK.Pf,children:[null==u?null:(0,l.jsx)(u,{color:"currentColor",className:tK.Kk},t),e]},t)});return(0,l.jsx)("div",{className:tK.kL,children:(0,l.jsx)(tU.S,{checked:a,disabled:null!=n,onChange:c,label:d,labelType:"secondary"})})}function tZ(e){let{channel:t,type:n,pendingScheduledMessage:i}=e,{shouldShow:s}=function(e){let{channel:t,type:n}=e,l=(0,m.bG)([tA.A],()=>{let e=tA.A.getChannel(t.parent_id);return e?.isForumLikeChannel()??!1}),i=[e$.oU.NORMAL,e$.oU.SIDEBAR].includes(n);return{shouldShow:t.isThread()&&!l&&i}}({channel:t,type:n});return s?(0,l.jsx)(tz,{thread:t,pendingScheduledMessage:i}):null}var tY=n(822610),tq=n(625928),tJ=n(135261),t$=n(820066),tX=n(922016),tQ=n(375499),t0=n(267889),t1=n(307731),t2=n(128934);function t6(e){let{getSlateEditor:t,onInsertEmoji:n,type:s,channel:r}=e,a=t(),o=i.useRef(null);return null==a?null:(0,l.jsxs)("div",{id:"slate-toolbar",className:t2.aL,children:[(0,l.jsx)("div",{className:t2.Wy,children:(0,l.jsx)(tJ.P,{slateEditor:a,options:s.markdown,iconClassName:t2.C7,dividerClassName:t2.us})}),(0,l.jsx)(tX.Y,{targetElementRef:o,renderPopout:e=>{let{closePopout:t}=e;return(0,l.jsx)(t0.A,{persistSearch:!0,channel:r,closePopout:t,onSelectEmoji:e=>{let{emoji:l,willClose:i}=e;n({emoji:l,willClose:i}),i&&t()},pickerIntention:s.expressionPicker?.emojiIntention??t1.EmojiIntention.COMMUNITY_CONTENT})},position:"bottom",animation:tX.Y.Animation.NONE,align:"left",children:(e,t)=>{let{isShown:n}=t;return(0,l.jsx)(tQ.A,{...e,ref:o,active:n,className:t2.Z8,tabIndex:0})}})]})}var t3=n(698279);function t7(e,t,s,r,a){let[o,c]=i.useState(!1),u=i.useCallback((i,d,h,m,f,g)=>{if(o)return;c(!0);let A=ew.A.getStickerPreview(a,t.drafts.type)?.map(e=>e.id)??[],E=eH.A.getUploads(a,t.drafts.type)??[];if(null==d&&!m&&!f&&(0,eC.xz)(E,a)){c(!1),(0,p.openModalLazy)(async()=>{let{default:e}=await Promise.all([n.e("42329"),n.e("2570"),n.e("72414"),n.e("60643"),n.e("43284"),n.e("38612"),n.e("90665"),n.e("64801"),n.e("12815"),n.e("49681"),n.e("76602"),n.e("34530"),n.e("28229"),n.e("21921"),n.e("39970"),n.e("72789"),n.e("79049"),n.e("65437"),n.e("79745"),n.e("5500"),n.e("32209"),n.e("49697"),n.e("18997"),n.e("68763"),n.e("58337"),n.e("47177"),n.e("26437"),n.e("98972"),n.e("12682"),n.e("33097"),n.e("36150"),n.e("99011"),n.e("15172"),n.e("10014"),n.e("86861"),n.e("70961"),n.e("23685"),n.e("42516"),n.e("84688")]).then(n.bind(n,538899));return t=>(0,l.jsx)(e,{...t,threadId:a,attachments:E,sendMessage:()=>u(i,void 0,void 0,void 0,!0)})});return}e({value:i,uploads:E,stickers:A,command:d,commandOptionValues:h,isGif:m,gifMetadata:g}).then(e=>{let{shouldClear:n,shouldRefocus:l}=e,i=(n&&t.submit?.clearOnSubmit)??!1,o=null!=s.current;i&&(a!==eG.A.getChannelId()?x.A.saveDraft(a,"",t.drafts.type):o&&(s.current?.clearValue(),r.current?.hide())),o&&(c(!1),(0,eA.v8)(),l&&s.current?.focus())})},[s,r,e,o,t,a]);return{submitting:o,submit:u,handleSubmit:i.useCallback(e=>{s?.current?.submit(e)},[s])}}function t4(e,t,n){return i.useCallback(l=>{if(t===e$.oU.CREATE_FORUM_POST||t===e$.oU.CREATE_ANNOUNCEMENT_POST)n.current?.insertGIF(l);else{let t={gif_provider:l.provider??(0,eI.cf)(),load_id:eW.A.getAnalyticsID(),source_object:"GIF Picker",gif_url:l.url,gif_id:l.id};e(l.url,void 0,void 0,!0,void 0,t)}(0,eA.v8)(),n.current?.focus()},[n,e,t])}function t8(e){return i.useCallback(t=>{let{emoji:n,willClose:l}=t,i=e.current;null!=n&&null!=i&&i.insertEmoji({emoji:n,willClose:l}),l&&(0,eA.v8)()},[e])}function t5(e){let{editorRef:t,disabled:n,textValue:l,channelId:s,chatInputType:r,submit:a}=e,{analyticsLocations:o}=(0,I.Ay)();return i.useCallback((e,i)=>{n||(r===e$.oU.CREATE_ANNOUNCEMENT_POST||(0,ek.YS)(i,l,s,r.drafts.type)?((0,tm.fh)({sticker:e,stickerSelectLocation:i,isReplacement:null!=ew.A.getStickerPreview(s,r.drafts.type),analyticsLocations:o}),(0,eL.$x)(s,e,r.drafts.type)):(a({value:"",uploads:void 0,stickers:[e.id]}),t.current?.clearValue()),(0,eA.v8)(),t.current?.focus())},[n,l,s,t,o,a,r])}function t9(e){return i.useCallback(t=>{let n=e.current;null!=n&&n.insertKaomoji(t),(0,eA.v8)(),n?.focus()},[e])}function ne(e,t,n){let l=i.useCallback(()=>{t||(0,eA.r$)(t3.kx.EMOJI,e,n)},[t,e,n]),s=i.useCallback(()=>{!t&&e.gifs?.allowSending&&(0,eA.r$)(t3.kx.GIF,e,n)},[t,e,n]),r=i.useCallback(()=>{!t&&e.stickers?.allowSending&&(0,eA.r$)(t3.kx.STICKER,e,n)},[t,e,n]);(0,ez.Vo)({event:ea.jej.TOGGLE_EMOJI_POPOUT,handler:l}),(0,ez.Vo)({event:ea.jej.TOGGLE_GIF_PICKER,handler:s}),(0,ez.Vo)({event:ea.jej.TOGGLE_STICKER_PICKER,handler:r})}function nt(e,t,n){let[l]=i.useState(()=>new a.EventEmitter);return i.useEffect(()=>{l.emit("text-changed",t,n)},[t,n,l]),{eventEmitter:l,handleEditorSelectionChanged:t=>{null!=e.current&&l.emit("selection-changed",t)}}}function nn(){let e=i.useRef(null),t=i.useCallback(()=>{e.current?.onMaybeShowAutocomplete()},[]),n=i.useCallback(()=>{e.current?.onHideAutocomplete()},[]);return{autocompleteRef:e,handleMaybeShowAutocomplete:t,handleHideAutocomplete:n}}function nl(e){let t=i.useRef(null);if(null!=e&&"function"==typeof e)throw Error("Only Ref objects are supported");return null==e?t:e}function ni(e){let[t,n]=i.useState(0);return{editorHeight:t,handleResize:i.useCallback(t=>{n(t??0),e?.(t)},[e])}}function ns(e,t,n,l){let i=e.getGuildId(),s=(0,m.bG)([ey.A],()=>null!=i&&ey.A.isLurking(i),[i]),r=(0,m.bG)([eU.Ay,eB.default],()=>{let e=eB.default.getCurrentUser();return(null!=i&&null!=e?eU.Ay.getMember(i,e.id)?.isPending:null)??!1}),a=(0,m.cf)([eV.A],()=>{let i=e.isPrivate(),s=eV.A.computePermissions(e),a=h.zy(s,ea.xBc.CREATE_PUBLIC_THREADS)||h.zy(s,ea.xBc.CREATE_PRIVATE_THREADS),o=(!t.permissions?.requireCreateTherads||a)&&(!t.permissions?.requireSendMessages||h.zy(s,ea.xBc.SEND_MESSAGES)),c=o&&h.zy(s,ea.xBc.ATTACH_FILES),u=null!=n,d=(0,eP.UJ)(e);return{disabled:l||r||!i&&!o||d,canAttachFiles:!0===t.attachments&&(i||r||c||u),canCreateThreads:a,canEveryoneSendMessages:eY.MJ(ea.xBc.SEND_MESSAGES,e)}},[e,t.permissions.requireCreateTherads,t.permissions.requireSendMessages,t.attachments,n,l,r]);return{isLurking:s,isPendingMember:r,...a}}function nr(e,t,n){let[l,s,r]=(0,eA.RQ)(e=>[e.activeView,e.activeViewType,e.activeChannelId],u.x),a=(0,m.bG)([S.A],()=>S.A.shouldShowPopup()&&S.A.activeViewType()===e&&S.A.activeChannelId()===n);i.useEffect(()=>()=>{(0,eA.v8)(e,n)},[e,n]);let o=i.useCallback(()=>{null!=l||a||t.current?.handleOuterClick()},[l,a,t]),c=null==l||null==s||s!==e||r!==n;return{expressionPickerView:l,shouldHideExpressionPicker:c,handleOuterClick:o}}let na=(e,t)=>({handleAutocompleteVisibilityChange:i.useCallback(n=>{n&&(0,eA.v8)(e,t)},[e,t])}),no=i.memo(i.forwardRef(function(e,t){let n,{textValue:s,richValue:a,className:o,innerClassName:u,editorClassName:h,id:p,required:x,disabled:v,placeholder:N,accessibilityLabel:_,channel:T,type:j,focused:b,error:R,renderAttachButton:O,renderApplicationCommandIcon:M,renderButtons:k,pendingReply:P,onChange:D,onResize:U,onBlur:V,onFocus:G,onKeyDown:F,onSubmit:H,promptToUpload:B,highlighted:W,canMentionRoles:K,canMentionChannels:z,maxCharacterCount:Z,showRemainingCharsAfterCount:Y,allowNewLines:q=!0,characterCountClassName:J,"aria-describedby":$,"aria-labelledby":X,setEditorRef:Q,autoCompletePosition:ee,children:et,disableThemedBackground:en=!1,emojiPickerCloseOnModalOuterClick:el,parentModalKey:ei,pendingScheduledMessage:es,showValueWhenDisabled:er=!1}=e;c()(null!=j,"chat input type must be set");let{analyticsLocations:eo}=(0,I.Ay)(C.A.CHANNEL_TEXT_AREA),ec=nl(t),eu=i.useRef(null),ed=i.useRef(null),em=i.useRef(null),eC=i.useRef(null),eI=i.useRef(null),ey=i.useCallback(()=>em.current?.getSlateEditor()??null,[]);Q?.(em.current);let ev=(0,y.A)(T),[eN,e_]=i.useState(!ev);(0,A.i4)(ec,e=>{let{width:t}=e;return e_(!ev&&(null==t||t>450))});let{activeCommand:eT,activeCommandSection:ej}=(0,m.cf)([L.A],()=>({activeCommand:j.commands?.enabled?L.A.getActiveCommand(T.id):null,activeCommandSection:j.commands?.enabled?L.A.getActiveCommandSection(T.id):null})),{isLurking:eb,isPendingMember:eR,disabled:eO,canAttachFiles:ew,canCreateThreads:eL,canEveryoneSendMessages:ek}=ns(T,j,eT,v),eP=j.toolbarType===e$.O1.STATIC,eV=!eD.D_.useSetting()&&!(0,eq.isAndroidWeb)()&&null!=window.ResizeObserver,eG=!eV||!j.commands?.enabled||!b||"/"!==s,eH=(0,eS.A)(),{fontSize:eW}=(0,m.cf)([E.A],()=>({fontSize:E.A.fontSize})),ez=(0,m.bG)([eF.A],()=>eF.A.isEnabled());ne(j,eO,T.id);let{eventEmitter:eY,handleEditorSelectionChanged:eQ}=nt(em,s,a),e0=i.useRef(s);e0.current=s;let e1=i.useCallback((e,t,n)=>{"/"===t&&""===e0.current&&j.commands?.enabled&&eY.emit("command-sentinel-typed"),D?.(e,t,n)},[D,j.commands?.enabled,eY]),{submitting:e2,submit:e6,handleSubmit:e3}=t7(H,j,em,eI,T.id),{autocompleteRef:e7,handleMaybeShowAutocomplete:e4,handleHideAutocomplete:e8}=nn(),e5=t4(e6,j,em),e9=t8(em),te=t5({editorRef:em,disabled:eO,textValue:s,channelId:T.id,chatInputType:j,submit:H}),tt=i.useCallback((e,t,n)=>{let l=em.current;null!=e&&null!=l&&(eK.default.track(ea.HAw.SOUNDMOJI_SELECT,{channel_id:T.id,guild_id:T.guild_id,sound_guild_id:e.guildId,sound_id:e.soundId,source:t}),l.insertSound(e)),n&&(0,eA.v8)(),l?.focus()},[em,T.id,T.guild_id]),tn=t9(em),tl=i.useCallback(()=>eI?.current?.hide(),[]),{editorHeight:ti,handleResize:ts}=ni(U),{handleTab:ta,handleEnter:tc,handleMoveSelection:tu}=(n=i.useCallback(()=>!!(!eG&&eu.current?.onTabOrEnter(!1))||e7.current?.onTabOrEnter(!1)||!1,[eG,eu,e7]),{handleTab:n,handleEnter:i.useCallback(()=>!!(!eG&&eu.current?.onTabOrEnter(!0))||e7.current?.onTabOrEnter(!0)||!1,[eG,eu,e7]),handleMoveSelection:i.useCallback(e=>!!(!eG&&eu.current?.onMoveSelection(e))||e7.current?.onMoveSelection(e)||!1,[eG,eu,e7])}),{expressionPickerView:td,shouldHideExpressionPicker:tm,handleOuterClick:tp}=nr(j,em,T.id),{selectedAutocompleteInputType:tf,selectedAutocompleteInputError:tx}=function(e,t){let[n,l]=i.useState({selectedAutocompleteInputType:null,selectedAutocompleteInputError:!1}),s=i.useCallback(()=>{let e,n=t.current?.getSlateEditor();null!=n&&(e=t$.VW.getSelectedParentOfType(n,eg.mk)?.[0]),l({selectedAutocompleteInputType:e?.type??null,selectedAutocompleteInputError:e?.error??!1})},[t]);return i.useEffect(()=>(e.on("selection-changed",s),e.on("submit-failure",s),s(),()=>{e.off("selection-changed",s),e.on("submit-failure",s)}),[s,e]),n}(eY,em),{handleAutocompleteVisibilityChange:tA}=na(j,T.id),tC=function(e){let{type:t,channelId:n}=e;return(0,ep.bG)([S.A],()=>{let e=S.A.activeViewType();return null!=e&&e===t&&S.A.activeChannelId()===n&&S.A.shouldShowPopup()},[t,n])}({type:j,channelId:T.id}),ty=i.useCallback(()=>{eY.emit("submit-failure")},[eY]);(0,eJ.R)(eY,T.guild_id,T.id);let tv=null!=P,tT=eO&&!((eb||eR)&&ek)||e2&&j.submit?.useDisabledStylesOnSubmit,tj=null;null!=eT?tj=M?.(eT,ej,tL.g$):(!eO||eL)&&(tj=O?.(tv,tL.g$));let tO=eV&&null!=a&&!eO&&j.showCharacterCount&&null==eT,tM=eV&&!__OVERLAY__&&null!=a&&null==eT&&j.toolbarType!==e$.O1.NONE&&!eO,tD=function(e){let{channel:t,type:n,activeCommand:s,pendingReply:r,pendingScheduledMessage:a,selectedAutocompleteInputType:o,selectedAutocompleteInputError:c}=e,{activeCommandOption:u,activeCommandOptionStates:d}=(0,m.cf)([L.A],()=>({activeCommandOption:L.A.getActiveOption(t.id),activeCommandOptionStates:L.A.getOptionStates(t.id)})),h=(0,m.bG)([eU.Ay,eB.default,tI],()=>{let e=eB.default.getCurrentUser();if(null==e||!e.isStaff()||!t.isDM())return!1;let n=eB.default.getUser(t.getRecipientId());if(!n?.isStaff())return!1;let l=eU.Ay.getNicknames(n.id).some(e=>e.endsWith("[PTO]")||e.endsWith("[OOO]"));return l?!tI.hasId(n.id)&&l:(tE.delete(n.id)&&tI.emitChange(),!1)}),p=(0,t_.Ay)(e=>e.channelId===t.id);return i.useMemo(()=>{let e=[],i=[];return null!=t.guild_id&&n===e$.oU.NORMAL&&i.push((0,l.jsx)(tR.A,{guildId:t.guild_id,channel:t,className:tL.UW})),null!=s&&e.push((0,l.jsx)(tg,{activeCommand:s,activeOption:u??null,optionStates:d,channelId:t.id})),null!=r&&e.push((0,l.jsx)(to,{reply:r,chatInputType:n})),h&&e.push((0,l.jsx)(tS,{})),null!=a&&e.push((0,l.jsx)(tw,{pendingScheduledMessage:a})),"timestampMentionInput"===o&&i.push((0,l.jsx)(tN,{error:c??!1})),p&&e.push((0,l.jsx)(tb,{channelId:t.id})),{stacked:e,floating:i}},[s,u,d,t,p,r,h,n,a,o,c])}({channel:T,type:j,activeCommand:eT,pendingReply:P,pendingScheduledMessage:es,selectedAutocompleteInputType:tf,selectedAutocompleteInputError:tx}),tU=0===s.trim().length,tV=null!=P?[$,tr].filter(Boolean).join(" "):$,tG=j.layout===e$.wt.INLINE,tF=j.layout===e$.wt.FLUSH,tH=(0,l.jsx)("div",{ref:ed,className:tL.BW}),tB=tC?(0,l.jsx)(w,{align:"right",positionTargetRef:ed,channel:T}):null,tW=null!=k?k():(0,l.jsx)(tP.A,{type:j,disabled:eO,channel:T,handleSubmit:e3,isEmpty:tU,showAllButtons:eN}),tK=tO?(0,l.jsx)(tq.A,{type:j,textValue:s,className:J,maxCharacterCount:Z,showRemainingCharsAfterCount:Y}):null;return i.useEffect(()=>{b&&eZ._.dispatch(ea.jej.CHANNEL_TEXT_AREA_FOCUSED,{channelId:T.id})},[b,T.id]),(0,l.jsx)(ex.Sv,{value:eY,children:(0,l.jsxs)(I.f5,{value:eo,children:[tM&&eP?(0,l.jsx)(t6,{getSlateEditor:ey,onInsertEmoji:e9,type:j,channel:T}):tM?(0,l.jsx)(tJ.A,{ref:eI,getSlateEditor:ey,containerRef:eC,options:j.markdown}):null,(0,l.jsxs)("div",{ref:ec,className:r()(o,{[tL.gM]:!0,[tL.h9]:tT,[tL.mr]:W,[tL.Wn]:d.Fr,[tL.Ls]:tG,[tL.AH]:tF,[tL.z3]:null!=R}),children:[tG||tF?null:(0,l.jsx)(tk,{bars:tD}),(0,l.jsxs)("div",{ref:eC,onScroll:tl,className:r()(u,{[tL.xx]:!0,[tL.k6]:!en,[tL.Ri]:tD.stacked.length>0}),children:[(0,l.jsx)(th,{channelId:T.id,chatInputType:j}),j.hideAttachmentArea?null:(0,l.jsx)(tY.A,{channelId:T.id,type:j,canAttachFiles:ew}),(0,l.jsxs)("div",{className:r()(tL.vW,{[tL.BF]:tT,[tL.RL]:j!==e$.oU.EDIT&&(null!=tj||tT&&null==tj||eb),[tL.fk]:j===e$.oU.THREAD_CREATION,[tL.TZ]:j===e$.oU.CREATE_FORUM_POST||j===e$.oU.FORWARD_MESSAGE_INPUT,[tL.$i]:j===e$.oU.USER_PROFILE_REPLY}),onMouseDown:tp,children:[tB,tj,(0,l.jsx)(f.vN,{ringTarget:ec,ringClassName:tL.Rg,children:(0,l.jsx)(eX.A,{ref:em,id:p,focused:b,useSlate:eV,textValue:s,richValue:a,disabled:eO,placeholder:N,required:x,accessibilityLabel:_,isPreviewing:(eb||eR)&&ek,channel:T,type:j,canPasteFiles:ew,uploadPromptCharacterCount:ea.CS1,maxCharacterCount:Z??eH,allowNewLines:q,"aria-describedby":tV,onChange:e1,onResize:ts,onBlur:V,onFocus:G,onKeyDown:F,onSubmit:e6,onSubmitFailure:ty,onTab:ta,onEnter:tc,onMoveSelection:tu,onSelectionChanged:eQ,onMaybeShowAutocomplete:e4,onHideAutocomplete:e8,promptToUpload:B,fontSize:eW,spellcheckEnabled:ez,canOnlyUseTextCommands:tv,className:r()({[tL.QI]:j===e$.oU.THREAD_CREATION,[tL.AV]:j===e$.oU.PROFILE_BIO_INPUT,[tL.GR]:j===e$.oU.OVERLAY_INLINE_REPLY},h),"aria-labelledby":X,showValueWhenDisabled:er})}),tW,tH]})]}),(0,l.jsx)(tZ,{channel:T,type:j,pendingScheduledMessage:es}),eG?null:(0,l.jsx)(eh,{ref:eu,channel:T,canOnlyUseTextCommands:tv}),(0,l.jsx)(ef.A,{ref:e7,channel:T,canMentionRoles:K,canMentionChannels:z,useNewSlashCommands:eV,canOnlyUseTextCommands:tv,canSendStickers:j.stickers?.allowSending,canSendSoundmoji:j.soundmoji?.allowSending,textValue:s,focused:b,expressionPickerView:td,type:j,targetRef:ec,editorRef:em,onSendMessage:e6,onSendSticker:te,onVisibilityChange:tA,editorScrollerRef:eC,editorHeight:ti,barsHeight:40*tD.floating.length,setValue:(e,t)=>e1?.(null,e,t),position:ee}),(0,l.jsx)(eM,{textValue:s,editorHeight:ti,channelId:T.id}),tK,et]}),(0,l.jsx)(g.U,{error:R}),tm?null:(0,l.jsx)(eE.A,{positionTargetRef:ec,type:j,onSelectGIF:e5,onSelectEmoji:e9,onSelectSticker:te,onSelectSound:tt,onSelectKaomoji:tn,channel:T,closeOnModalOuterClick:el,parentModalKey:ei,position:"top",align:"right",positionLayerClassName:tL.BD})]})})}))}