Module 1768

2,315 characters · in no known chunk
Dependencies
Required by (1)
Lazily required by (0)none
Lazily requires (0)none
Source Raw
function(e,t,n){"use strict";n.d(t,{g1:()=>S,nd:()=>I});var r=n(627968),i=n(64700),s=n(503698),a=n.n(s),o=n(990078),l=n(397927),u=n(736653),c=n(355622),d=n(408018),_=n(133343),f=n(375499),p=n(429433),h=n(95701);n(790168);var m=n(652215),E=n(985018),g=n(389605);let A=(0,h.createChannelRecord)({id:"1",type:m.rbe.DM});function I(e){let{placeholder:t,onEnter:n,setEditorRef:s,showEmojiButton:o=!1,renderAttachButton:l,autoFocus:u=!0,onFocus:f,channel:p,className:h}=e,[m,E]=i.useState(""),[I,T]=i.useState((0,d.x7)("")),S=()=>{E(""),T((0,d.x7)(""))},y=c.oU.ATOMIC_REACTOR_REPLY_INPUT,v=i.useRef(null),N=()=>{if(null==v.current)return"top";let e=v.current.getBoundingClientRect(),t=window.innerHeight;return e.top<t/2?"bottom":"top"};return(0,r.jsx)(_.Ay,{ref:v,placeholder:t,editorClassName:h,className:a()(g.N8,h),showRemainingCharsAfterCount:-1,allowNewLines:!1,maxCharacterCount:200,channel:p??A,onChange:(e,t,n)=>{E(t),T(n)},type:o?{...y,emojis:{button:!0}}:y,textValue:m,richValue:I,onSubmit:e=>{let{value:t}=e;return t.length>200?Promise.resolve({shouldClear:!1,shouldRefocus:!0}):(n(t),S(),Promise.resolve({shouldClear:!0,shouldRefocus:!1}))},setEditorRef:s,focused:u,onFocus:f,disableThemedBackground:!0,emojiPickerCloseOnModalOuterClick:!0,disabled:!1,autoCompletePosition:N(),renderAttachButton:l})}let T=(e,t)=>{i.useEffect(()=>{let n=t=>{"Escape"===t.key&&e()},r=n=>{null!=n.target&&(t?.current?.contains(n?.target)||e())};return document.addEventListener("keydown",n),document.addEventListener("mousedown",r),()=>{document.removeEventListener("keydown",n),document.removeEventListener("mousedown",r)}},[e,t])},S=e=>{let{onSelectEmoji:t,onClick:n}=e,s=(0,u.Ay)(),[a,c]=i.useState(!1),d=i.useRef(null),_=i.useRef(null);return T(()=>c(!1),d),(0,r.jsx)(l.YNO,{targetElementRef:_,align:"right",position:"top",shouldShow:a,disablePointerEvents:!1,renderPopout:()=>(0,r.jsx)(l.NPJ,{theme:s,children:e=>(0,r.jsx)("div",{className:e,ref:d,children:(0,r.jsx)(p.C,{messageId:m.dJq,channel:A,closePopout:()=>{c(!1)},onSelectEmoji:e=>{let{emoji:n,willClose:r,isBurst:i}=e;null!=n&&(t({emoji:n,willClose:r,isBurst:i}),c(!1))}})})}),children:()=>(0,r.jsx)(o.m,{text:E.intl.string(E.t.lfIHs4),children:(0,r.jsx)("div",{ref:_,className:g.mJ,children:(0,r.jsx)(f.A,{active:!1,tabIndex:0,onClick:()=>{n?.(),c(!0)}})})})})}}