(window.webpackJsonp=window.webpackJsonp||[]).push([[9],{312:function(e,t,n){"use strict";n.d(t,"b",(function(){return i})),n.d(t,"a",(function(){return l})),n.d(t,"c",(function(){return s}));var r=n(13),o=n.n(r),a=n(120);function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){return function(e){for(var t=1;tsetTimeout(e,0)))}function o(){const e=document.getSelection();return Boolean(null==e?void 0:e.isCollapsed)}function a(e){const t=document.getSelection();if(!t)return!1;if(t.anchorNode===e&&t.anchorOffset<=1)return!0;let n=e.firstChild;do{var r;if(n===t.anchorNode)return 0===t.anchorOffset}while(n=(null===(r=n)||void 0===r?void 0:r.firstChild)||null);return!1}function c(e){var t;const n=document.getSelection();if(!n)return!1;if(n.focusNode===e&&n.focusOffset===(null===(t=e.childNodes)||void 0===t?void 0:t.length))return!0;let r=e.childNodes.item(e.childNodes.length-2);do{var o;if(r===n.focusNode)return n.focusOffset===(null===(o=r.textContent)||void 0===o?void 0:o.length)}while(r=r.lastChild);return!1}n.d(t,"d",(function(){return r})),n.d(t,"c",(function(){return o})),n.d(t,"b",(function(){return a})),n.d(t,"a",(function(){return c}))},403:function(e,t,n){"use strict";n.d(t,"b",(function(){return c})),n.d(t,"a",(function(){return i}));var r=n(136),o=n(124),a=n(128);function c(e){o.a.dispatch({action:a.a.EditEvent,event:null,timelineRenderingType:e.timelineRenderingType}),o.a.dispatch({action:a.a.FocusSendMessageComposer,context:e.timelineRenderingType})}function i(e,t){const n=t.getEvent().replacingEvent();!n||n.status!==r.EventStatus.QUEUED&&n.status!==r.EventStatus.NOT_SENT||e.cancelPendingEvent(n)}},639:function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(120),o=n.n(r),a=n(142),c=n(205),i=n(121);const l=e=>{let{name:t,last:n}=e;const r=a.g[t],c=a.a[t];return o.a.createElement(o.a.Fragment,null,o.a.createElement("kbd",null," ",r||c&&Object(i.a)(c)||t," "),!n&&"+")},s=e=>{let{value:t,className:n="mx_KeyboardShortcut"}=e;if(!t)return null;const r=[];return t.ctrlOrCmdKey?r.push(o.a.createElement(l,{key:"ctrlOrCmdKey",name:c.a?c.b.META:c.b.CONTROL})):t.ctrlKey?r.push(o.a.createElement(l,{key:"ctrlKey",name:c.b.CONTROL})):t.metaKey&&r.push(o.a.createElement(l,{key:"metaKey",name:c.b.META})),t.altKey&&r.push(o.a.createElement(l,{key:"altKey",name:c.b.ALT})),t.shiftKey&&r.push(o.a.createElement(l,{key:"shiftKey",name:c.b.SHIFT})),o.a.createElement("div",{className:n},r,o.a.createElement(l,{name:t.key,last:!0}))}},642:function(e,t,n){"use strict";function r(e,t,n,r){var o;t===n.timelineRenderingType&&(null===(o=e.current)||void 0===o||o.focus(),r.current&&clearTimeout(r.current),r.current=window.setTimeout((()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.focus()}),200))}function o(e){const t=document.createRange();t.selectNodeContents(e),t.collapse(!1);const n=document.getSelection();n.removeAllRanges(),n.addRange(t),e.focus()}n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return o}))},910:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(120),o=n(642);function a(e,t){Object(r.useEffect)((()=>{t.current&&!e&&Object(o.b)(t.current)}),[t,e])}},911:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(120);function o(){const[e,t]=Object(r.useState)(!1),n=Object(r.useRef)();Object(r.useEffect)((()=>()=>clearTimeout(n.current)),[n]);return{isFocused:e,onFocus:Object(r.useCallback)((e=>{clearTimeout(n.current),"focus"===e.type?t(!0):n.current=window.setTimeout((()=>t(!1)),100)}),[t,n])}}},918:function(e,t,n){"use strict";n.d(t,"a",(function(){return Ne}));var r,o=n(120),a=n.n(o),c=n(643),i=n(126),l=n.n(i);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let{composer:t,isTextEnabled:n,onFinished:r,composerContext:c,isEditing:i}=e;const[l,s]=Object(o.useState)(!1),[u,d]=Object(o.useState)({text:"",link:i?t.getLink():""}),m=!i&&n,f=!l||m&&ie(u.text)||ie(u.link);return a.a.createElement(re.a,{className:"mx_LinkModal",title:i?Object(X.a)("Edit link"):Object(X.a)("Create a link"),hasCancel:!0,onFinished:r},a.a.createElement("form",{className:"mx_LinkModal_content",onSubmit:async e=>{e.preventDefault(),e.stopPropagation(),r(),await new Promise((e=>setTimeout(e,0))),await Object(ne.d)(c.selection),t.link(u.link,n?u.text:void 0)}},m&&a.a.createElement(te.a,{required:!0,autoFocus:!0,label:Object(X.a)("Text"),value:u.text,className:"mx_LinkModal_Field",placeholder:"",onChange:e=>d((t=>ce(ce({},t),{},{text:e.target.value})))}),a.a.createElement(te.a,{required:!0,autoFocus:!m,label:Object(X.a)("Link"),value:u.link,className:"mx_LinkModal_Field",placeholder:"",onChange:e=>{d((t=>ce(ce({},t),{},{link:e.target.value}))),s(!0)}}),a.a.createElement("div",{className:"mx_LinkModal_buttons"},i&&a.a.createElement("button",{type:"button",className:"danger",onClick:()=>{t.removeLinks(),r()}},Object(X.a)("Remove")),a.a.createElement(oe.a,{primaryButton:Object(X.a)("Save"),primaryDisabled:f,primaryIsSubmit:!0,onCancel:r}))))};var se=n(312);function ue(e){let{label:t,keyCombo:n}=e;return a.a.createElement("div",{className:"mx_FormattingButtons_Tooltip"},t,n&&a.a.createElement(G.a,{value:n,className:"mx_FormattingButtons_Tooltip_KeyboardShortcut"}))}function de(e){let{label:t,keyCombo:n,onClick:r,actionState:o,icon:c}=e;return a.a.createElement(Q.a,{element:"button",onClick:r,title:t,className:l()("mx_FormattingButtons_Button",{mx_FormattingButtons_active:"reversed"===o,mx_FormattingButtons_Button_hover:"enabled"===o,mx_FormattingButtons_disabled:"disabled"===o}),tooltip:n&&a.a.createElement(ue,{label:t,keyCombo:n}),forceHide:"disabled"===o,alignment:$.a.Top},c)}function me(e){let{composer:t,actionStates:n}=e;const r=Object(se.c)(),o="reversed"===n.unorderedList||"reversed"===n.orderedList;return a.a.createElement("div",{className:"mx_FormattingButtons"},a.a.createElement(de,{actionState:n.bold,label:Object(X.c)("Bold"),keyCombo:{ctrlOrCmdKey:!0,key:"b"},onClick:()=>t.bold(),icon:a.a.createElement(u,{className:"mx_FormattingButtons_Icon"})}),a.a.createElement(de,{actionState:n.italic,label:Object(X.c)("Italic"),keyCombo:{ctrlOrCmdKey:!0,key:"i"},onClick:()=>t.italic(),icon:a.a.createElement(f,{className:"mx_FormattingButtons_Icon"})}),a.a.createElement(de,{actionState:n.underline,label:Object(X.c)("Underline"),keyCombo:{ctrlOrCmdKey:!0,key:"u"},onClick:()=>t.underline(),icon:a.a.createElement(b,{className:"mx_FormattingButtons_Icon"})}),a.a.createElement(de,{actionState:n.strikeThrough,label:Object(X.c)("Strikethrough"),onClick:()=>t.strikeThrough(),icon:a.a.createElement(O,{className:"mx_FormattingButtons_Icon"})}),a.a.createElement(de,{actionState:n.unorderedList,label:Object(X.c)("Bulleted list"),onClick:()=>t.unorderedList(),icon:a.a.createElement(M,{className:"mx_FormattingButtons_Icon"})}),a.a.createElement(de,{actionState:n.orderedList,label:Object(X.c)("Numbered list"),onClick:()=>t.orderedList(),icon:a.a.createElement(H,{className:"mx_FormattingButtons_Icon"})}),o&&a.a.createElement(de,{actionState:n.indent,label:Object(X.c)("Indent increase"),onClick:()=>t.indent(),icon:a.a.createElement(W,{className:"mx_FormattingButtons_Icon"})}),o&&a.a.createElement(de,{actionState:n.unindent,label:Object(X.c)("Indent decrease"),onClick:()=>t.unindent(),icon:a.a.createElement(J,{className:"mx_FormattingButtons_Icon"})}),a.a.createElement(de,{actionState:n.quote,label:Object(X.c)("Quote"),onClick:()=>t.quote(),icon:a.a.createElement(w,{className:"mx_FormattingButtons_Icon"})}),a.a.createElement(de,{actionState:n.inlineCode,label:Object(X.c)("Code"),keyCombo:{ctrlOrCmdKey:!0,key:"e"},onClick:()=>t.inlineCode(),icon:a.a.createElement(C,{className:"mx_FormattingButtons_Icon"})}),a.a.createElement(de,{actionState:n.codeBlock,label:Object(X.c)("Code block"),onClick:()=>t.codeBlock(),icon:a.a.createElement(I,{className:"mx_FormattingButtons_Icon"})}),a.a.createElement(de,{actionState:n.link,label:Object(X.c)("Link"),onClick:()=>function(e,t,n){ee.b.createDialog(le,{composerContext:t,composer:e,isTextEnabled:Object(ne.c)(),isEditing:n},"mx_CompoundDialog",!1,!0)}(t,r,"reversed"===n.link),icon:a.a.createElement(N,{className:"mx_FormattingButtons_Icon"})}))}var fe=n(927),pe=n(167),ve=n(152),be=n(142),he=n(180),ge=n(124),Oe=n(128),Ee=n(138),ye=n(133),we=n(170);var je=n(403);function _e(e,t){const n=Object(Ee.c)(),r=Object(se.c)(),a=Object(ye.b)(),c=Object(pe.b)("MessageComposerInput.ctrlEnterToSend");return Object(o.useCallback)(((o,i,l)=>{if(o instanceof ClipboardEvent)return o;const s=()=>{var t,n;null===(t=o.stopPropagation)||void 0===t||t.call(o),null===(n=o.preventDefault)||void 0===n||n.call(o),e()};return o instanceof KeyboardEvent?function(e,t,n,r,o,a,c,i){const{editorStateTransfer:l}=c,s=Boolean(l)?n!==r.content():0!==r.content().length;switch(Object(ve.a)().getMessageComposerAction(e)){case be.h.SendMessage:return t(),null;case be.h.EditPrevMessage:if(!Object(ne.b)(o)||s)break;if(Ce(e,!1,l,c,a,i))return null;break;case be.h.EditNextMessage:if(!l||!Object(ne.a)(o)||s)break;return Ce(e,!0,l,c,a,i)||(Object(je.b)(a),e.preventDefault(),e.stopPropagation()),null}return e}(o,s,t,i,l,n,r,a):function(e,t,n){switch(e.inputType){case"insertParagraph":if(!n)return t(),null;break;case"sendMessage":if(n)return t(),null}return e}(o,s,c)}),[c,e,t,n,r,a])}function Ce(e,t,n,r,o,a){const c=n?function(e,t,n){var r;const o=null===(r=t.liveTimeline)||void 0===r?void 0:r.getEvents();if(!o)return;const a=e.getEvent().getRoomId();if(!a)return;const c=n.getRoom(a);if(!c)return;const i=c.getPendingEvents(),l=Boolean(e.getEvent().getThread());return o.concat(l?[]:i)}(n,o,a):function(e,t){var n,r,o;const a=(null===(n=e.eventRelation)||void 0===n?void 0:n.key)===we.d.name;return null===(r=t.liveTimeline)||void 0===r?void 0:r.getEvents().concat(a?[]:(null===(o=t.room)||void 0===o?void 0:o.getPendingEvents())||[])}(r,o);if(!c)return!1;const i=Object(he.g)({events:c,isForward:t,fromEventId:null==n?void 0:n.getEvent().getId()});return!!i&&(ge.a.dispatch({action:Oe.a.EditEvent,event:i,timelineRenderingType:o.timelineRenderingType}),e.stopPropagation(),e.preventDefault(),!0)}var ke=n(910),xe=n(911);const Ne=Object(o.memo)((function(e){let{disabled:t=!1,onChange:n,onSend:r,placeholder:i,initialContent:s,className:u,leftComponent:d,rightComponent:m,children:f}=e;const p=_e(r,s),{ref:v,isWysiwygReady:b,content:h,actionStates:g,wysiwyg:O}=Object(c.useWysiwyg)({initialContent:s,inputEventProcessor:p});Object(o.useEffect)((()=>{t||null===h||null==n||n(h)}),[n,h,t]);const E=b&&!t;Object(ke.a)(!E,v);const{isFocused:y,onFocus:w}=Object(xe.a)(),j=!h&&i||void 0;return a.a.createElement("div",{"data-testid":"WysiwygComposer",className:l()(u,{[`${u}-focused`]:y}),onFocus:w,onBlur:w},a.a.createElement(me,{composer:O,actionStates:g}),a.a.createElement(fe.a,{ref:v,disabled:!E,leftComponent:d,rightComponent:m,placeholder:j}),null==f?void 0:f(v,O))}))},927:function(e,t,n){"use strict";n.d(t,"a",(function(){return p}));var r=n(126),o=n.n(r),a=n(120),c=n.n(a);var i=n(13),l=n.n(i),s=n(564),u=n(312);function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function m(e){for(var t=1;t{if(e.current){const n=e.current,o=new ResizeObserver((e=>{requestAnimationFrame((()=>{var n,o;const a=null===(n=e[0])||void 0===n||null===(o=n.contentBoxSize)||void 0===o?void 0:o[0].blockSize;r(a>=t)}))}));return o.observe(n),()=>o.unobserve(n)}}),[e,t]),n}(t,24),{onFocus:p,onBlur:v,onInput:b}=function(){const e=Object(u.c)(),[t,n]=Object(s.a)();Object(a.useEffect)((()=>{function n(){f(e)}return t&&document.addEventListener("selectionchange",n),()=>document.removeEventListener("selectionchange",n)}),[t,e]);const r=Object(a.useCallback)((()=>{f(e)}),[e]);return m(m({},n),{},{onInput:r})}();return c.a.createElement("div",{"data-testid":"WysiwygComposerEditor",className:"mx_WysiwygComposer_Editor","data-is-expanded":d},i,c.a.createElement("div",{className:"mx_WysiwygComposer_Editor_container"},c.a.createElement("div",{className:o()("mx_WysiwygComposer_Editor_content",{mx_WysiwygComposer_Editor_content_placeholder:Boolean(r)}),style:{"--placeholder":`"${r}"`},ref:t,contentEditable:!n,role:"textbox","aria-multiline":"true","aria-autocomplete":"list","aria-haspopup":"listbox",dir:"auto","aria-disabled":n,onFocus:p,onBlur:v,onInput:b})),l)})))}}]); //# sourceMappingURL=9.js.map