|
|
(window.webpackJsonp=window.webpackJsonp||[]).push([[29],{1425:function(e,t,a){"use strict";(function(e){var t=a(136);if(e.__js_sdk_entrypoint)throw new Error("Multiple matrix-js-sdk entrypoints detected!");let n;e.__js_sdk_entrypoint=!0;try{n=e.indexedDB}catch(e){}n&&t.setCryptoStoreFactory((()=>new t.IndexedDBCryptoStore(n,"matrix-js-sdk:crypto")));e.matrixcs=t}).call(this,a(14))},1426:function(e,t,a){"use strict";var n=a(13),i=a.n(n),s=a(1),r=a(122),o=a(124),l=a(329);var c;!function(e){e.Online="online",e.Offline="offline",e.Unavailable="unavailable"}(c||(c={}));t.a=new class{constructor(){i()(this,"unavailableTimer",null),i()(this,"dispatcherRef",null),i()(this,"state",null),i()(this,"onAction",(e=>{var t;"user_activity"===e.action&&(this.setState(c.Online),null===(t=this.unavailableTimer)||void 0===t||t.restart())}))}async start(){for(this.unavailableTimer=new l.a(18e4),this.dispatcherRef=o.a.register(this.onAction);this.unavailableTimer;)try{await this.unavailableTimer.finished(),this.setState(c.Unavailable)}catch(e){}}stop(){this.dispatcherRef&&(o.a.unregister(this.dispatcherRef),this.dispatcherRef=null),this.unavailableTimer&&(this.unavailableTimer.abort(),this.unavailableTimer=null)}getState(){return this.state}async setState(e){if(e===this.state)return;const t=this.state;if(this.state=e,!r.a.get().isGuest())try{await r.a.get().setPresence({presence:this.state}),s.a.info("Presence:",e)}catch(e){s.a.error("Failed to set presence:",e),this.state=t}}}},1427:function(e,t){e.exports="fonts/Twemoji_Mozilla/TwemojiMozilla-colr.4d2d834.woff2"},1428:function(e,t){e.exports="fonts/Twemoji_Mozilla/TwemojiMozilla-sbix.b1b6461.woff2"},1429:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return r}));var n,i=a(120);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},s.apply(this,arguments)}function r(e){return i.createElement("svg",s({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 18 18",role:"presentation","aria-hidden":!0},e),n||(n=i.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 3.05v6.22C2 15.63 9 17 9 17s7-1.37 7-7.73V3.05L9 1 2 3.05zm9.94 2.47c.19-.18.49-.17.67.02.16.18.16.45.02.63l-4.22 5.11-.03.04c-.28.34-.79.39-1.13.11a.29.29 0 01-.077-.067.912.912 0 00-.023-.023L5.34 9.26c-.2-.24-.18-.6.06-.8.2-.18.49-.18.7-.04l1.57 1.1 4.27-4z",fill:"#010101"})))}t.default="img/e2e/verified-deprecated.85c94e6.svg"},1430:function(e,t,a){"use strict";t.a={}},1431:function(e,t,a){"use strict";var n=a(120),i=a.n(n),s=a(155),r=a(121),o=a(131);t.a=e=>{const t=o.b.get().brand,a=Object(r.a)("%(brand)s now uses 3-5x less memory, by only loading information about other users when needed. Please wait whilst we resynchronise with the server!",{brand:t});return i.a.createElement(s.a,{hasCancelButton:!1,title:Object(r.a)("Updating %(brand)s",{brand:t}),description:i.a.createElement("div",null,a),button:Object(r.a)("OK"),onFinished:e.onFinished})}},1432:function(e,t,a){"use strict";var n=a(120),i=a.n(n),s=a(155),r=a(121),o=a(131);t.a=e=>{const t=o.b.get().brand,a=Object(r.a)("You've previously used %(brand)s on %(host)s with lazy loading of members enabled. In this version lazy loading is disabled. As the local cache is not compatible between these two settings, %(brand)s needs to resync your account.",{brand:t,host:e.host}),n=Object(r.a)("If the other version of %(brand)s is still open in another tab, please close it as using %(brand)s on the same host with both lazy loading enabled and disabled simultaneously will cause issues.",{brand:t});return i.a.createElement(s.a,{hasCancelButton:!1,title:Object(r.a)("Incompatible local cache"),description:i.a.createElement("div",null,i.a.createElement("p",null,a),i.a.createElement("p",null,n)),button:Object(r.a)("Clear cache and resync"),onFinished:e.onFinished})}},1433:function(e,t,a){"use strict";a.d(t,"a",(function(){return p}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(131),l=a(127),c=a(121),d=a(155),m=a(276),u=a(135),h=a(145);class p extends r.a.Component{constructor(){super(...arguments),i()(this,"sendBugReport",(()=>{l.b.createDialog(m.a,{error:this.props.error})})),i()(this,"onClearStorageClick",(()=>{l.b.createDialog(d.a,{title:Object(c.a)("Sign out"),description:r.a.createElement("div",null,Object(c.a)("Sign out and remove encryption keys?")),button:Object(c.a)("Sign out"),danger:!0,onFinished:this.props.onFinished})})),i()(this,"onRefreshClick",(()=>{window.location.reload()}))}render(){const e=o.b.get().brand,t=r.a.createElement("button",{onClick:this.onClearStorageClick,className:"danger"},Object(c.a)("Clear Storage and Sign Out"));let a;return a=o.b.get().bug_report_endpoint_url?r.a.createElement(h.a,{primaryButton:Object(c.a)("Send Logs"),onPrimaryButtonClick:this.sendBugReport,focus:!0,hasCancel:!1},t):r.a.createElement(h.a,{primaryButton:Object(c.a)("Refresh"),onPrimaryButtonClick:this.onRefreshClick,focus:!0,hasCancel:!1},t),r.a.createElement(u.a,{className:"mx_ErrorDialog",onFinished:this.props.onFinished,title:Object(c.a)("Unable to restore session"),contentId:"mx_Dialog_content",hasCancel:!1},r.a.createElement("div",{className:"mx_Dialog_content",id:"mx_Dialog_content"},r.a.createElement("p",null,Object(c.a)("We encountered an error trying to restore your previous session.")),r.a.createElement("p",null,Object(c.a)("If you have previously used a more recent version of %(brand)s, your session may be incompatible with this version. Close this window and return to the more recent version.",{brand:e})),r.a.createElement("p",null,Object(c.a)("Clearing your browser's storage may fix the problem, but will sign you out and cause any encrypted chat history to become unreadable."))),a)}}},1434:function(e,t,a){"use strict";a.d(t,"a",(function(){return p}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(131),l=a(127),c=a(121),d=a(135),m=a(145),u=a(276),h=a(123);class p extends r.a.Component{constructor(){super(...arguments),i()(this,"sendBugReport",(e=>{e.preventDefault(),l.b.createDialog(u.a,{})})),i()(this,"onSignOutClick",(()=>{this.props.onFinished(!0)}))}render(){let e;return o.b.get().bug_report_endpoint_url&&(e=Object(c.a)("To help us prevent this in future, please <a>send us logs</a>.",{},{a:e=>r.a.createElement(h.a,{kind:"link_inline",onClick:this.sendBugReport},e)})),r.a.createElement(d.a,{className:"mx_ErrorDialog",onFinished:this.props.onFinished,title:Object(c.a)("Missing session data"),contentId:"mx_Dialog_content",hasCancel:!1},r.a.createElement("div",{className:"mx_Dialog_content",id:"mx_Dialog_content"},r.a.createElement("p",null,Object(c.a)("Some session data, including encrypted message keys, is missing. Sign out and sign in to fix this, restoring keys from backup.")),r.a.createElement("p",null,Object(c.a)("Your browser likely removed this data when running low on disk space.")," ",e)),r.a.createElement(m.a,{primaryButton:Object(c.a)("Sign out"),onPrimaryButtonClick:this.onSignOutClick,focus:!0,hasCancel:!1}))}}},1435:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return r}));var n,i=a(120);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},s.apply(this,arguments)}function r(e){return i.createElement("svg",s({viewBox:"-1 -1 13 13",xmlns:"http://www.w3.org/2000/svg",role:"presentation","aria-hidden":!0},e),n||(n=i.createElement("g",{stroke:"#4A4A4A",strokeWidth:2.82,strokeLinecap:"square",fill:"none",fillRule:"evenodd"},i.createElement("path",{d:"M6 2.229V9.77M2.229 6H9.77"}))))}t.default="img/plus.e8a5e12.svg"},1436:function(e,t,a){"use strict";(function(e){a.d(t,"a",(function(){return $e}));var n=a(130),i=a.n(n),s=a(13),r=a.n(s),o=a(120),l=a.n(o),c=a(136),d=a(215),m=a(288),u=a(16),h=a(1),p=a(149),g=a(174),v=(a(1437),a(1438),a(159)),b=a(873),f=a(122),y=a(157),E=a(131),_=a(124),w=a(274),S=a(127),O=a(232),C=a(285),x=a(470),j=(a(1439),a(1452),a(426)),k=a(219),R=a(121),I=a(125),T=a(619),N=a(880),P=a(386),D=a(1453),M=a(349),A=a(164),L=a(469),U=a(460),F=a(389),B=a(198),V=a(432),W=a(1544),H=a(128),z=a(900),G=a(617),K=a(144),q=a(220),$=a(137),Y=a(868),J=a(156),Q=a(1517),X=a(1518),Z=a(477),ee=a(226),te=a(190),ae=a(292),ne=a(134),ie=a(155),se=a(1545),re=a(588),oe=a(1522),le=a(1552),ce=a(1523),de=a(1555),me=a(1546),ue=a(1556),he=a(1557),pe=a(1558),ge=a(401),ve=a(1532),be=a(1559),fe=a(195),ye=a(1560),Ee=a(168),_e=a(228),we=a(189),Se=a(576),Oe=a(183),Ce=a(249),xe=a(123),je=a(362),ke=a(26),Re=a(496),Ie=a(306),Te=a(182),Ne=a(173),Pe=a(138),De=a(1553),Me=a(217),Ae=a(154),Le=a(1533),Ue=a(192),Fe=a(236),Be=a(881),Ve=a(305),We=a(196),He=a(197);function ze(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function Ge(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?ze(Object(a),!0).forEach((function(t){r()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):ze(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}const Ke=["register","login","forgot_password","start_sso","start_cas","welcome"],qe=[H.a.ViewUserSettings,"view_create_chat","view_create_room"];class $e extends l.a.PureComponent{constructor(t){if(super(t),r()(this,"firstSyncComplete",!1),r()(this,"firstSyncPromise",void 0),r()(this,"screenAfterLogin",void 0),r()(this,"tokenLogin",void 0),r()(this,"focusComposer",void 0),r()(this,"subTitleStatus",void 0),r()(this,"prevWindowWidth",void 0),r()(this,"voiceBroadcastResumer",void 0),r()(this,"loggedInView",void 0),r()(this,"dispatcherRef",void 0),r()(this,"themeWatcher",void 0),r()(this,"fontWatcher",void 0),r()(this,"stores",void 0),r()(this,"onWindowResized",(()=>{this.warnInConsole()})),r()(this,"warnInConsole",Object(p.throttle)((()=>{const t="15px",a=Object(R.a)("Wait!"),n=Object(R.a)("If someone told you to copy/paste something here, there is a high likelihood you're being scammed!"),i=Object(R.a)("If you know what you're doing, Element is open-source, be sure to check out our GitHub (https://github.com/vector-im/element-web/) and contribute!");e.mx_rage_logger.bypassRageshake("log",`%c${a}\n%c${n}\n%c${i}`,"font-size:50px; color:blue;",`font-size:${t}; color:red;`,`font-size:${t};`)}),1e3)),r()(this,"onAction",(e=>{var t;if(null!==(t=f.a.get())&&void 0!==t&&t.isGuest()&&qe.includes(e.action))return _.a.dispatch({action:H.a.DoAfterSyncPrepared,deferred_action:e}),void _.a.dispatch({action:"require_registration"});switch(e.action){case"MatrixActions.accountData":if("m.identity_server"===e.event_type){const t=e.event_content?e.event_content.base_url:null;t?(f.a.get().setIdentityServerUrl(t),localStorage.removeItem("mx_is_access_token"),localStorage.setItem("mx_is_url",t)):(f.a.get().setIdentityServerUrl(null),localStorage.removeItem("mx_is_access_token"),localStorage.removeItem("mx_is_url")),_.a.dispatch({action:"id_server_changed"})}break;case"logout":Oe.b.instance.hangupAllCalls(),Promise.all([...[...Ie.a.instance.activeCalls].map((e=>e.disconnect())),Object(Ue.D)(this.stores)]).finally((()=>x.i()));break;case"require_registration":Object(N.b)(e);break;case"start_registration":if(x.g()){this.onSoftLogout();break}e.screenAfterLogin&&(this.screenAfterLogin=e.screenAfterLogin),this.startRegistration(e.params||{});break;case"start_login":if(x.g()){this.onSoftLogout();break}e.screenAfterLogin&&(this.screenAfterLogin=e.screenAfterLogin),this.viewLogin();break;case"start_password_recovery":this.setStateForNewView({view:je.a.FORGOT_PASSWORD}),this.notifyNewScreen("forgot_password");break;case"start_chat":Object(k.b)({dmUserId:e.user_id});break;case"leave_room":this.leaveRoom(e.room_id);break;case"forget_room":this.forgetRoom(e.room_id);break;case"copy_room":this.copyRoom(e.room_id);break;case"reject_invite":S.b.createDialog(ie.a,{title:Object(R.a)("Reject invitation"),description:Object(R.a)("Are you sure you want to reject the invitation?"),onFinished:t=>{if(t){const t=S.b.createDialog(ne.a,void 0,"mx_Dialog_spinner");f.a.get().leave(e.room_id).then((()=>{t.close(),this.state.currentRoomId===e.room_id&&_.a.dispatch({action:H.a.ViewHomePage})}),(e=>{t.close(),S.b.createDialog(K.a,{title:Object(R.a)("Failed to reject invitation"),description:e.toString()})}))}}});break;case"view_user_info":this.viewUser(e.userId,e.subAction);break;case"MatrixActions.RoomState.events":{const t=e.event;t.getType()===c.EventType.RoomCanonicalAlias&&t.getRoomId()===this.state.currentRoomId&&this.viewRoom({action:H.a.ViewRoom,room_id:this.state.currentRoomId,metricsTrigger:void 0});break}case H.a.ViewRoom:{const t=this.viewRoom(e);e.deferred_action&&t.then((()=>{_.a.dispatch(e.deferred_action)}));break}case H.a.ViewUserDeviceSettings:Object(Le.a)(I.b.getValue("feature_new_device_manager"));break;case H.a.ViewUserSettings:{const t=e;S.b.createDialog(se.a,{initialTabId:t.initialTabId},null,!1,!0),this.viewSomethingBehindModal();break}case"view_create_room":this.createRoom(e.public,e.defaultName,e.type),this.viewSomethingBehindModal();break;case H.a.ViewRoomDirectory:S.b.createDialog(Be.b,{initialText:e.initialText,initialFilter:Be.a.PublicRooms},"mx_SpotlightDialog_wrapper",!1,!0),this.viewSomethingBehindModal();break;case"view_welcome_page":this.viewWelcome();break;case H.a.ViewHomePage:this.viewHome(e.justRegistered);break;case H.a.ViewStartChatOrReuse:this.chatCreateOrReuse(e.user_id);break;case"view_create_chat":Object(O.f)(e.initialText||""),this.viewSomethingBehindModal();break;case"view_invite":{const t=f.a.get().getRoom(e.roomId);null!=t&&t.isSpaceRoom()?Object(Ce.i)(t):Object(O.e)(e.roomId);break}case"view_last_screen":this.showScreenAfterLogin();break;case"hide_left_panel":this.setState({collapseLhs:!0},(()=>{this.state.resizeNotifier.notifyLeftHandleResized()}));break;case"show_left_panel":this.setState({collapseLhs:!1},(()=>{this.state.resizeNotifier.notifyLeftHandleResized()}));break;case H.a.OpenDialPad:S.b.createDialog(Q.a,{},"mx_Dialog_dialPadWrapper");break;case H.a.OnLoggedIn:this.stores.client=f.a.get(),this.tokenLogin||x.g()||this.state.view===je.a.LOGIN||this.state.view===je.a.REGISTER||this.state.view===je.a.COMPLETE_SECURITY||this.state.view===je.a.E2E_SETUP||this.state.view===je.a.USE_CASE_SELECTION||this.onLoggedIn();break;case"on_client_not_viable":this.onSoftLogout();break;case H.a.OnLoggedOut:this.onLoggedOut();break;case"will_start_client":this.setState({ready:!1},(()=>{this.onWillStartClient()}));break;case"client_started":this.onClientStarted();break;case"send_event":this.onSendEvent(e.room_id,e.event);break;case"aria_hide_main_app":this.setState({hideToSRUsers:!0});break;case"aria_unhide_main_app":this.setState({hideToSRUsers:!1});break;case H.a.PseudonymousAnalyticsAccept:Object(z.b)(),I.b.setValue("pseudonymousAnalyticsOptIn",null,$.a.ACCOUNT,!0);break;case H.a.PseudonymousAnalyticsReject:Object(z.b)(),I.b.setValue("pseudonymousAnalyticsOptIn",null,$.a.ACCOUNT,!1);break;case H.a.ShowThread:{const{rootEvent:t,initialEvent:a,highlighted:n,scrollIntoView:i,push:s}=e,r={phase:Te.a.ThreadView,state:{threadHeadEvent:t,initialEvent:a,isInitialEventHighlighted:n,initialEventScrollIntoView:i}};null!=s&&s?Ne.a.instance.pushCard(r):Ne.a.instance.setCards([{phase:Te.a.ThreadPanel},r]),_.a.dispatch({action:H.a.FocusSendMessageComposer,context:Pe.a.Thread});break}}})),r()(this,"handleResize",(()=>{const e=1e3,t=fe.b.instance.windowWidth;this.prevWindowWidth<e&&t>=e&&_.a.dispatch({action:"show_left_panel"}),this.prevWindowWidth>=e&&t<e&&_.a.dispatch({action:"hide_left_panel"}),this.prevWindowWidth=t,this.state.resizeNotifier.notifyWindowResized()})),r()(this,"onRegisterClick",(()=>{this.showScreen("register")})),r()(this,"onLoginClick",(()=>{this.showScreen("login")})),r()(this,"onForgotPasswordClick",(()=>{this.showScreen("forgot_password")})),r()(this,"onRegisterFlowComplete",((e,t)=>this.onUserCompletedLoginFlow(e,t))),r()(this,"onUpdateStatusIndicator",((e,t)=>{const a=e.numUnreadStates;y.a.get()&&(y.a.get().setErrorStatus(t===d.b.Error),y.a.get().setNotificationCount(a)),this.subTitleStatus="",t===d.b.Error&&(this.subTitleStatus+=`[${Object(R.a)("Offline")}] `),a>0?this.subTitleStatus+=`[${a}]`:e.color>=He.a.Bold&&(this.subTitleStatus+="*"),this.setPageSubtitle()})),r()(this,"onServerConfigChange",(e=>{this.setState({serverConfig:e})})),r()(this,"makeRegistrationUrl",(e=>(this.props.startingFragmentQueryParams.referrer&&(e.referrer=this.props.startingFragmentQueryParams.referrer),this.props.makeRegistrationUrl(e)))),r()(this,"onUserCompletedLoginFlow",(async(e,t)=>{this.stores.accountPasswordStore.setPassword(t),await x.k(e),await this.postLoginSetup(),be.b.instance.stop(be.a.LOGIN),be.b.instance.stop(be.a.REGISTER)})),r()(this,"onCompleteSecurityE2eSetupFinished",(()=>{this.onLoggedIn()})),this.stores=Ae.b.instance,this.stores.constructEagerStores(),this.state={view:je.a.LOADING,collapseLhs:!1,hideToSRUsers:!1,syncError:null,resizeNotifier:new D.a,ready:!1},this.loggedInView=Object(o.createRef)(),E.b.put(this.props.config),this.firstSyncComplete=!1,this.firstSyncPromise=Object(u.m)(),this.props.config.sync_timeline_limit&&(f.a.opts.initialSyncLimit=this.props.config.sync_timeline_limit),this.screenAfterLogin=this.props.initialScreenAfterLogin,this.screenAfterLogin){const e=this.screenAfterLogin.params||{};if(this.screenAfterLogin.screen.startsWith("room/")&&e.signurl&&e.email){const t=this.screenAfterLogin.screen.substring("room/".length);Y.a.instance.storeInvite(t,e)}}this.prevWindowWidth=fe.b.instance.windowWidth||1e3,fe.b.instance.on(fe.a.Resize,this.handleResize),this.state.resizeNotifier.on("middlePanelResized",this.dispatchTimelineResize),q.a.instance.on(q.b,this.onUpdateStatusIndicator),x.g()&&x.h(),this.dispatcherRef=_.a.register(this.onAction),this.themeWatcher=new L.a,this.fontWatcher=new U.a,this.themeWatcher.start(),this.fontWatcher.start(),this.focusComposer=!1,this.subTitleStatus="",x.g()||x.a(this.props.realQueryParams,this.props.defaultDeviceDisplayName,this.getFragmentAfterLogin()).then((async e=>{var t;if(null!==(t=this.props.realQueryParams)&&void 0!==t&&t.loginToken&&this.props.onTokenLoginCompleted(),e)return this.tokenLogin=!0,await x.j({ignoreGuest:!0}),this.postLoginSetup();const a=this.screenAfterLogin?this.screenAfterLogin.screen:null;return!!await this.loadSession()||("login"!==a&&"register"!==a&&"forgot_password"!==a||this.showScreenAfterLogin(),!1)})),Object(Se.a)(E.b.get("sentry"))}async postLoginSetup(){const e=f.a.get(),t=e.isCryptoEnabled();t||this.onLoggedIn();const a=[this.firstSyncPromise.promise];let n=!1;t&&a.push((async()=>{n=await e.userHasCrossSigningKeys()})()),this.setState({pendingInitialSync:!0}),await Promise.all(a),t?(n?!1===ae.a.SHOW_ENCRYPTION_SETUP_UI?this.onLoggedIn():this.setStateForNewView({view:je.a.COMPLETE_SECURITY}):await e.doesServerSupportUnstableFeature("org.matrix.e2e_cross_signing")?this.setStateForNewView({view:je.a.E2E_SETUP}):this.onLoggedIn(),this.setState({pendingInitialSync:!1})):this.setState({pendingInitialSync:!1})}setState(e,t){this.shouldTrackPageChange(this.state,Ge(Ge({},this.state),e))&&this.startPageChangeTimer(),super.setState(e,t)}componentDidMount(){window.addEventListener("resize",this.onWindowResized)}componentDidUpdate(e,t){if(this.shouldTrackPageChange(t,this.state)){const e=this.stopPageChangeTimer();v.b.instance.trackPageChange(this.state.view,this.state.page_type,e)}this.focusComposer&&(_.a.fire(H.a.FocusSendMessageComposer),this.focusComposer=!1)}componentWillUnmount(){x.m(),_.a.unregister(this.dispatcherRef),this.themeWatcher.stop(),this.fontWatcher.stop(),fe.b.destroy(),this.state.resizeNotifier.removeListener("middlePanelResized",this.dispatchTimelineResize),window.removeEventListener("resize",this.onWindowResized),this.stores.accountPasswordStore.clearPassword(),this.voiceBroadcastResumer&&this.voiceBroadcastResumer.destroy()}getFallbackHsUrl(){var e;return null!==(e=this.props.serverConfig)&&void 0!==e&&e.isDefault?this.props.config.fallback_hs_url:null}getServerProperties(){let e=this.state.serverConfig;return e||(e=this.props.serverConfig),e||(e=E.b.get("validated_server_config")),{serverConfig:e}}loadSession(){return Promise.resolve().then((()=>x.h({fragmentQueryParams:this.props.startingFragmentQueryParams,enableGuest:this.props.enableGuest,guestHsUrl:this.getServerProperties().serverConfig.hsUrl,guestIsUrl:this.getServerProperties().serverConfig.isUrl,defaultDeviceDisplayName:this.props.defaultDeviceDisplayName}))).then((e=>(e||(Y.a.instance.pickBestInvite()?_.a.dispatch({action:"start_registration"}):_.a.dispatch({action:"view_welcome_page"})),e)))}startPageChangeTimer(){be.b.instance.start(be.a.PAGE_CHANGE)}stopPageChangeTimer(){const e=be.b.instance;e.stop(be.a.PAGE_CHANGE);const t=e.getEntries({name:be.a.PAGE_CHANGE}).pop();return t?t.duration:null}shouldTrackPageChange(e,t){return e.currentRoomId!==t.currentRoomId||e.view!==t.view||e.page_type!==t.page_type}setStateForNewView(e){if(void 0===e.view)throw new Error("setStateForNewView with no view!");this.setState(Ge({currentUserId:void 0,justRegistered:!1},e))}setPage(e){this.setState({page_type:e})}async startRegistration(e){const t={view:je.a.REGISTER};if(e.client_secret&&e.session_id&&e.hs_url&&e.is_url&&e.sid){t.serverConfig=await M.a.validateServerConfigWithStaticUrls(e.hs_url,e.is_url);const a=E.b.get("validated_server_config");a&&a.hsUrl===t.serverConfig.hsUrl&&(t.serverConfig.hsName=a.hsName,t.serverConfig.hsNameIsDifferent=a.hsNameIsDifferent,t.serverConfig.isDefault=a.isDefault,t.serverConfig.isNameResolvable=a.isNameResolvable),t.register_client_secret=e.client_secret,t.register_session_id=e.session_id,t.register_id_sid=e.sid}this.setStateForNewView(t),T.a.isLogin=!0,this.themeWatcher.recheck(),this.notifyNewScreen("register")}async viewRoom(e){if(this.focusComposer=!0,e.room_alias?h.a.log(`Switching to room alias ${e.room_alias} at event ${e.event_id}`):h.a.log(`Switching to room id ${e.room_id} at event ${e.event_id}`),!this.firstSyncComplete){if(!this.firstSyncPromise)return void h.a.warn("Cannot view a room before first sync. room_id:",e.room_id);await this.firstSyncPromise.promise}let t=e.room_alias||e.room_id;const a=f.a.get().getRoom(e.room_id);if(a){var n;a.decryptAllEvents();const e=C.b(a);e&&(t=e,Object(F.b)(e,a.roomId)),null===(n=localStorage)||void 0===n||n.setItem("mx_last_room_id",a.roomId)}let i="#"===t[0]&&e.room_id===this.state.currentRoomId;var s,r,o,l;(Object(Me.a)(this.state.currentRoomId)&&(i=!0),e.room_id===this.state.currentRoomId)&&(e.threepid_invite=null!==(s=e.threepid_invite)&&void 0!==s?s:this.state.threepidInvite,e.oob_data=null!==(r=e.oob_data)&&void 0!==r?r:this.state.roomOobData,e.forceTimeline=null!==(o=e.forceTimeline)&&void 0!==o?o:this.state.forceTimeline,e.justCreatedOpts=null!==(l=e.justCreatedOpts)&&void 0!==l?l:this.state.roomJustCreatedOpts);e.event_id&&e.highlighted&&(t+="/"+e.event_id),this.setState({view:je.a.LOGGED_IN,currentRoomId:e.room_id||null,page_type:j.a.RoomView,threepidInvite:e.threepid_invite,roomOobData:e.oob_data,forceTimeline:e.forceTimeline,ready:!0,roomJustCreatedOpts:e.justCreatedOpts},(()=>{T.a.isLogin=!1,this.themeWatcher.recheck(),this.notifyNewScreen("room/"+t,i)}))}viewSomethingBehindModal(){this.state.view===je.a.LOGGED_IN?this.state.currentRoomId||this.state.currentUserId||this.viewHome():this.viewWelcome()}viewWelcome(){if(Object(Z.b)(E.b.get()))return this.viewLogin();this.setStateForNewView({view:je.a.WELCOME}),this.notifyNewScreen("welcome"),T.a.isLogin=!0,this.themeWatcher.recheck()}viewLogin(e){this.setStateForNewView(Ge({view:je.a.LOGIN},e)),this.notifyNewScreen("login"),T.a.isLogin=!0,this.themeWatcher.recheck()}viewHome(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.setStateForNewView({view:je.a.LOGGED_IN,justRegistered:e,currentRoomId:null}),this.setPage(j.a.HomePage),this.notifyNewScreen("home"),T.a.isLogin=!1,this.themeWatcher.recheck()}viewUser(e,t){(this.firstSyncPromise?this.firstSyncPromise.promise:Promise.resolve()).then((()=>{"chat"!==t?(this.notifyNewScreen("user/"+e),this.setState({currentUserId:e}),this.setPage(j.a.UserView)):this.chatCreateOrReuse(e)}))}async createRoom(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0,a=arguments.length>2?arguments[2]:void 0;const n=S.b.createDialog(re.a,{type:a,defaultPublic:e,defaultName:t}),[i,s]=await n.finished;i&&Object(k.b)(s)}chatCreateOrReuse(e){const t=new ke.a(this.props.config);if(f.a.get().isGuest())return e!==t.get("welcome_user_id")&&_.a.dispatch({action:H.a.DoAfterSyncPrepared,deferred_action:{action:H.a.ViewStartChatOrReuse,user_id:e}}),void _.a.dispatch({action:"require_registration",go_welcome_on_cancel:!0,screen_after:{screen:`user/${t.get("welcome_user_id")}`,params:{action:"chat"}}});const a=f.a.get(),n=Object(Ve.a)(a,e);n?_.a.dispatch({action:H.a.ViewRoom,room_id:n.roomId,metricsTrigger:"MessageUser"}):_.a.dispatch({action:"start_chat",user_id:e})}leaveRoomWarnings(e){const t=f.a.get().getRoom(e),a=null==t?void 0:t.isSpaceRoom(),n=[];if(1===t.currentState.getJoinedMemberCount())return n.push(l.a.createElement("span",{className:"warning",key:"only_member_warning"}," ",Object(R.a)("You are the only person here. If you leave, no one will be able to join in the future, including you."))),n;const i=t.currentState.getStateEvents("m.room.join_rules","");if(i){"public"!==i.getContent().join_rule&&n.push(l.a.createElement("span",{className:"warning",key:"non_public_warning"}," ",a?Object(R.a)("This space is not public. You will not be able to rejoin without an invite."):Object(R.a)("This room is not public. You will not be able to rejoin without an invite.")))}return n}leaveRoom(e){const t=f.a.get().getRoom(e),a=this.leaveRoomWarnings(e),n=null==t?void 0:t.isSpaceRoom();S.b.createDialog(ie.a,{title:n?Object(R.a)("Leave space"):Object(R.a)("Leave room"),description:l.a.createElement("span",null,n?Object(R.a)("Are you sure you want to leave the space '%(spaceName)s'?",{spaceName:t.name}):Object(R.a)("Are you sure you want to leave the room '%(roomName)s'?",{roomName:t.name}),a),button:Object(R.a)("Leave"),onFinished:t=>{t&&(Object(Re.a)(e),_.a.dispatch({action:H.a.AfterLeaveRoom,room_id:e}))}})}forgetRoom(e){const t=f.a.get().getRoom(e);f.a.get().forget(e).then((()=>{this.state.currentRoomId===e&&_.a.dispatch({action:H.a.ViewHomePage}),ee.c.instance.manualRoomUpdate(t,te.c.RoomRemoved)})).catch((e=>{const t=e.errcode||Object(R.c)("unknown error code");S.b.createDialog(K.a,{title:Object(R.a)("Failed to forget room %(errCode)s",{errCode:t}),description:e&&e.message?e.message:Object(R.a)("Operation failed")})}))}async copyRoom(e){const t=Object(Ee.h)(e);await Object(_e.b)(t)||S.b.createDialog(K.a,{title:Object(R.a)("Unable to copy room link"),description:Object(R.a)("Unable to copy a link to the room to the clipboard.")})}async startWelcomeUserChat(){let e;e=this.firstSyncComplete?Promise.resolve():this.firstSyncPromise.promise,await e;const t=new ke.a(this.props.config);if(0===A.a.shared().getDMRoomsForUserId(t.get("welcome_user_id")).length){const e=await Object(k.b)({dmUserId:t.get("welcome_user_id"),andView:!this.state.currentRoomId,spinner:!1}),a=e=>{e.getType()===c.EventType.Direct&&e.getContent()[t.get("welcome_user_id")]&&(f.a.get().store.save(!0),f.a.get().removeListener(c.ClientEvent.AccountData,a))};return f.a.get().on(c.ClientEvent.AccountData,a),e}return null}async onLoggedIn(){if(T.a.isLogin=!1,this.themeWatcher.recheck(),V.f(),!f.a.currentUserIsJustRegistered()||null!==I.b.getValue("FTUE.useCaseSelection"))return this.onShowPostLoginScreen();this.setStateForNewView({view:je.a.USE_CASE_SELECTION}),I.b.watchSetting("FTUE.useCaseSelection",null,((e,t,a,n,i)=>{null!==i&&this.state.view===je.a.USE_CASE_SELECTION&&this.onShowPostLoginScreen()}))}async onShowPostLoginScreen(e){if(e&&(we.a.instance.setProperty("ftueUseCaseSelection",e),I.b.setValue("FTUE.useCaseSelection",null,$.a.ACCOUNT,e)),this.setStateForNewView({view:je.a.LOGGED_IN}),this.screenAfterLogin&&this.screenAfterLogin.screen)this.showScreen(this.screenAfterLogin.screen,this.screenAfterLogin.params),this.screenAfterLogin=null;else if(f.a.currentUserIsJustRegistered()){f.a.setJustRegisteredUserId(null);if(new ke.a(this.props.config).get("welcome_user_id")&&Object(R.e)().startsWith("en")){null===await this.startWelcomeUserChat()&&_.a.dispatch({action:H.a.ViewHomePage,justRegistered:!0})}else if(Y.a.instance.pickBestInvite()){const e=Y.a.instance.pickBestInvite(),t=Y.a.instance.translateToWireFormat(e);this.showScreen(`room/${e.roomId}`,t)}else _.a.dispatch({action:H.a.ViewHomePage,justRegistered:!0})}else this.showScreenAfterLogin();E.b.get("mobile_guide_toast")&&Object(X.a)();const t=E.b.get("user_notice");if(t){const e="user_notice_"+t.title;t.show_once&&localStorage.getItem(e)||B.a.sharedInstance().addOrReplaceToast({key:e,title:t.title,props:{description:l.a.createElement(We.a,null,t.description),acceptLabel:Object(R.a)("OK"),onAccept:()=>{B.a.sharedInstance().dismissToast(e),localStorage.setItem(e,"1")}},component:Fe.a,className:"mx_AnalyticsToast",priority:100})}}initPosthogAnalyticsToast(){null===I.b.getValue("pseudonymousAnalyticsOptIn")&&Object(z.c)(),I.b.watchSetting("pseudonymousAnalyticsOptIn",null,((e,t,a,n,i)=>{null===i?Object(z.c)():Object(z.b)()}))}showScreenAfterLogin(){this.screenAfterLogin&&this.screenAfterLogin.screen?(this.showScreen(this.screenAfterLogin.screen,this.screenAfterLogin.params),this.screenAfterLogin=null):localStorage&&localStorage.getItem("mx_last_room_id")?this.viewLastRoom():f.a.get().isGuest()?_.a.dispatch({action:"view_welcome_page"}):_.a.dispatch({action:H.a.ViewHomePage})}viewLastRoom(){_.a.dispatch({action:H.a.ViewRoom,room_id:localStorage.getItem("mx_last_room_id"),metricsTrigger:void 0})}onLoggedOut(){this.viewLogin({ready:!1,collapseLhs:!1,currentRoomId:null}),this.subTitleStatus="",this.setPageSubtitle()}onSoftLogout(){this.notifyNewScreen("soft_logout"),this.setStateForNewView({view:je.a.SOFT_LOGOUT,ready:!1,collapseLhs:!1,currentRoomId:null}),this.subTitleStatus="",this.setPageSubtitle()}onWillStartClient(){this.firstSyncComplete=!1,this.firstSyncPromise=Object(u.m)();const e=f.a.get();e.setCanResetTimelineCallback((e=>(h.a.log("Request to reset timeline in room ",e," viewing:",this.state.currentRoomId),e!==this.state.currentRoomId||(!this.loggedInView.current||this.loggedInView.current.canResetTimelineInRoom(e))))),e.on(c.ClientEvent.Sync,((e,t,a)=>{e===d.b.Error||e===d.b.Reconnecting?(a.error instanceof m.c&&x.d(a.error),this.setState({syncError:a.error})):this.state.syncError&&this.setState({syncError:null}),e===d.b.Syncing&&t===d.b.Syncing||(h.a.info("MatrixClient sync state => %s",e),e===d.b.Prepared&&(this.firstSyncComplete=!0,this.firstSyncPromise.resolve(),w.default.shouldShowPrompt()&&!f.a.userRegisteredWithinLastHours(24)&&Object(G.b)(!1),_.a.fire(H.a.FocusSendMessageComposer),this.setState({ready:!0})))})),e.on(c.HttpApiEvent.SessionLoggedOut,(function(e){if(!x.f()){if(S.b.closeCurrentModal("Session.logged_out"),401===e.httpStatus&&e.data&&e.data.soft_logout)return h.a.warn("Soft logout issued by server - avoiding data deletion"),void x.l();S.b.createDialog(K.a,{title:Object(R.a)("Signed Out"),description:Object(R.a)("For security, this session has been signed out. Please sign in again.")}),_.a.dispatch({action:"logout"})}})),e.on(c.HttpApiEvent.NoConsent,(function(t,a){S.b.createDialog(ie.a,{title:Object(R.a)("Terms and Conditions"),description:l.a.createElement("div",null,l.a.createElement("p",null," ",Object(R.a)("To continue using the %(homeserverDomain)s homeserver you must review and agree to our terms and conditions.",{homeserverDomain:e.getDomain()}))),button:Object(R.a)("Review terms and conditions"),cancelButton:Object(R.a)("Dismiss"),onFinished:e=>{if(e){window.open(a,"_blank").opener=null}}},null,!0)}));const t=b.a.instance;t.start(),e.on(c.HttpApiEvent.SessionLoggedOut,(()=>t.stop())),e.on(c.MatrixEventEvent.Decrypted,((e,a)=>t.eventDecrypted(e,a))),e.on(c.ClientEvent.Room,(e=>{if(f.a.get().isCryptoEnabled()){const t=I.b.getValueAt($.a.ROOM_DEVICE,"blacklistUnverifiedDevices",e.roomId,!0);e.setBlacklistUnverifiedDevices(t)}})),e.on(g.b.Warning,(e=>{if("CRYPTO_WARNING_OLD_VERSION_DETECTED"===e)S.b.createDialog(K.a,{title:Object(R.a)("Old cryptography data detected"),description:Object(R.a)("Data from an older version of %(brand)s has been detected. This will have caused end-to-end cryptography to malfunction in the older version. End-to-end encrypted messages exchanged recently whilst using the older version may not be decryptable in this version. This may also cause messages exchanged with this version to fail. If you experience problems, log out and back in again. To retain message history, export and re-import your keys.",{brand:E.b.get().brand})})})),e.on(g.b.KeyBackupFailed,(async e=>{let t,n;if(f.a.get().getKeyBackupEnabled())t=!0;else try{n=await f.a.get().getKeyBackupVersion(),null!==n&&(t=!0)}catch(e){return void h.a.error("Saw key backup error but failed to check backup version!",e)}t?S.b.createDialogAsync(a.e(39).then(a.bind(null,1534)),{newVersionInfo:n}):S.b.createDialogAsync(a.e(40).then(a.bind(null,1535)))})),e.on(g.b.KeySignatureUploadFailure,((e,t,a)=>{S.b.createDialog(oe.a,{failures:e,source:t,continuation:a})})),e.on(g.b.VerificationRequest,(e=>{e.verifier?S.b.createDialog(le.a,{verifier:e.verifier},null,!1,!0):e.pending&&B.a.sharedInstance().addOrReplaceToast({key:"verifreq_"+e.channel.transactionId,title:Object(R.a)("Verification requested"),icon:"verification",props:{request:e},component:ve.a,priority:90})})),this.voiceBroadcastResumer=new Ue.z(e)}onClientStarted(){const e=f.a.get();if(e.isCryptoEnabled()){const t=I.b.getValueAt($.a.DEVICE,"blacklistUnverifiedDevices");e.setGlobalBlacklistUnverifiedDevices(t),e.setGlobalErrorOnUnknownDevices(!1)}we.a.instance.isEnabled()&&I.b.isLevelSupported($.a.ACCOUNT)&&this.initPosthogAnalyticsToast()}showScreen(e,t){const a=f.a.get();if(!a||a.isGuest()||!Ke.includes(e))if("register"===e)_.a.dispatch({action:"start_registration",params:t}),be.b.instance.start(be.a.REGISTER);else if("login"===e)_.a.dispatch({action:"start_login",params:t}),be.b.instance.start(be.a.LOGIN);else if("forgot_password"===e)_.a.dispatch({action:"start_password_recovery",params:t});else if("soft_logout"===e)a.getUserId()&&!x.g()?this.viewLastRoom():_.a.dispatch({action:"start_login",params:t});else if("new"===e)_.a.dispatch({action:"view_create_room"});else if("dm"===e)_.a.dispatch({action:"view_create_chat"});else if("settings"===e)_.a.fire(H.a.ViewUserSettings);else if("welcome"===e)_.a.dispatch({action:"view_welcome_page"});else if("home"===e)_.a.dispatch({action:H.a.ViewHomePage});else if("start"===e)this.showScreen("home"),_.a.dispatch({action:"require_registration"});else if("directory"===e)_.a.fire(H.a.ViewRoomDirectory);else if("start_sso"===e||"start_cas"===e){let t=f.a.get();if(!t){const{hsUrl:e,isUrl:a}=this.props.serverConfig;t=Object(c.createClient)({baseUrl:e,idBaseUrl:a})}const a="start_sso"===e?"sso":"cas";y.a.get().startSingleSignOn(t,a,this.getFragmentAfterLogin())}else if(0===e.indexOf("room/")){var n,i,s;const a=e.substring(5),r=a.indexOf(":")+1;let o=a.length;a.substring(r).indexOf("/")>-1&&(o=r+a.substring(r).indexOf("/"));const l=a.substring(0,o);let c,d=a.substring(o+1);if(d||(d=void 0),t.signurl&&t.email&&(c=Y.a.instance.storeInvite(l,t)),!c){c=Y.a.instance.getInvites().find((e=>e.roomId===l))}let m=[];t.via&&(m="string"==typeof t.via?[t.via]:t.via);const u={action:H.a.ViewRoom,event_id:d,via_servers:m,highlighted:Boolean(d),threepid_invite:c,oob_data:{name:null===(n=c)||void 0===n?void 0:n.roomName,avatarUrl:null===(i=c)||void 0===i?void 0:i.roomAvatarUrl,inviterName:null===(s=c)||void 0===s?void 0:s.inviterName},room_alias:void 0,room_id:void 0,metricsTrigger:void 0};"#"===l[0]?u.room_alias=l:u.room_id=l,_.a.dispatch(u)}else if(0===e.indexOf("user/")){const a=e.substring(5);_.a.dispatch({action:"view_user_info",userId:a,subAction:t.action})}else h.a.info("Ignoring showScreen for '%s'",e);else _.a.dispatch({action:H.a.ViewHomePage})}notifyNewScreen(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.props.onNewScreen&&this.props.onNewScreen(e,t),this.setPageSubtitle()}onLogoutClick(e){_.a.dispatch({action:"logout"}),e.stopPropagation(),e.preventDefault()}dispatchTimelineResize(){_.a.dispatch({action:"timeline_resize"})}onRegistered(e){return x.k(e)}onSendEvent(e,t){const a=f.a.get();a&&a.sendEvent(e,t.getType(),t.getContent()).then((()=>{_.a.dispatch({action:"message_sent"})}))}setPageSubtitle(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";if(this.state.currentRoomId){const t=f.a.get(),a=t&&t.getRoom(this.state.currentRoomId);a&&(e=`${this.subTitleStatus} | ${a.name} ${e}`)}else e=`${this.subTitleStatus} ${e}`;const t=`${E.b.get().brand} ${e}`;document.title!==t&&(document.title=t)}getFragmentAfterLogin(){let e="";const t=this.props.initialScreenAfterLogin;return t&&!["welcome","login","register","start_sso","start_cas"].includes(t.screen)&&(e=`/${t.screen}`),e}render(){const e=this.getFragmentAfterLogin();let t;if(this.state.view===je.a.LOADING)t=l.a.createElement("div",{className:"mx_MatrixChat_splash"},l.a.createElement(ne.a,null));else if(this.state.view===je.a.COMPLETE_SECURITY)t=l.a.createElement(ce.a,{onFinished:this.onCompleteSecurityE2eSetupFinished});else if(this.state.view===je.a.E2E_SETUP)t=l.a.createElement(ue.a,{onFinished:this.onCompleteSecurityE2eSetupFinished,accountPassword:this.stores.accountPasswordStore.getPassword(),tokenLogin:!!this.tokenLogin});else if(this.state.view===je.a.LOGGED_IN){const e=this.state.syncError&&this.state.syncError instanceof m.c;if(this.state.ready&&this.state.page_type&&!e)t=l.a.createElement(W.a,i()({},this.props,this.state,{ref:this.loggedInView,matrixClient:f.a.get(),onRegistered:this.onRegistered,currentRoomId:this.state.currentRoomId}));else{let a;this.state.syncError&&!e&&(a=l.a.createElement("div",{className:"mx_MatrixChat_syncError"},Object(P.b)(this.state.syncError))),t=l.a.createElement("div",{className:"mx_MatrixChat_splash"},a,l.a.createElement(ne.a,null),l.a.createElement("div",{className:"mx_MatrixChat_splashButtons"},l.a.createElement(xe.a,{kind:"link_inline",onClick:this.onLogoutClick},Object(R.a)("Logout"))))}}else if(this.state.view===je.a.WELCOME)t=l.a.createElement(de.a,null);else if(this.state.view===je.a.REGISTER&&I.b.getValue(J.b.Registration)){var a;const n=null===(a=Y.a.instance.pickBestInvite())||void 0===a?void 0:a.toEmail;t=l.a.createElement(he.a,i()({clientSecret:this.state.register_client_secret,sessionId:this.state.register_session_id,idSid:this.state.register_id_sid,email:n,brand:this.props.config.brand,makeRegistrationUrl:this.makeRegistrationUrl,onLoggedIn:this.onRegisterFlowComplete,onLoginClick:this.onLoginClick,onServerConfigChange:this.onServerConfigChange,defaultDeviceDisplayName:this.props.defaultDeviceDisplayName,fragmentAfterLogin:e},this.getServerProperties()))}else if(this.state.view===je.a.FORGOT_PASSWORD&&I.b.getValue(J.b.PasswordReset))t=l.a.createElement(me.a,i()({onComplete:this.onLoginClick,onLoginClick:this.onLoginClick},this.getServerProperties()));else if(this.state.view===je.a.LOGIN){const a=I.b.getValue(J.b.PasswordReset);t=l.a.createElement(pe.a,i()({isSyncing:this.state.pendingInitialSync,onLoggedIn:this.onUserCompletedLoginFlow,onRegisterClick:this.onRegisterClick,fallbackHsUrl:this.getFallbackHsUrl(),defaultDeviceDisplayName:this.props.defaultDeviceDisplayName,onForgotPasswordClick:a?this.onForgotPasswordClick:void 0,onServerConfigChange:this.onServerConfigChange,fragmentAfterLogin:e,defaultUsername:this.props.startingFragmentQueryParams.defaultUsername},this.getServerProperties()))}else if(this.state.view===je.a.SOFT_LOGOUT)t=l.a.createElement(ye.a,{realQueryParams:this.props.realQueryParams,onTokenLoginCompleted:this.props.onTokenLoginCompleted,fragmentAfterLogin:e});else{if(this.state.view!==je.a.USE_CASE_SELECTION)return h.a.error(`Unknown view ${this.state.view}`),null;t=l.a.createElement(De.a,{onFinished:e=>this.onShowPostLoginScreen(e)})}return l.a.createElement(ge.a,null,l.a.createElement(Ae.a.Provider,{value:this.stores},t))}}r()($e,"displayName","MatrixChat"),r()($e,"defaultProps",{realQueryParams:{},startingFragmentQueryParams:{},config:{},onTokenLoginCompleted:()=>{}})}).call(this,a(14))},1437:function(e,t,a){!function(){"use strict";function e(e){var t=!0,a=!1,n=null,i={text:!0,search:!0,url:!0,tel:!0,email:!0,password:!0,number:!0,date:!0,month:!0,week:!0,time:!0,datetime:!0,"datetime-local":!0};function s(e){return!!(e&&e!==document&&"HTML"!==e.nodeName&&"BODY"!==e.nodeName&&"classList"in e&&"contains"in e.classList)}function r(e){var t=e.type,a=e.tagName;return!("INPUT"!==a||!i[t]||e.readOnly)||"TEXTAREA"===a&&!e.readOnly||!!e.isContentEditable}function o(e){e.classList.contains("focus-visible")||(e.classList.add("focus-visible"),e.setAttribute("data-focus-visible-added",""))}function l(e){e.hasAttribute("data-focus-visible-added")&&(e.classList.remove("focus-visible"),e.removeAttribute("data-focus-visible-added"))}function c(a){a.metaKey||a.altKey||a.ctrlKey||(s(e.activeElement)&&o(e.activeElement),t=!0)}function d(e){t=!1}function m(e){s(e.target)&&(t||r(e.target))&&o(e.target)}function u(e){s(e.target)&&(e.target.classList.contains("focus-visible")||e.target.hasAttribute("data-focus-visible-added"))&&(a=!0,window.clearTimeout(n),n=window.setTimeout((function(){a=!1}),100),l(e.target))}function h(e){"hidden"===document.visibilityState&&(a&&(t=!0),p())}function p(){document.addEventListener("mousemove",v),document.addEventListener("mousedown",v),document.addEventListener("mouseup",v),document.addEventListener("pointermove",v),document.addEventListener("pointerdown",v),document.addEventListener("pointerup",v),document.addEventListener("touchmove",v),document.addEventListener("touchstart",v),document.addEventListener("touchend",v)}function g(){document.removeEventListener("mousemove",v),document.removeEventListener("mousedown",v),document.removeEventListener("mouseup",v),document.removeEventListener("pointermove",v),document.removeEventListener("pointerdown",v),document.removeEventListener("pointerup",v),document.removeEventListener("touchmove",v),document.removeEventListener("touchstart",v),document.removeEventListener("touchend",v)}function v(e){e.target.nodeName&&"html"===e.target.nodeName.toLowerCase()||(t=!1,g())}document.addEventListener("keydown",c,!0),document.addEventListener("mousedown",d,!0),document.addEventListener("pointerdown",d,!0),document.addEventListener("touchstart",d,!0),document.addEventListener("visibilitychange",h,!0),p(),e.addEventListener("focus",m,!0),e.addEventListener("blur",u,!0),e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&e.host?e.host.setAttribute("data-js-focus-visible",""):e.nodeType===Node.DOCUMENT_NODE&&(document.documentElement.classList.add("js-focus-visible"),document.documentElement.setAttribute("data-js-focus-visible",""))}if("undefined"!=typeof window&&"undefined"!=typeof document){var t;window.applyFocusVisiblePolyfill=e;try{t=new CustomEvent("focus-visible-polyfill-ready")}catch(e){(t=document.createEvent("CustomEvent")).initCustomEvent("focus-visible-polyfill-ready",!1,!1,{})}window.dispatchEvent(t)}"undefined"!=typeof document&&e(document)}()},1438:function(e,t,a){var n;n=function(){return function(e){var t={};function a(n){if(t[n])return t[n].exports;var i=t[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,a),i.loaded=!0,i.exports}return a.m=e,a.c=t,a.p="",a(0)}([function(e,t){"use strict";e.exports=function(){if("undefined"==typeof document||"undefined"==typeof window)return{ask:function(){return"initial"},element:function(){return null},ignoreKeys:function(){},specificKeys:function(){},registerOnChange:function(){},unRegisterOnChange:function(){}};var e=document.documentElement,t=null,a="initial",n=a,i=Date.now(),s=!1,r=["button","input","select","textarea"],o=[],l=[16,17,18,91,93],c=[],d={keydown:"keyboard",keyup:"keyboard",mousedown:"mouse",mousemove:"mouse",MSPointerDown:"pointer",MSPointerMove:"pointer",pointerdown:"pointer",pointermove:"pointer",touchstart:"touch",touchend:"touch"},m=!1,u={x:null,y:null},h={2:"touch",3:"touch",4:"mouse"},p=!1;try{var g=Object.defineProperty({},"passive",{get:function(){p=!0}});window.addEventListener("test",null,g)}catch(e){}var v=function(){var e=!p||{passive:!0,capture:!0};document.addEventListener("DOMContentLoaded",b,!0),window.PointerEvent?(window.addEventListener("pointerdown",f,!0),window.addEventListener("pointermove",E,!0)):window.MSPointerEvent?(window.addEventListener("MSPointerDown",f,!0),window.addEventListener("MSPointerMove",E,!0)):(window.addEventListener("mousedown",f,!0),window.addEventListener("mousemove",E,!0),"ontouchstart"in window&&(window.addEventListener("touchstart",f,e),window.addEventListener("touchend",f,!0))),window.addEventListener(x(),E,e),window.addEventListener("keydown",f,!0),window.addEventListener("keyup",f,!0),window.addEventListener("focusin",_,!0),window.addEventListener("focusout",w,!0)},b=function(){if(s=!("false"===e.getAttribute("data-whatpersist")||"false"===document.body.getAttribute("data-whatpersist")))try{window.sessionStorage.getItem("what-input")&&(a=window.sessionStorage.getItem("what-input")),window.sessionStorage.getItem("what-intent")&&(n=window.sessionStorage.getItem("what-intent"))}catch(e){}y("input"),y("intent")},f=function(e){var t=e.which,i=d[e.type];"pointer"===i&&(i=O(e));var s=!c.length&&-1===l.indexOf(t),o=c.length&&-1!==c.indexOf(t),m="keyboard"===i&&t&&(s||o)||"mouse"===i||"touch"===i;if(C(i)&&(m=!1),m&&a!==i&&(S("input",a=i),y("input")),m&&n!==i){var u=document.activeElement;u&&u.nodeName&&(-1===r.indexOf(u.nodeName.toLowerCase())||"button"===u.nodeName.toLowerCase()&&!R(u,"form"))&&(S("intent",n=i),y("intent"))}},y=function(t){e.setAttribute("data-what"+t,"input"===t?a:n),j(t)},E=function(e){var t=d[e.type];"pointer"===t&&(t=O(e)),k(e),(!m&&!C(t)||m&&"wheel"===e.type||"mousewheel"===e.type||"DOMMouseScroll"===e.type)&&n!==t&&(S("intent",n=t),y("intent"))},_=function(a){a.target.nodeName?(t=a.target.nodeName.toLowerCase(),e.setAttribute("data-whatelement",t),a.target.classList&&a.target.classList.length&&e.setAttribute("data-whatclasses",a.target.classList.toString().replace(" ",","))):w()},w=function(){t=null,e.removeAttribute("data-whatelement"),e.removeAttribute("data-whatclasses")},S=function(e,t){if(s)try{window.sessionStorage.setItem("what-"+e,t)}catch(e){}},O=function(e){return"number"==typeof e.pointerType?h[e.pointerType]:"pen"===e.pointerType?"touch":e.pointerType},C=function(e){var t=Date.now(),n="mouse"===e&&"touch"===a&&t-i<200;return i=t,n},x=function(){return"onwheel"in document.createElement("div")?"wheel":void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll"},j=function(e){for(var t=0,i=o.length;t<i;t++)o[t].type===e&&o[t].fn.call(void 0,"input"===e?a:n)},k=function(e){u.x!==e.screenX||u.y!==e.screenY?(m=!1,u.x=e.screenX,u.y=e.screenY):m=!0},R=function(e,t){var a=window.Element.prototype;if(a.matches||(a.matches=a.msMatchesSelector||a.webkitMatchesSelector),a.closest)return e.closest(t);do{if(e.matches(t))return e;e=e.parentElement||e.parentNode}while(null!==e&&1===e.nodeType);return null};return"addEventListener"in window&&Array.prototype.indexOf&&(d[x()]="mouse",v()),{ask:function(e){return"intent"===e?n:a},element:function(){return t},ignoreKeys:function(e){l=e},specificKeys:function(e){c=e},registerOnChange:function(e,t){o.push({fn:e,type:t||"input"})},unRegisterOnChange:function(e){var t=function(e){for(var t=0,a=o.length;t<a;t++)if(o[t].fn===e)return t}(e);(t||0===t)&&o.splice(t,1)},clearStorage:function(){window.sessionStorage.clear()}}}()}])},e.exports=n()},1439:function(e,t,a){"use strict";var n=a(13),i=a.n(n),s=a(1440),r=a(128),o=a(124);const l={deferredAction:null};class c extends s.Store{constructor(){super(o.a),i()(this,"state",l)}setState(e){this.state=Object.assign(this.state,e),this.__emitChange()}__onDispatch(e){switch(e.action){case r.a.DoAfterSyncPrepared:this.setState({deferredAction:e.deferred_action});break;case"cancel_after_sync_prepared":this.setState({deferredAction:null});break;case"MatrixActions.sync":{if("PREPARED"!==e.state)break;if(!this.state.deferredAction)break;const t=Object.assign({},this.state.deferredAction);this.setState({deferredAction:null}),o.a.dispatch(t);break}case"on_client_not_viable":case r.a.OnLoggedOut:this.reset()}}reset(){this.state=Object.assign({},l)}}let d=null;d||(d=new c)},1440:function(e,t,a){e.exports.Container=a(1441),e.exports.Mixin=a(1444),e.exports.ReduceStore=a(1445),e.exports.Store=a(878)},1441:function(e,t,a){"use strict";function n(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function i(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,s(e,t)}function s(e,t){return s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},s(e,t)}function r(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function o(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?r(Object(a),!0).forEach((function(t){l(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):r(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function l(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var c=a(1442),d=a(120),m=a(253),u=a(1443),h=d.Component,p={pure:!0,withProps:!1,withContext:!1};function g(e,t){var a;(a=e).getStores||m(!1),!a.calculateState&&m(!1);var s,r=o(o({},p),t||{}),d=function(t,a,n){var i=r.withProps?a:void 0,s=r.withContext?n:void 0;return e.calculateState(t,i,s)},h=function(t,a){var n=r.withProps?t:void 0,i=r.withContext?a:void 0;return e.getStores(n,i)},g=function(e){function t(t,a){var i;l(n(i=e.call(this,t,a)||this),"_fluxContainerSubscriptions",void 0),i._fluxContainerSubscriptions=new c,i._fluxContainerSubscriptions.setStores(h(t,a)),i._fluxContainerSubscriptions.addListener((function(){i.setState((function(e,t){return d(e,t,a)}))}));var s=d(void 0,t,a);return i.state=o(o({},i.state||{}),s),i}i(t,e);var a=t.prototype;return a.UNSAFE_componentWillReceiveProps=function(t,a){e.prototype.UNSAFE_componentWillReceiveProps&&e.prototype.UNSAFE_componentWillReceiveProps.call(this,t,a),e.prototype.componentWillReceiveProps&&e.prototype.componentWillReceiveProps.call(this,t,a),(r.withProps||r.withContext)&&(this._fluxContainerSubscriptions.setStores(h(t,a)),this.setState((function(e){return d(e,t,a)})))},a.componentWillUnmount=function(){e.prototype.componentWillUnmount&&e.prototype.componentWillUnmount.call(this),this._fluxContainerSubscriptions.reset()},t}(e),v=r.pure?(s=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.shouldComponentUpdate=function(e,t){return!u(this.props,e)||!u(this.state,t)},t}(g),s):g,b=e.displayName||e.name;return v.displayName="FluxContainer("+b+")",v}e.exports={create:g,createFunctional:function(e,t,a,s){var r=function(s){function r(){for(var e,t=arguments.length,a=new Array(t),i=0;i<t;i++)a[i]=arguments[i];return l(n(e=s.call.apply(s,[this].concat(a))||this),"state",void 0),e}return i(r,s),r.getStores=function(e,a){return t(e,a)},r.calculateState=function(e,t,n){return a(e,t,n)},r.prototype.render=function(){return e(this.state)},r}(h),o=e.displayName||e.name||"FunctionalContainer";return r.displayName=o,g(r,s)}}},1442:function(e,t,a){"use strict";function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var i=a(877);var s=function(){function e(){n(this,"_callbacks",void 0),n(this,"_storeGroup",void 0),n(this,"_stores",void 0),n(this,"_tokens",void 0),this._callbacks=[]}var t=e.prototype;return t.setStores=function(e){var t=this;if(!this._stores||!function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(var a=0;a<e.length;a++)if(e[a]!==t[a])return!1;return!0}(this._stores,e)){this._stores=e,this._resetTokens(),this._resetStoreGroup();var a=!1,n=function(){a=!0};this._tokens=e.map((function(e){return e.addListener(n)}));this._storeGroup=new i(e,(function(){a&&(t._callbacks.forEach((function(e){return e()})),a=!1)}))}},t.addListener=function(e){this._callbacks.push(e)},t.reset=function(){this._resetTokens(),this._resetStoreGroup(),this._resetCallbacks(),this._resetStores()},t._resetTokens=function(){this._tokens&&(this._tokens.forEach((function(e){return e.remove()})),this._tokens=null)},t._resetStoreGroup=function(){this._storeGroup&&(this._storeGroup.release(),this._storeGroup=null)},t._resetStores=function(){this._stores=null},t._resetCallbacks=function(){this._callbacks=[]},e}();e.exports=s},1443:function(e,t,a){"use strict";var n=Object.prototype.hasOwnProperty;function i(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}e.exports=function(e,t){if(i(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var a=Object.keys(e),s=Object.keys(t);if(a.length!==s.length)return!1;for(var r=0;r<a.length;r++)if(!n.call(t,a[r])||!i(e[a[r]],t[a[r]]))return!1;return!0}},1444:function(e,t,a){"use strict";function n(e,t){var a="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!a){if(Array.isArray(e)||(a=function(e,t){if(!e)return;if("string"==typeof e)return i(e,t);var a=Object.prototype.toString.call(e).slice(8,-1);"Object"===a&&e.constructor&&(a=e.constructor.name);if("Map"===a||"Set"===a)return Array.from(e);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return i(e,t)}(e))||t&&e&&"number"==typeof e.length){a&&(e=a);var n=0,s=function(){};return{s:s,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,o=!0,l=!1;return{s:function(){a=a.call(e)},n:function(){var e=a.next();return o=e.done,e},e:function(e){l=!0,r=e},f:function(){try{o||null==a.return||a.return()}finally{if(l)throw r}}}}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,n=new Array(t);a<t;a++)n[a]=e[a];return n}var s=a(877),r=a(253);e.exports=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{withProps:!1};return e=e.filter((function(e){return!!e})),{getInitialState:function(){return this.constructor.calculateState||r(!1),t.withProps?this.constructor.calculateState(null,this.props):this.constructor.calculateState(null,void 0)},componentWillMount:function(){var a=this,n=!1,i=function(){n=!0};this._fluxMixinSubscriptions=e.map((function(e){return e.addListener(i)}));this._fluxMixinStoreGroup=new s(e,(function(){n&&a.setState((function(e){return t.withProps?a.constructor.calculateState(e,a.props):a.constructor.calculateState(e,void 0)})),n=!1}))},componentWillUnmount:function(){this._fluxMixinStoreGroup.release();var e,t=n(this._fluxMixinSubscriptions);try{for(t.s();!(e=t.n()).done;){e.value.remove()}}catch(e){t.e(e)}finally{t.f()}this._fluxMixinSubscriptions=[]}}}},1445:function(e,t,a){"use strict";function n(e,t){return n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(e,t)}var i=a(878),s=a(1451),r=a(253),o=function(e){var t,a;function i(t){var a,n,i,s;return a=e.call(this,t)||this,n=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(a),s=void 0,(i="_state")in n?Object.defineProperty(n,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):n[i]=s,a._state=a.getInitialState(),a}a=e,(t=i).prototype=Object.create(a.prototype),t.prototype.constructor=t,n(t,a);var o=i.prototype;return o.getState=function(){return this._state},o.getInitialState=function(){return s("FluxReduceStore","getInitialState")},o.reduce=function(e,t){return s("FluxReduceStore","reduce")},o.areEqual=function(e,t){return e===t},o.__invokeOnDispatch=function(e){this.__changed=!1;var t=this._state,a=this.reduce(t,e);void 0===a&&r(!1),this.areEqual(t,a)||(this._state=a,this.__emitChange()),this.__changed&&this.__emitter.emit(this.__changeEvent)},i}(i);e.exports=o},1446:function(e,t,a){var n={EventEmitter:a(1447),EmitterSubscription:a(879)};e.exports=n},1447:function(e,t,a){"use strict";var n=a(879),i=a(1449),s=a(253),r=a(1450),o=function(){function e(){this._subscriber=new i,this._currentSubscription=null}var t=e.prototype;return t.addListener=function(e,t,a){return this._subscriber.addSubscription(e,new n(this._subscriber,t,a))},t.once=function(e,t,a){var n=this;return this.addListener(e,(function(){n.removeCurrentListener(),t.apply(a,arguments)}))},t.removeAllListeners=function(e){this._subscriber.removeAllSubscriptions(e)},t.removeCurrentListener=function(){this._currentSubscription||s(!1),this._subscriber.removeSubscription(this._currentSubscription)},t.listeners=function(e){var t=this._subscriber.getSubscriptionsForType(e);return t?t.filter(r.thatReturnsTrue).map((function(e){return e.listener})):[]},t.emit=function(e){var t=this._subscriber.getSubscriptionsForType(e);if(t){for(var a=Object.keys(t),n=0;n<a.length;n++){var i=t[a[n]];i&&(this._currentSubscription=i,this.__emitToSubscription.apply(this,[i].concat(Array.prototype.slice.call(arguments))))}this._currentSubscription=null}},t.__emitToSubscription=function(e,t){var a=Array.prototype.slice.call(arguments,2);e.listener.apply(e.context,a)},e}();e.exports=o},1448:function(e,t,a){"use strict";var n=function(){function e(e){this.subscriber=e}return e.prototype.remove=function(){this.subscriber&&(this.subscriber.removeSubscription(this),this.subscriber=null)},e}();e.exports=n},1449:function(e,t,a){"use strict";var n=a(253),i=function(){function e(){this._subscriptionsForType={},this._currentSubscription=null}var t=e.prototype;return t.addSubscription=function(e,t){t.subscriber!==this&&n(!1),this._subscriptionsForType[e]||(this._subscriptionsForType[e]=[]);var a=this._subscriptionsForType[e].length;return this._subscriptionsForType[e].push(t),t.eventType=e,t.key=a,t},t.removeAllSubscriptions=function(e){void 0===e?this._subscriptionsForType={}:delete this._subscriptionsForType[e]},t.removeSubscription=function(e){var t=e.eventType,a=e.key,n=this._subscriptionsForType[t];n&&delete n[a]},t.getSubscriptionsForType=function(e){return this._subscriptionsForType[e]},e}();e.exports=i},1450:function(e,t,a){"use strict";function n(e){return function(){return e}}var i=function(){};i.thatReturns=n,i.thatReturnsFalse=n(!1),i.thatReturnsTrue=n(!0),i.thatReturnsNull=n(null),i.thatReturnsThis=function(){return this},i.thatReturnsArgument=function(e){return e},e.exports=i},1451:function(e,t,a){"use strict";var n=a(253);e.exports=function(e,t){n(!1)}},1452:function(e,t,a){"use strict";var n=a(13),i=a.n(n),s=a(136),r=a(16),o=a(131),l=a(384),c=a(124),d=a(202),m=a(125),u=a(128);function h(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function p(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?h(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):h(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}const g="im.vector.auto_rs_request";class v extends d.a{constructor(){super(c.a,{reportedSessionIds:new Set,lastRageshakeTime:0,initialSyncCompleted:!1}),this.onDecryptionAttempt=this.onDecryptionAttempt.bind(this),this.onDeviceMessage=this.onDeviceMessage.bind(this),this.onSyncStateChange=this.onSyncStateChange.bind(this)}static get instance(){return v.internalInstance}async onAction(e){if(e.action===u.a.ReportKeyBackupNotEnabled)this.onReportKeyBackupNotEnabled()}async onReady(){m.b.getValue("automaticDecryptionErrorReporting")&&this.matrixClient&&(this.matrixClient.on(s.MatrixEventEvent.Decrypted,this.onDecryptionAttempt),this.matrixClient.on(s.ClientEvent.ToDeviceEvent,this.onDeviceMessage),this.matrixClient.on(s.ClientEvent.Sync,this.onSyncStateChange))}async onNotReady(){this.matrixClient&&(this.matrixClient.removeListener(s.ClientEvent.ToDeviceEvent,this.onDeviceMessage),this.matrixClient.removeListener(s.MatrixEventEvent.Decrypted,this.onDecryptionAttempt),this.matrixClient.removeListener(s.ClientEvent.Sync,this.onSyncStateChange))}async onDecryptionAttempt(e){if(!this.state.initialSyncCompleted)return;const t=e.getWireContent(),a=t.session_id;if(e.isDecryptionFailure()&&!this.state.reportedSessionIds.has(a)){if(await Object(r.N)(5e3),!e.isDecryptionFailure())return;const n=new Set(this.state.reportedSessionIds);await this.updateState({reportedSessionIds:n.add(a)});const i=(new Date).getTime();if(i-this.state.lastRageshakeTime<6e4)return;await this.updateState({lastRageshakeTime:i});const s={event_id:e.getId(),room_id:e.getRoomId(),session_id:a,device_id:t.device_id,user_id:e.getSender(),sender_key:t.sender_key},c=await Object(l.a)(o.b.get().bug_report_endpoint_url,{userText:"Auto-reporting decryption error (recipient)",sendLogs:!0,labels:["Z-UISI","web","uisi-recipient"],customApp:o.b.get().uisi_autorageshake_app,customFields:{auto_uisi:JSON.stringify(s)}}),d=p(p({},s),{},{recipient_rageshake:c});this.matrixClient.sendToDevice(g,new Map([["messageContent.user_id",new Map([[d.device_id,d]])]]))}}async onSyncStateChange(e,t,a){this.state.initialSyncCompleted||await this.updateState({initialSyncCompleted:!!a.nextSyncToken})}async onDeviceMessage(e){if(e.getType()!==g)return;const t=e.getContent(),a=t.recipient_rageshake||"",n=(new Date).getTime();n-this.state.lastRageshakeTime>6e4&&(await this.updateState({lastRageshakeTime:n}),await Object(l.a)(o.b.get().bug_report_endpoint_url,{userText:`Auto-reporting decryption error (sender)\nRecipient rageshake: ${a}`,sendLogs:!0,labels:["Z-UISI","web","uisi-sender"],customApp:o.b.get().uisi_autorageshake_app,customFields:{recipient_rageshake:a,auto_uisi:JSON.stringify(t)}}))}async onReportKeyBackupNotEnabled(){m.b.getValue("automaticKeyBackNotEnabledReporting")&&await Object(l.a)(o.b.get().bug_report_endpoint_url,{userText:"Auto-reporting key backup not enabled",sendLogs:!0,labels:["web",u.a.ReportKeyBackupNotEnabled]})}}i()(v,"internalInstance",(()=>{const e=new v;return e.start(),e})()),window.mxAutoRageshakeStore=v.instance},1453:function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(13),i=a.n(n),s=a(17),r=a(149);class o extends s.EventEmitter{constructor(){super(...arguments),i()(this,"_isResizing",!1),i()(this,"throttledMiddlePanel",Object(r.throttle)((()=>this.emit("middlePanelResized")),200))}get isResizing(){return this._isResizing}startResizing(){this._isResizing=!0,this.emit("isResizing",!0)}stopResizing(){this._isResizing=!1,this.emit("isResizing",!1)}noisyMiddlePanel(){this.emit("middlePanelResizedNoisy")}updateMiddlePanel(){this.throttledMiddlePanel(),this.noisyMiddlePanel()}notifyLeftHandleResized(){this.updateMiddlePanel()}notifyRightHandleResized(){this.updateMiddlePanel()}notifyTimelineHeightChanged(){this.updateMiddlePanel()}notifyWindowResized(){this.updateMiddlePanel()}}},1454:function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(120);const i=100;function s(e,t,a){Object(n.useEffect)((()=>{let n=null;const s=()=>{n=null,t(...a)};if(!1!==e)return n=window.setTimeout(s,i),()=>{n&&clearTimeout(n)}}),[e,t,a])}},1455:function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(120),i=a(122),s=a(137),r=a(125),o=a(146);const l=()=>{const[e,t]=Object(n.useState)((()=>{const e=i.a.get(),t=r.b.getValue("SpotlightSearch.recentSearches",null);return Object(o.n)(t.map((t=>e.getRoom(t))))}));return[e,()=>{r.b.setValue("SpotlightSearch.recentSearches",null,s.a.ACCOUNT,[]),t([])}]}},1456:function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(120),i=a(122),s=a(627);const r=()=>{const[e,t]=Object(n.useState)(null),[a,r]=Object(n.useState)(!1),[o,l]=Object(s.a)(t);return{ready:!0,loading:a,profile:e,search:Object(n.useCallback)((async e=>{let{query:a}=e;if(o(a),null==a||!a.length||!a.startsWith("@")||!a.includes(":"))return t(null),!0;r(!0);try{const e=await i.a.get().getProfileInfo(a);return l(a,{user_id:a,avatar_url:e.avatar_url,display_name:e.displayname}),!0}catch(e){return console.error("Could not fetch profile info for params",{term:a},e),l(a,null),!1}finally{r(!1)}}),[o,l])}}},1457:function(e,t,a){"use strict";a.d(t,"a",(function(){return g}));var n=a(120),i=a(122),s=a(131),r=a(125),o=a(627),l=a(167);const c="ALL_ROOMS",d="mx_last_room_directory_server",m="mx_last_room_directory_instance";let u;const h="nsfw",p=e=>{var t,a;return!(null!==(t=e.name)&&void 0!==t&&t.toLocaleLowerCase().includes(h)||null!==(a=e.topic)&&void 0!==a&&a.toLocaleLowerCase().includes(h))},g=()=>{const[e,t]=Object(n.useState)([]),[a,h]=Object(n.useState)(void 0),[g,v]=Object(n.useState)(null),[b,f]=Object(n.useState)(!1),[y,E]=Object(n.useState)(!1),[_,w]=Object(o.a)(t),S=Object(l.b)("SpotlightSearch.showNsfwPublicRooms");const O=Object(n.useCallback)((async e=>{let{limit:t=20,query:n,roomTypes:s}=e;const r={limit:t};(null==a?void 0:a.roomServer)!=i.a.getHomeserverName()&&(r.server=null==a?void 0:a.roomServer),(null==a?void 0:a.instanceId)===c?r.include_all_networks=!0:null!=a&&a.instanceId&&(r.third_party_instance_id=a.instanceId),(n||s)&&(r.filter={generic_search_term:n,room_types:await i.a.get().doesServerSupportUnstableFeature("org.matrix.msc3827.stable")?Array.from(s):void 0}),_(r);try{E(!0);const{chunk:e}=await i.a.get().publicRooms(r);return w(r,S?e:e.filter(p)),!0}catch(e){return console.error("Could not fetch public rooms for params",r,e),w(r,[]),!1}finally{E(!1)}}),[a,_,w,S]);return Object(n.useEffect)((()=>{!async function(){if(i.a.get())if(u)v(u);else{const e=await i.a.get().getThirdpartyProtocols();u=e,v(e)}else f(!0)}()}),[]),Object(n.useEffect)((()=>{var e,t,a,n;if(null===g)return;const o=i.a.getHomeserverName(),l=localStorage.getItem(d),u=null!==(e=localStorage.getItem(m))&&void 0!==e?e:void 0;let p,v=o;(null!==(t=s.b.getObject("room_directory"))&&void 0!==t&&null!==(a=t.get("servers"))&&void 0!==a&&a.includes(l)||null!==(n=r.b.getValue("room_directory_servers"))&&void 0!==n&&n.includes(l))&&(v=l),v!==o||u!==c&&!Object.values(g).some((e=>{e.instances.some((e=>e.instance_id===u))}))||(p=u),f(!0),h({roomServer:v,instanceId:p})}),[g]),Object(n.useEffect)((()=>{localStorage.setItem(d,null==a?void 0:a.roomServer),null!=a&&a.instanceId?localStorage.setItem(m,null==a?void 0:a.instanceId):localStorage.removeItem(m)}),[a]),{ready:b,loading:y,publicRooms:e,protocols:g,config:a,search:O,setConfig:function(e){if(!b)throw new Error("public room configuration not initialised yet");h(e)}}}},1458:function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(120),i=a(136),s=a(882),r=a(16),o=a(122);const l=(e,t)=>{var a;const[l,c]=Object(n.useState)([]),[d,m]=Object(n.useState)(),u=Object(n.useCallback)((()=>{m(e?new s.a(e,50):null)}),[e]);Object(n.useEffect)(u,[u]),Object(n.useEffect)((()=>{if(!e||!d)return;let t=!1;return(async()=>{for(;null!=d&&d.canLoadMore&&!t&&e===d.root;)await d.load(),d.canLoadMore&&d.load(),c(d.rooms)})(),()=>{t=!0}}),[e,d]);return[Object(n.useMemo)((()=>{const e=t.trim(),a=e.toLowerCase(),n=Object(r.B)(e),s=o.a.get();return null==l?void 0:l.filter((e=>{var t;return e.room_type!==i.RoomType.Space&&"join"!==(null===(t=s.getRoom(e.room_id))||void 0===t?void 0:t.getMyMembership())&&(Object(r.B)(e.name||"").includes(n)||(e.canonical_alias||"").includes(a))}))}),[l,t]),null!==(a=null==d?void 0:d.loading)&&void 0!==a&&a]}},1459:function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(120),i=a(122),s=a(405),r=a(627);const o=()=>{const[e,t]=Object(n.useState)([]),[a,o]=Object(n.useState)(!1),[l,c]=Object(r.a)(t);return{ready:!0,loading:a,users:e,search:Object(n.useCallback)((async e=>{let{limit:a=20,query:n}=e;const r={limit:a,term:n};if(l(r),null==n||!n.length)return t([]),!0;try{o(!0);const{results:e}=await i.a.get().searchUserDirectory(r);return c(r,e.map((e=>new s.a(e)))),!0}catch(e){return console.error("Could not fetch user in user directory for params",{limit:a,term:n},e),c(r,[]),!1}finally{o(!1)}}),[l,c])}}},1460:function(e,t,a){"use strict";a.d(t,"a",(function(){return p}));var n=a(130),i=a.n(n),s=a(132),r=a.n(s),o=a(126),l=a.n(o),c=a(120),d=a.n(c),m=a(169),u=a(123);const h=["inputRef","children","endAdornment","className"],p=e=>{let{inputRef:t,children:a,endAdornment:n,className:s}=e,o=r()(e,h);const[c,p,g]=Object(m.i)(t);return d.a.createElement(u.a,i()({},o,{className:l()(s,"mx_SpotlightDialog_option"),onFocus:c,inputRef:g,tabIndex:-1,"aria-selected":p,role:"option"}),a,d.a.createElement("div",{className:"mx_SpotlightDialog_option--endAdornment"},d.a.createElement("kbd",{className:"mx_SpotlightDialog_enterPrompt","aria-hidden":!0},"↵"),n))}},1461:function(e,t,a){"use strict";a.d(t,"a",(function(){return d}));var n=a(120),i=a.n(n),s=a(196),r=a(121),o=a(285);const l=80,c=800;function d(e){var t,a,n;let{room:d,labelId:m,descriptionId:u,detailsId:h}=e,p=d.name||Object(o.a)(null!==(t=d.canonical_alias)&&void 0!==t?t:"",null!==(a=d.aliases)&&void 0!==a?a:[])||Object(r.a)("Unnamed room");p.length>l&&(p=`${p.substring(0,l)}...`);let g=d.topic||"";return g.length>c&&(g=`${g.substring(0,c)}...`),i.a.createElement("div",{className:"mx_SpotlightDialog_result_publicRoomDetails"},i.a.createElement("div",{className:"mx_SpotlightDialog_result_publicRoomHeader"},i.a.createElement("span",{id:m,className:"mx_SpotlightDialog_result_publicRoomName"},p),i.a.createElement("span",{id:u,className:"mx_SpotlightDialog_result_publicRoomAlias"},null!==(n=d.canonical_alias)&&void 0!==n?n:d.room_id)),i.a.createElement("div",{id:h,className:"mx_SpotlightDialog_result_publicRoomDescription"},i.a.createElement("span",{className:"mx_SpotlightDialog_result_publicRoomMemberCount"},Object(r.a)("%(count)s Members",{count:d.num_joined_members})),g&&i.a.createElement(i.a.Fragment,null," · ",i.a.createElement("span",{className:"mx_SpotlightDialog_result_publicRoomTopic",dangerouslySetInnerHTML:{__html:Object(s.g)(g)}}))))}},1462:function(e,t,a){"use strict";a.d(t,"a",(function(){return b}));var n=a(130),i=a.n(n),s=a(126),r=a.n(s),o=a(120),l=a.n(o),c=a(328),d=a(591),m=a(121),u=a(264),h=a(819),p=a(818),g=a(629),v=a(450);function b(e){let{room:t}=e;const[a]=Object(d.a)(t),[n,s]=Object(o.useState)(null),[b,f]=Object(o.useState)(null);let y,E;null!==n&&(y=t.isSpaceRoom()?l.a.createElement(g.a,i()({},Object(v.a)(n),{space:t,onFinished:()=>s(null)})):l.a.createElement(h.a,i()({},Object(v.a)(n),{room:t,onFinished:()=>s(null)}))),null!==b&&(E=l.a.createElement(p.a,i()({},Object(v.a)(b),{room:t,onFinished:()=>f(null)})));const _=r()("mx_SpotlightDialog_option--notifications",{mx_RoomNotificationContextMenu_iconBell:a===u.a.AllMessages,mx_RoomNotificationContextMenu_iconBellDot:a===u.a.AllMessagesLoud,mx_RoomNotificationContextMenu_iconBellMentions:a===u.a.MentionsOnly,mx_RoomNotificationContextMenu_iconBellCrossed:a===u.a.Mute});return l.a.createElement(o.Fragment,null,l.a.createElement(c.a,{className:"mx_SpotlightDialog_option--menu",onClick:e=>{e.preventDefault(),e.stopPropagation();const t=e.target;s(t.getBoundingClientRect())},title:t.isSpaceRoom()?Object(m.a)("Space options"):Object(m.a)("Room options"),isExpanded:null!==n}),!t.isSpaceRoom()&&l.a.createElement(c.a,{className:_,onClick:e=>{e.preventDefault(),e.stopPropagation();const t=e.target;f(t.getBoundingClientRect())},title:Object(m.a)("Notification options"),isExpanded:null!==b}),y,E)}},1463:function(e,t,a){"use strict";a.d(t,"a",(function(){return p}));var n=a(130),i=a.n(n),s=a(132),r=a.n(s),o=a(126),l=a.n(o),c=a(120),d=a.n(c),m=a(169),u=a(148);const h=["inputRef","className"],p=e=>{let{inputRef:t,className:a}=e,n=r()(e,h);const[s,o,c]=Object(m.i)(t);return d.a.createElement(u.a,i()({},n,{className:l()(a,"mx_SpotlightDialog_option"),onFocus:s,inputRef:c,tabIndex:-1,"aria-selected":o,role:"option"}))}},1464:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return r}));var n,i=a(120);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},s.apply(this,arguments)}function r(e){return i.createElement("svg",s({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 18 18",role:"presentation","aria-hidden":!0},e),n||(n=i.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15 9a6 6 0 01-6 6v-2a4 4 0 000-8V3a6 6 0 016 6zM9 5a4 4 0 100 8V5zm8 4A8 8 0 111 9a8 8 0 0116 0z",fill:"#000"})))}t.default="img/element-icons/roomlist/dark-light-mode.87d7411.svg"},1465:function(e,t,a){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(t,"__esModule",{value:!0});var i=a(120),s=n(i),r=n(a(683)),o=n(a(130)),l=a(1466),c=a(1468),d=a(1487),m=a(1488),u=n(a(1490)),h=n(a(1491)),p=n(a(186)),g=!0,v=/[ \t]{2,}/g,b=/^[ \t]*/gm,f=function(e){return e.replace(v," ").replace(b,"").trim()},y=function(e){return f("\n %creact-beautiful-dnd\n\n %c"+f(e)+"\n\n %c👷 This is a development only message. It will be removed in production builds.\n")},E=function(e){return[y(e),"color: #00C584; font-size: 1.2em; font-weight: bold;","line-height: 1.5","color: #723874;"]},_="__react-beautiful-dnd-disable-dev-warnings";function w(e,t){var a;g||"undefined"!=typeof window&&window[_]||(a=console)[e].apply(a,E(t))}w.bind(null,"warn"),w.bind(null,"error");function S(){}function O(e,t,a){var n=t.map((function(t){var n=function(e,t){return o({},e,{},t)}(a,t.options);return e.addEventListener(t.eventName,t.fn,n),function(){e.removeEventListener(t.eventName,t.fn,n)}}));return function(){n.forEach((function(e){e()}))}}var C=!0,x="Invariant failed";function j(e){this.message=e}function k(e,t){if(!e)throw new j(C?x:x+": "+(t||""))}j.prototype.toString=function(){return this.message};var R=function(e){function t(){for(var t,a=arguments.length,n=new Array(a),i=0;i<a;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).callbacks=null,t.unbind=S,t.onWindowError=function(e){var a=t.getCallbacks();a.isDragging()&&a.tryAbort(),e.error instanceof j&&e.preventDefault()},t.getCallbacks=function(){if(!t.callbacks)throw new Error("Unable to find AppCallbacks in <ErrorBoundary/>");return t.callbacks},t.setCallbacks=function(e){t.callbacks=e},t}r(t,e);var a=t.prototype;return a.componentDidMount=function(){this.unbind=O(window,[{eventName:"error",fn:this.onWindowError}])},a.componentDidCatch=function(e){if(!(e instanceof j))throw e;this.setState({})},a.componentWillUnmount=function(){this.unbind()},a.render=function(){return this.props.children(this.setCallbacks)},t}(s.Component),I=function(e){return e+1},T=function(e,t){var a=e.droppableId===t.droppableId,n=I(e.index),i=I(t.index);return a?"\n You have moved the item from position "+n+"\n to position "+i+"\n ":"\n You have moved the item from position "+n+"\n in list "+e.droppableId+"\n to list "+t.droppableId+"\n in position "+i+"\n "},N=function(e,t,a){return t.droppableId===a.droppableId?"\n The item "+e+"\n has been combined with "+a.draggableId:"\n The item "+e+"\n in list "+t.droppableId+"\n has been combined with "+a.draggableId+"\n in list "+a.droppableId+"\n "},P=function(e){return"\n The item has returned to its starting position\n of "+I(e.index)+"\n"},D={dragHandleUsageInstructions:"\n Press space bar to start a drag.\n When dragging you can use the arrow keys to move the item around and escape to cancel.\n Some screen readers may require you to be in focus mode or to use your pass through key\n",onDragStart:function(e){return"\n You have lifted an item in position "+I(e.source.index)+"\n"},onDragUpdate:function(e){var t=e.destination;if(t)return T(e.source,t);var a=e.combine;return a?N(e.draggableId,e.source,a):"You are over an area that cannot be dropped on"},onDragEnd:function(e){if("CANCEL"===e.reason)return"\n Movement cancelled.\n "+P(e.source)+"\n ";var t=e.destination,a=e.combine;return t?"\n You have dropped the item.\n "+T(e.source,t)+"\n ":a?"\n You have dropped the item.\n "+N(e.draggableId,e.source,a)+"\n ":"\n The item has been dropped while not over a drop area.\n "+P(e.source)+"\n "}},M={x:0,y:0},A=function(e,t){return{x:e.x+t.x,y:e.y+t.y}},L=function(e,t){return{x:e.x-t.x,y:e.y-t.y}},U=function(e,t){return e.x===t.x&&e.y===t.y},F=function(e){return{x:0!==e.x?-e.x:0,y:0!==e.y?-e.y:0}},B=function(e,t,a){var n;return void 0===a&&(a=0),(n={})[e]=t,n["x"===e?"y":"x"]=a,n},V=function(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))},W=function(e,t){return Math.min.apply(Math,t.map((function(t){return V(e,t)})))},H=function(e){return function(t){return{x:e(t.x),y:e(t.y)}}},z=function(e,t){return{top:e.top+t.y,left:e.left+t.x,bottom:e.bottom+t.y,right:e.right+t.x}},G=function(e){return[{x:e.left,y:e.top},{x:e.right,y:e.top},{x:e.left,y:e.bottom},{x:e.right,y:e.bottom}]},K=function(e,t){return t&&t.shouldClipSubject?function(e,t){var a=m.getRect({top:Math.max(t.top,e.top),right:Math.min(t.right,e.right),bottom:Math.min(t.bottom,e.bottom),left:Math.max(t.left,e.left)});return a.width<=0||a.height<=0?null:a}(t.pageMarginBox,e):m.getRect(e)},q=function(e){var t=e.page,a=e.withPlaceholder,n=e.axis,i=e.frame,s=function(e,t){return t?z(e,t.scroll.diff.displacement):e}(t.marginBox,i),r=function(e,t,a){var n;return a&&a.increasedBy?o({},e,((n={})[t.end]=e[t.end]+a.increasedBy[t.line],n)):e}(s,n,a);return{page:t,withPlaceholder:a,active:K(r,i)}},$=function(e,t){e.frame||k(!1);var a=e.frame,n=L(t,a.scroll.initial),i=F(n),s=o({},a,{scroll:{initial:a.scroll.initial,current:t,diff:{value:n,displacement:i},max:a.scroll.max}}),r=q({page:e.subject.page,withPlaceholder:e.subject.withPlaceholder,axis:e.axis,frame:s});return o({},e,{frame:s,subject:r})};function Y(e){return Object.values?Object.values(e):Object.keys(e).map((function(t){return e[t]}))}function J(e,t){if(e.findIndex)return e.findIndex(t);for(var a=0;a<e.length;a++)if(t(e[a]))return a;return-1}function Q(e,t){if(e.find)return e.find(t);var a=J(e,t);return-1!==a?e[a]:void 0}function X(e){return Array.prototype.slice.call(e)}var Z=u((function(e){return e.reduce((function(e,t){return e[t.descriptor.id]=t,e}),{})})),ee=u((function(e){return e.reduce((function(e,t){return e[t.descriptor.id]=t,e}),{})})),te=u((function(e){return Y(e)})),ae=u((function(e){return Y(e)})),ne=u((function(e,t){var a=ae(t).filter((function(t){return e===t.descriptor.droppableId})).sort((function(e,t){return e.descriptor.index-t.descriptor.index}));return a}));function ie(e){return e.at&&"REORDER"===e.at.type?e.at.destination:null}function se(e){return e.at&&"COMBINE"===e.at.type?e.at.combine:null}var re=u((function(e,t){return t.filter((function(t){return t.descriptor.id!==e.descriptor.id}))})),oe=function(e,t){return e.descriptor.droppableId===t.descriptor.id},le={point:M,value:0},ce={invisible:{},visible:{},all:[]},de={displaced:ce,displacedBy:le,at:null},me=function(e,t){return function(a){return e<=a&&a<=t}},ue=function(e){var t=me(e.top,e.bottom),a=me(e.left,e.right);return function(n){if(t(n.top)&&t(n.bottom)&&a(n.left)&&a(n.right))return!0;var i=t(n.top)||t(n.bottom),s=a(n.left)||a(n.right);if(i&&s)return!0;var r=n.top<e.top&&n.bottom>e.bottom,o=n.left<e.left&&n.right>e.right;return!(!r||!o)||(r&&s||o&&i)}},he=function(e){var t=me(e.top,e.bottom),a=me(e.left,e.right);return function(e){return t(e.top)&&t(e.bottom)&&a(e.left)&&a(e.right)}},pe={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},ge={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"},ve=function(e){var t=e.target,a=e.destination,n=e.viewport,i=e.withDroppableDisplacement,s=e.isVisibleThroughFrameFn,r=i?function(e,t){var a=t.frame?t.frame.scroll.diff.displacement:M;return z(e,a)}(t,a):t;return function(e,t,a){return!!t.subject.active&&a(t.subject.active)(e)}(r,a,s)&&function(e,t,a){return a(t)(e)}(r,n,s)},be=function(e){return ve(o({},e,{isVisibleThroughFrameFn:ue}))},fe=function(e){return ve(o({},e,{isVisibleThroughFrameFn:he}))},ye=function(e,t,a){if("boolean"==typeof a)return a;if(!t)return!0;var n=t.invisible,i=t.visible;if(n[e])return!1;var s=i[e];return!s||s.shouldAnimate};function Ee(e){var t=e.afterDragging,a=e.destination,n=e.displacedBy,i=e.viewport,s=e.forceShouldAnimate,r=e.last;return t.reduce((function(e,t){var o=function(e,t){var a=e.page.marginBox,n={top:t.point.y,right:0,bottom:0,left:t.point.x};return m.getRect(m.expand(a,n))}(t,n),l=t.descriptor.id;if(e.all.push(l),!be({target:o,destination:a,viewport:i,withDroppableDisplacement:!0}))return e.invisible[t.descriptor.id]=!0,e;var c={draggableId:l,shouldAnimate:ye(l,r,s)};return e.visible[l]=c,e}),{all:[],visible:{},invisible:{}})}function _e(e){var t=e.insideDestination,a=e.inHomeList,n=e.displacedBy,i=e.destination,s=function(e,t){if(!e.length)return 0;var a=e[e.length-1].descriptor.index;return t.inHomeList?a:a+1}(t,{inHomeList:a});return{displaced:ce,displacedBy:n,at:{type:"REORDER",destination:{droppableId:i.descriptor.id,index:s}}}}function we(e){var t=e.draggable,a=e.insideDestination,n=e.destination,i=e.viewport,s=e.displacedBy,r=e.last,o=e.index,l=e.forceShouldAnimate,c=oe(t,n);if(null==o)return _e({insideDestination:a,inHomeList:c,displacedBy:s,destination:n});var d=Q(a,(function(e){return e.descriptor.index===o}));if(!d)return _e({insideDestination:a,inHomeList:c,displacedBy:s,destination:n});var m=re(t,a),u=a.indexOf(d);return{displaced:Ee({afterDragging:m.slice(u),destination:n,displacedBy:s,last:r,viewport:i.frame,forceShouldAnimate:l}),displacedBy:s,at:{type:"REORDER",destination:{droppableId:n.descriptor.id,index:o}}}}function Se(e,t){return Boolean(t.effected[e])}var Oe=function(e){var t=e.isMovingForward,a=e.isInHomeList,n=e.draggable,i=e.draggables,s=e.destination,r=e.insideDestination,o=e.previousImpact,l=e.viewport,c=e.afterCritical,d=o.at;if(d||k(!1),"REORDER"===d.type){var m=function(e){var t=e.isMovingForward,a=e.isInHomeList,n=e.insideDestination,i=e.location;if(!n.length)return null;var s=i.index,r=t?s+1:s-1,o=n[0].descriptor.index,l=n[n.length-1].descriptor.index;return r<o||r>(a?l:l+1)?null:r}({isMovingForward:t,isInHomeList:a,location:d.destination,insideDestination:r});return null==m?null:we({draggable:n,insideDestination:r,destination:s,viewport:l,last:o.displaced,displacedBy:o.displacedBy,index:m})}var u=function(e){var t=e.isMovingForward,a=e.destination,n=e.draggables,i=e.combine,s=e.afterCritical;if(!a.isCombineEnabled)return null;var r=i.draggableId,o=n[r].descriptor.index;return Se(r,s)?t?o:o-1:t?o+1:o}({isMovingForward:t,destination:s,displaced:o.displaced,draggables:i,combine:d.combine,afterCritical:c});return null==u?null:we({draggable:n,insideDestination:r,destination:s,viewport:l,last:o.displaced,displacedBy:o.displacedBy,index:u})},Ce=function(e){var t=e.afterCritical,a=e.impact,n=e.draggables,i=se(a);i||k(!1);var s=i.draggableId,r=n[s].page.borderBox.center,o=function(e){var t=e.displaced,a=e.afterCritical,n=e.combineWith,i=e.displacedBy,s=Boolean(t.visible[n]||t.invisible[n]);return Se(n,a)?s?M:F(i.point):s?i.point:M}({displaced:a.displaced,afterCritical:t,combineWith:s,displacedBy:a.displacedBy});return A(r,o)},xe=function(e,t){return t.margin[e.start]+t.borderBox[e.size]/2},je=function(e,t,a){return t[e.crossAxisStart]+a.margin[e.crossAxisStart]+a.borderBox[e.crossAxisSize]/2},ke=function(e){var t=e.axis,a=e.moveRelativeTo,n=e.isMoving;return B(t.line,a.marginBox[t.end]+xe(t,n),je(t,a.marginBox,n))},Re=function(e){var t=e.axis,a=e.moveRelativeTo,n=e.isMoving;return B(t.line,a.marginBox[t.start]-function(e,t){return t.margin[e.end]+t.borderBox[e.size]/2}(t,n),je(t,a.marginBox,n))},Ie=function(e){var t=e.impact,a=e.draggable,n=e.draggables,i=e.droppable,s=e.afterCritical,r=ne(i.descriptor.id,n),o=a.page,l=i.axis;if(!r.length)return function(e){var t=e.axis,a=e.moveInto,n=e.isMoving;return B(t.line,a.contentBox[t.start]+xe(t,n),je(t,a.contentBox,n))}({axis:l,moveInto:i.page,isMoving:o});var c=t.displaced,d=t.displacedBy,u=c.all[0];if(u){var h=n[u];if(Se(u,s))return Re({axis:l,moveRelativeTo:h.page,isMoving:o});var p=m.offset(h.page,d.point);return Re({axis:l,moveRelativeTo:p,isMoving:o})}var g=r[r.length-1];if(g.descriptor.id===a.descriptor.id)return o.borderBox.center;if(Se(g.descriptor.id,s)){var v=m.offset(g.page,F(s.displacedBy.point));return ke({axis:l,moveRelativeTo:v,isMoving:o})}return ke({axis:l,moveRelativeTo:g.page,isMoving:o})},Te=function(e,t){var a=e.frame;return a?A(t,a.scroll.diff.displacement):t},Ne=function(e){var t=function(e){var t=e.impact,a=e.draggable,n=e.droppable,i=e.draggables,s=e.afterCritical,r=a.page.borderBox.center,o=t.at;return n&&o?"REORDER"===o.type?Ie({impact:t,draggable:a,draggables:i,droppable:n,afterCritical:s}):Ce({impact:t,draggables:i,afterCritical:s}):r}(e),a=e.droppable;return a?Te(a,t):t},Pe=function(e,t){var a=L(t,e.scroll.initial),n=F(a);return{frame:m.getRect({top:t.y,bottom:t.y+e.frame.height,left:t.x,right:t.x+e.frame.width}),scroll:{initial:e.scroll.initial,max:e.scroll.max,current:t,diff:{value:a,displacement:n}}}};function De(e,t){return e.map((function(e){return t[e]}))}var Me=function(e){var t=e.pageBorderBoxCenter,a=e.draggable,n=function(e,t){return A(e.scroll.diff.displacement,t)}(e.viewport,t),i=L(n,a.page.borderBox.center);return A(a.client.borderBox.center,i)},Ae=function(e){var t=e.draggable,a=e.destination,n=e.newPageBorderBoxCenter,i=e.viewport,s=e.withDroppableDisplacement,r=e.onlyOnMainAxis,l=void 0!==r&&r,c=L(n,t.page.borderBox.center),d={target:z(t.page.borderBox,c),destination:a,withDroppableDisplacement:s,viewport:i};return l?function(e){return ve(o({},e,{isVisibleThroughFrameFn:(t=e.destination.axis,function(e){var a=me(e.top,e.bottom),n=me(e.left,e.right);return function(e){return t===pe?a(e.top)&&a(e.bottom):n(e.left)&&n(e.right)}})}));var t}(d):fe(d)},Le=function(e){var t=e.isMovingForward,a=e.draggable,n=e.destination,i=e.draggables,s=e.previousImpact,r=e.viewport,l=e.previousPageBorderBoxCenter,c=e.previousClientSelection,d=e.afterCritical;if(!n.isEnabled)return null;var m=ne(n.descriptor.id,i),u=oe(a,n),h=function(e){var t=e.isMovingForward,a=e.draggable,n=e.destination,i=e.insideDestination,s=e.previousImpact;if(!n.isCombineEnabled)return null;if(!ie(s))return null;function r(e){var t={type:"COMBINE",combine:{draggableId:e,droppableId:n.descriptor.id}};return o({},s,{at:t})}var l=s.displaced.all,c=l.length?l[0]:null;if(t)return c?r(c):null;var d=re(a,i);if(!c)return d.length?r(d[d.length-1].descriptor.id):null;var m=J(d,(function(e){return e.descriptor.id===c}));-1===m&&k(!1);var u=m-1;return u<0?null:r(d[u].descriptor.id)}({isMovingForward:t,draggable:a,destination:n,insideDestination:m,previousImpact:s})||Oe({isMovingForward:t,isInHomeList:u,draggable:a,draggables:i,destination:n,insideDestination:m,previousImpact:s,viewport:r,afterCritical:d});if(!h)return null;var p=Ne({impact:h,draggable:a,droppable:n,draggables:i,afterCritical:d});if(Ae({draggable:a,destination:n,newPageBorderBoxCenter:p,viewport:r.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0}))return{clientSelection:Me({pageBorderBoxCenter:p,draggable:a,viewport:r}),impact:h,scrollJumpRequest:null};var g=L(p,l),v=function(e){var t=e.impact,a=e.viewport,n=e.destination,i=e.draggables,s=e.maxScrollChange,r=Pe(a,A(a.scroll.current,s)),l=n.frame?$(n,A(n.frame.scroll.current,s)):n,c=t.displaced,d=Ee({afterDragging:De(c.all,i),destination:n,displacedBy:t.displacedBy,viewport:r.frame,last:c,forceShouldAnimate:!1}),m=Ee({afterDragging:De(c.all,i),destination:l,displacedBy:t.displacedBy,viewport:a.frame,last:c,forceShouldAnimate:!1}),u={},h={},p=[c,d,m];return c.all.forEach((function(e){var t=function(e,t){for(var a=0;a<t.length;a++){var n=t[a].visible[e];if(n)return n}return null}(e,p);t?h[e]=t:u[e]=!0})),o({},t,{displaced:{all:c.all,invisible:u,visible:h}})}({impact:h,viewport:r,destination:n,draggables:i,maxScrollChange:g});return{clientSelection:c,impact:v,scrollJumpRequest:g}},Ue=function(e){var t=e.subject.active;return t||k(!1),t},Fe=function(e,t){var a=e.page.borderBox.center;return Se(e.descriptor.id,t)?L(a,t.displacedBy.point):a},Be=function(e,t){var a=e.page.borderBox;return Se(e.descriptor.id,t)?z(a,F(t.displacedBy.point)):a},Ve=u((function(e,t){var a=t[e.line];return{value:a,point:B(e.line,a)}})),We=function(e,t){return o({},e,{scroll:o({},e.scroll,{max:t})})},He=function(e,t,a){var n=e.frame;oe(t,e)&&k(!1),e.subject.withPlaceholder&&k(!1);var i=Ve(e.axis,t.displaceBy).point,s=function(e,t,a){var n=e.axis;if("virtual"===e.descriptor.mode)return B(n.line,t[n.line]);var i=e.subject.page.contentBox[n.size],s=ne(e.descriptor.id,a).reduce((function(e,t){return e+t.client.marginBox[n.size]}),0)+t[n.line]-i;return s<=0?null:B(n.line,s)}(e,i,a),r={placeholderSize:i,increasedBy:s,oldFrameMaxScroll:e.frame?e.frame.scroll.max:null};if(!n){var l=q({page:e.subject.page,withPlaceholder:r,axis:e.axis,frame:e.frame});return o({},e,{subject:l})}var c=s?A(n.scroll.max,s):n.scroll.max,d=We(n,c),m=q({page:e.subject.page,withPlaceholder:r,axis:e.axis,frame:d});return o({},e,{subject:m,frame:d})},ze=function(e){var t=e.isMovingForward,a=e.previousPageBorderBoxCenter,n=e.draggable,i=e.isOver,s=e.draggables,r=e.droppables,o=e.viewport,l=e.afterCritical,c=function(e){var t=e.isMovingForward,a=e.pageBorderBoxCenter,n=e.source,i=e.droppables,s=e.viewport,r=n.subject.active;if(!r)return null;var o=n.axis,l=me(r[o.start],r[o.end]),c=te(i).filter((function(e){return e!==n})).filter((function(e){return e.isEnabled})).filter((function(e){return Boolean(e.subject.active)})).filter((function(e){return ue(s.frame)(Ue(e))})).filter((function(e){var a=Ue(e);return t?r[o.crossAxisEnd]<a[o.crossAxisEnd]:a[o.crossAxisStart]<r[o.crossAxisStart]})).filter((function(e){var t=Ue(e),a=me(t[o.start],t[o.end]);return l(t[o.start])||l(t[o.end])||a(r[o.start])||a(r[o.end])})).sort((function(e,a){var n=Ue(e)[o.crossAxisStart],i=Ue(a)[o.crossAxisStart];return t?n-i:i-n})).filter((function(e,t,a){return Ue(e)[o.crossAxisStart]===Ue(a[0])[o.crossAxisStart]}));if(!c.length)return null;if(1===c.length)return c[0];var d=c.filter((function(e){return me(Ue(e)[o.start],Ue(e)[o.end])(a[o.line])}));return 1===d.length?d[0]:d.length>1?d.sort((function(e,t){return Ue(e)[o.start]-Ue(t)[o.start]}))[0]:c.sort((function(e,t){var n=W(a,G(Ue(e))),i=W(a,G(Ue(t)));return n!==i?n-i:Ue(e)[o.start]-Ue(t)[o.start]}))[0]}({isMovingForward:t,pageBorderBoxCenter:a,source:i,droppables:r,viewport:o});if(!c)return null;var d=ne(c.descriptor.id,s),m=function(e){var t=e.pageBorderBoxCenter,a=e.viewport,n=e.destination,i=e.insideDestination,s=e.afterCritical,r=i.filter((function(e){return fe({target:Be(e,s),destination:n,viewport:a.frame,withDroppableDisplacement:!0})})).sort((function(e,a){var i=V(t,Te(n,Fe(e,s))),r=V(t,Te(n,Fe(a,s)));return i<r?-1:r<i?1:e.descriptor.index-a.descriptor.index}));return r[0]||null}({pageBorderBoxCenter:a,viewport:o,destination:c,insideDestination:d,afterCritical:l}),u=function(e){var t=e.previousPageBorderBoxCenter,a=e.moveRelativeTo,n=e.insideDestination,i=e.draggable,s=e.draggables,r=e.destination,o=e.viewport,l=e.afterCritical;if(!a){if(n.length)return null;var c={displaced:ce,displacedBy:le,at:{type:"REORDER",destination:{droppableId:r.descriptor.id,index:0}}},d=Ne({impact:c,draggable:i,droppable:r,draggables:s,afterCritical:l}),m=oe(i,r)?r:He(r,i,s);return Ae({draggable:i,destination:m,newPageBorderBoxCenter:d,viewport:o.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0})?c:null}var u,h=Boolean(t[r.axis.line]<=a.page.borderBox.center[r.axis.line]),p=(u=a.descriptor.index,a.descriptor.id===i.descriptor.id||h?u:u+1),g=Ve(r.axis,i.displaceBy);return we({draggable:i,insideDestination:n,destination:r,viewport:o,displacedBy:g,last:ce,index:p})}({previousPageBorderBoxCenter:a,destination:c,draggable:n,draggables:s,moveRelativeTo:m,insideDestination:d,viewport:o,afterCritical:l});if(!u)return null;var h=Ne({impact:u,draggable:n,droppable:c,draggables:s,afterCritical:l});return{clientSelection:Me({pageBorderBoxCenter:h,draggable:n,viewport:o}),impact:u,scrollJumpRequest:null}},Ge=function(e){var t=e.at;return t?"REORDER"===t.type?t.destination.droppableId:t.combine.droppableId:null},Ke=function(e){var t=e.state,a=e.type,n=function(e,t){var a=Ge(e);return a?t[a]:null}(t.impact,t.dimensions.droppables),i=Boolean(n),s=t.dimensions.droppables[t.critical.droppable.id],r=n||s,o=r.axis.direction,l="vertical"===o&&("MOVE_UP"===a||"MOVE_DOWN"===a)||"horizontal"===o&&("MOVE_LEFT"===a||"MOVE_RIGHT"===a);if(l&&!i)return null;var c="MOVE_DOWN"===a||"MOVE_RIGHT"===a,d=t.dimensions.draggables[t.critical.draggable.id],m=t.current.page.borderBoxCenter,u=t.dimensions,h=u.draggables,p=u.droppables;return l?Le({isMovingForward:c,previousPageBorderBoxCenter:m,draggable:d,destination:r,draggables:h,viewport:t.viewport,previousClientSelection:t.current.client.selection,previousImpact:t.impact,afterCritical:t.afterCritical}):ze({isMovingForward:c,previousPageBorderBoxCenter:m,draggable:d,isOver:r,draggables:h,droppables:p,viewport:t.viewport,afterCritical:t.afterCritical})};function qe(e){return"DRAGGING"===e.phase||"COLLECTING"===e.phase}function $e(e){var t=me(e.top,e.bottom),a=me(e.left,e.right);return function(e){return t(e.y)&&a(e.x)}}function Ye(e){var t=e.pageBorderBox,a=e.draggable,n=e.droppables,i=te(n).filter((function(e){if(!e.isEnabled)return!1;var a,n,i=e.subject.active;if(!i)return!1;if(n=i,!((a=t).left<n.right&&a.right>n.left&&a.top<n.bottom&&a.bottom>n.top))return!1;if($e(i)(t.center))return!0;var s=e.axis,r=i.center[s.crossAxisLine],o=t[s.crossAxisStart],l=t[s.crossAxisEnd],c=me(i[s.crossAxisStart],i[s.crossAxisEnd]),d=c(o),m=c(l);return!d&&!m||(d?o<r:l>r)}));return i.length?1===i.length?i[0].descriptor.id:function(e){var t=e.pageBorderBox,a=e.draggable,n=e.candidates,i=a.page.borderBox.center,s=n.map((function(e){var a=e.axis,n=B(e.axis.line,t.center[a.line],e.page.borderBox.center[a.crossAxisLine]);return{id:e.descriptor.id,distance:V(i,n)}})).sort((function(e,t){return t.distance-e.distance}));return s[0]?s[0].id:null}({pageBorderBox:t,draggable:a,candidates:i}):null}var Je=function(e,t){return m.getRect(z(e,t))};function Qe(e){var t=e.displaced,a=e.id;return Boolean(t.visible[a]||t.invisible[a])}var Xe=function(e){var t=e.pageOffset,a=e.draggable,n=e.draggables,i=e.droppables,s=e.previousImpact,r=e.viewport,o=e.afterCritical,l=Je(a.page.borderBox,t),c=Ye({pageBorderBox:l,draggable:a,droppables:i});if(!c)return de;var d=i[c],m=ne(d.descriptor.id,n),u=function(e,t){var a=e.frame;return a?Je(t,a.scroll.diff.value):t}(d,l);return function(e){var t=e.draggable,a=e.pageBorderBoxWithDroppableScroll,n=e.previousImpact,i=e.destination,s=e.insideDestination,r=e.afterCritical;if(!i.isCombineEnabled)return null;var o=i.axis,l=Ve(i.axis,t.displaceBy),c=l.value,d=a[o.start],m=a[o.end],u=Q(re(t,s),(function(e){var t=e.descriptor.id,a=e.page.borderBox,i=a[o.size]/4,s=Se(t,r),l=Qe({displaced:n.displaced,id:t});return s?l?m>a[o.start]+i&&m<a[o.end]-i:d>a[o.start]-c+i&&d<a[o.end]-c-i:l?m>a[o.start]+c+i&&m<a[o.end]+c-i:d>a[o.start]+i&&d<a[o.end]-i}));return u?{displacedBy:l,displaced:n.displaced,at:{type:"COMBINE",combine:{draggableId:u.descriptor.id,droppableId:i.descriptor.id}}}:null}({pageBorderBoxWithDroppableScroll:u,draggable:a,previousImpact:s,destination:d,insideDestination:m,afterCritical:o})||function(e){var t=e.pageBorderBoxWithDroppableScroll,a=e.draggable,n=e.destination,i=e.insideDestination,s=e.last,r=e.viewport,o=e.afterCritical,l=n.axis,c=Ve(n.axis,a.displaceBy),d=c.value,m=t[l.start],u=t[l.end],h=function(e){var t=e.draggable,a=e.closest,n=e.inHomeList;return a?n&&a.descriptor.index>t.descriptor.index?a.descriptor.index-1:a.descriptor.index:null}({draggable:a,closest:Q(re(a,i),(function(e){var t=e.descriptor.id,a=e.page.borderBox.center[l.line],n=Se(t,o),i=Qe({displaced:s,id:t});return n?i?u<=a:m<a-d:i?u<=a+d:m<a})),inHomeList:oe(a,n)});return we({draggable:a,insideDestination:i,destination:n,viewport:r,last:s,displacedBy:c,index:h})}({pageBorderBoxWithDroppableScroll:u,draggable:a,destination:d,insideDestination:m,last:s.displaced,viewport:r,afterCritical:o})},Ze=function(e,t){var a;return o({},e,((a={})[t.descriptor.id]=t,a))},et=function(e){var t=e.previousImpact,a=e.impact,n=e.droppables,i=Ge(t),s=Ge(a);if(!i)return n;if(i===s)return n;var r=n[i];if(!r.subject.withPlaceholder)return n;var l=function(e){var t=e.subject.withPlaceholder;t||k(!1);var a=e.frame;if(!a){var n=q({page:e.subject.page,axis:e.axis,frame:null,withPlaceholder:null});return o({},e,{subject:n})}var i=t.oldFrameMaxScroll;i||k(!1);var s=We(a,i),r=q({page:e.subject.page,axis:e.axis,frame:s,withPlaceholder:null});return o({},e,{subject:r,frame:s})}(r);return Ze(n,l)},tt=function(e){var t=e.state,a=e.clientSelection,n=e.dimensions,i=e.viewport,s=e.impact,r=e.scrollJumpRequest,l=i||t.viewport,c=n||t.dimensions,d=a||t.current.client.selection,m=L(d,t.initial.client.selection),u={offset:m,selection:d,borderBoxCenter:A(t.initial.client.borderBoxCenter,m)},h={selection:A(u.selection,l.scroll.current),borderBoxCenter:A(u.borderBoxCenter,l.scroll.current),offset:A(u.offset,l.scroll.diff.value)},p={client:u,page:h};if("COLLECTING"===t.phase)return o({phase:"COLLECTING"},t,{dimensions:c,viewport:l,current:p});var g=c.draggables[t.critical.draggable.id],v=s||Xe({pageOffset:h.offset,draggable:g,draggables:c.draggables,droppables:c.droppables,previousImpact:t.impact,viewport:l,afterCritical:t.afterCritical}),b=function(e){var t=e.draggable,a=e.draggables,n=e.droppables,i=e.previousImpact,s=e.impact,r=et({previousImpact:i,impact:s,droppables:n}),o=Ge(s);if(!o)return r;var l=n[o];if(oe(t,l))return r;if(l.subject.withPlaceholder)return r;var c=He(l,t,a);return Ze(r,c)}({draggable:g,impact:v,previousImpact:t.impact,draggables:c.draggables,droppables:c.droppables});return o({},t,{current:p,dimensions:{draggables:c.draggables,droppables:b},impact:v,viewport:l,scrollJumpRequest:r||null,forceShouldAnimate:!r&&null})};var at=function(e){var t=e.impact,a=e.viewport,n=e.draggables,i=e.destination,s=e.forceShouldAnimate,r=t.displaced,l=function(e,t){return e.map((function(e){return t[e]}))}(r.all,n),c=Ee({afterDragging:l,destination:i,displacedBy:t.displacedBy,viewport:a.frame,forceShouldAnimate:s,last:r});return o({},t,{displaced:c})},nt=function(e){var t=e.impact,a=e.draggable,n=e.droppable,i=e.draggables,s=e.viewport,r=e.afterCritical,o=Ne({impact:t,draggable:a,draggables:i,droppable:n,afterCritical:r});return Me({pageBorderBoxCenter:o,draggable:a,viewport:s})},it=function(e){var t=e.state,a=e.dimensions,n=e.viewport;"SNAP"!==t.movementMode&&k(!1);var i=t.impact,s=n||t.viewport,r=a||t.dimensions,o=r.draggables,l=r.droppables,c=o[t.critical.draggable.id],d=Ge(i);d||k(!1);var m=l[d],u=at({impact:i,viewport:s,destination:m,draggables:o}),h=nt({impact:u,draggable:c,droppable:m,draggables:o,viewport:s,afterCritical:t.afterCritical});return tt({impact:u,clientSelection:h,state:t,dimensions:r,viewport:s})},st=function(e){var t=e.draggable,a=e.home,n=e.draggables,i=e.viewport,s=Ve(a.axis,t.displaceBy),r=ne(a.descriptor.id,n),o=r.indexOf(t);-1===o&&k(!1);var l,c=r.slice(o+1),d=c.reduce((function(e,t){return e[t.descriptor.id]=!0,e}),{}),m={inVirtualList:"virtual"===a.descriptor.mode,displacedBy:s,effected:d};return{impact:{displaced:Ee({afterDragging:c,destination:a,displacedBy:s,last:null,viewport:i.frame,forceShouldAnimate:!1}),displacedBy:s,at:{type:"REORDER",destination:(l=t.descriptor,{index:l.index,droppableId:l.droppableId})}},afterCritical:m}},rt=function(e){0},ot=function(e){0},lt=function(e){var t=e.additions,a=e.updatedDroppables,n=e.viewport,i=n.scroll.diff.value;return t.map((function(e){var t=e.descriptor.droppableId,s=function(e){var t=e.frame;return t||k(!1),t}(a[t]),r=s.scroll.diff.value,l=function(e){var t=e.draggable,a=e.offset,n=e.initialWindowScroll,i=m.offset(t.client,a),s=m.withScroll(i,n);return o({},t,{placeholder:o({},t.placeholder,{client:i}),client:i,page:s})}({draggable:e,offset:A(i,r),initialWindowScroll:n.scroll.initial});return l}))},ct=function(e){return"SNAP"===e.movementMode},dt=function(e,t,a){var n=function(e,t){return{draggables:e.draggables,droppables:Ze(e.droppables,t)}}(e.dimensions,t);return!ct(e)||a?tt({state:e,dimensions:n}):it({state:e,dimensions:n})};function mt(e){return e.isDragging&&"SNAP"===e.movementMode?o({phase:"DRAGGING"},e,{scrollJumpRequest:null}):e}var ut={phase:"IDLE",completed:null,shouldFlush:!1},ht=function(e,t){if(void 0===e&&(e=ut),"FLUSH"===t.type)return o({},ut,{shouldFlush:!0});if("INITIAL_PUBLISH"===t.type){"IDLE"!==e.phase&&k(!1);var a=t.payload,n=a.critical,i=a.clientSelection,s=a.viewport,r=a.dimensions,l=a.movementMode,c=r.draggables[n.draggable.id],d=r.droppables[n.droppable.id],m={selection:i,borderBoxCenter:c.client.borderBox.center,offset:M},u={client:m,page:{selection:A(m.selection,s.scroll.initial),borderBoxCenter:A(m.selection,s.scroll.initial),offset:A(m.selection,s.scroll.diff.value)}},h=te(r.droppables).every((function(e){return!e.isFixedOnPage})),p=st({draggable:c,home:d,draggables:r.draggables,viewport:s}),g=p.impact;return{phase:"DRAGGING",isDragging:!0,critical:n,movementMode:l,dimensions:r,initial:u,current:u,isWindowScrollAllowed:h,impact:g,afterCritical:p.afterCritical,onLiftImpact:g,viewport:s,scrollJumpRequest:null,forceShouldAnimate:null}}if("COLLECTION_STARTING"===t.type)return"COLLECTING"===e.phase||"DROP_PENDING"===e.phase?e:("DRAGGING"!==e.phase&&k(!1),o({phase:"COLLECTING"},e,{phase:"COLLECTING"}));if("PUBLISH_WHILE_DRAGGING"===t.type)return"COLLECTING"!==e.phase&&"DROP_PENDING"!==e.phase&&k(!1),function(e){var t=e.state,a=e.published;rt();var n=a.modified.map((function(e){var a=t.dimensions.droppables[e.droppableId];return $(a,e.scroll)})),i=o({},t.dimensions.droppables,{},Z(n)),s=ee(lt({additions:a.additions,updatedDroppables:i,viewport:t.viewport})),r=o({},t.dimensions.draggables,{},s);a.removals.forEach((function(e){delete r[e]}));var l={droppables:i,draggables:r},c=Ge(t.impact),d=c?l.droppables[c]:null,m=l.draggables[t.critical.draggable.id],u=l.droppables[t.critical.droppable.id],h=st({draggable:m,home:u,draggables:r,viewport:t.viewport}),p=h.impact,g=h.afterCritical,v=d&&d.isCombineEnabled?t.impact:p,b=Xe({pageOffset:t.current.page.offset,draggable:l.draggables[t.critical.draggable.id],draggables:l.draggables,droppables:l.droppables,previousImpact:v,viewport:t.viewport,afterCritical:g});ot();var f=o({phase:"DRAGGING"},t,{phase:"DRAGGING",impact:b,onLiftImpact:p,dimensions:l,afterCritical:g,forceShouldAnimate:!1});return"COLLECTING"===t.phase?f:o({phase:"DROP_PENDING"},f,{phase:"DROP_PENDING",reason:t.reason,isWaiting:!1})}({state:e,published:t.payload});if("MOVE"===t.type){if("DROP_PENDING"===e.phase)return e;qe(e)||k(!1);var v=t.payload.client;return U(v,e.current.client.selection)?e:tt({state:e,clientSelection:v,impact:ct(e)?e.impact:null})}if("UPDATE_DROPPABLE_SCROLL"===t.type){if("DROP_PENDING"===e.phase)return mt(e);if("COLLECTING"===e.phase)return mt(e);qe(e)||k(!1);var b=t.payload,f=b.id,y=b.newScroll,E=e.dimensions.droppables[f];if(!E)return e;var _=$(E,y);return dt(e,_,!1)}if("UPDATE_DROPPABLE_IS_ENABLED"===t.type){if("DROP_PENDING"===e.phase)return e;qe(e)||k(!1);var w=t.payload,S=w.id,O=w.isEnabled,C=e.dimensions.droppables[S];C||k(!1),C.isEnabled===O&&k(!1);var x=o({},C,{isEnabled:O});return dt(e,x,!0)}if("UPDATE_DROPPABLE_IS_COMBINE_ENABLED"===t.type){if("DROP_PENDING"===e.phase)return e;qe(e)||k(!1);var j=t.payload,R=j.id,I=j.isCombineEnabled,T=e.dimensions.droppables[R];T||k(!1),T.isCombineEnabled===I&&k(!1);var N=o({},T,{isCombineEnabled:I});return dt(e,N,!0)}if("MOVE_BY_WINDOW_SCROLL"===t.type){if("DROP_PENDING"===e.phase||"DROP_ANIMATING"===e.phase)return e;qe(e)||k(!1),e.isWindowScrollAllowed||k(!1);var P=t.payload.newScroll;if(U(e.viewport.scroll.current,P))return mt(e);var D=Pe(e.viewport,P);return ct(e)?it({state:e,viewport:D}):tt({state:e,viewport:D})}if("UPDATE_VIEWPORT_MAX_SCROLL"===t.type){if(!qe(e))return e;var L=t.payload.maxScroll;if(U(L,e.viewport.scroll.max))return e;var F=o({},e.viewport,{scroll:o({},e.viewport.scroll,{max:L})});return o({phase:"DRAGGING"},e,{viewport:F})}if("MOVE_UP"===t.type||"MOVE_DOWN"===t.type||"MOVE_LEFT"===t.type||"MOVE_RIGHT"===t.type){if("COLLECTING"===e.phase||"DROP_PENDING"===e.phase)return e;"DRAGGING"!==e.phase&&k(!1);var B=Ke({state:e,type:t.type});return B?tt({state:e,impact:B.impact,clientSelection:B.clientSelection,scrollJumpRequest:B.scrollJumpRequest}):e}if("DROP_PENDING"===t.type){var V=t.payload.reason;return"COLLECTING"!==e.phase&&k(!1),o({phase:"DROP_PENDING"},e,{phase:"DROP_PENDING",isWaiting:!0,reason:V})}if("DROP_ANIMATE"===t.type){var W=t.payload,H=W.completed,z=W.dropDuration,G=W.newHomeClientOffset;return"DRAGGING"!==e.phase&&"DROP_PENDING"!==e.phase&&k(!1),{phase:"DROP_ANIMATING",completed:H,dropDuration:z,newHomeClientOffset:G,dimensions:e.dimensions}}return"DROP_COMPLETE"===t.type?{phase:"IDLE",completed:t.payload.completed,shouldFlush:!1}:e},pt=function(e){return{type:"LIFT",payload:e}},gt=function(e){return{type:"PUBLISH_WHILE_DRAGGING",payload:e}},vt=function(){return{type:"COLLECTION_STARTING",payload:null}},bt=function(e){return{type:"UPDATE_DROPPABLE_SCROLL",payload:e}},ft=function(e){return{type:"UPDATE_DROPPABLE_IS_ENABLED",payload:e}},yt=function(e){return{type:"UPDATE_DROPPABLE_IS_COMBINE_ENABLED",payload:e}},Et=function(e){return{type:"MOVE",payload:e}},_t=function(){return{type:"MOVE_UP",payload:null}},wt=function(){return{type:"MOVE_DOWN",payload:null}},St=function(){return{type:"MOVE_RIGHT",payload:null}},Ot=function(){return{type:"MOVE_LEFT",payload:null}},Ct=function(){return{type:"FLUSH",payload:null}},xt=function(e){return{type:"DROP_COMPLETE",payload:e}},jt=function(e){return{type:"DROP",payload:e}},kt=function(){return{type:"DROP_ANIMATION_FINISHED",payload:null}};var Rt={outOfTheWay:"cubic-bezier(0.2, 0, 0, 1)",drop:"cubic-bezier(.2,1,.1,1)"},It={opacity:{drop:0,combining:.7},scale:{drop:.75}},Tt=.33,Nt=.55,Pt=.2+"s "+Rt.outOfTheWay,Dt={fluid:"opacity "+Pt,snap:"transform "+Pt+", opacity "+Pt,drop:function(e){var t=e+"s "+Rt.drop;return"transform "+t+", opacity "+t},outOfTheWay:"transform "+Pt,placeholder:"height "+Pt+", width "+Pt+", margin "+Pt},Mt=function(e){return U(e,M)?null:"translate("+e.x+"px, "+e.y+"px)"},At={moveTo:Mt,drop:function(e,t){var a=Mt(e);return a?t?a+" scale("+It.scale.drop+")":a:null}},Lt=Tt,Ut=Nt,Ft=Ut-Lt,Bt=function(e){var t=e.getState,a=e.dispatch;return function(e){return function(n){if("DROP"===n.type){var i=t(),s=n.payload.reason;if("COLLECTING"!==i.phase){if("IDLE"!==i.phase){"DROP_PENDING"===i.phase&&i.isWaiting&&k(!1),"DRAGGING"!==i.phase&&"DROP_PENDING"!==i.phase&&k(!1);var r=i.critical,l=i.dimensions,c=l.draggables[i.critical.draggable.id],d=function(e){var t=e.draggables,a=e.reason,n=e.lastImpact,i=e.home,s=e.viewport,r=e.onLiftImpact;return n.at&&"DROP"===a?"REORDER"===n.at.type?{impact:n,didDropInsideDroppable:!0}:{impact:o({},n,{displaced:ce}),didDropInsideDroppable:!0}:{impact:at({draggables:t,impact:r,destination:i,viewport:s,forceShouldAnimate:!0}),didDropInsideDroppable:!1}}({reason:s,lastImpact:i.impact,afterCritical:i.afterCritical,onLiftImpact:i.onLiftImpact,home:i.dimensions.droppables[i.critical.droppable.id],viewport:i.viewport,draggables:i.dimensions.draggables}),m=d.impact,u=d.didDropInsideDroppable,h=u?ie(m):null,p=u?se(m):null,g={index:r.draggable.index,droppableId:r.droppable.id},v={draggableId:c.descriptor.id,type:c.descriptor.type,source:g,reason:s,mode:i.movementMode,destination:h,combine:p},b=function(e){var t=e.impact,a=e.draggable,n=e.dimensions,i=e.viewport,s=e.afterCritical,r=n.draggables,o=n.droppables,l=Ge(t),c=l?o[l]:null,d=o[a.descriptor.droppableId],m=nt({impact:t,draggable:a,draggables:r,afterCritical:s,droppable:c||d,viewport:i});return L(m,a.client.borderBox.center)}({impact:m,draggable:c,dimensions:l,viewport:i.viewport,afterCritical:i.afterCritical}),f={critical:i.critical,afterCritical:i.afterCritical,result:v,impact:m};if(!U(i.current.client.offset,b)||Boolean(v.combine)){var y=function(e){var t=e.current,a=e.destination,n=e.reason,i=V(t,a);if(i<=0)return Lt;if(i>=1500)return Ut;var s=Lt+Ft*(i/1500);return Number(("CANCEL"===n?.6*s:s).toFixed(2))}({current:i.current.client.offset,destination:b,reason:s});a(function(e){return{type:"DROP_ANIMATE",payload:e}}({newHomeClientOffset:b,dropDuration:y,completed:f}))}else a(xt({completed:f}))}}else a(function(e){return{type:"DROP_PENDING",payload:e}}({reason:s}))}else e(n)}}},Vt=function(){return{x:window.pageXOffset,y:window.pageYOffset}};function Wt(e){var t=e.onWindowScroll;var a=h((function(){t(Vt())})),n=function(e){return{eventName:"scroll",options:{passive:!0,capture:!1},fn:function(t){t.target!==window&&t.target!==window.document||e()}}}(a),i=S;function s(){return i!==S}return{start:function(){s()&&k(!1),i=O(window,[n])},stop:function(){s()||k(!1),a.cancel(),i(),i=S},isActive:s}}var Ht=function(e){var t=Wt({onWindowScroll:function(t){e.dispatch({type:"MOVE_BY_WINDOW_SCROLL",payload:{newScroll:t}})}});return function(e){return function(a){t.isActive()||"INITIAL_PUBLISH"!==a.type||t.start(),t.isActive()&&function(e){return"DROP_COMPLETE"===e.type||"DROP_ANIMATE"===e.type||"FLUSH"===e.type}(a)&&t.stop(),e(a)}}},zt=function(){var e=[];return{add:function(t){var a=setTimeout((function(){return function(t){var a=J(e,(function(e){return e.timerId===t}));-1===a&&k(!1),e.splice(a,1)[0].callback()}(a)})),n={timerId:a,callback:t};e.push(n)},flush:function(){if(e.length){var t=[].concat(e);e.length=0,t.forEach((function(e){clearTimeout(e.timerId),e.callback()}))}}}},Gt=function(e,t){rt(),t(),ot()},Kt=function(e,t){return{draggableId:e.draggable.id,type:e.droppable.type,source:{droppableId:e.droppable.id,index:e.draggable.index},mode:t}},qt=function(e,t,a,n){if(e){var i=function(e){var t=!1,a=!1,n=setTimeout((function(){a=!0})),i=function(i){t||a||(t=!0,e(i),clearTimeout(n))};return i.wasCalled=function(){return t},i}(a);e(t,{announce:i}),i.wasCalled()||a(n(t))}else a(n(t))},$t=function(e,t){var a=function(e,t){var a=zt(),n=null,i=function(a){n||k(!1),n=null,Gt(0,(function(){return qt(e().onDragEnd,a,t,D.onDragEnd)}))};return{beforeCapture:function(t,a){n&&k(!1),Gt(0,(function(){var n=e().onBeforeCapture;n&&n({draggableId:t,mode:a})}))},beforeStart:function(t,a){n&&k(!1),Gt(0,(function(){var n=e().onBeforeDragStart;n&&n(Kt(t,a))}))},start:function(i,s){n&&k(!1);var r=Kt(i,s);n={mode:s,lastCritical:i,lastLocation:r.source,lastCombine:null},a.add((function(){Gt(0,(function(){return qt(e().onDragStart,r,t,D.onDragStart)}))}))},update:function(i,s){var r=ie(s),l=se(s);n||k(!1);var c=!function(e,t){if(e===t)return!0;var a=e.draggable.id===t.draggable.id&&e.draggable.droppableId===t.draggable.droppableId&&e.draggable.type===t.draggable.type&&e.draggable.index===t.draggable.index,n=e.droppable.id===t.droppable.id&&e.droppable.type===t.droppable.type;return a&&n}(i,n.lastCritical);c&&(n.lastCritical=i);var d,m,u=(m=r,!(null==(d=n.lastLocation)&&null==m||null!=d&&null!=m&&d.droppableId===m.droppableId&&d.index===m.index));u&&(n.lastLocation=r);var h=!function(e,t){return null==e&&null==t||null!=e&&null!=t&&e.draggableId===t.draggableId&&e.droppableId===t.droppableId}(n.lastCombine,l);if(h&&(n.lastCombine=l),c||u||h){var p=o({},Kt(i,n.mode),{combine:l,destination:r});a.add((function(){Gt(0,(function(){return qt(e().onDragUpdate,p,t,D.onDragUpdate)}))}))}},flush:function(){n||k(!1),a.flush()},drop:i,abort:function(){if(n){var e=o({},Kt(n.lastCritical,n.mode),{combine:null,destination:null,reason:"CANCEL"});i(e)}}}}(e,t);return function(e){return function(t){return function(n){if("BEFORE_INITIAL_CAPTURE"!==n.type){if("INITIAL_PUBLISH"===n.type){var i=n.payload.critical;return a.beforeStart(i,n.payload.movementMode),t(n),void a.start(i,n.payload.movementMode)}if("DROP_COMPLETE"===n.type){var s=n.payload.completed.result;return a.flush(),t(n),void a.drop(s)}if(t(n),"FLUSH"!==n.type){var r=e.getState();"DRAGGING"===r.phase&&a.update(r.critical,r.impact)}else a.abort()}else a.beforeCapture(n.payload.draggableId,n.payload.movementMode)}}}},Yt=function(e){return function(t){return function(a){if("DROP_ANIMATION_FINISHED"===a.type){var n=e.getState();"DROP_ANIMATING"!==n.phase&&k(!1),e.dispatch(xt({completed:n.completed}))}else t(a)}}},Jt=function(e){var t=null,a=null;return function(n){return function(i){if("FLUSH"!==i.type&&"DROP_COMPLETE"!==i.type&&"DROP_ANIMATION_FINISHED"!==i.type||(a&&(cancelAnimationFrame(a),a=null),t&&(t(),t=null)),n(i),"DROP_ANIMATE"===i.type){var s={eventName:"scroll",options:{capture:!0,passive:!1,once:!0},fn:function(){"DROP_ANIMATING"===e.getState().phase&&e.dispatch({type:"DROP_ANIMATION_FINISHED",payload:null})}};a=requestAnimationFrame((function(){a=null,t=O(window,[s])}))}}}},Qt=function(e){return function(t){return function(a){if(t(a),"PUBLISH_WHILE_DRAGGING"===a.type){var n=e.getState();"DROP_PENDING"===n.phase&&(n.isWaiting||e.dispatch(jt({reason:n.reason})))}}}},Xt=l.compose,Zt=function(e){var t,a=e.dimensionMarshal,n=e.focusMarshal,i=e.styleMarshal,s=e.getResponders,r=e.announce,o=e.autoScroller;return l.createStore(ht,Xt(l.applyMiddleware((t=i,function(){return function(e){return function(a){"INITIAL_PUBLISH"===a.type&&t.dragging(),"DROP_ANIMATE"===a.type&&t.dropping(a.payload.completed.result.reason),"FLUSH"!==a.type&&"DROP_COMPLETE"!==a.type||t.resting(),e(a)}}}),function(e){return function(){return function(t){return function(a){"DROP_COMPLETE"!==a.type&&"FLUSH"!==a.type&&"DROP_ANIMATE"!==a.type||e.stopPublishing(),t(a)}}}}(a),function(e){return function(t){var a=t.getState,n=t.dispatch;return function(t){return function(i){if("LIFT"===i.type){var s=i.payload,r=s.id,o=s.clientSelection,l=s.movementMode,c=a();"DROP_ANIMATING"===c.phase&&n(xt({completed:c.completed})),"IDLE"!==a().phase&&k(!1),n(Ct()),n({type:"BEFORE_INITIAL_CAPTURE",payload:{draggableId:r,movementMode:l}});var d={draggableId:r,scrollOptions:{shouldPublishImmediately:"SNAP"===l}},m=e.startPublishing(d),u=m.critical,h=m.dimensions,p=m.viewport;n({type:"INITIAL_PUBLISH",payload:{critical:u,dimensions:h,clientSelection:o,movementMode:l,viewport:p}})}else t(i)}}}}(a),Bt,Yt,Jt,Qt,function(e){return function(t){return function(a){return function(n){if(function(e){return"DROP_COMPLETE"===e.type||"DROP_ANIMATE"===e.type||"FLUSH"===e.type}(n))return e.stop(),void a(n);if("INITIAL_PUBLISH"===n.type){a(n);var i=t.getState();return"DRAGGING"!==i.phase&&k(!1),void e.start(i)}a(n),e.scroll(t.getState())}}}}(o),Ht,function(e){var t=!1;return function(){return function(a){return function(n){if("INITIAL_PUBLISH"===n.type)return t=!0,e.tryRecordFocus(n.payload.critical.draggable.id),a(n),void e.tryRestoreFocusRecorded();if(a(n),t){if("FLUSH"===n.type)return t=!1,void e.tryRestoreFocusRecorded();if("DROP_COMPLETE"===n.type){t=!1;var i=n.payload.completed.result;i.combine&&e.tryShiftRecord(i.draggableId,i.combine.draggableId),e.tryRestoreFocusRecorded()}}}}}}(n),$t(s,r))))},ea=function(){return{additions:{},removals:{},modified:{}}};var ta=function(e){var t=e.scrollHeight,a=e.scrollWidth,n=e.height,i=e.width,s=L({x:a,y:t},{x:i,y:n});return{x:Math.max(0,s.x),y:Math.max(0,s.y)}},aa=function(){var e=document.documentElement;return e||k(!1),e},na=function(){var e=aa();return ta({scrollHeight:e.scrollHeight,scrollWidth:e.scrollWidth,width:e.clientWidth,height:e.clientHeight})},ia=function(e){var t=e.critical,a=e.scrollOptions,n=e.registry;rt();var i=function(){var e=Vt(),t=na(),a=e.y,n=e.x,i=aa(),s=n+i.clientWidth,r=a+i.clientHeight;return{frame:m.getRect({top:a,left:n,right:s,bottom:r}),scroll:{initial:e,current:e,max:t,diff:{value:M,displacement:M}}}}(),s=i.scroll.current,r=t.droppable,o=n.droppable.getAllByType(r.type).map((function(e){return e.callbacks.getDimensionAndWatchScroll(s,a)})),l=n.draggable.getAllByType(t.draggable.type).map((function(e){return e.getDimension(s)})),c={draggables:ee(l),droppables:Z(o)};return ot(),{dimensions:c,critical:t,viewport:i}};function sa(e,t,a){return a.descriptor.id!==t.id&&(a.descriptor.type===t.type&&"virtual"===e.droppable.getById(a.descriptor.droppableId).descriptor.mode)}var ra,oa,la=function(e,t){var a=null,n=function(e){var t=e.registry,a=e.callbacks,n=ea(),i=null,s=function(){i||(a.collectionStarting(),i=requestAnimationFrame((function(){i=null,rt();var e=n,s=e.additions,r=e.removals,o=e.modified,l=Object.keys(s).map((function(e){return t.draggable.getById(e).getDimension(M)})).sort((function(e,t){return e.descriptor.index-t.descriptor.index})),c=Object.keys(o).map((function(e){return{droppableId:e,scroll:t.droppable.getById(e).callbacks.getScrollWhileDragging()}})),d={additions:l,removals:Object.keys(r),modified:c};n=ea(),ot(),a.publish(d)})))};return{add:function(e){var t=e.descriptor.id;n.additions[t]=e,n.modified[e.descriptor.droppableId]=!0,n.removals[t]&&delete n.removals[t],s()},remove:function(e){var t=e.descriptor;n.removals[t.id]=!0,n.modified[t.droppableId]=!0,n.additions[t.id]&&delete n.additions[t.id],s()},stop:function(){i&&(cancelAnimationFrame(i),i=null,n=ea())}}}({callbacks:{publish:t.publishWhileDragging,collectionStarting:t.collectionStarting},registry:e}),i=function(t){a||k(!1);var i=a.critical.draggable;"ADDITION"===t.type&&sa(e,i,t.value)&&n.add(t.value),"REMOVAL"===t.type&&sa(e,i,t.value)&&n.remove(t.value)},s={updateDroppableIsEnabled:function(n,i){e.droppable.exists(n)||k(!1),a&&t.updateDroppableIsEnabled({id:n,isEnabled:i})},updateDroppableIsCombineEnabled:function(n,i){a&&(e.droppable.exists(n)||k(!1),t.updateDroppableIsCombineEnabled({id:n,isCombineEnabled:i}))},scrollDroppable:function(t,n){a&&e.droppable.getById(t).callbacks.scroll(n)},updateDroppableScroll:function(n,i){a&&(e.droppable.exists(n)||k(!1),t.updateDroppableScroll({id:n,newScroll:i}))},startPublishing:function(t){a&&k(!1);var n=e.draggable.getById(t.draggableId),s=e.droppable.getById(n.descriptor.droppableId),r={draggable:n.descriptor,droppable:s.descriptor},o=e.subscribe(i);return a={critical:r,unsubscribe:o},ia({critical:r,registry:e,scrollOptions:t.scrollOptions})},stopPublishing:function(){if(a){n.stop();var t=a.critical.droppable;e.droppable.getAllByType(t.type).forEach((function(e){return e.callbacks.dragStopped()})),a.unsubscribe(),a=null}}};return s},ca=function(e,t){return"IDLE"===e.phase||"DROP_ANIMATING"===e.phase&&(e.completed.result.draggableId!==t&&"DROP"===e.completed.result.reason)},da=function(e){window.scrollBy(e.x,e.y)},ma=u((function(e){return te(e).filter((function(e){return!!e.isEnabled&&!!e.frame}))})),ua=function(e){var t=e.center,a=e.destination,n=e.droppables;if(a){var i=n[a];return i.frame?i:null}var s=function(e,t){var a=Q(ma(t),(function(t){return t.frame||k(!1),$e(t.frame.pageMarginBox)(e)}));return a}(t,n);return s},ha=.25,pa=.05,ga=28,va=function(e){return Math.pow(e,2)},ba={stopDampeningAt:1200,accelerateAt:360},fa=function(e){var t=e.startOfRange,a=e.endOfRange,n=e.current,i=a-t;return 0===i?0:(n-t)/i},ya=ba.accelerateAt,Ea=ba.stopDampeningAt,_a=function(e){var t=e.distanceToEdge,a=e.thresholds,n=e.dragStartTime,i=e.shouldUseTimeDampening,s=function(e,t){if(e>t.startScrollingFrom)return 0;if(e<=t.maxScrollValueAt)return ga;if(e===t.startScrollingFrom)return 1;var a=fa({startOfRange:t.maxScrollValueAt,endOfRange:t.startScrollingFrom,current:e}),n=ga*va(1-a);return Math.ceil(n)}(t,a);return 0===s?0:i?Math.max(function(e,t){var a=t,n=Ea,i=Date.now()-a;if(i>=Ea)return e;if(i<ya)return 1;var s=fa({startOfRange:ya,endOfRange:n,current:i}),r=e*va(s);return Math.ceil(r)}(s,n),1):s},wa=function(e){var t=e.container,a=e.distanceToEdges,n=e.dragStartTime,i=e.axis,s=e.shouldUseTimeDampening,r=function(e,t){return{startScrollingFrom:e[t.size]*ha,maxScrollValueAt:e[t.size]*pa}}(t,i);return a[i.end]<a[i.start]?_a({distanceToEdge:a[i.end],thresholds:r,dragStartTime:n,shouldUseTimeDampening:s}):-1*_a({distanceToEdge:a[i.start],thresholds:r,dragStartTime:n,shouldUseTimeDampening:s})},Sa=H((function(e){return 0===e?0:e})),Oa=function(e){var t=e.dragStartTime,a=e.container,n=e.subject,i=e.center,s=e.shouldUseTimeDampening,r={top:i.y-a.top,right:a.right-i.x,bottom:a.bottom-i.y,left:i.x-a.left},o=wa({container:a,distanceToEdges:r,dragStartTime:t,axis:pe,shouldUseTimeDampening:s}),l=wa({container:a,distanceToEdges:r,dragStartTime:t,axis:ge,shouldUseTimeDampening:s}),c=Sa({x:l,y:o});if(U(c,M))return null;var d=function(e){var t=e.container,a=e.subject,n=e.proposedScroll,i=a.height>t.height,s=a.width>t.width;return s||i?s&&i?null:{x:s?0:n.x,y:i?0:n.y}:n}({container:a,subject:n,proposedScroll:c});return d?U(d,M)?null:d:null},Ca=H((function(e){return 0===e?0:e>0?1:-1})),xa=(ra=function(e,t){return e<0?e:e>t?e-t:0},function(e){var t=e.current,a=e.max,n=e.change,i=A(t,n),s={x:ra(i.x,a.x),y:ra(i.y,a.y)};return U(s,M)?null:s}),ja=function(e){var t=e.max,a=e.current,n=e.change,i={x:Math.max(a.x,t.x),y:Math.max(a.y,t.y)},s=Ca(n),r=xa({max:i,current:a,change:s});return!r||(0!==s.x&&0===r.x||0!==s.y&&0===r.y)},ka=function(e,t){return ja({current:e.scroll.current,max:e.scroll.max,change:t})},Ra=function(e,t){var a=e.frame;return!!a&&ja({current:a.scroll.current,max:a.scroll.max,change:t})},Ia=function(e){var t=e.state,a=e.dragStartTime,n=e.shouldUseTimeDampening,i=e.scrollWindow,s=e.scrollDroppable,r=t.current.page.borderBoxCenter,o=t.dimensions.draggables[t.critical.draggable.id].page.marginBox;if(t.isWindowScrollAllowed){var l=function(e){var t=e.viewport,a=e.subject,n=e.center,i=e.dragStartTime,s=e.shouldUseTimeDampening,r=Oa({dragStartTime:i,container:t.frame,subject:a,center:n,shouldUseTimeDampening:s});return r&&ka(t,r)?r:null}({dragStartTime:a,viewport:t.viewport,subject:o,center:r,shouldUseTimeDampening:n});if(l)return void i(l)}var c=ua({center:r,destination:Ge(t.impact),droppables:t.dimensions.droppables});if(c){var d=function(e){var t=e.droppable,a=e.subject,n=e.center,i=e.dragStartTime,s=e.shouldUseTimeDampening,r=t.frame;if(!r)return null;var o=Oa({dragStartTime:i,container:r.pageMarginBox,subject:a,center:n,shouldUseTimeDampening:s});return o&&Ra(t,o)?o:null}({dragStartTime:a,droppable:c,subject:o,center:r,shouldUseTimeDampening:n});d&&s(c.descriptor.id,d)}},Ta=function(e){var t=e.move,a=e.scrollDroppable,n=e.scrollWindow,i=function(e,t){if(!Ra(e,t))return t;var n=function(e,t){var a=e.frame;return a&&Ra(e,t)?xa({current:a.scroll.current,max:a.scroll.max,change:t}):null}(e,t);if(!n)return a(e.descriptor.id,t),null;var i=L(t,n);return a(e.descriptor.id,i),L(t,i)},s=function(e,t,a){if(!e)return a;if(!ka(t,a))return a;var i=function(e,t){if(!ka(e,t))return null;var a=e.scroll.max,n=e.scroll.current;return xa({current:n,max:a,change:t})}(t,a);if(!i)return n(a),null;var s=L(a,i);return n(s),L(a,s)};return function(e){var a=e.scrollJumpRequest;if(a){var n=Ge(e.impact);n||k(!1);var r=i(e.dimensions.droppables[n],a);if(r){var o=e.viewport,l=s(e.isWindowScrollAllowed,o,r);l&&function(e,a){var n=A(e.current.client.selection,a);t({client:n})}(e,l)}}}},Na=function(e){var t=e.scrollDroppable,a=e.scrollWindow,n=e.move,i=function(e){var t=e.scrollWindow,a=e.scrollDroppable,n=h(t),i=h(a),s=null,r=function(e){s||k(!1);var t=s,a=t.shouldUseTimeDampening,r=t.dragStartTime;Ia({state:e,scrollWindow:n,scrollDroppable:i,dragStartTime:r,shouldUseTimeDampening:a})};return{start:function(e){rt(),s&&k(!1);var t=Date.now(),a=!1,n=function(){a=!0};Ia({state:e,dragStartTime:0,shouldUseTimeDampening:!1,scrollWindow:n,scrollDroppable:n}),s={dragStartTime:t,shouldUseTimeDampening:a},ot(),a&&r(e)},stop:function(){s&&(n.cancel(),i.cancel(),s=null)},scroll:r}}({scrollWindow:a,scrollDroppable:t}),s=Ta({move:n,scrollWindow:a,scrollDroppable:t});return{scroll:function(e){"DRAGGING"===e.phase&&("FLUID"!==e.movementMode?e.scrollJumpRequest&&s(e):i.scroll(e))},start:i.start,stop:i.stop}},Pa="data-rbd",Da={base:oa=Pa+"-drag-handle",draggableId:oa+"-draggable-id",contextId:oa+"-context-id"},Ma=function(){var e=Pa+"-draggable";return{base:e,contextId:e+"-context-id",id:e+"-id"}}(),Aa=function(){var e=Pa+"-droppable";return{base:e,contextId:e+"-context-id",id:e+"-id"}}(),La={contextId:Pa+"-scroll-container-context-id"},Ua=function(e,t){return e.map((function(e){var a=e.styles[t];return a?e.selector+" { "+a+" }":""})).join(" ")},Fa=function(e){var t,a,n,i=(t=e,function(e){return"["+e+'="'+t+'"]'}),s=(a="\n cursor: -webkit-grab;\n cursor: grab;\n ",{selector:i(Da.contextId),styles:{always:"\n -webkit-touch-callout: none;\n -webkit-tap-highlight-color: rgba(0,0,0,0);\n touch-action: manipulation;\n ",resting:a,dragging:"pointer-events: none;",dropAnimating:a}}),r=[(n="\n transition: "+Dt.outOfTheWay+";\n ",{selector:i(Ma.contextId),styles:{dragging:n,dropAnimating:n,userCancel:n}}),s,{selector:i(Aa.contextId),styles:{always:"overflow-anchor: none;"}},{selector:"body",styles:{dragging:"\n cursor: grabbing;\n cursor: -webkit-grabbing;\n user-select: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n overflow-anchor: none;\n "}}];return{always:Ua(r,"always"),resting:Ua(r,"resting"),dragging:Ua(r,"dragging"),dropAnimating:Ua(r,"dropAnimating"),userCancel:Ua(r,"userCancel")}},Ba="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?i.useLayoutEffect:i.useEffect,Va=function(){var e=document.querySelector("head");return e||k(!1),e},Wa=function(e){var t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.type="text/css",t};var Ha=function(e){return e&&e.ownerDocument?e.ownerDocument.defaultView:window};function za(e){return e instanceof Ha(e).HTMLElement}function Ga(e,t){var a="["+Da.contextId+'="'+e+'"]',n=X(document.querySelectorAll(a));if(!n.length)return null;var i=Q(n,(function(e){return e.getAttribute(Da.draggableId)===t}));return i&&za(i)?i:null}function Ka(){var e={draggables:{},droppables:{}},t=[];function a(e){t.length&&t.forEach((function(t){return t(e)}))}function n(t){return e.draggables[t]||null}function i(t){return e.droppables[t]||null}return{draggable:{register:function(t){e.draggables[t.descriptor.id]=t,a({type:"ADDITION",value:t})},update:function(t,a){var n=e.draggables[a.descriptor.id];n&&n.uniqueId===t.uniqueId&&(delete e.draggables[a.descriptor.id],e.draggables[t.descriptor.id]=t)},unregister:function(t){var i=t.descriptor.id,s=n(i);s&&t.uniqueId===s.uniqueId&&(delete e.draggables[i],a({type:"REMOVAL",value:t}))},getById:function(e){var t=n(e);return t||k(!1),t},findById:n,exists:function(e){return Boolean(n(e))},getAllByType:function(t){return Y(e.draggables).filter((function(e){return e.descriptor.type===t}))}},droppable:{register:function(t){e.droppables[t.descriptor.id]=t},unregister:function(t){var a=i(t.descriptor.id);a&&t.uniqueId===a.uniqueId&&delete e.droppables[t.descriptor.id]},getById:function(e){var t=i(e);return t||k(!1),t},findById:i,exists:function(e){return Boolean(i(e))},getAllByType:function(t){return Y(e.droppables).filter((function(e){return e.descriptor.type===t}))}},subscribe:function(e){return t.push(e),function(){var a=t.indexOf(e);-1!==a&&t.splice(a,1)}},clean:function(){e.draggables={},e.droppables={},t.length=0}}}var qa=s.createContext(null),$a=function(){var e=document.body;return e||k(!1),e},Ya={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},Ja=function(e){return"rbd-announcement-"+e};var Qa=0,Xa={separator:"::"};function Za(e,t){return void 0===t&&(t=Xa),d.useMemo((function(){return""+e+t.separator+Qa++}),[t.separator,e])}var en=s.createContext(null);function tn(e){0}function an(e,t){tn()}function nn(e){var t=i.useRef(e);return i.useEffect((function(){t.current=e})),t}var sn,rn=27,on=32,ln=37,cn=38,dn=39,mn=40,un=((sn={})[13]=!0,sn[9]=!0,sn),hn=function(e){un[e.keyCode]&&e.preventDefault()},pn=function(){var e="visibilitychange";return"undefined"==typeof document?e:Q([e,"ms"+e,"webkit"+e,"moz"+e,"o"+e],(function(e){return"on"+e in document}))||e}(),gn=0,vn=5;var bn,fn={type:"IDLE"};function yn(e){var t=e.cancel,a=e.completed,n=e.getPhase,i=e.setPhase;return[{eventName:"mousemove",fn:function(e){var t=e.button,a=e.clientX,s=e.clientY;if(t===gn){var r={x:a,y:s},o=n();if("DRAGGING"===o.type)return e.preventDefault(),void o.actions.move(r);"PENDING"!==o.type&&k(!1);var l=o.point;if(c=l,d=r,Math.abs(d.x-c.x)>=vn||Math.abs(d.y-c.y)>=vn){var c,d;e.preventDefault();var m=o.actions.fluidLift(r);i({type:"DRAGGING",actions:m})}}}},{eventName:"mouseup",fn:function(e){var i=n();"DRAGGING"===i.type?(e.preventDefault(),i.actions.drop({shouldBlockNextClick:!0}),a()):t()}},{eventName:"mousedown",fn:function(e){"DRAGGING"===n().type&&e.preventDefault(),t()}},{eventName:"keydown",fn:function(e){if("PENDING"!==n().type)return e.keyCode===rn?(e.preventDefault(),void t()):void hn(e);t()}},{eventName:"resize",fn:t},{eventName:"scroll",options:{passive:!0,capture:!1},fn:function(){"PENDING"===n().type&&t()}},{eventName:"webkitmouseforcedown",fn:function(e){var a=n();"IDLE"===a.type&&k(!1),a.actions.shouldRespectForcePress()?t():e.preventDefault()}},{eventName:pn,fn:t}]}function En(e){var t=i.useRef(fn),a=i.useRef(S),n=d.useMemo((function(){return{eventName:"mousedown",fn:function(t){if(!t.defaultPrevented&&t.button===gn&&!(t.ctrlKey||t.metaKey||t.shiftKey||t.altKey)){var n=e.findClosestDraggableId(t);if(n){var i=e.tryGetLock(n,o,{sourceEvent:t});if(i){t.preventDefault();var s={x:t.clientX,y:t.clientY};a.current(),m(i,s)}}}}}}),[e]),s=d.useMemo((function(){return{eventName:"webkitmouseforcewillbegin",fn:function(t){if(!t.defaultPrevented){var a=e.findClosestDraggableId(t);if(a){var n=e.findOptionsForDraggable(a);n&&(n.shouldRespectForcePress||e.canGetLock(a)&&t.preventDefault())}}}}}),[e]),r=d.useCallback((function(){a.current=O(window,[s,n],{passive:!1,capture:!0})}),[s,n]),o=d.useCallback((function(){"IDLE"!==t.current.type&&(t.current=fn,a.current(),r())}),[r]),l=d.useCallback((function(){var e=t.current;o(),"DRAGGING"===e.type&&e.actions.cancel({shouldBlockNextClick:!0}),"PENDING"===e.type&&e.actions.abort()}),[o]),c=d.useCallback((function(){var e=yn({cancel:l,completed:o,getPhase:function(){return t.current},setPhase:function(e){t.current=e}});a.current=O(window,e,{capture:!0,passive:!1})}),[l,o]),m=d.useCallback((function(e,a){"IDLE"!==t.current.type&&k(!1),t.current={type:"PENDING",point:a,actions:e},c()}),[c]);Ba((function(){return r(),function(){a.current()}}),[r])}function _n(){}var wn=((bn={})[34]=!0,bn[33]=!0,bn[36]=!0,bn[35]=!0,bn);function Sn(e,t){function a(){t(),e.cancel()}return[{eventName:"keydown",fn:function(n){return n.keyCode===rn?(n.preventDefault(),void a()):n.keyCode===on?(n.preventDefault(),t(),void e.drop()):n.keyCode===mn?(n.preventDefault(),void e.moveDown()):n.keyCode===cn?(n.preventDefault(),void e.moveUp()):n.keyCode===dn?(n.preventDefault(),void e.moveRight()):n.keyCode===ln?(n.preventDefault(),void e.moveLeft()):void(wn[n.keyCode]?n.preventDefault():hn(n))}},{eventName:"mousedown",fn:a},{eventName:"mouseup",fn:a},{eventName:"click",fn:a},{eventName:"touchstart",fn:a},{eventName:"resize",fn:a},{eventName:"wheel",fn:a,options:{passive:!0}},{eventName:pn,fn:a}]}function On(e){var t=i.useRef(_n),a=d.useMemo((function(){return{eventName:"keydown",fn:function(a){if(!a.defaultPrevented&&a.keyCode===on){var i=e.findClosestDraggableId(a);if(i){var s=e.tryGetLock(i,l,{sourceEvent:a});if(s){a.preventDefault();var r=!0,o=s.snapLift();t.current(),t.current=O(window,Sn(o,l),{capture:!0,passive:!1})}}}function l(){r||k(!1),r=!1,t.current(),n()}}}}),[e]),n=d.useCallback((function(){t.current=O(window,[a],{passive:!1,capture:!0})}),[a]);Ba((function(){return n(),function(){t.current()}}),[n])}var Cn={type:"IDLE"},xn=120,jn=.15;function kn(e){var t=i.useRef(Cn),a=i.useRef(S),n=d.useCallback((function(){return t.current}),[]),s=d.useCallback((function(e){t.current=e}),[]),r=d.useMemo((function(){return{eventName:"touchstart",fn:function(t){if(!t.defaultPrevented){var n=e.findClosestDraggableId(t);if(n){var i=e.tryGetLock(n,l,{sourceEvent:t});if(i){var s=t.touches[0],r={x:s.clientX,y:s.clientY};a.current(),h(i,r)}}}}}}),[e]),o=d.useCallback((function(){a.current=O(window,[r],{capture:!0,passive:!1})}),[r]),l=d.useCallback((function(){var e=t.current;"IDLE"!==e.type&&("PENDING"===e.type&&clearTimeout(e.longPressTimerId),s(Cn),a.current(),o())}),[o,s]),c=d.useCallback((function(){var e=t.current;l(),"DRAGGING"===e.type&&e.actions.cancel({shouldBlockNextClick:!0}),"PENDING"===e.type&&e.actions.abort()}),[l]),m=d.useCallback((function(){var e={capture:!0,passive:!1},t={cancel:c,completed:l,getPhase:n},i=O(window,function(e){var t=e.cancel,a=e.completed,n=e.getPhase;return[{eventName:"touchmove",options:{capture:!1},fn:function(e){var a=n();if("DRAGGING"===a.type){a.hasMoved=!0;var i=e.touches[0],s={x:i.clientX,y:i.clientY};e.preventDefault(),a.actions.move(s)}else t()}},{eventName:"touchend",fn:function(e){var i=n();"DRAGGING"===i.type?(e.preventDefault(),i.actions.drop({shouldBlockNextClick:!0}),a()):t()}},{eventName:"touchcancel",fn:function(e){"DRAGGING"===n().type?(e.preventDefault(),t()):t()}},{eventName:"touchforcechange",fn:function(e){var a=n();"IDLE"===a.type&&k(!1);var i=e.touches[0];if(i&&i.force>=jn){var s=a.actions.shouldRespectForcePress();if("PENDING"!==a.type)return s?a.hasMoved?void e.preventDefault():void t():void e.preventDefault();s&&t()}}},{eventName:pn,fn:t}]}(t),e),s=O(window,function(e){var t=e.cancel,a=e.getPhase;return[{eventName:"orientationchange",fn:t},{eventName:"resize",fn:t},{eventName:"contextmenu",fn:function(e){e.preventDefault()}},{eventName:"keydown",fn:function(e){"DRAGGING"===a().type?(e.keyCode===rn&&e.preventDefault(),t()):t()}},{eventName:pn,fn:t}]}(t),e);a.current=function(){i(),s()}}),[c,n,l]),u=d.useCallback((function(){var e=n();"PENDING"!==e.type&&k(!1);var t=e.actions.fluidLift(e.point);s({type:"DRAGGING",actions:t,hasMoved:!1})}),[n,s]),h=d.useCallback((function(e,t){"IDLE"!==n().type&&k(!1);var a=setTimeout(u,xn);s({type:"PENDING",point:t,actions:e,longPressTimerId:a}),m()}),[m,n,s,u]);Ba((function(){return o(),function(){a.current();var e=n();"PENDING"===e.type&&(clearTimeout(e.longPressTimerId),s(Cn))}}),[n,o,s]),Ba((function(){return O(window,[{eventName:"touchmove",fn:function(){},options:{capture:!1,passive:!1}}])}),[])}var Rn={input:!0,button:!0,textarea:!0,select:!0,option:!0,optgroup:!0,video:!0,audio:!0};function In(e,t){if(null==t)return!1;if(Boolean(Rn[t.tagName.toLowerCase()]))return!0;var a=t.getAttribute("contenteditable");return"true"===a||""===a||t!==e&&In(e,t.parentElement)}function Tn(e,t){var a=t.target;return!!za(a)&&In(e,a)}var Nn=function(e){return m.getRect(e.getBoundingClientRect()).center};var Pn=function(){var e="matches";return"undefined"==typeof document?e:Q([e,"msMatchesSelector","webkitMatchesSelector"],(function(e){return e in Element.prototype}))||e}();function Dn(e,t){return null==e?null:e[Pn](t)?e:Dn(e.parentElement,t)}function Mn(e,t){return e.closest?e.closest(t):Dn(e,t)}function An(e,t){var a,n=t.target;if(!((a=n)instanceof Ha(a).Element))return null;var i=function(e){return"["+Da.contextId+'="'+e+'"]'}(e),s=Mn(n,i);return s&&za(s)?s:null}function Ln(e){e.preventDefault()}function Un(e){var t=e.expected,a=e.phase,n=e.isLockActive;e.shouldWarn;return!!n()&&t===a}function Fn(e){var t=e.lockAPI,a=e.store,n=e.registry,i=e.draggableId;if(t.isClaimed())return!1;var s=n.draggable.findById(i);return!!s&&(!!s.options.isEnabled&&!!ca(a.getState(),i))}function Bn(e){var t=e.lockAPI,a=e.contextId,n=e.store,i=e.registry,s=e.draggableId,r=e.forceSensorStop,l=e.sourceEvent;if(!Fn({lockAPI:t,store:n,registry:i,draggableId:s}))return null;var c=i.draggable.getById(s),d=function(e,t){var a="["+Ma.contextId+'="'+e+'"]',n=Q(X(document.querySelectorAll(a)),(function(e){return e.getAttribute(Ma.id)===t}));return n&&za(n)?n:null}(a,c.descriptor.id);if(!d)return null;if(l&&!c.options.canDragInteractiveElements&&Tn(d,l))return null;var m=t.claim(r||S),u="PRE_DRAG";function p(){return c.options.shouldRespectForcePress}function g(){return t.isActive(m)}var v=function(e,t){Un({expected:e,phase:u,isLockActive:g,shouldWarn:!0})&&n.dispatch(t())}.bind(null,"DRAGGING");function b(e){function a(){t.release(),u="COMPLETED"}function i(t,i){if(void 0===i&&(i={shouldBlockNextClick:!1}),e.cleanup(),i.shouldBlockNextClick){var s=O(window,[{eventName:"click",fn:Ln,options:{once:!0,passive:!1,capture:!0}}]);setTimeout(s)}a(),n.dispatch(jt({reason:t}))}return"PRE_DRAG"!==u&&(a(),"PRE_DRAG"!==u&&k(!1)),n.dispatch(pt(e.liftActionArgs)),u="DRAGGING",o({isActive:function(){return Un({expected:"DRAGGING",phase:u,isLockActive:g,shouldWarn:!1})},shouldRespectForcePress:p,drop:function(e){return i("DROP",e)},cancel:function(e){return i("CANCEL",e)}},e.actions)}return{isActive:function(){return Un({expected:"PRE_DRAG",phase:u,isLockActive:g,shouldWarn:!1})},shouldRespectForcePress:p,fluidLift:function(e){var t=h((function(e){v((function(){return Et({client:e})}))})),a=b({liftActionArgs:{id:s,clientSelection:e,movementMode:"FLUID"},cleanup:function(){return t.cancel()},actions:{move:t}});return o({},a,{move:t})},snapLift:function(){var e={moveUp:function(){return v(_t)},moveRight:function(){return v(St)},moveDown:function(){return v(wt)},moveLeft:function(){return v(Ot)}};return b({liftActionArgs:{id:s,clientSelection:Nn(d),movementMode:"SNAP"},cleanup:S,actions:e})},abort:function(){Un({expected:"PRE_DRAG",phase:u,isLockActive:g,shouldWarn:!0})&&t.release()}}}var Vn=[En,On,kn];function Wn(e){var t=e.contextId,a=e.store,n=e.registry,s=e.customSensors,r=e.enableDefaultSensors,o=[].concat(r?Vn:[],s||[]),l=i.useState((function(){return function(){var e=null;function t(){e||k(!1),e=null}return{isClaimed:function(){return Boolean(e)},isActive:function(t){return t===e},claim:function(t){e&&k(!1);var a={abandon:t};return e=a,a},release:t,tryAbandon:function(){e&&(e.abandon(),t())}}}()}))[0],c=d.useCallback((function(e,t){e.isDragging&&!t.isDragging&&l.tryAbandon()}),[l]);Ba((function(){var e=a.getState();return a.subscribe((function(){var t=a.getState();c(e,t),e=t}))}),[l,a,c]),Ba((function(){return l.tryAbandon}),[l.tryAbandon]);var m=d.useCallback((function(e){return Fn({lockAPI:l,registry:n,store:a,draggableId:e})}),[l,n,a]),u=d.useCallback((function(e,i,s){return Bn({lockAPI:l,registry:n,contextId:t,store:a,draggableId:e,forceSensorStop:i,sourceEvent:s&&s.sourceEvent?s.sourceEvent:null})}),[t,l,n,a]),h=d.useCallback((function(e){return function(e,t){var a=An(e,t);return a?a.getAttribute(Da.draggableId):null}(t,e)}),[t]),p=d.useCallback((function(e){var t=n.draggable.findById(e);return t?t.options:null}),[n.draggable]),g=d.useCallback((function(){l.isClaimed()&&(l.tryAbandon(),"IDLE"!==a.getState().phase&&a.dispatch(Ct()))}),[l,a]),v=d.useCallback(l.isClaimed,[l]),b=d.useMemo((function(){return{canGetLock:m,tryGetLock:u,findClosestDraggableId:h,findOptionsForDraggable:p,tryReleaseLock:g,isLockClaimed:v}}),[m,u,h,p,g,v]);tn();for(var f=0;f<o.length;f++)o[f](b)}var Hn=function(e){return{onBeforeCapture:e.onBeforeCapture,onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragEnd:e.onDragEnd,onDragUpdate:e.onDragUpdate}};function zn(e){return e.current||k(!1),e.current}function Gn(e){var t=e.contextId,a=e.setCallbacks,n=e.sensors,r=e.nonce,m=e.dragHandleUsageInstructions,h=i.useRef(null);an();var p=nn(e),g=d.useCallback((function(){return Hn(p.current)}),[p]),v=function(e){var t=d.useMemo((function(){return Ja(e)}),[e]),a=i.useRef(null);return i.useEffect((function(){var e=document.createElement("div");return a.current=e,e.id=t,e.setAttribute("aria-live","assertive"),e.setAttribute("aria-atomic","true"),o(e.style,Ya),$a().appendChild(e),function(){setTimeout((function(){var t=$a();t.contains(e)&&t.removeChild(e),e===a.current&&(a.current=null)}))}}),[t]),d.useCallback((function(e){var t=a.current;t&&(t.textContent=e)}),[])}(t),b=function(e){var t=e.contextId,a=e.text,n=Za("hidden-text",{separator:"-"}),s=d.useMemo((function(){return"rbd-hidden-text-"+(e={contextId:t,uniqueId:n}).contextId+"-"+e.uniqueId;var e}),[n,t]);return i.useEffect((function(){var e=document.createElement("div");return e.id=s,e.textContent=a,e.style.display="none",$a().appendChild(e),function(){var t=$a();t.contains(e)&&t.removeChild(e)}}),[s,a]),s}({contextId:t,text:m}),f=function(e,t){var a=d.useMemo((function(){return Fa(e)}),[e]),n=i.useRef(null),s=i.useRef(null),r=d.useCallback(u((function(e){var t=s.current;t||k(!1),t.textContent=e})),[]),o=d.useCallback((function(e){var t=n.current;t||k(!1),t.textContent=e}),[]);Ba((function(){(n.current||s.current)&&k(!1);var i=Wa(t),l=Wa(t);return n.current=i,s.current=l,i.setAttribute(Pa+"-always",e),l.setAttribute(Pa+"-dynamic",e),Va().appendChild(i),Va().appendChild(l),o(a.always),r(a.resting),function(){var e=function(e){var t=e.current;t||k(!1),Va().removeChild(t),e.current=null};e(n),e(s)}}),[t,o,r,a.always,a.resting,e]);var l=d.useCallback((function(){return r(a.dragging)}),[r,a.dragging]),c=d.useCallback((function(e){r("DROP"!==e?a.userCancel:a.dropAnimating)}),[r,a.dropAnimating,a.userCancel]),m=d.useCallback((function(){s.current&&r(a.resting)}),[r,a.resting]);return d.useMemo((function(){return{dragging:l,dropping:c,resting:m}}),[l,c,m])}(t,r),y=d.useCallback((function(e){zn(h).dispatch(e)}),[]),E=d.useMemo((function(){return l.bindActionCreators({publishWhileDragging:gt,updateDroppableScroll:bt,updateDroppableIsEnabled:ft,updateDroppableIsCombineEnabled:yt,collectionStarting:vt},y)}),[y]),_=function(){var e=d.useMemo(Ka,[]);return i.useEffect((function(){return function(){requestAnimationFrame(e.clean)}}),[e]),e}(),w=d.useMemo((function(){return la(_,E)}),[_,E]),S=d.useMemo((function(){return Na(o({scrollWindow:da,scrollDroppable:w.scrollDroppable},l.bindActionCreators({move:Et},y)))}),[w.scrollDroppable,y]),O=function(e){var t=i.useRef({}),a=i.useRef(null),n=i.useRef(null),s=i.useRef(!1),r=d.useCallback((function(e,a){var n={id:e,focus:a};return t.current[e]=n,function(){var a=t.current;a[e]!==n&&delete a[e]}}),[]),o=d.useCallback((function(t){var a=Ga(e,t);a&&a!==document.activeElement&&a.focus()}),[e]),l=d.useCallback((function(e,t){a.current===e&&(a.current=t)}),[]),c=d.useCallback((function(){n.current||s.current&&(n.current=requestAnimationFrame((function(){n.current=null;var e=a.current;e&&o(e)})))}),[o]),m=d.useCallback((function(e){a.current=null;var t=document.activeElement;t&&t.getAttribute(Da.draggableId)===e&&(a.current=e)}),[]);return Ba((function(){return s.current=!0,function(){s.current=!1;var e=n.current;e&&cancelAnimationFrame(e)}}),[]),d.useMemo((function(){return{register:r,tryRecordFocus:m,tryRestoreFocusRecorded:c,tryShiftRecord:l}}),[r,m,c,l])}(t),C=d.useMemo((function(){return Zt({announce:v,autoScroller:S,dimensionMarshal:w,focusMarshal:O,getResponders:g,styleMarshal:f})}),[v,S,w,O,g,f]);h.current=C;var x=d.useCallback((function(){var e=zn(h);"IDLE"!==e.getState().phase&&e.dispatch(Ct())}),[]),j=d.useCallback((function(){var e=zn(h).getState();return e.isDragging||"DROP_ANIMATING"===e.phase}),[]);a(d.useMemo((function(){return{isDragging:j,tryAbort:x}}),[j,x]));var R=d.useCallback((function(e){return ca(zn(h).getState(),e)}),[]),I=d.useCallback((function(){return qe(zn(h).getState())}),[]),T=d.useMemo((function(){return{marshal:w,focus:O,contextId:t,canLift:R,isMovementAllowed:I,dragHandleUsageInstructionsId:b,registry:_}}),[t,w,b,O,R,I,_]);return Wn({contextId:t,store:C,registry:_,customSensors:n,enableDefaultSensors:!1!==e.enableDefaultSensors}),i.useEffect((function(){return x}),[x]),s.createElement(en.Provider,{value:T},s.createElement(c.Provider,{context:qa,store:C},e.children))}var Kn=0;var qn=function(e){return function(t){return e===t}},$n=qn("scroll"),Yn=qn("auto"),Jn=(qn("visible"),function(e,t){return t(e.overflowX)||t(e.overflowY)}),Qn=function(e){var t=window.getComputedStyle(e),a={overflowX:t.overflowX,overflowY:t.overflowY};return Jn(a,$n)||Jn(a,Yn)},Xn=function e(t){return null==t||t===document.body||t===document.documentElement?null:Qn(t)?t:e(t.parentElement)},Zn=function(e){return{x:e.scrollLeft,y:e.scrollTop}},ei=function e(t){return!!t&&("fixed"===window.getComputedStyle(t).position||e(t.parentElement))},ti=function(e){return{closestScrollable:Xn(e),isFixedOnPage:ei(e)}},ai=function(e){var t=e.ref,a=e.descriptor,n=e.env,i=e.windowScroll,s=e.direction,r=e.isDropDisabled,o=e.isCombineEnabled,l=e.shouldClipSubject,c=n.closestScrollable,d=function(e,t){var a=m.getBox(e);if(!t)return a;if(e!==t)return a;var n=a.paddingBox.top-t.scrollTop,i=a.paddingBox.left-t.scrollLeft,s=n+t.scrollHeight,r={top:n,right:i+t.scrollWidth,bottom:s,left:i},o=m.expand(r,a.border);return m.createBox({borderBox:o,margin:a.margin,border:a.border,padding:a.padding})}(t,c),u=m.withScroll(d,i),h=function(){if(!c)return null;var e=m.getBox(c),t={scrollHeight:c.scrollHeight,scrollWidth:c.scrollWidth};return{client:e,page:m.withScroll(e,i),scroll:Zn(c),scrollSize:t,shouldClipSubject:l}}(),p=function(e){var t=e.descriptor,a=e.isEnabled,n=e.isCombineEnabled,i=e.isFixedOnPage,s=e.direction,r=e.client,o=e.page,l=e.closest,c=function(){if(!l)return null;var e=l.scrollSize,t=l.client,a=ta({scrollHeight:e.scrollHeight,scrollWidth:e.scrollWidth,height:t.paddingBox.height,width:t.paddingBox.width});return{pageMarginBox:l.page.marginBox,frameClient:t,scrollSize:e,shouldClipSubject:l.shouldClipSubject,scroll:{initial:l.scroll,current:l.scroll,max:a,diff:{value:M,displacement:M}}}}(),d="vertical"===s?pe:ge;return{descriptor:t,isCombineEnabled:n,isFixedOnPage:i,axis:d,isEnabled:a,client:r,page:o,frame:c,subject:q({page:o,withPlaceholder:null,axis:d,frame:c})}}({descriptor:a,isEnabled:!r,isCombineEnabled:o,isFixedOnPage:n.isFixedOnPage,direction:s,client:d,page:u,closest:h});return p},ni={passive:!1},ii={passive:!0},si=function(e){return e.shouldPublishImmediately?ni:ii};function ri(e){var t=i.useContext(e);return t||k(!1),t}var oi=function(e){return e&&e.env.closestScrollable||null};function li(){}var ci={width:0,height:0,margin:{top:0,right:0,bottom:0,left:0}},di=function(e){var t=e.isAnimatingOpenOnMount,a=e.placeholder,n=e.animate,i=function(e){var t=e.isAnimatingOpenOnMount,a=e.placeholder,n=e.animate;return t||"close"===n?ci:{height:a.client.borderBox.height,width:a.client.borderBox.width,margin:a.client.margin}}({isAnimatingOpenOnMount:t,placeholder:a,animate:n});return{display:a.display,boxSizing:"border-box",width:i.width,height:i.height,marginTop:i.margin.top,marginRight:i.margin.right,marginBottom:i.margin.bottom,marginLeft:i.margin.left,flexShrink:"0",flexGrow:"0",pointerEvents:"none",transition:"none"!==n?Dt.placeholder:null}};var mi=s.memo((function(e){var t=i.useRef(null),a=d.useCallback((function(){t.current&&(clearTimeout(t.current),t.current=null)}),[]),n=e.animate,r=e.onTransitionEnd,o=e.onClose,l=e.contextId,c=i.useState("open"===e.animate),m=c[0],u=c[1];i.useEffect((function(){return m?"open"!==n?(a(),u(!1),li):t.current?li:(t.current=setTimeout((function(){t.current=null,u(!1)})),a):li}),[n,m,a]);var h=d.useCallback((function(e){"height"===e.propertyName&&(r(),"close"===n&&o())}),[n,o,r]),p=di({isAnimatingOpenOnMount:m,animate:e.animate,placeholder:e.placeholder});return s.createElement(e.placeholder.tagName,{style:p,"data-rbd-placeholder-context-id":l,onTransitionEnd:h,ref:e.innerRef})})),ui=s.createContext(null);var hi=function(e){function t(){for(var t,a=arguments.length,n=new Array(a),i=0;i<a;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).state={isVisible:Boolean(t.props.on),data:t.props.on,animate:t.props.shouldAnimate&&t.props.on?"open":"none"},t.onClose=function(){"close"===t.state.animate&&t.setState({isVisible:!1})},t}return r(t,e),t.getDerivedStateFromProps=function(e,t){return e.shouldAnimate?e.on?{isVisible:!0,data:e.on,animate:"open"}:t.isVisible?{isVisible:!0,data:t.data,animate:"close"}:{isVisible:!1,animate:"close",data:null}:{isVisible:Boolean(e.on),data:e.on,animate:"none"}},t.prototype.render=function(){if(!this.state.isVisible)return null;var e={onClose:this.onClose,data:this.state.data,animate:this.state.animate};return this.props.children(e)},t}(s.PureComponent),pi={dragging:5e3,dropAnimating:4500},gi=function(e,t){return t?Dt.drop(t.duration):e?Dt.snap:Dt.fluid},vi=function(e,t){return e?t?It.opacity.drop:It.opacity.combining:null},bi=function(e){return null!=e.forceShouldAnimate?e.forceShouldAnimate:"SNAP"===e.mode};function fi(e){return"DRAGGING"===e.type?(n=(a=e).dimension.client,i=a.offset,s=a.combineWith,r=a.dropping,o=Boolean(s),l=bi(a),c=Boolean(r),d=c?At.drop(i,o):At.moveTo(i),{position:"fixed",top:n.marginBox.top,left:n.marginBox.left,boxSizing:"border-box",width:n.borderBox.width,height:n.borderBox.height,transition:gi(l,r),transform:d,opacity:vi(o,c),zIndex:c?pi.dropAnimating:pi.dragging,pointerEvents:"none"}):(t=e,{transform:At.moveTo(t.offset),transition:t.shouldAnimateDisplacement?null:"none"});var t,a,n,i,s,r,o,l,c,d}function yi(e){var t=Za("draggable"),a=e.descriptor,n=e.registry,s=e.getDraggableRef,r=e.canDragInteractiveElements,o=e.shouldRespectForcePress,l=e.isEnabled,c=d.useMemo((function(){return{canDragInteractiveElements:r,shouldRespectForcePress:o,isEnabled:l}}),[r,l,o]),u=d.useCallback((function(e){var t=s();return t||k(!1),function(e,t,a){void 0===a&&(a=M);var n=window.getComputedStyle(t),i=t.getBoundingClientRect(),s=m.calculateBox(i,n),r=m.withScroll(s,a);return{descriptor:e,placeholder:{client:s,tagName:t.tagName.toLowerCase(),display:n.display},displaceBy:{x:s.marginBox.width,y:s.marginBox.height},client:s,page:r}}(a,t,e)}),[a,s]),h=d.useMemo((function(){return{uniqueId:t,descriptor:a,options:c,getDimension:u}}),[a,u,c,t]),p=i.useRef(h),g=i.useRef(!0);Ba((function(){return n.draggable.register(p.current),function(){return n.draggable.unregister(p.current)}}),[n.draggable]),Ba((function(){if(g.current)g.current=!1;else{var e=p.current;p.current=h,n.draggable.update(h,e)}}),[h,n.draggable])}function Ei(e,t,a){an()}function _i(e){e.preventDefault()}var wi=function(e,t){return e===t},Si=function(e){var t=e.combine,a=e.destination;return a?a.droppableId:t?t.droppableId:null},Oi=function(e){return e.combine?e.combine.draggableId:null},Ci=function(e){return e.at&&"COMBINE"===e.at.type?e.at.combine.draggableId:null};function xi(e){return{isDragging:!1,isDropAnimating:!1,isClone:!1,dropAnimation:null,mode:null,draggingOver:null,combineTargetFor:e,combineWith:null}}var ji={mapped:{type:"SECONDARY",offset:M,combineTargetFor:null,shouldAnimateDisplacement:!0,snapshot:xi(null)}};var ki={dropAnimationFinished:kt},Ri=c.connect((function(){var e,t,a,n=(e=u((function(e,t){return{x:e,y:t}})),t=u((function(e,t,a,n,i){return{isDragging:!0,isClone:t,isDropAnimating:Boolean(i),dropAnimation:i,mode:e,draggingOver:a,combineWith:n,combineTargetFor:null}})),a=u((function(e,a,n,i,s,r,o){return{mapped:{type:"DRAGGING",dropping:null,draggingOver:s,combineWith:r,mode:a,offset:e,dimension:n,forceShouldAnimate:o,snapshot:t(a,i,s,r,null)}}})),function(n,i){if(n.isDragging){if(n.critical.draggable.id!==i.draggableId)return null;var s=n.current.client.offset,r=n.dimensions.draggables[i.draggableId],o=Ge(n.impact),l=Ci(n.impact),c=n.forceShouldAnimate;return a(e(s.x,s.y),n.movementMode,r,i.isClone,o,l,c)}if("DROP_ANIMATING"===n.phase){var d=n.completed;if(d.result.draggableId!==i.draggableId)return null;var m=i.isClone,u=n.dimensions.draggables[i.draggableId],h=d.result,p=h.mode,g=Si(h),v=Oi(h),b={duration:n.dropDuration,curve:Rt.drop,moveTo:n.newHomeClientOffset,opacity:v?It.opacity.drop:null,scale:v?It.scale.drop:null};return{mapped:{type:"DRAGGING",offset:n.newHomeClientOffset,dimension:u,dropping:b,draggingOver:g,combineWith:v,mode:p,forceShouldAnimate:null,snapshot:t(p,m,g,v,b)}}}return null}),i=function(){var e=u((function(e,t){return{x:e,y:t}})),t=u(xi),a=u((function(e,a,n){return void 0===a&&(a=null),{mapped:{type:"SECONDARY",offset:e,combineTargetFor:a,shouldAnimateDisplacement:n,snapshot:t(a)}}})),n=function(e){return e?a(M,e,!0):null},i=function(t,i,s,r){var o=s.displaced.visible[t],l=Boolean(r.inVirtualList&&r.effected[t]),c=se(s),d=c&&c.draggableId===t?i:null;if(!o){if(!l)return n(d);if(s.displaced.invisible[t])return null;var m=F(r.displacedBy.point),u=e(m.x,m.y);return a(u,d,!0)}if(l)return n(d);var h=s.displacedBy.point,p=e(h.x,h.y);return a(p,d,o.shouldAnimate)};return function(e,t){if(e.isDragging)return e.critical.draggable.id===t.draggableId?null:i(t.draggableId,e.critical.draggable.id,e.impact,e.afterCritical);if("DROP_ANIMATING"===e.phase){var a=e.completed;return a.result.draggableId===t.draggableId?null:i(t.draggableId,a.result.draggableId,a.impact,a.afterCritical)}return null}}();return function(e,t){return n(e,t)||i(e,t)||ji}}),ki,null,{context:qa,pure:!0,areStatePropsEqual:wi})((function(e){var t=i.useRef(null),a=d.useCallback((function(e){t.current=e}),[]),n=d.useCallback((function(){return t.current}),[]),s=ri(en),r=s.contextId,o=s.dragHandleUsageInstructionsId,l=s.registry,c=ri(ui),m=c.type,u=c.droppableId,h=d.useMemo((function(){return{id:e.draggableId,index:e.index,type:m,droppableId:u}}),[e.draggableId,e.index,m,u]),p=e.children,g=e.draggableId,v=e.isEnabled,b=e.shouldRespectForcePress,f=e.canDragInteractiveElements,y=e.isClone,E=e.mapped,_=e.dropAnimationFinished;Ei(),tn(),y||yi(d.useMemo((function(){return{descriptor:h,registry:l,getDraggableRef:n,canDragInteractiveElements:f,shouldRespectForcePress:b,isEnabled:v}}),[h,l,n,f,b,v]));var w=d.useMemo((function(){return v?{tabIndex:0,role:"button","aria-describedby":o,"data-rbd-drag-handle-draggable-id":g,"data-rbd-drag-handle-context-id":r,draggable:!1,onDragStart:_i}:null}),[r,o,g,v]),S=d.useCallback((function(e){"DRAGGING"===E.type&&E.dropping&&"transform"===e.propertyName&&_()}),[_,E]),O=d.useMemo((function(){var e=fi(E),t="DRAGGING"===E.type&&E.dropping?S:null;return{innerRef:a,draggableProps:{"data-rbd-draggable-context-id":r,"data-rbd-draggable-id":g,style:e,onTransitionEnd:t},dragHandleProps:w}}),[r,w,g,E,S,a]),C=d.useMemo((function(){return{draggableId:h.id,type:h.type,source:{index:h.index,droppableId:h.droppableId}}}),[h.droppableId,h.id,h.index,h.type]);return p(O,E.snapshot,C)}));function Ii(e){return ri(ui).isUsingCloneFor!==e.draggableId||e.isClone?s.createElement(Ri,e):null}var Ti=function(e,t){return e===t.droppable.type},Ni=function(e,t){return t.draggables[e.draggable.id]},Pi={updateViewportMaxScroll:function(e){return{type:"UPDATE_VIEWPORT_MAX_SCROLL",payload:e}}};var Di={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:function(){return document.body||k(!1),document.body}},Mi=c.connect((function(){var e={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null,isUsingPlaceholder:!1},useClone:null},t=o({},e,{shouldAnimatePlaceholder:!1}),a=u((function(e){return{draggableId:e.id,type:e.type,source:{index:e.index,droppableId:e.droppableId}}})),n=u((function(n,i,s,r,o,l){var c=o.descriptor.id;if(o.descriptor.droppableId===n){var d=l?{render:l,dragging:a(o.descriptor)}:null,m={isDraggingOver:s,draggingOverWith:s?c:null,draggingFromThisWith:c,isUsingPlaceholder:!0};return{placeholder:o.placeholder,shouldAnimatePlaceholder:!1,snapshot:m,useClone:d}}if(!i)return t;if(!r)return e;var u={isDraggingOver:s,draggingOverWith:c,draggingFromThisWith:null,isUsingPlaceholder:!0};return{placeholder:o.placeholder,shouldAnimatePlaceholder:!0,snapshot:u,useClone:null}}));return function(a,i){var s=i.droppableId,r=i.type,o=!i.isDropDisabled,l=i.renderClone;if(a.isDragging){var c=a.critical;if(!Ti(r,c))return t;var d=Ni(c,a.dimensions),m=Ge(a.impact)===s;return n(s,o,m,m,d,l)}if("DROP_ANIMATING"===a.phase){var u=a.completed;if(!Ti(r,u.critical))return t;var h=Ni(u.critical,a.dimensions);return n(s,o,Si(u.result)===s,Ge(u.impact)===s,h,l)}if("IDLE"===a.phase&&a.completed&&!a.shouldFlush){var p=a.completed;if(!Ti(r,p.critical))return t;var g=Ge(p.impact)===s,v=Boolean(p.impact.at&&"COMBINE"===p.impact.at.type),b=p.critical.droppable.id===s;return g?v?e:t:b?e:t}return t}}),Pi,null,{context:qa,pure:!0,areStatePropsEqual:wi})((function(e){var t=i.useContext(en);t||k(!1);var a=t.contextId,n=t.isMovementAllowed,r=i.useRef(null),o=i.useRef(null),l=e.children,c=e.droppableId,m=e.type,g=e.mode,v=e.direction,b=e.ignoreContainerClipping,f=e.isDropDisabled,y=e.isCombineEnabled,E=e.snapshot,_=e.useClone,w=e.updateViewportMaxScroll,S=e.getContainerForClone,O=d.useCallback((function(){return r.current}),[]),C=d.useCallback((function(e){r.current=e}),[]),x=(d.useCallback((function(){return o.current}),[]),d.useCallback((function(e){o.current=e}),[]));an();var j=d.useCallback((function(){n()&&w({maxScroll:na()})}),[n,w]);!function(e){var t=i.useRef(null),a=ri(en),n=Za("droppable"),s=a.registry,r=a.marshal,o=nn(e),l=d.useMemo((function(){return{id:e.droppableId,type:e.type,mode:e.mode}}),[e.droppableId,e.mode,e.type]),c=i.useRef(l),m=d.useMemo((function(){return u((function(e,a){t.current||k(!1);var n={x:e,y:a};r.updateDroppableScroll(l.id,n)}))}),[l.id,r]),p=d.useCallback((function(){var e=t.current;return e&&e.env.closestScrollable?Zn(e.env.closestScrollable):M}),[]),g=d.useCallback((function(){var e=p();m(e.x,e.y)}),[p,m]),v=d.useMemo((function(){return h(g)}),[g]),b=d.useCallback((function(){var e=t.current,a=oi(e);e&&a||k(!1),e.scrollOptions.shouldPublishImmediately?g():v()}),[v,g]),f=d.useCallback((function(e,n){t.current&&k(!1);var i=o.current,s=i.getDroppableRef();s||k(!1);var r=ti(s),c={ref:s,descriptor:l,env:r,scrollOptions:n};t.current=c;var d=ai({ref:s,descriptor:l,env:r,windowScroll:e,direction:i.direction,isDropDisabled:i.isDropDisabled,isCombineEnabled:i.isCombineEnabled,shouldClipSubject:!i.ignoreContainerClipping}),m=r.closestScrollable;return m&&(m.setAttribute(La.contextId,a.contextId),m.addEventListener("scroll",b,si(c.scrollOptions))),d}),[a.contextId,l,b,o]),y=d.useCallback((function(){var e=t.current,a=oi(e);return e&&a||k(!1),Zn(a)}),[]),E=d.useCallback((function(){var e=t.current;e||k(!1);var a=oi(e);t.current=null,a&&(v.cancel(),a.removeAttribute(La.contextId),a.removeEventListener("scroll",b,si(e.scrollOptions)))}),[b,v]),_=d.useCallback((function(e){var a=t.current;a||k(!1);var n=oi(a);n||k(!1),n.scrollTop+=e.y,n.scrollLeft+=e.x}),[]),w=d.useMemo((function(){return{getDimensionAndWatchScroll:f,getScrollWhileDragging:y,dragStopped:E,scroll:_}}),[E,f,y,_]),S=d.useMemo((function(){return{uniqueId:n,descriptor:l,callbacks:w}}),[w,l,n]);Ba((function(){return c.current=S.descriptor,s.droppable.register(S),function(){t.current&&E(),s.droppable.unregister(S)}}),[w,l,E,S,r,s.droppable]),Ba((function(){t.current&&r.updateDroppableIsEnabled(c.current.id,!e.isDropDisabled)}),[e.isDropDisabled,r]),Ba((function(){t.current&&r.updateDroppableIsCombineEnabled(c.current.id,e.isCombineEnabled)}),[e.isCombineEnabled,r])}({droppableId:c,type:m,mode:g,direction:v,isDropDisabled:f,isCombineEnabled:y,ignoreContainerClipping:b,getDroppableRef:O});var R=s.createElement(hi,{on:e.placeholder,shouldAnimate:e.shouldAnimatePlaceholder},(function(e){var t=e.onClose,n=e.data,i=e.animate;return s.createElement(mi,{placeholder:n,onClose:t,innerRef:x,animate:i,contextId:a,onTransitionEnd:j})})),I=d.useMemo((function(){return{innerRef:C,placeholder:R,droppableProps:{"data-rbd-droppable-id":c,"data-rbd-droppable-context-id":a}}}),[a,c,R,C]),T=_?_.dragging.draggableId:null,N=d.useMemo((function(){return{droppableId:c,type:m,isUsingCloneFor:T}}),[c,T,m]);return s.createElement(ui.Provider,{value:N},l(I,E),function(){if(!_)return null;var e=_.dragging,t=_.render,a=s.createElement(Ii,{draggableId:e.draggableId,index:e.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},(function(a,n){return t(a,n,e)}));return p.createPortal(a,S())}())}));Mi.defaultProps=Di,t.DragDropContext=function(e){var t=d.useMemo((function(){return""+Kn++}),[]),a=e.dragHandleUsageInstructions||D.dragHandleUsageInstructions;return s.createElement(R,null,(function(n){return s.createElement(Gn,{nonce:e.nonce,contextId:t,setCallbacks:n,dragHandleUsageInstructions:a,enableDefaultSensors:e.enableDefaultSensors,sensors:e.sensors,onBeforeCapture:e.onBeforeCapture,onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragUpdate:e.onDragUpdate,onDragEnd:e.onDragEnd},e.children)}))},t.Draggable=function(e){var t="boolean"!=typeof e.isDragDisabled||!e.isDragDisabled,a=Boolean(e.disableInteractiveElementBlocking),n=Boolean(e.shouldRespectForcePress);return s.createElement(Ii,o({},e,{isClone:!1,isEnabled:t,canDragInteractiveElements:a,shouldRespectForcePress:n}))},t.Droppable=Mi,t.resetServerContext=function(){Kn=0,Qa=0},t.useKeyboardSensor=On,t.useMouseSensor=En,t.useTouchSensor=kn},1466:function(e,t,a){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(a(1467));function s(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var r="function"==typeof Symbol&&Symbol.observable||"@@observable",o=function(){return Math.random().toString(36).substring(7).split("").join(".")},l={INIT:"@@redux/INIT"+o(),REPLACE:"@@redux/REPLACE"+o(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+o()}};function c(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function d(e,t,a){var n;if("function"==typeof t&&"function"==typeof a||"function"==typeof a&&"function"==typeof arguments[3])throw new Error(s(0));if("function"==typeof t&&void 0===a&&(a=t,t=void 0),void 0!==a){if("function"!=typeof a)throw new Error(s(1));return a(d)(e,t)}if("function"!=typeof e)throw new Error(s(2));var i=e,o=t,m=[],u=m,h=!1;function p(){u===m&&(u=m.slice())}function g(){if(h)throw new Error(s(3));return o}function v(e){if("function"!=typeof e)throw new Error(s(4));if(h)throw new Error(s(5));var t=!0;return p(),u.push(e),function(){if(t){if(h)throw new Error(s(6));t=!1,p();var a=u.indexOf(e);u.splice(a,1),m=null}}}function b(e){if(!c(e))throw new Error(s(7));if(void 0===e.type)throw new Error(s(8));if(h)throw new Error(s(9));try{h=!0,o=i(o,e)}finally{h=!1}for(var t=m=u,a=0;a<t.length;a++){(0,t[a])()}return e}return b({type:l.INIT}),(n={dispatch:b,subscribe:v,getState:g,replaceReducer:function(e){if("function"!=typeof e)throw new Error(s(10));i=e,b({type:l.REPLACE})}})[r]=function(){var e,t=v;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(s(11));function a(){e.next&&e.next(g())}return a(),{unsubscribe:t(a)}}})[r]=function(){return this},e},n}var m=d;function u(e,t){return function(){return t(e.apply(this,arguments))}}function h(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}t.__DO_NOT_USE__ActionTypes=l,t.applyMiddleware=function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];return function(e){return function(){var a=e.apply(void 0,arguments),n=function(){throw new Error(s(15))},r={getState:a.getState,dispatch:function(){return n.apply(void 0,arguments)}},o=t.map((function(e){return e(r)}));return n=h.apply(void 0,o)(a.dispatch),i.default(i.default({},a),{},{dispatch:n})}}},t.bindActionCreators=function(e,t){if("function"==typeof e)return u(e,t);if("object"!=typeof e||null===e)throw new Error(s(16));var a={};for(var n in e){var i=e[n];"function"==typeof i&&(a[n]=u(i,t))}return a},t.combineReducers=function(e){for(var t=Object.keys(e),a={},n=0;n<t.length;n++){var i=t[n];0,"function"==typeof e[i]&&(a[i]=e[i])}var r,o=Object.keys(a);try{!function(e){Object.keys(e).forEach((function(t){var a=e[t];if(void 0===a(void 0,{type:l.INIT}))throw new Error(s(12));if(void 0===a(void 0,{type:l.PROBE_UNKNOWN_ACTION()}))throw new Error(s(13))}))}(a)}catch(e){r=e}return function(e,t){if(void 0===e&&(e={}),r)throw r;for(var n=!1,i={},l=0;l<o.length;l++){var c=o[l],d=a[c],m=e[c],u=d(m,t);if(void 0===u){t&&t.type;throw new Error(s(14))}i[c]=u,n=n||u!==m}return(n=n||o.length!==Object.keys(e).length)?i:e}},t.compose=h,t.createStore=d,t.legacy_createStore=m},1467:function(e,t,a){var n=a(13);function i(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}e.exports=function(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?i(Object(a),!0).forEach((function(t){n(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):i(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e},e.exports.__esModule=!0,e.exports.default=e.exports},1468:function(e,t,a){"use strict";t.__esModule=!0;var n={batch:!0},i=a(1469);Object.keys(i).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||e in t&&t[e]===i[e]||(t[e]=i[e]))}));var s=a(1486);t.batch=s.unstable_batchedUpdates,(0,a(885).setBatch)(s.unstable_batchedUpdates)},1469:function(e,t,a){"use strict";var n=a(171).default;t.__esModule=!0;var i=n(a(1470));t.Provider=i.default;var s=n(a(886));t.connectAdvanced=s.default;var r=a(311);t.ReactReduxContext=r.ReactReduxContext;var o=n(a(1476));t.connect=o.default;var l=a(1484);t.useDispatch=l.useDispatch,t.createDispatchHook=l.createDispatchHook;var c=a(1485);t.useSelector=c.useSelector,t.createSelectorHook=c.createSelectorHook;var d=a(891);t.useStore=d.useStore,t.createStoreHook=d.createStoreHook;var m=n(a(887));t.shallowEqual=m.default},1470:function(e,t,a){"use strict";var n=a(171).default,i=a(240).default;t.__esModule=!0,t.default=void 0;var s=i(a(120)),r=(n(a(216)),a(311)),o=a(631),l=a(632);var c=function(e){var t=e.store,a=e.context,n=e.children,i=(0,s.useMemo)((function(){var e=(0,o.createSubscription)(t);return{store:t,subscription:e}}),[t]),c=(0,s.useMemo)((function(){return t.getState()}),[t]);(0,l.useIsomorphicLayoutEffect)((function(){var e=i.subscription;return e.onStateChange=e.notifyNestedSubs,e.trySubscribe(),c!==t.getState()&&e.notifyNestedSubs(),function(){e.tryUnsubscribe(),e.onStateChange=null}}),[i,c]);var d=a||r.ReactReduxContext;return s.default.createElement(d.Provider,{value:i},n)};t.default=c},1471:function(e,t,a){"use strict";var n=a(1472),i={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},s={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},r={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},o={};function l(e){return n.isMemo(e)?r:o[e.$$typeof]||i}o[n.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},o[n.Memo]=r;var c=Object.defineProperty,d=Object.getOwnPropertyNames,m=Object.getOwnPropertySymbols,u=Object.getOwnPropertyDescriptor,h=Object.getPrototypeOf,p=Object.prototype;e.exports=function e(t,a,n){if("string"!=typeof a){if(p){var i=h(a);i&&i!==p&&e(t,i,n)}var r=d(a);m&&(r=r.concat(m(a)));for(var o=l(t),g=l(a),v=0;v<r.length;++v){var b=r[v];if(!(s[b]||n&&n[b]||g&&g[b]||o&&o[b])){var f=u(a,b);try{c(t,b,f)}catch(e){}}}}return t}},1472:function(e,t,a){"use strict";e.exports=a(1473)},1473:function(e,t,a){"use strict";var n="function"==typeof Symbol&&Symbol.for,i=n?Symbol.for("react.element"):60103,s=n?Symbol.for("react.portal"):60106,r=n?Symbol.for("react.fragment"):60107,o=n?Symbol.for("react.strict_mode"):60108,l=n?Symbol.for("react.profiler"):60114,c=n?Symbol.for("react.provider"):60109,d=n?Symbol.for("react.context"):60110,m=n?Symbol.for("react.async_mode"):60111,u=n?Symbol.for("react.concurrent_mode"):60111,h=n?Symbol.for("react.forward_ref"):60112,p=n?Symbol.for("react.suspense"):60113,g=n?Symbol.for("react.suspense_list"):60120,v=n?Symbol.for("react.memo"):60115,b=n?Symbol.for("react.lazy"):60116,f=n?Symbol.for("react.block"):60121,y=n?Symbol.for("react.fundamental"):60117,E=n?Symbol.for("react.responder"):60118,_=n?Symbol.for("react.scope"):60119;function w(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case i:switch(e=e.type){case m:case u:case r:case l:case o:case p:return e;default:switch(e=e&&e.$$typeof){case d:case h:case b:case v:case c:return e;default:return t}}case s:return t}}}function S(e){return w(e)===u}t.AsyncMode=m,t.ConcurrentMode=u,t.ContextConsumer=d,t.ContextProvider=c,t.Element=i,t.ForwardRef=h,t.Fragment=r,t.Lazy=b,t.Memo=v,t.Portal=s,t.Profiler=l,t.StrictMode=o,t.Suspense=p,t.isAsyncMode=function(e){return S(e)||w(e)===m},t.isConcurrentMode=S,t.isContextConsumer=function(e){return w(e)===d},t.isContextProvider=function(e){return w(e)===c},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===i},t.isForwardRef=function(e){return w(e)===h},t.isFragment=function(e){return w(e)===r},t.isLazy=function(e){return w(e)===b},t.isMemo=function(e){return w(e)===v},t.isPortal=function(e){return w(e)===s},t.isProfiler=function(e){return w(e)===l},t.isStrictMode=function(e){return w(e)===o},t.isSuspense=function(e){return w(e)===p},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===r||e===u||e===l||e===o||e===p||e===g||"object"==typeof e&&null!==e&&(e.$$typeof===b||e.$$typeof===v||e.$$typeof===c||e.$$typeof===d||e.$$typeof===h||e.$$typeof===y||e.$$typeof===E||e.$$typeof===_||e.$$typeof===f)},t.typeOf=w},1474:function(e,t,a){"use strict";e.exports=a(1475)},1475:function(e,t,a){"use strict";var n=60103,i=60106,s=60107,r=60108,o=60114,l=60109,c=60110,d=60112,m=60113,u=60120,h=60115,p=60116,g=60121,v=60122,b=60117,f=60129,y=60131;if("function"==typeof Symbol&&Symbol.for){var E=Symbol.for;n=E("react.element"),i=E("react.portal"),s=E("react.fragment"),r=E("react.strict_mode"),o=E("react.profiler"),l=E("react.provider"),c=E("react.context"),d=E("react.forward_ref"),m=E("react.suspense"),u=E("react.suspense_list"),h=E("react.memo"),p=E("react.lazy"),g=E("react.block"),v=E("react.server.block"),b=E("react.fundamental"),f=E("react.debug_trace_mode"),y=E("react.legacy_hidden")}function _(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:switch(e=e.type){case s:case o:case r:case m:case u:return e;default:switch(e=e&&e.$$typeof){case c:case d:case p:case h:case l:return e;default:return t}}case i:return t}}}var w=l,S=n,O=d,C=s,x=p,j=h,k=i,R=o,I=r,T=m;t.ContextConsumer=c,t.ContextProvider=w,t.Element=S,t.ForwardRef=O,t.Fragment=C,t.Lazy=x,t.Memo=j,t.Portal=k,t.Profiler=R,t.StrictMode=I,t.Suspense=T,t.isAsyncMode=function(){return!1},t.isConcurrentMode=function(){return!1},t.isContextConsumer=function(e){return _(e)===c},t.isContextProvider=function(e){return _(e)===l},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},t.isForwardRef=function(e){return _(e)===d},t.isFragment=function(e){return _(e)===s},t.isLazy=function(e){return _(e)===p},t.isMemo=function(e){return _(e)===h},t.isPortal=function(e){return _(e)===i},t.isProfiler=function(e){return _(e)===o},t.isStrictMode=function(e){return _(e)===r},t.isSuspense=function(e){return _(e)===m},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===s||e===o||e===f||e===r||e===m||e===u||e===y||"object"==typeof e&&null!==e&&(e.$$typeof===p||e.$$typeof===h||e.$$typeof===l||e.$$typeof===c||e.$$typeof===d||e.$$typeof===b||e.$$typeof===g||e[0]===v)},t.typeOf=_},1476:function(e,t,a){"use strict";var n=a(171).default;t.__esModule=!0,t.createConnect=g,t.default=void 0;var i=n(a(130)),s=n(a(408)),r=n(a(886)),o=n(a(887)),l=n(a(1477)),c=n(a(1480)),d=n(a(1481)),m=n(a(1482)),u=["pure","areStatesEqual","areOwnPropsEqual","areStatePropsEqual","areMergedPropsEqual"];function h(e,t,a){for(var n=t.length-1;n>=0;n--){var i=t[n](e);if(i)return i}return function(t,n){throw new Error("Invalid value of type "+typeof e+" for "+a+" argument when connecting component "+n.wrappedComponentName+".")}}function p(e,t){return e===t}function g(e){var t=void 0===e?{}:e,a=t.connectHOC,n=void 0===a?r.default:a,g=t.mapStateToPropsFactories,v=void 0===g?c.default:g,b=t.mapDispatchToPropsFactories,f=void 0===b?l.default:b,y=t.mergePropsFactories,E=void 0===y?d.default:y,_=t.selectorFactory,w=void 0===_?m.default:_;return function(e,t,a,r){void 0===r&&(r={});var l=r,c=l.pure,d=void 0===c||c,m=l.areStatesEqual,g=void 0===m?p:m,b=l.areOwnPropsEqual,y=void 0===b?o.default:b,_=l.areStatePropsEqual,S=void 0===_?o.default:_,O=l.areMergedPropsEqual,C=void 0===O?o.default:O,x=(0,s.default)(l,u),j=h(e,v,"mapStateToProps"),k=h(t,f,"mapDispatchToProps"),R=h(a,E,"mergeProps");return n(w,(0,i.default)({methodName:"connect",getDisplayName:function(e){return"Connect("+e+")"},shouldHandleStateChanges:Boolean(e),initMapStateToProps:j,initMapDispatchToProps:k,initMergeProps:R,pure:d,areStatesEqual:g,areOwnPropsEqual:y,areStatePropsEqual:S,areMergedPropsEqual:C},x))}}var v=g();t.default=v},1477:function(e,t,a){"use strict";var n=a(171).default;t.__esModule=!0,t.default=void 0,t.whenMapDispatchToPropsIsFunction=r,t.whenMapDispatchToPropsIsMissing=o,t.whenMapDispatchToPropsIsObject=l;var i=n(a(1478)),s=a(888);function r(e){return"function"==typeof e?(0,s.wrapMapToPropsFunc)(e,"mapDispatchToProps"):void 0}function o(e){return e?void 0:(0,s.wrapMapToPropsConstant)((function(e){return{dispatch:e}}))}function l(e){return e&&"object"==typeof e?(0,s.wrapMapToPropsConstant)((function(t){return(0,i.default)(e,t)})):void 0}var c=[r,o,l];t.default=c},1478:function(e,t,a){"use strict";t.__esModule=!0,t.default=function(e,t){var a={},n=function(n){var i=e[n];"function"==typeof i&&(a[n]=function(){return t(i.apply(void 0,arguments))})};for(var i in e)n(i);return a}},1479:function(e,t,a){"use strict";t.__esModule=!0,t.default=function(e){if("object"!=typeof e||null===e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var a=t;for(;null!==Object.getPrototypeOf(a);)a=Object.getPrototypeOf(a);return t===a}},1480:function(e,t,a){"use strict";t.__esModule=!0,t.default=void 0,t.whenMapStateToPropsIsFunction=i,t.whenMapStateToPropsIsMissing=s;var n=a(888);function i(e){return"function"==typeof e?(0,n.wrapMapToPropsFunc)(e,"mapStateToProps"):void 0}function s(e){return e?void 0:(0,n.wrapMapToPropsConstant)((function(){return{}}))}var r=[i,s];t.default=r},1481:function(e,t,a){"use strict";var n=a(171).default;t.__esModule=!0,t.default=void 0,t.defaultMergeProps=s,t.whenMergePropsIsFunction=o,t.whenMergePropsIsOmitted=l,t.wrapMergePropsFunc=r;var i=n(a(130));n(a(889));function s(e,t,a){return(0,i.default)({},a,e,t)}function r(e){return function(t,a){a.displayName;var n,i=a.pure,s=a.areMergedPropsEqual,r=!1;return function(t,a,o){var l=e(t,a,o);return r?i&&s(l,n)||(n=l):(r=!0,n=l),n}}}function o(e){return"function"==typeof e?r(e):void 0}function l(e){return e?void 0:function(){return s}}var c=[o,l];t.default=c},1482:function(e,t,a){"use strict";var n=a(171).default;t.__esModule=!0,t.default=function(e,t){var a=t.initMapStateToProps,n=t.initMapDispatchToProps,l=t.initMergeProps,c=(0,i.default)(t,s),d=a(e,c),m=n(e,c),u=l(e,c);0;return(c.pure?o:r)(d,m,u,e,c)},t.impureFinalPropsSelectorFactory=r,t.pureFinalPropsSelectorFactory=o;var i=n(a(408)),s=(n(a(1483)),["initMapStateToProps","initMapDispatchToProps","initMergeProps"]);function r(e,t,a,n){return function(i,s){return a(e(i,s),t(n,s),s)}}function o(e,t,a,n,i){var s,r,o,l,c,d=i.areStatesEqual,m=i.areOwnPropsEqual,u=i.areStatePropsEqual,h=!1;function p(i,h){var p,g,v=!m(h,r),b=!d(i,s,h,r);return s=i,r=h,v&&b?(o=e(s,r),t.dependsOnOwnProps&&(l=t(n,r)),c=a(o,l,r)):v?(e.dependsOnOwnProps&&(o=e(s,r)),t.dependsOnOwnProps&&(l=t(n,r)),c=a(o,l,r)):b?(p=e(s,r),g=!u(p,o),o=p,g&&(c=a(o,l,r)),c):c}return function(i,d){return h?p(i,d):(o=e(s=i,r=d),l=t(n,r),c=a(o,l,r),h=!0,c)}}},1483:function(e,t,a){"use strict";var n=a(171).default;t.__esModule=!0,t.default=function(e,t,a,n){s(e,"mapStateToProps",n),s(t,"mapDispatchToProps",n),s(a,"mergeProps",n)};var i=n(a(890));function s(e,t,a){if(!e)throw new Error("Unexpected value for "+t+" in "+a+".");"mapStateToProps"!==t&&"mapDispatchToProps"!==t||Object.prototype.hasOwnProperty.call(e,"dependsOnOwnProps")||(0,i.default)("The selector for "+t+" of "+a+" did not specify a value for dependsOnOwnProps.")}},1484:function(e,t,a){"use strict";t.__esModule=!0,t.createDispatchHook=s,t.useDispatch=void 0;var n=a(311),i=a(891);function s(e){void 0===e&&(e=n.ReactReduxContext);var t=e===n.ReactReduxContext?i.useStore:(0,i.createStoreHook)(e);return function(){return t().dispatch}}var r=s();t.useDispatch=r},1485:function(e,t,a){"use strict";t.__esModule=!0,t.createSelectorHook=c,t.useSelector=void 0;var n=a(120),i=a(892),s=a(631),r=a(632),o=a(311),l=function(e,t){return e===t};function c(e){void 0===e&&(e=o.ReactReduxContext);var t=e===o.ReactReduxContext?i.useReduxContext:function(){return(0,n.useContext)(e)};return function(e,a){void 0===a&&(a=l);var i=t(),o=function(e,t,a,i){var o,l=(0,n.useReducer)((function(e){return e+1}),0)[1],c=(0,n.useMemo)((function(){return(0,s.createSubscription)(a,i)}),[a,i]),d=(0,n.useRef)(),m=(0,n.useRef)(),u=(0,n.useRef)(),h=(0,n.useRef)(),p=a.getState();try{if(e!==m.current||p!==u.current||d.current){var g=e(p);o=void 0!==h.current&&t(g,h.current)?h.current:g}else o=h.current}catch(e){throw d.current&&(e.message+="\nThe error may be correlated with this previous error:\n"+d.current.stack+"\n\n"),e}return(0,r.useIsomorphicLayoutEffect)((function(){m.current=e,u.current=p,h.current=o,d.current=void 0})),(0,r.useIsomorphicLayoutEffect)((function(){function e(){try{var e=a.getState();if(e===u.current)return;var n=m.current(e);if(t(n,h.current))return;h.current=n,u.current=e}catch(e){d.current=e}l()}return c.onStateChange=e,c.trySubscribe(),e(),function(){return c.tryUnsubscribe()}}),[a,c]),o}(e,a,i.store,i.subscription);return(0,n.useDebugValue)(o),o}}var d=c();t.useSelector=d},1486:function(e,t,a){"use strict";t.__esModule=!0,t.unstable_batchedUpdates=void 0;var n=a(186);t.unstable_batchedUpdates=n.unstable_batchedUpdates},1487:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=a(120);function i(e,t){var a=n.useState((function(){return{inputs:t,result:e()}}))[0],i=n.useRef(!0),s=n.useRef(a),r=i.current||Boolean(t&&s.current.inputs&&function(e,t){if(e.length!==t.length)return!1;for(var a=0;a<e.length;a++)if(e[a]!==t[a])return!1;return!0}(t,s.current.inputs))?s.current:{inputs:t,result:e()};return n.useEffect((function(){i.current=!1,s.current=r}),[r]),r.result}function s(e,t){return i((function(){return e}),t)}var r=i,o=s;t.useCallback=o,t.useCallbackOne=s,t.useMemo=r,t.useMemoOne=i},1488:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,i=(n=a(1489))&&"object"==typeof n&&"default"in n?n.default:n,s=function(e){var t=e.top,a=e.right,n=e.bottom,i=e.left;return{top:t,right:a,bottom:n,left:i,width:a-i,height:n-t,x:i,y:t,center:{x:(a+i)/2,y:(n+t)/2}}},r=function(e,t){return{top:e.top-t.top,left:e.left-t.left,bottom:e.bottom+t.bottom,right:e.right+t.right}},o=function(e,t){return{top:e.top+t.top,left:e.left+t.left,bottom:e.bottom-t.bottom,right:e.right-t.right}},l={top:0,right:0,bottom:0,left:0},c=function(e){var t=e.borderBox,a=e.margin,n=void 0===a?l:a,i=e.border,c=void 0===i?l:i,d=e.padding,m=void 0===d?l:d,u=s(r(t,n)),h=s(o(t,c)),p=s(o(h,m));return{marginBox:u,borderBox:s(t),paddingBox:h,contentBox:p,margin:n,border:c,padding:m}},d=function(e){var t=e.slice(0,-2);if("px"!==e.slice(-2))return 0;var a=Number(t);return isNaN(a)&&i(!1),a},m=function(e,t){var a,n,i=e.borderBox,s=e.border,r=e.margin,o=e.padding,l=(n=t,{top:(a=i).top+n.y,left:a.left+n.x,bottom:a.bottom+n.y,right:a.right+n.x});return c({borderBox:l,border:s,margin:r,padding:o})},u=function(e,t){var a={top:d(t.marginTop),right:d(t.marginRight),bottom:d(t.marginBottom),left:d(t.marginLeft)},n={top:d(t.paddingTop),right:d(t.paddingRight),bottom:d(t.paddingBottom),left:d(t.paddingLeft)},i={top:d(t.borderTopWidth),right:d(t.borderRightWidth),bottom:d(t.borderBottomWidth),left:d(t.borderLeftWidth)};return c({borderBox:e,margin:a,padding:n,border:i})};t.calculateBox=u,t.createBox=c,t.expand=r,t.getBox=function(e){var t=e.getBoundingClientRect(),a=window.getComputedStyle(e);return u(t,a)},t.getRect=s,t.offset=m,t.shrink=o,t.withScroll=function(e,t){return void 0===t&&(t={x:window.pageXOffset,y:window.pageYOffset}),m(e,t)}},1489:function(e,t,a){"use strict";var n=!0,i="Invariant failed";e.exports=function(e,t){if(!e){if(n)throw new Error(i);var a="function"==typeof t?t():t,s=a?"".concat(i,": ").concat(a):i;throw new Error(s)}}},1490:function(e,t,a){"use strict";var n=Number.isNaN||function(e){return"number"==typeof e&&e!=e};function i(e,t){if(e.length!==t.length)return!1;for(var a=0;a<e.length;a++)if(i=e[a],s=t[a],!(i===s||n(i)&&n(s)))return!1;var i,s;return!0}e.exports=function(e,t){var a;void 0===t&&(t=i);var n,s=[],r=!1;return function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];return r&&a===this&&t(i,s)||(n=e.apply(this,i),r=!0,a=this,s=i),n}}},1491:function(e,t,a){"use strict";e.exports=function(e){var t=[],a=null,n=function(){for(var n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];t=i,a||(a=requestAnimationFrame((function(){a=null,e.apply(void 0,t)})))};return n.cancel=function(){a&&(cancelAnimationFrame(a),a=null)},n}},1492:function(e,t){e.exports="img/user-onboarding/WorkMessaging.f3c8ccf.png"},1493:function(e,t){e.exports="img/user-onboarding/CommunityMessaging.85955ea.png"},1494:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return l}));var n,i,s,r=a(120);function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},o.apply(this,arguments)}function l(e){return r.createElement("svg",o({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",role:"presentation","aria-hidden":!0},e),r.createElement("g",{clipPath:"url(#default_app_svg__clip0)"},n||(n=r.createElement("rect",{width:20,height:20,rx:4,fill:"url(#default_app_svg__paint0_linear)"})),r.createElement("path",{d:"M2.496 0v20M20 2.5H0M20 10H0M20 17.5H0M10 0v20M17.496 0v20",stroke:"#fff",strokeOpacity:.5,style:{mixBlendMode:"lighten"}}),i||(i=r.createElement("circle",{opacity:.8,cx:10,cy:10,r:7.5,stroke:"#fff"}))),s||(s=r.createElement("defs",null,r.createElement("linearGradient",{id:"default_app_svg__paint0_linear",x1:10,y1:0,x2:10,y2:20,gradientUnits:"userSpaceOnUse"},r.createElement("stop",{stopColor:"#60A6FF"}),r.createElement("stop",{offset:1,stopColor:"#418DED"})),r.createElement("clipPath",{id:"default_app_svg__clip0"},r.createElement("rect",{width:20,height:20,rx:4,fill:"#fff"})))))}t.default="img/element-icons/room/default_app.63bac9a.svg"},1495:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return o}));var n,i,s=a(120);function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},r.apply(this,arguments)}function o(e){return s.createElement("svg",r({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",role:"presentation","aria-hidden":!0},e),n||(n=s.createElement("rect",{width:20,height:20,rx:4,fill:"#5ABFF2"})),i||(i=s.createElement("path",{d:"M3 7.875C3 6.839 3.84 6 4.875 6h6.313c1.035 0 1.874.84 1.874 1.875v5c0 1.036-.839 1.875-1.874 1.875H4.875A1.875 1.875 0 013 12.875v-5zM14.375 8.446l1.746-1.336a.547.547 0 01.879.435v5.495c0 .48-.575.727-.923.396l-1.702-1.615V8.446z",fill:"#fff"})))}t.default="img/element-icons/room/default_video.6afce87.svg"},1496:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return c}));var n,i,s,r,o=a(120);function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},l.apply(this,arguments)}function c(e){return o.createElement("svg",l({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",role:"presentation","aria-hidden":!0},e),n||(n=o.createElement("rect",{width:20,height:20,rx:4,fill:"#FF5B55"})),i||(i=o.createElement("path",{d:"M2 7h16v9a2 2 0 01-2 2H4a2 2 0 01-2-2V7z",fill:"#fff"})),s||(s=o.createElement("rect",{x:3.968,y:9,width:2.997,height:3,rx:.25,fill:"#FF5B55"})),r||(r=o.createElement("rect",{x:10.961,y:13,width:2.997,height:3,rx:.25,fill:"#FF5B55"})))}t.default="img/element-icons/room/default_cal.68352c5.svg"},1497:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return o}));var n,i,s=a(120);function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},r.apply(this,arguments)}function o(e){return s.createElement("svg",r({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",role:"presentation","aria-hidden":!0},e),n||(n=s.createElement("rect",{width:20,height:20,rx:4,fill:"#FCC639"})),i||(i=s.createElement("path",{d:"M2 7h16v9a2 2 0 01-2 2H4a2 2 0 01-2-2V7z",fill:"#fff"})))}t.default="img/element-icons/room/default_doc.6a6092c.svg"},1498:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return l}));var n,i,s,r=a(120);function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},o.apply(this,arguments)}function l(e){return r.createElement("svg",o({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",role:"presentation","aria-hidden":!0},e),n||(n=r.createElement("rect",{x:1,y:1,width:18,height:18,rx:3,fill:"#17191C",stroke:"#17191C",strokeWidth:2})),i||(i=r.createElement("path",{d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0z",fill:"#fff"})),s||(s=r.createElement("path",{d:"M10 6v3.813l2.5 1.687",stroke:"#000",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})))}t.default="img/element-icons/room/default_clock.312a340.svg"},1499:function(e,t,a){"use strict";(function(e){a.d(t,"a",(function(){return R}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(186),l=a.n(o),c=a(143),d=a(1500),m=a(129),u=a(1),h=a(635),p=a(166),g=a(194),v=a(649),b=a(165),f=a(168),y=a(121),E=a(259),_=a(346),w=a(501),S=a(191),O=a(133),C=a(1506),x=a(293),j=a(238),k=a(1508);class R extends h.a{constructor(e,t,a,n){super(e,t,a,n),i()(this,"avatars",void 0),i()(this,"permalinkCreator",void 0),i()(this,"totalSize",void 0),i()(this,"mediaOmitText",void 0),this.avatars=new Map,this.permalinkCreator=new f.a(this.room),this.totalSize=0,this.mediaOmitText=this.exportOptions.attachmentsIncluded?Object(y.a)("Media omitted - file size limit exceeded"):Object(y.a)("Media omitted")}async getRoomAvatar(){let e;const t=E.b(this.room,32,32,"crop"),a="room.png";if(t)try{const n=await fetch(t);e=await n.blob(),this.totalSize+=e.size,this.addFile(a,e)}catch(e){u.a.log("Failed to fetch room's avatar"+e)}const n=r.a.createElement(S.a,{width:32,height:32,name:this.room.name,title:this.room.name,url:e?a:"",resizeMethod:"crop"});return Object(d.renderToStaticMarkup)(n)}async wrapHTML(e,t,a){var n,i,s,o,l;const c=await this.getRoomAvatar(),u=Object(b.f)(new Date),h=null===(n=this.room.currentState.getStateEvents(m.b.RoomCreate,""))||void 0===n?void 0:n.getSender(),p=(h?null===(i=this.room.getMember(h))||void 0===i?void 0:i.rawDisplayName:h)||h,g=this.client.getUserId(),v=null===(s=this.room.getMember(g))||void 0===s?void 0:s.rawDisplayName,f=(null===(o=this.room.currentState.getStateEvents(m.b.RoomTopic,""))||void 0===o||null===(l=o.getContent())||void 0===l?void 0:l.topic)||"",E=Object(y.a)("%(creatorName)s created this room.",{creatorName:p}),_=Object(d.renderToStaticMarkup)(r.a.createElement("p",null,Object(y.a)("This is the start of export of <roomName/>. Exported by <exporterDetails/> at %(exportDate)s.",{exportDate:u},{roomName:()=>r.a.createElement("b",null,this.room.name),exporterDetails:()=>r.a.createElement("a",{href:`https://matrix.to/#/${g}`,target:"_blank",rel:"noopener noreferrer"},v?r.a.createElement(r.a.Fragment,null,r.a.createElement("b",null,v)," ("+g+")"):r.a.createElement("b",null,g))}))),w=f?Object(y.a)("Topic: %(topic)s",{topic:f}):"",S=Object(d.renderToStaticMarkup)(0!==t?r.a.createElement("div",{style:{textAlign:"center"}},r.a.createElement("a",{href:`./messages${1===t?"":t}.html`,style:{fontWeight:"bold"}},"Previous group of messages")):r.a.createElement(r.a.Fragment,null)),O=Object(d.renderToStaticMarkup)(t<a-1?r.a.createElement("div",{style:{textAlign:"center",margin:"10px"}},r.a.createElement("a",{href:"./messages"+(t+2)+".html",style:{fontWeight:"bold"}},"Next group of messages")):r.a.createElement(r.a.Fragment,null));return`\n <!DOCTYPE html>\n <html lang="en">\n <head>\n <meta charset="UTF-8" />\n <meta http-equiv="X-UA-Compatible" content="IE=edge" />\n <meta name="viewport" content="width=device-width, initial-scale=1.0" />\n <link href="css/style.css" rel="stylesheet" />\n <script src="js/script.js"><\/script>\n <title>Exported Data</title>\n </head>\n <body style="height: 100vh;">\n <section\n id="matrixchat"\n style="height: 100%; overflow: auto"\n class="notranslate"\n >\n <div class="mx_MatrixChat_wrapper" aria-hidden="false">\n <div class="mx_MatrixChat">\n <main class="mx_RoomView">\n <div class="mx_RoomHeader light-panel">\n <div class="mx_RoomHeader_wrapper" aria-owns="mx_RightPanel">\n <div class="mx_RoomHeader_avatar">\n <div class="mx_DecoratedRoomAvatar">\n ${c}\n </div>\n </div>\n <div class="mx_RoomHeader_name">\n <div\n dir="auto"\n class="mx_RoomHeader_nametext"\n title="${this.room.name}"\n >\n ${this.room.name}\n </div>\n </div>\n <div class="mx_RoomHeader_topic" dir="auto"> ${f} </div>\n </div>\n </div>\n ${S}\n <div class="mx_MainSplit">\n <div class="mx_RoomView_body">\n <div\n class="mx_RoomView_timeline mx_RoomView_timeline_rr_enabled"\n >\n <div\n class="\n mx_AutoHideScrollbar\n mx_ScrollPanel\n mx_RoomView_messagePanel\n "\n >\n <div class="mx_RoomView_messageListWrapper">\n <ol\n class="mx_RoomView_MessageList"\n aria-live="polite"\n role="list"\n >\n ${0==t?`<div class="mx_NewRoomIntro">\n ${c}\n <h2> ${this.room.name} </h2>\n <p> ${E} <br/><br/> ${_} </p>\n <br/>\n <p> ${w} </p>\n </div>`:""}\n ${e}\n </ol>\n </div>\n </div>\n </div>\n <div class="mx_RoomView_statusArea">\n <div class="mx_RoomView_statusAreaBox">\n <div class="mx_RoomView_statusAreaBox_line"></div>\n </div>\n </div>\n </div>\n </div>\n ${O}\n </main>\n </div>\n </div>\n </section>\n <div id="snackbar"/>\n </body>\n </html>`}getAvatarURL(e){const t=e.sender,a=null==t?void 0:t.getMxcAvatarUrl();return a?Object(p.b)(a).getThumbnailOfSourceHttp(30,30,"crop"):null}async saveAvatarIfNeeded(e){const t=e.sender;if(!this.avatars.has(t.userId))try{const a=this.getAvatarURL(e);this.avatars.set(t.userId,!0);const n=await fetch(a),i=await n.blob();this.addFile(`users/${t.userId.replace(/:/g,"-")}.png`,i)}catch(e){u.a.log("Failed to fetch user's avatar"+e)}}getDateSeparator(e){const t=e.getTs(),a=r.a.createElement("li",{key:t},r.a.createElement(w.a,{forExport:!0,key:t,roomId:e.getRoomId(),ts:t}));return Object(d.renderToStaticMarkup)(a)}needsDateSeparator(e,t){return!t||Object(b.o)(t.getDate()||void 0,e.getDate()||void 0)}getEventTile(e,t){return r.a.createElement("div",{className:"mx_Export_EventWrapper",id:e.getId()},r.a.createElement(O.a.Provider,{value:this.client},r.a.createElement(_.b,{mxEvent:e,continuation:t,isRedacted:e.isRedacted(),replacingEventId:e.replacingEventId(),forExport:!0,alwaysShowTimestamps:!0,showUrlPreview:!1,checkUnmounting:()=>!1,isTwelveHour:!1,last:!1,lastInSection:!1,permalinkCreator:this.permalinkCreator,lastSuccessful:!1,isSelectedEvent:!1,showReactions:!1,layout:g.a.Group,showReadReceipts:!1})))}async getEventTileMarkup(e,t,a){const n=this.getAvatarURL(e),i=!!n;i&&await this.saveAvatarIfNeeded(e);const s=this.getEventTile(e,t);let r;if(e.getContent().msgtype==m.e.Emote||e.getContent().msgtype==m.e.Notice||e.getContent().msgtype===m.e.Text){const e=document.createElement("div");l.a.render(s,e),r=e.innerHTML}else r=Object(d.renderToStaticMarkup)(s);if(a){var o,c;const t=null!==(o=e.getContent().url)&&void 0!==o?o:null===(c=e.getContent().file)||void 0===c?void 0:c.url;r=r.split(t).join(a)}return r=r.replace(/<span class="mx_MFileBody_info_icon".*?>.*?<\/span>/,""),i&&(r=r.replace(encodeURI(n).replace(/&/g,"&"),`users/${e.sender.userId.replace(/:/g,"-")}.png`)),r}createModifiedEvent(e,t){const a={msgtype:"m.text",body:`${e}`,format:"org.matrix.custom.html",formatted_body:`${e}`};(!(arguments.length>2&&void 0!==arguments[2])||arguments[2])&&(a.formatted_body="<em>"+a.formatted_body+"</em>",a.body="*"+a.body+"*");const n=new c.b;return n.event=t.event,n.sender=t.sender,n.event.type="m.room.message",n.event.content=a,n}async createMessageBody(e){let t,a=arguments.length>1&&void 0!==arguments[1]&&arguments[1];try{if(this.isAttachment(e))if(this.exportOptions.attachmentsIncluded)try{const n=await this.getMediaBlob(e);if(this.totalSize+n.size>this.exportOptions.maxSize)t=await this.getEventTileMarkup(this.createModifiedEvent(this.mediaOmitText,e),a);else{this.totalSize+=n.size;const i=this.getFilePath(e);t=await this.getEventTileMarkup(e,a,i),this.totalSize==this.exportOptions.maxSize&&(this.exportOptions.attachmentsIncluded=!1),this.addFile(i,n)}}catch(n){u.a.log("Error while fetching file"+n),t=await this.getEventTileMarkup(this.createModifiedEvent(Object(y.a)("Error fetching file"),e),a)}else t=await this.getEventTileMarkup(this.createModifiedEvent(this.mediaOmitText,e),a);else t=await this.getEventTileMarkup(e,a)}catch(n){u.a.error(n),t=await this.getEventTileMarkup(this.createModifiedEvent(Object(x.b)(e),e,!1),a)}return t}async createHTML(t,a,n,i){let s="",r=null;for(let n=a;n<Math.min(a+1e3,t.length);n++){const a=t[n];if(this.updateProgress(Object(y.a)("Processing event %(number)s out of %(total)s",{number:n+1,total:t.length}),!1,!0),this.cancelled)return this.cleanUp();if(!Object(j.c)(a,!1))continue;s+=this.needsDateSeparator(a,r)?this.getDateSeparator(a):"";const i=!this.needsDateSeparator(a,r)&&Object(v.b)(r,a,!1),o=await this.createMessageBody(a,i);this.totalSize+=e.byteLength(o),s+=o,r=a}return this.wrapHTML(s,n,i)}async export(){this.updateProgress(Object(y.a)("Starting export…"));const e=performance.now(),t=await this.getRequiredEvents(),a=performance.now();this.updateProgress(Object(y.a)("Fetched %(count)s events in %(seconds)ss",{count:t.length,seconds:(a-e)/1e3}),!0,!1),this.updateProgress(Object(y.a)("Creating HTML…"));const n=new Set;for(let e=0;e<t.length/1e3;e++){const a=await this.createHTML(t,1e3*e,e,t.length/1e3);(new DOMParser).parseFromString(a,"text/html").querySelectorAll("*").forEach((e=>{e.classList.forEach((e=>n.add(e)))})),this.addFile(`messages${e?e+1:""}.html`,new Blob([a]))}const i=await Object(C.a)(n);this.addFile("css/style.css",new Blob([i])),this.addFile("js/script.js",new Blob([k.a])),await this.downloadZIP();const s=performance.now();this.cancelled?u.a.info("Export cancelled successfully"):(this.updateProgress(Object(y.a)("Export successful!")),this.updateProgress(Object(y.a)("Exported %(count)s events in %(seconds)s seconds",{count:t.length,seconds:(s-e)/1e3}))),this.cleanUp()}}}).call(this,a(53).Buffer)},1500:function(e,t,a){"use strict";e.exports=a(1501)},1501:function(e,t,a){"use strict";var n=a(502),i=a(120);function s(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,a=1;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=60106,o=60107,l=60108,c=60114,d=60109,m=60110,u=60112,h=60113,p=60120,g=60115,v=60116,b=60121,f=60117,y=60119,E=60129,_=60131;if("function"==typeof Symbol&&Symbol.for){var w=Symbol.for;r=w("react.portal"),o=w("react.fragment"),l=w("react.strict_mode"),c=w("react.profiler"),d=w("react.provider"),m=w("react.context"),u=w("react.forward_ref"),h=w("react.suspense"),p=w("react.suspense_list"),g=w("react.memo"),v=w("react.lazy"),b=w("react.block"),f=w("react.fundamental"),y=w("react.scope"),E=w("react.debug_trace_mode"),_=w("react.legacy_hidden")}function S(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case o:return"Fragment";case r:return"Portal";case c:return"Profiler";case l:return"StrictMode";case h:return"Suspense";case p:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case m:return(e.displayName||"Context")+".Consumer";case d:return(e._context.displayName||"Context")+".Provider";case u:var t=e.render;return t=t.displayName||t.name||"",e.displayName||(""!==t?"ForwardRef("+t+")":"ForwardRef");case g:return S(e.type);case b:return S(e._render);case v:t=e._payload,e=e._init;try{return S(e(t))}catch(e){}}return null}var O=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,C={};function x(e,t){for(var a=0|e._threadCount;a<=t;a++)e[a]=e._currentValue2,e._threadCount=a+1}for(var j=new Uint16Array(16),k=0;15>k;k++)j[k]=k+1;j[15]=0;var R=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,I=Object.prototype.hasOwnProperty,T={},N={};function P(e){return!!I.call(N,e)||!I.call(T,e)&&(R.test(e)?N[e]=!0:(T[e]=!0,!1))}function D(e,t,a,n,i,s,r){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=a,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=r}var M={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach((function(e){M[e]=new D(e,0,!1,e,null,!1,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((function(e){var t=e[0];M[t]=new D(t,1,!1,e[1],null,!1,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((function(e){M[e]=new D(e,2,!1,e.toLowerCase(),null,!1,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(e){M[e]=new D(e,2,!1,e,null,!1,!1)})),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach((function(e){M[e]=new D(e,3,!1,e.toLowerCase(),null,!1,!1)})),["checked","multiple","muted","selected"].forEach((function(e){M[e]=new D(e,3,!0,e,null,!1,!1)})),["capture","download"].forEach((function(e){M[e]=new D(e,4,!1,e,null,!1,!1)})),["cols","rows","size","span"].forEach((function(e){M[e]=new D(e,6,!1,e,null,!1,!1)})),["rowSpan","start"].forEach((function(e){M[e]=new D(e,5,!1,e.toLowerCase(),null,!1,!1)}));var A=/[\-:]([a-z])/g;function L(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach((function(e){var t=e.replace(A,L);M[t]=new D(t,1,!1,e,null,!1,!1)})),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach((function(e){var t=e.replace(A,L);M[t]=new D(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)})),["xml:base","xml:lang","xml:space"].forEach((function(e){var t=e.replace(A,L);M[t]=new D(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)})),["tabIndex","crossOrigin"].forEach((function(e){M[e]=new D(e,1,!1,e.toLowerCase(),null,!1,!1)})),M.xlinkHref=new D("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach((function(e){M[e]=new D(e,1,!1,e.toLowerCase(),null,!0,!0)}));var U=/["'&<>]/;function F(e){if("boolean"==typeof e||"number"==typeof e)return""+e;e=""+e;var t=U.exec(e);if(t){var a,n="",i=0;for(a=t.index;a<e.length;a++){switch(e.charCodeAt(a)){case 34:t=""";break;case 38:t="&";break;case 39:t="'";break;case 60:t="<";break;case 62:t=">";break;default:continue}i!==a&&(n+=e.substring(i,a)),i=a+1,n+=t}e=i!==a?n+e.substring(i,a):n}return e}function B(e,t){var a,n=M.hasOwnProperty(e)?M[e]:null;return(a="style"!==e)&&(a=null!==n?0===n.type:2<e.length&&("o"===e[0]||"O"===e[0])&&("n"===e[1]||"N"===e[1])),a||function(e,t,a,n){if(null==t||function(e,t,a,n){if(null!==a&&0===a.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!n&&(null!==a?!a.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,a,n))return!0;if(n)return!1;if(null!==a)switch(a.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(e,t,n,!1)?"":null!==n?(e=n.attributeName,3===(a=n.type)||4===a&&!0===t?e+'=""':(n.sanitizeURL&&(t=""+t),e+'="'+F(t)+'"')):P(e)?e+'="'+F(t)+'"':""}var V="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},W=null,H=null,z=null,G=!1,K=!1,q=null,$=0;function Y(){if(null===W)throw Error(s(321));return W}function J(){if(0<$)throw Error(s(312));return{memoizedState:null,queue:null,next:null}}function Q(){return null===z?null===H?(G=!1,H=z=J()):(G=!0,z=H):null===z.next?(G=!1,z=z.next=J()):(G=!0,z=z.next),z}function X(e,t,a,n){for(;K;)K=!1,$+=1,z=null,a=e(t,n);return Z(),a}function Z(){W=null,K=!1,H=null,$=0,z=q=null}function ee(e,t){return"function"==typeof t?t(e):t}function te(e,t,a){if(W=Y(),z=Q(),G){var n=z.queue;if(t=n.dispatch,null!==q&&void 0!==(a=q.get(n))){q.delete(n),n=z.memoizedState;do{n=e(n,a.action),a=a.next}while(null!==a);return z.memoizedState=n,[n,t]}return[z.memoizedState,t]}return e=e===ee?"function"==typeof t?t():t:void 0!==a?a(t):t,z.memoizedState=e,e=(e=z.queue={last:null,dispatch:null}).dispatch=ne.bind(null,W,e),[z.memoizedState,e]}function ae(e,t){if(W=Y(),t=void 0===t?null:t,null!==(z=Q())){var a=z.memoizedState;if(null!==a&&null!==t){var n=a[1];e:if(null===n)n=!1;else{for(var i=0;i<n.length&&i<t.length;i++)if(!V(t[i],n[i])){n=!1;break e}n=!0}if(n)return a[0]}}return e=e(),z.memoizedState=[e,t],e}function ne(e,t,a){if(!(25>$))throw Error(s(301));if(e===W)if(K=!0,e={action:a,next:null},null===q&&(q=new Map),void 0===(a=q.get(t)))q.set(t,e);else{for(t=a;null!==t.next;)t=t.next;t.next=e}}function ie(){}var se=null,re={readContext:function(e){var t=se.threadID;return x(e,t),e[t]},useContext:function(e){Y();var t=se.threadID;return x(e,t),e[t]},useMemo:ae,useReducer:te,useRef:function(e){W=Y();var t=(z=Q()).memoizedState;return null===t?(e={current:e},z.memoizedState=e):t},useState:function(e){return te(ee,e)},useLayoutEffect:function(){},useCallback:function(e,t){return ae((function(){return e}),t)},useImperativeHandle:ie,useEffect:ie,useDebugValue:ie,useDeferredValue:function(e){return Y(),e},useTransition:function(){return Y(),[function(e){e()},!1]},useOpaqueIdentifier:function(){return(se.identifierPrefix||"")+"R:"+(se.uniqueID++).toString(36)},useMutableSource:function(e,t){return Y(),t(e._source)}},oe={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};function le(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}var ce={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},de=n({menuitem:!0},ce),me={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ue=["Webkit","ms","Moz","O"];Object.keys(me).forEach((function(e){ue.forEach((function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),me[t]=me[e]}))}));var he=/([A-Z])/g,pe=/^ms-/,ge=i.Children.toArray,ve=O.ReactCurrentDispatcher,be={listing:!0,pre:!0,textarea:!0},fe=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,ye={},Ee={};var _e=Object.prototype.hasOwnProperty,we={children:null,dangerouslySetInnerHTML:null,suppressContentEditableWarning:null,suppressHydrationWarning:null};function Se(e,t){if(void 0===e)throw Error(s(152,S(t)||"Component"))}function Oe(e,t,a){function r(i,r){var o=r.prototype&&r.prototype.isReactComponent,l=function(e,t,a,n){if(n&&"object"==typeof(n=e.contextType)&&null!==n)return x(n,a),n[a];if(e=e.contextTypes){for(var i in a={},e)a[i]=t[i];t=a}else t=C;return t}(r,t,a,o),c=[],d=!1,m={isMounted:function(){return!1},enqueueForceUpdate:function(){if(null===c)return null},enqueueReplaceState:function(e,t){d=!0,c=[t]},enqueueSetState:function(e,t){if(null===c)return null;c.push(t)}};if(o){if(o=new r(i.props,l,m),"function"==typeof r.getDerivedStateFromProps){var u=r.getDerivedStateFromProps.call(null,i.props,o.state);null!=u&&(o.state=n({},o.state,u))}}else if(W={},o=r(i.props,l,m),null==(o=X(r,i.props,o,l))||null==o.render)return void Se(e=o,r);if(o.props=i.props,o.context=l,o.updater=m,void 0===(m=o.state)&&(o.state=m=null),"function"==typeof o.UNSAFE_componentWillMount||"function"==typeof o.componentWillMount)if("function"==typeof o.componentWillMount&&"function"!=typeof r.getDerivedStateFromProps&&o.componentWillMount(),"function"==typeof o.UNSAFE_componentWillMount&&"function"!=typeof r.getDerivedStateFromProps&&o.UNSAFE_componentWillMount(),c.length){m=c;var h=d;if(c=null,d=!1,h&&1===m.length)o.state=m[0];else{u=h?m[0]:o.state;var p=!0;for(h=h?1:0;h<m.length;h++){var g=m[h];null!=(g="function"==typeof g?g.call(o,u,i.props,l):g)&&(p?(p=!1,u=n({},u,g)):n(u,g))}o.state=u}}else c=null;if(Se(e=o.render(),r),"function"==typeof o.getChildContext&&"object"==typeof(i=r.childContextTypes)){var v=o.getChildContext();for(var b in v)if(!(b in i))throw Error(s(108,S(r)||"Unknown",b))}v&&(t=n({},t,v))}for(;i.isValidElement(e);){var o=e,l=o.type;if("function"!=typeof l)break;r(o,l)}return{child:e,context:t}}var Ce=function(){function e(e,t,a){i.isValidElement(e)?e.type!==o?e=[e]:(e=e.props.children,e=i.isValidElement(e)?[e]:ge(e)):e=ge(e),e={type:null,domNamespace:oe.html,children:e,childIndex:0,context:C,footer:""};var n=j[0];if(0===n){var r=j,l=2*(n=r.length);if(!(65536>=l))throw Error(s(304));var c=new Uint16Array(l);for(c.set(r),(j=c)[0]=n+1,r=n;r<l-1;r++)j[r]=r+1;j[l-1]=0}else j[0]=j[n];this.threadID=n,this.stack=[e],this.exhausted=!1,this.currentSelectValue=null,this.previousWasTextNode=!1,this.makeStaticMarkup=t,this.suspenseDepth=0,this.contextIndex=-1,this.contextStack=[],this.contextValueStack=[],this.uniqueID=0,this.identifierPrefix=a&&a.identifierPrefix||""}var t=e.prototype;return t.destroy=function(){if(!this.exhausted){this.exhausted=!0,this.clearProviders();var e=this.threadID;j[e]=j[0],j[0]=e}},t.pushProvider=function(e){var t=++this.contextIndex,a=e.type._context,n=this.threadID;x(a,n);var i=a[n];this.contextStack[t]=a,this.contextValueStack[t]=i,a[n]=e.props.value},t.popProvider=function(){var e=this.contextIndex,t=this.contextStack[e],a=this.contextValueStack[e];this.contextStack[e]=null,this.contextValueStack[e]=null,this.contextIndex--,t[this.threadID]=a},t.clearProviders=function(){for(var e=this.contextIndex;0<=e;e--)this.contextStack[e][this.threadID]=this.contextValueStack[e]},t.read=function(e){if(this.exhausted)return null;var t=se;se=this;var a=ve.current;ve.current=re;try{for(var n=[""],i=!1;n[0].length<e;){if(0===this.stack.length){this.exhausted=!0;var r=this.threadID;j[r]=j[0],j[0]=r;break}var o=this.stack[this.stack.length-1];if(i||o.childIndex>=o.children.length){var l=o.footer;if(""!==l&&(this.previousWasTextNode=!1),this.stack.pop(),"select"===o.type)this.currentSelectValue=null;else if(null!=o.type&&null!=o.type.type&&o.type.type.$$typeof===d)this.popProvider(o.type);else if(o.type===h){this.suspenseDepth--;var c=n.pop();if(i){i=!1;var m=o.fallbackFrame;if(!m)throw Error(s(303));this.stack.push(m),n[this.suspenseDepth]+="\x3c!--$!--\x3e";continue}n[this.suspenseDepth]+=c}n[this.suspenseDepth]+=l}else{var u=o.children[o.childIndex++],p="";try{p+=this.render(u,o.context,o.domNamespace)}catch(e){if(null!=e&&"function"==typeof e.then)throw Error(s(294));throw e}n.length<=this.suspenseDepth&&n.push(""),n[this.suspenseDepth]+=p}}return n[0]}finally{ve.current=a,se=t,Z()}},t.render=function(e,t,a){if("string"==typeof e||"number"==typeof e)return""===(a=""+e)?"":this.makeStaticMarkup?F(a):this.previousWasTextNode?"\x3c!-- --\x3e"+F(a):(this.previousWasTextNode=!0,F(a));if(e=(t=Oe(e,t,this.threadID)).child,t=t.context,null===e||!1===e)return"";if(!i.isValidElement(e)){if(null!=e&&null!=e.$$typeof){if((a=e.$$typeof)===r)throw Error(s(257));throw Error(s(258,a.toString()))}return e=ge(e),this.stack.push({type:null,domNamespace:a,children:e,childIndex:0,context:t,footer:""}),""}var b=e.type;if("string"==typeof b)return this.renderDOM(e,t,a);switch(b){case _:case E:case l:case c:case p:case o:return e=ge(e.props.children),this.stack.push({type:null,domNamespace:a,children:e,childIndex:0,context:t,footer:""}),"";case h:throw Error(s(294));case y:throw Error(s(343))}if("object"==typeof b&&null!==b)switch(b.$$typeof){case u:W={};var w=b.render(e.props,e.ref);return w=X(b.render,e.props,w,e.ref),w=ge(w),this.stack.push({type:null,domNamespace:a,children:w,childIndex:0,context:t,footer:""}),"";case g:return e=[i.createElement(b.type,n({ref:e.ref},e.props))],this.stack.push({type:null,domNamespace:a,children:e,childIndex:0,context:t,footer:""}),"";case d:return a={type:e,domNamespace:a,children:b=ge(e.props.children),childIndex:0,context:t,footer:""},this.pushProvider(e),this.stack.push(a),"";case m:b=e.type,w=e.props;var S=this.threadID;return x(b,S),b=ge(w.children(b[S])),this.stack.push({type:e,domNamespace:a,children:b,childIndex:0,context:t,footer:""}),"";case f:throw Error(s(338));case v:return b=(w=(b=e.type)._init)(b._payload),e=[i.createElement(b,n({ref:e.ref},e.props))],this.stack.push({type:null,domNamespace:a,children:e,childIndex:0,context:t,footer:""}),""}throw Error(s(130,null==b?b:typeof b,""))},t.renderDOM=function(e,t,a){var r=e.type.toLowerCase();if(a===oe.html&&le(r),!ye.hasOwnProperty(r)){if(!fe.test(r))throw Error(s(65,r));ye[r]=!0}var o=e.props;if("input"===r)o=n({type:void 0},o,{defaultChecked:void 0,defaultValue:void 0,value:null!=o.value?o.value:o.defaultValue,checked:null!=o.checked?o.checked:o.defaultChecked});else if("textarea"===r){var l=o.value;if(null==l){l=o.defaultValue;var c=o.children;if(null!=c){if(null!=l)throw Error(s(92));if(Array.isArray(c)){if(!(1>=c.length))throw Error(s(93));c=c[0]}l=""+c}null==l&&(l="")}o=n({},o,{value:void 0,children:""+l})}else if("select"===r)this.currentSelectValue=null!=o.value?o.value:o.defaultValue,o=n({},o,{value:void 0});else if("option"===r){c=this.currentSelectValue;var d=function(e){if(null==e)return e;var t="";return i.Children.forEach(e,(function(e){null!=e&&(t+=e)})),t}(o.children);if(null!=c){var m=null!=o.value?o.value+"":d;if(l=!1,Array.isArray(c)){for(var u=0;u<c.length;u++)if(""+c[u]===m){l=!0;break}}else l=""+c===m;o=n({selected:void 0,children:void 0},o,{selected:l,children:d})}}if(l=o){if(de[r]&&(null!=l.children||null!=l.dangerouslySetInnerHTML))throw Error(s(137,r));if(null!=l.dangerouslySetInnerHTML){if(null!=l.children)throw Error(s(60));if("object"!=typeof l.dangerouslySetInnerHTML||!("__html"in l.dangerouslySetInnerHTML))throw Error(s(61))}if(null!=l.style&&"object"!=typeof l.style)throw Error(s(62))}l=o,c=this.makeStaticMarkup,d=1===this.stack.length,m="<"+e.type;e:if(-1===r.indexOf("-"))u="string"==typeof l.is;else switch(r){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":u=!1;break e;default:u=!0}for(_ in l)if(_e.call(l,_)){var h=l[_];if(null!=h){if("style"===_){var p=void 0,g="",v="";for(p in h)if(h.hasOwnProperty(p)){var b=0===p.indexOf("--"),f=h[p];if(null!=f){if(b)var y=p;else if(y=p,Ee.hasOwnProperty(y))y=Ee[y];else{var E=y.replace(he,"-$1").toLowerCase().replace(pe,"-ms-");y=Ee[y]=E}g+=v+y+":",v=p,g+=b=null==f||"boolean"==typeof f||""===f?"":b||"number"!=typeof f||0===f||me.hasOwnProperty(v)&&me[v]?(""+f).trim():f+"px",v=";"}}h=g||null}p=null,u?we.hasOwnProperty(_)||(p=P(p=_)&&null!=h?p+'="'+F(h)+'"':""):p=B(_,h),p&&(m+=" "+p)}}c||d&&(m+=' data-reactroot=""');var _=m;l="",ce.hasOwnProperty(r)?_+="/>":(_+=">",l="</"+e.type+">");e:{if(null!=(c=o.dangerouslySetInnerHTML)){if(null!=c.__html){c=c.__html;break e}}else if("string"==typeof(c=o.children)||"number"==typeof c){c=F(c);break e}c=null}return null!=c?(o=[],be.hasOwnProperty(r)&&"\n"===c.charAt(0)&&(_+="\n"),_+=c):o=ge(o.children),e=e.type,a=null==a||"http://www.w3.org/1999/xhtml"===a?le(e):"http://www.w3.org/2000/svg"===a&&"foreignObject"===e?"http://www.w3.org/1999/xhtml":a,this.stack.push({domNamespace:a,type:r,children:o,childIndex:0,context:t,footer:l}),this.previousWasTextNode=!1,_},e}();t.renderToNodeStream=function(){throw Error(s(207))},t.renderToStaticMarkup=function(e,t){e=new Ce(e,!0,t);try{return e.read(1/0)}finally{e.destroy()}},t.renderToStaticNodeStream=function(){throw Error(s(208))},t.renderToString=function(e,t){e=new Ce(e,!1,t);try{return e.read(1/0)}finally{e.destroy()}},t.version="17.0.2"},1502:function(e,t,a){"use strict";var n=a(1503),i=/[\/\?<>\\:\*\|"]/g,s=/[\x00-\x1f\x80-\x9f]/g,r=/^\.+$/,o=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i,l=/[\. ]+$/;function c(e,t){if("string"!=typeof e)throw new Error("Input must be string");var a=e.replace(i,t).replace(s,t).replace(r,t).replace(o,t).replace(l,t);return n(a,255)}e.exports=function(e,t){var a=t&&t.replacement||"",n=c(e,a);return""===a?n:c(n,"")}},1503:function(e,t,a){"use strict";var n=a(1504),i=a(1505);e.exports=n.bind(null,i)},1504:function(e,t,a){"use strict";function n(e){return e>=55296&&e<=56319}function i(e){return e>=56320&&e<=57343}e.exports=function(e,t,a){if("string"!=typeof t)throw new Error("Input must be string");for(var s,r,o=t.length,l=0,c=0;c<o;c+=1){if(s=t.charCodeAt(c),r=t[c],n(s)&&i(t.charCodeAt(c+1))&&(r+=t[c+=1]),(l+=e(r))===a)return t.slice(0,c+1);if(l>a)return t.slice(0,c-r.length+1)}return t}},1505:function(e,t,a){"use strict";function n(e){return e>=55296&&e<=56319}function i(e){return e>=56320&&e<=57343}e.exports=function(e){if("string"!=typeof e)throw new Error("Input must be string");for(var t=e.length,a=0,s=null,r=null,o=0;o<t;o++)i(s=e.charCodeAt(o))?null!=r&&n(r)?a+=1:a+=3:s<=127?a+=1:s>=128&&s<=2047?a+=2:s>=2048&&s<=65535&&(a+=3),r=s;return a}},1506:function(e,t,a){"use strict";var n=a(1507);const i=/\.[\w-]+/g;function s(e){return e.replace(/font-family: ?(Inter|'Inter'|"Inter")/g,"font-family: -apple-system, BlinkMacSystemFont, avenir next,\n avenir, segoe ui, helvetica neue, helvetica, Ubuntu, roboto, noto, arial, sans-serif").replace(/font-family: ?Inconsolata/g,"font-family: Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace")}function r(e){var t;return"light"===(null===(t=e.ownerNode.dataset.mxTheme)||void 0===t?void 0:t.toLowerCase())}t.a=async e=>{const t=Array.from(document.styleSheets).filter((e=>{var t;return(null===(t=e.href)||void 0===t?void 0:t.endsWith("bundle.css"))||r(e)}));if(!t.some(r)){var a;const e=null===(a=document.querySelector('link[rel="stylesheet"][href$="theme-light.css"]'))||void 0===a?void 0:a.href;e&&t.push(await async function(e){const t=document.implementation.createHTMLDocument(""),a=document.createElement("style"),n=await fetch(e);return a.textContent=await n.text(),t.body.appendChild(a),a.sheet}(e))}let o="";for(const a of t)for(const t of a.cssRules){if(t instanceof CSSFontFaceRule)continue;const a=t.selectorText;null!=a&&a.split(",").every((t=>{const a=t.match(i);if(a&&!a.every((t=>e.has(t.substring(1)))))return!0}))||(o+=s(t.cssText)+"\n")}return o+n.a}},1508:function(e,t,a){"use strict";t.a='/*\nCopyright 2021 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the "License");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an "AS IS" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n// This file is raw-imported (imported as plain text) for the export bundle, which is why this is in JS\nfunction showToastIfNeeded(replyId) {\n const el = document.getElementById(replyId);\n if (!el) {\n showToast("The message you\'re looking for wasn\'t exported");\n return;\n }\n}\n\nfunction showToast(text) {\n const el = document.getElementById("snackbar");\n el.innerHTML = text;\n el.className = "mx_show";\n window.setTimeout(() => {\n el.className = el.className.replace("mx_show", "");\n }, 2000);\n}\n\nwindow.onload = () => {\n document.querySelectorAll(".mx_reply_anchor").forEach((element) => {\n element.addEventListener("click", (event) => {\n showToastIfNeeded(event.target.dataset.scrollTo);\n });\n });\n};\n'},1509:function(e,t,a){"use strict";(function(e){var n=a(120),i=a.n(n),s=a(1),r=a(179),o=a(129),l=a(121),c=a(124),d=a(128),m=a(135),u=a(213),h=a(145),p=a(177);t.a=t=>{const{matrixClient:a,room:g,member:v,onFinished:b}=t,[f,y]=Object(n.useState)(!0);let E=g.getLiveTimeline(),_=[];for(;E;)_=[..._,...E.getEvents().filter((e=>e.getSender()===v.userId&&!e.isRedacted()&&!e.isRedaction()&&e.getType()!==o.b.RoomCreate&&e.getType()!==o.b.RoomServerAcl&&e.getType()!==o.b.RoomEncryption))],E=E.getNeighbouringTimeline(r.b.BACKWARDS);if(0===_.length)return i.a.createElement(u.a,{onFinished:b,title:Object(l.a)("No recent messages by %(user)s found",{user:v.name}),description:i.a.createElement("div",null,i.a.createElement("p",null,Object(l.a)("Try scrolling up in the timeline to see if there are any earlier ones.")))});{_=_.filter((e=>!(f&&e.isState())));const t=_.length,n=v.name,r=async()=>{s.a.info(`Started redacting recent ${t} messages for ${v.userId} in ${g.roomId}`),c.a.dispatch({action:d.a.BulkRedactStart,room_id:g.roomId}),await Promise.resolve(),await Promise.all(_.reverse().map((async e=>{try{await a.redactEvent(g.roomId,e.getId())}catch(t){s.a.error("Could not redact",e.getId()),s.a.error(t)}}))),s.a.info(`Finished redacting recent ${t} messages for ${v.userId} in ${g.roomId}`),c.a.dispatch({action:d.a.BulkRedactEnd,room_id:g.roomId})};return i.a.createElement(m.a,{className:"mx_BulkRedactDialog",onFinished:b,title:Object(l.a)("Remove recent messages by %(user)s",{user:n}),contentId:"mx_Dialog_content"},i.a.createElement("div",{className:"mx_Dialog_content",id:"mx_Dialog_content"},i.a.createElement("p",null,Object(l.a)("You are about to remove %(count)s messages by %(user)s. This will remove them permanently for everyone in the conversation. Do you wish to continue?",{count:t,user:n})),i.a.createElement("p",null,Object(l.a)("For a large amount of messages, this might take some time. Please don't refresh your client in the meantime.")),i.a.createElement(p.b,{checked:f,onChange:e=>y(e.target.checked)},Object(l.a)("Preserve system messages")),i.a.createElement("div",{className:"mx_BulkRedactDialog_checkboxMicrocopy"},Object(l.a)("Uncheck if you also want to remove system messages on this user (e.g. membership change, profile change…)"))),i.a.createElement(h.a,{primaryButton:Object(l.a)("Remove %(count)s messages",{count:t}),primaryButtonClass:"danger",primaryDisabled:0===t,onPrimaryButtonClick:()=>{e(r),b(!0)},onCancel:()=>b(!1)}))}}}).call(this,a(54).setImmediate)},1510:function(e,t){e.exports="img/stickerpack-placeholder.c50e1de.png"},1511:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return p}));var n,i,s,r,o,l,c,d,m,u=a(120);function h(){return h=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},h.apply(this,arguments)}function p(e){return u.createElement("svg",h({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 31 31",role:"presentation","aria-hidden":!0},e),n||(n=u.createElement("path",{fill:"none",d:"M0 0h31v31H0z"})),i||(i=u.createElement("circle",{cx:15.5,cy:15.5,r:15.5,fill:"#A2A2A2"})),s||(s=u.createElement("path",{d:"M22.855 15.5a7.355 7.355 0 11-14.71 0 7.355 7.355 0 0114.71 0zM15.5 24.25a8.75 8.75 0 100-17.5 8.75 8.75 0 000 17.5z",fill:"#fff",stroke:"#fff",strokeWidth:.5})),r||(r=u.createElement("path",{fill:"#A2A2A2",d:"M16.266 30.503h-1.5L14.76 1.1h1.5z"})),o||(o=u.createElement("path",{fill:"#A2A2A2",d:"M8.894 28.844l-1.294-.76L22.605 2.503l1.294.759z"})),l||(l=u.createElement("path",{fill:"#A2A2A2",d:"M2.88 24.495l-.786-1.278L27.71 7.46l.786 1.277z"})),c||(c=u.createElement("path",{fill:"#A2A2A2",d:"M2.163 23.341L1.49 22l26.51-13.264.671 1.341z"})),d||(d=u.createElement("path",{fill:"#A2A2A2",d:"M1.551 22.134L1 20.74 28.433 9.887l.552 1.394z"})),m||(m=u.createElement("path",{d:"M9.5 17l-2 3-2-3h4zM21.5 15l2-3 2 3h-4z",fill:"#fff",stroke:"#fff"})))}t.default="img/room_replaced.97416ee.svg"},1512:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return r}));var n,i=a(120);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},s.apply(this,arguments)}function r(e){return i.createElement("svg",s({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",role:"presentation","aria-hidden":!0},e),n||(n=i.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16 0C7.163 0 0 7.163 0 16s7.163 16 16 16 16-7.163 16-16S24.837 0 16 0zm1.251 6.974a1.496 1.496 0 00-2.051-.129 1.495 1.495 0 00-.13.12l-6.274 6.589a1.5 1.5 0 102.173 2.069l3.688-3.873V23.06a1.5 1.5 0 103 0V11.75l3.688 3.873a1.5 1.5 0 102.173-2.07L17.25 6.975z",fill:"#0DBD8B"})))}t.default="img/upload-big.dcf3fb1.svg"},1513:function(e,t,a){"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.RoomViewLifecycle=void 0,t.RoomViewLifecycle=n,function(e){e.PreviewRoomNotLoggedIn="preview_not_logged_in",e.JoinFromRoomPreview="try_join_not_logged_in"}(n||(t.RoomViewLifecycle=n={}))},1515:function(e,t,a){"use strict";(function(e){a.d(t,"a",(function(){return h}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(195),l=a(1516),c=a(396);const d=336,m=232,u={top:58,bottom:58,left:76,right:8};class h extends r.a.Component{constructor(){var t;super(...arguments),t=this,i()(this,"callViewWrapper",Object(s.createRef)()),i()(this,"initX",0),i()(this,"initY",0),i()(this,"desiredTranslationX",o.b.instance.windowWidth-u.right-d),i()(this,"desiredTranslationY",o.b.instance.windowHeight-u.bottom-m),i()(this,"translationX",this.desiredTranslationX),i()(this,"translationY",this.desiredTranslationY),i()(this,"mouseHeld",!1),i()(this,"scheduledUpdate",new c.a((()=>this.animationCallback()),(()=>requestAnimationFrame((()=>this.scheduledUpdate.trigger()))))),i()(this,"startingPositionX",0),i()(this,"startingPositionY",0),i()(this,"_moving",!1),i()(this,"animationCallback",(()=>{var e,t;if(!this.moving&&Math.abs(this.translationX-this.desiredTranslationX)<=1&&Math.abs(this.translationY-this.desiredTranslationY)<=1)this.translationX=this.desiredTranslationX,this.translationY=this.desiredTranslationY,this.setStyle();else{const e=this.moving?.2:.1;this.translationX=Object(l.a)(this.translationX,this.desiredTranslationX,e),this.translationY=Object(l.a)(this.translationY,this.desiredTranslationY,e),this.setStyle(),this.scheduledUpdate.mark()}null===(e=(t=this.props).onMove)||void 0===e||e.call(t)})),i()(this,"setStyle",(()=>{this.callViewWrapper.current&&(this.callViewWrapper.current.style.transform=`translateX(${this.translationX}px) translateY(${this.translationY}px)`)})),i()(this,"onResize",(()=>{this.snap(!1)})),i()(this,"snap",(function(){var e,a;let n=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const i=t.desiredTranslationX,s=t.desiredTranslationY,r=o.b.instance.windowWidth-((null===(e=t.callViewWrapper.current)||void 0===e?void 0:e.clientWidth)||d),l=o.b.instance.windowHeight-((null===(a=t.callViewWrapper.current)||void 0===a?void 0:a.clientHeight)||m);i>=r/2&&s>=l/2?(t.desiredTranslationX=r-u.right,t.desiredTranslationY=l-u.bottom):i>=r/2&&s<=l/2?(t.desiredTranslationX=r-u.right,t.desiredTranslationY=u.top):i<=r/2&&s>=l/2?(t.desiredTranslationX=u.left,t.desiredTranslationY=l-u.bottom):(t.desiredTranslationX=u.left,t.desiredTranslationY=u.top),n||(t.translationX=t.desiredTranslationX,t.translationY=t.desiredTranslationY),t.scheduledUpdate.mark()})),i()(this,"onStartMoving",(e=>{e.preventDefault(),e.stopPropagation(),this.mouseHeld=!0,this.startingPositionX=e.clientX,this.startingPositionY=e.clientY})),i()(this,"onMoving",(e=>{this.mouseHeld&&(Math.abs(this.startingPositionX-e.clientX)<5&&Math.abs(this.startingPositionY-e.clientY)<5||(e.preventDefault(),e.stopPropagation(),this.moving||(this.moving=!0,this.initX=e.pageX-this.desiredTranslationX,this.initY=e.pageY-this.desiredTranslationY,this.scheduledUpdate.mark()),this.setTranslation(e.pageX-this.initX,e.pageY-this.initY)))})),i()(this,"onEndMoving",(t=>{this.mouseHeld&&(t.preventDefault(),t.stopPropagation(),this.mouseHeld=!1,e((()=>this.moving=!1)),this.snap(!0))})),i()(this,"onClickCapture",(e=>{this.moving&&(e.preventDefault(),e.stopPropagation())}))}get moving(){return this._moving}set moving(e){this._moving=e}componentDidMount(){document.addEventListener("mousemove",this.onMoving),document.addEventListener("mouseup",this.onEndMoving),o.b.instance.on(o.a.Resize,this.onResize),this.snap()}componentWillUnmount(){document.removeEventListener("mousemove",this.onMoving),document.removeEventListener("mouseup",this.onEndMoving),o.b.instance.off(o.a.Resize,this.onResize)}componentDidUpdate(e){e.children!==this.props.children&&this.snap(!0)}setTranslation(e,t){var a,n;const i=(null===(a=this.callViewWrapper.current)||void 0===a?void 0:a.clientWidth)||d,s=(null===(n=this.callViewWrapper.current)||void 0===n?void 0:n.clientHeight)||m;e+i>=o.b.instance.windowWidth?this.desiredTranslationX=o.b.instance.windowWidth-i:this.desiredTranslationX=e<=0?0:e,t+s>=o.b.instance.windowHeight?this.desiredTranslationY=o.b.instance.windowHeight-s:this.desiredTranslationY=t<=0?0:t}render(){const e={transform:`translateX(${this.translationX}px) translateY(${this.translationY}px)`},t=this.props.children.map((e=>e({onStartMoving:this.onStartMoving,onResize:this.onResize})));return r.a.createElement("aside",{className:this.props.className,style:e,ref:this.callViewWrapper,onClickCapture:this.onClickCapture,onDoubleClick:this.props.onDoubleClick},t)}}}).call(this,a(54).setImmediate)},1516:function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(149);function i(e,t,a){return(1-(a=Object(n.clamp)(a,0,1)))*e+a*t}},1517:function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(123),l=a(139),c=a(614),d=a(845),m=a(183);class u extends r.a.PureComponent{constructor(e){super(e),i()(this,"numberEntryFieldRef",Object(s.createRef)()),i()(this,"onCancelClick",(()=>{this.props.onFinished(!1)})),i()(this,"onChange",(e=>{this.setState({value:e.target.value})})),i()(this,"onFormSubmit",(e=>{e.preventDefault(),this.onDialPress()})),i()(this,"onDigitPress",((e,t)=>{var a;(this.setState({value:this.state.value+e}),"click"===t.type)&&(null===(a=this.numberEntryFieldRef.current)||void 0===a||a.focus())})),i()(this,"onDeletePress",(e=>{var t;0!==this.state.value.length&&(this.setState({value:this.state.value.slice(0,-1)}),"click"===e.type&&(null===(t=this.numberEntryFieldRef.current)||void 0===t||t.focus()))})),i()(this,"onDialPress",(async()=>{m.b.instance.dialNumber(this.state.value),this.props.onFinished(!0)})),this.state={value:""}}render(){const e=r.a.createElement(d.a,{onBackspacePress:this.onDeletePress});let t;return t=0!==this.state.value.length?r.a.createElement(l.a,{ref:this.numberEntryFieldRef,className:"mx_DialPadModal_field",id:"dialpad_number",value:this.state.value,autoFocus:!0,onChange:this.onChange,postfixComponent:e}):r.a.createElement(l.a,{ref:this.numberEntryFieldRef,className:"mx_DialPadModal_field",id:"dialpad_number",value:this.state.value,autoFocus:!0,onChange:this.onChange}),r.a.createElement("div",{className:"mx_DialPadModal"},r.a.createElement("div",null,r.a.createElement(o.a,{className:"mx_DialPadModal_cancel",onClick:this.onCancelClick})),r.a.createElement("div",{className:"mx_DialPadModal_header"},r.a.createElement("form",{onSubmit:this.onFormSubmit},t)),r.a.createElement("div",{className:"mx_DialPadModal_dialPad"},r.a.createElement(c.a,{hasDial:!0,onDigitPress:this.onDigitPress,onDeletePress:this.onDeletePress,onDialPress:this.onDialPress})))}}},1518:function(e,t,a){"use strict";a.d(t,"a",(function(){return d}));var n=a(121),i=a(236),s=a(198),r=a(131);const o=()=>{window.location.href="mobile_guide/"},l=()=>{document.cookie="element_mobile_redirect_to_guide=false;path=/;max-age=14400",m()},c="mobileguide",d=()=>{const e=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,t=/Android/.test(navigator.userAgent),a=r.b.get().brand;(e||t)&&(document.cookie.includes("element_mobile_redirect_to_guide=false")||s.a.sharedInstance().addOrReplaceToast({key:c,title:Object(n.a)("Use app for a better experience"),props:{description:Object(n.a)("%(brand)s is experimental on a mobile web browser. For a better experience and the latest features, use our free native app.",{brand:a}),acceptLabel:Object(n.a)("Use app"),onAccept:o,rejectLabel:Object(n.a)("Dismiss"),onReject:l},component:i.a,priority:99}))},m=()=>{s.a.sharedInstance().dismissToast(c)}},1519:function(e,t,a){"use strict";(function(e){a.d(t,"a",(function(){return b}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(490),l=a(121),c=a(123),d=a(449),m=a(134),u=a(899),h=a(1520),p=a(394),g=a(1521),v=a(651);class b extends r.a.Component{constructor(e){super(e),i()(this,"handleClick",(e=>async t=>{t.preventDefault(),await this.props.onClick(e)})),i()(this,"cancelButton",(()=>r.a.createElement(c.a,{"data-testid":"cancel-button",kind:"primary_outline",onClick:this.handleClick(v.a.Cancel)},Object(l.a)("Cancel")))),i()(this,"simpleSpinner",(e=>r.a.createElement("div",{className:"mx_LoginWithQR_spinner"},r.a.createElement("div",null,r.a.createElement(m.a,null),e&&r.a.createElement("p",null,e)))))}render(){let t,a,n,i,s="",m=!0,b=!1;switch(this.props.phase){case v.c.Error:switch(this.props.failureReason){case o.c.Expired:i=Object(l.a)("The linking wasn't completed in the required time.");break;case o.c.InvalidCode:i=Object(l.a)("The scanned code is invalid.");break;case o.c.UnsupportedAlgorithm:i=Object(l.a)("Linking with this device is not supported.");break;case o.c.UserDeclined:i=Object(l.a)("The request was declined on the other device.");break;case o.c.OtherDeviceAlreadySignedIn:i=Object(l.a)("The other device is already signed in.");break;case o.c.OtherDeviceNotSignedIn:i=Object(l.a)("The other device isn't signed in.");break;case o.c.UserCancelled:i=Object(l.a)("The request was cancelled.");break;case o.c.Unknown:i=Object(l.a)("An unexpected error occurred.");break;case o.c.HomeserverLacksSupport:i=Object(l.a)("The homeserver doesn't support signing in another device.");break;default:i=Object(l.a)("The request was cancelled.")}s=Object(l.a)("Connection failed"),b=!0,t=r.a.createElement(p.Icon,{className:"error"}),m=!1,a=r.a.createElement("p",{"data-testid":"cancellation-message"},i),n=r.a.createElement(r.a.Fragment,null,r.a.createElement(c.a,{"data-testid":"try-again-button",kind:"primary",onClick:this.handleClick(v.a.TryAgain)},Object(l.a)("Try again")),this.cancelButton());break;case v.c.Connected:s=Object(l.a)("Devices connected"),t=r.a.createElement(h.a,{className:"normal"}),m=!1,a=r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,Object(l.a)("Check that the code below matches with your other device:")),r.a.createElement("div",{className:"mx_LoginWithQR_confirmationDigits"},this.props.confirmationDigits),r.a.createElement("div",{className:"mx_LoginWithQR_confirmationAlert"},r.a.createElement("div",null,r.a.createElement(g.a,null)),r.a.createElement("div",null,Object(l.a)("By approving access for this device, it will have full access to your account.")))),n=r.a.createElement(r.a.Fragment,null,r.a.createElement(c.a,{"data-testid":"decline-login-button",kind:"primary_outline",onClick:this.handleClick(v.a.Decline)},Object(l.a)("Cancel")),r.a.createElement(c.a,{"data-testid":"approve-login-button",kind:"primary",onClick:this.handleClick(v.a.Approve)},Object(l.a)("Approve")));break;case v.c.ShowingQR:if(s=Object(l.a)("Sign in with QR code"),this.props.code){var f;const t=r.a.createElement("div",{className:"mx_LoginWithQR_qrWrapper"},r.a.createElement(d.a,{data:[{data:e.from(null!==(f=this.props.code)&&void 0!==f?f:""),mode:"byte"}],className:"mx_QRCode"}));a=r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,Object(l.a)("Scan the QR code below with your device that's signed out.")),r.a.createElement("ol",null,r.a.createElement("li",null,Object(l.a)("Start at the sign in screen")),r.a.createElement("li",null,Object(l.a)("Select '%(scanQRCode)s'",{scanQRCode:Object(l.a)("Scan QR code")})),r.a.createElement("li",null,Object(l.a)("Review and approve the sign in"))),t)}else a=this.simpleSpinner(),n=this.cancelButton();break;case v.c.Loading:a=this.simpleSpinner();break;case v.c.Connecting:a=this.simpleSpinner(Object(l.a)("Connecting…")),n=this.cancelButton();break;case v.c.WaitingForDevice:a=this.simpleSpinner(Object(l.a)("Waiting for device to sign in")),n=this.cancelButton();break;case v.c.Verifying:s=Object(l.a)("Success"),b=!0,a=this.simpleSpinner(Object(l.a)("Completing set up of your new device"))}return r.a.createElement("div",{"data-testid":"login-with-qr",className:"mx_LoginWithQR"},r.a.createElement("div",{className:b?"mx_LoginWithQR_centreTitle":""},m?r.a.createElement(c.a,{"data-testid":"back-button",className:"mx_LoginWithQR_BackButton",onClick:this.handleClick(v.a.Back),title:"Back"},r.a.createElement(u.a,null)):null,r.a.createElement("h1",null,t,s)),r.a.createElement("div",{className:"mx_LoginWithQR_main"},a),r.a.createElement("div",{className:"mx_LoginWithQR_buttons"},n))}}}).call(this,a(53).Buffer)},1520:function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n,i,s=a(120);function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},r.apply(this,arguments)}function o(e){return s.createElement("svg",r({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",role:"presentation","aria-hidden":!0},e),n||(n=s.createElement("g",{clipPath:"url(#devices_svg__clip0_721_35674)"},s.createElement("path",{d:"M5.333 9.333C5.333 8.6 5.933 8 6.667 8H28c.733 0 1.333-.6 1.333-1.334 0-.733-.6-1.333-1.333-1.333H5.333A2.675 2.675 0 002.667 8v14.666H2c-1.107 0-2 .894-2 2 0 1.107.893 2 2 2h16.667v-4H5.333V9.333zm25.334 1.333h-8c-.734 0-1.334.6-1.334 1.334v13.333c0 .734.6 1.334 1.334 1.334h8c.733 0 1.333-.6 1.333-1.334V12c0-.733-.6-1.334-1.333-1.334zm-1.334 12H24v-9.333h5.333v9.333z",fill:"currentColor"}))),i||(i=s.createElement("defs",null,s.createElement("clipPath",{id:"devices_svg__clip0_721_35674"},s.createElement("path",{fill:"#fff",d:"M0 0h32v32H0z"})))))}},1521:function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n,i=a(120);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},s.apply(this,arguments)}function r(e){return i.createElement("svg",s({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",role:"presentation","aria-hidden":!0},e),n||(n=i.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 10a1.5 1.5 0 100-3 1.5 1.5 0 000 3zm-1 3a1 1 0 110-2h1a1 1 0 011 1v3.5h.5a1 1 0 110 2H12a1 1 0 01-1-1V13z",fill:"#000"})))}},1522:function(e,t,a){"use strict";var n=a(120),i=a.n(n),s=a(121),r=a(131),o=a(135),l=a(145),c=a(134);t.a=e=>{let{failures:t,source:a,continuation:d,onFinished:m}=e;const[u,h]=Object(n.useState)(2),[p,g]=Object(n.useState)(!1),[v,b]=Object(n.useState)(!1),[f,y]=Object(n.useState)(!1),E=Object(n.useRef)(m),_=new Map([["_afterCrossSigningLocalKeyChange",Object(s.a)("a new master key signature")],["checkOwnCrossSigningTrust",Object(s.a)("a new cross-signing key signature")],["setDeviceVerification",Object(s.a)("a device cross-signing signature")]]),w=Object(s.a)("a key signature"),S=Object(n.useCallback)((async()=>{try{b(!0);const e=new Promise(((e,t)=>{E.current=t})).finally((()=>{g(!0)}));await Promise.race([d({shouldEmit:!1}),e]),y(!0)}catch(e){h((e=>e-1))}finally{E.current=m,b(!1)}}),[d,m]);let O;if(!f&&!p&&d&&u>0){const e=_.get(a)||w,n=r.b.get().brand;O=i.a.createElement("div",null,i.a.createElement("p",null,Object(s.a)("%(brand)s encountered an error during upload of:",{brand:n})),i.a.createElement("p",null,e),v&&i.a.createElement(c.a,null),i.a.createElement("pre",null,JSON.stringify(t,null,2)),i.a.createElement(l.a,{primaryButton:"Retry",hasCancel:!0,onPrimaryButtonClick:S,onCancel:E.current,primaryDisabled:v}))}else{let e=Object(s.a)("Upload completed");f||(e=p?Object(s.a)("Cancelled signature upload"):Object(s.a)("Unable to upload")),O=i.a.createElement("div",null,i.a.createElement("span",null,e),i.a.createElement(l.a,{primaryButton:Object(s.a)("OK"),hasCancel:!1,onPrimaryButtonClick:m}))}return i.a.createElement(o.a,{title:f?Object(s.a)("Signature upload success"):Object(s.a)("Signature upload failed"),fixedWidth:!1,onFinished:()=>{}},O)}},1523:function(e,t,a){"use strict";a.d(t,"a",(function(){return h}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(121),l=a(473),c=a(859),d=a(123),m=a(907),u=a(318);class h extends r.a.Component{constructor(e){super(e),i()(this,"onStoreUpdate",(()=>{const e=l.b.sharedInstance();this.setState({phase:e.phase,lostKeys:e.lostKeys()})})),i()(this,"onSkipClick",(()=>{l.b.sharedInstance().skip()}));const t=l.b.sharedInstance();t.on("update",this.onStoreUpdate),t.start(),this.state={phase:t.phase,lostKeys:t.lostKeys()}}componentWillUnmount(){const e=l.b.sharedInstance();e.off("update",this.onStoreUpdate),e.stop()}render(){const{phase:e,lostKeys:t}=this.state;let a,n,i;if(e===l.a.Loading)return null;if(e===l.a.Intro)t?(a=r.a.createElement("span",{className:"mx_CompleteSecurity_headerIcon mx_E2EIcon_warning"}),n=Object(o.a)("Unable to verify this device")):(a=r.a.createElement("span",{className:"mx_CompleteSecurity_headerIcon mx_E2EIcon_warning"}),n=Object(o.a)("Verify this device"));else if(e===l.a.Done)a=r.a.createElement("span",{className:"mx_CompleteSecurity_headerIcon mx_E2EIcon_verified"}),n=Object(o.a)("Device verified");else if(e===l.a.ConfirmSkip)a=r.a.createElement("span",{className:"mx_CompleteSecurity_headerIcon mx_E2EIcon_warning"}),n=Object(o.a)("Are you sure?");else if(e===l.a.Busy)a=r.a.createElement("span",{className:"mx_CompleteSecurity_headerIcon mx_E2EIcon_warning"}),n=Object(o.a)("Verify this device");else if(e===l.a.ConfirmReset)a=r.a.createElement("span",{className:"mx_CompleteSecurity_headerIcon mx_E2EIcon_warning"}),n=Object(o.a)("Really reset verification keys?");else if(e!==l.a.Finished)throw new Error(`Unknown phase ${e}`);return e!==l.a.Intro&&e!==l.a.ConfirmReset||(i=r.a.createElement(d.a,{onClick:this.onSkipClick,className:"mx_CompleteSecurity_skip","aria-label":Object(o.a)("Skip verification for now")})),r.a.createElement(u.a,null,r.a.createElement(m.a,null,r.a.createElement("h1",{className:"mx_CompleteSecurity_header"},a,n,i),r.a.createElement("div",{className:"mx_CompleteSecurity_body"},r.a.createElement(c.a,{onFinished:this.props.onFinished}))))}}},1524:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return g}));var n,i,s,r,o,l,c,d,m,u,h=a(120);function p(){return p=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},p.apply(this,arguments)}function g(e){return h.createElement("svg",p({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 793.322 340.809",role:"presentation","aria-hidden":!0},e),n||(n=h.createElement("path",{opacity:.5,fill:"#FFF",d:"M34.004 340.809H2a2 2 0 01-2-2V2a2 2 0 012-2h32.004a2 2 0 012 2v7.71a2 2 0 01-2 2h-21.13v317.386h21.13a2 2 0 012 2.001v7.712a2 2 0 01-2 2z"})),i||(i=h.createElement("path",{opacity:.5,fill:"#FFF",d:"M10.875 9.711v321.386h23.13v7.711H1.999V2.001h32.006v7.71h-23.13zM252.402 233.711h-32.993a2 2 0 01-2-2v-68.073c0-3.949-.154-7.722-.457-11.213-.289-3.282-1.074-6.153-2.332-8.53-1.204-2.276-3.017-4.119-5.384-5.476-2.393-1.362-5.775-2.056-10.042-2.056-4.238 0-7.674.798-10.213 2.371-2.565 1.596-4.604 3.701-6.053 6.258-1.498 2.643-2.51 5.694-3.013 9.067a72.757 72.757 0 00-.793 10.741v66.91a2 2 0 01-2 2h-32.991a2 2 0 01-2-2v-67.373c0-3.435-.078-6.964-.228-10.485-.148-3.251-.767-6.278-1.841-8.995-1.018-2.571-2.667-4.584-5.047-6.153-2.372-1.552-6.029-2.341-10.865-2.341-1.372 0-3.265.328-5.629.976-2.28.624-4.536 1.826-6.705 3.577-2.152 1.732-4.036 4.306-5.605 7.655-1.569 3.356-2.367 7.877-2.367 13.438v69.701a2 2 0 01-2 2H68.857a2 2 0 01-2-2V111.594a2 2 0 012-1.999h31.13a2 2 0 012 1.999v11.007c3.834-4.499 8.248-8.152 13.173-10.896 6.396-3.559 13.799-5.362 22.002-5.362 7.846 0 15.127 1.548 21.642 4.604 5.794 2.722 10.424 7.26 13.791 13.52 3.449-4.362 7.833-8.306 13.071-11.752 6.422-4.228 14.102-6.371 22.824-6.371 6.499 0 12.625.807 18.209 2.399 5.686 1.628 10.635 4.271 14.712 7.857 4.088 3.605 7.318 8.357 9.601 14.123 2.25 5.719 3.391 12.649 3.391 20.604v80.384a2.002 2.002 0 01-2.001 2z"})),s||(s=h.createElement("path",{opacity:.5,fill:"#FFF",d:"M99.988 111.595v16.264h.463c4.338-6.191 9.563-10.998 15.684-14.406 6.117-3.402 13.129-5.11 21.027-5.11 7.588 0 14.521 1.475 20.793 4.415 6.274 2.945 11.038 8.131 14.291 15.567 3.56-5.265 8.4-9.913 14.521-13.94 6.117-4.025 13.358-6.042 21.724-6.042 6.351 0 12.234.776 17.66 2.325 5.418 1.549 10.065 4.027 13.938 7.434 3.869 3.41 6.889 7.863 9.062 13.357 2.167 5.504 3.253 12.122 3.253 19.869v80.385H219.41v-68.074c0-4.025-.154-7.82-.465-11.385-.313-3.56-1.161-6.656-2.555-9.293-1.395-2.631-3.45-4.724-6.157-6.274-2.711-1.543-6.391-2.322-11.037-2.322s-8.403.896-11.269 2.671c-2.868 1.784-5.112 4.109-6.737 6.971-1.626 2.869-2.711 6.12-3.252 9.762a74.395 74.395 0 00-.814 11.035v66.91h-32.991v-67.375c0-3.562-.081-7.087-.23-10.57-.158-3.487-.814-6.7-1.978-9.645-1.162-2.94-3.099-5.304-5.809-7.088-2.711-1.775-6.699-2.671-11.965-2.671-1.551 0-3.603.349-6.156 1.048-2.556.697-5.036 2.016-7.435 3.949-2.404 1.938-4.454 4.726-6.158 8.363-1.705 3.642-2.556 8.402-2.556 14.287v69.701h-32.99V111.595h31.132zM304.909 236.733c-5.883 0-11.46-.729-16.574-2.163-5.192-1.464-9.806-3.774-13.713-6.871-3.944-3.117-7.068-7.111-9.282-11.871-2.205-4.733-3.324-10.412-3.324-16.876 0-7.13 1.293-13.117 3.846-17.797 2.542-4.674 5.877-8.464 9.912-11.263 3.97-2.752 8.556-4.842 13.63-6.209a142.954 142.954 0 0114.961-3.184 261.677 261.677 0 0114.754-1.872c4.679-.452 8.88-1.139 12.489-2.039 3.412-.854 6.118-2.09 8.042-3.672 1.666-1.37 2.416-3.384 2.292-6.151-.002-3.289-.502-5.816-1.492-7.595-.998-1.798-2.283-3.15-3.927-4.138-1.703-1.02-3.725-1.713-6.012-2.062-2.47-.37-5.146-.557-7.947-.557-6.034 0-10.789 1.271-14.135 3.783-3.233 2.424-5.155 6.64-5.714 12.527a2.003 2.003 0 01-1.992 1.812h-32.992a2.006 2.006 0 01-1.457-.629 2.013 2.013 0 01-.54-1.491c.485-8.073 2.55-14.894 6.142-20.272a41.725 41.725 0 0113.661-12.931c5.424-3.191 11.612-5.498 18.392-6.857a103.675 103.675 0 0120.26-2.013c6.096 0 12.365.437 18.626 1.296 6.377.88 12.285 2.622 17.562 5.177 5.376 2.604 9.845 6.29 13.282 10.951 3.498 4.744 5.271 11.048 5.271 18.731v62.494c0 5.307.306 10.462.915 15.319.576 4.64 1.572 8.116 2.963 10.338.385.616.407 1.395.055 2.031a2.002 2.002 0 01-1.75 1.03h-33.457c-.861 0-1.624-.55-1.898-1.367a49.145 49.145 0 01-1.572-5.936 49.182 49.182 0 01-.38-2.12 44.922 44.922 0 01-16.474 9.105 77.066 77.066 0 01-22.423 3.342zm37.032-60.072c-.809.409-1.676.768-2.596 1.074-2.161.72-4.511 1.326-6.988 1.807-2.442.475-5.033.872-7.699 1.186-2.631.311-5.251.697-7.784 1.146a56.995 56.995 0 00-7.051 1.792c-2.194.711-4.114 1.667-5.699 2.842-1.531 1.128-2.785 2.587-3.731 4.335-.917 1.709-1.385 3.97-1.385 6.719 0 2.598.465 4.778 1.385 6.481.928 1.722 2.142 3.035 3.716 4.018 1.644 1.026 3.601 1.757 5.816 2.17 2.344.439 4.799.663 7.297.663 6.105 0 10.836-.996 14.063-2.961 3.244-1.973 5.666-4.349 7.199-7.062 1.568-2.78 2.542-5.62 2.892-8.436.376-3.019.565-5.436.565-7.187v-8.587z"})),r||(r=h.createElement("path",{opacity:.5,fill:"#FFF",d:"M273.544 129.255c3.405-5.113 7.744-9.215 13.012-12.316 5.264-3.097 11.186-5.303 17.771-6.621a101.17 101.17 0 0119.865-1.976c6.042 0 12.158.428 18.354 1.277 6.195.855 11.85 2.522 16.962 4.997 5.111 2.477 9.292 5.926 12.546 10.338 3.253 4.414 4.879 10.262 4.879 17.543v62.494c0 5.428.31 10.611.931 15.567.615 4.959 1.701 8.676 3.251 11.153H347.66a46.656 46.656 0 01-1.511-5.693 48.292 48.292 0 01-.813-5.923c-5.267 5.422-11.465 9.217-18.585 11.386a74.81 74.81 0 01-21.842 3.251c-5.733 0-11.077-.698-16.033-2.09-4.958-1.395-9.293-3.562-13.01-6.51-3.718-2.938-6.622-6.656-8.713-11.147s-3.138-9.84-3.138-16.033c0-6.813 1.199-12.43 3.604-16.84 2.399-4.417 5.495-7.939 9.295-10.575 3.793-2.632 8.129-4.607 13.01-5.923a140.326 140.326 0 0114.752-3.137 253.631 253.631 0 0114.638-1.857c4.801-.466 9.062-1.164 12.779-2.093 3.718-.929 6.658-2.282 8.829-4.065 2.165-1.781 3.172-4.375 3.02-7.785 0-3.56-.58-6.389-1.742-8.479-1.161-2.09-2.711-3.719-4.646-4.88-1.937-1.161-4.183-1.936-6.737-2.325-2.557-.382-5.309-.58-8.248-.58-6.506 0-11.617 1.395-15.335 4.183-3.716 2.788-5.889 7.437-6.506 13.94h-32.991c.462-7.742 2.395-14.173 5.807-19.281zm65.169 46.583a53.802 53.802 0 01-6.736 1.741c-2.402.465-4.918.853-7.551 1.161-2.635.313-5.268.698-7.899 1.163a59.302 59.302 0 00-7.317 1.857c-2.404.779-4.495 1.822-6.274 3.138-1.784 1.317-3.216 2.985-4.3 4.994-1.085 2.014-1.626 4.571-1.626 7.668 0 2.94.541 5.422 1.626 7.431 1.084 2.017 2.558 3.604 4.416 4.765s4.025 1.976 6.507 2.438c2.475.466 5.031.698 7.665.698 6.505 0 11.537-1.082 15.103-3.253 3.561-2.166 6.192-4.762 7.899-7.785 1.702-3.019 2.749-6.072 3.137-9.174.384-3.097.58-5.576.58-7.434V172.93c-1.396 1.243-3.138 2.21-5.23 2.908zM444.542 234.874c-5.187 0-10.173-.361-14.823-1.069-4.802-.732-9.104-2.183-12.779-4.313-3.789-2.185-6.821-5.341-9.006-9.375-2.163-3.986-3.26-9.232-3.26-15.59v-68.859h-17.981a2 2 0 01-2-1.999v-22.073a2 2 0 012-1.999h17.981V75.582a2 2 0 012-2h32.992a2 2 0 012 2v34.014h22.162a2 2 0 012 1.999v22.073a2 2 0 01-2 1.999h-22.162v57.479c0 6.229 1.198 8.731 2.202 9.733 1.004 1.007 3.506 2.205 9.738 2.205 1.804 0 3.542-.076 5.161-.225a44.198 44.198 0 004.669-.665 1.994 1.994 0 011.661.415c.463.379.73.946.73 1.546v25.555a2 2 0 01-1.672 1.974c-2.834.472-6.041.794-9.527.957-3.613.157-6.91.233-10.086.233z"})),o||(o=h.createElement("path",{opacity:.5,fill:"#FFF",d:"M463.825 111.595v22.072h-24.161v59.479c0 5.573.928 9.292 2.788 11.149 1.856 1.859 5.576 2.788 11.152 2.788 1.859 0 3.638-.076 5.343-.232a45.912 45.912 0 004.878-.696v25.557c-2.788.465-5.887.773-9.293.931-3.407.149-6.737.23-9.99.23-5.111 0-9.953-.35-14.521-1.048-4.571-.695-8.597-2.047-12.081-4.063-3.486-2.011-6.236-4.88-8.248-8.597-2.016-3.714-3.021-8.595-3.021-14.639v-70.859h-19.98v-22.072h19.98V75.583h32.992v36.012h24.162zM512.613 233.711h-32.991a2 2 0 01-2-2V111.594a2 2 0 012-1.999h31.366a2 2 0 012 1.999v15.069a43.465 43.465 0 013.199-4.382 43.541 43.541 0 019.496-8.522 46.77 46.77 0 0111.415-5.462c4.056-1.298 8.327-1.954 12.691-1.954 2.341 0 4.953.418 7.766 1.243a2 2 0 011.437 1.92v30.67a2 2 0 01-2.395 1.96c-1.484-.3-3.299-.565-5.392-.787a57.416 57.416 0 00-6.062-.339c-5.706 0-10.572.95-14.467 2.823-3.862 1.86-7.012 4.428-9.361 7.629-2.389 3.263-4.115 7.12-5.127 11.47-1.043 4.479-1.574 9.409-1.574 14.647v54.132a2.002 2.002 0 01-2.001 2z"})),l||(l=h.createElement("path",{opacity:.5,fill:"#FFF",d:"M510.988 111.595V133.9h.465c1.546-3.72 3.636-7.163 6.272-10.341a41.182 41.182 0 019.06-8.131 44.466 44.466 0 0110.923-5.228c3.868-1.237 7.898-1.859 12.081-1.859 2.168 0 4.566.39 7.202 1.163v30.67c-1.551-.312-3.41-.584-5.576-.814a58.79 58.79 0 00-6.274-.35c-6.041 0-11.152 1.01-15.332 3.021-4.182 2.014-7.55 4.761-10.107 8.247-2.555 3.487-4.379 7.55-5.462 12.198-1.083 4.645-1.625 9.682-1.625 15.102v54.133h-32.991V111.595h31.364zM603.923 233.711H570.93a2 2 0 01-2-2V111.594a2 2 0 012-1.999h32.994a2 2 0 012 1.999v120.117a2.002 2.002 0 01-2.001 2zm0-138.705H570.93a2 2 0 01-2-1.999V65.825a2 2 0 012-2h32.994a2 2 0 012 2v27.182a2.002 2.002 0 01-2.001 1.999z"})),c||(c=h.createElement("path",{opacity:.5,fill:"#FFF",d:"M570.93 93.007V65.824h32.994v27.183H570.93zm32.994 18.588v120.117H570.93V111.595h32.994zM742.163 233.711h-37.64a1.995 1.995 0 01-1.667-.896l-23.426-35.352-23.426 35.352a1.992 1.992 0 01-1.667.896h-36.938a2.003 2.003 0 01-1.77-1.067 2.002 2.002 0 01.118-2.061l42.435-62.055-38.71-55.793a2.001 2.001 0 011.643-3.14h37.636c.665 0 1.287.33 1.658.882l19.477 28.893 19.255-28.884a2.004 2.004 0 011.665-.891h36.475c.746 0 1.43.415 1.776 1.078.343.66.289 1.46-.139 2.071l-38.69 55.082 43.578 62.744c.424.61.474 1.408.128 2.066a1.992 1.992 0 01-1.771 1.075z"})),d||(d=h.createElement("path",{opacity:.5,fill:"#FFF",d:"M621.115 111.595h37.637l21.144 31.365 20.911-31.365h36.476l-39.496 56.226 44.377 63.892h-37.64l-25.093-37.87-25.094 37.87h-36.938l43.213-63.193-39.497-56.925zM791.322 340.809h-32.008a2 2 0 01-2-2v-7.712a2 2 0 012-2.001h21.13V11.71h-21.13a2 2 0 01-2-2V2a2 2 0 012-2h32.008a2 2 0 012 2v336.809a2 2 0 01-2 2z"})),m||(m=h.createElement("path",{opacity:.5,fill:"#FFF",d:"M782.443 331.097V9.711h-23.13v-7.71h32.008v336.807h-32.008v-7.711h23.13z"})),u||(u=h.createElement("path",{d:"M10.875 9.711v321.386h23.13v7.711H1.999V2.001h32.006v7.71h-23.13zM99.988 111.595v16.264h.463c4.338-6.191 9.563-10.998 15.684-14.406 6.117-3.402 13.129-5.11 21.027-5.11 7.588 0 14.521 1.475 20.793 4.415 6.274 2.945 11.038 8.131 14.291 15.567 3.56-5.265 8.4-9.913 14.521-13.94 6.117-4.025 13.358-6.042 21.724-6.042 6.351 0 12.234.776 17.66 2.325 5.418 1.549 10.065 4.027 13.938 7.434 3.869 3.41 6.889 7.863 9.062 13.357 2.167 5.504 3.253 12.122 3.253 19.869v80.385H219.41v-68.074c0-4.025-.154-7.82-.465-11.385-.313-3.56-1.161-6.656-2.555-9.293-1.395-2.631-3.45-4.724-6.157-6.274-2.711-1.543-6.391-2.322-11.037-2.322s-8.403.896-11.269 2.671c-2.868 1.784-5.112 4.109-6.737 6.971-1.626 2.869-2.711 6.12-3.252 9.762a74.395 74.395 0 00-.814 11.035v66.91h-32.991v-67.375c0-3.562-.081-7.087-.23-10.57-.158-3.487-.814-6.7-1.978-9.645-1.162-2.94-3.099-5.304-5.809-7.088-2.711-1.775-6.699-2.671-11.965-2.671-1.551 0-3.603.349-6.156 1.048-2.556.697-5.036 2.016-7.435 3.949-2.404 1.938-4.454 4.726-6.158 8.363-1.705 3.642-2.556 8.402-2.556 14.287v69.701h-32.99V111.595h31.132zM273.544 129.255c3.405-5.113 7.744-9.215 13.012-12.316 5.264-3.097 11.186-5.303 17.771-6.621a101.17 101.17 0 0119.865-1.976c6.042 0 12.158.428 18.354 1.277 6.195.855 11.85 2.522 16.962 4.997 5.111 2.477 9.292 5.926 12.546 10.338 3.253 4.414 4.879 10.262 4.879 17.543v62.494c0 5.428.31 10.611.931 15.567.615 4.959 1.701 8.676 3.251 11.153H347.66a46.656 46.656 0 01-1.511-5.693 48.292 48.292 0 01-.813-5.923c-5.267 5.422-11.465 9.217-18.585 11.386a74.81 74.81 0 01-21.842 3.251c-5.733 0-11.077-.698-16.033-2.09-4.958-1.395-9.293-3.562-13.01-6.51-3.718-2.938-6.622-6.656-8.713-11.147s-3.138-9.84-3.138-16.033c0-6.813 1.199-12.43 3.604-16.84 2.399-4.417 5.495-7.939 9.295-10.575 3.793-2.632 8.129-4.607 13.01-5.923a140.326 140.326 0 0114.752-3.137 253.631 253.631 0 0114.638-1.857c4.801-.466 9.062-1.164 12.779-2.093 3.718-.929 6.658-2.282 8.829-4.065 2.165-1.781 3.172-4.375 3.02-7.785 0-3.56-.58-6.389-1.742-8.479-1.161-2.09-2.711-3.719-4.646-4.88-1.937-1.161-4.183-1.936-6.737-2.325-2.557-.382-5.309-.58-8.248-.58-6.506 0-11.617 1.395-15.335 4.183-3.716 2.788-5.889 7.437-6.506 13.94h-32.991c.462-7.742 2.395-14.173 5.807-19.281zm65.169 46.583a53.802 53.802 0 01-6.736 1.741c-2.402.465-4.918.853-7.551 1.161-2.635.313-5.268.698-7.899 1.163a59.302 59.302 0 00-7.317 1.857c-2.404.779-4.495 1.822-6.274 3.138-1.784 1.317-3.216 2.985-4.3 4.994-1.085 2.014-1.626 4.571-1.626 7.668 0 2.94.541 5.422 1.626 7.431 1.084 2.017 2.558 3.604 4.416 4.765s4.025 1.976 6.507 2.438c2.475.466 5.031.698 7.665.698 6.505 0 11.537-1.082 15.103-3.253 3.561-2.166 6.192-4.762 7.899-7.785 1.702-3.019 2.749-6.072 3.137-9.174.384-3.097.58-5.576.58-7.434V172.93c-1.396 1.243-3.138 2.21-5.23 2.908zM463.825 111.595v22.072h-24.161v59.479c0 5.573.928 9.292 2.788 11.149 1.856 1.859 5.576 2.788 11.152 2.788 1.859 0 3.638-.076 5.343-.232a45.912 45.912 0 004.878-.696v25.557c-2.788.465-5.887.773-9.293.931-3.407.149-6.737.23-9.99.23-5.111 0-9.953-.35-14.521-1.048-4.571-.695-8.597-2.047-12.081-4.063-3.486-2.011-6.236-4.88-8.248-8.597-2.016-3.714-3.021-8.595-3.021-14.639v-70.859h-19.98v-22.072h19.98V75.583h32.992v36.012h24.162zM510.988 111.595V133.9h.465c1.546-3.72 3.636-7.163 6.272-10.341a41.182 41.182 0 019.06-8.131 44.466 44.466 0 0110.923-5.228c3.868-1.237 7.898-1.859 12.081-1.859 2.168 0 4.566.39 7.202 1.163v30.67c-1.551-.312-3.41-.584-5.576-.814a58.79 58.79 0 00-6.274-.35c-6.041 0-11.152 1.01-15.332 3.021-4.182 2.014-7.55 4.761-10.107 8.247-2.555 3.487-4.379 7.55-5.462 12.198-1.083 4.645-1.625 9.682-1.625 15.102v54.133h-32.991V111.595h31.364zM570.93 93.007V65.824h32.994v27.183H570.93zm32.994 18.588v120.117H570.93V111.595h32.994zM621.115 111.595h37.637l21.144 31.365 20.911-31.365h36.476l-39.496 56.226 44.377 63.892h-37.64l-25.093-37.87-25.094 37.87h-36.938l43.213-63.193-39.497-56.925zM782.443 331.097V9.711h-23.13v-7.71h32.008v336.807h-32.008v-7.711h23.13z"})))}t.default="img/matrix.d1fcad6.svg"},1526:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return r}));var n,i=a(120);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},s.apply(this,arguments)}function r(e){return i.createElement("svg",s({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 24",role:"presentation","aria-hidden":!0},e),n||(n=i.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16.98 1.28a4.872 4.872 0 01-1.114 3.49 4.099 4.099 0 01-3.237 1.53 4.636 4.636 0 011.144-3.36 4.957 4.957 0 013.207-1.66zm3.974 7.428a4.949 4.949 0 00-2.357 4.152 4.782 4.782 0 002.92 4.4 10.963 10.963 0 01-1.519 3.092c-.894 1.338-1.832 2.645-3.32 2.669-.708.016-1.186-.187-1.684-.4-.52-.22-1.06-.451-1.907-.451-.899 0-1.464.238-2.01.467-.47.198-.927.39-1.57.417-1.417.053-2.5-1.428-3.427-2.753-1.853-2.707-3.296-7.628-1.362-10.976a5.315 5.315 0 014.473-2.728c.804-.017 1.576.293 2.252.565.517.208.979.393 1.357.393.332 0 .78-.178 1.304-.386.824-.326 1.832-.727 2.859-.619 1.596.05 3.075.85 3.99 2.158z",fill:"#17191C"})))}t.default="img/element-icons/brands/apple.3f29900.svg"},1527:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return l}));var n,i,s,r=a(120);function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},o.apply(this,arguments)}function l(e){return r.createElement("svg",o({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 24",role:"presentation","aria-hidden":!0},e),n||(n=r.createElement("mask",{id:"facebook_svg__a",maskUnits:"userSpaceOnUse",x:2,y:1,width:22,height:22},r.createElement("path",{d:"M2.102 1.5H23.1v20.872H2.102V1.5z",fill:"#fff"}))),i||(i=r.createElement("g",{mask:"url(#facebook_svg__a)"},r.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M23.1 11.999c0-5.799-4.701-10.5-10.5-10.5S2.1 6.2 2.1 11.999c0 5.24 3.84 9.585 8.86 10.373v-7.338H8.292V12h2.666V9.686c0-2.632 1.568-4.085 3.966-4.085 1.15 0 2.35.205 2.35.205V8.39h-1.323c-1.305 0-1.711.809-1.711 1.64v1.969h2.912l-.466 3.035h-2.446v7.338c5.02-.788 8.859-5.132 8.859-10.373z",fill:"#1877F2"}))),s||(s=r.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16.687 15.034L17.153 12H14.24v-1.97c0-.83.406-1.64 1.71-1.64h1.325V5.807s-1.202-.205-2.35-.205c-2.4 0-3.967 1.453-3.967 4.085v2.313H8.293v3.035h2.666v7.338a10.588 10.588 0 003.282 0v-7.338h2.446z",fill:"#fff"})))}t.default="img/element-icons/brands/facebook.d149f4a.svg"},1528:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return r}));var n,i=a(120);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},s.apply(this,arguments)}function r(e){return i.createElement("svg",s({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 24",role:"presentation","aria-hidden":!0},e),n||(n=i.createElement("path",{d:"M20.842 7.106a9.707 9.707 0 00-3.548-3.548C15.8 2.686 14.169 2.25 12.4 2.25c-1.769 0-3.4.436-4.894 1.308a9.707 9.707 0 00-3.548 3.548C3.086 8.6 2.65 10.23 2.65 12c0 2.124.62 4.035 1.86 5.732 1.24 1.696 2.841 2.87 4.805 3.522.228.043.398.013.508-.088a.497.497 0 00.165-.381l-.007-.686c-.004-.431-.006-.808-.006-1.13l-.292.051a3.725 3.725 0 01-.705.045 5.354 5.354 0 01-.882-.09 1.97 1.97 0 01-.85-.38 1.611 1.611 0 01-.56-.78l-.126-.293a3.174 3.174 0 00-.4-.647c-.182-.237-.366-.398-.552-.482l-.089-.064a.928.928 0 01-.165-.152.696.696 0 01-.114-.178c-.026-.06-.005-.108.063-.146.068-.039.19-.057.368-.057l.254.038c.17.034.379.135.629.304.25.17.454.39.615.66.195.348.43.612.705.794.275.182.552.273.831.273.28 0 .52-.021.724-.063.203-.043.393-.107.571-.191.076-.567.284-1.003.622-1.308a8.696 8.696 0 01-1.301-.228 5.18 5.18 0 01-1.193-.496 3.419 3.419 0 01-1.022-.85c-.271-.339-.493-.783-.667-1.333-.173-.55-.26-1.185-.26-1.904 0-1.025.335-1.896 1.003-2.616-.313-.77-.284-1.633.089-2.59.245-.076.61-.018 1.092.172.482.19.835.354 1.06.489.224.135.404.25.54.343.787-.22 1.599-.33 2.437-.33.838 0 1.65.11 2.438.33l.482-.305c.33-.203.72-.39 1.168-.559.448-.169.791-.215 1.028-.14.381.957.415 1.82.102 2.59.668.72 1.003 1.592 1.003 2.616 0 .72-.087 1.356-.26 1.91-.174.555-.398.999-.673 1.333a3.55 3.55 0 01-1.028.845c-.411.228-.809.393-1.194.495a8.69 8.69 0 01-1.301.229c.44.38.66.981.66 1.802v2.678c0 .153.053.28.159.381.105.102.273.131.501.089 1.964-.652 3.566-1.826 4.805-3.523 1.24-1.697 1.86-3.607 1.86-5.732 0-1.768-.436-3.4-1.308-4.893z",fill:"#000"})))}t.default="img/element-icons/brands/github.de3b60e.svg"},1529:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return m}));var n,i,s,r,o,l,c=a(120);function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},d.apply(this,arguments)}function m(e){return c.createElement("svg",d({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",role:"presentation","aria-hidden":!0},e),n||(n=c.createElement("path",{d:"M12 20.33l3.317-10.2H8.689l3.312 10.2z",fill:"#E24329"})),i||(i=c.createElement("path",{d:"M4.043 10.13l-1.01 3.098a.687.687 0 00.25.768L12 20.33l-7.957-10.2z",fill:"#FCA326"})),s||(s=c.createElement("path",{d:"M4.042 10.129h4.645L6.688 3.986c-.102-.315-.548-.315-.654 0l-1.992 6.143z",fill:"#E24329"})),r||(r=c.createElement("path",{d:"M19.96 10.13l1.006 3.098a.687.687 0 01-.248.768l-8.719 6.334 7.961-10.2z",fill:"#FCA326"})),o||(o=c.createElement("path",{d:"M19.962 10.129h-4.645l1.995-6.143c.102-.315.548-.315.654 0l1.996 6.143z",fill:"#E24329"})),l||(l=c.createElement("path",{d:"M12 20.33l3.315-10.2h4.645L12 20.33zM11.998 20.33l-7.956-10.2h4.645L12 20.33z",fill:"#FC6D26"})))}t.default="img/element-icons/brands/gitlab.e075acd.svg"},1530:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return c}));var n,i,s,r,o=a(120);function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},l.apply(this,arguments)}function c(e){return o.createElement("svg",l({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",role:"presentation","aria-hidden":!0},e),n||(n=o.createElement("path",{d:"M22.501 12.233c0-.863-.071-1.493-.226-2.146h-10.06v3.896h5.905c-.119.969-.762 2.427-2.19 3.407l-.02.13 3.18 2.415.22.022c2.024-1.832 3.191-4.527 3.191-7.724z",fill:"#4285F4"})),i||(i=o.createElement("path",{d:"M12.215 22.5c2.893 0 5.321-.933 7.095-2.543l-3.381-2.567c-.905.618-2.12 1.05-3.714 1.05a6.438 6.438 0 01-6.096-4.363l-.125.01-3.307 2.509-.044.117c1.762 3.43 5.381 5.787 9.572 5.787z",fill:"#34A853"})),s||(s=o.createElement("path",{d:"M6.12 14.077A6.347 6.347 0 015.763 12c0-.723.131-1.423.345-2.077l-.006-.139-3.348-2.548-.11.05A10.339 10.339 0 001.501 12c0 1.692.417 3.29 1.143 4.713l3.476-2.636z",fill:"#FBBC05"})),r||(r=o.createElement("path",{d:"M12.215 5.56c2.012 0 3.369.852 4.143 1.563L19.38 4.23c-1.857-1.692-4.273-2.73-7.166-2.73-4.19 0-7.81 2.357-9.572 5.787l3.465 2.636a6.465 6.465 0 016.107-4.363z",fill:"#EB4335"})))}t.default="img/element-icons/brands/google.44aaf41.svg"},1531:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return r}));var n,i=a(120);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},s.apply(this,arguments)}function r(e){return i.createElement("svg",s({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 24",role:"presentation","aria-hidden":!0},e),n||(n=i.createElement("path",{d:"M9.042 21c-2.427 0-4.688-.706-6.592-1.923 1.616.104 4.469-.146 6.243-1.838-2.67-.123-3.873-2.17-4.03-3.045.227.088 1.308.193 1.919-.052-3.07-.77-3.541-3.464-3.436-4.286.575.402 1.552.542 1.936.507-2.86-2.047-1.832-5.126-1.326-5.79 2.053 2.843 5.13 4.44 8.936 4.53a4.398 4.398 0 01-.11-.98 4.367 4.367 0 014.361-4.373c1.259 0 2.393.535 3.189 1.39.84-.197 2.106-.659 2.725-1.058-.312 1.12-1.283 2.054-1.87 2.4.005.012-.005-.012 0 0 .516-.078 1.912-.346 2.463-.72-.273.629-1.302 1.675-2.147 2.26C21.46 14.953 16.157 21 9.042 21z",fill:"#1D9BF0"})))}t.default="img/element-icons/brands/twitter.43b393b.svg"},1532:function(e,t,a){"use strict";a.d(t,"a",(function(){return E}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(239),l=a(1),c=a(121),d=a(122),m=a(182),u=a(611),h=a(124),p=a(198),g=a(127),v=a(236),b=a(128),f=a(472),y=a(173);class E extends r.a.PureComponent{constructor(e){super(e),i()(this,"intervalHandle",void 0),i()(this,"checkRequestIsPending",(()=>{const{request:e}=this.props;e.canAccept||p.a.sharedInstance().dismissToast(this.props.toastKey)})),i()(this,"cancel",(()=>{p.a.sharedInstance().dismissToast(this.props.toastKey);try{this.props.request.cancel()}catch(e){l.a.error("Error while cancelling verification request",e)}})),i()(this,"accept",(async()=>{p.a.sharedInstance().dismissToast(this.props.toastKey);const{request:e}=this.props,t=d.a.get();try{if(e.channel.roomId){h.a.dispatch({action:b.a.ViewRoom,room_id:e.channel.roomId,should_peek:!1,metricsTrigger:"VerificationRequest"});const a=t.getUser(e.otherUserId);y.a.instance.setCards([{phase:m.a.RoomSummary},{phase:m.a.RoomMemberInfo,state:{member:a}},{phase:m.a.EncryptionPanel,state:{verificationRequest:e,member:a}}],void 0,e.channel.roomId)}else g.b.createDialog(f.a,{verificationRequest:e,onFinished:()=>{e.cancel()}},void 0,!1,!0);await e.accept()}catch(e){l.a.error(e.message)}})),this.state={counter:Math.ceil(e.request.timeout/1e3)}}async componentDidMount(){const{request:e}=this.props;if(e.timeout&&e.timeout>0&&(this.intervalHandle=window.setInterval((()=>{let{counter:e}=this.state;e=Math.max(0,e-1),this.setState({counter:e})}),1e3)),e.on(o.l.Change,this.checkRequestIsPending),this.checkRequestIsPending(),e.isSelfVerification){const t=d.a.get(),a=(await t.getDevice(e.channel.deviceId)).last_seen_ip;this.setState({device:t.getStoredDevice(t.getUserId(),e.channel.deviceId),ip:a})}}componentWillUnmount(){clearInterval(this.intervalHandle);const{request:e}=this.props;e.off(o.l.Change,this.checkRequestIsPending)}render(){const{request:e}=this.props;let t,a;if(e.isSelfVerification)this.state.device&&(t=this.state.device.getDisplayName(),a=Object(c.a)("%(deviceId)s from %(ip)s",{deviceId:this.state.device.deviceId,ip:this.state.ip}));else{const a=e.otherUserId,n=e.channel.roomId;if(t=n?Object(u.b)(a,n):a,t===a){const e=d.a.get().getUser(a);e&&e.displayName&&(t=Object(c.a)("%(name)s (%(userId)s)",{name:e.displayName,userId:a}))}}const n=0===this.state.counter?Object(c.a)("Ignore"):Object(c.a)("Ignore (%(counter)s)",{counter:this.state.counter});return r.a.createElement(v.a,{description:t,detail:a,acceptLabel:Object(c.a)("Verify Session"),onAccept:this.accept,rejectLabel:n,onReject:this.cancel})}}},1533:function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(214),i=a(128),s=a(124);const r=e=>{s.a.dispatch({action:i.a.ViewUserSettings,initialTabId:e?n.a.SessionManager:n.a.Security})}},1544:function(e,t,a){"use strict";var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(147),l=a(126),c=a.n(l),d=a(215),m=a(151),u=a(205),h=a(426),p=a(245),g=a(862),v=a(124),b=a(125),f=a(137);var y=e=>{let{vertical:t,reverse:a,id:n,passRef:i}=e;const s=["mx_ResizeHandle"];return t?s.push("mx_ResizeHandle_vertical"):s.push("mx_ResizeHandle_horizontal"),a&&s.push("mx_ResizeHandle_reverse"),r.a.createElement("div",{ref:i,className:s.join(" "),"data-id":n},r.a.createElement("div",null))};class E{constructor(e,t,a,n){this.resizer=t,this.sizer=a,this.container=n,i()(this,"domNode",void 0),i()(this,"id",void 0),i()(this,"reverse",void 0),this.reverse=t.isReverseResizeHandle(e),this.domNode=n||(this.reverse?e.nextElementSibling:e.previousElementSibling),this.id=e.getAttribute("data-id")}copyWith(e,t,a,n){return new(0,this.constructor)(e,t,a,n)}advance(e){let t=this.reverse?this.domNode.previousElementSibling:this.domNode.nextElementSibling;const a=e!==this.reverse;do{t=a?t.nextElementSibling:t.previousElementSibling}while(t&&!this.resizer.isResizeHandle(t));if(t){const e=this.copyWith(t,this.resizer,this.sizer);return e.reverse=this.reverse,e}}next(){return this.advance(!0)}previous(){return this.advance(!1)}size(){return this.sizer.getItemSize(this.domNode)}offset(){return this.sizer.getItemOffset(this.domNode)}start(){this.sizer.start(this.domNode)}finish(){this.sizer.finish(this.domNode)}getSize(){return this.sizer.getDesiredItemSize(this.domNode)}setRawSize(e){this.sizer.setItemSize(this.domNode,e)}setSize(e){var t,a;this.setRawSize(`${Math.round(e)}px`),null===(t=this.resizer.config)||void 0===t||null===(a=t.onResized)||void 0===a||a.call(t,e,this.id,this.domNode)}clearSize(){var e,t;this.sizer.clearItemSize(this.domNode),null===(e=this.resizer.config)||void 0===e||null===(t=e.onResized)||void 0===t||t.call(e,null,this.id,this.domNode)}first(){const e=Array.from(this.domNode.parentElement.children).find((e=>this.resizer.isResizeHandle(e)));if(e)return this.copyWith(e,this.resizer,this.sizer)}last(){const e=Array.from(this.domNode.parentElement.children).reverse().find((e=>this.resizer.isResizeHandle(e)));if(e)return this.copyWith(e,this.resizer,this.sizer)}}class _{constructor(e,t,a){this.container=e,this.vertical=t,this.reverse=a}getItemOffset(e){const t=(this.vertical?e.offsetTop:e.offsetLeft)-this.getOffset();return this.reverse?this.getTotalSize()-(t+this.getItemSize(e)):t}getItemSize(e){return this.vertical?e.offsetHeight:e.offsetWidth}getTotalSize(){return this.vertical?this.container.offsetHeight:this.container.offsetWidth}getOffset(){return this.vertical?this.container.offsetTop:this.container.offsetLeft}getPageOffset(){let e=this.container,t=0;for(;e;){t+=this.vertical?e.offsetTop:e.offsetLeft,e=e.offsetParent}return t}getDesiredItemSize(e){return this.vertical?e.style.height:e.style.width}setItemSize(e,t){this.vertical?e.style.height=t:e.style.width=t}clearItemSize(e){this.vertical?e.style.height=null:e.style.width=null}start(e){}finish(e){}offsetFromEvent(e){const t=this.vertical?e.pageY:e.pageX;return this.reverse?this.getPageOffset()+this.getTotalSize()-t:t-this.getPageOffset()}}class w{static createItem(e,t,a){return new E(e,t,a)}static createSizer(e,t,a){return new _(e,t,a)}constructor(e){this.item=e,i()(this,"beforeOffset",void 0),this.beforeOffset=e.offset()}get size(){return this.item.getSize()}set size(e){this.item.setRawSize(e)}resize(e){this.item.setSize(e)}resizeFromContainerOffset(e){this.resize(e-this.beforeOffset)}start(){this.item.start()}finish(){this.item.finish()}}class S extends _{start(e){this.vertical?e.style.minHeight=null:e.style.minWidth=null}finish(e){const t=e.offsetParent;if(t)if(this.vertical){const a=(e.offsetHeight/t.offsetHeight*100).toFixed(2)+"%";e.style.minHeight=a,e.style.height=a}else{const a=(e.offsetWidth/t.offsetWidth*100).toFixed(2)+"%";e.style.minWidth=a,e.style.width=a}}}class O extends w{static createSizer(e,t,a){return new S(e,t,a)}}class C extends E{notifyCollapsed(e){var t,a;null===(t=this.resizer.config)||void 0===t||null===(a=t.onCollapsed)||void 0===a||a.call(t,e,this.id,this.domNode)}get isCollapsed(){var e,t,a;return null!==(e=null===(t=this.resizer.config)||void 0===t||null===(a=t.isItemCollapsed)||void 0===a?void 0:a.call(t,this.domNode))&&void 0!==e&&e}}class x extends w{static createItem(e,t,a,n){return new C(e,t,a,n)}constructor(e){var t,a;super(e),i()(this,"toggleSize",void 0),i()(this,"isCollapsed",void 0),this.toggleSize=null===(t=e.resizer)||void 0===t||null===(a=t.config)||void 0===a?void 0:a.toggleSize,this.isCollapsed=e.isCollapsed}resize(e){const t=e<this.toggleSize;t!==this.isCollapsed&&(this.isCollapsed=t,this.item.notifyCollapsed(t)),t||super.resize(e)}}var j=a(149);class k{constructor(e,t,a){this.container=e,this.distributorCtor=t,this.config=a,i()(this,"classNames",void 0),i()(this,"onMouseDown",(e=>{var t,a,n;const i=e.target&&e.target.closest(`.${this.classNames.handle}`),s=null==this||null===(t=this.config)||void 0===t?void 0:t.handler;if(!i||!s&&i.parentElement!==this.container||s&&i!==s)return;var r,o;(e.preventDefault(),this.classNames.resizing)&&(null===(r=this.container)||void 0===r||null===(o=r.classList)||void 0===o||o.add(this.classNames.resizing));null===(a=this.config)||void 0===a||null===(n=a.onResizeStart)||void 0===n||n.call(a);const{sizer:l,distributor:c}=this.createSizerAndDistributor(i);c.start();const d=e=>{const t=l.offsetFromEvent(e);c.resizeFromContainerOffset(t)},m=document.body,u=()=>{var e,t,a,n;this.classNames.resizing&&(null===(a=this.container)||void 0===a||null===(n=a.classList)||void 0===n||n.remove(this.classNames.resizing));c.finish(),null===(e=this.config)||void 0===e||null===(t=e.onResizeStop)||void 0===t||t.call(e),m.removeEventListener("mouseup",u,!1),document.removeEventListener("mouseleave",u,!1),m.removeEventListener("mousemove",d,!1)};m.addEventListener("mouseup",u,!1),document.addEventListener("mouseleave",u,!1),m.addEventListener("mousemove",d,!1)})),i()(this,"onResize",Object(j.throttle)((()=>{const e=this.getDistributors();e.forEach((e=>e.start())),e.forEach((e=>e.finish()))}),100,{trailing:!0,leading:!0})),i()(this,"getDistributors",(()=>this.getResizeHandles().map((e=>{const{distributor:t}=this.createSizerAndDistributor(e);return t})))),this.classNames={handle:"resizer-handle",reverse:"resizer-reverse",vertical:"resizer-vertical",resizing:"resizer-resizing"}}setClassNames(e){this.classNames=e}attach(){var e,t,a;(null!==(e=null==this||null===(t=this.config)||void 0===t||null===(a=t.handler)||void 0===a?void 0:a.parentElement)&&void 0!==e?e:this.container).addEventListener("mousedown",this.onMouseDown,!1),window.addEventListener("resize",this.onResize)}detach(){var e,t,a;(null!==(e=null==this||null===(t=this.config)||void 0===t||null===(a=t.handler)||void 0===a?void 0:a.parentElement)&&void 0!==e?e:this.container).removeEventListener("mousedown",this.onMouseDown,!1),window.removeEventListener("resize",this.onResize)}forHandleAt(e){const t=this.getResizeHandles()[e];if(t){const{distributor:e}=this.createSizerAndDistributor(t);return e}}forHandleWithId(e){const t=this.getResizeHandles().find((t=>t.getAttribute("data-id")===e));if(t){const{distributor:e}=this.createSizerAndDistributor(t);return e}}isReverseResizeHandle(e){return e.classList.contains(this.classNames.reverse)}isResizeHandle(e){return e.classList.contains(this.classNames.handle)}createSizerAndDistributor(e){var t;const a=e.classList.contains(this.classNames.vertical),n=this.isReverseResizeHandle(e),i=this.distributorCtor,s=null!==(t=this.config)&&void 0!==t&&t.handler?this.container:void 0,r=i.createSizer(this.container,a,n),o=i.createItem(e,this,r,s);return{sizer:r,distributor:new i(o)}}getResizeHandles(){var e,t;return null!=this&&null!==(e=this.config)&&void 0!==e&&e.handler?[this.config.handler]:null!==(t=this.container)&&void 0!==t&&t.children?Array.from(this.container.querySelectorAll(`.${this.classNames.handle}`)):[]}}var R=a(133),I=a(157),T=a(190),N=a(121),P=a(236),D=a(198),M=a(386);const A="serverlimit",L=()=>{D.a.sharedInstance().dismissToast(A)};var U=a(128),F=a(933),B=a(183),V=a(806),W=a(142),H=a(127),z=a(881),G=a(123);class K extends s.PureComponent{constructor(e){super(e),i()(this,"dispatcherRef",void 0),i()(this,"onAction",(e=>{"focus_room_filter"===e.action&&this.openSpotlight()})),this.dispatcherRef=v.a.register(this.onAction)}componentWillUnmount(){v.a.unregister(this.dispatcherRef)}openSpotlight(){H.b.createDialog(z.b,{},"mx_SpotlightDialog_wrapper",!1,!0)}render(){const e=c()({mx_RoomSearch:!0,mx_RoomSearch_minimized:this.props.isMinimized},"mx_RoomSearch_spotlightTrigger"),t=s.createElement("div",{className:"mx_RoomSearch_icon"}),a=s.createElement("kbd",{className:"mx_RoomSearch_shortcutPrompt"},u.a?"⌘ K":Object(N.a)(W.a[u.b.CONTROL])+" K");return s.createElement(G.a,{onClick:this.openSpotlight,className:e},t,!this.props.isMinimized&&s.createElement("div",{className:"mx_RoomSearch_spotlightTriggerText"},Object(N.a)("Search")),a)}}var q=a(148),$=a(178),Y=a(208),J=a(152),Q=a(195),X=a(130),Z=a.n(X),ee=a(129),te=a(140),ae=a(221),ne=a(237),ie=a(141),se=a(167),re=a(159),oe=a(156),le=a(249),ce=a(150),de=a(286),me=a(176),ue=a(629),he=a(206),pe=a(244),ge=a(132),ve=a.n(ge),be=a(1465),fe=a(590),ye=a(162);const Ee=(e,t)=>{let a="";if(t)for(const e of t.entries())a+=e+"/";return`mx_space_collapsed_${a+e}`};class _e{static get instance(){return _e.internalInstance||(_e.internalInstance=new _e),_e.internalInstance}setSpaceCollapsedState(e,t,a){localStorage.setItem(Ee(e,t),a.toString())}getSpaceCollapsedState(e,t,a){const n=localStorage.getItem(Ee(e,t));return n?"true"===n:a}}i()(_e,"internalInstance",void 0);var we=a(246),Se=a(328),Oe=a(331),Ce=a(197),xe=a(169);const je=["space","spaceKey","className","selected","label","contextMenuTooltip","notificationState","avatarSize","isNarrow","children","ContextMenuComponent"],ke=["space","activeSpaces","isNested","isPanelCollapsed","onExpand","parents","innerRef","dragHandleProps"],Re=["tabIndex"],Ie=Object(s.forwardRef)(((e,t)=>{var a;let{space:n,spaceKey:i,className:s,selected:o,label:l,contextMenuTooltip:d,notificationState:m,avatarSize:u,isNarrow:h,children:p,ContextMenuComponent:g}=e,b=ve()(e,je);const[f,y,E,_]=Object(ce.q)(t),[w,S]=Object(xe.i)(y),O=S?0:-1;let C,x,j=r.a.createElement("div",{className:"mx_SpaceButton_avatarPlaceholder"},r.a.createElement("div",{className:"mx_SpaceButton_icon"}));if(n&&(j=r.a.createElement(ye.a,{width:u,height:u,room:n})),m){let e=Object(N.a)("Jump to first unread room.");"invite"===(null==n?void 0:n.getMyMembership())&&(e=Object(N.a)("Jump to first invite."));const t=e=>{e.stopPropagation(),e.preventDefault(),$.a.instance.setActiveRoomInSpace(null!=i?i:n.roomId)};C=r.a.createElement("div",{className:"mx_SpacePanel_badgeContainer"},r.a.createElement(we.a,{onClick:t,forceCount:!1,notification:m,"aria-label":e,tabIndex:O,showUnsentTooltip:!0}))}f&&y.current&&g&&(x=r.a.createElement(g,Z()({},Object(ce.p)(y.current.getBoundingClientRect(),0),{space:n,onFinished:_})));const k=null!==(a=b.onClick)&&void 0!==a?a:o&&n?()=>v.a.dispatch({action:U.a.ViewRoom,room_id:n.roomId}):()=>$.a.instance.setActiveSpace(null!=i?i:n.roomId);return r.a.createElement(q.a,Z()({},b,{className:c()("mx_SpaceButton",s,{mx_SpaceButton_active:o,mx_SpaceButton_hasMenuOpen:f,mx_SpaceButton_narrow:h}),title:l,onClick:k,onContextMenu:E,forceHide:!h||f,inputRef:y,tabIndex:O,onFocus:w}),p,r.a.createElement("div",{className:"mx_SpaceButton_selectionWrapper"},r.a.createElement("div",{className:"mx_SpaceButton_avatarWrapper"},j,C),!h&&r.a.createElement("span",{className:"mx_SpaceButton_name"},l),g&&r.a.createElement(Se.a,{className:"mx_SpaceButton_menuButton",onClick:E,title:d,isExpanded:f}),x))}));class Te extends r.a.PureComponent{constructor(e){super(e),i()(this,"buttonRef",Object(s.createRef)()),i()(this,"onSpaceUpdate",(()=>{this.setState({childSpaces:this.childSpaces})})),i()(this,"onRoomNameChange",(()=>{this.setState({name:this.props.space.name})})),i()(this,"toggleCollapse",(e=>{this.props.onExpand&&this.isCollapsed&&this.props.onExpand();const t=!this.isCollapsed;_e.instance.setSpaceCollapsedState(this.props.space.roomId,this.props.parents,t),this.setState({collapsed:t}),e.stopPropagation()})),i()(this,"onKeyDown",(e=>{var t;let a=!0;const n=Object(J.a)().getRoomListAction(e),i=null===(t=this.state.childSpaces)||void 0===t?void 0:t.length;switch(n){case W.h.CollapseRoomListSection:if(i&&!this.isCollapsed)this.toggleCollapse(e);else{var s,r,o;const e=null===(s=this.buttonRef)||void 0===s||null===(r=s.current)||void 0===r||null===(o=r.parentElement)||void 0===o?void 0:o.parentElement,t=null==e?void 0:e.previousElementSibling;null==t||t.focus()}break;case W.h.ExpandRoomListSection:if(i)if(this.isCollapsed)this.toggleCollapse(e);else{var l,c,d;const e=null===(l=this.buttonRef)||void 0===l||null===(c=l.current)||void 0===c?void 0:c.nextElementSibling,t=null==e?void 0:e.querySelector(".mx_SpaceItem");null==t||null===(d=t.querySelector(".mx_SpaceButton"))||void 0===d||d.focus()}break;default:a=!1}a&&(e.stopPropagation(),e.preventDefault())}));const t=_e.instance.getSpaceCollapsedState(e.space.roomId,this.props.parents,!e.isNested);this.state={name:this.props.space.name,collapsed:t,childSpaces:this.childSpaces},$.a.instance.on(this.props.space.roomId,this.onSpaceUpdate),this.props.space.on(te.d.Name,this.onRoomNameChange)}componentWillUnmount(){$.a.instance.off(this.props.space.roomId,this.onSpaceUpdate),this.props.space.off(te.d.Name,this.onRoomNameChange)}get childSpaces(){return $.a.instance.getChildSpaces(this.props.space.roomId).filter((e=>{var t;return!(null!==(t=this.props.parents)&&void 0!==t&&t.has(e.roomId))}))}get isCollapsed(){return this.state.collapsed||!!this.props.isPanelCollapsed}render(){var e,t;const a=this.props,{space:n,activeSpaces:i,isNested:s,isPanelCollapsed:o,onExpand:l,parents:d,innerRef:m,dragHandleProps:u}=a,h=ve()(a,ke),p=this.isCollapsed,g=c()(this.props.className,{mx_SpaceItem:!0,mx_SpaceItem_narrow:o,collapsed:p,hasSubSpaces:null===(e=this.state.childSpaces)||void 0===e?void 0:e.length}),v="invite"===n.getMyMembership(),b=v?Oe.a.forSymbol("!",Ce.a.Red):$.a.instance.getNotificationState(n.roomId),f=null===(t=this.state.childSpaces)||void 0===t?void 0:t.length;let y;f&&!p&&(y=r.a.createElement(Ne,{spaces:this.state.childSpaces,activeSpaces:i,isNested:!0,parents:new Set(d).add(n.roomId)}));const E=f?r.a.createElement(G.a,{className:"mx_SpaceButton_toggleCollapse",onClick:this.toggleCollapse,tabIndex:-1,"aria-label":p?Object(N.a)("Expand"):Object(N.a)("Collapse")}):null,_=u||{},{tabIndex:w}=_,S=ve()(_,Re),O=i.includes(n.roomId);return r.a.createElement("li",Z()({},h,{className:g,ref:m,"aria-expanded":f?!p:void 0,"aria-selected":O,role:"treeitem"}),r.a.createElement(Ie,Z()({},S,{space:n,className:v?"mx_SpaceButton_invite":void 0,selected:O,label:this.state.name,contextMenuTooltip:Object(N.a)("Space options"),notificationState:b,isNarrow:o,avatarSize:s?24:32,onKeyDown:this.onKeyDown,ContextMenuComponent:"join"===this.props.space.getMyMembership()?ue.a:void 0}),E),y)}}i()(Te,"contextType",R.a);const Ne=e=>{let{spaces:t,activeSpaces:a,isNested:n,parents:i}=e;return r.a.createElement("ul",{className:"mx_SpaceTreeLevel",role:"group"},t.map((e=>r.a.createElement(Te,{key:e.roomId,activeSpaces:a,space:e,isNested:n,parents:i}))))};var Pe=a(220),De=a(177),Me=a(883),Ae=a(214),Le=a(310),Ue=a(279),Fe=a(884);const Be="MATCH_SYSTEM_THEME_ID";var Ve,We,He=e=>{let{requestClose:t}=e;const a=Object(s.useMemo)(Le.f,[]),n=Fe.a.calculateThemeState(),i=Object(Le.d)(n.theme),o=i||n.theme,{useSystemTheme:l}=n,c=[{id:Be,name:Object(N.a)("Match system")},...a],d=l?Be:o;return r.a.createElement("div",{className:"mx_QuickThemeSwitcher"},r.a.createElement("h4",{className:"mx_QuickThemeSwitcher_heading"},Object(N.a)("Theme")),r.a.createElement(Ue.a,{id:"mx_QuickSettingsButton_themePickerDropdown",onOptionChange:async e=>{re.b.trackInteraction("WebQuickSettingsThemeDropdown");try{e===Be?await b.b.setValue("use_system_theme",null,f.a.DEVICE,!0):(v.a.dispatch({action:U.a.RecheckTheme,forceTheme:e}),await Promise.all([b.b.setValue("theme",null,f.a.DEVICE,e),b.b.setValue("use_system_theme",null,f.a.DEVICE,!1)]))}catch(e){v.a.dispatch({action:U.a.RecheckTheme})}t()},value:d,label:Object(N.a)("Space selection")},c.map((e=>r.a.createElement("div",{key:e.id},e.name)))))};function ze(){return ze=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},ze.apply(this,arguments)}function Ge(e){return s.createElement("svg",ze({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",role:"presentation","aria-hidden":!0},e),Ve||(Ve=s.createElement("path",{d:"M11 18.598V15h2v3.598C13 20.5 12.238 22 12 22s-1-1.5-1-3.402zM9.5 6c-.325-.167-1.714-.8-2.883-2s-.495-2 .513-2H12v4H9.5zM14.5 6c.325-.167 1.714-.8 2.883-2s.495-2-.513-2H12v4h2.5zM9.429 6h5.142L15 10H9l.429-4z",fill:"#000"})),We||(We=s.createElement("path",{d:"M12 9c-3.069 0-5.676 1.693-6.621 4.048C4.967 14.073 5.895 15 7 15h10c1.105 0 2.032-.927 1.621-1.952C17.677 10.693 15.07 9 12 9z",fill:"#000"})))}var Ke,qe,$e;function Ye(){return Ye=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Ye.apply(this,arguments)}function Je(e){return s.createElement("svg",Ye({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",role:"presentation","aria-hidden":!0},e),Ke||(Ke=s.createElement("circle",{cx:15.5,cy:10,r:1.5,transform:"rotate(180 15.5 10)",fill:"#15191E"})),qe||(qe=s.createElement("circle",{cx:10,cy:10,r:1.5,transform:"rotate(180 10 10)",fill:"#15191E"})),$e||($e=s.createElement("circle",{cx:4.5,cy:10,r:1.5,transform:"rotate(180 4.5 10)",fill:"#15191E"})))}var Qe,Xe,Ze;function et(){return et=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},et.apply(this,arguments)}function tt(e){return s.createElement("svg",et({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",role:"presentation","aria-hidden":!0},e),Qe||(Qe=s.createElement("mask",{id:"members_svg__a",fill:"#fff"},s.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.591 20.292A9.954 9.954 0 0112 22a9.956 9.956 0 01-6-2 9.985 9.985 0 01-4-8C2 6.477 6.477 2 12 2s10 4.477 10 10a9.99 9.99 0 01-4.409 8.292zM12 12.5c1.657 0 3-1.455 3-3.25S13.657 6 12 6 9 7.455 9 9.25s1.343 3.25 3 3.25zm0 7.5a7.974 7.974 0 005.563-2.251 6.002 6.002 0 00-11.126 0A7.973 7.973 0 0012 20z"}))),Xe||(Xe=s.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.591 20.292A9.954 9.954 0 0112 22a9.956 9.956 0 01-6-2 9.985 9.985 0 01-4-8C2 6.477 6.477 2 12 2s10 4.477 10 10a9.99 9.99 0 01-4.409 8.292zM12 12.5c1.657 0 3-1.455 3-3.25S13.657 6 12 6 9 7.455 9 9.25s1.343 3.25 3 3.25zm0 7.5a7.974 7.974 0 005.563-2.251 6.002 6.002 0 00-11.126 0A7.973 7.973 0 0012 20z",fill:"#000"})),Ze||(Ze=s.createElement("path",{d:"M17.591 20.292l-1.12-1.657 1.12 1.657zM6 20.001L4.799 21.6 6 20zm11.563-2.252l1.391 1.437.97-.938-.507-1.25-1.854.75zm-11.126 0l-1.854-.751-.506 1.25.969.938 1.39-1.437zM12 24c2.482 0 4.794-.756 6.71-2.05l-2.239-3.315A7.954 7.954 0 0112 20v4zm-7.201-2.4A11.956 11.956 0 0012 24v-4a7.955 7.955 0 01-4.799-1.598L4.8 21.6zM0 12c0 3.927 1.889 7.414 4.799 9.6L7.2 18.402A7.985 7.985 0 014 12H0zM12 0C5.373 0 0 5.373 0 12h4a8 8 0 018-8V0zm12 12c0-6.627-5.373-12-12-12v4a8 8 0 018 8h4zm-5.29 9.95A11.99 11.99 0 0024 12h-4a7.99 7.99 0 01-3.529 6.635l2.24 3.314zM13 9.25c0 .844-.595 1.25-1 1.25v4c2.91 0 5-2.504 5-5.25h-4zM12 8c.405 0 1 .406 1 1.25h4C17 6.504 14.91 4 12 4v4zm-1 1.25c0-.844.595-1.25 1-1.25V4C9.09 4 7 6.504 7 9.25h4zm1 1.25c-.405 0-1-.406-1-1.25H7c0 2.746 2.09 5.25 5 5.25v-4zm4.172 5.812A5.974 5.974 0 0112 18v4a9.973 9.973 0 006.954-2.814l-2.782-2.874zM12 16a4.002 4.002 0 013.71 2.5l3.707-1.502A8.002 8.002 0 0012 12v4zm-3.71 2.5A4.002 4.002 0 0112 16v-4a8.002 8.002 0 00-7.417 4.998L8.29 18.5zM12 18a5.974 5.974 0 01-4.172-1.688l-2.782 2.874A9.973 9.973 0 0012 22v-4z",fill:"#000",mask:"url(#members_svg__a)"})))}var at;function nt(){return nt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},nt.apply(this,arguments)}function it(e){return s.createElement("svg",nt({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 18 18",role:"presentation","aria-hidden":!0},e),at||(at=s.createElement("path",{d:"M8.414 1.432c.178-.576.994-.576 1.172 0l1.585 5.131h5.215c.586 0 .838.745.372 1.1l-4.244 3.243 1.604 5.194c.177.57-.483 1.03-.958.668L9 13.59l-4.16 3.178c-.475.363-1.135-.098-.959-.668l1.606-5.194-4.245-3.242c-.466-.356-.214-1.1.372-1.1H6.83l1.585-5.132z",fill:"#000"})))}var st=a(648),rt=a(154);var ot=e=>{let{isPanelCollapsed:t=!1}=e;const[a,n,i,s]=Object(ce.q)(),{[Y.a.Favourites]:o,[Y.a.People]:l}=Object(se.b)("Spaces.enabledMetaSpaces");let d;return a&&n.current&&(d=r.a.createElement(ce.n,Z()({},Object(ce.k)(n.current.getBoundingClientRect(),ce.a.None,16),{wrapperClassName:"mx_QuickSettingsButton_ContextMenuWrapper",onFinished:s,managed:!1,focusLock:!0}),r.a.createElement("h2",null,Object(N.a)("Quick settings")),r.a.createElement(G.a,{onClick:()=>{s(),v.a.dispatch({action:U.a.ViewUserSettings})},kind:"primary_outline"},Object(N.a)("All settings")),b.b.getValue("developerMode")&&r.a.createElement(G.a,{onClick:()=>{s(),H.b.createDialog(st.a,{roomId:rt.b.instance.roomViewStore.getRoomId()},"mx_DevtoolsDialog_wrapper")},kind:"danger_outline"},Object(N.a)("Developer tools")),r.a.createElement("h4",{className:"mx_QuickSettingsButton_pinToSidebarHeading"},r.a.createElement(Ge,{className:"mx_QuickSettingsButton_icon"}),Object(N.a)("Pin to sidebar")),r.a.createElement(De.b,{className:"mx_QuickSettingsButton_favouritesCheckbox",checked:!!o,onChange:Object(Me.b)(Y.a.Favourites,"WebQuickSettingsPinToSidebarCheckbox")},r.a.createElement(it,{className:"mx_QuickSettingsButton_icon"}),Object(N.a)("Favourites")),r.a.createElement(De.b,{className:"mx_QuickSettingsButton_peopleCheckbox",checked:!!l,onChange:Object(Me.b)(Y.a.People,"WebQuickSettingsPinToSidebarCheckbox")},r.a.createElement(tt,{className:"mx_QuickSettingsButton_icon"}),Object(N.a)("People")),r.a.createElement(G.a,{className:"mx_QuickSettingsButton_moreOptionsButton",onClick:()=>{s(),v.a.dispatch({action:U.a.ViewUserSettings,initialTabId:Ae.a.Sidebar})}},r.a.createElement(Je,{className:"mx_QuickSettingsButton_icon"}),Object(N.a)("More options")),r.a.createElement(He,{requestClose:s}))),r.a.createElement(r.a.Fragment,null,r.a.createElement(q.a,{className:c()("mx_QuickSettingsButton",{expanded:!t}),onClick:i,title:Object(N.a)("Quick settings"),inputRef:n,forceHide:!t},t?null:Object(N.a)("Settings")),d)},lt=a(122),ct=a(628),dt=a(630),mt=a(131),ut=a(477),ht=a(267),pt=a(153),gt=a(191),vt=a(260),bt=a(395),ft=a(192);class yt extends r.a.Component{constructor(e,t){super(e,t),i()(this,"context",void 0),i()(this,"dispatcherRef",void 0),i()(this,"themeWatcherRef",void 0),i()(this,"dndWatcherRef",void 0),i()(this,"buttonRef",Object(s.createRef)()),i()(this,"onCurrentVoiceBroadcastRecordingChanged",(e=>{this.setState({showLiveAvatarAddon:null!==e})})),i()(this,"onProfileUpdate",(async()=>{this.forceUpdate()})),i()(this,"onSelectedSpaceUpdate",(async()=>{this.setState({selectedSpace:$.a.instance.activeSpaceRoom})})),i()(this,"onThemeChanged",(()=>{this.setState({isDarkTheme:this.isUserOnDarkTheme(),isHighContrast:this.isUserOnHighContrastTheme()})})),i()(this,"onAction",(e=>{if(e.action===U.a.ToggleUserMenu)this.state.contextMenuPosition?this.setState({contextMenuPosition:null}):this.buttonRef.current&&this.buttonRef.current.click()})),i()(this,"onOpenMenuClick",(e=>{e.preventDefault(),e.stopPropagation(),this.setState({contextMenuPosition:e.currentTarget.getBoundingClientRect()})})),i()(this,"onContextMenu",(e=>{e.preventDefault(),e.stopPropagation(),this.setState({contextMenuPosition:{left:e.clientX,top:e.clientY,width:20,height:0}})})),i()(this,"onCloseMenu",(()=>{this.setState({contextMenuPosition:null})})),i()(this,"onSwitchThemeClick",(e=>{e.preventDefault(),e.stopPropagation(),re.b.trackInteraction("WebUserMenuThemeToggleButton",e),b.b.setValue("use_system_theme",null,f.a.DEVICE,!1);let t=this.state.isDarkTheme?"light":"dark";if(this.state.isHighContrast){const e=Object(Le.c)(t);e&&(t=e)}b.b.setValue("theme",null,f.a.DEVICE,t)})),i()(this,"onSettingsOpen",((e,t)=>{e.preventDefault(),e.stopPropagation();const a={action:U.a.ViewUserSettings,initialTabId:t};v.a.dispatch(a),this.setState({contextMenuPosition:null})})),i()(this,"onProvideFeedback",(e=>{e.preventDefault(),e.stopPropagation(),H.b.createDialog(ct.a),this.setState({contextMenuPosition:null})})),i()(this,"onSignOutClick",(async e=>{var t;e.preventDefault(),e.stopPropagation();const a=lt.a.get();a&&a.isCryptoEnabled()&&null!==(t=await a.exportRoomKeys())&&void 0!==t&&t.length?H.b.createDialog(dt.a):v.a.dispatch({action:"logout"}),this.setState({contextMenuPosition:null})})),i()(this,"onSignInClick",(()=>{v.a.dispatch({action:"start_login"}),this.setState({contextMenuPosition:null})})),i()(this,"onRegisterClick",(()=>{v.a.dispatch({action:"start_registration"}),this.setState({contextMenuPosition:null})})),i()(this,"onHomeClick",(e=>{e.preventDefault(),e.stopPropagation(),v.a.dispatch({action:U.a.ViewHomePage}),this.setState({contextMenuPosition:null})})),i()(this,"renderContextMenu",(()=>{if(!this.state.contextMenuPosition)return null;let e;lt.a.get().isGuest()&&(e=r.a.createElement("div",{className:"mx_UserMenu_contextMenu_header mx_UserMenu_contextMenu_guestPrompts"},Object(N.a)("Got an account? <a>Sign in</a>",{},{a:e=>r.a.createElement(G.a,{kind:"link_inline",onClick:this.onSignInClick},e)}),Object(N.a)("New here? <a>Create an account</a>",{},{a:e=>r.a.createElement(G.a,{kind:"link_inline",onClick:this.onRegisterClick},e)})));let t,n=null;this.hasHomePage&&(n=r.a.createElement(me.b,{iconClassName:"mx_UserMenu_iconHome",label:Object(N.a)("Home"),onClick:this.onHomeClick})),b.b.getValue(oe.b.Feedback)&&(t=r.a.createElement(me.b,{iconClassName:"mx_UserMenu_iconMessage",label:Object(N.a)("Feedback"),onClick:this.onProvideFeedback}));let i=r.a.createElement(me.c,null,n,r.a.createElement(me.b,{iconClassName:"mx_UserMenu_iconBell",label:Object(N.a)("Notifications"),onClick:e=>this.onSettingsOpen(e,Ae.a.Notifications)}),r.a.createElement(me.b,{iconClassName:"mx_UserMenu_iconLock",label:Object(N.a)("Security & Privacy"),onClick:e=>this.onSettingsOpen(e,Ae.a.Security)}),r.a.createElement(me.b,{iconClassName:"mx_UserMenu_iconSettings",label:Object(N.a)("All settings"),onClick:e=>this.onSettingsOpen(e,null)}),t,r.a.createElement(me.b,{className:"mx_IconizedContextMenu_option_red",iconClassName:"mx_UserMenu_iconSignOut",label:Object(N.a)("Sign out"),onClick:this.onSignOutClick}));lt.a.get().isGuest()&&(i=r.a.createElement(me.c,null,n,r.a.createElement(me.b,{iconClassName:"mx_UserMenu_iconSettings",label:Object(N.a)("Settings"),onClick:e=>this.onSettingsOpen(e,null)}),t));const s=this.props.isPanelCollapsed?{left:(o=this.state.contextMenuPosition).width+o.left+8,top:o.top,chevronFace:ce.a.None}:(e=>({left:e.left,top:e.top+e.height,chevronFace:ce.a.None}))(this.state.contextMenuPosition);var o;return r.a.createElement(me.e,Z()({},s,{onFinished:this.onCloseMenu,className:"mx_UserMenu_contextMenu"}),r.a.createElement("div",{className:"mx_UserMenu_contextMenu_header"},r.a.createElement("div",{className:"mx_UserMenu_contextMenu_name"},r.a.createElement("span",{className:"mx_UserMenu_contextMenu_displayName"},ht.a.instance.displayName),r.a.createElement("span",{className:"mx_UserMenu_contextMenu_userId"},vt.a.getDisplayUserIdentifier(lt.a.get().getUserId(),{withDisplayName:!0}))),r.a.createElement(xe.b,{className:"mx_UserMenu_contextMenu_themeButton",onClick:this.onSwitchThemeClick,title:this.state.isDarkTheme?Object(N.a)("Switch to light mode"):Object(N.a)("Switch to dark mode")},r.a.createElement("img",{src:a(1464).default,alt:Object(N.a)("Switch theme"),width:16}))),e,i)})),this.context=t,this.state={contextMenuPosition:null,isDarkTheme:this.isUserOnDarkTheme(),isHighContrast:this.isUserOnHighContrastTheme(),selectedSpace:$.a.instance.activeSpaceRoom,showLiveAvatarAddon:this.context.voiceBroadcastRecordingsStore.hasCurrent()},ht.a.instance.on(pt.b,this.onProfileUpdate),$.a.instance.on(Y.d,this.onSelectedSpaceUpdate)}get hasHomePage(){return!!Object(ut.a)(mt.b.get())}componentDidMount(){this.context.voiceBroadcastRecordingsStore.on(ft.y.CurrentChanged,this.onCurrentVoiceBroadcastRecordingChanged),this.dispatcherRef=v.a.register(this.onAction),this.themeWatcherRef=b.b.watchSetting("theme",null,this.onThemeChanged)}componentWillUnmount(){this.themeWatcherRef&&b.b.unwatchSetting(this.themeWatcherRef),this.dndWatcherRef&&b.b.unwatchSetting(this.dndWatcherRef),this.dispatcherRef&&v.a.unregister(this.dispatcherRef),ht.a.instance.off(pt.b,this.onProfileUpdate),$.a.instance.off(Y.d,this.onSelectedSpaceUpdate),this.context.voiceBroadcastRecordingsStore.off(ft.y.CurrentChanged,this.onCurrentVoiceBroadcastRecordingChanged)}isUserOnDarkTheme(){if(b.b.getValue("use_system_theme"))return window.matchMedia("(prefers-color-scheme: dark)").matches;{const e=b.b.getValue("theme");return e.startsWith("custom-")?Object(Le.e)(e.substring("custom-".length)).is_dark:"dark"===e}}isUserOnHighContrastTheme(){if(b.b.getValue("use_system_theme"))return window.matchMedia("(prefers-contrast: more)").matches;{const e=b.b.getValue("theme");return!e.startsWith("custom-")&&Object(Le.g)(e)}}render(){const e=lt.a.get().getSafeUserId(),t=ht.a.instance.displayName||e,a=ht.a.instance.getHttpAvatarUrl(32);let n;this.props.isPanelCollapsed||(n=r.a.createElement("div",{className:"mx_UserMenu_name"},t));const i=this.state.showLiveAvatarAddon?r.a.createElement("div",{className:"mx_UserMenu_userAvatarLive","data-testid":"user-menu-live-vb"},r.a.createElement(bt.a,{className:"mx_Icon_8"})):null;return r.a.createElement("div",{className:"mx_UserMenu"},r.a.createElement(ce.b,{onClick:this.onOpenMenuClick,inputRef:this.buttonRef,label:Object(N.a)("User menu"),isExpanded:!!this.state.contextMenuPosition,onContextMenu:this.onContextMenu},r.a.createElement("div",{className:"mx_UserMenu_userAvatar"},r.a.createElement(gt.a,{idName:e,name:t,url:a,width:32,height:32,resizeMethod:"crop",className:"mx_UserMenu_userAvatar_BaseAvatar"}),i),n,this.renderContextMenu()),this.props.children)}}i()(yt,"contextType",rt.a);var Et=a(212);const _t=["children","trackHorizontalOverflow","verticalScrollsHorizontally"];class wt extends r.a.Component{constructor(e){super(e),i()(this,"autoHideScrollbar",Object(s.createRef)()),i()(this,"scrollElement",void 0),i()(this,"likelyTrackpadUser",null),i()(this,"checkAgainForTrackpad",0),i()(this,"collectScroller",(e=>{var t,a;null===(t=(a=this.props).wrappedRef)||void 0===t||t.call(a,e),e&&!this.scrollElement&&(this.scrollElement=e,this.scrollElement.addEventListener("scroll",this.checkOverflow,{passive:!0}),this.checkOverflow())})),i()(this,"checkOverflow",(()=>{const e=this.scrollElement.scrollTop>0,t=this.scrollElement.scrollHeight>this.scrollElement.scrollTop+this.scrollElement.clientHeight,a=this.scrollElement.scrollLeft>0,n=this.scrollElement.scrollWidth>this.scrollElement.scrollLeft+this.scrollElement.clientWidth;e?this.scrollElement.classList.add("mx_IndicatorScrollbar_topOverflow"):this.scrollElement.classList.remove("mx_IndicatorScrollbar_topOverflow"),t?this.scrollElement.classList.add("mx_IndicatorScrollbar_bottomOverflow"):this.scrollElement.classList.remove("mx_IndicatorScrollbar_bottomOverflow"),a?this.scrollElement.classList.add("mx_IndicatorScrollbar_leftOverflow"):this.scrollElement.classList.remove("mx_IndicatorScrollbar_leftOverflow"),n?this.scrollElement.classList.add("mx_IndicatorScrollbar_rightOverflow"):this.scrollElement.classList.remove("mx_IndicatorScrollbar_rightOverflow"),this.props.trackHorizontalOverflow&&this.setState({leftIndicatorOffset:a?`${this.scrollElement.scrollLeft}px`:"0",rightIndicatorOffset:n?`-${this.scrollElement.scrollLeft}px`:"0"})})),i()(this,"onMouseWheel",(e=>{if(this.props.verticalScrollsHorizontally&&this.scrollElement){const t=0,a=1,n=(new Date).getTime();if(Math.abs(e.deltaX)>0?(this.likelyTrackpadUser=!0,this.checkAgainForTrackpad=n+6e4):this.likelyTrackpadUser&&n>=this.checkAgainForTrackpad&&(this.likelyTrackpadUser=!1),this.likelyTrackpadUser)return;if(Math.abs(e.deltaX)<=t){const t=e.deltaY<0?-50:50,n=Math.abs(e.deltaY)<25?e.deltaY+t:e.deltaY;this.scrollElement.scrollLeft+=n*a}}})),this.state={leftIndicatorOffset:"0",rightIndicatorOffset:"0"}}componentDidUpdate(e){r.a.Children.count(e.children)!==r.a.Children.count(this.props.children)&&this.checkOverflow()}componentDidMount(){this.checkOverflow(),Q.b.instance.on(Q.a.Resize,this.checkOverflow)}componentWillUnmount(){var e;null===(e=this.scrollElement)||void 0===e||e.removeEventListener("scroll",this.checkOverflow),Q.b.instance.off(Q.a.Resize,this.checkOverflow)}render(){const e=this.props,{children:t,trackHorizontalOverflow:a,verticalScrollsHorizontally:n}=e,i=ve()(e,_t),s={left:this.state.leftIndicatorOffset},o={right:this.state.rightIndicatorOffset},l=a?r.a.createElement("div",{className:"mx_IndicatorScrollbar_leftOverflowIndicator",style:s}):null,c=a?r.a.createElement("div",{className:"mx_IndicatorScrollbar_rightOverflowIndicator",style:o}):null;return r.a.createElement(Et.a,Z()({},i,{ref:this.autoHideScrollbar,wrappedRef:this.collectScroller,onWheel:this.onMouseWheel}),l,t,c)}}const St=["onFinished","hideHeader"],Ot=["selected","isPanelCollapsed"],Ct=["children","isPanelCollapsed","setPanelCollapsed","isDraggingOver","innerRef"],xt=e=>{let{onFinished:t,hideHeader:a}=e,n=ve()(e,St);const i=Object(se.b)("Spaces.allRoomsInHome");return r.a.createElement(me.e,Z()({},n,{onFinished:t,className:"mx_SpacePanel_contextMenu",compact:!0}),!a&&r.a.createElement("div",{className:"mx_SpacePanel_contextMenu_header"},Object(N.a)("Home")),r.a.createElement(me.c,{first:!0},r.a.createElement(me.a,{iconClassName:"mx_SpacePanel_noIcon",label:Object(N.a)("Show all rooms"),active:i,onClick:()=>{b.b.setValue("Spaces.allRoomsInHome",null,f.a.ACCOUNT,!i)}})))},jt=e=>{let{selected:t,isPanelCollapsed:a}=e,n=ve()(e,Ot);return r.a.createElement("li",{className:c()("mx_SpaceItem",{collapsed:a}),role:"treeitem","aria-selected":t},r.a.createElement(Ie,Z()({},n,{selected:t,isNarrow:a})))},kt=()=>$.a.instance.allRoomsInHome?Pe.a.instance.globalState:$.a.instance.getNotificationState(Y.a.Home),Rt=e=>{let{isPanelCollapsed:t,setPanelCollapsed:a}=e;const[n,i,o,l]=Object(ce.q)();let d;Object(s.useEffect)((()=>{!t&&n&&l()}),[t]),n&&(d=r.a.createElement(fe.d,{onFinished:l}));const m=n?l:()=>{t||a(!0),o()};return r.a.createElement("li",{className:c()("mx_SpaceItem mx_SpaceItem_new",{collapsed:t}),role:"treeitem","aria-selected":!1},r.a.createElement(Ie,{"data-testid":"create-space-button",className:c()("mx_SpaceButton_new",{mx_SpaceButton_newCancel:n}),label:n?Object(N.a)("Cancel"):Object(N.a)("Create a space"),onClick:m,isNarrow:t,ref:i}),d)},It={[Y.a.Home]:e=>{let{selected:t,isPanelCollapsed:a}=e;const n=Object(ie.b)($.a.instance,Y.b,(()=>$.a.instance.allRoomsInHome)),[i,o]=Object(s.useState)(kt()),l=Object(s.useCallback)((()=>{o(kt())}),[]);return Object(s.useEffect)(l,[l,n]),Object(ie.a)(Pe.a.instance,Pe.b,l),r.a.createElement(jt,{spaceKey:Y.a.Home,className:"mx_SpaceButton_home",selected:t,isPanelCollapsed:a,label:Object(Y.g)(Y.a.Home,n),notificationState:i,ContextMenuComponent:xt,contextMenuTooltip:Object(N.a)("Options")})},[Y.a.Favourites]:e=>{let{selected:t,isPanelCollapsed:a}=e;return r.a.createElement(jt,{spaceKey:Y.a.Favourites,className:"mx_SpaceButton_favourites",selected:t,isPanelCollapsed:a,label:Object(Y.g)(Y.a.Favourites),notificationState:$.a.instance.getNotificationState(Y.a.Favourites)})},[Y.a.People]:e=>{let{selected:t,isPanelCollapsed:a}=e;return r.a.createElement(jt,{spaceKey:Y.a.People,className:"mx_SpaceButton_people",selected:t,isPanelCollapsed:a,label:Object(Y.g)(Y.a.People),notificationState:$.a.instance.getNotificationState(Y.a.People)})},[Y.a.Orphans]:e=>{let{selected:t,isPanelCollapsed:a}=e;return r.a.createElement(jt,{spaceKey:Y.a.Orphans,className:"mx_SpaceButton_orphans",selected:t,isPanelCollapsed:a,label:Object(Y.g)(Y.a.Orphans),notificationState:$.a.instance.getNotificationState(Y.a.Orphans)})}},Tt=r.a.memo((e=>{let{children:t,isPanelCollapsed:a,setPanelCollapsed:n,isDraggingOver:i,innerRef:s}=e,o=ve()(e,Ct);const[l,c,d,m]=(()=>{const e=Object(ie.b)($.a.instance,Y.c,(()=>$.a.instance.invitedSpaces)),[t,a]=Object(ie.b)($.a.instance,Y.f,(()=>[$.a.instance.enabledMetaSpaces,$.a.instance.spacePanelSpaces]));return[e,t,a,Object(ie.b)($.a.instance,Y.d,(()=>$.a.instance.activeSpace))]})(),u=m?[m]:[],h=c.map((e=>{const t=It[e];return r.a.createElement(t,{key:e,selected:m===e,isPanelCollapsed:a})}));return r.a.createElement(wt,Z()({},o,{wrappedRef:s,className:"mx_SpaceTreeLevel",style:i?{pointerEvents:"none"}:void 0,element:"ul",role:"tree","aria-label":Object(N.a)("Spaces")}),h,l.map((e=>r.a.createElement(Te,{key:e.roomId,space:e,activeSpaces:u,isPanelCollapsed:a,onExpand:()=>n(!1)}))),d.map(((e,t)=>r.a.createElement(be.Draggable,{key:e.roomId,draggableId:e.roomId,index:t},((t,i)=>r.a.createElement(Te,Z()({},t.draggableProps,{dragHandleProps:t.dragHandleProps,key:e.roomId,innerRef:t.innerRef,className:i.isDragging?"mx_SpaceItem_dragging":void 0,space:e,activeSpaces:u,isPanelCollapsed:a,onExpand:()=>n(!1)})))))),t,Object(ae.a)(oe.a.CreateSpaces)&&r.a.createElement(Rt,{isPanelCollapsed:a,setPanelCollapsed:n}))}));var Nt=()=>{const[e,t]=Object(s.useState)(!0),a=Object(s.useRef)();return Object(s.useLayoutEffect)((()=>(Q.b.instance.trackElementDimensions("SpacePanel",a.current),()=>Q.b.instance.stopTrackingElementDimensions("SpacePanel"))),[]),Object(ne.a)(v.a,(a=>{a.action===U.a.ToggleSpacePanel&&t(!e)})),r.a.createElement(be.DragDropContext,{onDragEnd:e=>{e.destination&&$.a.instance.moveRootSpace(e.source.index,e.destination.index)}},r.a.createElement(xe.d,{handleHomeEnd:!0,handleUpDown:!0},(n=>{let{onKeyDownHandler:i}=n;return r.a.createElement("div",{className:c()("mx_SpacePanel",{collapsed:e}),onKeyDown:i,ref:a},r.a.createElement(yt,{isPanelCollapsed:e},r.a.createElement(q.a,{className:c()("mx_SpacePanel_toggleCollapse",{expanded:!e}),onClick:()=>t(!e),title:e?Object(N.a)("Expand"):Object(N.a)("Collapse"),tooltip:r.a.createElement("div",null,r.a.createElement("div",{className:"mx_Tooltip_title"},e?Object(N.a)("Expand"):Object(N.a)("Collapse")),r.a.createElement("div",{className:"mx_Tooltip_sub"},u.a?"⌘ + ⇧ + D":Object(N.a)(W.a[u.b.CONTROL])+" + "+Object(N.a)(W.a[u.b.SHIFT])+" + D"))})),r.a.createElement(be.Droppable,{droppableId:"top-level-spaces"},((a,n)=>r.a.createElement(Tt,Z()({},a.droppableProps,{isPanelCollapsed:e,setPanelCollapsed:t,isDraggingOver:n.isDraggingOver,innerRef:a.innerRef}),a.placeholder))),r.a.createElement(ot,{isPanelCollapsed:e}))})))};const Pt=e=>({left:e.left+window.scrollX,top:e.bottom+window.scrollY+12,chevronFace:ce.a.None});var Dt;!function(e){e[e.JoinRoom=0]="JoinRoom",e[e.BulkRedact=1]="BulkRedact"}(Dt||(Dt={}));var Mt=e=>{var t;let{onVisibilityChange:a}=e;const n=Object(s.useContext)(R.a),[i,l,c,d]=Object(ce.q)(),[m,u,h,p]=Object(ce.q)(),[g,b]=Object(ie.b)($.a.instance,Y.d,(()=>[$.a.instance.activeSpace,$.a.instance.activeSpaceRoom])),f=Object(ie.b)($.a.instance,Y.b,(()=>$.a.instance.allRoomsInHome)),y=Object(se.a)("feature_video_rooms"),E=Object(se.a)("feature_element_call_video_rooms"),_=(()=>{const e=Object(s.useContext)(R.a),[t,a]=Object(s.useState)(new Map),n=(e,n)=>{const i=new Set(t.get(e));i.add(n),a(new Map(t).set(e,i))},i=(e,n)=>{const i=new Set(t.get(e));i.delete(n)&&a(new Map(t).set(e,i))};return Object(ne.a)(v.a,(e=>{switch(e.action){case U.a.JoinRoom:n(Dt.JoinRoom,e.roomId);break;case U.a.JoinRoomReady:case U.a.JoinRoomError:i(Dt.JoinRoom,e.roomId);break;case U.a.BulkRedactStart:n(Dt.BulkRedact,e.roomId);break;case U.a.BulkRedactEnd:i(Dt.BulkRedact,e.roomId)}})),Object(ie.c)(e,o.b.Room,(e=>i(Dt.JoinRoom,e.roomId))),t})(),w=b||g===Y.a.Home;Object(s.useEffect)((()=>{i&&!w&&d()}),[d,w,i]);const S=Object(ie.d)(null!=b?b:void 0,te.d.Name,(()=>null==b?void 0:b.name));Object(s.useEffect)((()=>{null==a||a()}),[a]);const O=Object(ae.a)(oe.a.ExploreRooms),C=Object(ae.a)(oe.a.CreateRooms),x=Object(ae.a)(oe.a.CreateSpaces),j=null==b||null===(t=b.currentState)||void 0===t?void 0:t.maySendStateEvent(ee.b.SpaceChild,n.getUserId()),k=j&&C,I=j&&x,T=C||O||x||b;let P,D;if(i&&l.current){let e;e=b?ue.a:xt,P=r.a.createElement(e,Z()({},Pt(l.current.getBoundingClientRect()),{space:b,onFinished:d,hideHeader:!0}))}else if(m&&b){let e,t;Object(le.c)(b)&&(e=r.a.createElement(me.b,{label:Object(N.a)("Invite"),iconClassName:"mx_RoomListHeader_iconInvite",onClick:e=>{e.preventDefault(),e.stopPropagation(),Object(le.i)(b),p()}})),null!=b&&b.currentState.maySendStateEvent(ee.b.RoomAvatar,n.getUserId())&&(t=r.a.createElement(r.a.Fragment,null,r.a.createElement(me.b,{iconClassName:"mx_RoomListHeader_iconNewRoom",label:Object(N.a)("New room"),onClick:e=>{e.preventDefault(),e.stopPropagation(),Object(le.g)(b),re.b.trackInteraction("WebRoomListHeaderPlusMenuCreateRoomItem",e),p()}}),y&&r.a.createElement(me.b,{iconClassName:"mx_RoomListHeader_iconNewVideoRoom",label:Object(N.a)("New video room"),onClick:e=>{e.preventDefault(),e.stopPropagation(),Object(le.g)(b,E?ee.j.UnstableCall:ee.j.ElementVideo),p()}},r.a.createElement(de.a,null)))),P=r.a.createElement(me.e,Z()({},Pt(u.current.getBoundingClientRect()),{onFinished:p,compact:!0}),r.a.createElement(me.c,{first:!0},e,t,r.a.createElement(me.b,{label:Object(N.a)("Explore rooms"),iconClassName:"mx_RoomListHeader_iconExplore",onClick:e=>{e.preventDefault(),e.stopPropagation(),v.a.dispatch({action:U.a.ViewRoom,room_id:b.roomId,metricsTrigger:void 0}),p(),re.b.trackInteraction("WebRoomListHeaderPlusMenuExploreRoomsItem",e)}}),r.a.createElement(me.b,{label:Object(N.a)("Add existing room"),iconClassName:"mx_RoomListHeader_iconPlus",onClick:e=>{e.preventDefault(),e.stopPropagation(),Object(le.e)(b),p()},disabled:!k,tooltip:k?void 0:Object(N.a)("You do not have permissions to add rooms to this space")}),x&&r.a.createElement(me.b,{label:Object(N.a)("Add space"),iconClassName:"mx_RoomListHeader_iconPlus",onClick:e=>{e.preventDefault(),e.stopPropagation(),Object(le.h)(b),p()},disabled:!I,tooltip:I?void 0:Object(N.a)("You do not have permissions to add spaces to this space")},r.a.createElement(de.a,null))))}else if(m){let e,t;C&&(e=r.a.createElement(r.a.Fragment,null,r.a.createElement(me.b,{label:Object(N.a)("Start new chat"),iconClassName:"mx_RoomListHeader_iconStartChat",onClick:e=>{e.preventDefault(),e.stopPropagation(),v.a.dispatch({action:"view_create_chat"}),re.b.trackInteraction("WebRoomListHeaderPlusMenuCreateChatItem",e),p()}}),r.a.createElement(me.b,{label:Object(N.a)("New room"),iconClassName:"mx_RoomListHeader_iconNewRoom",onClick:e=>{e.preventDefault(),e.stopPropagation(),v.a.dispatch({action:"view_create_room"}),re.b.trackInteraction("WebRoomListHeaderPlusMenuCreateRoomItem",e),p()}}),y&&r.a.createElement(me.b,{label:Object(N.a)("New video room"),iconClassName:"mx_RoomListHeader_iconNewVideoRoom",onClick:e=>{e.preventDefault(),e.stopPropagation(),v.a.dispatch({action:"view_create_room",type:E?ee.j.UnstableCall:ee.j.ElementVideo}),p()}},r.a.createElement(de.a,null)))),O&&(t=r.a.createElement(me.b,{label:Object(N.a)("Join public room"),iconClassName:"mx_RoomListHeader_iconExplore",onClick:e=>{e.preventDefault(),e.stopPropagation(),v.a.dispatch({action:U.a.ViewRoomDirectory}),re.b.trackInteraction("WebRoomListHeaderPlusMenuExploreRoomsItem",e),p()}})),P=r.a.createElement(me.e,Z()({},Pt(u.current.getBoundingClientRect()),{onFinished:p,compact:!0}),r.a.createElement(me.c,{first:!0},e,t))}D=b&&S?S:Object(Y.g)(g,f);const M=[..._.entries()].filter((e=>{let[t,a]=e;return a.size>0})).map((e=>{let[t,a]=e;switch(t){case Dt.JoinRoom:return Object(N.a)("Currently joining %(count)s rooms",{count:a.size});case Dt.BulkRedact:return Object(N.a)("Currently removing messages in %(count)s rooms",{count:a.size})}})).join("\n");let A=r.a.createElement("div",{className:"mx_RoomListHeader_contextLessTitle"},D);return w&&(A=r.a.createElement(ce.c,{inputRef:l,onClick:c,isExpanded:i,className:"mx_RoomListHeader_contextMenuButton",title:b?Object(N.a)("%(spaceName)s menu",{spaceName:null!=S?S:b.name}):Object(N.a)("Home options")},D)),r.a.createElement("div",{className:"mx_RoomListHeader"},A,M?r.a.createElement(pe.a,{label:M},r.a.createElement(he.a,null)):null,T&&r.a.createElement(ce.c,{inputRef:u,onClick:h,isExpanded:m,className:"mx_RoomListHeader_plusButton",title:Object(N.a)("Add")}),P)},At=a(476),Lt=a(657),Ut=a(186),Ft=a.n(Ut);function Bt(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function Vt(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?Bt(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):Bt(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}const Wt="mx_InteractiveTooltip_Container";function Ht(){let e=document.getElementById(Wt);return e||(e=document.createElement("div"),e.id=Wt,document.body.appendChild(e)),e}function zt(e,t,a){const{top:n,right:i,bottom:s,left:r}=a;return e>=r&&e<=i&&t>=n&&t<=s}function Gt(e){const{top:t,right:a,bottom:n,left:i}=e;return(n-t)/(a-i)}function Kt(e,t,a){const{bottom:n,left:i}=a,s=-1*Gt(a);return zt(e,t,a)&&t<=n+s*(e-i)}function qt(e,t,a){const{bottom:n,left:i}=a,s=-1*Gt(a);return zt(e,t,a)&&t>=n+s*(e-i)}function $t(e,t,a){const{top:n,left:i}=a,s=1*Gt(a);return zt(e,t,a)&&t<=n+s*(e-i)}function Yt(e,t,a){const{top:n,left:i}=a,s=1*Gt(a);return zt(e,t,a)&&t>=n+s*(e-i)}let Jt;!function(e){e[e.Top=0]="Top",e[e.Left=1]="Left",e[e.Bottom=2]="Bottom",e[e.Right=3]="Right"}(Jt||(Jt={}));class Qt extends r.a.Component{constructor(e){super(e),i()(this,"target",void 0),i()(this,"collectContentRect",(e=>{e&&this.setState({contentRect:e.getBoundingClientRect()})})),i()(this,"collectTarget",(e=>{this.target=e})),i()(this,"onMouseMove",(e=>{const{clientX:t,clientY:a}=e,{contentRect:n}=this.state,i=this.target.getBoundingClientRect();let s;s=this.isOnTheSide?this.onLeftOfTarget()?Jt.Left:Jt.Right:this.aboveTarget()?Jt.Top:Jt.Bottom,function(e,t,a,n,i){const s=50;if(zt(e,t,n))return!0;switch(a){case Jt.Left:{const a={top:i.top-s,right:i.right,bottom:i.bottom+s,left:i.left-s},r={top:i.top-s,right:n.right,bottom:n.top,left:i.right},o={top:n.top,right:n.left,bottom:n.bottom,left:i.right},l={top:n.bottom,right:n.right,bottom:i.bottom+s,left:i.right};if(zt(e,t,a)||Yt(e,t,r)||zt(e,t,o)||Kt(e,t,l))return!0;break}case Jt.Right:{const a={top:i.top-s,right:i.right+s,bottom:i.bottom+s,left:i.left},r={top:i.top-s,right:i.left,bottom:n.top,left:n.left},o={top:n.top,right:i.left,bottom:n.bottom,left:n.right},l={top:n.bottom,right:i.left,bottom:i.bottom+s,left:n.left};if(zt(e,t,a)||qt(e,t,r)||zt(e,t,o)||$t(e,t,l))return!0;break}case Jt.Top:{const a={top:i.top-s,right:i.right+s,bottom:i.bottom,left:i.left-s},r={top:i.bottom,right:n.left,bottom:n.bottom,left:i.left-s},o={top:i.bottom,right:n.right,bottom:n.top,left:n.left},l={top:i.bottom,right:i.right+s,bottom:n.bottom,left:n.right};if(zt(e,t,a)||$t(e,t,r)||zt(e,t,o)||Kt(e,t,l))return!0;break}case Jt.Bottom:{const a={top:i.top,right:i.right+s,bottom:i.bottom+s,left:i.left-s},r={top:n.top,right:n.left,bottom:i.top,left:i.left-s},o={top:n.bottom,right:n.right,bottom:i.top,left:n.left},l={top:n.top,right:i.right+s,bottom:i.top,left:n.right};if(zt(e,t,a)||qt(e,t,r)||zt(e,t,o)||Yt(e,t,l))return!0;break}}return!1}(t,a,s,i,n)||this.hideTooltip()})),i()(this,"onTargetMouseOver",(()=>{this.showTooltip()})),this.state={contentRect:null,visible:!1}}componentDidUpdate(){this.renderTooltip()}componentWillUnmount(){document.removeEventListener("mousemove",this.onMouseMove)}onLeftOfTarget(){const{contentRect:e}=this.state,t=this.target.getBoundingClientRect();if(this.props.direction===Jt.Left){const a=t.left+window.scrollX;return!e||a-e.width>20}{const a=t.right+window.scrollX,n=Q.b.instance.windowWidth-a;return e&&n-e.width<20}}aboveTarget(){const{contentRect:e}=this.state,t=this.target.getBoundingClientRect();if(this.props.direction===Jt.Top){const a=t.top+window.scrollY;return!e||a-e.height>20}{const a=t.bottom+window.scrollY,n=Q.b.instance.windowHeight-a;return e&&n-e.height<20}}get isOnTheSide(){return this.props.direction===Jt.Left||this.props.direction===Jt.Right}showTooltip(){var e,t;this.target&&(this.setState({visible:!0}),null===(e=(t=this.props).onVisibilityChange)||void 0===e||e.call(t,!0),document.addEventListener("mousemove",this.onMouseMove))}hideTooltip(){var e,t;this.setState({visible:!1}),null===(e=(t=this.props).onVisibilityChange)||void 0===e||e.call(t,!1),document.removeEventListener("mousemove",this.onMouseMove)}renderTooltip(){const{contentRect:e,visible:t}=this.state;if(!t)return Ft.a.unmountComponentAtNode(Ht()),null;const a=this.target.getBoundingClientRect(),n=a.left+window.scrollX,i=a.right+window.scrollX,s=a.bottom+window.scrollY,o=a.top+window.scrollY,l={};let d=null;this.isOnTheSide?(this.onLeftOfTarget()?(l.left=n,d=ce.a.Right):(l.left=i,d=ce.a.Left),l.top=o):(this.aboveTarget()?(l.bottom=Q.b.instance.windowHeight-o,d=ce.a.Bottom):(l.top=s,d=ce.a.Top),l.left=n+a.width/2);const m=r.a.createElement("div",{className:"mx_InteractiveTooltip_chevron_"+d}),u=c()({mx_InteractiveTooltip:!0,mx_InteractiveTooltip_withChevron_top:d===ce.a.Top,mx_InteractiveTooltip_withChevron_left:d===ce.a.Left,mx_InteractiveTooltip_withChevron_right:d===ce.a.Right,mx_InteractiveTooltip_withChevron_bottom:d===ce.a.Bottom}),h={};e&&!this.isOnTheSide&&(h.left=`-${e.width/2}px`);const p=r.a.createElement("div",{className:"mx_InteractiveTooltip_wrapper",style:Vt({},l)},r.a.createElement("div",{className:u,style:h,ref:this.collectContentRect},m,this.props.content));Ft.a.render(p,Ht())}render(){return this.props.children({ref:this.collectTarget,onMouseOver:this.onTargetMouseOver})}}i()(Qt,"defaultProps",{side:Jt.Top});var Xt=a(317);var Zt=()=>{const e=Object(s.useRef)(),t=Object(ie.b)(At.a.instance,pt.b,(()=>At.a.instance.rooms)),a=r.a.createElement("div",{className:"mx_RecentlyViewedButton_ContextMenu"},r.a.createElement("h4",null,Object(N.a)("Recently viewed")),r.a.createElement("div",null,t.map((t=>r.a.createElement(ce.d,{key:t.roomId,onClick:a=>{var n;v.a.dispatch({action:U.a.ViewRoom,room_id:t.roomId,metricsTrigger:"WebVerticalBreadcrumbs",metricsViaKeyboard:"click"!==a.type}),null===(n=e.current)||void 0===n||n.hideTooltip()}},t.isSpaceRoom()?r.a.createElement(ye.a,{room:t,width:24,height:24}):r.a.createElement(Xt.a,{room:t,avatarSize:24,tooltipProps:{tabIndex:-1}}),r.a.createElement("span",{className:"mx_RecentlyViewedButton_entry_label"},r.a.createElement("div",null,t.name),r.a.createElement(Lt.a,{className:"mx_RecentlyViewedButton_entry_spaces",room:t})))))));return r.a.createElement(Qt,{content:a,direction:Jt.Right,ref:e},(e=>{let{ref:t,onMouseOver:a}=e;return r.a.createElement("span",{className:"mx_LeftPanel_recentsButton",title:Object(N.a)("Recently viewed"),ref:t,onMouseOver:a})}))},ea=a(226),ta=a(827),aa=a(475);const na=e=>{let{room:t,onClick:a}=e;const[n,i,s]=Object(xe.i)();return r.a.createElement(q.a,{className:"mx_RoomBreadcrumbs_crumb",onClick:a,"aria-label":Object(N.a)("Room %(name)s",{name:t.name}),title:t.name,tooltipClassName:"mx_RoomBreadcrumbs_Tooltip",onFocus:n,inputRef:s,tabIndex:i?0:-1},r.a.createElement(Xt.a,{room:t,avatarSize:32,displayBadge:!0,forceCount:!0,tooltipProps:{tabIndex:i?0:-1}}))};class ia extends r.a.PureComponent{constructor(e){super(e),i()(this,"isMounted",!0),i()(this,"onBreadcrumbsUpdate",(()=>{this.isMounted&&(this.setState({doAnimation:!1,skipFirst:!0}),window.setTimeout((()=>this.setState({doAnimation:!0,skipFirst:!1})),0))})),i()(this,"viewRoom",(function(e,t){let a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];v.a.dispatch({action:U.a.ViewRoom,room_id:e.roomId,metricsTrigger:"WebHorizontalBreadcrumbs",metricsViaKeyboard:a})})),this.state={doAnimation:!0,skipFirst:!1},At.a.instance.on(pt.b,this.onBreadcrumbsUpdate)}componentWillUnmount(){this.isMounted=!1,At.a.instance.off(pt.b,this.onBreadcrumbsUpdate)}render(){const e=At.a.instance.rooms.map(((e,t)=>r.a.createElement(na,{key:e.roomId,room:e,onClick:a=>this.viewRoom(e,t,"click"!==a.type)})));return e.length>0?r.a.createElement(ta.CSSTransition,{appear:!0,in:this.state.doAnimation,timeout:640,classNames:"mx_RoomBreadcrumbs"},r.a.createElement(aa.a,{className:"mx_RoomBreadcrumbs","aria-label":Object(N.a)("Recently visited rooms")},e.slice(this.state.skipFirst?1:0))):r.a.createElement("div",{className:"mx_RoomBreadcrumbs"},r.a.createElement("div",{className:"mx_RoomBreadcrumbs_placeholder"},Object(N.a)("No recently visited rooms")))}}var sa,ra=a(175),oa=a(489);function la(e){let{selected:t,minimized:a}=e;const n=Object(se.b)("FTUE.useCaseSelection");return Object(se.b)("FTUE.userOnboardingButton")&&!a&&Object(oa.b)(n)?r.a.createElement(ca,{selected:t,minimized:a}):r.a.createElement(r.a.Fragment,null)}function ca(e){let{selected:t,minimized:a}=e;const n=Object(s.useCallback)((e=>{e.preventDefault(),e.stopPropagation(),re.b.trackInteraction("WebRoomListUserOnboardingIgnoreButton",e),b.b.setValue("FTUE.userOnboardingButton",null,f.a.ACCOUNT,!1)}),[]),i=Object(s.useCallback)((e=>{e.preventDefault(),e.stopPropagation(),re.b.trackInteraction("WebRoomListUserOnboardingButton",e),v.a.fire(U.a.ViewHomePage)}),[]);return r.a.createElement(G.a,{className:c()("mx_UserOnboardingButton",{mx_UserOnboardingButton_selected:t,mx_UserOnboardingButton_minimized:a}),onClick:i},!a&&r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:"mx_UserOnboardingButton_content"},r.a.createElement(ra.a,{size:"h4",className:"mx_Heading_h4"},Object(N.a)("Welcome")),r.a.createElement(G.a,{className:"mx_UserOnboardingButton_close",onClick:n}))))}!function(e){e[e.Disabled=0]="Disabled",e[e.Legacy=1]="Legacy",e[e.Labs=2]="Labs"}(sa||(sa={}));class da extends s.Component{constructor(e){super(e),i()(this,"listContainerRef",Object(s.createRef)()),i()(this,"roomListRef",Object(s.createRef)()),i()(this,"focusedElement",null),i()(this,"isDoingStickyHeaders",!1),i()(this,"updateActiveSpace",(e=>{this.setState({activeSpace:e})})),i()(this,"onDialPad",(()=>{v.a.fire(U.a.OpenDialPad)})),i()(this,"onExplore",(e=>{v.a.fire(U.a.ViewRoomDirectory),re.b.trackInteraction("WebLeftPanelExploreRoomsButton",e)})),i()(this,"refreshStickyHeaders",(()=>{this.listContainerRef.current&&this.handleStickyHeaders(this.listContainerRef.current)})),i()(this,"onBreadcrumbsUpdate",(()=>{const e=da.breadcrumbsMode;if(e!==this.state.showBreadcrumbs){if(this.setState({showBreadcrumbs:e}),!this.listContainerRef.current)return;this.handleStickyHeaders(this.listContainerRef.current)}})),i()(this,"onScroll",(e=>{const t=e.target;this.handleStickyHeaders(t)})),i()(this,"onFocus",(e=>{this.focusedElement=e.target})),i()(this,"onBlur",(()=>{this.focusedElement=null})),i()(this,"onKeyDown",((e,t)=>{if(!this.focusedElement)return;var a;Object(J.a)().getRoomListAction(e)===W.h.NextRoom&&(t||(e.stopPropagation(),e.preventDefault(),null===(a=this.roomListRef.current)||void 0===a||a.focus()))})),this.state={activeSpace:$.a.instance.activeSpace,showBreadcrumbs:da.breadcrumbsMode},At.a.instance.on(pt.b,this.onBreadcrumbsUpdate),ea.c.instance.on(ea.b,this.onBreadcrumbsUpdate),$.a.instance.on(Y.d,this.updateActiveSpace)}static get breadcrumbsMode(){return At.a.instance.visible?b.b.getValue("feature_breadcrumbs_v2")?sa.Labs:sa.Legacy:sa.Disabled}componentDidMount(){var e;Q.b.instance.trackElementDimensions("ListContainer",this.listContainerRef.current),Q.b.instance.on("ListContainer",this.refreshStickyHeaders),null===(e=this.listContainerRef.current)||void 0===e||e.addEventListener("scroll",this.onScroll,{passive:!0})}componentWillUnmount(){var e;At.a.instance.off(pt.b,this.onBreadcrumbsUpdate),ea.c.instance.off(ea.b,this.onBreadcrumbsUpdate),$.a.instance.off(Y.d,this.updateActiveSpace),Q.b.instance.stopTrackingElementDimensions("ListContainer"),Q.b.instance.removeListener("ListContainer",this.refreshStickyHeaders),null===(e=this.listContainerRef.current)||void 0===e||e.removeEventListener("scroll",this.onScroll)}componentDidUpdate(e,t){t.activeSpace!==this.state.activeSpace&&this.refreshStickyHeaders()}handleStickyHeaders(e){this.isDoingStickyHeaders||(this.isDoingStickyHeaders=!0,window.requestAnimationFrame((()=>{this.doStickyHeaders(e),this.isDoingStickyHeaders=!1})))}doStickyHeaders(e){const t=e.scrollTop,a=e.offsetHeight+e.scrollTop,n=e.querySelectorAll(".mx_RoomSublist:not(.mx_RoomSublist_hidden)"),i=new Map;let s,r;for(const e of n){const o=e.querySelector(".mx_RoomSublist_stickable");if(!o)continue;o.style.removeProperty("display");const l=.4,c=e.offsetTop+l*V.a<=t,d=e.offsetTop+l*V.a>=a;c||e===n[0]?(i.set(o,{stickyTop:!0}),s&&(s.style.display="none",i.set(s,{makeInvisible:!0})),s=o):d&&!r?(i.set(o,{stickyBottom:!0}),r=o):i.set(o,{})}for(const t of i.keys()){const a=i.get(t);if(a.makeInvisible)t.style.display="none";else{if(a.stickyTop){t.classList.contains("mx_RoomSublist_headerContainer_stickyTop")||t.classList.add("mx_RoomSublist_headerContainer_stickyTop");const a=`${e.parentElement.offsetTop}px`;t.style.top!==a&&(t.style.top=a)}else t.classList.contains("mx_RoomSublist_headerContainer_stickyTop")&&t.classList.remove("mx_RoomSublist_headerContainer_stickyTop"),t.style.top&&t.style.removeProperty("top");if(a.stickyBottom){t.classList.contains("mx_RoomSublist_headerContainer_stickyBottom")||t.classList.add("mx_RoomSublist_headerContainer_stickyBottom");const a=`${Q.b.instance.windowHeight-(e.parentElement.offsetTop+e.parentElement.offsetHeight)}px`;t.style.bottom!==a&&(t.style.bottom=a)}else t.classList.contains("mx_RoomSublist_headerContainer_stickyBottom")&&t.classList.remove("mx_RoomSublist_headerContainer_stickyBottom"),t.style.bottom&&t.style.removeProperty("bottom");if(a.stickyTop||a.stickyBottom){t.classList.contains("mx_RoomSublist_headerContainer_sticky")||t.classList.add("mx_RoomSublist_headerContainer_sticky");const e=Q.b.instance.getElementDimensions("ListContainer");if(e){const a=15,n=`${e.width-a}px`;t.style.width!==n&&(t.style.width=n)}}else a.stickyTop||a.stickyBottom||(t.classList.contains("mx_RoomSublist_headerContainer_sticky")&&t.classList.remove("mx_RoomSublist_headerContainer_sticky"),t.style.width&&t.style.removeProperty("width"))}}const o=e.parentElement;s?o.classList.add("mx_LeftPanel_roomListWrapper_stickyTop"):o.classList.remove("mx_LeftPanel_roomListWrapper_stickyTop"),r?o.classList.add("mx_LeftPanel_roomListWrapper_stickyBottom"):o.classList.remove("mx_LeftPanel_roomListWrapper_stickyBottom")}renderBreadcrumbs(){if(this.state.showBreadcrumbs===sa.Legacy&&!this.props.isMinimized)return s.createElement(wt,{className:"mx_LeftPanel_breadcrumbsContainer mx_AutoHideScrollbar",verticalScrollsHorizontally:!0},s.createElement(ia,null))}renderSearchDialExplore(){let e,t;return B.b.instance.getSupportsPstnProtocol()&&(e=s.createElement(q.a,{className:c()("mx_LeftPanel_dialPadButton",{}),onClick:this.onDialPad,title:Object(N.a)("Open dial pad")})),this.state.showBreadcrumbs===sa.Labs?t=s.createElement(Zt,null):this.state.activeSpace===Y.a.Home&&Object(ae.a)(oe.a.ExploreRooms)&&(t=s.createElement(q.a,{className:"mx_LeftPanel_exploreButton",onClick:this.onExplore,title:Object(N.a)("Explore rooms")})),s.createElement("div",{className:"mx_LeftPanel_filterContainer",onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown},s.createElement(K,{isMinimized:this.props.isMinimized}),e,t)}render(){const e=s.createElement(F.b,{onKeyDown:this.onKeyDown,resizeNotifier:this.props.resizeNotifier,onFocus:this.onFocus,onBlur:this.onBlur,isMinimized:this.props.isMinimized,activeSpace:this.state.activeSpace,onResize:this.refreshStickyHeaders,onListCollapse:this.refreshStickyHeaders,ref:this.roomListRef}),t=c()({mx_LeftPanel:!0,mx_LeftPanel_minimized:this.props.isMinimized}),a=c()("mx_LeftPanel_actualRoomListContainer","mx_AutoHideScrollbar");return s.createElement("div",{className:t},s.createElement("div",{className:"mx_LeftPanel_roomListContainer"},this.renderSearchDialExplore(),this.renderBreadcrumbs(),!this.props.isMinimized&&s.createElement(Mt,{onVisibilityChange:this.refreshStickyHeaders}),s.createElement(la,{selected:this.props.pageType===h.a.HomePage,minimized:this.props.isMinimized}),s.createElement("div",{className:"mx_LeftPanel_roomListWrapper"},s.createElement("div",{className:a,ref:this.listContainerRef,tabIndex:-1},e))))}}var ma=a(809);class ua extends s.PureComponent{constructor(e){super(e),i()(this,"onUpdateToasts",(()=>{this.setState({toasts:ma.a.instance.components})})),this.state={toasts:ma.a.instance.components},ma.a.instance.on(pt.b,this.onUpdateToasts)}componentWillUnmount(){ma.a.instance.off(pt.b,this.onUpdateToasts)}render(){const e=this.state.toasts.map(((e,t)=>s.createElement("div",{className:"mx_NonUrgentToastContainer_toast",key:`toast-${t}`},s.createElement(e,{}))));return s.createElement("div",{className:"mx_NonUrgentToastContainer",role:"alert"},e)}}var ha=a(188),pa=a(497),ga=a(1);class va extends r.a.Component{constructor(e){super(e),i()(this,"element",Object(s.createRef)()),i()(this,"onAudioOutputChanged",(e=>{const t=this.element.current;if(e)try{t.setSinkId(e)}catch(e){ga.a.error("Couldn't set requested audio output device: using default",e),ga.a.warn("Couldn't set requested audio output device: using default",e)}})),i()(this,"onNewStream",(()=>{this.setState({audioMuted:this.props.feed.isAudioMuted()}),this.playMedia()})),this.state={audioMuted:this.props.feed.isAudioMuted()}}componentDidMount(){p.c.instance.addListener(p.a.AudioOutputChanged,this.onAudioOutputChanged),this.props.feed.addListener(pa.b.NewStream,this.onNewStream),this.playMedia()}componentWillUnmount(){p.c.instance.removeListener(p.a.AudioOutputChanged,this.onAudioOutputChanged),this.props.feed.removeListener(pa.b.NewStream,this.onNewStream),this.stopMedia()}async playMedia(){const e=this.element.current;if(e){this.onAudioOutputChanged(p.c.getAudioOutput()),e.muted=!1,e.srcObject=this.props.feed.stream,e.autoplay=!0;try{await e.load()}catch(e){ga.a.info(`Failed to play media element with feed for userId ${this.props.feed.userId} with purpose ${this.props.feed.purpose}`,e)}}}stopMedia(){const e=this.element.current;e&&(e.pause(),e.src=null)}render(){return this.state.audioMuted?null:r.a.createElement("audio",{ref:this.element})}}class ba extends r.a.Component{constructor(e){super(e),i()(this,"onFeedsChanged",(()=>{this.setState({feeds:this.props.call.getRemoteFeeds()})})),this.state={feeds:this.props.call.getRemoteFeeds()}}componentDidMount(){this.props.call.addListener(ha.d.FeedsChanged,this.onFeedsChanged)}componentWillUnmount(){this.props.call.removeListener(ha.d.FeedsChanged,this.onFeedsChanged)}render(){return this.state.feeds.map(((e,t)=>r.a.createElement(va,{feed:e,key:t})))}}var fa=a(143),ya=a(174),Ea=a(170),_a=a(160),wa=a(370),Sa=a(168),Oa=a(284),Ca=a(285),xa=a(463);class ja extends r.a.Component{constructor(){super(...arguments),i()(this,"onResizeStart",(()=>{this.props.resizeNotifier.startResizing()})),i()(this,"onResize",(()=>{this.props.resizeNotifier.notifyRightHandleResized()})),i()(this,"onResizeStop",((e,t,a,n)=>{this.props.resizeNotifier.stopResizing(),window.localStorage.setItem("mx_rhs_size",(this.loadSidePanelSize().width+n.width).toString())}))}loadSidePanelSize(){let e=parseInt(window.localStorage.getItem("mx_rhs_size"),10);return isNaN(e)&&(e=350),{height:"100%",width:e}}render(){const e=r.a.Children.only(this.props.children),t=this.props.panel;let a;return!this.props.collapsedRhs&&t&&(a=r.a.createElement(xa.Resizable,{defaultSize:this.loadSidePanelSize(),minWidth:264,maxWidth:"50%",enable:{top:!1,right:!1,bottom:!1,left:!0,topRight:!1,bottomRight:!1,bottomLeft:!1,topLeft:!1},onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,className:"mx_RightPanel_ResizeWrapper",handleClasses:{left:"mx_ResizeHandle_horizontal"}},t)),r.a.createElement("div",{className:"mx_MainSplit"},e,a)}}var ka=a(184),Ra=a(182),Ia=a(173);function Ta(e,t){const[a,n]=Object(s.useState)(t?e.isRoomEncrypted(t.roomId):void 0),i=Object(s.useCallback)((a=>{t&&a.getType()===ee.b.RoomEncryption&&n(e.isRoomEncrypted(t.roomId))}),[e,t]);return Object(ie.c)(null==t?void 0:t.currentState,m.b.Events,i),a}var Na=a(375);const Pa=e=>{let{className:t,title:a,children:n}=e;return r.a.createElement("div",{className:c()("mx_BaseCard_Group",t)},r.a.createElement("h1",null,a),n)};var Da=Object(s.forwardRef)(((e,t)=>{let a,{closeLabel:n,onClose:i,onBack:s,className:o,header:l,footer:d,withoutScrollContainer:m,children:u,onKeyDown:h}=e;const p=Ia.a.instance.roomPhaseHistory;if(p.length>1){var g;const e=p[p.length-2],t=e=>{null==s||s(e),Ia.a.instance.popCard()},n=null!==(g=Object(Ra.b)(e.phase))&&void 0!==g?g:Object(N.a)("Back");a=r.a.createElement(G.a,{className:"mx_BaseCard_back",onClick:t,title:n})}let v;return i&&(v=r.a.createElement(G.a,{"data-testid":"base-card-close-button",className:"mx_BaseCard_close",onClick:i,title:n||Object(N.a)("Close")})),m||(u=r.a.createElement(Et.a,null,u)),r.a.createElement(Na.a.Provider,{value:{isCard:!0}},r.a.createElement("div",{className:c()("mx_BaseCard",o),ref:t,onKeyDown:h},r.a.createElement("div",{className:"mx_BaseCard_header"},a,v,l),u,d&&r.a.createElement("div",{className:"mx_BaseCard_footer"},d)))})),Ma=a(561),Aa=a(181),La=a(283),Ua=a(243),Fa=a(166);const Ba=["app","className","width","height"];var Va=e=>{let{app:t,className:n,width:i=20,height:s=20}=e,o=ve()(e,Ba),l=[a(1494).default];return t.type.includes("jitsi")?l=[a(1495).default]:t.type.includes("meeting")||t.type.includes("calendar")?l=[a(1496).default]:t.type.includes("pad")||t.type.includes("doc")||t.type.includes("calc")?l=[a(1497).default]:t.type.includes("clock")&&(l=[a(1498).default]),r.a.createElement(gt.a,Z()({},o,{name:t.id,className:c()("mx_WidgetAvatar",n),url:t.avatar_url?Object(Fa.b)(t.avatar_url).getSquareThumbnailHttp(20):null,urls:l,width:i,height:s}))},Wa=a(234),Ha=a(164);let za;!function(e){e.Warning="warning",e.Verified="verified",e.Normal="normal"}(za||(za={}));var Ga=a(138),Ka=a(6),qa=a(634),$a=a(265),Ya=a(155),Ja=a(144),Qa=a(201),Xa=a(207),Za=a(2);function en(){return mt.b.get("audio_stream_url")}const tn="rtmp://audiostream.dummy/";async function an(e,t){const a=await async function(e){const t=await lt.a.get().getOpenIdToken(),a=en()+"/createStream",n=await window.fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({room_id:e,openid_token:t})});return(await n.json()).stream_id}(t);await e.transport.send(Za.a.StartLiveStream,{rtmpStreamKey:tn+a})}var nn=a(347),sn=a(17),rn=a(146);var on=a(235),ln=a(587),cn=a(135),dn=a(145);class mn extends r.a.PureComponent{constructor(e){super(e),i()(this,"onAllow",(()=>{this.onPermissionSelection(!0)})),i()(this,"onDeny",(()=>{this.onPermissionSelection(!1)})),i()(this,"onRememberSelectionChange",(e=>{this.setState({rememberSelection:e})})),this.state={rememberSelection:!1}}onPermissionSelection(e){this.state.rememberSelection&&(ga.a.log(`Remembering ${this.props.widget.id} as allowed=${e} for OpenID`),rt.b.instance.widgetPermissionStore.setOIDCState(this.props.widget,this.props.widgetKind,this.props.inRoomId,e?ln.a.Allowed:ln.a.Denied)),this.props.onFinished(e)}render(){return r.a.createElement(cn.a,{className:"mx_WidgetOpenIDPermissionsDialog",hasCancel:!0,onFinished:this.props.onFinished,title:Object(N.a)("Allow this widget to verify your identity")},r.a.createElement("div",{className:"mx_WidgetOpenIDPermissionsDialog_content"},r.a.createElement("p",null,Object(N.a)("The widget will verify your user ID, but won't be able to perform actions for you:")),r.a.createElement("p",{className:"text-muted"},this.props.widget.templateUrl.split("?")[0].split("#")[0])),r.a.createElement(dn.a,{primaryButton:Object(N.a)("Continue"),onPrimaryButtonClick:this.onAllow,onCancel:this.onDeny,additive:r.a.createElement(on.a,{value:this.state.rememberSelection,toggleInFront:!0,onChange:this.onRememberSelectionChange,label:Object(N.a)("Remember this")})}))}}var un=a(16),hn=a(185),pn=a(32);const gn="generic";class vn{static bylineFor(e){return e.kind===Ka.EventKind.State?e.keyStr?Object(N.a)("with state key %(stateKey)s",{stateKey:e.keyStr}):Object(N.a)("with an empty state key"):null}static for(e,t){if(vn.simpleCaps[e]){const a=vn.simpleCaps[e];if(a[t])return{primary:Object(N.a)(a[t])};if(a[gn])return{primary:Object(N.a)(a[gn])}}if(Object(Ka.isTimelineCapability)(e)){if(Object(Ka.isTimelineCapabilityFor)(e,Ka.Symbols.AnyRoom))return{primary:Object(N.a)("The above, but in any room you are joined or invited to as well")};{const t=Object(Ka.getTimelineRoomIDFromCapability)(e),a=lt.a.get().getRoom(t);return{primary:Object(N.a)("The above, but in <Room /> as well",{},{Room:()=>{var e;return a?r.a.createElement(Ua.a,{tooltip:null!==(e=a.getCanonicalAlias())&&void 0!==e?e:t},r.a.createElement("b",null,a.name)):r.a.createElement("b",null,r.a.createElement("code",null,t))}})}}}const[a]=Ka.WidgetEventCapability.findEventCapabilities([e]);if(a){if(a.kind===Ka.EventKind.Event&&a.eventType===ee.b.RoomMessage)return vn.forRoomMessageCap(a,t);const e=a.kind===Ka.EventKind.State?vn.stateSendRecvCaps:vn.nonStateSendRecvCaps;if(e[a.eventType]){const n=e[a.eventType],i=(null==n?void 0:n[t])||(null==n?void 0:n[gn]);if(null!=i&&i[a.direction])return{primary:Object(N.a)(i[a.direction])}}return t===Ka.WidgetKind.Room?a.direction===Ka.EventDirection.Send?{primary:Object(N.a)("Send <b>%(eventType)s</b> events as you in this room",{eventType:a.eventType},{b:e=>r.a.createElement("b",null,e)}),byline:vn.bylineFor(a)}:{primary:Object(N.a)("See <b>%(eventType)s</b> events posted to this room",{eventType:a.eventType},{b:e=>r.a.createElement("b",null,e)}),byline:vn.bylineFor(a)}:a.direction===Ka.EventDirection.Send?{primary:Object(N.a)("Send <b>%(eventType)s</b> events as you in your active room",{eventType:a.eventType},{b:e=>r.a.createElement("b",null,e)}),byline:vn.bylineFor(a)}:{primary:Object(N.a)("See <b>%(eventType)s</b> events posted to your active room",{eventType:a.eventType},{b:e=>r.a.createElement("b",null,e)}),byline:vn.bylineFor(a)}}return{primary:Object(N.a)("The <b>%(capability)s</b> capability",{capability:e},{b:e=>r.a.createElement("b",null,e)})}}static forRoomMessageCap(e,t){if(!e.keyStr)return e.direction===Ka.EventDirection.Send?{primary:t===Ka.WidgetKind.Room?Object(N.a)("Send messages as you in this room"):Object(N.a)("Send messages as you in your active room")}:{primary:t===Ka.WidgetKind.Room?Object(N.a)("See messages posted to this room"):Object(N.a)("See messages posted to your active room")};switch(e.keyStr){case ee.e.Text:return e.direction===Ka.EventDirection.Send?{primary:t===Ka.WidgetKind.Room?Object(N.a)("Send text messages as you in this room"):Object(N.a)("Send text messages as you in your active room")}:{primary:t===Ka.WidgetKind.Room?Object(N.a)("See text messages posted to this room"):Object(N.a)("See text messages posted to your active room")};case ee.e.Emote:return e.direction===Ka.EventDirection.Send?{primary:t===Ka.WidgetKind.Room?Object(N.a)("Send emotes as you in this room"):Object(N.a)("Send emotes as you in your active room")}:{primary:t===Ka.WidgetKind.Room?Object(N.a)("See emotes posted to this room"):Object(N.a)("See emotes posted to your active room")};case ee.e.Image:return e.direction===Ka.EventDirection.Send?{primary:t===Ka.WidgetKind.Room?Object(N.a)("Send images as you in this room"):Object(N.a)("Send images as you in your active room")}:{primary:t===Ka.WidgetKind.Room?Object(N.a)("See images posted to this room"):Object(N.a)("See images posted to your active room")};case ee.e.Video:return e.direction===Ka.EventDirection.Send?{primary:t===Ka.WidgetKind.Room?Object(N.a)("Send videos as you in this room"):Object(N.a)("Send videos as you in your active room")}:{primary:t===Ka.WidgetKind.Room?Object(N.a)("See videos posted to this room"):Object(N.a)("See videos posted to your active room")};case ee.e.File:return e.direction===Ka.EventDirection.Send?{primary:t===Ka.WidgetKind.Room?Object(N.a)("Send general files as you in this room"):Object(N.a)("Send general files as you in your active room")}:{primary:t===Ka.WidgetKind.Room?Object(N.a)("See general files posted to this room"):Object(N.a)("See general files posted to your active room")};default:{let a;return a=e.direction===Ka.EventDirection.Send?t===Ka.WidgetKind.Room?Object(N.a)("Send <b>%(msgtype)s</b> messages as you in this room",{msgtype:e.keyStr},{b:e=>r.a.createElement("b",null,e)}):Object(N.a)("Send <b>%(msgtype)s</b> messages as you in your active room",{msgtype:e.keyStr},{b:e=>r.a.createElement("b",null,e)}):t===Ka.WidgetKind.Room?Object(N.a)("See <b>%(msgtype)s</b> messages posted to this room",{msgtype:e.keyStr},{b:e=>r.a.createElement("b",null,e)}):Object(N.a)("See <b>%(msgtype)s</b> messages posted to your active room",{msgtype:e.keyStr},{b:e=>r.a.createElement("b",null,e)}),{primary:a}}}}}i()(vn,"simpleCaps",{[Ka.MatrixCapabilities.AlwaysOnScreen]:{[Ka.WidgetKind.Room]:Object(N.c)("Remain on your screen when viewing another room, when running"),[gn]:Object(N.c)("Remain on your screen while running")},[Ka.MatrixCapabilities.StickerSending]:{[Ka.WidgetKind.Room]:Object(N.c)("Send stickers into this room"),[gn]:Object(N.c)("Send stickers into your active room")},[pn.a.CanChangeViewedRoom]:{[gn]:Object(N.c)("Change which room you're viewing")},[Ka.MatrixCapabilities.MSC2931Navigate]:{[gn]:Object(N.c)("Change which room, message, or user you're viewing")}}),i()(vn,"stateSendRecvCaps",{[ee.b.RoomTopic]:{[Ka.WidgetKind.Room]:{[Ka.EventDirection.Send]:Object(N.c)("Change the topic of this room"),[Ka.EventDirection.Receive]:Object(N.c)("See when the topic changes in this room")},[gn]:{[Ka.EventDirection.Send]:Object(N.c)("Change the topic of your active room"),[Ka.EventDirection.Receive]:Object(N.c)("See when the topic changes in your active room")}},[ee.b.RoomName]:{[Ka.WidgetKind.Room]:{[Ka.EventDirection.Send]:Object(N.c)("Change the name of this room"),[Ka.EventDirection.Receive]:Object(N.c)("See when the name changes in this room")},[gn]:{[Ka.EventDirection.Send]:Object(N.c)("Change the name of your active room"),[Ka.EventDirection.Receive]:Object(N.c)("See when the name changes in your active room")}},[ee.b.RoomAvatar]:{[Ka.WidgetKind.Room]:{[Ka.EventDirection.Send]:Object(N.c)("Change the avatar of this room"),[Ka.EventDirection.Receive]:Object(N.c)("See when the avatar changes in this room")},[gn]:{[Ka.EventDirection.Send]:Object(N.c)("Change the avatar of your active room"),[Ka.EventDirection.Receive]:Object(N.c)("See when the avatar changes in your active room")}},[ee.b.RoomMember]:{[Ka.WidgetKind.Room]:{[Ka.EventDirection.Send]:Object(N.c)("Remove, ban, or invite people to this room, and make you leave"),[Ka.EventDirection.Receive]:Object(N.c)("See when people join, leave, or are invited to this room")},[gn]:{[Ka.EventDirection.Send]:Object(N.c)("Remove, ban, or invite people to your active room, and make you leave"),[Ka.EventDirection.Receive]:Object(N.c)("See when people join, leave, or are invited to your active room")}}}),i()(vn,"nonStateSendRecvCaps",{[ee.b.Sticker]:{[Ka.WidgetKind.Room]:{[Ka.EventDirection.Send]:Object(N.c)("Send stickers to this room as you"),[Ka.EventDirection.Receive]:Object(N.c)("See when a sticker is posted in this room")},[gn]:{[Ka.EventDirection.Send]:Object(N.c)("Send stickers to your active room as you"),[Ka.EventDirection.Receive]:Object(N.c)("See when anyone posts a sticker to your active room")}}});class bn extends r.a.PureComponent{constructor(e){super(e),i()(this,"eventPermissionsMap",new Map),i()(this,"onToggle",(e=>{const t=Object(hn.e)(this.state.booleanStates);t[e]=!t[e],this.setState({booleanStates:t})})),i()(this,"onRememberSelectionChange",(e=>{this.setState({rememberSelection:e})})),i()(this,"onSubmit",(async()=>{this.closeAndTryRemember(Object.entries(this.state.booleanStates).filter((e=>{let[t,a]=e;return a})).map((e=>{let[t]=e;return t})))})),i()(this,"onReject",(async()=>{this.closeAndTryRemember([])}));Ka.WidgetEventCapability.findEventCapabilities(this.props.requestedCapabilities).forEach((e=>this.eventPermissionsMap.set(e.raw,e)));const t={};this.props.requestedCapabilities.forEach((e=>t[e]=!0)),this.state={booleanStates:t,rememberSelection:!0}}closeAndTryRemember(e){this.props.onFinished({approved:e,remember:this.state.rememberSelection})}render(){const e=Object.entries(this.state.booleanStates).sort(((e,t)=>{let[a]=e,[n]=t;const i=Object(Ka.isTimelineCapability)(a),s=Object(Ka.isTimelineCapability)(n);return i||s?i&&!s?1:!i&&s?-1:i&&s?Object(un.x)(a,n):0:Object(un.x)(a,n)})).map(((e,t)=>{let[a,n]=e;const i=vn.for(a,this.props.widgetKind),s=i.byline?r.a.createElement("span",{className:"mx_WidgetCapabilitiesPromptDialog_byline"},i.byline):null;return r.a.createElement("div",{className:"mx_WidgetCapabilitiesPromptDialog_cap",key:a+t},r.a.createElement(De.b,{checked:n,onChange:()=>this.onToggle(a)},i.primary),s)}));return r.a.createElement(cn.a,{className:"mx_WidgetCapabilitiesPromptDialog",onFinished:this.props.onFinished,title:Object(N.a)("Approve widget permissions")},r.a.createElement("form",{onSubmit:this.onSubmit},r.a.createElement("div",{className:"mx_Dialog_content"},r.a.createElement("div",{className:"text-muted"},Object(N.a)("This widget would like to:")),e,r.a.createElement(dn.a,{primaryButton:Object(N.a)("Approve"),cancelButton:Object(N.a)("Decline All"),onPrimaryButtonClick:this.onSubmit,onCancel:this.onReject,additive:r.a.createElement(on.a,{value:this.state.rememberSelection,toggleInFront:!0,onChange:this.onRememberSelectionChange,label:Object(N.a)("Remember my selection for this widget")})}))))}}const fn={};var yn=a(247),En=a(308),_n=a(852);const wn=e=>{let{urls:t,username:a,credential:n}=e;return{uris:t,username:a,password:n}};class Sn extends Ka.WidgetDriver{constructor(e,t,a,n,s){var r;if(super(),this.forWidget=t,this.forWidgetKind=a,this.inRoomId=s,i()(this,"allowedCapabilities",void 0),this.allowedCapabilities=new Set([...e,Ka.MatrixCapabilities.Screenshots,pn.a.RequiresClient]),Qa.a.JITSI.matches(this.forWidget.type)&&a===Ka.WidgetKind.Room)this.allowedCapabilities.add(Ka.MatrixCapabilities.AlwaysOnScreen);else if(Qa.a.STICKERPICKER.matches(this.forWidget.type)&&a===Ka.WidgetKind.Account){const e=Ka.WidgetEventCapability.forRoomEvent(Ka.EventDirection.Send,ee.b.Sticker).raw;this.allowedCapabilities.add(Ka.MatrixCapabilities.StickerSending),this.allowedCapabilities.add(e),this.allowedCapabilities.add("visibility")}else if(n&&new URL(null!==(r=mt.b.get("element_call").url)&&void 0!==r?r:mt.a.element_call.url).origin===this.forWidget.origin){this.allowedCapabilities.add(Ka.MatrixCapabilities.AlwaysOnScreen),this.allowedCapabilities.add(Ka.MatrixCapabilities.MSC3846TurnServers),this.allowedCapabilities.add(`org.matrix.msc2762.timeline:${s}`),this.allowedCapabilities.add(Ka.WidgetEventCapability.forRoomEvent(Ka.EventDirection.Send,"org.matrix.rageshake_request").raw),this.allowedCapabilities.add(Ka.WidgetEventCapability.forRoomEvent(Ka.EventDirection.Receive,"org.matrix.rageshake_request").raw),this.allowedCapabilities.add(Ka.WidgetEventCapability.forStateEvent(Ka.EventDirection.Receive,ee.b.RoomMember).raw),this.allowedCapabilities.add(Ka.WidgetEventCapability.forStateEvent(Ka.EventDirection.Receive,"org.matrix.msc3401.call").raw),this.allowedCapabilities.add(Ka.WidgetEventCapability.forStateEvent(Ka.EventDirection.Send,"org.matrix.msc3401.call.member",lt.a.get().getUserId()).raw),this.allowedCapabilities.add(Ka.WidgetEventCapability.forStateEvent(Ka.EventDirection.Receive,"org.matrix.msc3401.call.member").raw);const e=[ee.b.CallInvite,ee.b.CallCandidates,ee.b.CallAnswer,ee.b.CallHangup,ee.b.CallReject,ee.b.CallSelectAnswer,ee.b.CallNegotiate,ee.b.CallSDPStreamMetadataChanged,ee.b.CallSDPStreamMetadataChangedPrefix,ee.b.CallReplaces];for(const t of e)this.allowedCapabilities.add(Ka.WidgetEventCapability.forToDeviceEvent(Ka.EventDirection.Send,t).raw),this.allowedCapabilities.add(Ka.WidgetEventCapability.forToDeviceEvent(Ka.EventDirection.Receive,t).raw)}}async validateCapabilities(e){const t=(a=e,n=this.allowedCapabilities,Object(rn.a)(Array.from(a),Array.from(n)));var a,n;const i=new Set(t.removed),s=new Set(this.allowedCapabilities);var r;let o;if((r=this.forWidget,JSON.parse(localStorage.getItem(`widget_${r.id}_approved_caps`)||"[]")).forEach((e=>{s.add(e),i.delete(e)})),fn.preapproveCapabilities)o=await fn.preapproveCapabilities(this.forWidget,e);else{const t={approvedCapabilities:void 0};nn.a.instance.invoke(qa.WidgetLifecycle.CapabilitiesRequest,t,this.forWidget,e),o=t.approvedCapabilities}o&&o.forEach((e=>{s.add(e),i.delete(e)}));let l=!1;if(i.size>0)try{const[e]=await H.b.createDialog(bn,{requestedCapabilities:i,widget:this.forWidget,widgetKind:this.forWidgetKind}).finished;(e.approved||[]).forEach((e=>s.add(e))),l=e.remember}catch(e){ga.a.error("Non-fatal error getting capabilities: ",e)}const c=new Set(function(e,t){return Object(rn.f)(Array.from(e),Array.from(t))}(s,e));return l&&function(e,t){localStorage.setItem(`widget_${e.id}_approved_caps`,JSON.stringify(t))}(this.forWidget,Array.from(c)),c}async sendEvent(e,t,a,n){const i=lt.a.get(),s=n||rt.b.instance.roomViewStore.getRoomId();if(!i||!s)throw new Error("Not in a room or not attached to a client");let r=null;return null!==a?r=await i.sendStateEvent(s,e,t,a):e===ee.b.RoomRedaction?r=await i.redactEvent(s,t.redacts):(r=await i.sendEvent(s,e,t),e===ee.b.RoomMessage&&yn.CHAT_EFFECTS.forEach((e=>{if(Object(En.containsEmoji)(t,e.emojis)){var a;(null===(a=t["m.relates_to"])||void 0===a?void 0:a.rel_type)!==Ea.d.name&&v.a.dispatch({action:`effects.${e.command}`})}}))),{roomId:s,eventId:r.event_id}}async sendToDevice(e,t,a){const n=lt.a.get();if(t){const e=await n.crypto.deviceList.downloadKeys(Object.keys(a),!1);await Promise.all(Object.entries(a).flatMap((t=>{let[a,i]=t;return Object.entries(i).map((async t=>{let[i,s]=t;"*"===i?await n.encryptAndSendToDevices(Array.from(e.get(a).values()).map((e=>({userId:a,deviceInfo:e}))),s):await n.encryptAndSendToDevices([{userId:a,deviceInfo:e.get(a).get(i)}],s)}))})))}else await n.queueToDevice({eventType:e,batch:Object.entries(a).flatMap((e=>{let[t,a]=e;return Object.entries(a).map((e=>{let[a,n]=e;return{userId:t,deviceId:a,payload:n}}))}))})}pickRooms(e){const t=lt.a.get();if(!t)throw new Error("Not attached to a client");return(e?e.includes(Ka.Symbols.AnyRoom)?t.getVisibleRooms():e.map((e=>t.getRoom(e))):[t.getRoom(rt.b.instance.roomViewStore.getRoomId())]).filter((e=>!!e))}async readRoomEvents(e,t,a,n){a=a>0?Math.min(a,Number.MAX_SAFE_INTEGER):Number.MAX_SAFE_INTEGER;const i=this.pickRooms(n),s=[];for(const n of i){const i=[],r=n.getLiveTimeline().getEvents();for(let n=r.length-1;n>0&&!(i.length>=a);n--){const a=r[n];a.getType()!==e||a.isState()||e===ee.b.RoomMessage&&t&&t!==a.getContent().msgtype||i.push(a)}i.forEach((e=>s.push(e.getEffectiveEvent())))}return s}async readStateEvents(e,t,a,n){a=a>0?Math.min(a,Number.MAX_SAFE_INTEGER):Number.MAX_SAFE_INTEGER;const i=this.pickRooms(n),s=[];for(const n of i){const i=[],r=n.currentState.events.get(e);if(r)if(""===t||t){const e=r.get(t);e&&i.push(e)}else i.push(...Array.from(r.values()));i.slice(0,a).forEach((e=>s.push(e.getEffectiveEvent())))}return s}async askOpenID(e){const t={approved:void 0};if(nn.a.instance.invoke(qa.WidgetLifecycle.IdentityRequest,t,this.forWidget),t.approved)return e.update({state:Ka.OpenIDRequestState.Allowed,token:await lt.a.get().getOpenIdToken()});const a=rt.b.instance.widgetPermissionStore.getOIDCState(this.forWidget,this.forWidgetKind,this.inRoomId),n=()=>lt.a.get().getOpenIdToken();return a===ln.a.Denied?e.update({state:Ka.OpenIDRequestState.Blocked}):a===ln.a.Allowed?e.update({state:Ka.OpenIDRequestState.Allowed,token:await n()}):(e.update({state:Ka.OpenIDRequestState.PendingUserConfirmation}),void H.b.createDialog(mn,{widget:this.forWidget,widgetKind:this.forWidgetKind,inRoomId:this.inRoomId,onFinished:async t=>t?e.update({state:Ka.OpenIDRequestState.Allowed,token:await n()}):e.update({state:Ka.OpenIDRequestState.Blocked})}))}async navigate(e){Object(_n.a)(e)}async*getTurnServers(){const e=lt.a.get();if(!e.pollingTurnServers||!e.getTurnServers().length)return;let t,a;const n=e=>{let[a]=e;return t(wn(a))},i=(e,t)=>{t&&a(e)};e.on(o.b.TurnServers,n),e.on(o.b.TurnServersError,i);try{const n=e.getTurnServers()[0];for(yield wn(n);;)yield await new Promise(((e,n)=>{t=e,a=n}))}finally{e.off(o.b.TurnServers,n),e.off(o.b.TurnServersError,i)}}async readEventRelations(e,t,a,n,i,s,r,o){var l,c;const d=lt.a.get(),m=o;if("string"!=typeof(t=null!==(l=null!==(c=t)&&void 0!==c?c:rt.b.instance.roomViewStore.getRoomId())&&void 0!==l?l:void 0))throw new Error("Error while reading the current room");const{events:u,nextBatch:h,prevBatch:p}=await d.relations(t,e,null!=a?a:null,null!=n?n:null,{from:i,to:s,limit:r,dir:m});return{chunk:u.map((e=>e.getEffectiveEvent())),nextBatch:null!=h?h:void 0,prevBatch:null!=p?p:void 0}}}var On=a(332),Cn=a(202);const xn="io.element.web";function jn(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function kn(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?jn(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):jn(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}class Rn extends s.PureComponent{constructor(e){super(e),i()(this,"widget",void 0),i()(this,"possibleButtons",void 0),i()(this,"appFrame",s.createRef()),i()(this,"state",{disabledButtonIds:(this.props.widgetDefinition.buttons||[]).filter((e=>e.disabled)).map((e=>e.id))}),i()(this,"onReady",(()=>{this.state.messaging.sendWidgetConfig(this.props.widgetDefinition)})),i()(this,"onLoad",(()=>{this.state.messaging.once("ready",this.onReady),this.state.messaging.on(`action:${Ka.WidgetApiFromWidgetAction.CloseModalWidget}`,this.onWidgetClose),this.state.messaging.on(`action:${Ka.WidgetApiFromWidgetAction.SetModalButtonEnabled}`,this.onButtonEnableToggle)})),i()(this,"onWidgetClose",(e=>{this.props.onFinished(!0,e.detail.data)})),i()(this,"onButtonEnableToggle",(e=>{e.preventDefault();if(e.detail.data.button===Ka.BuiltInModalButtonID.Close||!this.possibleButtons.includes(e.detail.data.button))return this.state.messaging.transport.reply(e.detail,{error:{message:"Invalid button"}});let t;if(e.detail.data.enabled)t=Object(rn.b)(this.state.disabledButtonIds).filter((t=>t!==e.detail.data.button));else{const a=new Set(this.state.disabledButtonIds);a.add(e.detail.data.button),t=Array.from(a)}this.setState({disabledButtonIds:t}),this.state.messaging.transport.reply(e.detail,{})})),this.widget=new Ln(kn(kn({},this.props.widgetDefinition),{},{creatorUserId:lt.a.get().getUserId(),id:`modal_${this.props.sourceWidgetId}`})),this.possibleButtons=(this.props.widgetDefinition.buttons||[]).map((e=>e.id))}componentDidMount(){const e=new Sn([],this.widget,Ka.WidgetKind.Modal,!1),t=new Ka.ClientWidgetApi(this.widget,this.appFrame.current,e);this.setState({messaging:t})}componentWillUnmount(){this.state.messaging.off("ready",this.onReady),this.state.messaging.off(`action:${Ka.WidgetApiFromWidgetAction.CloseModalWidget}`,this.onWidgetClose),this.state.messaging.stop()}render(){const e=this.widget.getCompleteUrl({widgetRoomId:this.props.widgetRoomId,currentUserId:lt.a.get().getUserId(),userDisplayName:ht.a.instance.displayName,userHttpAvatarUrl:ht.a.instance.getHttpAvatarUrl(),clientId:xn,clientTheme:b.b.getValue("theme"),clientLanguage:Object(N.h)()}),t=new URL(e);t.searchParams.set("widgetId",this.widget.id),t.searchParams.set("parentUrl",window.location.href.split("#",2)[0]);const n=t.toString().replace(/%24/g,"$");let i;return this.props.widgetDefinition.buttons&&(i=this.props.widgetDefinition.buttons.slice(0,3).reverse().map((e=>{let t="secondary";switch(e.kind){case Ka.ModalButtonKind.Primary:t="primary";break;case Ka.ModalButtonKind.Secondary:t="primary_outline";break;case Ka.ModalButtonKind.Danger:t="danger"}const a=this.state.disabledButtonIds.includes(e.id);return s.createElement(G.a,{key:e.id,kind:t,onClick:()=>{this.state.messaging.notifyModalWidgetButtonClicked(e.id)},disabled:a},e.label)}))),s.createElement(cn.a,{title:this.props.widgetDefinition.name||Object(N.a)("Modal Widget"),className:"mx_ModalWidgetDialog",contentId:"mx_Dialog_content",onFinished:this.props.onFinished},s.createElement("div",{className:"mx_ModalWidgetDialog_warning"},s.createElement("img",{src:a(394).default,height:"16",width:"16",alt:""}),Object(N.a)("Data on this screen is shared with %(widgetDomain)s",{widgetDomain:t.hostname})),s.createElement("div",null,s.createElement("iframe",{title:this.widget.name,ref:this.appFrame,sandbox:"allow-forms allow-scripts allow-same-origin",src:n,onLoad:this.onLoad})),s.createElement("div",{className:"mx_ModalWidgetDialog_buttons"},i))}}function In(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function Tn(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?In(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):In(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}class Nn extends Cn.a{constructor(){super(v.a,{}),i()(this,"modalInstance",null),i()(this,"openSourceWidgetId",null),i()(this,"openSourceWidgetRoomId",null),i()(this,"canOpenModalWidget",(()=>!this.modalInstance)),i()(this,"openModalWidget",((e,t,a)=>{this.modalInstance||(this.openSourceWidgetId=t.id,this.openSourceWidgetRoomId=a,this.modalInstance=H.b.createDialog(Rn,{widgetDefinition:Tn({},e),widgetRoomId:a,sourceWidgetId:t.id,onFinished:(e,n)=>{e?this.closeModalWidget(t,a,n):this.closeModalWidget(t,a,{"m.exited":!0}),this.openSourceWidgetId=null,this.openSourceWidgetRoomId=null,this.modalInstance=null}},null,!1,!0))})),i()(this,"closeModalWidget",((e,t,a)=>{if(this.modalInstance&&this.openSourceWidgetId===e.id&&this.openSourceWidgetRoomId===t){this.openSourceWidgetId=null,this.openSourceWidgetRoomId=null,this.modalInstance.close(),this.modalInstance=null;const n=$a.a.instance.getMessaging(e,t);if(!n)return void ga.a.error("No source widget messaging for modal widget");n.notifyModalWidgetClose(a)}}))}static get instance(){return Nn.internalInstance}async onAction(e){}}i()(Nn,"internalInstance",(()=>{const e=new Nn;return e.start(),e})()),window.mxModalWidgetStore=Nn.instance;var Pn=a(469);const Dn={};function Mn(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function An(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?Mn(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):Mn(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}class Ln extends Ka.Widget{constructor(e){super(e),this.rawDefinition=e}get templateUrl(){var e;return Qa.a.JITSI.matches(this.type)?Aa.a.getLocalJitsiWrapperUrl({forLocalRender:!0,auth:null===(e=super.rawData)||void 0===e?void 0:e.auth}):super.templateUrl}get popoutTemplateUrl(){var e;return Qa.a.JITSI.matches(this.type)?Aa.a.getLocalJitsiWrapperUrl({forLocalRender:!1,auth:null===(e=super.rawData)||void 0===e?void 0:e.auth}):this.templateUrl}get rawData(){let e=super.rawData.conferenceId;if(void 0===e){e=new URL(super.templateUrl).searchParams.get("confId")}let t=super.rawData.domain;void 0===t&&(t="meet.element.io");let a=(new Pn.a).getEffectiveTheme();if(a.startsWith("custom-")){const e=Object(Le.e)(a.slice(7));a=e.is_dark?"dark":"light"}return a=a.includes("light")?"light":"dark",An(An({},super.rawData),{},{theme:a,conferenceId:e,domain:t})}getCompleteUrl(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Object(Ka.runTemplate)(t?this.popoutTemplateUrl:this.templateUrl,An(An({},this.rawDefinition),{},{data:this.rawData}),e)}}class Un extends sn.EventEmitter{constructor(e){var t;super(),this.appTileProps=e,i()(this,"client",void 0),i()(this,"messaging",void 0),i()(this,"mockWidget",void 0),i()(this,"scalarToken",void 0),i()(this,"roomId",void 0),i()(this,"kind",void 0),i()(this,"virtual",void 0),i()(this,"readUpToMap",{}),i()(this,"onOpenModal",(async e=>{var t,a;(e.preventDefault(),Nn.instance.canOpenModalWidget())?(Nn.instance.openModalWidget(e.detail.data,this.mockWidget,this.roomId),null===(t=this.messaging)||void 0===t||t.transport.reply(e.detail,{})):null===(a=this.messaging)||void 0===a||a.transport.reply(e.detail,{error:{message:"Unable to open modal at this time"}})})),i()(this,"onEvent",(e=>{this.client.decryptEventIfNeeded(e),e.isBeingDecrypted()||e.isDecryptionFailure()||this.feedEvent(e)})),i()(this,"onEventDecrypted",(e=>{e.isDecryptionFailure()||this.feedEvent(e)})),i()(this,"onToDeviceEvent",(async e=>{var t;await this.client.decryptEventIfNeeded(e),e.isDecryptionFailure()||await(null===(t=this.messaging)||void 0===t?void 0:t.feedToDevice(e.getEffectiveEvent(),e.isEncrypted()))})),this.client=lt.a.get();let a=e.app;a.creatorUserId||(a=Object(hn.e)(a),a.creatorUserId=this.client.getUserId()),this.mockWidget=new Ln(a),this.roomId=null===(t=e.room)||void 0===t?void 0:t.roomId,this.kind=e.userWidget?Ka.WidgetKind.Account:Ka.WidgetKind.Room,this.virtual=void 0===a.eventId}get eventListenerRoomId(){return this.roomId?this.roomId:rt.b.instance.roomViewStore.getRoomId()}get widgetApi(){return this.messaging}get embedUrl(){return this.runUrlTemplate({asPopout:!1})}get popoutUrl(){return this.runUrlTemplate({asPopout:!0})}runUrlTemplate(){var e,t,a,n;let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{asPopout:!1};const s=null!==(e=null==Dn||null===(t=Dn.provideVariables)||void 0===t?void 0:t.call(Dn))&&void 0!==e?e:{},r={widgetRoomId:this.roomId,currentUserId:this.client.getUserId(),userDisplayName:null!==(a=ht.a.instance.displayName)&&void 0!==a?a:void 0,userHttpAvatarUrl:null!==(n=ht.a.instance.getHttpAvatarUrl())&&void 0!==n?n:void 0,clientId:xn,clientTheme:b.b.getValue("theme"),clientLanguage:Object(N.h)()},o=this.mockWidget.getCompleteUrl(Object.assign(r,s),null==i?void 0:i.asPopout),l=new URL(o);return null!=i&&i.asPopout||(l.searchParams.set("widgetId",this.mockWidget.id),l.searchParams.set("parentUrl",window.location.href.split("#",2)[0]),this.scalarToken&&l.searchParams.set("scalar_token",this.scalarToken)),l.toString().replace(/%24/g,"$")}get isManagedByManager(){return!!this.scalarToken}get started(){return!!this.messaging}startMessaging(e){if(this.started)return;const t=this.appTileProps.whitelistCapabilities||[],a=new Sn(t,this.mockWidget,this.kind,this.virtual,this.roomId);this.messaging=new Ka.ClientWidgetApi(this.mockWidget,e,a),this.messaging.on("preparing",(()=>this.emit("preparing"))),this.messaging.on("ready",(()=>{$a.a.instance.storeMessaging(this.mockWidget,this.roomId,this.messaging),this.emit("ready")})),this.messaging.on("capabilitiesNotified",(()=>this.emit("capabilitiesNotified"))),this.messaging.on(`action:${Ka.WidgetApiFromWidgetAction.OpenModalWidget}`,this.onOpenModal),this.messaging.on(`action:${Za.a.JoinCall}`,(()=>{var e;null===(e=rt.b.instance.voiceBroadcastRecordingsStore.getCurrent())||void 0===e||e.pause()})),this.messaging.on(`action:${Za.a.ViewRoom}`,(e=>{var t;e.preventDefault();const a=(e.detail.data||{}).room_id;var n,i;return a?null!==(t=this.messaging)&&void 0!==t&&t.hasCapability(pn.a.CanChangeViewedRoom)?(v.a.dispatch({action:U.a.ViewRoom,room_id:a,metricsTrigger:"Widget"}),void this.messaging.transport.reply(e.detail,{})):null===(i=this.messaging)||void 0===i?void 0:i.transport.reply(e.detail,{error:{message:"This widget does not have permission for this action (denied)."}}):null===(n=this.messaging)||void 0===n?void 0:n.transport.reply(e.detail,{error:{message:"Room ID not supplied."}})}));for(const e of this.client.getRooms()){var n;const t=(null===(n=e.getLiveTimeline())||void 0===n?void 0:n.getEvents())||[],a=t[t.length-1];a&&(this.readUpToMap[e.roomId]=a.getId())}this.client.on(o.b.Event,this.onEvent),this.client.on(fa.c.Decrypted,this.onEventDecrypted),this.client.on(o.b.ToDeviceEvent,this.onToDeviceEvent),this.messaging.on(`action:${Ka.WidgetApiFromWidgetAction.UpdateAlwaysOnScreen}`,(e=>{var t;null!==(t=this.messaging)&&void 0!==t&&t.hasCapability(Ka.MatrixCapabilities.AlwaysOnScreen)&&(On.b.instance.setWidgetPersistence(this.mockWidget.id,this.roomId,e.detail.data.value),e.preventDefault(),this.messaging.transport.reply(e.detail,{}))})),this.messaging.on(`action:${Ka.WidgetApiFromWidgetAction.SendSticker}`,(e=>{var t;null!==(t=this.messaging)&&void 0!==t&&t.hasCapability(Ka.MatrixCapabilities.StickerSending)&&(e.preventDefault(),this.messaging.transport.reply(e.detail,{}),v.a.dispatch({action:"m.sticker",data:e.detail.data,widgetId:this.mockWidget.id}))})),Qa.a.STICKERPICKER.matches(this.mockWidget.type)&&this.messaging.on(`action:${Za.a.OpenIntegrationManager}`,(e=>{var t;e.preventDefault(),null===(t=this.messaging)||void 0===t||t.transport.reply(e.detail,{}),v.a.dispatch({action:"stickerpicker_close"});const a=e.detail.data,n=null==a?void 0:a.integType,i=null==a?void 0:a.integId;La.a.sharedInstance().getPrimaryManager().open(this.client.getRoom(rt.b.instance.roomViewStore.getRoomId()),`type_${n}`,i)})),Qa.a.JITSI.matches(this.mockWidget.type)&&this.messaging.on(`action:${Za.a.HangupCall}`,(e=>{var t,a;e.preventDefault(),null!==(t=e.detail.data)&&void 0!==t&&t.errorMessage&&H.b.createDialog(Ja.a,{title:Object(N.a)("Connection lost"),description:Object(N.a)("You were disconnected from the call. (Error: %(message)s)",{message:e.detail.data.errorMessage})}),null===(a=this.messaging)||void 0===a||a.transport.reply(e.detail,{})}))}async prepare(){var e,t;if(await(null!==(e=null==Dn||null===(t=Dn.isReady)||void 0===t?void 0:t.call(Dn))&&void 0!==e?e:Promise.resolve()),this.scalarToken)return;const a=$a.a.instance.getMessaging(this.mockWidget,this.roomId);a&&(this.messaging=a);try{if(Aa.a.isScalarUrl(this.mockWidget.templateUrl)){const e=La.a.sharedInstance();if(e.hasManager()){const t=e.getPrimaryManager();if(Aa.a.isScalarUrl(t.apiUrl)){const e=t.getScalarClient();this.scalarToken=await e.getScalarToken()}}}}catch(e){ga.a.error("Error preparing widget communications: ",e)}}stopMessaging(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{forceDestroy:!1};null!=e&&e.forceDestroy||!On.b.instance.getWidgetPersistence(this.mockWidget.id,this.roomId)?this.started&&($a.a.instance.stopMessaging(this.mockWidget,this.roomId),this.messaging=null,this.client.off(o.b.Event,this.onEvent),this.client.off(fa.c.Decrypted,this.onEventDecrypted),this.client.off(o.b.ToDeviceEvent,this.onToDeviceEvent)):ga.a.log("Skipping destroy - persistent widget")}feedEvent(e){if(!this.messaging)return;const t=this.readUpToMap[e.getRoomId()];if(t){if(t===e.getId())return;let a=!0;const n=this.client.getRoom(e.getRoomId()).getLiveTimeline(),i=Object(rn.b)(n.getEvents()).reverse().slice(0,100);for(const n of i){if(n.getId()===t)break;if(n.getId()===e.getId()){a=!1;break}}if(a)return}const a=e.getRoomId(),n=e.getId();if(a&&n){const e=this.client.getRoom(a);e&&"join"===e.getMyMembership()&&(this.readUpToMap[a]=n)}const i=e.getEffectiveEvent();this.messaging.feedEvent(i,this.eventListenerRoomId).catch((e=>{ga.a.error("Error sending event to widget: ",e)}))}}const Fn=["onFinished","app","userWidget","onDeleteClick","onEditClick","showUnpin"],Bn=e=>{var t;let{onFinished:a,app:n,userWidget:i,onDeleteClick:o,onEditClick:l,showUnpin:c}=e,d=ve()(e,Fn);const m=Object(s.useContext)(R.a),{room:u,roomId:h}=Object(s.useContext)(Ga.b),p=$a.a.instance.getMessagingForUid(Aa.a.getWidgetUid(n)),g=i||Aa.a.canUserModifyWidgets(h);let f;if(en()&&Qa.a.JITSI.matches(n.type)){const e=async()=>{try{await an(p,h)}catch(e){ga.a.error("Failed to start livestream",e);const t=e.message||Object(N.a)("Unable to start audio streaming.");H.b.createDialog(Ja.a,{title:Object(N.a)("Failed to start livestream"),description:t})}a()};f=r.a.createElement(me.b,{onClick:e,label:Object(N.a)("Start audio stream")})}const y=Xa.d.instance.getContainerWidgets(u,Xa.a.Top),E=y.findIndex((e=>e.id===n.id));let _,w;if(g&&Aa.a.isManagedByManager(n)){const e=()=>{l?l():Aa.a.editWidget(u,n),a()};_=r.a.createElement(me.b,{onClick:e,label:Object(N.a)("Edit")})}if(b.b.getValue("enableWidgetScreenshots")&&null!=p&&p.hasCapability(Ka.MatrixCapabilities.Screenshots)){const e=()=>{null==p||p.takeScreenshot().then((e=>{v.a.dispatch({action:"picture_snapshot",file:e.screenshot})})).catch((e=>{ga.a.error("Failed to take screenshot: ",e)})),a()};w=r.a.createElement(me.b,{onClick:e,label:Object(N.a)("Take a picture")})}let S;if(o||g){const e=()=>{o?o():H.b.createDialog(Ya.a,{title:Object(N.a)("Delete Widget"),description:Object(N.a)("Deleting a widget removes it for all users in this room. Are you sure you want to delete this widget?"),button:Object(N.a)("Delete widget"),onFinished:e=>{e&&Aa.a.setRoomWidget(h,n.id)}}),a()};S=r.a.createElement(me.b,{onClick:e,label:i?Object(N.a)("Remove"):Object(N.a)("Remove for everyone")})}const O=void 0!==n.eventId&&null!==(t=b.b.getValue("allowedWidgets",h)[n.eventId])&&void 0!==t&&t||n.creatorUserId===m.getUserId(),C=Qa.a.JITSI.matches(n.type);let x,j,k;if(!i&&!C&&O){const e={approved:void 0};if(nn.a.instance.invoke(qa.WidgetLifecycle.PreLoadRequest,e,new Ln(n)),!e.approved){const e=()=>{ga.a.info("Revoking permission for widget to load: "+n.eventId);const e=b.b.getValue("allowedWidgets",h);void 0!==n.eventId&&(e[n.eventId]=!1);const t=b.b.firstSupportedLevel("allowedWidgets");if(!t)throw new Error("level must be defined");b.b.setValue("allowedWidgets",null!=h?h:null,t,e).catch((e=>{ga.a.error(e)})),a()};x=r.a.createElement(me.b,{onClick:e,label:Object(N.a)("Revoke permissions")})}}if(c&&E>0){const e=()=>{if(!u)throw new Error("room must be defined");Xa.d.instance.moveWithinContainer(u,Xa.a.Top,n,-1),a()};j=r.a.createElement(me.b,{onClick:e,label:Object(N.a)("Move left")})}if(c&&E<y.length-1){const e=()=>{Xa.d.instance.moveWithinContainer(u,Xa.a.Top,n,1),a()};k=r.a.createElement(me.b,{onClick:e,label:Object(N.a)("Move right")})}return r.a.createElement(me.e,Z()({},d,{chevronFace:ce.a.None,onFinished:a}),r.a.createElement(me.c,null,f,_,x,S,w,j,k))},Vn=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250;const[a,n]=Object(s.useState)(e.getJoinedMemberCount());return Object(ie.c)(e.currentState,m.b.Update,Object(j.throttle)((()=>{n(e.getJoinedMemberCount())}),t,{leading:!0,trailing:!0})),a},Wn=e=>{const[t,a]=Object(s.useState)(e.getMyMembership());return Object(ie.c)(e,te.d.MyMembership,(()=>{a(e.getMyMembership())})),t};var Hn=a(623),zn=a(871),Gn=a(872),Kn=a(134),qn=a(187);class $n{static isPinnable(e){return!!e&&(!!this.pinnableEventTypes.includes(e.getType())&&!e.isRedacted())}}i()($n,"pinnableEventTypes",[ee.b.RoomMessage,qn.e.name,qn.e.altName]);var Yn=a(248),Jn=a(917),Qn=a(172),Xn=a(165),Zn=a(211);class ei extends r.a.Component{constructor(){super(...arguments),i()(this,"context",void 0),i()(this,"onTileClicked",(()=>{v.a.dispatch({action:U.a.ViewRoom,event_id:this.props.event.getId(),highlighted:!0,room_id:this.props.event.getRoomId(),metricsTrigger:void 0})})),i()(this,"relations",new Map),i()(this,"getRelationsForEvent",((e,t,a)=>{var n;if(e===this.props.event.getId())return null===(n=this.relations.get(t))||void 0===n?void 0:n.get(a)}))}render(){var e;const t=this.props.event.getSender();let a;return this.props.onUnpinClicked&&(a=r.a.createElement(q.a,{onClick:this.props.onUnpinClicked,className:"mx_PinnedEventTile_unpinButton",title:Object(N.a)("Unpin")})),r.a.createElement("div",{className:"mx_PinnedEventTile"},r.a.createElement(Qn.b,{className:"mx_PinnedEventTile_senderAvatar",member:this.props.event.sender,width:24,height:24,fallbackUserId:t}),r.a.createElement("span",{className:"mx_PinnedEventTile_sender "+Object(Zn.f)(t)},(null===(e=this.props.event.sender)||void 0===e?void 0:e.name)||t),a,r.a.createElement("div",{className:"mx_PinnedEventTile_message"},r.a.createElement(Jn.a,{mxEvent:this.props.event,getRelationsForEvent:this.getRelationsForEvent,className:"mx_PinnedEventTile_body",maxImageHeight:150,onHeightChanged:()=>{},permalinkCreator:this.props.permalinkCreator,replacingEventId:this.props.event.replacingEventId()})),r.a.createElement("div",{className:"mx_PinnedEventTile_footer"},r.a.createElement("span",{className:"mx_MessageTimestamp mx_PinnedEventTile_timestamp"},Object(Xn.a)(new Date(this.props.event.getTs()))),r.a.createElement(G.a,{onClick:this.onTileClicked,kind:"link"},Object(N.a)("View message"))))}}i()(ei,"contextType",R.a);var ti=a(309),ai=a(745);function ni(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function ii(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?ni(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):ni(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}const si=e=>{const[t,a]=Object(s.useState)([]),n=Object(s.useCallback)((t=>{var n,i;e&&(t&&t.getType()!==ee.b.RoomPinnedEvents||a((null===(n=e.currentState.getStateEvents(ee.b.RoomPinnedEvents,""))||void 0===n||null===(i=n.getContent())||void 0===i?void 0:i.pinned)||[]))}),[e]);return Object(ie.c)(null==e?void 0:e.currentState,m.b.Events,n),Object(s.useEffect)((()=>(n(),()=>{a([])})),[n]),t},ri=e=>{const[t,a]=Object(s.useState)(new Set),n=Object(s.useCallback)((t=>{var n,i;if(!e)return;if(t&&t.getType()!==ai.a)return;const s=null===(n=e.getAccountData(ai.a))||void 0===n||null===(i=n.getContent())||void 0===i?void 0:i.event_ids;a(new Set(s||[]))}),[e]);return Object(ie.c)(e,te.d.AccountData,n),Object(s.useEffect)((()=>(n(),()=>{a(new Set)})),[n]),t};var oi=e=>{let{room:t,onClose:a,permalinkCreator:n}=e;const i=Object(s.useContext)(R.a),o=Object(s.useContext)(Ga.b),l=Object(ti.a)(t,(e=>e.mayClientSendStateEvent(ee.b.RoomPinnedEvents,i))),c=si(t),d=ri(t);Object(s.useEffect)((()=>{c.filter((e=>!d.has(e))).length>0&&i.setRoomAccountData(t.roomId,ai.a,{event_ids:c})}),[i,t.roomId,c,d]);const m=Object(Yn.a)((()=>{const e=c.map((async e=>{var a;const n=t.getUnfilteredTimelineSet(),s=null==n||null===(a=n.getTimelineForEvent(e))||void 0===a?void 0:a.getEvents().find((t=>t.getId()===e));if(s)return $n.isPinnable(s)?s:null;try{const[a,{events:[n]}]=await Promise.all([i.fetchRoomEvent(t.roomId,e),i.relations(t.roomId,e,ee.h.Replace,null,{limit:1})]),s=new fa.b(a);if(s.isEncrypted()&&await i.decryptEventIfNeeded(s),await t.processPollEvents([s]),s&&$n.isPinnable(s))return s.sender=t.getMember(s.getSender()),n&&s.makeReplaced(n),s}catch(a){ga.a.error("Error looking up pinned event "+e+" in room "+t.roomId),ga.a.error(a)}return null}));return Promise.all(e)}),[i,t,c],null);let u;if(m)if(m.length>0){const e=async e=>{var a;const n=t.currentState.getStateEvents(ee.b.RoomPinnedEvents,"");if(null!=n&&null!==(a=n.getContent())&&void 0!==a&&a.pinned){const a=n.getContent().pinned,s=a.indexOf(e.getId());-1!==s&&(a.splice(s,1),await i.sendStateEvent(t.roomId,ee.b.RoomPinnedEvents,{pinned:a},""))}};u=m.filter(Boolean).reverse().map((t=>r.a.createElement(ei,{key:t.getId(),event:t,onUnpinClicked:l?()=>e(t):void 0,permalinkCreator:n})))}else u=r.a.createElement("div",{className:"mx_PinnedMessagesCard_empty_wrapper"},r.a.createElement("div",{className:"mx_PinnedMessagesCard_empty"},r.a.createElement("div",{className:"mx_MessageActionBar mx_PinnedMessagesCard_MessageActionBar"},r.a.createElement("div",{className:"mx_MessageActionBar_iconButton"},r.a.createElement(zn.a,null)),r.a.createElement("div",{className:"mx_MessageActionBar_iconButton"},r.a.createElement(Gn.a,null)),r.a.createElement("div",{className:"mx_MessageActionBar_iconButton mx_MessageActionBar_optionsButton"},r.a.createElement(Hn.a,null))),r.a.createElement(ra.a,{size:"h4",className:"mx_PinnedMessagesCard_empty_header"},Object(N.a)("Nothing pinned, yet")),Object(N.a)("If you have permissions, open the menu on any message and select <b>Pin</b> to stick them here.",{},{b:e=>r.a.createElement("b",null,e)})));else u=r.a.createElement(Kn.a,null);return r.a.createElement(Da,{header:r.a.createElement("div",{className:"mx_BaseCard_header_title"},r.a.createElement(ra.a,{size:"h4",className:"mx_BaseCard_header_title_heading"},Object(N.a)("Pinned messages"))),className:"mx_PinnedMessagesCard",onClose:a},r.a.createElement(Ga.b.Provider,{value:ii(ii({},o),{},{timelineRenderingType:Ga.a.Pinned})},u))},li=a(282),ci=a(139),di=a(335),mi=a(895),ui=a(200),hi=a(1499),pi=a(635),gi=a(238);class vi extends pi.a{constructor(e,t,a,n){super(e,t,a,n),i()(this,"totalSize",0),i()(this,"messages",[])}get destinationFileName(){return this.makeFileNameNoExtension()+".json"}createJSONString(){var e,t,a,n,i,s,r;const o=Object(Xn.f)(new Date),l=null===(e=this.room.currentState.getStateEvents(ee.b.RoomCreate,""))||void 0===e?void 0:e.getSender(),c=(null===(t=this.room)||void 0===t||null===(a=t.getMember(l))||void 0===a?void 0:a.rawDisplayName)||l,d=(null===(n=this.room.currentState.getStateEvents(ee.b.RoomTopic,""))||void 0===n||null===(i=n.getContent())||void 0===i?void 0:i.topic)||"",m=this.client.getUserId(),u=(null===(s=this.room)||void 0===s||null===(r=s.getMember(m))||void 0===r?void 0:r.rawDisplayName)||m,h={room_name:this.room.name,room_creator:c,topic:d,export_date:o,exported_by:u,messages:this.messages};return JSON.stringify(h,null,2)}async getJSONString(e){if(this.exportOptions.attachmentsIncluded&&this.isAttachment(e))try{const t=await this.getMediaBlob(e);if(this.totalSize+t.size<this.exportOptions.maxSize){this.totalSize+=t.size;const a=this.getFilePath(e);this.totalSize==this.exportOptions.maxSize&&(this.exportOptions.attachmentsIncluded=!1),this.addFile(a,t)}}catch(e){ga.a.log("Error fetching file: "+e)}const t=e.toJSON();return e.isEncrypted()?t.decrypted:t}async createOutput(e){for(let t=0;t<e.length;t++){const a=e[t];if(this.updateProgress(Object(N.a)("Processing event %(number)s out of %(total)s",{number:t+1,total:e.length}),!1,!0),this.cancelled)return this.cleanUp();Object(gi.c)(a,!1)&&this.messages.push(await this.getJSONString(a))}return this.createJSONString()}async export(){ga.a.info("Starting export process..."),ga.a.info("Fetching events...");const e=performance.now(),t=await this.getRequiredEvents(),a=performance.now();ga.a.log(`Fetched ${t.length} events in ${(a-e)/1e3}s`),ga.a.info("Creating output...");const n=await this.createOutput(t);if(this.files.length)this.addFile("export.json",new Blob([n])),await this.downloadZIP();else{const e=this.destinationFileName;this.downloadPlainText(e,n)}const i=performance.now();this.cancelled?ga.a.info("Export cancelled successfully"):(ga.a.info("Export successful!"),ga.a.log(`Exported ${t.length} events in ${(i-e)/1e3} seconds`)),this.cleanUp()}}var bi=a(293);class fi extends pi.a{constructor(e,t,a,n){super(e,t,a,n),i()(this,"totalSize",void 0),i()(this,"mediaOmitText",void 0),i()(this,"textForReplyEvent",(e=>{const t=/> <(.*?)>(.*?)\n\n(.*)/s.exec(e.body);if(!t)return e.body;let a;const n=t[1],i=t[3];a=t[2].substring(1);const s=a.split("\n").filter((e=>!/^\s*$/.test(e)));return s.length>0?(a=s[0].substring(0,32),s[0].length>32&&(a+="..."),a=` "${a}"`):a="",`<${n}${a}> ${i}`})),i()(this,"plainTextForEvent",(async e=>{const t=e.sender&&e.sender.name?e.sender.name:e.getSender();let a="";if(this.isAttachment(e))if(this.exportOptions.attachmentsIncluded)try{const t=await this.getMediaBlob(e);if(this.totalSize+t.size>this.exportOptions.maxSize)a=` (${this.mediaOmitText})`;else{this.totalSize+=t.size;const n=this.getFilePath(e);a=" ("+Object(N.a)("File Attached")+")",this.addFile(n,t),this.totalSize==this.exportOptions.maxSize&&(this.exportOptions.attachmentsIncluded=!1)}}catch(e){a=" ("+Object(N.a)("Error fetching file")+")",ga.a.log("Error fetching file "+e)}else a=` (${this.mediaOmitText})`;return this.isReply(e)?t+": "+this.textForReplyEvent(e.getContent())+a:Object(bi.b)(e)+a})),this.totalSize=0,this.mediaOmitText=this.exportOptions.attachmentsIncluded?Object(N.a)("Media omitted - file size limit exceeded"):Object(N.a)("Media omitted")}get destinationFileName(){return this.makeFileNameNoExtension()+".txt"}async createOutput(e){let t="";for(let a=0;a<e.length;a++){const n=e[a];if(this.updateProgress(Object(N.a)("Processing event %(number)s out of %(total)s",{number:a+1,total:e.length}),!1,!0),this.cancelled)return this.cleanUp();if(!Object(gi.c)(n,!1))continue;const i=await this.plainTextForEvent(n);t+=i&&`${new Date(n.getTs()).toLocaleString()} - ${i}\n`}return t}async export(){this.updateProgress(Object(N.a)("Starting export process…")),this.updateProgress(Object(N.a)("Fetching events…"));const e=performance.now(),t=await this.getRequiredEvents(),a=performance.now();ga.a.log(`Fetched ${t.length} events in ${(a-e)/1e3}s`),this.updateProgress(Object(N.a)("Creating output…"));const n=await this.createOutput(t);if(this.files.length)this.addFile("export.txt",new Blob([n])),await this.downloadZIP();else{const e=this.destinationFileName;this.downloadPlainText(e,n)}const i=performance.now();this.cancelled?ga.a.info("Export cancelled successfully"):(ga.a.info("Export successful!"),ga.a.log(`Exported ${t.length} events in ${(i-e)/1e3} seconds`)),this.cleanUp()}}var yi=a(213);var Ei=()=>({});const _i=(e,t)=>a=>"number"==typeof a&&!(isNaN(a)||e>a||a>t);var wi=e=>{let{room:t,onFinished:a}=e;const{exportFormat:n,exportType:i,includeAttachments:o,numberOfMessages:l,sizeLimit:c,setExportFormat:d,setExportType:m,setNumberOfMessages:u,setSizeLimit:h,setAttachments:p}=(()=>{var e,t,a,n,i;const r=Ei(),[o,l]=Object(s.useState)(null!==(e=r.format)&&void 0!==e?e:mi.a.Html),[c,d]=Object(s.useState)(null!==(t=r.range)&&void 0!==t?t:mi.b.Timeline),[m,u]=Object(s.useState)(null!==(a=r.includeAttachments)&&void 0!==a&&a),[h,p]=Object(s.useState)(null!==(n=r.numberOfMessages)&&void 0!==n?n:100),[g,v]=Object(s.useState)(null!==(i=r.sizeMb)&&void 0!==i?i:8);return{exportFormat:o,exportType:c,includeAttachments:m,numberOfMessages:h,sizeLimit:g,setExportFormat:r.format?void 0:l,setExportType:r.range?void 0:d,setNumberOfMessages:r.numberOfMessages?void 0:p,setSizeLimit:r.sizeMb?void 0:v,setAttachments:void 0===r.includeAttachments?u:void 0}})(),[g,v]=Object(s.useState)(!1),b=Object(s.useRef)(),f=Object(s.useRef)(),[y,E]=Object(s.useState)(Object(N.a)("Processing…")),[_,w]=Object(s.useState)(!1),[S,O]=Object(s.useState)(!1),[C,x]=Object(s.useState)(!1),[j,k]=((e,t)=>{const[a,n]=Object(s.useState)(e);return[a,e=>{n(e),t(e)}]})(null,(async e=>{await(null==e?void 0:e.export().then((()=>{S||x(!0)})))})),R=async()=>{if(!h||await b.current.validate({focused:!1})){if(i===mi.b.LastNMessages){if(!await f.current.validate({focused:!1}))return void f.current.validate({focused:!0})}v(!0),await(async()=>{const e={numberOfMessages:l,attachmentsIncluded:o,maxSize:1024*c*1024};switch(n){case mi.a.Html:k(new hi.a(t,mi.b[i],e,E));break;case mi.a.Json:k(new vi(t,mi.b[i],e,E));break;case mi.a.PlainText:k(new fi(t,mi.b[i],e,E));break;default:return void ga.a.error("Unknown export format")}})()}else b.current.validate({focused:!0})},I=Object(ui.a)({rules:[{key:"required",test(e){let{value:t,allowEmpty:a}=e;return a||!!t},invalid:()=>Object(N.a)("Enter a number between %(min)s and %(max)s",{min:1,max:2e3})},{key:"number",test:e=>{let{value:t}=e;const a=parseInt(t,10);return _i(1,2e3)(a)},invalid:()=>Object(N.a)("Size can only be a number between %(min)s MB and %(max)s MB",{min:1,max:2e3})}]}),T=async e=>await I(e),P=Object(ui.a)({rules:[{key:"required",test(e){let{value:t,allowEmpty:a}=e;return a||!!t},invalid:()=>Object(N.a)("Enter a number between %(min)s and %(max)s",{min:1,max:10**8})},{key:"number",test:e=>{let{value:t}=e;const a=parseInt(t,10);return _i(1,10**8)(a)},invalid:()=>Object(N.a)("Number of messages can only be a number between %(min)s and %(max)s",{min:1,max:10**8})}]}),D=async e=>await P(e),M=async()=>{g?w(!0):a(!1)},A=async()=>{await(null==j?void 0:j.cancelExport()),O(!0),v(!1),k(null)},L=Object.values(mi.a).map((e=>({value:e,label:Object(mi.c)(e)}))),U=Object.values(mi.b).map((e=>r.a.createElement("option",{key:mi.b[e],value:e},Object(mi.d)(e))));let F=null;i===mi.b.LastNMessages&&u&&(F=r.a.createElement(ci.a,{id:"message-count",element:"input",type:"number",value:l.toString(),ref:f,onValidate:D,label:Object(N.a)("Number of messages"),onChange:e=>{u(parseInt(e.target.value))}}));const B=r.a.createElement("span",null,Object(N.a)("MB"));return S?r.a.createElement(yi.a,{title:Object(N.a)("Export Cancelled"),description:Object(N.a)("The export was cancelled successfully"),hasCloseButton:!0,onFinished:a}):C?r.a.createElement(yi.a,{title:Object(N.a)("Export Successful"),description:Object(N.a)("Your export was successful. Find it in your Downloads folder."),hasCloseButton:!0,onFinished:a}):_?r.a.createElement(cn.a,{title:Object(N.a)("Warning"),className:"mx_ExportDialog",contentId:"mx_Dialog_content",onFinished:a,fixedWidth:!0},r.a.createElement("p",null,Object(N.a)("Are you sure you want to stop exporting your data? If you do, you'll need to start over.")),r.a.createElement(dn.a,{primaryButton:Object(N.a)("Stop"),primaryButtonClass:"danger",hasCancel:!0,cancelButton:Object(N.a)("Continue"),onCancel:()=>w(!1),onPrimaryButtonClick:A})):r.a.createElement(cn.a,{title:g?Object(N.a)("Exporting your data"):Object(N.a)("Export Chat"),className:`mx_ExportDialog ${g&&"mx_ExportDialog_Exporting"}`,contentId:"mx_Dialog_content",hasCancel:!0,onFinished:a,fixedWidth:!0},g?null:r.a.createElement("p",null,Object(N.a)("Select from the options below to export chats from your timeline")),r.a.createElement("div",{className:"mx_ExportDialog_options"},!!d&&r.a.createElement(r.a.Fragment,null,r.a.createElement("span",{className:"mx_ExportDialog_subheading"},Object(N.a)("Format")),r.a.createElement(di.a,{name:"exportFormat",value:n,onChange:e=>d(mi.a[e]),definitions:L})),!!m&&r.a.createElement(r.a.Fragment,null,r.a.createElement("span",{className:"mx_ExportDialog_subheading"},Object(N.a)("Messages")),r.a.createElement(ci.a,{id:"export-type",element:"select",value:i,onChange:e=>{m(mi.b[e.target.value])}},U),F),h&&r.a.createElement(r.a.Fragment,null,r.a.createElement("span",{className:"mx_ExportDialog_subheading"},Object(N.a)("Size Limit")),r.a.createElement(ci.a,{id:"size-limit",type:"number",autoComplete:"off",onValidate:T,element:"input",ref:b,value:c.toString(),postfixComponent:B,onChange:e=>h(parseInt(e.target.value))})),p&&r.a.createElement(r.a.Fragment,null,r.a.createElement(De.b,{className:"mx_ExportDialog_attachments-checkbox",id:"include-attachments",checked:o,onChange:e=>p(e.target.checked)},Object(N.a)("Include Attachments")))),g?r.a.createElement("div",{"data-test-id":"export-progress",className:"mx_ExportDialog_progress"},r.a.createElement(Kn.a,{w:24,h:24}),r.a.createElement("p",null,y),r.a.createElement(dn.a,{primaryButton:Object(N.a)("Cancel"),primaryButtonClass:"danger",hasCancel:!1,onPrimaryButtonClick:M})):r.a.createElement(dn.a,{primaryButton:Object(N.a)("Export"),onPrimaryButtonClick:R,onCancel:()=>a(!1)}))};const Si=["name","value","tabs","onFilterChange"],Oi=e=>{let{name:t,value:a,tabs:n,onFilterChange:i}=e,s=ve()(e,Si);return r.a.createElement("fieldset",Z()({},s,{className:"mx_FilterTabGroup"}),n.map((e=>{let{label:n,id:s}=e;return r.a.createElement("label",{"data-testid":`filter-tab-${t}-${s}`,key:s},r.a.createElement("input",{type:"radio",name:t,value:s,onChange:()=>i(s),checked:a===s}),r.a.createElement("span",null,n))})))};var Ci=a(605),xi=a(161);const ji=e=>{let{event:t,onClick:a}=e;const n=t.unstableExtensibleEvent;if(!n)return null;const i=Object(Xn.i)(t.getTs());return r.a.createElement("li",{"data-testid":`pollListItem-${t.getId()}`,className:"mx_PollListItem",onClick:a},r.a.createElement(pe.a,{label:Object(N.a)("View poll"),alignment:xi.a.Top},r.a.createElement("div",{className:"mx_PollListItem_content"},r.a.createElement("span",null,i),r.a.createElement(Ci.a,{className:"mx_PollListItem_icon"}),r.a.createElement("span",{className:"mx_PollListItem_question"},n.question.text))))};var ki=a(136),Ri=a(314),Ii=a(938),Ti=a(461);const Ni=(e,t)=>{const a=Object(Ri.b)(Object(Ri.a)(t)),n=Object(Ri.c)(a,e.pollEvent),i=[...n.values()].reduce(((e,t)=>e+t),0),s=Math.max(...n.values());return{totalVoteCount:i,winningAnswers:e.pollEvent.answers.filter((e=>n.get(e.id)===s)).map((e=>({answer:e,voteCount:n.get(e.id)||0})))}},Pi=e=>{let{event:t,poll:a,onClick:n}=e;const i=a.pollEvent,{winningAnswers:o,totalVoteCount:l}=(e=>{const[t,a]=Object(s.useState)({totalVoteCount:0});return Object(s.useEffect)((()=>{const t=t=>a(Ni(e,t));return e.on(ki.PollEvent.Responses,t),(async()=>{const t=await e.getResponses();a(Ni(e,t))})(),()=>{e.off(ki.PollEvent.Responses,t)}}),[e]),t})(a);if(!i)return null;const c=Object(Xn.i)(t.getTs());return r.a.createElement("li",{"data-testid":`pollListItem-${t.getId()}`,className:"mx_PollListItemEnded",onClick:n},r.a.createElement(pe.a,{label:Object(N.a)("View poll"),alignment:xi.a.Top},r.a.createElement("div",{className:"mx_PollListItemEnded_content"},r.a.createElement("div",{className:"mx_PollListItemEnded_title"},r.a.createElement(Ci.a,{className:"mx_PollListItemEnded_icon"}),r.a.createElement("span",{className:"mx_PollListItemEnded_question"},i.question.text),r.a.createElement(Ti.a,null,c)),!(null==o||!o.length)&&r.a.createElement("div",{className:"mx_PollListItemEnded_answers"},null==o?void 0:o.map((e=>{let{answer:t,voteCount:n}=e;return r.a.createElement(Ii.a,{key:t.id,answer:t,voteCount:n,totalVoteCount:l,pollId:a.pollId,displayVoteCount:!0,isChecked:!0,isEnded:!0})}))),r.a.createElement("div",{className:"mx_PollListItemEnded_voteCount"},r.a.createElement(Ti.a,null,Object(N.a)("Final result based on %(count)s votes",{count:l}))))))},Di=e=>{let{noResultsYet:t}=e;return r.a.createElement("div",{className:c()("mx_PollHistoryList_loading",{mx_PollHistoryList_noResultsYet:t})},r.a.createElement(he.a,null),Object(N.a)("Loading polls"))},Mi=e=>{let{isLoading:t,loadMorePolls:a}=e;return a?r.a.createElement(G.a,{className:"mx_PollHistoryList_loadMorePolls",kind:"link_inline",onClick:()=>a()},Object(N.a)("Load more polls"),t&&r.a.createElement(he.a,null)):null},Ai=e=>{let{filter:t,isLoading:a,oldestFetchedEventTimestamp:n,loadMorePolls:i}=e;return!i&&a?r.a.createElement(Di,{noResultsYet:!0}):r.a.createElement("span",{className:"mx_PollHistoryList_noResults"},((e,t,a)=>{if(!a)return"ACTIVE"===e?Object(N.a)("There are no active polls in this room"):Object(N.a)("There are no past polls in this room");if(!t)return"ACTIVE"===e?Object(N.a)("There are no active polls. Load more polls to view polls for previous months"):Object(N.a)("There are no past polls. Load more polls to view polls for previous months");const n=Math.ceil((Date.now()-t)/864e5);return"ACTIVE"===e?Object(N.a)("There are no active polls for the past %(count)s days. Load more polls to view polls for previous months",{count:n}):Object(N.a)("There are no past polls for the past %(count)s days. Load more polls to view polls for previous months",{count:n})})(t,n,i),!!i&&r.a.createElement(Mi,{loadMorePolls:i,isLoading:a}))},Li=e=>{let{pollStartEvents:t,polls:a,filter:n,isLoading:i,oldestFetchedEventTimestamp:s,onFilterChange:o,loadMorePolls:l,onItemClick:d}=e;return r.a.createElement("div",{className:"mx_PollHistoryList"},r.a.createElement(Oi,{name:"PollHistoryDialog_filter",value:n,onFilterChange:o,tabs:[{id:"ACTIVE",label:"Active polls"},{id:"ENDED",label:"Past polls"}]}),!!t.length&&r.a.createElement("ol",{className:c()("mx_PollHistoryList_list",`mx_PollHistoryList_list_${n}`)},t.map((e=>"ACTIVE"===n?r.a.createElement(ji,{key:e.getId(),event:e,onClick:()=>d(e.getId())}):r.a.createElement(Pi,{key:e.getId(),event:e,poll:a.get(e.getId()),onClick:()=>d(e.getId())}))),i&&!l&&r.a.createElement(Di,null),!!l&&r.a.createElement(Mi,{loadMorePolls:l,isLoading:i})),!t.length&&r.a.createElement(Ai,{oldestFetchedEventTimestamp:s,isLoading:i,filter:n,loadMorePolls:l}))};var Ui=a(897);const Fi=e=>{let{filter:t,onNavigateBack:a}=e;return r.a.createElement(G.a,{kind:"content_inline",onClick:a,className:"mx_PollDetailHeader"},r.a.createElement(Ui.a,{className:"mx_PollDetailHeader_icon"}),"ACTIVE"===t?Object(N.a)("Active polls"):Object(N.a)("Past polls"))},Bi=()=>{},Vi=e=>{let{poll:t,permalinkCreator:a,requestModalClose:n}=e;const i=t.isEnded?t.endEventId:t.pollId,s=a.forEvent(i);return r.a.createElement(r.a.Fragment,null,r.a.createElement(Ri.d,{mxEvent:t.rootEvent,permalinkCreator:a,onHeightChanged:Bi,onMessageAllowed:Bi,mediaEventHelper:{}}),r.a.createElement("br",null),r.a.createElement("div",null,r.a.createElement(G.a,{kind:"link_inline",element:"a",href:s,onClick:e=>{e.ctrlKey||e.metaKey||(e.preventDefault(),v.a.dispatch({action:U.a.ViewRoom,event_id:i,highlighted:!0,room_id:t.roomId,metricsTrigger:void 0}),n())},rel:"noreferrer noopener"},Object(N.a)("View poll in timeline"))))},Wi=(e,t)=>{const{polls:a}=((e,t)=>{const a=t.getRoom(e);if(!a)throw new Error("Cannot find room");return{polls:Object(ie.b)(a,ki.PollEvent.New,(()=>new Map(a.polls)))}})(e,t),[n,i]=Object(s.useState)(a);return Object(s.useEffect)((()=>{const e=async()=>{i(new Map(a))};if(a){for(const t of a.values())t.on(ki.PollEvent.End,e),t.on(ki.PollEvent.Responses,e),t.getResponses();i(a)}return()=>{if(a)for(const t of a.values())t.off(ki.PollEvent.End,e),t.off(ki.PollEvent.Responses,e)}}),[a,i]),{polls:n}};var Hi=a(315);const zi=e=>{var t;if(!e)return;return null===(t=(null==e?void 0:e.getLiveTimeline()).getEvents()[0])||void 0===t?void 0:t.getTs()},Gi=async(e,t)=>{if(!e)return{canPageBackward:!1};const a=e.getLiveTimeline();return await t.paginateEventTimeline(a,{backwards:!0}),{oldestEventTimestamp:zi(e),canPageBackward:!!a.getPaginationToken(ki.EventTimeline.BACKWARDS)}},Ki=async(e,t,a,n,i)=>{if(!e||!n||i&&i<a)return;const s=await Gi(e,t);return Ki(e,t,a,s.canPageBackward,s.oldestEventTimestamp)},qi=(e,t,a)=>{const[n,i]=Object(s.useState)(!0),[r,o]=Object(s.useState)(void 0),[l,c]=Object(s.useState)(!1),d=Object(s.useCallback)((async()=>{const n=Date.now()-864e5*a;i(!0);try{var s;const a=null==e?void 0:e.getLiveTimeline(),i=!(null==a||!a.getPaginationToken(ki.Direction.Backward)),r=zi(e);await Ki(e,t,n,i,r),c(!(null==e||null===(s=e.getLiveTimeline())||void 0===s||!s.getPaginationToken(ki.EventTimeline.BACKWARDS))),o(zi(e))}catch(e){ga.a.error("Failed to fetch room polls history",e)}finally{i(!1)}}),[a,e,t]),m=Object(s.useCallback)((async()=>{if(e){i(!0);try{const a=await Gi(e,t);c(a.canPageBackward),o(a.oldestEventTimestamp)}catch(e){ga.a.error("Failed to fetch room polls history",e)}finally{i(!1)}}}),[e,t]);return{isLoading:n,oldestEventTimestamp:r,loadTimelineHistory:d,loadMorePolls:l?m:void 0}},$i={room:{timeline:{types:[qn.e.name,qn.e.altName]}}},Yi=(e,t)=>t.getTs()-e.getTs(),Ji=e=>{let{room:t,matrixClient:a,permalinkCreator:n,onFinished:i}=e;const{polls:o}=Wi(t.roomId,a),{isLoading:l,loadMorePolls:c,oldestEventTimestamp:d}=function(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:30;const[n,i]=Object(s.useState)(void 0);Object(s.useEffect)((()=>{const a=new Hi.a(t.getSafeUserId());a.setDefinition($i),(async()=>{const n=await t.getOrCreateFilter(`POLL_HISTORY_FILTER_${e.roomId}}`,a);a.filterId=n;const s=e.getOrCreateFilteredTimelineSet(a);i(s)})()}),[e,t]);const{isLoading:r,oldestEventTimestamp:o,loadMorePolls:l,loadTimelineHistory:c}=qi(n,t,a);return Object(s.useEffect)((()=>{c()}),[c]),{isLoading:r,oldestEventTimestamp:o,loadMorePolls:l}}(t,a),[m,u]=Object(s.useState)("ACTIVE"),[h,p]=Object(s.useState)(null),g=((e,t)=>[...e.values()].filter((e=>t=>!t.isFetchingResponses&&"ACTIVE"===e!==t.isEnded)(t)).map((e=>e.rootEvent)).sort(Yi))(o,m),v=[...o.values()].some((e=>e.isFetchingResponses)),b=h?o.get(h):void 0,f=b?r.a.createElement(Fi,{filter:m,onNavigateBack:()=>p(null)}):Object(N.a)("Polls history");return r.a.createElement(cn.a,{title:f,onFinished:i},r.a.createElement("div",{className:"mx_PollHistoryDialog_content"},b?r.a.createElement(Vi,{poll:b,permalinkCreator:n,requestModalClose:i}):r.a.createElement(Li,{onItemClick:p,pollStartEvents:g,isLoading:l||v,oldestFetchedEventTimestamp:d,polls:o,filter:m,onFilterChange:u,loadMorePolls:c})))},Qi=["children","className","onClick"],Xi=e=>{let{children:t,className:a,onClick:n}=e,i=ve()(e,Qi);return r.a.createElement(G.a,Z()({},i,{className:c()("mx_BaseCard_Button mx_RoomSummaryCard_Button",a),onClick:n}),t)},Zi=e=>{const[t,a]=Object(s.useState)((()=>Wa.a.instance.getApps(e.roomId))),n=Object(s.useCallback)((()=>{a([...Wa.a.instance.getApps(e.roomId)])}),[e]);return Object(s.useEffect)(n,[e,n]),Object(ie.a)(Wa.a.instance,e.roomId,n),Object(ie.a)(Xa.d.instance,Xa.d.emissionForRoom(e),n),t},es=e=>{let{app:t,room:a}=e;const n=Aa.a.getWidgetName(t),i=Aa.a.getWidgetDataTitle(t),o=i&&" - "+i,[l,d]=Object(s.useState)();Object(s.useEffect)((()=>{d(Aa.a.canUserModifyWidgets(a.roomId))}),[a.roomId]);const m=Xa.d.instance.isInContainer(a,t,Xa.a.Top),u=m?()=>{Xa.d.instance.moveToContainer(a,t,Xa.a.Right)}:()=>{Xa.d.instance.moveToContainer(a,t,Xa.a.Top)},[h,p,g,v]=Object(ce.q)();let b;if(h){const e=p.current.getBoundingClientRect();b=r.a.createElement(Bn,{chevronFace:ce.a.None,right:Q.b.instance.windowWidth-e.right,bottom:Q.b.instance.windowHeight-e.top,onFinished:v,app:t})}const f=!m&&!Xa.d.instance.canAddToContainer(a,Xa.a.Top);let y;y=f?Object(N.a)("You can only pin up to %(count)s widgets",{count:Xa.b}):m?Object(N.a)("Unpin"):Object(N.a)("Pin");const E=Xa.d.instance.isInContainer(a,t,Xa.a.Center),_=E?()=>{Xa.d.instance.moveToContainer(a,t,Xa.a.Right)}:()=>{Xa.d.instance.moveToContainer(a,t,Xa.a.Center)},w=E?Object(N.a)("Close"):Object(N.a)("Maximise");let S="";m?S=Object(N.a)("Unpin this widget to view it in this panel"):E&&(S=Object(N.a)("Close this widget to view it in this panel"));const O=c()("mx_BaseCard_Button mx_RoomSummaryCard_Button",{mx_RoomSummaryCard_Button_pinned:m,mx_RoomSummaryCard_Button_maximised:E});return r.a.createElement("div",{className:O,ref:p},r.a.createElement(q.a,{className:"mx_RoomSummaryCard_icon_app",onClick:()=>{Ia.a.instance.pushCard({phase:Ra.a.Widget,state:{widgetId:t.id}})},title:S,forceHide:!(m||E),disabled:m||E},r.a.createElement(Va,{app:t}),r.a.createElement("span",null,n),o),l&&r.a.createElement(ce.c,{className:"mx_RoomSummaryCard_app_options",isExpanded:h,onClick:g,title:Object(N.a)("Options")}),r.a.createElement(q.a,{className:"mx_RoomSummaryCard_app_pinToggle",onClick:u,title:y,disabled:f}),r.a.createElement(q.a,{className:"mx_RoomSummaryCard_app_maximiseToggle",onClick:_,title:w}),b)},ts=e=>{let{room:t}=e;const a=Zi(t),n=Object(s.useMemo)((()=>a.filter((e=>void 0!==e.eventId))),[a]);let i=null;return n.length>0&&Xa.d.instance.canCopyLayoutToRoom(t)&&(i=r.a.createElement(G.a,{kind:"link",onClick:()=>Xa.d.instance.copyLayoutToRoom(t)},Object(N.a)("Set my room layout for everyone"))),r.a.createElement(Pa,{className:"mx_RoomSummaryCard_appsGroup",title:Object(N.a)("Widgets")},n.map((e=>r.a.createElement(es,{key:e.id,app:e,room:t}))),i,r.a.createElement(G.a,{kind:"link",onClick:()=>{const e=La.a.sharedInstance();e.hasManager()?e.getPrimaryManager().open(t):e.openNoManagerDialog()}},n.length>0?Object(N.a)("Edit widgets, bridges & bots"):Object(N.a)("Add widgets, bridges & bots")))},as=e=>{Ia.a.instance.pushCard({phase:Ra.a.RoomMemberList},!0),re.b.trackInteraction("WebRightPanelRoomInfoPeopleButton",e)},ns=()=>{Ia.a.instance.pushCard({phase:Ra.a.FilePanel},!0)},is=()=>{Ia.a.instance.pushCard({phase:Ra.a.PinnedMessages},!0)},ss=e=>{v.a.dispatch({action:"open_room_settings"}),re.b.trackInteraction("WebRightPanelRoomInfoSettingsButton",e)};var rs=e=>{var t;let{room:a,permalinkCreator:n,onClose:i}=e;const o=Object(s.useContext)(R.a),l=Ta(o,a),d=Object(s.useContext)(Ga.b).e2eStatus,m=Object(se.a)("feature_video_rooms"),u=Object(se.a)("feature_element_call_video_rooms"),h=m&&(a.isElementVideoRoom()||u&&a.isCallRoom()),p=a.getCanonicalAlias()||a.getAltAliases()[0]||"",g=r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:"mx_RoomSummaryCard_avatar",role:"presentation"},r.a.createElement(ye.a,{room:a,height:54,width:54,viewAvatarOnClick:!0}),r.a.createElement(Ua.a,{tooltip:l?Object(N.a)("Encrypted"):Object(N.a)("Not encrypted"),class:c()("mx_RoomSummaryCard_e2ee",{mx_RoomSummaryCard_e2ee_normal:l,mx_RoomSummaryCard_e2ee_warning:l&&d===za.Warning,mx_RoomSummaryCard_e2ee_verified:l&&d===za.Verified})})),r.a.createElement(li.a,{room:a},(e=>r.a.createElement("h2",{title:e},e))),r.a.createElement("div",{className:"mx_RoomSummaryCard_alias",title:p},p)),v=Vn(a),f=Object(se.a)("feature_pinning"),y=null===(t=si(f&&a))||void 0===t?void 0:t.length,E=Object(se.a)("feature_poll_history");return r.a.createElement(Da,{header:g,className:"mx_RoomSummaryCard",onClose:i},r.a.createElement(Pa,{title:Object(N.a)("About"),className:"mx_RoomSummaryCard_aboutGroup"},r.a.createElement(Xi,{className:"mx_RoomSummaryCard_icon_people",onClick:as},Object(N.a)("People"),r.a.createElement("span",{className:"mx_BaseCard_Button_sublabel"},v)),!h&&r.a.createElement(Xi,{className:"mx_RoomSummaryCard_icon_files",onClick:ns},Object(N.a)("Files")),!h&&E&&r.a.createElement(Xi,{className:"mx_RoomSummaryCard_icon_poll",onClick:()=>{H.b.createDialog(Ji,{room:a,matrixClient:o,permalinkCreator:n})}},Object(N.a)("Polls history")),f&&!h&&r.a.createElement(Xi,{className:"mx_RoomSummaryCard_icon_pins",onClick:is},Object(N.a)("Pinned"),y>0&&r.a.createElement("span",{className:"mx_BaseCard_Button_sublabel"},y)),!h&&r.a.createElement(Xi,{className:"mx_RoomSummaryCard_icon_export",onClick:async()=>{H.b.createDialog(wi,{room:a})}},Object(N.a)("Export chat")),r.a.createElement(Xi,{"data-testid":"shareRoomButton",className:"mx_RoomSummaryCard_icon_share",onClick:()=>{H.b.createDialog(Ma.a,{target:a})}},Object(N.a)("Share room")),r.a.createElement(Xi,{className:"mx_RoomSummaryCard_icon_settings",onClick:ss},Object(N.a)("Room settings"))),b.b.getValue(oe.b.Widgets)&&!h&&Object(ae.a)(oe.a.AddIntegrations)&&r.a.createElement(ts,{room:a}))},os=a(255),ls=a.n(os);function cs(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}class ds extends r.a.Component{constructor(e){super(e);const t=this.parseWidgetUrl(),a=lt.a.get().getRoom(this.props.roomId);let n;a&&(n=a.getMember(this.props.creatorUserId)),this.state=function(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?cs(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):cs(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}({widgetDomain:null,isWrapped:null,roomMember:n},t)}parseWidgetUrl(){const e=ls.a.parse(this.props.url),t=new URLSearchParams(e.search);if(Aa.a.isScalarUrl(this.props.url)&&t&&t.get("url")){const e=ls.a.parse(t.get("url"));return{widgetDomain:e.host||e.hostname,isWrapped:!0}}return{widgetDomain:e.host||e.hostname,isWrapped:!1}}render(){const e=mt.b.get().brand,t=this.state.roomMember?this.state.roomMember.name:this.props.creatorUserId,a=t===this.props.creatorUserId?null:this.props.creatorUserId,n=this.state.roomMember?r.a.createElement(Qn.b,{member:this.state.roomMember,width:38,height:38}):r.a.createElement(gt.a,{name:this.props.creatorUserId,width:38,height:38}),i=r.a.createElement("div",null,Object(N.a)("Any of the following data may be shared:"),r.a.createElement("ul",null,r.a.createElement("li",null,Object(N.a)("Your display name")),r.a.createElement("li",null,Object(N.a)("Your avatar URL")),r.a.createElement("li",null,Object(N.a)("Your user ID")),r.a.createElement("li",null,Object(N.a)("Your theme")),r.a.createElement("li",null,Object(N.a)("%(brand)s URL",{brand:e})),r.a.createElement("li",null,Object(N.a)("Room ID")),r.a.createElement("li",null,Object(N.a)("Widget ID")))),s=r.a.createElement(Ua.a,{tooltip:i,tooltipClass:"mx_AppPermissionWarning_tooltip mx_Tooltip_dark"},r.a.createElement("span",{className:"mx_AppPermissionWarning_helpIcon"})),o=this.state.isWrapped?Object(N.a)("Using this widget may share data <helpIcon /> with %(widgetDomain)s & your integration manager.",{widgetDomain:this.state.widgetDomain},{helpIcon:()=>s}):Object(N.a)("Using this widget may share data <helpIcon /> with %(widgetDomain)s.",{widgetDomain:this.state.widgetDomain},{helpIcon:()=>s}),l=this.props.isRoomEncrypted?Object(N.a)("Widgets do not use message encryption."):null;return r.a.createElement("div",{className:"mx_AppPermissionWarning"},r.a.createElement("div",{className:"mx_AppPermissionWarning_row mx_AppPermissionWarning_bolder mx_AppPermissionWarning_smallText"},Object(N.a)("Widget added by")),r.a.createElement("div",{className:"mx_AppPermissionWarning_row"},n,r.a.createElement("h4",{className:"mx_AppPermissionWarning_bolder"},t),r.a.createElement("div",{className:"mx_AppPermissionWarning_smallText"},a)),r.a.createElement("div",{className:"mx_AppPermissionWarning_row mx_AppPermissionWarning_smallText"},o),r.a.createElement("div",{className:"mx_AppPermissionWarning_row mx_AppPermissionWarning_smallText"},Object(N.a)("This widget may use cookies.")," ",l),r.a.createElement("div",{className:"mx_AppPermissionWarning_row"},r.a.createElement(G.a,{kind:"primary_sm",onClick:this.props.onPermissionGranted},Object(N.a)("Continue"))))}}i()(ds,"defaultProps",{onPermissionGranted:()=>{}});var ms=e=>r.a.createElement("div",{className:"mx_AppPermissionWarning"},r.a.createElement("div",{className:"mx_AppPermissionWarningImage"},r.a.createElement("img",{src:a(602).default,alt:""})),r.a.createElement("div",{className:"mx_AppPermissionWarningText"},r.a.createElement("span",{className:"mx_AppPermissionWarningTextLabel"},e.errorMsg||"Error")));function us(e){return document.getElementById(e)}class hs extends r.a.Component{constructor(e){super(e),i()(this,"resizeObserver",void 0),i()(this,"dispatcherRef",void 0),i()(this,"childContainer",void 0),i()(this,"child",void 0),i()(this,"collectChildContainer",(e=>{this.childContainer&&this.resizeObserver.unobserve(this.childContainer),this.childContainer=e,e&&this.resizeObserver.observe(e)})),i()(this,"collectChild",(e=>{this.child=e,this.updateChild()})),i()(this,"onAction",(e=>{"timeline_resize"===e.action?this.repositionChild():"logout"===e.action&&hs.destroyElement(this.props.persistKey)})),i()(this,"repositionChild",(()=>{this.updateChildPosition(this.child,this.childContainer)})),this.resizeObserver=new ResizeObserver(this.repositionChild),window.addEventListener("resize",this.repositionChild),this.dispatcherRef=v.a.register(this.onAction),this.props.moveRef&&(this.props.moveRef.current=this.repositionChild)}static destroyElement(e){const t=us("mx_persistedElement_"+e);t&&t.remove()}static isMounted(e){return Boolean(us("mx_persistedElement_"+e))}componentDidMount(){this.updateChild(),this.renderApp()}componentDidUpdate(){this.updateChild(),this.renderApp()}componentWillUnmount(){this.updateChildVisibility(this.child,!1),this.resizeObserver.disconnect(),window.removeEventListener("resize",this.repositionChild),v.a.unregister(this.dispatcherRef)}updateChild(){this.updateChildPosition(this.child,this.childContainer),this.updateChildVisibility(this.child,!0)}renderApp(){const e=r.a.createElement(R.a.Provider,{value:lt.a.get()},r.a.createElement("div",{ref:this.collectChild,style:this.props.style},this.props.children));Ft.a.render(e,function(e){let t=us(e);return t||(t=document.createElement("div"),t.id=e,document.body.appendChild(t)),t}("mx_persistedElement_"+this.props.persistKey))}updateChildVisibility(e,t){e&&(e.style.display=t?"block":"none")}updateChildPosition(e,t){if(!e||!t)return;const a=t.getBoundingClientRect();Object.assign(e.style,{zIndex:Object(un.u)(this.props.zIndex)?9:this.props.zIndex,position:"absolute",top:"0",left:"0",transform:`translateX(${a.left}px) translateY(${a.top}px)`,width:a.width+"px",height:a.height+"px"})}render(){return r.a.createElement("div",{ref:this.collectChildContainer})}}function ps(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function gs(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?ps(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):ps(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}class vs extends r.a.Component{constructor(e){super(e),i()(this,"context",void 0),i()(this,"contextMenuButton",Object(s.createRef)()),i()(this,"iframe",void 0),i()(this,"allowedWidgetsWatchRef",void 0),i()(this,"persistKey",void 0),i()(this,"sgWidget",void 0),i()(this,"dispatcherRef",void 0),i()(this,"unmounted",void 0),i()(this,"watchUserReady",(()=>{ht.a.instance.isProfileInfoFetched||ht.a.instance.once(pt.b,this.onUserReady)})),i()(this,"onUserReady",(()=>{this.setState({isUserProfileReady:!0})})),i()(this,"hasPermissionToLoad",(e=>{var t;if(this.usingLocalWidget())return!0;if(!e.room)return!0;const a={approved:void 0};if(nn.a.instance.invoke(qa.WidgetLifecycle.PreLoadRequest,a,new Ln(this.props.app)),a.approved)return!0;const n=b.b.getValue("allowedWidgets",e.room.roomId);return void 0!==e.app.eventId&&null!==(t=n[e.app.eventId])&&void 0!==t&&t||e.userId===e.creatorUserId})),i()(this,"onMyMembership",((e,t)=>{var a;"leave"!==t&&"ban"!==t||e.roomId!==(null===(a=this.props.room)||void 0===a?void 0:a.roomId)||this.onUserLeftRoom()})),i()(this,"onAllowedWidgetsChange",(()=>{const e=this.hasPermissionToLoad(this.props);var t;this.state.hasPermissionToLoad&&!e&&(On.b.instance.destroyPersistentWidget(this.props.app.id,this.props.app.roomId),hs.destroyElement(this.persistKey),null===(t=this.sgWidget)||void 0===t||t.stopMessaging());this.setState({hasPermissionToLoad:e})})),i()(this,"iframeRefChange",(e=>{this.iframe=e,this.unmounted||(e?this.startMessaging():this.resetWidget(this.props))})),i()(this,"onWidgetPreparing",(()=>{this.setState({loading:!1})})),i()(this,"onWidgetCapabilitiesNotified",(()=>{this.setState({requiresClient:this.sgWidget.widgetApi.hasCapability(pn.a.RequiresClient)})})),i()(this,"onAction",(e=>{var t;switch(e.action){case"m.sticker":e.widgetId===this.props.app.id&&this.sgWidget.widgetApi.hasCapability(Ka.MatrixCapabilities.StickerSending)?(v.a.dispatch({action:"post_sticker_message",data:gs(gs({},e.data),{},{threadId:this.props.threadId})}),v.a.dispatch({action:"stickerpicker_close"})):ga.a.warn("Ignoring sticker message. Invalid capability");break;case U.a.AfterLeaveRoom:e.room_id===(null===(t=this.props.room)||void 0===t?void 0:t.roomId)&&this.onUserLeftRoom()}})),i()(this,"grantWidgetPermission",(()=>{var e;const t=null===(e=this.props.room)||void 0===e?void 0:e.roomId;ga.a.info("Granting permission for widget to load: "+this.props.app.eventId);const a=b.b.getValue("allowedWidgets",t);void 0!==this.props.app.eventId&&(a[this.props.app.eventId]=!0);const n=b.b.firstSupportedLevel("allowedWidgets");b.b.setValue("allowedWidgets",t,n,a).then((()=>{this.setState({hasPermissionToLoad:!0}),this.startWidget()})).catch((e=>{ga.a.error(e)}))})),i()(this,"onPopoutWidgetClick",(()=>{Qa.a.JITSI.matches(this.props.app.type)&&this.reload(),Object.assign(document.createElement("a"),{target:"_blank",href:this.sgWidget.popoutUrl,rel:"noreferrer noopener"}).click()})),i()(this,"onToggleMaximisedClick",(()=>{if(!this.props.room)return;const e=Xa.d.instance.isInContainer(this.props.room,this.props.app,Xa.a.Center)?Xa.a.Top:Xa.a.Center;Xa.d.instance.moveToContainer(this.props.room,this.props.app,e)})),i()(this,"onMinimiseClicked",(()=>{this.props.room&&Xa.d.instance.moveToContainer(this.props.room,this.props.app,Xa.a.Right)})),i()(this,"onContextMenuClick",(()=>{this.setState({menuDisplayed:!0})})),i()(this,"closeContextMenu",(()=>{this.setState({menuDisplayed:!1})})),this.props.miniMode||On.b.instance.dockWidget(this.props.app.id,this.props.app.roomId),this.persistKey="widget_"+Aa.a.getWidgetUid(this.props.app);try{this.sgWidget=new Un(this.props),this.setupSgListeners()}catch(e){ga.a.log("Failed to construct widget",e),this.sgWidget=null}this.state=this.getNewState(e)}onUserLeftRoom(){On.b.instance.getWidgetPersistence(this.props.app.id,this.props.app.roomId)&&(this.props.room&&rt.b.instance.roomViewStore.getRoomId()!==this.props.room.roomId?this.endWidgetActions():Qa.a.JITSI.matches(this.props.app.type)?this.reload():On.b.instance.destroyPersistentWidget(this.props.app.id,this.props.app.roomId))}determineInitialRequiresClientState(){try{const e=new Ln(this.props.app),t=$a.a.instance.getMessaging(e,this.props.room.roomId);if(t)return t.hasCapability(pn.a.RequiresClient)}catch{}return!0}getNewState(e){return{initialising:!0,loading:this.props.waitForIframeLoad&&!hs.isMounted(this.persistKey),hasPermissionToLoad:this.hasPermissionToLoad(e),isUserProfileReady:ht.a.instance.isProfileInfoFetched,error:null,menuDisplayed:!1,requiresClient:this.determineInitialRequiresClientState()}}isMixedContent(){const e=window.location.protocol,t=ls.a.parse(this.props.app.url).protocol;return"https:"===e&&"https:"!==t&&(ga.a.warn("Refusing to load mixed-content app:",e,t,window.location,this.props.app.url),!0)}componentDidMount(){this.sgWidget&&this.state.hasPermissionToLoad&&this.startWidget(),this.watchUserReady(),this.props.room&&this.context.on(te.d.MyMembership,this.onMyMembership),this.allowedWidgetsWatchRef=b.b.watchSetting("allowedWidgets",null,this.onAllowedWidgetsChange),this.dispatcherRef=v.a.register(this.onAction)}componentWillUnmount(){this.unmounted=!0,this.props.miniMode||On.b.instance.undockWidget(this.props.app.id,this.props.app.roomId),On.b.instance.isLive(this.props.app.id,this.props.app.roomId)||this.endWidgetActions(),this.dispatcherRef&&v.a.unregister(this.dispatcherRef),this.props.room&&this.context.off(te.d.MyMembership,this.onMyMembership),b.b.unwatchSetting(this.allowedWidgetsWatchRef),ht.a.instance.removeListener(pt.b,this.onUserReady)}setupSgListeners(){this.sgWidget.on("preparing",this.onWidgetPreparing),this.sgWidget.on("capabilitiesNotified",this.onWidgetCapabilitiesNotified)}stopSgListeners(){this.sgWidget&&(this.sgWidget.off("preparing",this.onWidgetPreparing),this.sgWidget.off("capabilitiesNotified",this.onWidgetCapabilitiesNotified))}resetWidget(e){var t;null===(t=this.sgWidget)||void 0===t||t.stopMessaging(),this.stopSgListeners();try{this.sgWidget=new Un(e),this.setupSgListeners(),this.startWidget()}catch(e){ga.a.error("Failed to construct widget",e),this.sgWidget=null}}startWidget(){this.sgWidget.prepare().then((()=>{this.unmounted||this.setState({initialising:!1})}))}startMessaging(){try{var e;null===(e=this.sgWidget)||void 0===e||e.startMessaging(this.iframe)}catch(e){ga.a.error("Failed to start widget",e)}}componentDidUpdate(e){e.app.url!==this.props.app.url&&(this.getNewState(this.props),this.state.hasPermissionToLoad&&this.resetWidget(this.props))}async endWidgetActions(){var e;this.iframe&&(this.iframe.src="about:blank"),Qa.a.JITSI.matches(this.props.app.type)&&this.props.room&&B.b.instance.hangupCallApp(this.props.room.roomId),hs.destroyElement(this.persistKey),On.b.instance.destroyPersistentWidget(this.props.app.id,this.props.app.roomId),null===(e=this.sgWidget)||void 0===e||e.stopMessaging({forceDestroy:!0})}formatAppTileName(){let e="No name";return this.props.app.name&&this.props.app.name.trim()&&(e=this.props.app.name.trim()),e}usingLocalWidget(){return Qa.a.JITSI.matches(this.props.app.type)}getTileTitle(){const e=this.formatAppTileName(),t=r.a.createElement("span",null," - ");let a="";return this.props.widgetPageTitle&&this.props.widgetPageTitle!==this.formatAppTileName()&&(a=this.props.widgetPageTitle),r.a.createElement("span",null,r.a.createElement(Va,{app:this.props.app}),r.a.createElement("b",null,e),r.a.createElement("span",null,a?t:"",a))}reload(){this.endWidgetActions().then((()=>{this.resetWidget(this.props),this.startMessaging(),this.iframe&&(this.iframe.src=this.sgWidget.embedUrl)}))}render(){let e;const t="mx_AppTileBody"+(this.props.miniMode?"_mini ":" "),a={};this.props.pointerEvents&&(a.pointerEvents=this.props.pointerEvents);const n=r.a.createElement("div",{className:"mx_AppLoading_spinner_fadeIn"},r.a.createElement(Kn.a,{message:Object(N.a)("Loading…")})),i=Aa.a.getWidgetName(this.props.app);if(null===this.sgWidget)e=r.a.createElement("div",{className:t,style:a},r.a.createElement(ms,{errorMsg:Object(N.a)("Error loading Widget")}));else if(this.state.hasPermissionToLoad){if(this.state.initialising||!this.state.isUserProfileReady)e=r.a.createElement("div",{className:t+(this.state.loading?"mx_AppLoading":""),style:a},n);else if(this.isMixedContent())e=r.a.createElement("div",{className:t,style:a},r.a.createElement(ms,{errorMsg:Object(N.a)("Error - Mixed content")}));else if(e=r.a.createElement("div",{className:t+(this.state.loading?"mx_AppLoading":""),style:a},this.state.loading&&n,r.a.createElement("iframe",{title:i,allow:"microphone; camera; encrypted-media; autoplay; display-capture; clipboard-write; clipboard-read;",ref:this.iframeRefChange,src:this.sgWidget.embedUrl,allowFullScreen:!0,sandbox:"allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-presentation allow-downloads"})),!this.props.userWidget){const t=101;e=r.a.createElement("div",{className:"mx_AppTile_persistedWrapper"},r.a.createElement(hs,{zIndex:this.props.miniMode?t:9,persistKey:this.persistKey,moveRef:this.props.movePersistedElement},e))}}else{const n=this.context.isRoomEncrypted(this.props.room.roomId);e=r.a.createElement("div",{className:t,style:a},r.a.createElement(ds,{roomId:this.props.room.roomId,creatorUserId:this.props.creatorUserId,url:this.sgWidget.embedUrl,isRoomEncrypted:n,onPermissionGranted:this.grantWidgetPermission}))}let s,o;s=this.props.miniMode?{mx_AppTile_mini:!0}:this.props.fullWidth?{mx_AppTileFullWidth:!0}:{mx_AppTile:!0},s=c()(s),this.state.menuDisplayed&&(o=r.a.createElement(Bn,Z()({},Object(ce.i)(this.contextMenuButton.current.getBoundingClientRect(),null),{app:this.props.app,onFinished:this.closeContextMenu,showUnpin:!this.props.userWidget,userWidget:this.props.userWidget,onEditClick:this.props.onEditClick,onDeleteClick:this.props.onDeleteClick})));const l=[];if(this.props.showLayoutButtons){const e=Xa.d.instance.isInContainer(this.props.room,this.props.app,Xa.a.Center),t=c()({mx_AppTileMenuBar_iconButton:!0,mx_AppTileMenuBar_iconButton_collapse:e,mx_AppTileMenuBar_iconButton_maximise:!e});l.push(r.a.createElement(G.a,{key:"toggleMaximised",className:t,title:e?Object(N.a)("Un-maximise"):Object(N.a)("Maximise"),onClick:this.onToggleMaximisedClick})),l.push(r.a.createElement(G.a,{key:"minimise",className:"mx_AppTileMenuBar_iconButton mx_AppTileMenuBar_iconButton_minimise",title:Object(N.a)("Minimise"),onClick:this.onMinimiseClicked}))}return r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:s,id:this.props.app.id},this.props.showMenubar&&r.a.createElement("div",{className:"mx_AppTileMenuBar"},r.a.createElement("span",{className:"mx_AppTileMenuBarTitle",style:{pointerEvents:this.props.handleMinimisePointerEvents?"all":"none"}},this.props.showTitle&&this.getTileTitle()),r.a.createElement("span",{className:"mx_AppTileMenuBarWidgets"},l,this.props.showPopout&&!this.state.requiresClient&&r.a.createElement(G.a,{className:"mx_AppTileMenuBar_iconButton mx_AppTileMenuBar_iconButton_popout",title:Object(N.a)("Popout widget"),onClick:this.onPopoutWidgetClick}),r.a.createElement(ce.b,{className:"mx_AppTileMenuBar_iconButton mx_AppTileMenuBar_iconButton_menu",label:Object(N.a)("Options"),isExpanded:this.state.menuDisplayed,inputRef:this.contextMenuButton,onClick:this.onContextMenuClick}))),e),o)}}i()(vs,"contextType",R.a),i()(vs,"defaultProps",{waitForIframeLoad:!0,showMenubar:!0,showTitle:!0,showPopout:!0,handleMinimisePointerEvents:!1,userWidget:!1,miniMode:!1,threadId:null,showLayoutButtons:!0});var bs=e=>{let{room:t,widgetId:a,onClose:n}=e;const i=Object(s.useContext)(R.a),o=Zi(t).find((e=>e.id===a)),l=o&&Xa.d.instance.isInContainer(t,o,Xa.a.Right),[c,d,m,u]=Object(ce.q)();if(Object(s.useEffect)((()=>{o&&l||Ia.a.instance.popCard()}),[o,l]),!o||!l)return null;let h;if(c){const e=d.current.getBoundingClientRect();h=r.a.createElement(Bn,{chevronFace:ce.a.None,right:Q.b.instance.windowWidth-e.right-12,top:e.bottom+12,onFinished:u,app:o})}const p=r.a.createElement("div",{className:"mx_BaseCard_header_title"},r.a.createElement(ra.a,{size:"h4",className:"mx_BaseCard_header_title_heading"},Aa.a.getWidgetName(o)),r.a.createElement(ce.b,{className:"mx_BaseCard_header_title_button--option",inputRef:d,onClick:m,isExpanded:c,label:Object(N.a)("Options")}),h);return r.a.createElement(Da,{header:p,className:"mx_WidgetCard",onClose:n,withoutScrollContainer:!0},r.a.createElement(vs,{app:o,fullWidth:!0,showMenubar:!1,room:t,userId:i.getUserId(),creatorUserId:o.creatorUserId,widgetPageTitle:Aa.a.getWidgetDataTitle(o),waitForIframeLoad:o.waitForIframeLoad}))},fs=a(222),ys=a(232),Es=a(558),_s=a(334),ws=a(625),Ss=a(870),Os=a(266);class Cs extends r.a.Component{constructor(e){super(e),i()(this,"userLastModifiedTime",void 0),i()(this,"memberLastModifiedTime",void 0),i()(this,"onRoomStateEvents",(e=>{if(e.getType()!==ee.b.RoomEncryption)return;const{roomId:t}=this.props.member;if(e.getRoomId()!==t)return;lt.a.get().removeListener(m.b.Events,this.onRoomStateEvents),this.setState({isRoomEncrypted:!0}),this.updateE2EStatus()})),i()(this,"onUserTrustStatusChanged",((e,t)=>{e===this.props.member.userId&&this.updateE2EStatus()})),i()(this,"onDeviceVerificationChanged",((e,t,a)=>{e===this.props.member.userId&&this.updateE2EStatus()})),i()(this,"onClick",(()=>{v.a.dispatch({action:U.a.ViewUser,member:this.props.member,push:!0})})),this.state={isRoomEncrypted:!1,e2eStatus:null}}componentDidMount(){const e=lt.a.get(),{roomId:t}=this.props.member;if(t){const a=e.isRoomEncrypted(t);this.setState({isRoomEncrypted:a}),a?(e.on(ya.b.UserTrustStatusChanged,this.onUserTrustStatusChanged),e.on(ya.b.DeviceVerificationChanged,this.onDeviceVerificationChanged),this.updateE2EStatus()):e.on(m.b.Events,this.onRoomStateEvents)}}componentWillUnmount(){const e=lt.a.get();e&&(e.removeListener(m.b.Events,this.onRoomStateEvents),e.removeListener(ya.b.UserTrustStatusChanged,this.onUserTrustStatusChanged),e.removeListener(ya.b.DeviceVerificationChanged,this.onDeviceVerificationChanged))}async updateE2EStatus(){const e=lt.a.get(),{userId:t}=this.props.member,a=t===e.getUserId(),n=e.checkUserTrust(t);if(!n.isCrossSigningVerified())return void this.setState({e2eStatus:n.wasCrossSigningVerified()?Os.a.Warning:Os.a.Normal});const i=e.getStoredDevicesForUser(t).some((n=>{const{deviceId:i}=n,s=e.checkDeviceTrust(t,i);return a?!s.isCrossSigningVerified():!s.isVerified()}));this.setState({e2eStatus:i?Os.a.Warning:Os.a.Verified})}shouldComponentUpdate(e,t){return void 0===this.memberLastModifiedTime||this.memberLastModifiedTime<e.member.getLastModifiedTime()||(!(!e.member.user||!(void 0===this.userLastModifiedTime||this.userLastModifiedTime<e.member.user.getLastModifiedTime()))||(t.isRoomEncrypted!==this.state.isRoomEncrypted||t.e2eStatus!==this.state.e2eStatus))}getDisplayName(){return this.props.member.name}getPowerLabel(){return Object(N.a)("%(userName)s (power %(powerLevelNumber)s)",{userName:vt.a.getDisplayUserIdentifier(this.props.member.userId,{roomId:this.props.member.roomId}),powerLevelNumber:this.props.member.powerLevel}).trim()}render(){var e,t;const a=this.props.member,n=this.getDisplayName(),i=null!==(e=null===(t=a.user)||void 0===t?void 0:t.presence)&&void 0!==e?e:null,s=r.a.createElement(Qn.b,{member:a,width:36,height:36,"aria-hidden":"true"});a.user&&(this.userLastModifiedTime=a.user.getLastModifiedTime()),this.memberLastModifiedTime=a.getLastModifiedTime();const o=new Map([[100,ws.a.Admin],[50,ws.a.Moderator]]);let l=this.props.member.powerLevel;for(const[e]of o)if(this.props.member.powerLevel>=e){l=e;break}const c=o.get(l);let d;this.state.isRoomEncrypted&&(d=this.state.e2eStatus);const m=r.a.createElement(Ss.a,{member:a,fallbackName:n||""});return r.a.createElement(ws.b,Z()({},this.props,{presenceState:i,presenceLastActiveAgo:a.user?a.user.lastActiveAgo:0,presenceLastTs:a.user?a.user.lastPresenceTs:0,presenceCurrentlyActive:!!a.user&&a.user.currentlyActive,avatarJsx:s,title:this.getPowerLabel(),name:n,nameJSX:m,powerStatus:c,showPresence:this.props.showPresence,e2eStatus:d,onClick:this.onClick}))}}i()(Cs,"defaultProps",{showPresence:!0});class xs extends r.a.Component{constructor(e,t){super(e),i()(this,"showPresence",void 0),i()(this,"mounted",!1),i()(this,"context",void 0),i()(this,"onUserPresenceChange",((e,t)=>{this.refs[t.userId]&&this.updateList()})),i()(this,"onRoom",(e=>{e.roomId===this.props.roomId&&this.updateListNow(!0)})),i()(this,"onMyMembership",((e,t,a)=>{e.roomId===this.props.roomId&&"join"===t&&"join"!==a&&this.updateListNow(!0)})),i()(this,"onRoomStateUpdate",(e=>{e.roomId===this.props.roomId&&this.updateList()})),i()(this,"onRoomMemberName",((e,t)=>{t.roomId===this.props.roomId&&this.updateList()})),i()(this,"onRoomStateEvent",(e=>{e.getRoomId()===this.props.roomId&&e.getType()===ee.b.RoomThirdPartyInvite&&this.updateList(),this.canInvite!==this.state.canInvite&&this.setState({canInvite:this.canInvite})})),i()(this,"updateList",Object(j.throttle)((()=>{this.updateListNow(!1)}),500,{leading:!0,trailing:!0})),i()(this,"createOverflowTileJoined",((e,t)=>this.createOverflowTile(e,t,this.showMoreJoinedMemberList))),i()(this,"createOverflowTileInvited",((e,t)=>this.createOverflowTile(e,t,this.showMoreInvitedMemberList))),i()(this,"createOverflowTile",((e,t,n)=>{const i=Object(N.a)("and %(count)s others...",{count:e});return r.a.createElement(ws.b,{className:"mx_EntityTile_ellipsis",avatarJsx:r.a.createElement(gt.a,{url:a(875).default,name:"...",width:36,height:36}),name:i,presenceState:"online",suppressOnHover:!0,onClick:n})})),i()(this,"showMoreJoinedMemberList",(()=>{this.setState({truncateAtJoined:this.state.truncateAtJoined+100})})),i()(this,"showMoreInvitedMemberList",(()=>{this.setState({truncateAtInvited:this.state.truncateAtInvited+100})})),i()(this,"onSearchQueryChanged",(e=>{this.props.onSearchQueryChanged(e)})),i()(this,"onPending3pidInviteClick",(e=>{v.a.dispatch({action:"view_3pid_invite",event:e})})),i()(this,"getChildrenJoined",((e,t)=>this.makeMemberTiles(this.state.filteredJoinedMembers.slice(e,t)))),i()(this,"getChildCountJoined",(()=>this.state.filteredJoinedMembers.length)),i()(this,"getChildrenInvited",((e,t)=>{let a=this.state.filteredInvitedMembers;return t>this.state.filteredInvitedMembers.length&&(a=a.concat(this.getPending3PidInvites())),this.makeMemberTiles(a.slice(e,t))})),i()(this,"getChildCountInvited",(()=>this.state.filteredInvitedMembers.length+(this.getPending3PidInvites()||[]).length)),i()(this,"onInviteButtonClick",(e=>{re.b.trackInteraction("WebRightPanelMemberListInviteButton",e),lt.a.get().isGuest()?v.a.dispatch({action:"require_registration"}):v.a.dispatch({action:"view_invite",roomId:this.props.roomId})})),this.state=this.getMembersState([],[]),this.showPresence=t.memberListStore.isPresenceEnabled(),this.mounted=!0,this.listenForMembersChanges()}listenForMembersChanges(){const e=lt.a.get();e.on(m.b.Update,this.onRoomStateUpdate),e.on(ka.b.Name,this.onRoomMemberName),e.on(m.b.Events,this.onRoomStateEvent),e.on(fs.b.LastPresenceTs,this.onUserPresenceChange),e.on(fs.b.Presence,this.onUserPresenceChange),e.on(fs.b.CurrentlyActive,this.onUserPresenceChange),e.on(o.b.Room,this.onRoom),e.on(te.d.MyMembership,this.onMyMembership)}componentDidMount(){this.updateListNow(!0)}componentWillUnmount(){this.mounted=!1;const e=lt.a.get();e&&(e.removeListener(m.b.Update,this.onRoomStateUpdate),e.removeListener(ka.b.Name,this.onRoomMemberName),e.removeListener(te.d.MyMembership,this.onMyMembership),e.removeListener(m.b.Events,this.onRoomStateEvent),e.removeListener(o.b.Room,this.onRoom),e.removeListener(fs.b.LastPresenceTs,this.onUserPresenceChange),e.removeListener(fs.b.Presence,this.onUserPresenceChange),e.removeListener(fs.b.CurrentlyActive,this.onUserPresenceChange)),this.updateList.cancel()}get canInvite(){const e=lt.a.get(),t=e.getRoom(this.props.roomId);return(null==t?void 0:t.canInvite(e.getUserId()))||(null==t?void 0:t.isSpaceRoom())&&t.getJoinRule()===_a.c.Public}getMembersState(e,t){return{loading:!1,filteredJoinedMembers:t,filteredInvitedMembers:e,canInvite:this.canInvite,truncateAtJoined:30,truncateAtInvited:5}}async updateListNow(e){if(!this.mounted)return;e&&this.setState({loading:!0});const{joined:t,invited:a}=await this.context.memberListStore.loadMemberList(this.props.roomId,this.props.searchQuery);this.mounted&&this.setState({loading:!1,filteredJoinedMembers:t,filteredInvitedMembers:a})}componentDidUpdate(e,t,a){e.searchQuery!==this.props.searchQuery&&this.updateListNow(!1)}getPending3PidInvites(){const e=lt.a.get().getRoom(this.props.roomId);if(e)return e.currentState.getStateEvents("m.room.third_party_invite").filter((function(t){if(!Object(ys.c)(t))return!1;return!e.currentState.getInviteForThreePidToken(t.getStateKey())}))}makeMemberTiles(e){return e.map((e=>e instanceof ka.a?r.a.createElement(Cs,{key:e.userId,member:e,ref:e.userId,showPresence:this.showPresence}):r.a.createElement(ws.b,{key:e.getStateKey(),name:e.getContent().display_name,suppressOnHover:!0,onClick:()=>this.onPending3pidInviteClick(e)})))}render(){if(this.state.loading)return r.a.createElement(Da,{className:"mx_MemberList",onClose:this.props.onClose},r.a.createElement(Kn.a,null));const e=lt.a.get().getRoom(this.props.roomId);let t,a,n;if("join"===(null==e?void 0:e.getMyMembership())&&Object(ae.a)(oe.a.InviteUsers)){let a=Object(N.a)("Invite to this room");e.isSpaceRoom()&&(a=Object(N.a)("Invite to this space")),t=r.a.createElement(G.a,{className:"mx_MemberList_invite",onClick:this.onInviteButtonClick,disabled:!this.state.canInvite},r.a.createElement("span",null,a))}this.getChildCountInvited()>0&&(a=r.a.createElement("h2",null,Object(N.a)("Invited")),n=r.a.createElement(Es.a,{className:"mx_MemberList_section mx_MemberList_invited",truncateAt:this.state.truncateAtInvited,createOverflowElement:this.createOverflowTileInvited,getChildren:this.getChildrenInvited,getChildCount:this.getChildCountInvited}));const i=r.a.createElement(_s.a,{className:"mx_MemberList_query mx_textinput_icon mx_textinput_search",placeholder:Object(N.a)("Filter room members"),onSearch:this.onSearchQueryChanged,initialValue:this.props.searchQuery});let s;return null!=e&&e.isSpaceRoom()&&(s=r.a.createElement("div",{className:"mx_RightPanel_scopeHeader"},r.a.createElement(ye.a,{room:e,height:32,width:32}),r.a.createElement(li.a,{room:e}))),r.a.createElement(Da,{className:"mx_MemberList",header:r.a.createElement(r.a.Fragment,null,s,t),footer:i,onClose:this.props.onClose},r.a.createElement("div",{className:"mx_MemberList_wrapper"},r.a.createElement(Es.a,{className:"mx_MemberList_section mx_MemberList_joined",truncateAt:this.state.truncateAtJoined,createOverflowElement:this.createOverflowTileJoined,getChildren:this.getChildrenJoined,getChildCount:this.getChildCountJoined}),a,n))}}i()(xs,"contextType",rt.a);var js=a(655),ks=a(525),Rs=a(652),Is=a(925),Ts=a(406),Ns=a(615),Ps=a(874),Ds=a(1509);class Ms extends r.a.Component{constructor(e){super(e),i()(this,"onOk",(e=>{e.preventDefault(),this.props.onFinished(!0,this.state.reason)})),i()(this,"onCancel",(()=>{this.props.onFinished(!1)})),i()(this,"onReasonChange",(e=>{this.setState({reason:e.target.value})})),this.state={reason:""}}render(){const e=this.props.danger?"danger":"";let t;this.props.askReason&&(t=r.a.createElement("form",{onSubmit:this.onOk},r.a.createElement(ci.a,{type:"text",onChange:this.onReasonChange,value:this.state.reason,className:"mx_ConfirmUserActionDialog_reasonField",label:Object(N.a)("Reason"),autoFocus:!0})));const a=r.a.createElement(Qn.b,{member:this.props.member,width:48,height:48}),n=this.props.member.name,i=this.props.member.userId,s=vt.a.getDisplayUserIdentifier(i,{roomId:this.props.roomId,withDisplayName:!0});return r.a.createElement(cn.a,{className:c()("mx_ConfirmUserActionDialog",this.props.className),onFinished:this.props.onFinished,title:this.props.title,contentId:"mx_Dialog_content"},r.a.createElement("div",{id:"mx_Dialog_content",className:"mx_Dialog_content"},r.a.createElement("div",{className:"mx_ConfirmUserActionDialog_user"},r.a.createElement("div",{className:"mx_ConfirmUserActionDialog_avatar"},a),r.a.createElement("div",{className:"mx_ConfirmUserActionDialog_name"},n),r.a.createElement("div",{className:"mx_ConfirmUserActionDialog_userId"},s)),t,this.props.children),r.a.createElement(dn.a,{primaryButton:this.props.action,onPrimaryButtonClick:this.onOk,primaryButtonClass:e,focus:!this.props.askReason,onCancel:this.onCancel}))}}i()(Ms,"defaultProps",{danger:!1,askReason:!1});var As=a(811);const Ls=["space","spaceChildFilter","allLabel","specificLabel","noneLabel","warningMessage","onFinished"];var Us=e=>{let{space:t,spaceChildFilter:a,allLabel:n,specificLabel:i,noneLabel:o,warningMessage:l,onFinished:c}=e,d=ve()(e,Ls);const m=Object(s.useMemo)((()=>{const e=$.a.instance.getChildren(t.roomId);return a?e.filter(a):e}),[t.roomId,a]),[u,h]=Object(s.useState)([]),p=Object(s.useMemo)((()=>new Set(u)),[u]);let g;return l&&(g=r.a.createElement("div",{className:"mx_ConfirmSpaceUserActionDialog_warning"},l)),r.a.createElement(Ms,Z()({},d,{onFinished:(e,t)=>{c(e,t,u)},className:"mx_ConfirmSpaceUserActionDialog",roomId:t.roomId}),g,r.a.createElement(As.a,{space:t,spaceChildren:m,selected:p,allLabel:n,specificLabel:i,noneLabel:o,onChange:h}))},Fs=a(405);const Bs=["user","room","onClose","phase"];function Vs(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function Ws(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?Vs(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):Vs(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}const Hs=e=>{const t=Object.create(null);for(let a=0;a<e.length;a++){const n=e[a].getDisplayName(),i=t[n]||[];i.push(a),t[n]=i}for(const a in t)t[a].length>1&&t[a].forEach((t=>{e[t].ambiguous=!0}))};function zs(e){var t;let{userId:a,device:n}=e;const i=Object(s.useContext)(R.a),o=a===i.getUserId(),l=i.checkDeviceTrust(a,n.deviceId),d=i.checkUserTrust(a),m=o?l.isCrossSigningVerified():l.isVerified(),u=c()("mx_UserInfo_device",{mx_UserInfo_device_verified:m,mx_UserInfo_device_unverified:!m}),h=c()("mx_E2EIcon",{mx_E2EIcon_normal:!d.isVerified(),mx_E2EIcon_verified:m,mx_E2EIcon_warning:d.isVerified()&&!m}),p=()=>{const e=i.getUser(a);e&&Object(Is.c)(e,n)};let g;g=null!==(t=n.getDisplayName())&&void 0!==t&&t.trim()?n.ambiguous?n.getDisplayName()+" ("+n.deviceId+")":n.getDisplayName():n.deviceId;let v=null;return d.isVerified()&&(v=m?Object(N.a)("Trusted"):Object(N.a)("Not trusted")),m?r.a.createElement("div",{className:u,title:n.deviceId},r.a.createElement("div",{className:h}),r.a.createElement("div",{className:"mx_UserInfo_device_name"},g),r.a.createElement("div",{className:"mx_UserInfo_device_trusted"},v)):r.a.createElement(G.a,{className:u,title:n.deviceId,onClick:p},r.a.createElement("div",{className:h}),r.a.createElement("div",{className:"mx_UserInfo_device_name"},g),r.a.createElement("div",{className:"mx_UserInfo_device_trusted"},v))}function Gs(e){let{devices:t,userId:a,loading:n}=e;const i=Object(s.useContext)(R.a),o=i.checkUserTrust(a),[l,c]=Object(s.useState)(!1);if(n)return r.a.createElement(Kn.a,null);if(null===t)return r.a.createElement("p",null,Object(N.a)("Unable to load session list"));const d=a===i.getUserId(),m=t.map((e=>i.checkDeviceTrust(a,e.deviceId)));let u=[];const h=[];let p,g,v,b="mx_E2EIcon";if(o.isVerified()){for(let e=0;e<t.length;++e){const a=t[e],n=m[e];(d?n.isCrossSigningVerified():n.isVerified())?u.push(a):h.push(a)}p=Object(N.a)("%(count)s verified sessions",{count:u.length}),g=Object(N.a)("Hide verified sessions"),b+=" mx_E2EIcon_verified"}else u=t,p=Object(N.a)("%(count)s sessions",{count:t.length}),g=Object(N.a)("Hide sessions"),b+=" mx_E2EIcon_normal";u.length&&(v=l?r.a.createElement(G.a,{kind:"link",className:"mx_UserInfo_expand",onClick:()=>c(!1)},r.a.createElement("div",null,g)):r.a.createElement(G.a,{kind:"link",className:"mx_UserInfo_expand",onClick:()=>c(!0)},r.a.createElement("div",{className:b}),r.a.createElement("div",null,p)));let f=h.map(((e,t)=>r.a.createElement(zs,{key:t,userId:a,device:e})));if(l){const e=h.length;f=f.concat(u.map(((t,n)=>r.a.createElement(zs,{key:n+e,userId:a,device:t}))))}return r.a.createElement("div",{className:"mx_UserInfo_devices"},r.a.createElement("div",null,f),r.a.createElement("div",null,v))}const Ks=e=>{let{member:t}=e;const a=Object(s.useContext)(R.a),[n,i]=Object(s.useState)(!1);return r.a.createElement(G.a,{kind:"link",onClick:async()=>{n||(i(!0),await async function(e,t){const a=t instanceof fs.a?t.avatarUrl:t.getMxcAvatarUrl(),n=new Fs.a({user_id:t.userId,display_name:t.rawDisplayName,avatar_url:a});await Object(Fs.e)(e,[n])}(a,t),i(!1))},className:"mx_UserInfo_field",disabled:n},Object(N.a)("Message"))},qs=e=>{let{member:t,isIgnored:a,canInvite:n,isSpace:i}=e;const o=Object(s.useContext)(R.a);let l=null,d=null,m=null,u=null;const h=t.userId===o.getUserId(),p=Object(s.useCallback)((()=>{const e=o.getIgnoredUsers(),a=e.indexOf(t.userId);-1!==a&&e.splice(a,1),o.setIgnoredUsers(e)}),[o,t]),g=Object(s.useCallback)((async()=>{const e=(t instanceof fs.a?t.displayName:t.name)||t.userId,{finished:a}=H.b.createDialog(Ya.a,{title:Object(N.a)("Ignore %(user)s",{user:e}),description:r.a.createElement("div",null,Object(N.a)("All messages and invites from this user will be hidden. Are you sure you want to ignore them?")),button:Object(N.a)("Ignore")}),[n]=await a;if(n){const e=o.getIgnoredUsers();e.push(t.userId),o.setIgnoredUsers(e)}}),[o,t]);if(!h){var b;if(l=r.a.createElement(G.a,{onClick:a?p:g,kind:"link",className:c()("mx_UserInfo_field",{mx_UserInfo_destructive:!a})},a?Object(N.a)("Unignore"):Object(N.a)("Ignore")),t instanceof ka.a&&t.roomId&&!i){const e=function(){const e=o.getRoom(t.roomId);v.a.dispatch({action:U.a.ViewRoom,highlighted:!0,event_id:(null==e?void 0:e.getEventReadUpTo(t.userId))||void 0,room_id:t.roomId,metricsTrigger:void 0})},a=function(){v.a.dispatch({action:U.a.ComposerInsert,userId:t.userId,timelineRenderingType:Ga.a.Room})},n=t instanceof ka.a?o.getRoom(t.roomId):void 0;null!=n&&n.getEventReadUpTo(t.userId)&&(u=r.a.createElement(G.a,{kind:"link",onClick:e,className:"mx_UserInfo_field"},Object(N.a)("Jump to read receipt"))),d=r.a.createElement(G.a,{kind:"link",onClick:a,className:"mx_UserInfo_field"},Object(N.a)("Mention"))}if(t instanceof ka.a&&n&&"leave"===(null!==(b=null==t?void 0:t.membership)&&void 0!==b?b:"leave")&&Object(ae.a)(oe.a.InviteUsers)){const e=t&&t.roomId?t.roomId:rt.b.instance.roomViewStore.getRoomId(),a=async a=>{try{const a=new js.a(e||"");await a.invite([t.userId]).then((()=>{if("invited"!==a.getCompletionState(t.userId))throw new Error(a.getErrorText(t.userId))}))}catch(e){const t=e instanceof Error?e.message:Object(N.a)("Operation failed");H.b.createDialog(Ja.a,{title:Object(N.a)("Failed to invite"),description:t})}re.b.trackInteraction("WebRightPanelRoomUserInfoInviteButton",a)};m=r.a.createElement(G.a,{kind:"link",onClick:a,className:"mx_UserInfo_field"},Object(N.a)("Invite"))}}const f=r.a.createElement(G.a,{kind:"link",onClick:()=>{H.b.createDialog(Ma.a,{target:t})},className:"mx_UserInfo_field"},Object(N.a)("Share Link to User")),y=h?null:r.a.createElement(Ks,{member:t});return r.a.createElement("div",{className:"mx_UserInfo_container"},r.a.createElement("h3",null,Object(N.a)("Options")),r.a.createElement("div",null,y,u,f,d,m,l))},$s=async e=>{const{finished:t}=H.b.createDialog(Ya.a,{title:Object(N.a)("Demote yourself?"),description:r.a.createElement("div",null,e?Object(N.a)("You will not be able to undo this change as you are demoting yourself, if you are the last privileged user in the space it will be impossible to regain privileges."):Object(N.a)("You will not be able to undo this change as you are demoting yourself, if you are the last privileged user in the room it will be impossible to regain privileges.")),button:Object(N.a)("Demote")}),[a]=await t;return a},Ys=e=>{let{children:t}=e;return r.a.createElement("div",{className:"mx_UserInfo_container"},r.a.createElement("h3",null,Object(N.a)("Admin Tools")),r.a.createElement("div",{className:"mx_UserInfo_buttons"},t))},Js=e=>{var t,a;return(null==e||null===(t=e.currentState)||void 0===t||null===(a=t.getStateEvents(ee.b.RoomPowerLevels,""))||void 0===a?void 0:a.getContent())||{}},Qs=e=>{let{room:t,member:a,startUpdating:n,stopUpdating:i}=e;const o=Object(s.useContext)(R.a);if("invite"!==a.membership&&"join"!==a.membership)return null;const l=t.isSpaceRoom()?"invite"===a.membership?Object(N.a)("Disinvite from space"):Object(N.a)("Remove from space"):"invite"===a.membership?Object(N.a)("Disinvite from room"):Object(N.a)("Remove from room");return r.a.createElement(G.a,{kind:"link",className:"mx_UserInfo_field mx_UserInfo_destructive",onClick:async()=>{const e={member:a,action:t.isSpaceRoom()?"invite"===a.membership?Object(N.a)("Disinvite from space"):Object(N.a)("Remove from space"):"invite"===a.membership?Object(N.a)("Disinvite from room"):Object(N.a)("Remove from room"),title:"invite"===a.membership?Object(N.a)("Disinvite from %(roomName)s",{roomName:t.name}):Object(N.a)("Remove from %(roomName)s",{roomName:t.name}),askReason:"join"===a.membership,danger:!0};let s;t.isSpaceRoom()?({finished:s}=H.b.createDialog(Us,Ws(Ws({},e),{},{space:t,spaceChildFilter:e=>{const t=e.getMember(o.credentials.userId||""),n=e.getMember(a.userId);return t&&n&&n.membership===a.membership&&t.powerLevel>n.powerLevel&&e.currentState.hasSufficientPowerLevelFor("kick",t.powerLevel)},allLabel:Object(N.a)("Remove them from everything I'm able to"),specificLabel:Object(N.a)("Remove them from specific things I'm able to"),warningMessage:Object(N.a)("They'll still be able to access whatever you're not an admin of.")}),"mx_ConfirmSpaceUserActionDialog_wrapper")):({finished:s}=H.b.createDialog(Ms,e));const[r,l,c=[]]=await s;r&&(n(),Object(le.a)(t,c,(e=>o.kick(e.roomId,a.userId,l||void 0))).then((()=>{ga.a.log("Kick success")}),(function(e){ga.a.error("Kick error: "+e),H.b.createDialog(Ja.a,{title:Object(N.a)("Failed to remove user"),description:e&&e.message?e.message:"Operation failed"})})).finally((()=>{i()})))}},l)},Xs=e=>{let{member:t}=e;const a=Object(s.useContext)(R.a);return r.a.createElement(G.a,{kind:"link",className:"mx_UserInfo_field mx_UserInfo_destructive",onClick:()=>{const e=a.getRoom(t.roomId);e&&H.b.createDialog(Ds.a,{matrixClient:a,room:e,member:t})}},Object(N.a)("Remove recent messages"))},Zs=e=>{let{room:t,member:a,startUpdating:n,stopUpdating:i}=e;const o=Object(s.useContext)(R.a),l="ban"===a.membership;let d=t.isSpaceRoom()?Object(N.a)("Ban from space"):Object(N.a)("Ban from room");l&&(d=t.isSpaceRoom()?Object(N.a)("Unban from space"):Object(N.a)("Unban from room"));const m=c()("mx_UserInfo_field",{mx_UserInfo_destructive:!l});return r.a.createElement(G.a,{kind:"link",className:m,onClick:async()=>{const e={member:a,action:t.isSpaceRoom()?l?Object(N.a)("Unban from space"):Object(N.a)("Ban from space"):l?Object(N.a)("Unban from room"):Object(N.a)("Ban from room"),title:l?Object(N.a)("Unban from %(roomName)s",{roomName:t.name}):Object(N.a)("Ban from %(roomName)s",{roomName:t.name}),askReason:!l,danger:!l};let s;t.isSpaceRoom()?({finished:s}=H.b.createDialog(Us,Ws(Ws({},e),{},{space:t,spaceChildFilter:l?e=>{const t=e.getMember(o.credentials.userId||""),n=e.getMember(a.userId);return t&&n&&"ban"===n.membership&&t.powerLevel>n.powerLevel&&e.currentState.hasSufficientPowerLevelFor("ban",t.powerLevel)}:e=>{const t=e.getMember(o.credentials.userId||""),n=e.getMember(a.userId);return t&&n&&"ban"!==n.membership&&t.powerLevel>n.powerLevel&&e.currentState.hasSufficientPowerLevelFor("ban",t.powerLevel)},allLabel:l?Object(N.a)("Unban them from everything I'm able to"):Object(N.a)("Ban them from everything I'm able to"),specificLabel:l?Object(N.a)("Unban them from specific things I'm able to"):Object(N.a)("Ban them from specific things I'm able to"),warningMessage:l?Object(N.a)("They won't be able to access whatever you're not an admin of."):Object(N.a)("They'll still be able to access whatever you're not an admin of.")}),"mx_ConfirmSpaceUserActionDialog_wrapper")):({finished:s}=H.b.createDialog(Ms,e));const[r,c,d=[]]=await s;if(!r)return;n();Object(le.a)(t,d,(e=>{return t=e.roomId,l?o.unban(t,a.userId):o.ban(t,a.userId,c||void 0);var t})).then((()=>{ga.a.log("Ban success")}),(function(e){ga.a.error("Ban error: "+e),H.b.createDialog(Ja.a,{title:Object(N.a)("Error"),description:Object(N.a)("Failed to ban user")})})).finally((()=>{i()}))}},d)},er=e=>{let{member:t,room:a,powerLevels:n,startUpdating:i,stopUpdating:o}=e;const l=Object(s.useContext)(R.a);if("join"!==t.membership)return null;const d=((e,t)=>{if(!t||!e)return!1;const a=(t.events?t.events["m.room.message"]:null)||t.events_default;return void 0!==a&&e.powerLevel<a})(t,n),m=c()("mx_UserInfo_field",{mx_UserInfo_destructive:!d}),u=d?Object(N.a)("Unmute"):Object(N.a)("Mute");return r.a.createElement(G.a,{kind:"link",className:m,onClick:async()=>{const e=t.roomId,n=t.userId;if(n===l.getUserId())try{if(!await $s(null==a?void 0:a.isSpaceRoom()))return}catch(e){return void ga.a.error("Failed to warn about self demotion: ",e)}const s=a.currentState.getStateEvents("m.room.power_levels","");if(!s)return;const r=s.getContent(),c=(r.events?r.events["m.room.message"]:null)||r.events_default;let m;m=d?c:c-1,m=parseInt(m),isNaN(m)||(i(),l.setPowerLevel(e,n,m,s).then((()=>{ga.a.log("Mute toggle success")}),(function(e){ga.a.error("Mute error: "+e),H.b.createDialog(Ja.a,{title:Object(N.a)("Error"),description:Object(N.a)("Failed to mute user")})})).finally((()=>{o()})))}},u)},tr=e=>{let{room:t,children:a,member:n,startUpdating:i,stopUpdating:o,powerLevels:l}=e;const c=Object(s.useContext)(R.a);let d,m,u,h;const p=(l.events?l.events["m.room.power_levels"]:null)||l.state_default,{ban:g=50,kick:v=50,redact:b=50}=l,f=t.getMember(c.getUserId()||"");if(!f)return r.a.createElement("div",null);const y=f.userId===n.userId,E=n.powerLevel<f.powerLevel||y;return!y&&E&&f.powerLevel>=v&&(d=r.a.createElement(Qs,{room:t,member:n,startUpdating:i,stopUpdating:o})),f.powerLevel>=b&&!t.isSpaceRoom()&&(h=r.a.createElement(Xs,{member:n,startUpdating:i,stopUpdating:o})),!y&&E&&f.powerLevel>=g&&(m=r.a.createElement(Zs,{room:t,member:n,startUpdating:i,stopUpdating:o})),!y&&E&&f.powerLevel>=Number(p)&&!t.isSpaceRoom()&&(u=r.a.createElement(er,{member:n,room:t,powerLevels:l,startUpdating:i,stopUpdating:o})),d||m||u||h||a?r.a.createElement(Ys,null,u,d,m,h,a):r.a.createElement("div",null)};const ar=e=>{let{user:t,room:a,roomPermissions:n,powerLevels:i}=e;if(n.canEdit)return r.a.createElement(nr,{user:t,room:a,roomPermissions:n});{const e=i.users_default||0,a=t.powerLevel,n=Object(ks.b)(a,e);return r.a.createElement("div",{className:"mx_UserInfo_profileField"},r.a.createElement("div",{className:"mx_UserInfo_roleDescription"},n))}},nr=e=>{let{user:t,room:a,roomPermissions:n}=e;const i=Object(s.useContext)(R.a),[o,l]=Object(s.useState)(t.powerLevel);Object(s.useEffect)((()=>{l(t.powerLevel)}),[t]);const c=Object(s.useCallback)((async e=>{l(e);const n=t.roomId,s=t.userId,o=a.currentState.getStateEvents("m.room.power_levels","");if(!o)return;const c=i.getUserId(),d=o.getContent().users[c||""];if(d&&parseInt(d)<=e&&c!==s){const{finished:e}=H.b.createDialog(Ya.a,{title:Object(N.a)("Warning!"),description:r.a.createElement("div",null,Object(N.a)("You will not be able to undo this change as you are promoting the user to have the same power level as yourself."),r.a.createElement("br",null),Object(N.a)("Are you sure?")),button:Object(N.a)("Continue")}),[t]=await e;if(!t)return}else if(c===s&&d&&parseInt(d)>e)try{if(!await $s(null==a?void 0:a.isSpaceRoom()))return}catch(e){ga.a.error("Failed to warn about self demotion: ",e)}await((e,t,a,n)=>i.setPowerLevel(e,t,a,n).then((function(){ga.a.log("Power change success")}),(function(e){ga.a.error("Failed to change power level "+e),H.b.createDialog(Ja.a,{title:Object(N.a)("Error"),description:Object(N.a)("Failed to change power level")})})))(n,s,e,o)}),[t.roomId,t.userId,i,a]),d=a.currentState.getStateEvents("m.room.power_levels",""),m=d?d.getContent().users_default:0;return r.a.createElement("div",{className:"mx_UserInfo_profileField"},r.a.createElement(Ns.a,{label:void 0,value:o,maxValue:n.modifyLevelMax,usersDefault:m,onChange:c}))},ir=e=>{let{room:t,member:a,devices:n,isRoomEncrypted:i}=e;const l=Object(s.useContext)(R.a),c=((e,t)=>{const[a,n]=Object(s.useState)(Js(t)),i=Object(s.useCallback)((e=>{t&&(e&&e.getType()!==ee.b.RoomPowerLevels||n(Js(t)))}),[t]);return Object(ie.c)(e,m.b.Events,i),Object(s.useEffect)((()=>(i(),()=>{n({})})),[i]),a})(l,t),d=(e=>{const[t,a]=Object(s.useState)(!1);return Object(s.useEffect)((()=>{e.isSynapseAdministrator().then((e=>{a(e)}),(()=>{a(!1)}))}),[e]),t})(l),[u,h]=Object(s.useState)(l.isUserIgnored(a.userId));Object(s.useEffect)((()=>{h(l.isUserIgnored(a.userId))}),[l,a.userId]);const p=Object(s.useCallback)((e=>{"m.ignored_user_list"===e.getType()&&h(l.isUserIgnored(a.userId))}),[l,a.userId]);Object(ie.c)(l,o.b.AccountData,p);const[g,b]=Object(s.useState)(0),f=Object(s.useCallback)((()=>{b(g+1)}),[g]),y=Object(s.useCallback)((()=>{b(g-1)}),[g]),E=function(e,t,a){const[n,i]=Object(s.useState)({modifyLevelMax:-1,canEdit:!1,canInvite:!1}),r=Object(s.useCallback)((()=>{var n,s;const r=null==t||null===(n=t.currentState.getStateEvents(ee.b.RoomPowerLevels,""))||void 0===n?void 0:n.getContent();if(!r)return;const o=t.getMember(e.getUserId()||"");if(!o)return;const l=a,c=o.userId===l.userId;let d=-1;if(l.powerLevel<o.powerLevel||c){var m,u,h;const e=null!==(m=null!==(u=null===(h=r.events)||void 0===h?void 0:h[ee.b.RoomPowerLevels])&&void 0!==u?u:r.state_default)&&void 0!==m?m:50;o.powerLevel>=e&&(d=o.powerLevel)}i({canInvite:o.powerLevel>=(null!==(s=r.invite)&&void 0!==s?s:0),canEdit:d>=0,modifyLevelMax:d})}),[e,a,t]);return Object(ie.c)(e,m.b.Update,r),Object(s.useEffect)((()=>(r(),()=>{i({modifyLevelMax:-1,canEdit:!1,canInvite:!1})})),[r]),n}(l,t,a),_=Object(s.useCallback)((async()=>{const{finished:e}=H.b.createDialog(Ya.a,{title:Object(N.a)("Deactivate user?"),description:r.a.createElement("div",null,Object(N.a)("Deactivating this user will log them out and prevent them from logging back in. Additionally, they will leave all the rooms they are in. This action cannot be reversed. Are you sure you want to deactivate this user?")),button:Object(N.a)("Deactivate user"),danger:!0}),[t]=await e;if(t)try{await l.deactivateSynapseUser(a.userId)}catch(e){ga.a.error("Failed to deactivate user"),ga.a.error(e);const t=e instanceof Error?e.message:Object(N.a)("Operation failed");H.b.createDialog(Ja.a,{title:Object(N.a)("Failed to deactivate user"),description:t})}}),[l,a.userId]);let w,S,O,C;d&&a.userId.endsWith(`:${lt.a.getHomeserverName()}`)&&(w=r.a.createElement(G.a,{kind:"link",className:"mx_UserInfo_field mx_UserInfo_destructive",onClick:_},Object(N.a)("Deactivate user"))),t&&a.roomId?(Ha.a.shared().getUserIdForRoomId(a.roomId)||(O=r.a.createElement("div",{className:"mx_UserInfo_container"},r.a.createElement("h3",null,Object(N.a)("Role in <RoomName/>",{},{RoomName:()=>r.a.createElement("b",null,t.name)})),r.a.createElement(ar,{powerLevels:c,user:a,room:t,roomPermissions:E}))),C=r.a.createElement(tr,{powerLevels:c,member:a,room:t,startUpdating:f,stopUpdating:y},w)):w&&(C=r.a.createElement(Ys,null,w)),g>0&&(S=r.a.createElement(Kn.a,null));const x=l.isCryptoEnabled();let j,k;i?t.isSpaceRoom()||(j=Object(N.a)("Messages in this room are end-to-end encrypted.")):x?t&&!t.isSpaceRoom()&&(j=Object(N.a)("Messages in this room are not end-to-end encrypted.")):j=Object(N.a)("This client does not support end-to-end encryption.");const I=(e=>Object(Yn.a)((async()=>e.doesServerSupportUnstableFeature("org.matrix.e2e_cross_signing")),[e],!1))(l),T=x&&l.checkUserTrust(a.userId),P=x&&T&&T.isCrossSigningVerified(),D=a.userId===l.getUserId(),M=x&&I&&!P&&!D&&n&&n.length>0,A=function(e,t,a,n){return Object(Yn.a)((async()=>{if(a){n(!0);try{await e.downloadKeys([t.userId]);const a=e.getStoredCrossSigningForUser(t.userId);return!(!a||!a.getId())}finally{n(!1)}}}),[e,t,a])}(l,a,M,(e=>{b((t=>t+(e?1:-1)))})),L=void 0===n;let F;M&&(void 0!==A?k=r.a.createElement("div",{className:"mx_UserInfo_container_verifyButton"},r.a.createElement(G.a,{kind:"link",className:"mx_UserInfo_field mx_UserInfo_verifyButton",onClick:()=>{A?Object(Is.d)(a):Object(Is.a)(a)}},Object(N.a)("Verify"))):L||(k=r.a.createElement(Kn.a,null))),a.userId==l.getUserId()&&(F=r.a.createElement("div",null,r.a.createElement(G.a,{kind:"link",className:"mx_UserInfo_field",onClick:()=>{v.a.dispatch({action:U.a.ViewUserDeviceSettings})}},Object(N.a)("Edit devices"))));const B=r.a.createElement("div",{className:"mx_UserInfo_container"},r.a.createElement("h3",null,Object(N.a)("Security")),r.a.createElement("p",null,j),k,x&&r.a.createElement(Gs,{loading:L,devices:n,userId:a.userId}),F);return r.a.createElement(r.a.Fragment,null,O,B,r.a.createElement(qs,{canInvite:E.canInvite,isIgnored:u,member:a,isSpace:null==t?void 0:t.isSpaceRoom()}),C,S)},sr=e=>{var t;let{member:a,e2eStatus:n,roomId:i}=e;const o=Object(s.useContext)(R.a),l=Object(s.useCallback)((()=>{const e=a.getMxcAvatarUrl?a.getMxcAvatarUrl():a.avatarUrl;if(!e)return;const t={src:Object(Fa.b)(e).srcHttp,name:a.name||a.displayName};H.b.createDialog(Ts.a,t,"mx_Dialog_lightbox",void 0,!0)}),[a]),c=a.avatarUrl,d=r.a.createElement("div",{className:"mx_UserInfo_avatar"},r.a.createElement("div",{className:"mx_UserInfo_avatar_transition"},r.a.createElement("div",{className:"mx_UserInfo_avatar_transition_child"},r.a.createElement(Qn.b,{key:a.userId,member:a,width:.6*Q.b.instance.windowHeight,height:.6*Q.b.instance.windowHeight,resizeMethod:"scale",fallbackUserId:a.userId,onClick:l,urls:c?[c]:void 0}))));let m,u,h;a instanceof ka.a&&a.user&&(m=a.user.presence,u=a.user.lastActiveAgo,h=a.user.currentlyActive);const p=mt.b.get("enable_presence_by_hs_url");let g=!0;p&&void 0!==p[o.baseUrl]&&(g=p[o.baseUrl]);let v=null;g&&(v=r.a.createElement(Ps.a,{activeAgo:u,currentlyActive:h,presenceState:m}));const b=n?r.a.createElement(Os.b,{size:18,status:n,isUser:!0}):null,f=a.rawDisplayName;return r.a.createElement(r.a.Fragment,null,d,r.a.createElement("div",{className:"mx_UserInfo_container mx_UserInfo_separator"},r.a.createElement("div",{className:"mx_UserInfo_profile"},r.a.createElement("div",null,r.a.createElement("h2",null,b,r.a.createElement("span",{title:f,"aria-label":f,dir:"auto"},f))),r.a.createElement("div",{className:"mx_UserInfo_profile_mxid"},null===(t=vt.a.getDisplayUserIdentifier)||void 0===t?void 0:t.call(vt.a,a.userId,{roomId:i,withDisplayName:!0})),r.a.createElement("div",{className:"mx_UserInfo_profileStatus"},v))))};var rr=e=>{let{user:t,room:a,onClose:n,phase:i=Ra.a.RoomMemberInfo}=e,o=ve()(e,Bs);const l=Object(s.useContext)(R.a),c=Object(s.useMemo)((()=>a&&a.getMember(t.userId)||t),[a,t]),d=Ta(l,a),m=(e=>{const t=Object(s.useContext)(R.a),[a,n]=Object(s.useState)(void 0);return Object(s.useEffect)((()=>{n(void 0);let a=!1;return async function(){try{await t.downloadKeys([e],!0);const i=t.getStoredDevicesForUser(e);if(a)return;Hs(i),n(i)}catch(e){n(null)}}(),()=>{a=!0}}),[t,e]),Object(s.useEffect)((()=>{let a=!1;const i=async()=>{const i=t.getStoredDevicesForUser(e);a||n(i)},s=t=>{t.includes(e)&&i()},r=(t,a)=>{t===e&&i()},o=(t,a)=>{t===e&&i()};return t.on(ya.b.DevicesUpdated,s),t.on(ya.b.DeviceVerificationChanged,r),t.on(ya.b.UserTrustStatusChanged,o),()=>{a=!0,t.removeListener(ya.b.DevicesUpdated,s),t.removeListener(ya.b.DeviceVerificationChanged,r),t.removeListener(ya.b.UserTrustStatusChanged,o)}}),[t,e]),a})(t.userId);let u;d&&m&&(u=((e,t,a)=>{const n=t===e.getUserId(),i=e.checkUserTrust(t);return i.isCrossSigningVerified()?a.some((a=>{const{deviceId:i}=a,s=e.checkDeviceTrust(t,i);return n?!s.isCrossSigningVerified():!s.isVerified()}))?za.Warning:za.Verified:i.wasCrossSigningVerified()?za.Warning:za.Normal})(l,t.userId,m));const h=["mx_UserInfo"];let p={};a&&i===Ra.a.EncryptionPanel?p={member:c}:null!=a&&a.isSpaceRoom()&&(p={spaceId:a.roomId});const g=()=>{Ia.a.instance.popCard()};let v,b,f;switch(i){case Ra.a.RoomMemberInfo:case Ra.a.SpaceMemberInfo:v=r.a.createElement(ir,{room:a,member:c,devices:m,isRoomEncrypted:Boolean(d)});break;case Ra.a.EncryptionPanel:h.push("mx_UserInfo_smallAvatar"),v=r.a.createElement(Rs.a,Z()({},o,{member:c,onClose:g,isRoomEncrypted:Boolean(d)}))}if(i===Ra.a.EncryptionPanel){const e=o.verificationRequest;e&&e.pending&&(b=Object(N.a)("Cancel"))}null!=a&&a.isSpaceRoom()&&(f=r.a.createElement("div",{"data-testid":"space-header",className:"mx_RightPanel_scopeHeader"},r.a.createElement(ye.a,{room:a,height:32,width:32}),r.a.createElement(li.a,{room:a})));const y=r.a.createElement(r.a.Fragment,null,f,r.a.createElement(sr,{member:c,e2eStatus:u,roomId:null==a?void 0:a.roomId}));return r.a.createElement(Da,{className:h.join(" "),header:y,onClose:n,closeLabel:b,cardState:p,onBack:e=>{Ia.a.instance.previousCard.phase===Ra.a.RoomMemberList&&re.b.trackInteraction("WebRightPanelRoomUserInfoBackButton",e)}},v)};class or extends r.a.Component{constructor(e){var t,a,n;super(e),i()(this,"room",void 0),i()(this,"onRoomStateEvents",(e=>{if(e.getType()===ee.b.RoomThirdPartyInvite&&e.getStateKey()===this.state.stateKey){const t=e.getContent().display_name,a={invited:Object(ys.c)(e)};t&&(a.displayName=t),this.setState(a)}})),i()(this,"onCancel",(()=>{v.a.dispatch({action:"view_3pid_invite",event:null})})),i()(this,"onKickClick",(()=>{lt.a.get().sendStateEvent(this.state.roomId,"m.room.third_party_invite",{},this.state.stateKey).catch((e=>{ga.a.error(e),this.setState({invited:!0}),H.b.createDialog(Ja.a,{title:Object(N.a)("Failed to revoke invite"),description:Object(N.a)("Could not revoke the invite. The server may be experiencing a temporary problem or you do not have sufficient permissions to revoke the invite.")})})),this.setState({invited:!1})})),this.room=lt.a.get().getRoom(this.props.event.getRoomId());const s=null===(t=this.room)||void 0===t?void 0:t.getMember(lt.a.get().getUserId()),r=null===(a=this.room)||void 0===a?void 0:a.currentState.getStateEvents("m.room.power_levels","");let o=r?r.getContent().kick:50;"number"!=typeof o&&(o=50);const l=null===(n=this.room)||void 0===n?void 0:n.getMember(this.props.event.getSender());this.state={stateKey:this.props.event.getStateKey(),roomId:this.props.event.getRoomId(),displayName:this.props.event.getContent().display_name,invited:!0,canKick:!!s&&s.powerLevel>o,senderName:l?l.name:this.props.event.getSender()}}componentDidMount(){lt.a.get().on(m.b.Events,this.onRoomStateEvents)}componentWillUnmount(){const e=lt.a.get();e&&e.removeListener(m.b.Events,this.onRoomStateEvents)}render(){var e;let t,a;return this.state.canKick&&this.state.invited&&(t=r.a.createElement("div",{className:"mx_MemberInfo_container"},r.a.createElement("h3",null,Object(N.a)("Admin Tools")),r.a.createElement("div",{className:"mx_MemberInfo_buttons"},r.a.createElement(G.a,{className:"mx_MemberInfo_field",onClick:this.onKickClick},Object(N.a)("Revoke invite"))))),null!==(e=this.room)&&void 0!==e&&e.isSpaceRoom()&&(a=r.a.createElement("div",{className:"mx_RightPanel_scopeHeader"},r.a.createElement(ye.a,{room:this.room,height:32,width:32}),r.a.createElement(li.a,{room:this.room}))),r.a.createElement("div",{className:"mx_MemberInfo",role:"tabpanel"},a,r.a.createElement("div",{className:"mx_MemberInfo_name"},r.a.createElement(G.a,{className:"mx_MemberInfo_cancel",onClick:this.onCancel,title:Object(N.a)("Close")}),r.a.createElement("h2",null,this.state.displayName)),r.a.createElement("div",{className:"mx_MemberInfo_container"},r.a.createElement("div",{className:"mx_MemberInfo_profile"},r.a.createElement("div",{className:"mx_MemberInfo_profileField"},Object(N.a)("Invited by %(sender)s",{sender:this.state.senderName})))),t)}}var lr=a(316);let cr;function dr(e){let{isRoomEncrypted:t,kind:a}=e;if(!t)return r.a.createElement(r.a.Fragment,null);if(lr.a.get())return r.a.createElement(r.a.Fragment,null);if(lr.a.error)return r.a.createElement("div",{className:"mx_SearchWarning"},Object(N.a)("Message search initialisation failed, check <a>your settings</a> for more information",{},{a:e=>r.a.createElement(G.a,{kind:"link_inline",onClick:e=>{e.preventDefault(),v.a.dispatch({action:U.a.ViewUserSettings,initialTabId:Ae.a.Security})}},e)}));const n=mt.b.get("brand"),i=mt.b.getObject("desktop_builds");let s,o;if(i.get("available")){o=r.a.createElement("img",{src:i.get("logo")});const e=i.get("url");switch(a){case cr.Files:s=Object(N.a)("Use the <a>Desktop app</a> to see all encrypted files",{},{a:t=>r.a.createElement("a",{href:e,target:"_blank",rel:"noreferrer noopener"},t)});break;case cr.Search:s=Object(N.a)("Use the <a>Desktop app</a> to search encrypted messages",{},{a:t=>r.a.createElement("a",{href:e,target:"_blank",rel:"noreferrer noopener"},t)})}}else switch(a){case cr.Files:s=Object(N.a)("This version of %(brand)s does not support viewing some encrypted files",{brand:n});break;case cr.Search:s=Object(N.a)("This version of %(brand)s does not support searching encrypted messages",{brand:n})}return s?r.a.createElement("div",{className:"mx_SearchWarning"},o,r.a.createElement("span",null,s)):(ga.a.warn("Unknown desktop builds warning kind: ",a),r.a.createElement(r.a.Fragment,null))}!function(e){e[e.Files=0]="Files",e[e.Search=1]="Search"}(cr||(cr={}));var mr=a(179),ur=a(516),hr=a(18),pr=a(618),gr=a(329),vr=a(649),br=a(468);const fr=function(){if(b.b.getValue("debug_timeline_panel")){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];ga.a.log.call(console,"TimelinePanel debuglog:",...t)}};class yr extends r.a.Component{constructor(e,t){var a;super(e,t),i()(this,"context",void 0),i()(this,"lastRRSentEventId",void 0),i()(this,"lastRMSentEventId",void 0),i()(this,"messagePanel",Object(s.createRef)()),i()(this,"dispatcherRef",void 0),i()(this,"timelineWindow",void 0),i()(this,"overlayTimelineWindow",void 0),i()(this,"unmounted",!1),i()(this,"readReceiptActivityTimer",null),i()(this,"readMarkerActivityTimer",null),i()(this,"callEventGroupers",new Map),i()(this,"onDumpDebugLogs",(()=>{var e,t,a,n,i;const s=null===(e=this.props.timelineSet)||void 0===e?void 0:e.room,r=null===(t=this.state)||void 0===t||null===(a=t.events)||void 0===a?void 0:a.map((e=>e.getId()));let o,l,c;try{const e=this.messagePanel.current;if(e){const t=Ft.a.findDOMNode(e);if(t){o=[...t.querySelectorAll("[data-event-id]")].map((e=>e.getAttribute("data-event-id")))}}}catch(e){ga.a.error("onDumpDebugLogs: Failed to get the actual event ID's in the DOM",e)}const d={};if(s){const e=s.getTimelineSets(),t=s.threadsTimelineSets;try{l=Er(e),c=Er(t)}catch(e){ga.a.error("onDumpDebugLogs: Failed to serialize event IDs from timelinesets",e)}try{s.getThreads().forEach((e=>{var t,a;d[e.id]={events:e.events.map((e=>e.getId())),numTimelines:e.timelineSet.getTimelines().length,liveTimeline:e.timelineSet.getLiveTimeline().getEvents().length,prevTimeline:null===(t=e.timelineSet.getLiveTimeline().getNeighbouringTimeline(mr.a.Backward))||void 0===t?void 0:t.getEvents().length,nextTimeline:null===(a=e.timelineSet.getLiveTimeline().getNeighbouringTimeline(mr.a.Forward))||void 0===a?void 0:a.getEvents().length}}))}catch(e){ga.a.error("onDumpDebugLogs: Failed to serialize event IDs from the threads",e)}}let m,u;try{m=this.timelineWindow.getEvents().map((e=>e.getId()))}catch(e){ga.a.error("onDumpDebugLogs: Failed to get event IDs from the timelineWindow",e)}try{u=this.props.timelineSet.getPendingEvents().map((e=>e.getId()))}catch(e){ga.a.error("onDumpDebugLogs: Failed to get pending event IDs",e)}ga.a.debug(`TimelinePanel(${this.context.timelineRenderingType}): Debugging info for ${null==s?void 0:s.roomId}\n\tevents(${r.length})=${JSON.stringify(r)}\n\trenderedEventIds(${null!==(n=null===(i=o)||void 0===i?void 0:i.length)&&void 0!==n?n:0})=${JSON.stringify(o)}\n\tserializedEventIdsFromTimelineSets=${JSON.stringify(l)}\n\tserializedEventIdsFromThreadsTimelineSets=${JSON.stringify(c)}\n\tserializedThreadsMap=${JSON.stringify(d)}\n\ttimelineWindowEventIds(${m.length})=${JSON.stringify(m)}\n\tpendingEventIds(${u.length})=${JSON.stringify(u)}`)})),i()(this,"onMessageListUnfillRequest",((e,t)=>{const a=e?mr.b.BACKWARDS:mr.b.FORWARDS;fr("unpaginating events in direction",a);const n=t,i=this.state.events.findIndex((e=>e.getId()===n)),s=e?i+1:this.state.events.length-i;if(s>0){fr("Unpaginating",s,"in direction",a),this.timelineWindow.unpaginate(s,e);const{events:t,liveEvents:n,firstVisibleEventIndex:i}=this.getEvents();this.buildLegacyCallEventGroupers(t);const r={events:t,liveEvents:n,firstVisibleEventIndex:i};e?r.canBackPaginate=!0:r.canForwardPaginate=!0,this.setState(r)}})),i()(this,"onPaginationRequest",((e,t,a)=>this.props.onPaginationRequest?this.props.onPaginationRequest(e,t,a):e.paginate(t,a))),i()(this,"onMessageListFillRequest",(e=>{if(!this.shouldPaginate())return Promise.resolve(!1);const t=e?mr.b.BACKWARDS:mr.b.FORWARDS,a=e?"canBackPaginate":"canForwardPaginate",n=e?"backPaginating":"forwardPaginating";return this.state[a]?this.timelineWindow.canPaginate(t)?e&&0!==this.state.firstVisibleEventIndex?(fr("won't",t,"paginate past first visible event"),Promise.resolve(!1)):(fr("Initiating paginate; backwards:"+e),this.setState({[n]:!0}),this.onPaginationRequest(this.timelineWindow,t,20).then((t=>{if(this.unmounted)return;fr("paginate complete backwards:"+e+"; success:"+t);const{events:i,liveEvents:s,firstVisibleEventIndex:r}=this.getEvents();this.buildLegacyCallEventGroupers(i);const o={[n]:!1,[a]:t,events:i,liveEvents:s,firstVisibleEventIndex:r},l=e?mr.b.FORWARDS:mr.b.BACKWARDS,c=e?"canForwardPaginate":"canBackPaginate";return!this.state[c]&&this.timelineWindow.canPaginate(l)&&(fr("can now",l,"paginate again"),o[c]=!0),new Promise((a=>{this.setState(o,(()=>{a(t&&(!e||0===r))}))}))}))):(fr("can't",t,"paginate any further"),this.setState({[a]:!1}),Promise.resolve(!1)):(fr("have given up",t,"paginating this timeline"),Promise.resolve(!1))})),i()(this,"onMessageListScroll",(e=>{var t,a;null===(t=(a=this.props).onScroll)||void 0===t||t.call(a,e),this.props.manageReadMarkers&&this.doManageReadMarkers()})),i()(this,"doManageReadMarkers",Object(j.debounce)((()=>{var e;const t=this.getReadMarkerPosition();t<0&&this.setState({readMarkerVisible:!0});const a=this.readMarkerTimeout(t);null===(e=this.readMarkerActivityTimer)||void 0===e||e.changeTimeout(a)}),100,{leading:!1,trailing:!0})),i()(this,"onAction",(e=>{switch(e.action){case"ignore_state_changed":this.forceUpdate();break;case U.a.DumpDebugLogs:this.onDumpDebugLogs()}})),i()(this,"onRoomTimeline",((e,t,a,n,i)=>{var s;i.timeline.getTimelineSet()!==this.props.timelineSet&&i.timeline.getTimelineSet()!==this.props.overlayTimelineSet||(Ea.e.hasServerSideSupport||this.context.timelineRenderingType!==Ga.a.Thread||(a&&!this.state.canBackPaginate&&this.setState({canBackPaginate:!0}),a||this.state.canForwardPaginate||this.setState({canForwardPaginate:!0})),!a&&i&&i.liveEvent&&null!==(s=this.messagePanel.current)&&void 0!==s&&s.getScrollState()&&(this.messagePanel.current.getScrollState().stuckAtBottom?this.timelineWindow.paginate(mr.b.FORWARDS,1,!1).then((()=>{if(this.overlayTimelineWindow)return this.overlayTimelineWindow.paginate(mr.b.FORWARDS,1,!1)})).then((()=>{if(this.unmounted)return;const{events:t,liveEvents:a,firstVisibleEventIndex:n}=this.getEvents();this.buildLegacyCallEventGroupers(t);const i=a[a.length-1],s={events:t,liveEvents:a,firstVisibleEventIndex:n};let r=!1;if(this.props.manageReadMarkers){const t=lt.a.get().credentials.userId;if(r=!1,e.getSender()===t||pr.a.sharedInstance().userActiveRecently()){if(i&&0===this.getReadMarkerPosition()){var o;this.setReadMarker(null!==(o=i.getId())&&void 0!==o?o:null,i.getTs(),!0),s.readMarkerVisible=!1,s.readMarkerEventId=i.getId(),r=!0}}else s.readMarkerVisible=!0}this.setState(s,(()=>{var e,t,a;(null===(e=this.messagePanel.current)||void 0===e||e.updateTimelineMinHeight(),r)&&(null===(t=(a=this.props).onReadMarkerUpdated)||void 0===t||t.call(a))}))})):this.setState({canForwardPaginate:!0})))})),i()(this,"onRoomTimelineReset",((e,t)=>{t===this.props.timelineSet&&this.messagePanel.current&&this.messagePanel.current.isAtBottom()&&this.loadTimeline()})),i()(this,"canResetTimeline",(()=>{var e,t;return null===(e=this.messagePanel)||void 0===e||null===(t=e.current)||void 0===t?void 0:t.isAtBottom()})),i()(this,"onRoomRedaction",((e,t)=>{this.unmounted||t===this.props.timelineSet.room&&this.forceUpdate()})),i()(this,"onThreadUpdate",(e=>{var t,a;if(this.unmounted)return;if(e.roomId!==(null===(t=this.props.timelineSet.room)||void 0===t?void 0:t.roomId))return;const n=null===(a=this.messagePanel.current)||void 0===a?void 0:a.getTileForEventId(e.id);n&&n.forceUpdate()})),i()(this,"onEventVisibilityChange",(e=>{var t,a;if(this.unmounted)return;if(e.getRoomId()!==(null===(t=this.props.timelineSet.room)||void 0===t?void 0:t.roomId))return;const n=null===(a=this.messagePanel.current)||void 0===a?void 0:a.getTileForEventId(e.getId());n&&n.forceUpdate()})),i()(this,"onVisibilityPowerLevelChange",((e,t)=>{var a,n;if(!this.unmounted&&t.roomId===(null===(a=this.props.timelineSet.room)||void 0===a?void 0:a.roomId)&&t.userId==(null===(n=lt.a.get().credentials)||void 0===n?void 0:n.userId)){for(const e of this.state.events){var i;const t=null===(i=this.messagePanel.current)||void 0===i?void 0:i.getTileForEventId(e.getId());t&&t.forceUpdate()}this.forceUpdate()}})),i()(this,"onEventReplaced",(e=>{var t;this.unmounted||e.getRoomId()===(null===(t=this.props.timelineSet.room)||void 0===t?void 0:t.roomId)&&this.forceUpdate()})),i()(this,"onRoomReceipt",((e,t)=>{this.unmounted||t===this.props.timelineSet.room&&this.forceUpdate()})),i()(this,"onLocalEchoUpdated",((e,t,a)=>{this.unmounted||t===this.props.timelineSet.room&&this.reloadEvents()})),i()(this,"onAccountData",((e,t)=>{this.unmounted||t===this.props.timelineSet.room&&e.getType()===ee.b.FullyRead&&this.setState({readMarkerEventId:e.getContent().event_id},this.props.onReadMarkerUpdated)})),i()(this,"onEventDecrypted",(e=>{this.props.timelineSet.room&&e.getRoomId()===this.props.timelineSet.room.roomId&&this.state.events.includes(e)&&(this.recheckFirstVisibleEventIndex(),this.buildLegacyCallEventGroupers(this.state.events),this.forceUpdate())})),i()(this,"onSync",((e,t,a)=>{this.unmounted||this.setState({clientSyncState:e})})),i()(this,"recheckFirstVisibleEventIndex",Object(j.throttle)((()=>{const e=this.checkForPreJoinUISI(this.state.events);e!==this.state.firstVisibleEventIndex&&this.setState({firstVisibleEventIndex:e})}),500,{leading:!0,trailing:!0})),i()(this,"sendReadReceipt",(()=>{var e;if(b.b.getValue("lowBandwidth"))return;if(!this.messagePanel.current)return;if(!this.props.manageReadReceipts)return;const t=lt.a.get();if(!t||t.isGuest())return;let a=!0;const n=this.getCurrentReadReceipt(!0),i=this.indexForEventId(n);n&&null===i&&this.timelineWindow.canPaginate(mr.b.FORWARDS)&&(a=!1);const s=this.getLastDisplayedEventIndex({ignoreOwn:!0});null===s&&(a=!1);let r=this.state.events[null!=s?s:0];a=a&&s>i&&this.lastRRSentEventId!==(null===(e=r)||void 0===e?void 0:e.getId());const o=this.lastRMSentEventId!=this.state.readMarkerEventId;if(a||o){var l,c,d;if(a)this.lastRRSentEventId=null===(d=r)||void 0===d?void 0:d.getId();else r=null;this.lastRMSentEventId=this.state.readMarkerEventId;const e=this.props.timelineSet.room.roomId,n=b.b.getValue("sendReadReceipts",e);var m,u,h;if(fr(`Sending Read Markers for ${this.props.timelineSet.room.roomId}: `,`rm=${this.state.readMarkerEventId} `,`rr=${n?null===(l=r)||void 0===l?void 0:l.getId():null} `,`prr=${null===(c=r)||void 0===c?void 0:c.getId()}`),this.props.timelineSet.thread&&n&&r)t.sendReadReceipt(r,n?hr.b.Read:hr.b.ReadPrivate);else t.setRoomReadMarkers(e,null!==(m=this.state.readMarkerEventId)&&void 0!==m?m:"",n&&null!==(u=r)&&void 0!==u?u:void 0,null!==(h=r)&&void 0!==h?h:void 0).catch((async e=>{if("M_UNRECOGNIZED"===e.errcode&&r){if(!n&&!await t.doesServerSupportUnstableFeature("org.matrix.msc2285.stable")&&!await t.isVersionSupported("v1.4"))return;try{return void await t.sendReadReceipt(r,n?hr.b.Read:hr.b.ReadPrivate)}catch(t){ga.a.error(e),this.lastRRSentEventId=void 0}}else ga.a.error(e);this.lastRRSentEventId=void 0,this.lastRMSentEventId=void 0})),this.isAtEndOfLiveTimeline()&&(this.props.timelineSet.room.setUnreadNotificationCount(te.b.Total,0),this.props.timelineSet.room.setUnreadNotificationCount(te.b.Highlight,0),v.a.dispatch({action:"on_room_read",roomId:this.props.timelineSet.room.roomId}))}})),i()(this,"updateReadMarker",(()=>{if(!this.props.manageReadMarkers)return;if(1===this.getReadMarkerPosition())return;const e=this.getLastDisplayedEventIndex({allowPartial:!0});if(null===e)return;const t=this.state.events[e];this.setReadMarker(t.getId(),t.getTs()),this.state.readMarkerVisible&&this.setState({readMarkerVisible:!1}),this.sendReadReceipt()})),i()(this,"jumpToLiveTimeline",(()=>{var e;this.timelineWindow.canPaginate(mr.b.FORWARDS)?this.loadTimeline():null===(e=this.messagePanel.current)||void 0===e||e.scrollToBottom()})),i()(this,"scrollToEventIfNeeded",(e=>{var t;null===(t=this.messagePanel.current)||void 0===t||t.scrollToEventIfNeeded(e)})),i()(this,"jumpToReadMarker",(()=>{if(!this.props.manageReadMarkers)return;if(!this.messagePanel.current)return;if(!this.state.readMarkerEventId)return;null===this.messagePanel.current.getReadMarkerPosition()?this.loadTimeline(this.state.readMarkerEventId,0,1/3):this.messagePanel.current.scrollToEvent(this.state.readMarkerEventId,0,1/3)})),i()(this,"forgetReadMarker",(()=>{if(!this.props.manageReadMarkers)return;const e=this.getCurrentReadReceipt(),t=this.props.timelineSet.getTimelineForEvent(null!=e?e:"");let a;if(t){const n=t.getEvents().find((t=>t.getId()==e));n&&(a=n.getTs())}this.setReadMarker(e,a),this.sendReadReceipt()})),i()(this,"isAtEndOfLiveTimeline",(()=>{var e;return(null===(e=this.messagePanel.current)||void 0===e?void 0:e.isAtBottom())&&this.timelineWindow&&!this.timelineWindow.canPaginate(mr.b.FORWARDS)})),i()(this,"getScrollState",(()=>this.messagePanel.current?this.messagePanel.current.getScrollState():null)),i()(this,"getReadMarkerPosition",(()=>{if(!this.props.manageReadMarkers)return null;if(!this.messagePanel.current)return null;const e=this.messagePanel.current.getReadMarkerPosition();if(null!==e)return e;const t=yr.roomReadMarkerTsMap[this.props.timelineSet.room.roomId];return t&&this.state.events.length>0?t<this.state.events[0].getTs()?-1:1:null})),i()(this,"canJumpToReadMarker",(()=>{const e=this.getReadMarkerPosition();return null!==this.state.readMarkerEventId&&(e<0||null===e)})),i()(this,"handleScrollKey",(e=>{if(!this.messagePanel.current)return;Object(J.a)().getRoomAction(e)===W.h.JumpToLatestMessage?this.jumpToLiveTimeline():this.messagePanel.current.handleScrollKey(e)})),i()(this,"getRelationsForEvent",((e,t,a)=>{var n;return null===(n=this.props.timelineSet.relations)||void 0===n?void 0:n.getChildEventsForEvent(e,t,a)})),this.context=t,fr("mounting");let n=null;if(this.props.manageReadMarkers){const e=this.props.timelineSet.room.getAccountData("m.fully_read");n=e?e.getContent().event_id:this.getCurrentReadReceipt()}this.state={events:[],liveEvents:[],timelineLoading:!0,firstVisibleEventIndex:0,canBackPaginate:!1,canForwardPaginate:!1,readMarkerVisible:!0,readMarkerEventId:n,backPaginating:!1,forwardPaginating:!1,clientSyncState:lt.a.get().getSyncState(),isTwelveHour:b.b.getValue("showTwelveHourTimestamps"),alwaysShowTimestamps:b.b.getValue("alwaysShowTimestamps"),readMarkerInViewThresholdMs:b.b.getValue("readMarkerInViewThresholdMs"),readMarkerOutOfViewThresholdMs:b.b.getValue("readMarkerOutOfViewThresholdMs")},this.dispatcherRef=v.a.register(this.onAction);const r=lt.a.get();r.on(te.d.Timeline,this.onRoomTimeline),r.on(te.d.TimelineReset,this.onRoomTimelineReset),r.on(te.d.Redaction,this.onRoomRedaction),b.b.getValue("feature_msc3531_hide_messages_pending_moderation")&&(r.on(fa.c.VisibilityChange,this.onEventVisibilityChange),r.on(ka.b.PowerLevel,this.onVisibilityPowerLevelChange)),r.on(te.d.RedactionCancelled,this.onRoomRedaction),r.on(te.d.Receipt,this.onRoomReceipt),r.on(te.d.LocalEchoUpdated,this.onLocalEchoUpdated),r.on(te.d.AccountData,this.onAccountData),r.on(fa.c.Decrypted,this.onEventDecrypted),r.on(fa.c.Replaced,this.onEventReplaced),r.on(o.b.Sync,this.onSync),null===(a=this.props.timelineSet.room)||void 0===a||a.on(Ea.f.Update,this.onThreadUpdate)}componentDidMount(){this.props.manageReadReceipts&&this.updateReadReceiptOnUserActivity(),this.props.manageReadMarkers&&this.updateReadMarkerOnUserActivity(),this.initTimeline(this.props)}componentDidUpdate(e){var t,a;e.timelineSet!==this.props.timelineSet&&ga.a.warn("Replacing timelineSet on a TimelinePanel - confusion may ensue"),null===(t=this.props.timelineSet.room)||void 0===t||t.off(Ea.f.Update,this.onThreadUpdate),null===(a=this.props.timelineSet.room)||void 0===a||a.on(Ea.f.Update,this.onThreadUpdate);const n=e.eventId!=this.props.eventId,i=e.highlightedEventId!=this.props.highlightedEventId,s=e.eventScrollIntoView&&!this.props.eventScrollIntoView,r=e.overlayTimelineSet!==this.props.overlayTimelineSet;n||i||s?(ga.a.log(`TimelinePanel switching to eventId ${this.props.eventId} (was ${e.eventId}), scrollIntoView: ${this.props.eventScrollIntoView} (was ${e.eventScrollIntoView})`),this.initTimeline(this.props)):r&&(ga.a.log("TimelinePanel updating overlay timeline."),this.initTimeline(this.props))}componentWillUnmount(){this.unmounted=!0,this.readReceiptActivityTimer&&(this.readReceiptActivityTimer.abort(),this.readReceiptActivityTimer=null),this.readMarkerActivityTimer&&(this.readMarkerActivityTimer.abort(),this.readMarkerActivityTimer=null),v.a.unregister(this.dispatcherRef);const e=lt.a.get();var t;e&&(e.removeListener(te.d.Timeline,this.onRoomTimeline),e.removeListener(te.d.TimelineReset,this.onRoomTimelineReset),e.removeListener(te.d.Redaction,this.onRoomRedaction),e.removeListener(te.d.RedactionCancelled,this.onRoomRedaction),e.removeListener(te.d.Receipt,this.onRoomReceipt),e.removeListener(te.d.LocalEchoUpdated,this.onLocalEchoUpdated),e.removeListener(te.d.AccountData,this.onAccountData),e.removeListener(ka.b.PowerLevel,this.onVisibilityPowerLevelChange),e.removeListener(fa.c.Decrypted,this.onEventDecrypted),e.removeListener(fa.c.Replaced,this.onEventReplaced),e.removeListener(fa.c.VisibilityChange,this.onEventVisibilityChange),e.removeListener(o.b.Sync,this.onSync),null===(t=this.props.timelineSet.room)||void 0===t||t.removeListener(Ea.f.Update,this.onThreadUpdate))}readMarkerTimeout(e){var t,a,n,i;return 0===e?null!==(t=null===(a=this.context)||void 0===a?void 0:a.readMarkerInViewThresholdMs)&&void 0!==t?t:this.state.readMarkerInViewThresholdMs:null!==(n=null===(i=this.context)||void 0===i?void 0:i.readMarkerOutOfViewThresholdMs)&&void 0!==n?n:this.state.readMarkerOutOfViewThresholdMs}async updateReadMarkerOnUserActivity(){const e=this.readMarkerTimeout(this.getReadMarkerPosition());for(this.readMarkerActivityTimer=new gr.a(e);this.readMarkerActivityTimer;){pr.a.sharedInstance().timeWhileActiveRecently(this.readMarkerActivityTimer);try{await this.readMarkerActivityTimer.finished()}catch(e){continue}this.updateReadMarker()}}async updateReadReceiptOnUserActivity(){for(this.readReceiptActivityTimer=new gr.a(500);this.readReceiptActivityTimer;){pr.a.sharedInstance().timeWhileActiveNow(this.readReceiptActivityTimer);try{await this.readReceiptActivityTimer.finished()}catch(e){continue}this.sendReadReceipt()}}advanceReadMarkerPastMyEvents(){if(!this.props.manageReadMarkers)return;const e=this.timelineWindow.getEvents();let t;for(t=0;t<e.length&&e[t].getId()!=this.state.readMarkerEventId;t++);if(t>=e.length)return;const a=lt.a.get().credentials.userId;for(t++;t<e.length;t++){if(e[t].getSender()!==a)break}t--;const n=e[t];this.setReadMarker(n.getId(),n.getTs())}initTimeline(e){const t=e.eventId,a=e.eventPixelOffset;let n=1;return null==a&&(n=.5),this.loadTimeline(t,a,n,e.eventScrollIntoView)}scrollIntoView(e,t,a){var n,i;const s=()=>{this.messagePanel.current&&(e?(fr("TimelinePanel scrolling to eventId "+e+" at position "+100*a+"% + "+t),this.messagePanel.current.scrollToEvent(e,t,a)):(fr("TimelinePanel scrolling to bottom"),this.messagePanel.current.scrollToBottom()))};fr("TimelinePanel scheduling scroll to event"),null===(n=(i=this.props).onEventScrolledIntoView)||void 0===n||n.call(i,e),s(),window.requestAnimationFrame((()=>{s()}))}loadTimeline(e,t,a){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const i=lt.a.get();this.timelineWindow=new ur.b(i,this.props.timelineSet,{windowLimit:this.props.timelineCap}),this.overlayTimelineWindow=this.props.overlayTimelineSet?new ur.b(i,this.props.overlayTimelineSet,{windowLimit:this.props.timelineCap}):void 0;const s=()=>{var i,s,r;this.unmounted||(null===(i=this.messagePanel.current)||void 0===i||i.onTimelineReset(),this.reloadEvents(),this.advanceReadMarkerPastMyEvents(),this.setState({canBackPaginate:!(null===(s=this.timelineWindow)||void 0===s||!s.canPaginate(mr.b.BACKWARDS)),canForwardPaginate:!(null===(r=this.timelineWindow)||void 0===r||!r.canPaginate(mr.b.FORWARDS)),timelineLoading:!1},(()=>{this.messagePanel.current?(n&&this.scrollIntoView(e,t,a),this.props.sendReadReceiptOnLoad&&this.sendReadReceipt()):ga.a.log("can't initialise scroll state because messagePanel didn't load")})))};var r;if(this.props.timelineSet.getTimelineForEvent(e))return this.timelineWindow.load(e,20),null===(r=this.overlayTimelineWindow)||void 0===r||r.load(void 0,20),void s();const o=this.timelineWindow.load(e,20).then((async()=>{this.overlayTimelineWindow&&await this.overlayTimelineWindow.load(void 0,20)}));this.buildLegacyCallEventGroupers(),this.setState({events:[],liveEvents:[],canBackPaginate:!1,canForwardPaginate:!1,timelineLoading:!0}),o.then(s,(t=>{var a;if(this.unmounted)return;let n,i;this.setState({timelineLoading:!1}),ga.a.error(`Error loading timeline panel at ${null===(a=this.props.timelineSet.room)||void 0===a?void 0:a.roomId}/${e}`,t),e&&(n=()=>{v.a.dispatch({action:U.a.ViewRoom,room_id:this.props.timelineSet.room.roomId,metricsTrigger:void 0})}),i="M_FORBIDDEN"==t.errcode?Object(N.a)("Tried to load a specific point in this room's timeline, but you do not have permission to view the message in question."):Object(N.a)("Tried to load a specific point in this room's timeline, but was unable to find it."),H.b.createDialog(Ja.a,{title:Object(N.a)("Failed to load timeline position"),description:i,onFinished:n})}))}reloadEvents(){if(this.unmounted)return;const e=this.getEvents();this.buildLegacyCallEventGroupers(e.events),this.setState(e)}refreshTimeline(e){this.loadTimeline(e,void 0,void 0,!1),this.reloadEvents()}getEvents(){var e,t,a;const n=(null===(e=this.timelineWindow)||void 0===e?void 0:e.getEvents())||[],i=this.props.overlayTimelineSetFilter||Boolean,s=((null===(t=this.overlayTimelineWindow)||void 0===t?void 0:t.getEvents().filter(i))||[]).reduce(((e,t)=>{const a=e.findIndex((e=>e.localTimestamp>t.localTimestamp));return a>-1?e.splice(a,0,t):e.push(t),e}),[...n]);Object(rn.b)(s).reverse().forEach((e=>{lt.a.get().decryptEventIfNeeded(e)}));const r=this.checkForPreJoinUISI(n),o=[...s];if(null===(a=this.timelineWindow)||void 0===a||!a.canPaginate(mr.b.FORWARDS)){const e=this.props.timelineSet.getPendingEvents();s.push(...e.filter((t=>{const{shouldLiveInRoom:a,threadId:n}=this.props.timelineSet.room.eventShouldLiveIn(t,e);return this.context.timelineRenderingType===Ga.a.Thread?n===this.context.threadId:a})))}return{events:s,liveEvents:o,firstVisibleEventIndex:r}}checkForPreJoinUISI(e){const t=lt.a.get(),a=this.props.timelineSet.room,n=[Ga.a.Thread,Ga.a.ThreadsList].includes(this.context.timelineRenderingType);if(0===e.length||!a||!t.isRoomEncrypted(a.roomId)||n)return ga.a.info("checkForPreJoinUISI: showing all messages, skipping check"),0;const i=t.credentials.userId;let s=e.length-1,r="leave";for(;s>=0;s--){var o,l;const t=this.props.timelineSet.getTimelineForEvent(e[s].getId());if(!t){ga.a.warn(`Event ${e[s].getId()} in room ${a.roomId} is live, but it does not have a timeline`);continue}r=null!==(o=null===(l=t.getState(mr.b.FORWARDS).getMember(i))||void 0===l?void 0:l.membership)&&void 0!==o?o:"leave";const n=t.getEvents();for(let t=n.length-1;t>=0;t--){const a=n[t];if(a.getId()===e[s].getId())break;a.getStateKey()===i&&a.getType()===ee.b.RoomMember&&(r=a.getPrevContent().membership||"leave")}break}for(;s>=0;s--){const t=e[s];if(t.getStateKey()===i&&t.getType()===ee.b.RoomMember)r=t.getPrevContent().membership||"leave";else if("leave"===r&&(t.isDecryptionFailure()||t.isBeingDecrypted()))return ga.a.info("checkForPreJoinUISI: reached a pre-join UISI at index ",s),s+1}return ga.a.info("checkForPreJoinUISI: did not find pre-join UISI"),0}indexForEventId(e){if(null===e)return null;if(this.context.timelineRenderingType===Ga.a.Thread)return 0;const t=this.state.events.findIndex((t=>t.getId()===e));return t>-1?t:null}getVisibleDecryptionFailures(e){const t=this.messagePanel.current;if(!t)return null;const a=Ft.a.findDOMNode(t);if(!a)return null;const n=a.getBoundingClientRect(),i=e?100:0,s=n.top-i,r=n.bottom+i,o=[];for(const e of this.state.liveEvents){const a=e.getId();if(!a)continue;const n=t.getNodeForEventId(a);if(!n)continue;const i=n.getBoundingClientRect();if(i.top>r)break;i.bottom>=s&&e.isDecryptionFailure()&&o.push(e)}return o}getLastDisplayedEventIndex(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=e.ignoreOwn||!1,a=e.allowPartial||!1,n=this.messagePanel.current;if(!n)return null;const i=Ft.a.findDOMNode(n);if(!i)return null;const s=i.getBoundingClientRect(),r=lt.a.get().credentials.userId,o=e=>{if(e){const t=e.getBoundingClientRect();if(a&&t.top<=s.bottom||!a&&t.bottom<=s.bottom)return!0}return!1};let l=0;for(let e=this.state.liveEvents.length-1;e>=0;--e){var c;const a=this.state.liveEvents[e],i=n.getNodeForEventId(a.getId()),s=o(i);if(s&&0!==l)return e+l;i&&!s&&(l=0);const d=!!a.status||t&&a.getSender()===r;if(!(!Object(gi.c)(a,null===(c=this.context)||void 0===c?void 0:c.showHiddenEvents)||Object(wa.a)(a,this.context))&&i){if(!d&&s)return e}else(!d||d&&0!==l)&&++l}return null}getCurrentReadReceipt(){var e;let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const a=lt.a.get();if(null==a)return null;const n=a.credentials.userId,i=null!==(e=this.props.timelineSet.thread)&&void 0!==e?e:this.props.timelineSet.room;return null==i?void 0:i.getEventReadUpTo(n,t)}setReadMarker(e,t){var a;let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const i=null===(a=this.props.timelineSet.room)||void 0===a?void 0:a.roomId;e!==this.state.readMarkerEventId&&null!==e&&(yr.roomReadMarkerTsMap[null!=i?i:""]=t,n||this.setState({readMarkerEventId:e},this.props.onReadMarkerUpdated))}shouldPaginate(){return!this.state.events.some((e=>e.isBeingDecrypted()))}buildLegacyCallEventGroupers(e){this.callEventGroupers=Object(br.c)(this.callEventGroupers,e)}render(){var e,t,a,n,i;if(this.state.timelineLoading)return r.a.createElement("div",{className:"mx_RoomView_messagePanelSpinner"},r.a.createElement(Kn.a,null));if(0==this.state.events.length&&!this.state.canBackPaginate&&this.props.empty)return r.a.createElement("div",{className:this.props.className+" mx_RoomView_messageListWrapper"},r.a.createElement("div",{className:"mx_RoomView_empty"},this.props.empty));const s=!this.timelineWindow.canPaginate(mr.b.FORWARDS),o=this.state.forwardPaginating||["PREPARED","CATCHUP"].includes(this.state.clientSyncState),l=this.state.firstVisibleEventIndex?this.state.events.slice(this.state.firstVisibleEventIndex):this.state.events;return r.a.createElement(vr.a,{ref:this.messagePanel,room:this.props.timelineSet.room,permalinkCreator:this.props.permalinkCreator,hidden:this.props.hidden,backPaginating:this.state.backPaginating,forwardPaginating:o,events:l,highlightedEventId:this.props.highlightedEventId,readMarkerEventId:this.state.readMarkerEventId,readMarkerVisible:this.state.readMarkerVisible,canBackPaginate:this.state.canBackPaginate&&0===this.state.firstVisibleEventIndex,showUrlPreview:this.props.showUrlPreview,showReadReceipts:this.props.showReadReceipts,ourUserId:lt.a.get().credentials.userId,stickyBottom:s,onScroll:this.onMessageListScroll,onFillRequest:this.onMessageListFillRequest,onUnfillRequest:this.onMessageListUnfillRequest,isTwelveHour:null!==(e=null===(t=this.context)||void 0===t?void 0:t.showTwelveHourTimestamps)&&void 0!==e?e:this.state.isTwelveHour,alwaysShowTimestamps:null!==(a=null!==(n=this.props.alwaysShowTimestamps)&&void 0!==n?n:null===(i=this.context)||void 0===i?void 0:i.alwaysShowTimestamps)&&void 0!==a?a:this.state.alwaysShowTimestamps,className:this.props.className,resizeNotifier:this.props.resizeNotifier,getRelationsForEvent:this.getRelationsForEvent,editState:this.props.editState,showReactions:this.props.showReactions,layout:this.props.layout,hideThreadedMessages:this.props.hideThreadedMessages,disableGrouping:this.props.disableGrouping,callEventGroupers:this.callEventGroupers})}}function Er(e){return e.map((e=>{const t={},a=e.getTimelines(),n=e.getLiveTimeline();return a.forEach(((e,a)=>{t[e===n?"liveTimeline":`${a}`]=e.getEvents().map((e=>e.getId()))})),t}))}i()(yr,"contextType",Ga.b),i()(yr,"roomReadMarkerTsMap",{}),i()(yr,"defaultProps",{timelineCap:Number.MAX_VALUE,className:"mx_RoomView_messagePanel",sendReadReceiptOnLoad:!0,hideThreadedMessages:!0,disableGrouping:!1});var _r=yr,wr=a(194);class Sr extends r.a.PureComponent{constructor(e){super(e),i()(this,"instanceId",void 0),i()(this,"onResize",((e,t)=>{e===Q.a.Resize&&this.props.onMeasurement(t.contentRect.width<=this.props.breakpoint)})),this.instanceId=Sr.instanceCount++}componentDidMount(){Q.b.instance.on(`Measured${this.instanceId}`,this.onResize)}componentDidUpdate(e){const t=e.sensor,a=this.props.sensor;t!==a&&(t&&Q.b.instance.stopTrackingElementDimensions(`Measured${this.instanceId}`),a&&Q.b.instance.trackElementDimensions(`Measured${this.instanceId}`,this.props.sensor))}componentWillUnmount(){Q.b.instance.off(`Measured${this.instanceId}`,this.onResize),Q.b.instance.stopTrackingElementDimensions(`Measured${this.instanceId}`)}render(){return null}}function Or(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function Cr(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?Or(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):Or(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}i()(Sr,"instanceCount",0),i()(Sr,"defaultProps",{breakpoint:500});class xr extends r.a.Component{constructor(){super(...arguments),i()(this,"decryptingEvents",new Set),i()(this,"noRoom",void 0),i()(this,"card",Object(s.createRef)()),i()(this,"state",{timelineSet:null,narrow:!1}),i()(this,"onRoomTimeline",((e,t,a,n,i)=>{var s;if((null==t?void 0:t.roomId)!==(null===(s=this.props)||void 0===s?void 0:s.roomId))return;if(a||!i||!i.liveEvent||e.isRedacted())return;lt.a.get().decryptEventIfNeeded(e),e.isBeingDecrypted()?this.decryptingEvents.add(e.getId()):this.addEncryptedLiveEvent(e)})),i()(this,"onEventDecrypted",((e,t)=>{if(e.getRoomId()!==this.props.roomId)return;const a=e.getId();this.decryptingEvents.delete(a)&&(t||this.addEncryptedLiveEvent(e))})),i()(this,"onPaginationRequest",((e,t,a)=>{const n=lt.a.get(),i=lr.a.get(),s=this.props.roomId,r=n.getRoom(s);return n.isRoomEncrypted(s)&&null!==i?i.paginateTimelineWindow(r,e,t,a):e.paginate(t,a)})),i()(this,"onMeasurement",(e=>{this.setState({narrow:e})}))}addEncryptedLiveEvent(e){if(!this.state.timelineSet)return;const t=this.state.timelineSet.getLiveTimeline();"m.room.message"===e.getType()&&-1!=["m.file","m.image","m.video","m.audio"].indexOf(e.getContent().msgtype)&&(this.state.timelineSet.eventIdToTimeline(e.getId())||this.state.timelineSet.addEventToTimeline(e,t,!1))}async componentDidMount(){const e=lt.a.get();await this.updateTimelineSet(this.props.roomId),lt.a.get().isRoomEncrypted(this.props.roomId)&&null!==lr.a.get()&&(e.on(te.d.Timeline,this.onRoomTimeline),e.on(fa.c.Decrypted,this.onEventDecrypted))}componentWillUnmount(){const e=lt.a.get();null!==e&<.a.get().isRoomEncrypted(this.props.roomId)&&null!==lr.a.get()&&(e.removeListener(te.d.Timeline,this.onRoomTimeline),e.removeListener(fa.c.Decrypted,this.onEventDecrypted))}async fetchFileEventsServer(e){const t=lt.a.get(),a=new Hi.a(t.credentials.userId);a.setDefinition({room:{timeline:{contains_url:!0,types:["m.room.message"]}}});const n=await t.getOrCreateFilter("FILTER_FILES_"+t.credentials.userId,a);a.filterId=n;return e.getOrCreateFilteredTimelineSet(a)}async updateTimelineSet(e){const t=lt.a.get(),a=t.getRoom(e),n=lr.a.get();if(this.noRoom=!a,a){let i;try{if(i=await this.fetchFileEventsServer(a),t.isRoomEncrypted(e)&&null!==n){const e=i.getLiveTimeline();await n.populateFileTimeline(i,e,a,10)}this.setState({timelineSet:i})}catch(e){ga.a.error("Failed to get or create file panel filter",e)}}else ga.a.error("Failed to add filtered timelineSet for FilePanel as no room!")}render(){if(lt.a.get().isGuest())return r.a.createElement(Da,{className:"mx_FilePanel mx_RoomView_messageListWrapper",onClose:this.props.onClose},r.a.createElement("div",{className:"mx_RoomView_empty"},Object(N.a)("You must <a>register</a> to use this functionality",{},{a:e=>r.a.createElement("a",{href:"#/register",key:"sub"},e)})));if(this.noRoom)return r.a.createElement(Da,{className:"mx_FilePanel mx_RoomView_messageListWrapper",onClose:this.props.onClose},r.a.createElement("div",{className:"mx_RoomView_empty"},Object(N.a)("You must join the room to see its files")));const e=r.a.createElement("div",{className:"mx_RightPanel_empty mx_FilePanel_empty"},r.a.createElement("h2",null,Object(N.a)("No files visible in this room")),r.a.createElement("p",null,Object(N.a)("Attach files from chat or just drag and drop them anywhere in a room."))),t=!this.noRoom&<.a.get().isRoomEncrypted(this.props.roomId);return this.state.timelineSet?r.a.createElement(Ga.b.Provider,{value:Cr(Cr({},this.context),{},{timelineRenderingType:Ga.a.File,narrow:this.state.narrow})},r.a.createElement(Da,{className:"mx_FilePanel",onClose:this.props.onClose,withoutScrollContainer:!0,ref:this.card},r.a.createElement(Sr,{sensor:this.card.current,onMeasurement:this.onMeasurement}),r.a.createElement(dr,{isRoomEncrypted:t,kind:cr.Files}),r.a.createElement(_r,{manageReadReceipts:!1,manageReadMarkers:!1,timelineSet:this.state.timelineSet,showUrlPreview:!1,onPaginationRequest:this.onPaginationRequest,resizeNotifier:this.props.resizeNotifier,empty:e,layout:wr.a.Group}))):r.a.createElement(Ga.b.Provider,{value:Cr(Cr({},this.context),{},{timelineRenderingType:Ga.a.File})},r.a.createElement(Da,{className:"mx_FilePanel",onClose:this.props.onClose},r.a.createElement(Kn.a,null)))}}i()(xr,"contextType",Ga.b);var jr=xr;class kr extends r.a.Component{constructor(e){super(e),i()(this,"resize",(()=>{this.props.onResize&&this.props.onResize()}))}componentDidMount(){window.addEventListener("resize",this.resize)}componentWillUnmount(){window.removeEventListener("resize",this.resize)}render(){return r.a.createElement("div",null,this.props.element)}}const Rr="stickerPicker";class Ir extends r.a.PureComponent{constructor(e){super(e),i()(this,"dispatcherRef",void 0),i()(this,"prevSentVisibility",void 0),i()(this,"popoverWidth",300),i()(this,"popoverHeight",300),i()(this,"scalarClient",null),i()(this,"removeStickerpickerWidgets",(async()=>{const e=await this.acquireScalarClient();ga.a.log("Removing Stickerpicker widgets"),this.state.widgetId?e?e.disableWidgetAssets(Qa.a.STICKERPICKER,this.state.widgetId).then((()=>{ga.a.log("Assets disabled")})).catch((()=>{ga.a.error("Failed to disable assets")})):ga.a.error("Cannot disable assets: no scalar client"):ga.a.warn("No widget ID specified, not disabling assets"),this.props.setStickerPickerOpen(!1),Aa.a.removeStickerpickerWidgets().then((()=>{this.forceUpdate()})).catch((e=>{ga.a.error("Failed to remove sticker picker widget",e)}))})),i()(this,"updateWidget",(()=>{var e,t,a,n;const i=Aa.a.getStickerpickerWidgets()[0];if(!i)return Ir.currentWidget=void 0,void this.setState({stickerpickerWidget:null,widgetId:null});const s=Ir.currentWidget,r=null!==(e=null==s||null===(t=s.content)||void 0===t?void 0:t.url)&&void 0!==e?e:null;(null!==(a=null==i||null===(n=i.content)||void 0===n?void 0:n.url)&&void 0!==a?a:null)!==r&&hs.destroyElement(Rr),Ir.currentWidget=i,this.setState({stickerpickerWidget:i,widgetId:i?i.id:null})})),i()(this,"onAction",(e=>{switch(e.action){case"user_widget_updated":this.forceUpdate();break;case"stickerpicker_close":case"show_left_panel":case"hide_left_panel":this.props.setStickerPickerOpen(!1)}})),i()(this,"onRightPanelStoreUpdate",(()=>{this.props.setStickerPickerOpen(!1)})),i()(this,"onResize",(()=>{this.props.isStickerPickerOpen&&this.props.setStickerPickerOpen(!1)})),i()(this,"onFinished",(()=>{this.props.isStickerPickerOpen&&this.props.setStickerPickerOpen(!1)})),i()(this,"launchManageIntegrations",(()=>{var e,t,a;null===(e=La.a.sharedInstance())||void 0===e||null===(t=e.getPrimaryManager())||void 0===t||t.open(this.props.room,`type_${Qa.a.STICKERPICKER.preferred}`,null!==(a=this.state.widgetId)&&void 0!==a?a:void 0)})),this.state={imError:null,stickerpickerWidget:null,widgetId:null}}async acquireScalarClient(){return this.scalarClient?Promise.resolve(this.scalarClient):La.a.sharedInstance().hasManager()?(this.scalarClient=null!==(e=null===(t=La.a.sharedInstance().getPrimaryManager())||void 0===t?void 0:t.getScalarClient())&&void 0!==e?e:null,null===(a=this.scalarClient)||void 0===a?void 0:a.connect().then((()=>(this.forceUpdate(),this.scalarClient))).catch((e=>{this.imError(Object(N.c)("Failed to connect to integration manager"),e)}))):void La.a.sharedInstance().openNoManagerDialog();var e,t,a}componentDidMount(){window.addEventListener("resize",this.onResize),this.dispatcherRef=v.a.register(this.onAction),lt.a.get().on(te.d.AccountData,this.updateWidget),Ia.a.instance.on(pt.b,this.onRightPanelStoreUpdate),this.updateWidget()}componentWillUnmount(){const e=lt.a.get();e&&e.removeListener(te.d.AccountData,this.updateWidget),Ia.a.instance.off(pt.b,this.onRightPanelStoreUpdate),window.removeEventListener("resize",this.onResize),this.dispatcherRef&&v.a.unregister(this.dispatcherRef)}componentDidUpdate(){this.sendVisibilityToWidget(this.props.isStickerPickerOpen)}imError(e,t){ga.a.error(e,t),this.setState({imError:Object(N.a)(e)}),this.props.setStickerPickerOpen(!1)}defaultStickerpickerContent(){return r.a.createElement(G.a,{onClick:this.launchManageIntegrations,className:"mx_Stickers_contentPlaceholder"},r.a.createElement("p",null,Object(N.a)("You don't currently have any stickerpacks enabled")),r.a.createElement("p",{className:"mx_Stickers_addLink"},Object(N.a)("Add some now")),r.a.createElement("img",{src:a(1510),alt:""}))}errorStickerpickerContent(){return r.a.createElement("div",{style:{textAlign:"center"},className:"error"},r.a.createElement("p",null," ",this.state.imError," "))}sendVisibilityToWidget(e){if(!this.state.stickerpickerWidget)return;const t=$a.a.instance.getMessagingForUid(Aa.a.calcWidgetUid(this.state.stickerpickerWidget.id));t&&e!==this.prevSentVisibility&&(t.updateVisibility(e).catch((e=>{ga.a.error("Error updating widget visibility: ",e)})),this.prevSentVisibility=e)}getStickerpickerContent(){if(this.state.imError)return this.errorStickerpickerContent();const e=this.state.stickerpickerWidget;let t;if(e&&e.content&&e.content.url){e.content.name=e.content.name||Object(N.a)("Stickerpack");const a={id:e.id,url:e.content.url,name:e.content.name,type:e.content.type,data:e.content.data,roomId:e.content.roomId,eventId:e.content.eventId,avatar_url:e.content.avatar_url,creatorUserId:e.content.creatorUserId};t=r.a.createElement("div",{className:"mx_Stickers_content_container"},r.a.createElement("div",{id:"stickersContent",className:"mx_Stickers_content",style:{border:"none",height:this.popoverHeight,width:this.popoverWidth}},r.a.createElement(hs,{persistKey:Rr,zIndex:3500},r.a.createElement(vs,{app:a,room:this.props.room,threadId:this.props.threadId,fullWidth:!0,userId:lt.a.get().credentials.userId,creatorUserId:e.sender||lt.a.get().credentials.userId,waitForIframeLoad:!0,showMenubar:!0,onEditClick:this.launchManageIntegrations,onDeleteClick:this.removeStickerpickerWidgets,showTitle:!1,showPopout:!1,handleMinimisePointerEvents:!0,userWidget:!0,showLayoutButtons:!1}))))}else t=this.defaultStickerpickerContent();return t}render(){return this.props.isStickerPickerOpen?r.a.createElement(ce.n,Z()({chevronFace:ce.a.Bottom,menuWidth:this.popoverWidth,menuHeight:this.popoverHeight,onFinished:this.onFinished,menuPaddingTop:0,menuPaddingLeft:0,menuPaddingRight:0,zIndex:3500},this.props.menuPosition),r.a.createElement(kr,{element:this.getStickerpickerContent(),onResize:this.onFinished})):null}}i()(Ir,"defaultProps",{threadId:null}),i()(Ir,"currentWidget",void 0);var Tr=a(941);class Nr extends r.a.Component{render(){return this.props.replyToEvent?r.a.createElement("div",{className:"mx_ReplyPreview"},r.a.createElement("div",{className:"mx_ReplyPreview_section"},r.a.createElement("div",{className:"mx_ReplyPreview_header"},r.a.createElement("span",null,Object(N.a)("Replying")),r.a.createElement(G.a,{className:"mx_ReplyPreview_header_cancel",onClick:()=>{return e=this.context.timelineRenderingType,void v.a.dispatch({action:"reply_to_event",event:null,context:e});var e}})),r.a.createElement(Tr.a,{mxEvent:this.props.replyToEvent,permalinkCreator:this.props.permalinkCreator}))):null}}i()(Nr,"contextType",Ga.b);var Pr=a(348),Dr=a(836),Mr=a(396);class Ar extends r.a.PureComponent{constructor(e){super(e),i()(this,"waveform",[]),i()(this,"scheduledUpdate",new Mr.a((()=>this.updateWaveform()),(()=>requestAnimationFrame((()=>this.scheduledUpdate.trigger()))))),this.state={waveform:Object(rn.h)(0,Pr.a)}}componentDidMount(){this.props.recorder.liveData.onUpdate((e=>{this.waveform=Object(rn.c)(Array.from(e.waveform),Pr.a),this.scheduledUpdate.mark()}))}updateWaveform(){this.setState({waveform:this.waveform})}render(){return r.a.createElement(Dr.a,{relHeights:this.state.waveform})}}i()(Ar,"defaultProps",{progress:1});var Lr=a(337);class Ur extends r.a.PureComponent{constructor(e){super(e),i()(this,"seconds",0),i()(this,"scheduledUpdate",new Mr.a((()=>this.updateClock()),(()=>requestAnimationFrame((()=>this.scheduledUpdate.trigger()))))),this.state={seconds:0}}componentDidMount(){this.props.recorder.liveData.onUpdate((e=>{this.seconds=e.timeSeconds,this.scheduledUpdate.mark()}))}updateClock(){this.setState({seconds:this.seconds})}render(){return r.a.createElement(Lr.a,{seconds:this.state.seconds,"aria-live":"off"})}}var Fr=a(567),Br=a(251);class Vr{constructor(e,t){this.matrixClient=e,this.voiceRecording=t,i()(this,"lastUpload",void 0),i()(this,"buffer",new Uint8Array(0)),i()(this,"playback",void 0),i()(this,"onDataAvailable",(e=>{const t=new Uint8Array(e);this.buffer=Object(rn.m)(this.buffer,t)})),this.voiceRecording.onDataAvailable=this.onDataAvailable}async start(){if(this.lastUpload||this.hasRecording)throw new Error("Recording already prepared");return this.voiceRecording.start()}async stop(){return await this.voiceRecording.stop(),this.audioBuffer}on(e,t){return this.voiceRecording.on(e,t),this}off(e,t){return this.voiceRecording.off(e,t),this}emit(e){for(var t=arguments.length,a=new Array(t>1?t-1:0),n=1;n<t;n++)a[n-1]=arguments[n];return this.voiceRecording.emit(e,...a)}get hasRecording(){return this.buffer.length>0}get isRecording(){return this.voiceRecording.isRecording}getPlayback(){return this.playback=Fr.a.for(this,"playback").do((()=>new Br.c(this.audioBuffer.buffer,this.voiceRecording.amplitudes))),this.playback}async upload(e){if(!this.hasRecording)throw new Error("No recording available to upload");if(this.lastUpload)return this.lastUpload;try{this.emit(Pr.b.Uploading);const{url:t,file:a}=await Object(Oa.b)(this.matrixClient,e,new Blob([this.audioBuffer],{type:this.contentType}));this.lastUpload={mxc:t,encrypted:a},this.emit(Pr.b.Uploaded)}catch(e){throw this.emit(Pr.b.Ended),e}return this.lastUpload}get durationSeconds(){return this.voiceRecording.durationSeconds}get contentType(){return this.voiceRecording.contentType}get contentLength(){return this.buffer.length}get liveData(){return this.voiceRecording.liveData}get isSupported(){return this.voiceRecording.isSupported}destroy(){var e;null===(e=this.playback)||void 0===e||e.destroy(),this.voiceRecording.destroy()}get audioBuffer(){return this.buffer.slice(0)}}function Wr(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var a=e[Symbol.toPrimitive];if(void 0!==a){var n=a.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function Hr(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function zr(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?Hr(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):Hr(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}class Gr extends Cn.a{constructor(){super(v.a,{})}static get instance(){return this.internalInstance||(this.internalInstance=new Gr,this.internalInstance.start()),this.internalInstance}async onAction(e){}static getVoiceRecordingId(e,t){return"io.element.thread"===(null==t?void 0:t.rel_type)||(null==t?void 0:t.rel_type)===ee.h.Thread?e.roomId+"|"+t.event_id:e.roomId}getActiveRecording(e){return this.state[e]}startRecording(e){if(!this.matrixClient)throw new Error("Cannot start a recording without a MatrixClient");if(!e)throw new Error("Recording must be associated with a room");if(this.state[e])throw new Error("A recording is already in progress");const t=(a=this.matrixClient,new Vr(a,new Pr.d));var a;return this.updateState(zr(zr({},this.state),{},{[e]:t})),t}disposeRecording(e){var t;null===(t=this.state[e])||void 0===t||t.destroy();const a=this.state,{[e]:n}=a,i=ve()(a,[e].map(Wr));return this.reset(i)}}i()(Gr,"internalInstance",void 0),window.mxVoiceRecordingStore=Gr.instance;var Kr=a(940),qr=a(500),$r=a(270),Yr=a(568),Jr=a(227),Qr=a(816);class Xr extends r.a.PureComponent{constructor(e){super(e),i()(this,"context",void 0),i()(this,"voiceRecordingId",void 0),i()(this,"onCancel",(async()=>{await this.disposeRecording()})),i()(this,"onRecordStartEndClick",(async()=>{if(this.state.recorder)return void await this.state.recorder.stop();const e=()=>{H.b.createDialog(Ja.a,{title:Object(N.a)("Unable to access your microphone"),description:r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,Object(N.a)("We were unable to access your microphone. Please check your browser settings and try again.")))})};try{var t;const e=await p.c.getDevices();if(null==e||null===(t=e[p.b.AudioInput])||void 0===t||!t.length)return void H.b.createDialog(Ja.a,{title:Object(N.a)("No microphone found"),description:r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,Object(N.a)("We didn't find a microphone on your device. Please check your settings and try again.")))})}catch(t){return ga.a.error("Error getting devices: ",t),void e()}try{qr.a.instance.pauseAllExcept();const e=Gr.instance.startRecording(this.voiceRecordingId);await e.start(),this.bindNewRecorder(e),this.setState({recorder:e,recordingPhase:Pr.b.Started})}catch(t){ga.a.error("Error starting recording: ",t),e(),Gr.instance.disposeRecording(this.voiceRecordingId)}})),i()(this,"onRecordingUpdate",(e=>{e!==Pr.b.EndingSoon&&this.setState({recordingPhase:e})})),this.state={},this.voiceRecordingId=Gr.getVoiceRecordingId(this.props.room,this.props.relation)}componentDidMount(){const e=Gr.instance.getActiveRecording(this.voiceRecordingId);e&&(!e.isRecording&&e.hasRecording||ga.a.warn("Cached recording hasn't ended yet and might cause issues"),this.bindNewRecorder(e),this.setState({recorder:e,recordingPhase:Pr.b.Ended}))}async componentWillUnmount(){const e=Gr.instance.getActiveRecording(this.voiceRecordingId);await(null==e?void 0:e.stop()),this.bindNewRecorder(null)}async send(){if(!this.state.recorder)throw new Error("No recording started - cannot send anything");const{replyToEvent:e,relation:t,permalinkCreator:a}=this.props;let n;await this.state.recorder.stop();try{n=await this.state.recorder.upload(this.voiceRecordingId)}catch(e){return ga.a.error("Error uploading voice message:",e),void this.setState({didUploadFail:!0})}try{const i=Object(Qr.a)(n.mxc,this.state.recorder.contentType,Math.round(1e3*this.state.recorder.durationSeconds),this.state.recorder.contentLength,n.encrypted,this.state.recorder.getPlayback().thumbnailWaveform.map((e=>Math.round(1024*e))));Object(Yr.a)(i,t),e&&(Object(Jr.a)(i,e,{permalinkCreator:a,includeLegacyFallback:!0}),v.a.dispatch({action:"reply_to_event",event:null,context:this.context.timelineRenderingType})),Object($r.a)(this.props.room.roomId,(e=>lt.a.get().sendMessage(e,i)))}catch(e){ga.a.error("Error sending voice message:",e)}await this.disposeRecording()}async disposeRecording(){await Gr.instance.disposeRecording(this.voiceRecordingId),this.setState({recorder:void 0,recordingPhase:void 0,didUploadFail:!1})}bindNewRecorder(e){this.state.recorder&&this.state.recorder.off(pt.b,this.onRecordingUpdate),e&&e.on(pt.b,this.onRecordingUpdate)}renderWaveformArea(){return this.state.recorder?this.state.recordingPhase!==Pr.b.Started?r.a.createElement(Kr.b,{playback:this.state.recorder.getPlayback(),layout:Kr.a.Composer}):r.a.createElement("div",{className:"mx_MediaBody mx_VoiceMessagePrimaryContainer mx_VoiceRecordComposerTile_recording"},r.a.createElement(Ur,{recorder:this.state.recorder}),r.a.createElement(Ar,{recorder:this.state.recorder})):null}render(){if(!this.state.recordingPhase)return null;let e,t,a;if(this.state.recordingPhase===Pr.b.Started){var n;let t=Object(N.a)("Send voice message");this.state.recorder&&(t=Object(N.a)("Stop recording")),e=r.a.createElement(q.a,{className:"mx_VoiceRecordComposerTile_stop",onClick:this.onRecordStartEndClick,title:t}),!this.state.recorder||null!==(n=this.state.recorder)&&void 0!==n&&n.isRecording||(e=null)}return this.state.recorder&&this.state.recordingPhase!==Pr.b.Uploading&&(t=r.a.createElement(q.a,{className:"mx_VoiceRecordComposerTile_delete",title:Object(N.a)("Delete"),onClick:this.onCancel})),this.state.recordingPhase===Pr.b.Uploading?a=r.a.createElement("span",{className:"mx_VoiceRecordComposerTile_uploadingState"},r.a.createElement(he.a,{w:16,h:16})):this.state.didUploadFail&&this.state.recordingPhase===Pr.b.Ended&&(a=r.a.createElement("span",{className:"mx_VoiceRecordComposerTile_failedState"},r.a.createElement("span",{className:"mx_VoiceRecordComposerTile_uploadState_badge"},r.a.createElement(we.a,{notification:Oe.a.forSymbol("!",Ce.a.Red)})),r.a.createElement("span",{className:"text-warning"},Object(N.a)("Failed to send")))),r.a.createElement(r.a.Fragment,null,a,t,e,this.renderWaveformArea())}}i()(Xr,"contextType",Ga.b);var Zr=a(647),eo=a(217),to=a(313),ao=a(936);let no=0;function io(e){var t;return r.a.createElement(q.a,{className:"mx_MessageComposer_sendMessage",onClick:e.onClick,title:null!==(t=e.title)&&void 0!==t?t:Object(N.a)("Send message"),"data-testid":"sendmessagebtn"})}class so extends r.a.Component{constructor(e){super(e),i()(this,"dispatcherRef",void 0),i()(this,"messageComposerInput",Object(s.createRef)()),i()(this,"voiceRecordingButton",Object(s.createRef)()),i()(this,"ref",Object(s.createRef)()),i()(this,"instanceId",void 0),i()(this,"_voiceRecording",void 0),i()(this,"context",void 0),i()(this,"onResize",((e,t)=>{if(e===Q.a.Resize){const{narrow:e}=this.context;this.setState({isMenuOpen:!!e&&this.state.isMenuOpen,isStickerPickerOpen:!1})}})),i()(this,"onAction",(e=>{switch(e.action){case"reply_to_event":e.context===this.context.timelineRenderingType&&window.setTimeout((()=>{this.props.resizeNotifier.notifyTimelineHeightChanged()}),100);break;case U.a.SettingUpdated:{const t=e;switch(t.settingName){case"MessageComposerInput.showStickersButton":{const e=b.b.getValue("MessageComposerInput.showStickersButton");this.state.showStickersButton!==e&&this.setState({showStickersButton:e});break}case"MessageComposerInput.showPollsButton":{const e=b.b.getValue("MessageComposerInput.showPollsButton");this.state.showPollsButton!==e&&this.setState({showPollsButton:e});break}case to.a.VoiceBroadcast:this.state.showVoiceBroadcastButton!==t.newValue&&this.setState({showVoiceBroadcastButton:!!t.newValue});break;case"feature_wysiwyg_composer":this.state.isWysiwygLabEnabled!==t.newValue&&this.setState({isWysiwygLabEnabled:Boolean(t.newValue)})}}}})),i()(this,"onTombstoneClick",(e=>{var t;e.preventDefault();const a=null===(t=this.context.tombstone)||void 0===t?void 0:t.getContent().replacement_room,n=lt.a.get().getRoom(a);let i;if(n){const e=n.currentState.getStateEvents(ee.b.RoomCreate,"");null!=e&&e.getId()&&(i=e.getId())}const s=[this.context.tombstone.getSender().split(":").slice(1).join(":")];v.a.dispatch({action:U.a.ViewRoom,highlighted:!0,event_id:i,room_id:a,auto_join:!0,via_servers:s,metricsTrigger:"Tombstone",metricsViaKeyboard:"click"!==e.type})})),i()(this,"renderPlaceholderText",(()=>{if(this.props.replyToEvent){var e;const t=(null===(e=this.props.relation)||void 0===e?void 0:e.rel_type)===Ea.d.name;return t&&this.props.e2eStatus?Object(N.a)("Reply to encrypted thread…"):t?Object(N.a)("Reply to thread…"):this.props.e2eStatus?Object(N.a)("Send an encrypted reply…"):Object(N.a)("Send a reply…")}return this.props.e2eStatus?Object(N.a)("Send an encrypted message…"):Object(N.a)("Send a message…")})),i()(this,"addEmoji",(e=>(v.a.dispatch({action:U.a.ComposerInsert,text:e,timelineRenderingType:this.context.timelineRenderingType}),!0))),i()(this,"sendMessage",(async()=>{var e,t;if(this.state.haveRecording&&this.voiceRecordingButton.current)await(null===(t=this.voiceRecordingButton.current)||void 0===t?void 0:t.send());else if(null===(e=this.messageComposerInput.current)||void 0===e||e.sendMessage(),this.state.isWysiwygLabEnabled){const{permalinkCreator:e,relation:t,replyToEvent:a}=this.props,n=this.state.composerContent;this.setState({composerContent:"",initialComposerContent:""}),v.a.dispatch({action:U.a.ClearAndFocusSendMessageComposer,timelineRenderingType:this.context.timelineRenderingType}),await Object(ao.d)(n,this.state.isRichTextEnabled,{mxClient:this.props.mxClient,roomContext:this.context,permalinkCreator:e,relation:t,replyToEvent:a})}})),i()(this,"onChange",(e=>{this.setState({isComposerEmpty:e.isEmpty})})),i()(this,"onWysiwygChange",(e=>{this.setState({composerContent:e,isComposerEmpty:0===(null==e?void 0:e.length)})})),i()(this,"onRichTextToggle",(async()=>{const{richToPlain:e,plainToRich:t}=await Object(ao.c)(),{isRichTextEnabled:a,composerContent:n}=this.state,i=a?await e(n):await t(n);this.setState({isRichTextEnabled:!a,composerContent:i,initialComposerContent:i})})),i()(this,"onVoiceStoreUpdate",(()=>{this.updateRecordingState()})),i()(this,"onRecordingStarted",(()=>{const e=Gr.getVoiceRecordingId(this.props.room,this.props.relation);this.voiceRecording=Gr.instance.getActiveRecording(e),this.setState({haveRecording:!!this.voiceRecording})})),i()(this,"onRecordingEndingSoon",(e=>{let{secondsLeft:t}=e;this.setState({recordingTimeLeftSeconds:t}),window.setTimeout((()=>this.setState({recordingTimeLeftSeconds:void 0})),3e3)})),i()(this,"setStickerPickerOpen",(e=>{this.setState({isStickerPickerOpen:e,isMenuOpen:!1})})),i()(this,"toggleStickerPickerOpen",(()=>{this.setStickerPickerOpen(!this.state.isStickerPickerOpen)})),i()(this,"toggleButtonMenu",(()=>{this.setState({isMenuOpen:!this.state.isMenuOpen})})),i()(this,"onRecordStartEndClick",(()=>{const e=rt.b.instance.voiceBroadcastRecordingsStore.getCurrent();var t;e&&e.getState()!==ft.h.Stopped?H.b.createDialog(yi.a,{title:Object(N.a)("Can't start voice message"),description:r.a.createElement("p",null,Object(N.a)("You can't start a voice message as you are currently recording a live broadcast. Please end your live broadcast in order to start recording a voice message.")),hasCloseButton:!0}):null===(t=this.voiceRecordingButton.current)||void 0===t||t.onRecordStartEndClick();this.context.narrow&&this.toggleButtonMenu()})),Gr.instance.on(pt.b,this.onVoiceStoreUpdate),this.state={isComposerEmpty:!0,composerContent:"",haveRecording:!1,recordingTimeLeftSeconds:void 0,isMenuOpen:!1,isStickerPickerOpen:!1,showStickersButton:b.b.getValue("MessageComposerInput.showStickersButton"),showPollsButton:b.b.getValue("MessageComposerInput.showPollsButton"),showVoiceBroadcastButton:b.b.getValue(to.a.VoiceBroadcast),isWysiwygLabEnabled:b.b.getValue("feature_wysiwyg_composer"),isRichTextEnabled:!0,initialComposerContent:""},this.instanceId=no++,b.b.monitorSetting("MessageComposerInput.showStickersButton",null),b.b.monitorSetting("MessageComposerInput.showPollsButton",null),b.b.monitorSetting(to.a.VoiceBroadcast,null),b.b.monitorSetting("feature_wysiwyg_composer",null)}get voiceRecording(){return this._voiceRecording}set voiceRecording(e){this._voiceRecording&&(this._voiceRecording.off(Pr.b.Started,this.onRecordingStarted),this._voiceRecording.off(Pr.b.EndingSoon,this.onRecordingEndingSoon)),this._voiceRecording=e,e&&(e.on(Pr.b.Started,this.onRecordingStarted),e.on(Pr.b.EndingSoon,this.onRecordingEndingSoon))}componentDidMount(){this.dispatcherRef=v.a.register(this.onAction),this.waitForOwnMember(),Q.b.instance.trackElementDimensions(`MessageComposer${this.instanceId}`,this.ref.current),Q.b.instance.on(`MessageComposer${this.instanceId}`,this.onResize),this.updateRecordingState()}waitForOwnMember(){const e=this.props.room.getMember(lt.a.get().getUserId());e?this.setState({me:e}):this.props.room.loadMembersIfNeeded().then((()=>{const e=this.props.room.getMember(lt.a.get().getUserId());this.setState({me:e})}))}componentWillUnmount(){Gr.instance.off(pt.b,this.onVoiceStoreUpdate),this.dispatcherRef&&v.a.unregister(this.dispatcherRef),Q.b.instance.stopTrackingElementDimensions(`MessageComposer${this.instanceId}`),Q.b.instance.removeListener(`MessageComposer${this.instanceId}`,this.onResize),this.voiceRecording=null}updateRecordingState(){const e=Gr.getVoiceRecordingId(this.props.room,this.props.relation);this.voiceRecording=Gr.instance.getActiveRecording(e),this.voiceRecording?this.voiceRecording.hasRecording&&!this.voiceRecording.isRecording&&this.setState({haveRecording:!0}):this.setState({haveRecording:!1})}get showStickersButton(){return this.state.showStickersButton&&!Object(eo.a)(this.props.room)}getMenuPosition(){if(this.ref.current){const e=this.state.isWysiwygLabEnabled&&this.state.isRichTextEnabled,t=this.ref.current.getBoundingClientRect(),a=e?36:0,n=new DOMRect(t.x,t.y+a,t.width,t.height-a);return Object(ce.i)(n)}}render(){var e;const t=Boolean(!this.state.isWysiwygLabEnabled&&this.props.e2eStatus),n=t&&r.a.createElement(Os.b,{key:"e2eIcon",status:this.props.e2eStatus,className:"mx_MessageComposer_e2eIcon"}),i=[],s=this.getMenuPosition(),o=this.context.canSendMessages&&!this.context.tombstone;let l,d;if(o)l=this.state.isWysiwygLabEnabled&&s?r.a.createElement(ao.b,{key:"controls_input",disabled:this.state.haveRecording,onChange:this.onWysiwygChange,onSend:this.sendMessage,isRichTextEnabled:this.state.isRichTextEnabled,initialContent:this.state.initialComposerContent,e2eStatus:this.props.e2eStatus,menuPosition:s,placeholder:this.renderPlaceholderText(),eventRelation:this.props.relation}):r.a.createElement(Yr.b,{ref:this.messageComposerInput,key:"controls_input",room:this.props.room,placeholder:this.renderPlaceholderText(),permalinkCreator:this.props.permalinkCreator,relation:this.props.relation,replyToEvent:this.props.replyToEvent,onChange:this.onChange,disabled:this.state.haveRecording,toggleStickerPickerOpen:this.toggleStickerPickerOpen}),i.push(r.a.createElement(Xr,{key:"controls_voice_record",ref:this.voiceRecordingButton,room:this.props.room,permalinkCreator:this.props.permalinkCreator,relation:this.props.relation,replyToEvent:this.props.replyToEvent}));else if(this.context.tombstone){const e=this.context.tombstone.getContent().replacement_room,t=e?r.a.createElement("a",{href:Object(Sa.h)(e),className:"mx_MessageComposer_roomReplaced_link",onClick:this.onTombstoneClick},Object(N.a)("The conversation continues here.")):"";i.push(r.a.createElement("div",{className:"mx_MessageComposer_replaced_wrapper",key:"room_replaced"},r.a.createElement("div",{className:"mx_MessageComposer_replaced_valign"},r.a.createElement("img",{className:"mx_MessageComposer_roomReplaced_icon",src:a(1511).default}),r.a.createElement("span",{className:"mx_MessageComposer_roomReplaced_header"},Object(N.a)("This room has been replaced and is no longer active.")),r.a.createElement("br",null),t)))}else i.push(r.a.createElement("div",{key:"controls_error",className:"mx_MessageComposer_noperm_error"},Object(N.a)("You do not have permission to post to this room")));if(this.state.recordingTimeLeftSeconds){const e=Math.round(this.state.recordingTimeLeftSeconds);d=r.a.createElement(xi.b,{label:Object(N.a)("%(seconds)ss left",{seconds:e}),alignment:xi.a.Top})}const m=(null===(e=this.props.relation)||void 0===e?void 0:e.rel_type)===Ea.d.name?this.props.relation.event_id:null;i.push(r.a.createElement(Ir,{room:this.props.room,threadId:m,isStickerPickerOpen:this.state.isStickerPickerOpen,setStickerPickerOpen:this.setStickerPickerOpen,menuPosition:s,key:"stickers"}));const u=!this.state.isComposerEmpty||this.state.haveRecording,h=c()({mx_MessageComposer:!0,"mx_MessageComposer--compact":this.props.compact,mx_MessageComposer_e2eStatus:t,mx_MessageComposer_wysiwyg:this.state.isWysiwygLabEnabled});return r.a.createElement("div",{className:h,ref:this.ref},d,r.a.createElement("div",{className:"mx_MessageComposer_wrapper"},r.a.createElement(Nr,{replyToEvent:this.props.replyToEvent,permalinkCreator:this.props.permalinkCreator}),r.a.createElement("div",{className:"mx_MessageComposer_row"},n,l,r.a.createElement("div",{className:"mx_MessageComposer_actions"},i,o&&r.a.createElement(Zr.b,{addEmoji:this.addEmoji,haveRecording:this.state.haveRecording,isMenuOpen:this.state.isMenuOpen,isStickerPickerOpen:this.state.isStickerPickerOpen,menuPosition:s,relation:this.props.relation,onRecordStartEndClick:this.onRecordStartEndClick,setStickerPickerOpen:this.setStickerPickerOpen,showLocationButton:!window.electron,showPollsButton:this.state.showPollsButton,showStickersButton:this.showStickersButton,isRichTextEnabled:this.state.isRichTextEnabled,onComposerModeClick:this.onRichTextToggle,toggleButtonMenu:this.toggleButtonMenu,showVoiceBroadcastButton:this.state.showVoiceBroadcastButton,onStartVoiceBroadcastClick:()=>{(async(e,t,a,n,i)=>{var s;if(!await Object(ft.C)(e,t,n))return null;const r=t.getUserId();if(!r)return null;const o=e.getMember(r);if(!o)return null;null===(s=a.getCurrent())||void 0===s||s.pause(),a.clearCurrent();const l=new ft.o(e,o,t,a,n);i.setCurrent(l)})(this.props.room,lt.a.get(),rt.b.instance.voiceBroadcastPlaybacksStore,rt.b.instance.voiceBroadcastRecordingsStore,rt.b.instance.voiceBroadcastPreRecordingStore),this.toggleButtonMenu()}}),u&&r.a.createElement(io,{key:"controls_send",onClick:this.sendMessage,title:this.state.haveRecording?Object(N.a)("Send voice message"):void 0})))))}}i()(so,"contextType",Ga.b),i()(so,"defaultProps",{compact:!1,showVoiceBroadcastButton:!1,isRichTextEnabled:!0});var ro=Object(R.c)(so);class oo{constructor(e){this.event=e,i()(this,"serializedParts",null),i()(this,"caret",null)}setEditorState(e,t){this.caret=e,this.serializedParts=t}hasEditorState(){return!!this.serializedParts}getSerializedParts(){return this.serializedParts}getCaret(){return this.caret}getEvent(){return this.event}}var lo=a(378),co=a(494);class mo extends r.a.PureComponent{constructor(e){super(e),i()(this,"dispatcherRef",void 0),i()(this,"mounted",!1),i()(this,"onAction",(e=>{this.mounted&&function(e){return[U.a.UploadStarted,U.a.UploadProgress,U.a.UploadFailed,U.a.UploadFinished,U.a.UploadCanceled].includes(e.action)}(e)&&this.setState(this.calculateState())})),i()(this,"onCancelClick",(e=>{e.preventDefault(),Oa.a.sharedInstance().cancelUpload(this.state.currentUpload)})),this.state=this.calculateState()}componentDidMount(){this.dispatcherRef=v.a.register(this.onAction),this.mounted=!0}componentWillUnmount(){this.mounted=!1,v.a.unregister(this.dispatcherRef)}getUploadsInRoom(){return Oa.a.sharedInstance().getCurrentUploads(this.props.relation).filter((e=>e.roomId===this.props.room.roomId))}calculateState(){const[e,...t]=this.getUploadsInRoom();return{currentUpload:e,currentFile:null==e?void 0:e.fileName,currentLoaded:null==e?void 0:e.loaded,currentTotal:null==e?void 0:e.total,countFiles:t.length+1}}render(){if(!this.state.currentFile)return null;const e=Object(N.a)("Uploading %(filename)s and %(count)s others",{filename:this.state.currentFile,count:this.state.countFiles-1}),t=Object(lo.filesize)(this.state.currentTotal);return r.a.createElement("div",{className:"mx_UploadBar"},r.a.createElement("div",{className:"mx_UploadBar_filename"},e," (",t,")"),r.a.createElement(G.a,{onClick:this.onCancelClick,className:"mx_UploadBar_cancel"}),r.a.createElement(co.a,{value:this.state.currentLoaded,max:this.state.currentTotal}))}}var uo=a(228);const ho=["mxEvent","permalinkCreator","onMenuToggle"];var po=e=>{let{mxEvent:t,permalinkCreator:a,onMenuToggle:n}=e,i=ve()(e,ho);const[o,l,c,d]=Object(ce.q)(),m=Object(s.useCallback)((e=>{e.preventDefault(),e.stopPropagation(),v.a.dispatch({action:U.a.ViewRoom,event_id:t.getId(),highlighted:!0,room_id:t.getRoomId(),metricsTrigger:void 0}),d()}),[t,d]),u=Object(s.useCallback)((async e=>{if(a){null==e||e.preventDefault(),null==e||e.stopPropagation();const n=a.forEvent(t.getId());await Object(uo.b)(n),d()}}),[t,d,a]);Object(s.useEffect)((()=>{null==n||n(o)}),[o,n]);const h=!Xa.d.instance.hasMaximisedWidget(lt.a.get().getRoom(t.getRoomId()));return r.a.createElement(r.a.Fragment,null,r.a.createElement(ce.c,Z()({},i,{className:"mx_BaseCard_header_title_button--option",onClick:c,title:Object(N.a)("Thread options"),isExpanded:o,inputRef:l,"data-testid":"threadlist-dropdown-button"})),o&&r.a.createElement(me.e,Z()({onFinished:d,className:"mx_RoomTile_contextMenu",compact:!0,rightAligned:!0},{left:(p=l.current.getBoundingClientRect()).left+window.scrollX+p.width,top:p.bottom+window.scrollY,chevronFace:ce.a.None}),r.a.createElement(me.c,null,h&&r.a.createElement(me.b,{onClick:e=>m(e),label:Object(N.a)("View in room"),iconClassName:"mx_ThreadPanel_viewInRoom"}),a&&r.a.createElement(me.b,{"data-testid":"copy-thread-link",onClick:e=>u(e),label:Object(N.a)("Copy link to thread"),iconClassName:"mx_ThreadPanel_copyLinkToThread"}))));var p};var go=e=>{let{parent:t,onFileDrop:n}=e;const[i,o]=Object(s.useState)({dragging:!1,counter:0});return Object(s.useEffect)((()=>{if(!t||t.ondrop)return;const e=e=>{e.stopPropagation(),e.preventDefault(),e.dataTransfer&&o((t=>({counter:t.counter+1,dragging:!(!e.dataTransfer.types.includes("Files")&&!e.dataTransfer.types.includes("application/x-moz-file"))||t.dragging})))},a=e=>{e.stopPropagation(),e.preventDefault(),o((e=>({counter:e.counter-1,dragging:!(e.counter<=1)&&e.dragging})))},i=e=>{e.stopPropagation(),e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="none",(e.dataTransfer.types.includes("Files")||e.dataTransfer.types.includes("application/x-moz-file"))&&(e.dataTransfer.dropEffect="copy"))},s=e=>{e.stopPropagation(),e.preventDefault(),e.dataTransfer&&(n(e.dataTransfer),o((e=>({dragging:!1,counter:e.counter-1}))))};return null==t||t.addEventListener("drop",s),null==t||t.addEventListener("dragover",i),null==t||t.addEventListener("dragenter",e),null==t||t.addEventListener("dragleave",a),()=>{null==t||t.removeEventListener("drop",s),null==t||t.removeEventListener("dragover",i),null==t||t.removeEventListener("dragenter",e),null==t||t.removeEventListener("dragleave",a)}}),[t,n]),i.dragging?r.a.createElement("div",{className:"mx_FileDropTarget"},r.a.createElement("img",{src:a(1512).default,className:"mx_FileDropTarget_image",alt:""}),Object(N.a)("Drop file here to upload")):null},vo=a(336);function bo(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function fo(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?bo(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):bo(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}class yo extends r.a.Component{constructor(e){var t;super(e),t=this,i()(this,"context",void 0),i()(this,"dispatcherRef",void 0),i()(this,"layoutWatcherRef",void 0),i()(this,"timelinePanel",Object(s.createRef)()),i()(this,"card",Object(s.createRef)()),i()(this,"onAction",(e=>{switch(e.phase==Ra.a.ThreadView&&e.event&&this.setupThread(e.event),e.action){case U.a.ComposerInsert:if(e.composerType)break;if(e.timelineRenderingType!==Ga.a.Thread)break;v.a.dispatch(fo(fo({},e),{},{composerType:this.state.editState?vo.a.Edit:vo.a.Send}));break;case U.a.EditEvent:if(e.timelineRenderingType!==Ga.a.Thread)return;if(e.event&&!e.event.getThread())return;this.setState({editState:e.event?new oo(e.event):null},(()=>{var t;e.event&&(null===(t=this.timelinePanel.current)||void 0===t||t.scrollToEventIfNeeded(e.event.getId()))}));break;case"reply_to_event":e.context===Ga.a.Thread&&this.setState({replyToEvent:e.event})}})),i()(this,"setupThread",(e=>{let t=this.props.room.getThread(e.getId());t||(t=this.props.room.createThread(e.getId(),e,[e],!0)),this.updateThread(t)})),i()(this,"onNewThread",(e=>{e.id===this.props.mxEvent.getId()&&this.setupThread(this.props.mxEvent)})),i()(this,"updateThreadRelation",(()=>{this.setState({lastReply:this.threadLastReply})})),i()(this,"updateThread",(e=>{this.state.thread!==e&&(this.setupThreadListeners(e,this.state.thread),e&&this.setState({thread:e,lastReply:this.threadLastReply},(async()=>this.postThreadUpdate(e))))})),i()(this,"resetJumpToEvent",(e=>{var t,a;this.props.initialEvent&&this.props.initialEventScrollIntoView&&e===(null===(t=this.props.initialEvent)||void 0===t?void 0:t.getId())&&v.a.dispatch({action:U.a.ViewRoom,room_id:this.props.room.roomId,event_id:null===(a=this.props.initialEvent)||void 0===a?void 0:a.getId(),highlighted:this.props.isInitialEventHighlighted,scroll_into_view:!1,replyingToEvent:this.state.replyToEvent,metricsTrigger:void 0})})),i()(this,"onMeasurement",(e=>{this.setState({narrow:e})})),i()(this,"onKeyDown",(e=>{let t=!1;if(Object(J.a)().getRoomAction(e)===W.h.UploadFile)v.a.dispatch({action:"upload_file",context:Ga.a.Thread},!0),t=!0;t&&(e.stopPropagation(),e.preventDefault())})),i()(this,"onFileDrop",(e=>{const t=this.props.mxEvent.getRoomId();t?Oa.a.sharedInstance().sendContentListToRoom(Array.from(e.files),t,this.threadRelation,lt.a.get(),Ga.a.Thread):console.warn("Unknwon roomId for event",this.props.mxEvent)})),i()(this,"renderThreadViewHeader",(()=>r.a.createElement("div",{className:"mx_BaseCard_header_title"},r.a.createElement(ra.a,{size:"h4",className:"mx_BaseCard_header_title_heading"},Object(N.a)("Thread")),r.a.createElement(po,{mxEvent:this.props.mxEvent,permalinkCreator:this.props.permalinkCreator}))));const a=this.props.room.getThread(this.props.mxEvent.getId());this.setupThreadListeners(a),this.state={layout:b.b.getValue("layout"),narrow:!1,thread:a,lastReply:null==a?void 0:a.lastReply((e=>e.isRelation(Ea.d.name)&&!e.status))},this.layoutWatcherRef=b.b.watchSetting("layout",null,(function(){for(var e=arguments.length,a=new Array(e),n=0;n<e;n++)a[n]=arguments[n];let[,,,i]=a;return t.setState({layout:i})}))}componentDidMount(){this.state.thread&&this.postThreadUpdate(this.state.thread),this.setupThread(this.props.mxEvent),this.dispatcherRef=v.a.register(this.onAction);lt.a.get().getRoom(this.props.mxEvent.getRoomId()).on(Ea.f.New,this.onNewThread)}componentWillUnmount(){this.dispatcherRef&&v.a.unregister(this.dispatcherRef);const e=this.props.mxEvent.getRoomId();lt.a.get().getRoom(e).removeListener(Ea.f.New,this.onNewThread),b.b.unwatchSetting(this.layoutWatcherRef);const t=rt.b.instance.roomViewStore.getRoomId()!==e;this.props.initialEvent&&!t&&v.a.dispatch({action:U.a.ViewRoom,room_id:this.props.room.roomId,metricsTrigger:void 0}),v.a.dispatch({action:U.a.ViewThread,thread_id:null})}componentDidUpdate(e){e.mxEvent!==this.props.mxEvent&&this.setupThread(this.props.mxEvent),e.room!==this.props.room&&Ia.a.instance.setCard({phase:Ra.a.RoomSummary})}get threadLastReply(){var e;return null===(e=this.state.thread)||void 0===e?void 0:e.lastReply((e=>e.isRelation(Ea.d.name)&&!e.status))}async postThreadUpdate(e){var t,a;v.a.dispatch({action:U.a.ViewThread,thread_id:e.id}),e.emit(Ea.f.ViewThread),this.updateThreadRelation(),null===(t=this.timelinePanel.current)||void 0===t||t.refreshTimeline(null===(a=this.props.initialEvent)||void 0===a?void 0:a.getId())}setupThreadListeners(e,t){t&&(this.state.thread.off(Ea.f.NewReply,this.updateThreadRelation),this.props.room.off(te.d.LocalEchoUpdated,this.updateThreadRelation)),e&&(e.on(Ea.f.NewReply,this.updateThreadRelation),this.props.room.on(te.d.LocalEchoUpdated,this.updateThreadRelation))}get threadRelation(){var e,t,a,n;const i={rel_type:Ea.d.name,event_id:null===(e=this.state.thread)||void 0===e?void 0:e.id,is_falling_back:!0},s=null!==(t=null===(a=this.state.lastReply)||void 0===a?void 0:a.getId())&&void 0!==t?t:null===(n=this.state.thread)||void 0===n?void 0:n.id;return s&&(i["m.in_reply_to"]={event_id:s}),i}render(){var e,t,a,n,i,s;const o=this.props.isInitialEventHighlighted?null===(e=this.props.initialEvent)||void 0===e?void 0:e.getId():null,l=this.threadRelation;let d;var m;this.state.thread?(this.props.initialEvent&&this.props.initialEvent.getRoomId()!==this.state.thread.roomId&&ga.a.warn("ThreadView attempting to render TimelinePanel with mismatched initialEvent",this.state.thread.roomId,this.props.initialEvent.getRoomId(),this.props.initialEvent.getId()),d=r.a.createElement(r.a.Fragment,null,r.a.createElement(go,{parent:this.card.current,onFileDrop:this.onFileDrop}),r.a.createElement(_r,{key:this.state.thread.id,ref:this.timelinePanel,showReadReceipts:!0,manageReadReceipts:!0,manageReadMarkers:!0,sendReadReceiptOnLoad:!0,timelineSet:this.state.thread.timelineSet,showUrlPreview:this.context.showUrlPreview,layout:this.state.layout===wr.a.Bubble?wr.a.Bubble:wr.a.Group,hideThreadedMessages:!1,hidden:!1,showReactions:!0,className:"mx_RoomView_messagePanel",permalinkCreator:this.props.permalinkCreator,membersLoaded:!0,editState:this.state.editState,eventId:null===(m=this.props.initialEvent)||void 0===m?void 0:m.getId(),highlightedEventId:o,eventScrollIntoView:this.props.initialEventScrollIntoView,onEventScrolledIntoView:this.resetJumpToEvent}))):d=r.a.createElement("div",{className:"mx_RoomView_messagePanelSpinner"},r.a.createElement(Kn.a,null));return r.a.createElement(Ga.b.Provider,{value:fo(fo({},this.context),{},{timelineRenderingType:Ga.a.Thread,threadId:null===(t=this.state.thread)||void 0===t?void 0:t.id,liveTimeline:null===(a=this.state)||void 0===a||null===(n=a.thread)||void 0===n||null===(i=n.timelineSet)||void 0===i?void 0:i.getLiveTimeline(),narrow:this.state.narrow})},r.a.createElement(Da,{className:c()("mx_ThreadView mx_ThreadPanel",{mx_ThreadView_narrow:this.state.narrow}),onClose:this.props.onClose,withoutScrollContainer:!0,header:this.renderThreadViewHeader(),ref:this.card,onKeyDown:this.onKeyDown,onBack:e=>{re.b.trackInteraction("WebThreadViewBackButton",e)}},r.a.createElement(Sr,{sensor:this.card.current,onMeasurement:this.onMeasurement}),r.a.createElement("div",{className:"mx_ThreadView_timelinePanelWrapper"},d),Oa.a.sharedInstance().getCurrentUploads(l).length>0&&r.a.createElement(mo,{room:this.props.room,relation:l}),(null===(s=this.state.thread)||void 0===s?void 0:s.timelineSet)&&r.a.createElement(ro,{room:this.props.room,resizeNotifier:this.props.resizeNotifier,relation:l,replyToEvent:this.state.replyToEvent,permalinkCreator:this.props.permalinkCreator,e2eStatus:this.props.e2eStatus,compact:!0})))}}i()(yo,"contextType",Ga.b);var Eo=a(550);function _o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function wo(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?_o(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):_o(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}let So;!function(e){e[e.My=0]="My",e[e.All=1]="All"}(So||(So={}));const Oo=e=>{let{label:t,description:a,onClick:n,isSelected:i}=e;return r.a.createElement(ce.f,{active:i,className:"mx_ThreadPanel_Header_FilterOptionItem",onClick:n},r.a.createElement("span",null,t),r.a.createElement("span",null,a))},Co=e=>{let{filterOption:t,setFilterOption:a,empty:n}=e;const[i,s,o,l]=Object(ce.q)(),c=[{label:Object(N.a)("All threads"),description:Object(N.a)("Shows all threads from current room"),key:So.All},{label:Object(N.a)("My threads"),description:Object(N.a)("Shows all threads you've participated in"),key:So.My}],d=c.find((e=>e.key===t)),m=c.map((e=>r.a.createElement(Oo,{key:e.key,label:e.label,description:e.description,onClick:()=>{a(e.key),l()},isSelected:e===d}))),u=i?r.a.createElement(ce.n,{top:108,right:33,onFinished:l,chevronFace:ce.a.Top,wrapperClassName:"mx_BaseCard_header_title"},m):null;return r.a.createElement("div",{className:"mx_BaseCard_header_title"},r.a.createElement(ra.a,{size:"h4",className:"mx_BaseCard_header_title_heading"},Object(N.a)("Threads")),!n&&r.a.createElement(r.a.Fragment,null,r.a.createElement(Eo.a,{className:"mx_ThreadPanel_dropdown",inputRef:s,isExpanded:i,onClick:e=>{o(),re.b.trackInteraction("WebRightPanelThreadPanelFilterDropdown",e)}},`${Object(N.a)("Show:")} ${d.label}`),u))},xo=e=>{let t,{hasThreads:a,filterOption:n,showAllThreadsCallback:i}=e;return t=a?r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,Object(N.a)("Reply to an ongoing thread or use “%(replyInThread)s” when hovering over a message to start a new one.",{replyInThread:Object(N.a)("Reply in thread")})),r.a.createElement("p",null,n===So.My?r.a.createElement("button",{onClick:i},Object(N.a)("Show all threads")):r.a.createElement(r.a.Fragment,null," "))):r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,Object(N.a)("Threads help keep your conversations on-topic and easy to track.")),r.a.createElement("p",{className:"mx_ThreadPanel_empty_tip"},Object(N.a)("<b>Tip:</b> Use “%(replyInThread)s” when hovering over a message.",{replyInThread:Object(N.a)("Reply in thread")},{b:e=>r.a.createElement("b",null,e)}))),r.a.createElement("aside",{className:"mx_ThreadPanel_empty"},r.a.createElement("div",{className:"mx_ThreadPanel_largeIcon"}),r.a.createElement("h2",null,Object(N.a)("Keep discussions organised with threads")),t)};var jo=e=>{var t,a,n,i,o,l;let{roomId:c,onClose:d,permalinkCreator:m}=e;const u=Object(s.useContext)(R.a),h=Object(s.useContext)(Ga.b),p=Object(s.useRef)(),g=Object(s.useRef)(),[v,b]=Object(s.useState)(So.All),[f,y]=Object(s.useState)(null),[E,_]=Object(s.useState)(!1),w=v===So.My?null==f?void 0:f.threadsTimelineSets[1]:null==f?void 0:f.threadsTimelineSets[0],S=Boolean(null==f||null===(t=f.threadsTimelineSets)||void 0===t||null===(a=t[0])||void 0===a||null===(n=a.getLiveTimeline())||void 0===n||null===(i=n.getEvents())||void 0===i?void 0:i.length);return Object(s.useEffect)((()=>{const e=u.getRoom(c);null==e||e.createThreadsTimelineSets().then((()=>e.fetchRoomThreads())).then((()=>{b(So.All),y(e)}))}),[u,c]),Object(s.useEffect)((()=>{w&&!Ea.e.hasServerSideSupport&&p.current.refreshTimeline()}),[w,p]),r.a.createElement(Ga.b.Provider,{value:wo(wo({},h),{},{timelineRenderingType:Ga.a.ThreadsList,showHiddenEvents:!0,narrow:E})},r.a.createElement(Da,{header:r.a.createElement(Co,{filterOption:v,setFilterOption:b,empty:!S}),className:"mx_ThreadPanel",onClose:d,withoutScrollContainer:!0,ref:g},r.a.createElement(Sr,{sensor:g.current,onMeasurement:_}),w?r.a.createElement(_r,{key:v+":"+(null!==(o=null===(l=w.getFilter())||void 0===l?void 0:l.filterId)&&void 0!==o?o:c),ref:p,showReadReceipts:!1,manageReadReceipts:!1,manageReadMarkers:!1,sendReadReceiptOnLoad:!1,timelineSet:w,showUrlPreview:!1,empty:r.a.createElement(xo,{hasThreads:S,filterOption:v,showAllThreadsCallback:()=>b(So.All)}),alwaysShowTimestamps:!0,layout:wr.a.Group,hideThreadedMessages:!1,hidden:!1,showReactions:!1,className:"mx_RoomView_messagePanel",membersLoaded:!0,permalinkCreator:m,disableGrouping:!0}):r.a.createElement("div",{className:"mx_AutoHideScrollbar"},r.a.createElement(Kn.a,null))))};function ko(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function Ro(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?ko(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):ko(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}class Io extends r.a.PureComponent{constructor(e){super(e),i()(this,"card",r.a.createRef()),i()(this,"onMeasurement",(e=>{this.setState({narrow:e})})),this.state={narrow:!1}}render(){const e=r.a.createElement("div",{className:"mx_RightPanel_empty mx_NotificationPanel_empty"},r.a.createElement("h2",null,Object(N.a)("You're all caught up")),r.a.createElement("p",null,Object(N.a)("You have no visible notifications.")));let t;const a=lt.a.get().getNotifTimelineSet();return a?t=r.a.createElement(_r,{manageReadReceipts:!1,manageReadMarkers:!1,timelineSet:a,showUrlPreview:!1,empty:e,alwaysShowTimestamps:!0,layout:wr.a.Group}):(ga.a.error("No notifTimelineSet available!"),t=r.a.createElement(Kn.a,null)),r.a.createElement(Ga.b.Provider,{value:Ro(Ro({},this.context),{},{timelineRenderingType:Ga.a.Notification,narrow:this.state.narrow})},r.a.createElement(Da,{header:r.a.createElement(ra.a,{size:"h4",className:"mx_BaseCard_header_title_heading"},Object(N.a)("Notifications")),className:"mx_ThreadPanel",onClose:this.props.onClose,withoutScrollContainer:!0},this.card.current&&r.a.createElement(Sr,{sensor:this.card.current,onMeasurement:this.onMeasurement}),t))}}i()(Io,"contextType",Ga.b);var To=e=>{const t=c()({mx_JumpToBottomButton:!0,mx_JumpToBottomButton_highlight:e.highlight});let a;return e.numUnreadMessages&&(a=r.a.createElement("div",{className:"mx_JumpToBottomButton_badge"},e.numUnreadMessages)),r.a.createElement("div",{className:t},r.a.createElement(G.a,{className:"mx_JumpToBottomButton_scrollDown",title:Object(N.a)("Scroll to most recent messages"),onClick:e.onScrollToBottomClick}),a)};function No(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function Po(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?No(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):No(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}class Do extends r.a.Component{constructor(e){super(e),i()(this,"dispatcherRef",void 0),i()(this,"layoutWatcherRef",void 0),i()(this,"timelinePanel",r.a.createRef()),i()(this,"card",r.a.createRef()),i()(this,"readReceiptsSettingWatcher",void 0),i()(this,"onRoomViewStoreUpdate",(async e=>{const t={initialEventId:rt.b.instance.roomViewStore.getInitialEventId(),isInitialEventHighlighted:rt.b.instance.roomViewStore.isInitialEventHighlighted(),replyToEvent:rt.b.instance.roomViewStore.getQuotingEvent()};this.setState(t)})),i()(this,"onAction",(e=>{if(e.action===U.a.EditEvent)this.setState({editState:e.event?new oo(e.event):null},(()=>{var t;e.event&&(null===(t=this.timelinePanel.current)||void 0===t||t.scrollToEventIfNeeded(e.event.getId()))}))})),i()(this,"onScroll",(()=>{const e=this.timelinePanel.current;e&&(e.isAtEndOfLiveTimeline()?this.setState({atEndOfLiveTimeline:!0}):this.setState({atEndOfLiveTimeline:!1}),this.state.initialEventId&&this.state.isInitialEventHighlighted&&v.a.dispatch({action:U.a.ViewRoom,room_id:this.props.room.roomId,event_id:this.state.initialEventId,highlighted:!1,replyingToEvent:this.state.replyToEvent,metricsTrigger:void 0}))})),i()(this,"onMeasurement",(e=>{this.setState({narrow:e})})),i()(this,"jumpToLiveTimeline",(()=>{var e;this.state.initialEventId&&this.state.isInitialEventHighlighted?v.a.dispatch({action:U.a.ViewRoom,room_id:this.props.room.roomId}):(null===(e=this.timelinePanel.current)||void 0===e||e.jumpToLiveTimeline(),v.a.fire(U.a.FocusSendMessageComposer))})),i()(this,"renderTimelineCardHeader",(()=>r.a.createElement("div",{className:"mx_BaseCard_header_title"},r.a.createElement(ra.a,{size:"h4",className:"mx_BaseCard_header_title_heading"},Object(N.a)("Chat"))))),this.state={showReadReceipts:b.b.getValue("showReadReceipts",e.room.roomId),layout:b.b.getValue("layout"),atEndOfLiveTimeline:!0,narrow:!1},this.readReceiptsSettingWatcher=null}componentDidMount(){var e=this;rt.b.instance.roomViewStore.addListener(pt.b,this.onRoomViewStoreUpdate),this.dispatcherRef=v.a.register(this.onAction),this.readReceiptsSettingWatcher=b.b.watchSetting("showReadReceipts",null,(function(){for(var t=arguments.length,a=new Array(t),n=0;n<t;n++)a[n]=arguments[n];let[,,,i]=a;return e.setState({showReadReceipts:i})})),this.layoutWatcherRef=b.b.watchSetting("layout",null,(function(){for(var t=arguments.length,a=new Array(t),n=0;n<t;n++)a[n]=arguments[n];let[,,,i]=a;return e.setState({layout:i})}))}componentWillUnmount(){rt.b.instance.roomViewStore.removeListener(pt.b,this.onRoomViewStoreUpdate),this.readReceiptsSettingWatcher&&b.b.unwatchSetting(this.readReceiptsSettingWatcher),this.layoutWatcherRef&&b.b.unwatchSetting(this.layoutWatcherRef),v.a.unregister(this.dispatcherRef)}render(){var e;const t=this.state.isInitialEventHighlighted?this.state.initialEventId:null;let a;this.state.atEndOfLiveTimeline||(a=r.a.createElement(To,{highlight:this.props.room.getUnreadNotificationCount(te.b.Highlight)>0,onScrollToBottomClick:this.jumpToLiveTimeline}));const n=Oa.a.sharedInstance().getCurrentUploads(this.props.composerRelation).length>0,i="join"===this.props.room.getMyMembership();return r.a.createElement(Ga.b.Provider,{value:Po(Po({},this.context),{},{timelineRenderingType:null!==(e=this.props.timelineRenderingType)&&void 0!==e?e:this.context.timelineRenderingType,liveTimeline:this.props.timelineSet.getLiveTimeline(),narrow:this.state.narrow})},r.a.createElement(Da,{className:this.props.classNames,onClose:this.props.onClose,withoutScrollContainer:!0,header:this.renderTimelineCardHeader(),ref:this.card},r.a.createElement(Sr,{sensor:this.card.current,onMeasurement:this.onMeasurement}),r.a.createElement("div",{className:"mx_TimelineCard_timeline"},a,r.a.createElement(_r,{ref:this.timelinePanel,showReadReceipts:this.state.showReadReceipts,manageReadReceipts:!0,manageReadMarkers:!1,sendReadReceiptOnLoad:!0,timelineSet:this.props.timelineSet,showUrlPreview:this.context.showUrlPreview,layout:this.state.layout===wr.a.Bubble?wr.a.Bubble:wr.a.Group,hideThreadedMessages:!1,hidden:!1,showReactions:!0,className:"mx_RoomView_messagePanel",permalinkCreator:this.props.permalinkCreator,membersLoaded:!0,editState:this.state.editState,eventId:this.state.initialEventId,resizeNotifier:this.props.resizeNotifier,highlightedEventId:t,onScroll:this.onScroll})),n&&r.a.createElement(mo,{room:this.props.room,relation:this.props.composerRelation}),i&&r.a.createElement(ro,{room:this.props.room,relation:this.props.composerRelation,resizeNotifier:this.props.resizeNotifier,replyToEvent:this.state.replyToEvent,permalinkCreator:this.props.permalinkCreator,e2eStatus:this.props.e2eStatus,compact:!0})))}}function Mo(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}i()(Do,"contextType",Ga.b);class Ao extends r.a.Component{constructor(e,t){super(e,t),i()(this,"context",void 0),i()(this,"delayedUpdate",Object(j.throttle)((()=>{this.forceUpdate()}),500,{leading:!0,trailing:!0})),i()(this,"onRoomStateMember",((e,t,a)=>{this.props.room&&a.roomId===this.props.room.roomId&&(this.state.phase===Ra.a.RoomMemberList||this.state.phase===Ra.a.RoomMemberInfo&&a.userId===this.state.cardState.member.userId)&&this.delayedUpdate()})),i()(this,"onRightPanelStoreUpdate",(()=>{this.setState(function(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?Mo(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):Mo(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}({},Ao.getDerivedStateFromProps(this.props)))})),i()(this,"onClose",(()=>{var e,t,a;if(null!==(e=this.props.overwriteCard)&&void 0!==e&&null!==(t=e.state)&&void 0!==t&&t.member)v.a.dispatch({action:U.a.ViewHomePage});else if(this.state.phase===Ra.a.EncryptionPanel&&null!==(a=this.state.cardState.verificationRequest)&&void 0!==a&&a.pending)this.state.cardState.verificationRequest.cancel();else{var n;Ia.a.instance.togglePanel(null===(n=this.props.room)||void 0===n?void 0:n.roomId)}})),i()(this,"onSearchQueryChanged",(e=>{this.setState({searchQuery:e})})),this.state={searchQuery:""}}componentDidMount(){this.context.on(m.b.Members,this.onRoomStateMember),Ia.a.instance.on(pt.b,this.onRightPanelStoreUpdate)}componentWillUnmount(){var e;null===(e=this.context)||void 0===e||e.removeListener(m.b.Members,this.onRoomStateMember),Ia.a.instance.off(pt.b,this.onRightPanelStoreUpdate)}static getDerivedStateFromProps(e){var t,a;let n;return e.room&&(n=Ia.a.instance.currentCardForRoom(e.room.roomId)),{cardState:null===(t=n)||void 0===t?void 0:t.state,phase:null===(a=n)||void 0===a?void 0:a.phase}}render(){var e,t,a,n,i;let s=r.a.createElement("div",null);const o=null===(e=this.props.room)||void 0===e?void 0:e.roomId,l=null!==(t=null===(a=this.props.overwriteCard)||void 0===a?void 0:a.phase)&&void 0!==t?t:this.state.phase,c=null!==(n=null===(i=this.props.overwriteCard)||void 0===i?void 0:i.state)&&void 0!==n?n:this.state.cardState;switch(l){case Ra.a.RoomMemberList:o&&(s=r.a.createElement(xs,{roomId:o,key:o,onClose:this.onClose,searchQuery:this.state.searchQuery,onSearchQueryChanged:this.onSearchQueryChanged}));break;case Ra.a.SpaceMemberList:s=r.a.createElement(xs,{roomId:c.spaceId?c.spaceId:o,key:c.spaceId?c.spaceId:o,onClose:this.onClose,searchQuery:this.state.searchQuery,onSearchQueryChanged:this.onSearchQueryChanged});break;case Ra.a.RoomMemberInfo:case Ra.a.SpaceMemberInfo:case Ra.a.EncryptionPanel:{var d;const e=c.member instanceof ka.a?c.member:void 0;s=r.a.createElement(rr,{user:c.member,room:null!==(d=this.context.getRoom(null==e?void 0:e.roomId))&&void 0!==d?d:this.props.room,key:o||c.member.userId,onClose:this.onClose,phase:l,verificationRequest:c.verificationRequest,verificationRequestPromise:c.verificationRequestPromise});break}case Ra.a.Room3pidMemberInfo:case Ra.a.Space3pidMemberInfo:s=r.a.createElement(or,{event:c.memberInfoEvent,key:o});break;case Ra.a.NotificationPanel:s=r.a.createElement(Io,{onClose:this.onClose});break;case Ra.a.PinnedMessages:b.b.getValue("feature_pinning")&&(s=r.a.createElement(oi,{room:this.props.room,onClose:this.onClose,permalinkCreator:this.props.permalinkCreator}));break;case Ra.a.Timeline:s=r.a.createElement(Do,{classNames:"mx_ThreadPanel mx_TimelineCard",room:this.props.room,timelineSet:this.props.room.getUnfilteredTimelineSet(),resizeNotifier:this.props.resizeNotifier,onClose:this.onClose,permalinkCreator:this.props.permalinkCreator,e2eStatus:this.props.e2eStatus});break;case Ra.a.FilePanel:s=r.a.createElement(jr,{roomId:o,resizeNotifier:this.props.resizeNotifier,onClose:this.onClose});break;case Ra.a.ThreadView:s=r.a.createElement(yo,{room:this.props.room,resizeNotifier:this.props.resizeNotifier,onClose:this.onClose,mxEvent:c.threadHeadEvent,initialEvent:c.initialEvent,isInitialEventHighlighted:c.isInitialEventHighlighted,initialEventScrollIntoView:c.initialEventScrollIntoView,permalinkCreator:this.props.permalinkCreator,e2eStatus:this.props.e2eStatus});break;case Ra.a.ThreadPanel:s=r.a.createElement(jo,{roomId:o,resizeNotifier:this.props.resizeNotifier,onClose:this.onClose,permalinkCreator:this.props.permalinkCreator});break;case Ra.a.RoomSummary:s=r.a.createElement(rs,{room:this.props.room,onClose:this.onClose,permalinkCreator:this.props.permalinkCreator});break;case Ra.a.Widget:s=r.a.createElement(bs,{room:this.props.room,widgetId:c.widgetId,onClose:this.onClose})}return r.a.createElement("aside",{className:"mx_RightPanel dark-panel",id:"mx_RightPanel"},s)}}i()(Ao,"contextType",R.a);class Lo{constructor(){i()(this,"scrollStateMap",new Map)}getScrollState(e){return this.scrollStateMap.get(e)}setScrollState(e,t){this.scrollStateMap.set(e,t)}}void 0===window.mxRoomScrollStateStore&&(window.mxRoomScrollStateStore=new Lo);var Uo=window.mxRoomScrollStateStore,Fo=a(379),Bo=a(380),Vo=a(401),Wo=a(1513),Ho=a(289),zo=a(196);class Go extends r.a.PureComponent{constructor(e){super(e),i()(this,"onViewClick",(()=>{this.setState({hidden:!1})})),this.state={hidden:!0}}render(){const e=c()({mx_InviteReason:!0,mx_InviteReason_hidden:this.state.hidden});return r.a.createElement("div",{className:e},r.a.createElement("div",{className:"mx_InviteReason_reason"},this.props.htmlReason?Object(zo.i)(this.props.htmlReason):this.props.reason),r.a.createElement("div",{className:"mx_InviteReason_view",onClick:this.onViewClick},Object(N.a)("View message")))}}var Ko;!function(e){e.NotLoggedIn="NotLoggedIn",e.Joining="Joining",e.Loading="Loading",e.Rejecting="Rejecting",e.Kicked="Kicked",e.Banned="Banned",e.OtherThreePIDError="OtherThreePIDError",e.InvitedEmailNotFoundInAccount="InvitedEmailNotFoundInAccount",e.InvitedEmailNoIdentityServer="InvitedEmailNoIdentityServer",e.InvitedEmailMismatch="InvitedEmailMismatch",e.Invite="Invite",e.ViewingRoom="ViewingRoom",e.RoomNotFound="RoomNotFound",e.OtherError="OtherError"}(Ko||(Ko={}));class qo extends r.a.Component{constructor(e){super(e),i()(this,"onLoginClick",(()=>{v.a.dispatch({action:"start_login",screenAfterLogin:this.makeScreenAfterLogin()})})),i()(this,"onRegisterClick",(()=>{v.a.dispatch({action:"start_registration",screenAfterLogin:this.makeScreenAfterLogin()})})),this.state={busy:!1}}componentDidMount(){this.checkInvitedEmail()}componentDidUpdate(e,t){this.props.invitedEmail===e.invitedEmail&&this.props.inviterName===e.inviterName||this.checkInvitedEmail()}async checkInvitedEmail(){if(this.props.inviterName&&this.props.invitedEmail){this.setState({busy:!0});try{const e=await lt.a.get().getThreePids();if(this.setState({accountEmails:e.threepids.filter((e=>"email"===e.medium)).map((e=>e.address))}),!lt.a.get().getIdentityServerUrl())return void this.setState({busy:!1});const t=new Ho.a,a=await t.getAccessToken(),n=await lt.a.get().lookupThreePid("email",this.props.invitedEmail,a);this.setState({invitedEmailMxid:n.mxid})}catch(e){this.setState({threePidFetchError:e})}this.setState({busy:!1})}}getMessageCase(){if(lt.a.get().isGuest())return Ko.NotLoggedIn;const e=this.getMyMember();if(e){if(e.isKicked())return Ko.Kicked;if("ban"===e.membership)return Ko.Banned}if(this.props.joining)return Ko.Joining;if(this.props.rejecting)return Ko.Rejecting;if(this.props.loading||this.state.busy)return Ko.Loading;if(this.props.inviterName){if(this.props.invitedEmail){if(this.state.threePidFetchError)return Ko.OtherThreePIDError;if(this.state.accountEmails&&!this.state.accountEmails.includes(this.props.invitedEmail))return Ko.InvitedEmailNotFoundInAccount;if(!lt.a.get().getIdentityServerUrl())return Ko.InvitedEmailNoIdentityServer;if(this.state.invitedEmailMxid!=lt.a.get().getUserId())return Ko.InvitedEmailMismatch}return Ko.Invite}return this.props.error?"M_NOT_FOUND"==this.props.error.errcode?Ko.RoomNotFound:Ko.OtherError:Ko.ViewingRoom}getKickOrBanInfo(){const e=this.getMyMember();if(!e)return{};const t=this.props.room.currentState.getMember(e.events.member.getSender());return{memberName:t?t.name:e.events.member.getSender(),reason:e.events.member.getContent().reason}}joinRule(){var e,t,a;return null!==(e=null===(t=this.props.room)||void 0===t||null===(a=t.currentState.getStateEvents(ee.b.RoomJoinRules,""))||void 0===a?void 0:a.getContent().join_rule)&&void 0!==e?e:null}getMyMember(){var e,t;return null!==(e=null===(t=this.props.room)||void 0===t?void 0:t.getMember(lt.a.get().getUserId()))&&void 0!==e?e:null}getInviteMember(){const{room:e}=this.props;if(!e)return null;const t=lt.a.get().getUserId(),a=e.currentState.getMember(t);if(!a)return null;const n=a.events.member.getSender();return e.currentState.getMember(n)}isDMInvite(){const e=this.getMyMember();if(!e)return!1;const t=e.events.member.getContent();return"invite"===t.membership&&t.is_direct}makeScreenAfterLogin(){var e,t,a,n,i,s;return{screen:"room",params:{email:this.props.invitedEmail,signurl:this.props.signUrl,room_name:null!==(e=null===(t=this.props.oobData)||void 0===t?void 0:t.name)&&void 0!==e?e:null,room_avatar_url:null!==(a=null===(n=this.props.oobData)||void 0===n?void 0:n.avatarUrl)&&void 0!==a?a:null,inviter_name:null!==(i=null===(s=this.props.oobData)||void 0===s?void 0:s.inviterName)&&void 0!==i?i:null}}}render(){var e,t,a,n,i,s;const o=mt.b.get().brand,l=null!==(e=null!==(t=null===(a=this.props.room)||void 0===a?void 0:a.name)&&void 0!==t?t:this.props.roomAlias)&&void 0!==e?e:"",d=null!==(n=null===(i=this.props.room)||void 0===i?void 0:i.isSpaceRoom())&&void 0!==n?n:(null===(s=this.props.oobData)||void 0===s?void 0:s.roomType)===ee.j.Space;let m,u,h,p,g,v,f,y,E=!1;const _=[],w=this.getMessageCase();switch(w){case Ko.Joining:var S;m=null!==(S=this.props.oobData)&&void 0!==S&&S.roomType||d?d?Object(N.a)("Joining space…"):Object(N.a)("Joining room…"):Object(N.a)("Joining…"),E=!0;break;case Ko.Loading:m=Object(N.a)("Loading…"),E=!0;break;case Ko.Rejecting:m=Object(N.a)("Rejecting invite…"),E=!0;break;case Ko.NotLoggedIn:{const e={canJoin:!1};this.props.roomId&&nn.a.instance.invoke(Wo.RoomViewLifecycle.PreviewRoomNotLoggedIn,e,this.props.roomId),e.canJoin?(m=Object(N.a)("Join the room to participate"),g=Object(N.a)("Join"),p=()=>{nn.a.instance.invoke(Wo.RoomViewLifecycle.JoinFromRoomPreview,this.props.roomId)}):(m=Object(N.a)("Join the conversation with an account"),b.b.getValue(oe.b.Registration)&&(g=Object(N.a)("Sign Up"),p=this.onRegisterClick),f=Object(N.a)("Sign In"),v=this.onLoginClick),this.props.previewLoading&&(y=r.a.createElement("div",null,r.a.createElement(Kn.a,{w:20,h:20}),Object(N.a)("Loading preview")));break}case Ko.Kicked:{const{memberName:e,reason:t}=this.getKickOrBanInfo();m=l?Object(N.a)("You were removed from %(roomName)s by %(memberName)s",{memberName:e,roomName:l}):Object(N.a)("You were removed by %(memberName)s",{memberName:e}),u=t?Object(N.a)("Reason: %(reason)s",{reason:t}):void 0,g=d?Object(N.a)("Forget this space"):Object(N.a)("Forget this room"),p=this.props.onForgetClick,this.joinRule()!==_a.c.Invite&&(f=g,v=p,g=Object(N.a)("Re-join"),p=this.props.onJoinClick);break}case Ko.Banned:{const{memberName:e,reason:t}=this.getKickOrBanInfo();m=l?Object(N.a)("You were banned from %(roomName)s by %(memberName)s",{memberName:e,roomName:l}):Object(N.a)("You were banned by %(memberName)s",{memberName:e}),u=t?Object(N.a)("Reason: %(reason)s",{reason:t}):void 0,g=d?Object(N.a)("Forget this space"):Object(N.a)("Forget this room"),p=this.props.onForgetClick;break}case Ko.OtherThreePIDError:{m=l?Object(N.a)("Something went wrong with your invite to %(roomName)s",{roomName:l}):Object(N.a)("Something went wrong with your invite.");const e=this.joinRule(),t=Object(N.a)("An error (%(errcode)s) was returned while trying to validate your invite. You could try to pass this information on to the person who invited you.",{errcode:this.state.threePidFetchError.errcode||Object(N.a)("unknown error code")});switch(e){case"invite":u=[Object(N.a)("You can only join it with a working invite."),t],g=Object(N.a)("Try to join anyway"),p=this.props.onJoinClick;break;case"public":u=Object(N.a)("You can still join here."),g=Object(N.a)("Join the discussion"),p=this.props.onJoinClick;break;default:u=t,g=Object(N.a)("Try to join anyway"),p=this.props.onJoinClick}break}case Ko.InvitedEmailNotFoundInAccount:m=l?Object(N.a)("This invite to %(roomName)s was sent to %(email)s which is not associated with your account",{roomName:l,email:this.props.invitedEmail}):Object(N.a)("This invite was sent to %(email)s which is not associated with your account",{email:this.props.invitedEmail}),u=Object(N.a)("Link this email with your account in Settings to receive invites directly in %(brand)s.",{brand:o}),g=Object(N.a)("Join the discussion"),p=this.props.onJoinClick;break;case Ko.InvitedEmailNoIdentityServer:m=l?Object(N.a)("This invite to %(roomName)s was sent to %(email)s",{roomName:l,email:this.props.invitedEmail}):Object(N.a)("This invite was sent to %(email)s",{email:this.props.invitedEmail}),u=Object(N.a)("Use an identity server in Settings to receive invites directly in %(brand)s.",{brand:o}),g=Object(N.a)("Join the discussion"),p=this.props.onJoinClick;break;case Ko.InvitedEmailMismatch:m=l?Object(N.a)("This invite to %(roomName)s was sent to %(email)s",{roomName:l,email:this.props.invitedEmail}):Object(N.a)("This invite was sent to %(email)s",{email:this.props.invitedEmail}),u=Object(N.a)("Share this email in Settings to receive invites directly in %(brand)s.",{brand:o}),g=Object(N.a)("Join the discussion"),p=this.props.onJoinClick;break;case Ko.Invite:{var O,C;const e=r.a.createElement(ye.a,{room:this.props.room,oobData:this.props.oobData}),t=this.getInviteMember();let a;a=t?r.a.createElement("span",null,r.a.createElement("span",{className:"mx_RoomPreviewBar_inviter"},t.rawDisplayName)," (",t.userId,")"):r.a.createElement("span",{className:"mx_RoomPreviewBar_inviter"},this.props.inviterName);this.isDMInvite()?(m=Object(N.a)("Do you want to chat with %(user)s?",{user:t.name}),u=[e,Object(N.a)("<userName/> wants to chat",{},{userName:()=>a})],g=Object(N.a)("Start chatting")):(m=Object(N.a)("Do you want to join %(roomName)s?",{roomName:l}),u=[e,Object(N.a)("<userName/> invited you",{},{userName:()=>a})],g=Object(N.a)("Accept"));const n=lt.a.get().getUserId(),i=null===(O=this.props.room)||void 0===O?void 0:O.currentState.getMember(n),s=null==i||null===(C=i.events.member)||void 0===C?void 0:C.getContent();null!=s&&s.reason&&(h=r.a.createElement(Go,{reason:s.reason,htmlReason:s["io.element.html_reason"]})),p=this.props.onJoinClick,f=Object(N.a)("Reject"),v=this.props.onRejectClick,this.props.onRejectAndIgnoreClick&&_.push(r.a.createElement(G.a,{kind:"secondary",onClick:this.props.onRejectAndIgnoreClick,key:"ignore"},Object(N.a)("Reject & Ignore user")));break}case Ko.ViewingRoom:m=this.props.canPreview?Object(N.a)("You're previewing %(roomName)s. Want to join it?",{roomName:l}):l?Object(N.a)("%(roomName)s can't be previewed. Do you want to join it?",{roomName:l}):Object(N.a)("There's no preview, would you like to join?"),g=Object(N.a)("Join the discussion"),p=this.props.onJoinClick;break;case Ko.RoomNotFound:m=l?Object(N.a)("%(roomName)s does not exist.",{roomName:l}):Object(N.a)("This room or space does not exist."),u=Object(N.a)("Are you sure you're at the right place?");break;case Ko.OtherError:m=l?Object(N.a)("%(roomName)s is not accessible at this time.",{roomName:l}):Object(N.a)("This room or space is not accessible at this time."),u=[Object(N.a)("Try again later, or ask a room or space admin to check if you have access."),Object(N.a)("%(errcode)s was returned while trying to access the room or space. If you think you're seeing this message in error, please <issueLink>submit a bug report</issueLink>.",{errcode:this.props.error.errcode},{issueLink:e=>r.a.createElement("a",{href:"https://github.com/vector-im/element-web/issues/new/choose",target:"_blank",rel:"noreferrer noopener"},e)})]}let x,j,k,R;u&&(Array.isArray(u)||(u=[u]),x=u.map(((e,t)=>r.a.createElement("p",{key:`subTitle${t}`},e)))),j=E?r.a.createElement("h3",{className:"mx_RoomPreviewBar_spinnerTitle"},r.a.createElement(Kn.a,null),m):r.a.createElement("h3",null,m),p&&(k=r.a.createElement(G.a,{kind:"primary",onClick:p},g)),v&&(R=r.a.createElement(G.a,{kind:"secondary",onClick:v},f));const I=this.props.canPreview,T=c()("mx_RoomPreviewBar","dark-panel",`mx_RoomPreviewBar_${w}`,{mx_RoomPreviewBar_panel:I,mx_RoomPreviewBar_dialog:!I}),P=I?r.a.createElement(r.a.Fragment,null,R,_,k):r.a.createElement(r.a.Fragment,null,k,_,R);return r.a.createElement("div",{className:T},r.a.createElement("div",{className:"mx_RoomPreviewBar_message"},j,x),h,r.a.createElement("div",{className:"mx_RoomPreviewBar_actions"},P),r.a.createElement("div",{className:"mx_RoomPreviewBar_footer"},y))}}i()(qo,"defaultProps",{onJoinClick(){}});var $o=a(242),Yo=a(626);const Jo=["room"];function Qo(e){let{room:t}=e,a=ve()(e,Jo);const n=Object(s.useContext)(R.a),i=Object(s.useRef)(),o=Object(Yo.b)(t),l=Object(zo.j)(null==o?void 0:o.text,null==o?void 0:o.html,i),d=Object(s.useCallback)((e=>{var t;null===(t=a.onClick)||void 0===t||t.call(a,e);"A"!==e.target.tagName.toUpperCase()&&v.a.fire(U.a.ShowRoomTopic)}),[a]);Object(ne.a)(v.a,(e=>{if(e.action===U.a.ShowRoomTopic){const e=t.currentState.maySendStateEvent(ee.b.RoomTopic,n.getUserId()),a=Object(zo.j)(null==o?void 0:o.text,null==o?void 0:o.html,i,!0),s=H.b.createDialog(yi.a,{title:t.name,description:r.a.createElement("div",null,r.a.createElement(zo.a,{options:{attributes:{onClick(){s.close()}}},as:"p"},a),e&&r.a.createElement(G.a,{kind:"primary_outline",onClick:()=>{s.close(),v.a.dispatch({action:"open_room_settings"})}},Object(N.a)("Edit topic"))),hasCloseButton:!0,button:!1})}}));const m=c()(a.className,"mx_RoomTopic");return r.a.createElement("div",Z()({},a,{ref:i,onClick:d,dir:"auto",className:m}),r.a.createElement(pe.a,{label:Object(N.a)("Click to read topic"),alignment:xi.a.Bottom,ignoreHover:e=>"A"===e.target.tagName.toUpperCase()},r.a.createElement(zo.a,null,l)))}var Xo=a(612);const Zo=["room","onlyKnownUsers","numShown"],el=5,tl=e=>{var t;return!(null===(t=Ha.a.shared().getDMRoomsForUserId(e.userId))||void 0===t||!t.length)};var al=e=>{let{room:t,onlyKnownUsers:a=!0,numShown:n=el}=e,i=ve()(e,Zo);const o=Object(s.useContext)(R.a),l="join"===t.getMyMembership();let c=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250;const[a,n]=Object(s.useState)(e.getJoinedMembers());return Object(ie.c)(e.currentState,m.b.Update,Object(j.throttle)((()=>{n(e.getJoinedMembers())}),t,{leading:!0,trailing:!0})),a}(t);const d=c.length,u=[e=>e.getMxcAvatarUrl()?0:1];a?c=c.filter(tl):u.unshift((e=>tl(e)?0:1));const h=Object(j.sortBy)(c.filter((e=>e.userId!==o.getUserId())),u).slice(0,n);if(h.length<1)return null;const p=h.map((e=>e.name)).reverse().join(", "),g=r.a.createElement("div",null,r.a.createElement("div",{className:"mx_Tooltip_title"},i.onClick?Object(N.a)("View all %(count)s members",{count:d}):Object(N.a)("%(count)s members",{count:d})),r.a.createElement("div",{className:"mx_Tooltip_sub"},l?Object(N.a)("Including you, %(commaSeparatedMembers)s",{commaSeparatedMembers:p}):Object(N.a)("Including %(commaSeparatedMembers)s",{commaSeparatedMembers:p})));return r.a.createElement(Xo.a,Z()({members:h,faceSize:28,overflow:c.length>n,tooltip:g},i),a&&r.a.createElement("span",{className:"mx_FacePile_summary"},Object(N.a)("%(count)s people you know have already joined",{count:c.length})))};var nl=e=>{let{room:t}=e;const a=Object(Yn.a)((async()=>{if("invite"!==t.getMyMembership())return null;try{return await t.client.getRoomSummary(t.roomId)}catch(e){return null}}),[t]),n=Object(ti.a)(t,(e=>e.getJoinRule())),i=Wn(t),s=Vn(t),o=Object(se.a)("feature_element_call_video_rooms");let l,c,d;if(t.isElementVideoRoom()||o&&t.isCallRoom()?(l="mx_RoomInfoLine_video",c=Object(N.a)("Video room")):n===_a.c.Public?(l="mx_RoomInfoLine_public",c=t.isSpaceRoom()?Object(N.a)("Public space"):Object(N.a)("Public room")):(l="mx_RoomInfoLine_private",c=t.isSpaceRoom()?Object(N.a)("Private space"):Object(N.a)("Private room")),"invite"===i&&a)d=r.a.createElement("span",{className:"mx_RoomInfoLine_members"},Object(N.a)("%(count)s members",{count:a.num_joined_members}));else if(s&&void 0!==a){const e=()=>Ia.a.instance.setCard({phase:t.isSpaceRoom()?Ra.a.SpaceMemberList:Ra.a.RoomMemberList});d=r.a.createElement(G.a,{kind:"link",className:"mx_RoomInfoLine_members",onClick:e},Object(N.a)("%(count)s members",{count:s}))}return r.a.createElement("div",{className:`mx_RoomInfoLine ${l}`},c,d)};var il=e=>{let{room:t,onJoinButtonClicked:a,onRejectButtonClicked:n}=e;const i=Object(s.useContext)(R.a),o=Object(se.a)("feature_video_rooms"),l=Object(se.a)("feature_element_call_video_rooms"),c=t.isElementVideoRoom()||l&&t.isCallRoom(),d=Wn(t);Object(ne.a)(v.a,(e=>{e.action===U.a.JoinRoomError&&e.roomId===t.roomId&&u(!1)}));const[m,u]=Object(s.useState)(!1),h=Object(ti.a)(t,(e=>e.getJoinRule())),p=Object($o.b)(d)===$o.a.Leave&&h!==_a.c.Public,g=()=>v.a.dispatch({action:U.a.ViewUserSettings,initialTabId:Ae.a.Labs});let b,f,y=null;if("join"===d)b=r.a.createElement(G.a,{kind:"danger_outline",onClick:()=>{v.a.dispatch({action:"leave_room",room_id:t.roomId})}},Object(N.a)("Leave"));else if("invite"===d){var E,_;const e=null===(E=t.getMember(i.getUserId()))||void 0===E||null===(_=E.events.member)||void 0===_?void 0:_.getSender();if(e){const a=t.getMember(e);y=r.a.createElement("div",{className:"mx_RoomPreviewCard_inviter"},r.a.createElement(Qn.b,{member:a,fallbackUserId:e,width:32,height:32}),r.a.createElement("div",null,r.a.createElement("div",{className:"mx_RoomPreviewCard_inviter_name"},Object(N.a)("<inviter/> invites you",{},{inviter:()=>r.a.createElement("b",null,(null==a?void 0:a.name)||e)})),a?r.a.createElement("div",{className:"mx_RoomPreviewCard_inviter_mxid"},e):null))}b=r.a.createElement(r.a.Fragment,null,r.a.createElement(G.a,{kind:"primary_outline",onClick:()=>{u(!0),n()}},Object(N.a)("Reject")),r.a.createElement(G.a,{kind:"primary",onClick:()=>{u(!0),a()}},Object(N.a)("Accept")))}else b=r.a.createElement(G.a,{kind:"primary",onClick:()=>{a(),i.isGuest()||u(!0)},disabled:p},Object(N.a)("Join"));m&&(b=r.a.createElement(he.a,null)),f=c?r.a.createElement(r.a.Fragment,null,r.a.createElement(ye.a,{room:t,height:50,width:50,viewAvatarOnClick:!0}),r.a.createElement("div",{className:"mx_RoomPreviewCard_video"}),r.a.createElement(de.a,{onClick:g,tooltipTitle:Object(N.a)("Video rooms are a beta feature")})):t.isSpaceRoom()?r.a.createElement(ye.a,{room:t,height:80,width:80,viewAvatarOnClick:!0}):r.a.createElement(ye.a,{room:t,height:50,width:50,viewAvatarOnClick:!0});let w=null;return p?w=Object(N.a)("To view %(roomName)s, you need an invite",{roomName:t.name}):c&&!o&&(w="join"===d?Object(N.a)("To view, please enable video rooms in Labs first"):Object(N.a)("To join, please enable video rooms in Labs first"),b=r.a.createElement(G.a,{kind:"primary",onClick:g},Object(N.a)("Show Labs settings"))),r.a.createElement("div",{className:"mx_RoomPreviewCard"},y,r.a.createElement("div",{className:"mx_RoomPreviewCard_avatar"},f),r.a.createElement("h1",{className:"mx_RoomPreviewCard_name"},r.a.createElement(li.a,{room:t})),r.a.createElement(nl,{room:t}),r.a.createElement(Qo,{room:t,className:"mx_RoomPreviewCard_topic"}),"public"===t.getJoinRule()&&r.a.createElement(al,{room:t}),w?r.a.createElement("div",{className:"mx_RoomPreviewCard_notice"},w):null,r.a.createElement("div",{className:"mx_RoomPreviewCard_joinButtons"},b))};let sl;!function(e){e.Room="Room",e.All="All"}(sl||(sl={}));class rl extends r.a.Component{constructor(e){super(e),i()(this,"searchTerm",Object(s.createRef)()),i()(this,"onThisRoomClick",(()=>{this.setState({scope:sl.Room},(()=>this.searchIfQuery()))})),i()(this,"onAllRoomsClick",(()=>{this.setState({scope:sl.All},(()=>this.searchIfQuery()))})),i()(this,"onSearchChange",(e=>{switch(Object(J.a)().getAccessibilityAction(e)){case W.h.Enter:this.onSearch();break;case W.h.Escape:this.props.onCancelClick()}})),i()(this,"onSearch",(()=>{var e;null!==(e=this.searchTerm.current)&&void 0!==e&&e.value.trim()&&this.props.onSearch(this.searchTerm.current.value,this.state.scope)})),this.state={scope:sl.Room}}searchIfQuery(){var e;null!==(e=this.searchTerm.current)&&void 0!==e&&e.value&&this.onSearch()}render(){const e=c()("mx_SearchBar_searchButton",{mx_SearchBar_searching:this.props.searchInProgress}),t=c()("mx_SearchBar_button",{mx_SearchBar_unselected:this.state.scope!==sl.Room}),a=c()("mx_SearchBar_button",{mx_SearchBar_unselected:this.state.scope!==sl.All});return r.a.createElement(r.a.Fragment,null,r.a.createElement(re.a,{screenName:"RoomSearch"}),r.a.createElement("div",{className:"mx_SearchBar"},r.a.createElement("div",{className:"mx_SearchBar_buttons",role:"radiogroup"},r.a.createElement(G.a,{className:t,onClick:this.onThisRoomClick,"aria-checked":this.state.scope===sl.Room,role:"radio"},Object(N.a)("This Room")),r.a.createElement(G.a,{className:a,onClick:this.onAllRoomsClick,"aria-checked":this.state.scope===sl.All,role:"radio"},Object(N.a)("All Rooms"))),r.a.createElement("div",{className:"mx_SearchBar_input mx_textinput"},r.a.createElement("input",{ref:this.searchTerm,type:"text",autoFocus:!0,placeholder:Object(N.a)("Search…"),onKeyDown:this.onSearchChange}),r.a.createElement(G.a,{className:e,onClick:this.onSearch})),r.a.createElement(G.a,{className:"mx_SearchBar_cancel",onClick:this.props.onCancelClick})),r.a.createElement(dr,{isRoomEncrypted:this.props.isRoomEncrypted,kind:cr.Search}))}}var ol=a(848);class ll extends r.a.PureComponent{constructor(e,t){super(e,t),i()(this,"context",void 0),i()(this,"onStateEvents",(e=>{if(!this.props.room||e.getRoomId()!==this.props.room.roomId)return;if("m.room.tombstone"!==e.getType())return;const t=this.props.room.currentState.getStateEvents("m.room.tombstone","");this.setState({upgraded:t&&t.getContent().replacement_room})})),i()(this,"onUpgradeClick",(()=>{H.b.createDialog(ol.a,{room:this.props.room})}));const a=this.props.room.currentState.getStateEvents("m.room.tombstone","");this.state={upgraded:null==a?void 0:a.getContent().replacement_room}}componentDidMount(){this.context.on(m.b.Events,this.onStateEvents)}componentWillUnmount(){this.context.removeListener(m.b.Events,this.onStateEvents)}render(){let e=r.a.createElement("div",null,r.a.createElement("div",{className:"mx_RoomUpgradeWarningBar_body"},r.a.createElement("p",null,Object(N.a)("Upgrading this room will shut down the current instance of the room and create an upgraded room with the same name.")),r.a.createElement("p",null,Object(N.a)("<b>Warning</b>: upgrading a room will <i>not automatically migrate room members to the new version of the room.</i> We'll post a link to the new room in the old version of the room - room members will have to click this link to join the new room.",{},{b:e=>r.a.createElement("b",null,e),i:e=>r.a.createElement("i",null,e)}))),r.a.createElement("p",{className:"mx_RoomUpgradeWarningBar_upgradelink"},r.a.createElement(G.a,{onClick:this.onUpgradeClick},Object(N.a)("Upgrade this room to the recommended room version"))));return this.state.upgraded&&(e=r.a.createElement("div",{className:"mx_RoomUpgradeWarningBar_body"},r.a.createElement("p",null,Object(N.a)("This room has already been upgraded.")))),r.a.createElement("div",{className:"mx_RoomUpgradeWarningBar"},r.a.createElement("div",{className:"mx_RoomUpgradeWarningBar_wrapped"},r.a.createElement("div",{className:"mx_RoomUpgradeWarningBar_header"},Object(N.a)("This room is running room version <roomVersion />, which this homeserver has marked as <i>unstable</i>.",{},{roomVersion:()=>r.a.createElement("code",null,this.props.room.getVersion()),i:e=>r.a.createElement("i",null,e)})),e,r.a.createElement("div",{className:"mx_RoomUpgradeWarningBar_small"},Object(N.a)("Only room administrators will see this warning"))))}}i()(ll,"contextType",R.a);var cl=a(399),dl=a(473);const ml=e=>{let{failures:t}=e;const a=Object(s.useContext)(R.a),[n,i]=Object(s.useState)(!0);Object(s.useEffect)((()=>{const e=setTimeout((()=>i(!1)),5e3);return()=>clearTimeout(e)}),[]);const[o,l]=Object(s.useState)(!1),[c,d]=Object(s.useState)(!1),[m,u]=Object(s.useState)(!1),[h,p]=Object(s.useState)(new Set),[g,b]=Object(s.useState)(!0);Object(s.useEffect)((()=>{b(t.some((e=>{const t=e.getWireContent().session_id;return t&&!h.has(t)})))}),[t,h,b]);const f=Object(s.useCallback)((()=>{const e=new Set(h);for(const n of t){const t=n.getWireContent().session_id;t&&!e.has(t)&&(e.add(t),a.cancelAndResendEventRoomKeyRequest(n))}p(e)}),[a,h,p,t]),y=Object(s.useCallback)((async()=>{const e=a.getDeviceId();let t=!0;try{t=a.checkIfOwnDeviceCrossSigned(e)}catch(e){console.error("Error getting device cross-signing info",e)}l(!t);let n=!1;try{n=a.getStoredDevicesForUser(a.getUserId()).some((t=>t.deviceId!==e&&a.checkIfOwnDeviceCrossSigned(t.deviceId)))}catch(e){console.error("Error getting info about other devices",e)}d(n);let i=!1;try{const e=await a.isSecretStored("m.cross_signing.master");i=null!==e&&Object.keys(e).length>0}catch(e){console.error("Error getting info about key backups",e)}u(i)}),[a]);Object(s.useEffect)((()=>(y().catch(console.error),a.on(ya.b.DevicesUpdated,y),()=>{a.off(ya.b.DevicesUpdated,y)})),[a,y]);const E=()=>{H.b.createDialog(cl.a)},_=()=>{const e={action:U.a.ViewUserSettings,initialTabId:Ae.a.Security};v.a.dispatch(e)},w=()=>{dl.b.sharedInstance().resetConfirm()},S=n?r.a.createElement(Kn.a,null):r.a.createElement("div",{className:"mx_DecryptionFailureBar_icon"});let O,C,x=r.a.createElement(r.a.Fragment,null);n?(O=r.a.createElement(r.a.Fragment,null,Object(N.a)("Decrypting messages…")),C=r.a.createElement(r.a.Fragment,null,Object(N.a)("Please wait as we try to decrypt your messages. This may take a few moments."))):o?c||m?(O=r.a.createElement(r.a.Fragment,null,Object(N.a)("Verify this device to access all messages")),C=r.a.createElement(r.a.Fragment,null,Object(N.a)("This device was unable to decrypt some messages because it has not been verified yet.")),x=r.a.createElement(G.a,{kind:"primary",onClick:E},Object(N.a)("Verify"))):(O=r.a.createElement(r.a.Fragment,null,Object(N.a)("Reset your keys to prevent future decryption errors")),C=r.a.createElement(r.a.Fragment,null,Object(N.a)("You will not be able to access old undecryptable messages, but resetting your keys will allow you to receive new messages.")),x=r.a.createElement(G.a,{kind:"primary",onClick:w},Object(N.a)("Reset"))):c?(O=r.a.createElement(r.a.Fragment,null,Object(N.a)("Open another device to load encrypted messages")),C=r.a.createElement(r.a.Fragment,null,Object(N.a)("This device is requesting decryption keys from your other devices. Opening one of your other devices may speed this up.")),x=r.a.createElement(G.a,{kind:"primary_outline",onClick:_},Object(N.a)("View your device list"))):(O=r.a.createElement(r.a.Fragment,null,Object(N.a)("Some messages could not be decrypted")),C=r.a.createElement(r.a.Fragment,null,Object(N.a)("Unfortunately, there are no other verified devices to request decryption keys from. Signing in and verifying other devices may help avoid this situation in the future.")));let j=r.a.createElement(r.a.Fragment,null);return!o&&c&&g&&(j=r.a.createElement("div",{className:"mx_DecryptionFailureBar_button"},r.a.createElement(G.a,{kind:"primary",onClick:f},Object(N.a)("Resend key requests")))),r.a.createElement("div",{className:"mx_DecryptionFailureBar"},S,r.a.createElement("div",{className:"mx_DecryptionFailureBar_message"},r.a.createElement("div",{className:"mx_DecryptionFailureBar_message_headline"},O),r.a.createElement("div",{className:"mx_DecryptionFailureBar_message_body"},C)),r.a.createElement("div",{className:"mx_DecryptionFailureBar_button"},x),j)};var ul;function hl(e,t){const a=Object(hn.a)(e.data);a.response=t,e.source.postMessage(a,e.origin)}function pl(e,t,a){ga.a.error("Action:"+e.data.action+" failed with message: "+t);const n=Object(hn.a)(e.data);n.response={error:{message:t}},a&&(n.response.error._error=a),e.source.postMessage(n,e.origin)}function gl(e,t){const a=e.data.widget_id;let n=e.data.type;const i=e.data.url,s=e.data.name,r=e.data.data,o=e.data.avatar_url,l=e.data.userWidget;if(a&&void 0!==i){if(null!==i){if(void 0!==s&&"string"!=typeof s)return void pl(e,Object(N.a)("Unable to create widget."),new Error("Optional field 'name' must be a string."));if(void 0!==r&&!(r instanceof Object))return void pl(e,Object(N.a)("Unable to create widget."),new Error("Optional field 'data' must be an Object."));if(void 0!==o&&"string"!=typeof o)return void pl(e,Object(N.a)("Unable to create widget."),new Error("Optional field 'avatar_url' must be a string."));if("string"!=typeof n)return void pl(e,Object(N.a)("Unable to create widget."),new Error("Field 'type' must be a string."));if("string"!=typeof i)return void pl(e,Object(N.a)("Unable to create widget."),new Error("Field 'url' must be a string or null."))}if(n=Qa.a.fromString(n),l)Aa.a.setUserWidget(a,n,i,s,r).then((()=>{hl(e,{success:!0}),v.a.dispatch({action:"user_widget_updated"})})).catch((t=>{pl(e,Object(N.a)("Unable to create widget."),t)}));else{if(!t)return void pl(e,Object(N.a)("Missing roomId."));Aa.a.setRoomWidget(t,a,n,i,s,r,o).then((()=>{hl(e,{success:!0})}),(t=>{pl(e,Object(N.a)("Failed to send request."),t)}))}}else pl(e,Object(N.a)("Unable to create widget."),new Error("Missing required widget fields."))}function vl(e,t){const a=lt.a.get();if(!a)return void pl(e,Object(N.a)("You need to be logged in."));let n=[];if(t){const i=a.getRoom(t);if(!i)return void pl(e,Object(N.a)("This room is not recognised."));n=Aa.a.getRoomWidgets(i).map((e=>e.event))}const i=Aa.a.getUserWidgetsArray();n=n.concat(i),hl(e,n)}function bl(e,t,a,n){const i=lt.a.get();if(!i)return void pl(e,Object(N.a)("You need to be logged in."));const s=i.getRoom(t);if(!s)return void pl(e,Object(N.a)("This room is not recognised."));const r=s.currentState.getStateEvents(a,n);hl(e,r?r.getContent():null)}!function(e){e.CloseScalar="close_scalar",e.GetWidgets="get_widgets",e.SetWidget="set_widget",e.JoinRulesState="join_rules_state",e.SetPlumbingState="set_plumbing_state",e.GetMembershipCount="get_membership_count",e.GetRoomEncryptionState="get_room_enc_state",e.CanSendEvent="can_send_event",e.MembershipState="membership_state",e.invite="invite",e.Kick="kick",e.BotOptions="bot_options",e.SetBotOptions="set_bot_options",e.SetBotPower="set_bot_power",e.GetOpenIdToken="get_open_id_token",e.SendEvent="send_event",e.ReadEvents="read_events"}(ul||(ul={}));const fl=function(e){let t,a;e.origin||(e.origin=e.originalEvent.origin);try{El||(El=La.a.sharedInstance().getPrimaryManager().uiUrl),t=new URL(El)}catch(e){return}try{a=new URL(e.origin)}catch(e){return}if(t.origin!==a.origin||!e.data.action||e.data.api)return;if(e.data.action===ul.CloseScalar)return v.a.dispatch({action:ul.CloseScalar}),void hl(e,null);const n=e.data.room_id,i=e.data.user_id;if(!n)return e.data.action===ul.GetWidgets?void vl(e,null):e.data.action===ul.SetWidget?void gl(e,null):e.data.action===ul.GetOpenIdToken?void async function(e){try{hl(e,await lt.a.get().getOpenIdToken())}catch(t){ga.a.warn("Unable to fetch openId token.",t),pl(e,"Unable to fetch openId token.")}}(e):void pl(e,Object(N.a)("Missing room_id in request"));if(n===rt.b.instance.roomViewStore.getRoomId())if(e.data.action!==ul.GetWidgets)if(e.data.action!==ul.SetWidget)if(e.data.action!==ul.JoinRulesState)if(e.data.action!==ul.SetPlumbingState)if(e.data.action!==ul.GetMembershipCount)if(e.data.action!==ul.GetRoomEncryptionState)if(e.data.action!==ul.CanSendEvent)if(e.data.action!==ul.SendEvent)if(e.data.action!==ul.ReadEvents)if(i)switch(e.data.action){case ul.MembershipState:!function(e,t,a){ga.a.log(`membership_state of ${a} in room ${t} requested.`),bl(e,t,"m.room.member",a)}(e,n,i);break;case ul.invite:!function(e,t,a){ga.a.log(`Received request to invite ${a} into room ${t}`);const n=lt.a.get();if(!n)return void pl(e,Object(N.a)("You need to be logged in."));const i=n.getRoom(t);if(i){const t=i.getMember(a);if(t&&["join","invite"].includes(t.membership))return void hl(e,{success:!0})}n.invite(t,a).then((function(){hl(e,{success:!0})}),(function(t){pl(e,Object(N.a)("You need to be able to invite users to do that."),t)}))}(e,n,i);break;case ul.Kick:!function(e,t,a){ga.a.log(`Received request to kick ${a} from room ${t}`);const n=lt.a.get();if(!n)return void pl(e,Object(N.a)("You need to be logged in."));const i=n.getRoom(t);if(i){const t=i.getMember(a);if(!t||Object($o.b)(t.membership)===$o.a.Leave)return void hl(e,{success:!0})}const s=e.data.reason;n.kick(t,a,s).then((()=>{hl(e,{success:!0})})).catch((t=>{pl(e,Object(N.a)("You need to be able to kick users to do that."),t)}))}(e,n,i);break;case ul.BotOptions:!function(e,t,a){ga.a.log(`bot_options of ${a} in room ${t} requested.`),bl(e,t,"m.room.bot.options","_"+a)}(e,n,i);break;case ul.SetBotOptions:!function(e,t,a){ga.a.log(`Received request to set options for bot ${a} in room ${t}`);const n=lt.a.get();n?n.sendStateEvent(t,"m.room.bot.options",e.data.content,"_"+a).then((()=>{hl(e,{success:!0})}),(t=>{pl(e,t.message?t.message:Object(N.a)("Failed to send request."),t)})):pl(e,Object(N.a)("You need to be logged in."))}(e,n,i);break;case ul.SetBotPower:!async function(e,t,a,n,i){if(!(Number.isInteger(n)&&n>=0))return void pl(e,Object(N.a)("Power level must be positive integer."));ga.a.log(`Received request to set power level to ${n} for bot ${a} in room ${t}.`);const s=lt.a.get();if(s)try{const c=await s.getStateEvent(t,"m.room.power_levels","");var r,o,l;if(!0===i)if((null!==(r=null!==(o=null===(l=c.users)||void 0===l?void 0:l[a])&&void 0!==o?o:c.users_default)&&void 0!==r?r:0)>=n)return hl(e,{success:!0});return await s.setPowerLevel(t,a,n,new fa.b({type:"m.room.power_levels",content:c})),hl(e,{success:!0})}catch(t){pl(e,t.message?t.message:Object(N.a)("Failed to send request."),t)}else pl(e,Object(N.a)("You need to be logged in."))}(e,n,i,e.data.level,e.data.ignoreIfGreater);break;default:ga.a.warn("Unhandled postMessage event with action '"+e.data.action+"'")}else pl(e,Object(N.a)("Missing user_id in request"));else!async function(e,t){const a=e.data.type,n=e.data.state_key,i=e.data.limit;if("string"!=typeof a)return void pl(e,Object(N.a)("Failed to read events"),new Error("Invalid 'type' in request"));if(!["m.room.power_levels","m.room.encryption","m.room.member","m.room.name","m.widgets","im.vector.modular.widgets","io.element.integrations.installations"].includes(a))return void pl(e,Object(N.a)("Failed to read events"),new Error("Disallowed 'type' in request"));let s;if(void 0!==i){if("number"!=typeof i||i<0)return void pl(e,Object(N.a)("Failed to read events"),new Error("Invalid 'limit' in request"));s=Math.min(i,Number.MAX_SAFE_INTEGER)}else s=Number.MAX_SAFE_INTEGER;const r=lt.a.get();if(!r)return void pl(e,Object(N.a)("You need to be logged in."));const o=r.getRoom(t);if(o){if(void 0!==n){if("string"!=typeof n&&!0!==n)return void pl(e,Object(N.a)("Failed to read events"),new Error("Invalid 'state_key' in request"));const t=!0===n?void 0:n;let i=[];return i=i.concat(o.currentState.getStateEvents(a,t)||[]),i=i.slice(0,s),void hl(e,{events:i.map((e=>e.getEffectiveEvent()))})}pl(e,Object(N.a)("Failed to read events"),new Error("Reading message events is not implemented"))}else pl(e,Object(N.a)("This room is not recognised."))}(e,n);else!async function(e,t){const a=e.data.type,n=e.data.state_key,i=e.data.content;if("string"!=typeof a)return void pl(e,Object(N.a)("Failed to send event"),new Error("Invalid 'type' in request"));if(!["m.widgets","im.vector.modular.widgets","io.element.integrations.installations"].includes(a))return void pl(e,Object(N.a)("Failed to send event"),new Error("Disallowed 'type' in request"));if(!i||"object"!=typeof i)return void pl(e,Object(N.a)("Failed to send event"),new Error("Invalid 'content' in request"));const s=lt.a.get();if(!s)return void pl(e,Object(N.a)("You need to be logged in."));if(s.getRoom(t))if(void 0!==n)try{hl(e,{room_id:t,event_id:(await s.sendStateEvent(t,a,i,n)).event_id})}catch(t){return void pl(e,Object(N.a)("Failed to send event"),t)}else pl(e,Object(N.a)("Failed to send event"),new Error("Sending message events is not implemented"));else pl(e,Object(N.a)("This room is not recognised."))}(e,n);else!function(e,t){const a=""+e.data.event_type,n=Boolean(e.data.is_state),i=lt.a.get();if(!i)return void pl(e,Object(N.a)("You need to be logged in."));const s=i.getRoom(t);if(!s)return void pl(e,Object(N.a)("This room is not recognised."));if("join"!==s.getMyMembership())return void pl(e,Object(N.a)("You are not in this room."));const r=i.credentials.userId;let o=!1;o=n?s.currentState.maySendStateEvent(a,r):s.currentState.maySendEvent(a,r),o?hl(e,!0):pl(e,Object(N.a)("You do not have permission to do that in this room."))}(e,n);else!function(e,t){const a=lt.a.get();if(!a)return void pl(e,Object(N.a)("You need to be logged in."));if(!a.getRoom(t))return void pl(e,Object(N.a)("This room is not recognised."));hl(e,lt.a.get().isRoomEncrypted(t))}(e,n);else!function(e,t){const a=lt.a.get();if(!a)return void pl(e,Object(N.a)("You need to be logged in."));const n=a.getRoom(t);if(!n)return void pl(e,Object(N.a)("This room is not recognised."));hl(e,n.getJoinedMemberCount())}(e,n);else!function(e,t,a){if("string"!=typeof a)throw new Error("Plumbing state status should be a string");ga.a.log(`Received request to set plumbing state to status "${a}" in room ${t}`);const n=lt.a.get();n?n.sendStateEvent(t,"m.room.plumbing",{status:a}).then((()=>{hl(e,{success:!0})}),(t=>{pl(e,t.message?t.message:Object(N.a)("Failed to send request."),t)})):pl(e,Object(N.a)("You need to be logged in."))}(e,n,e.data.status);else!function(e,t){ga.a.log(`join_rules of ${t} requested.`),bl(e,t,"m.room.join_rules","")}(e,n);else gl(e,n);else vl(e,n);else pl(e,Object(N.a)("Room %(roomId)s not visible",{roomId:n}))};let yl=0,El=null;var _l=a(290);class wl extends r.a.Component{constructor(e){super(e),i()(this,"unmounted",!1),i()(this,"resizeContainer",void 0),i()(this,"resizer",void 0),i()(this,"dispatcherRef",void 0),i()(this,"onIsResizing",(e=>{this.setState({resizingVertical:e}),e||this.relaxResizer()})),i()(this,"collectResizer",(e=>{this.resizeContainer&&this.resizer.detach(),e&&(this.resizer.container=e,this.resizer.attach()),this.resizeContainer=e,this.loadResizerPreferences()})),i()(this,"getAppsHash",(e=>e.map((e=>e.id)).join("~"))),i()(this,"relaxResizer",(()=>{const e=this.resizer.getDistributors();e.forEach((e=>e.start())),e.forEach((e=>e.finish()))})),i()(this,"loadResizerPreferences",(()=>{const e=Xa.d.instance.getResizerDistributions(this.props.room,Xa.a.Top);if(this.state.apps&&this.topApps().length-1===e.length)e.forEach(((e,t)=>{const a=this.resizer.forHandleAt(t);a&&(a.size=e,a.finish())}));else if(this.state.apps){const e=this.resizer.getDistributors();e.forEach((e=>e.item.clearSize())),e.forEach((e=>e.start())),e.forEach((e=>e.finish()))}})),i()(this,"onAction",(e=>{const t=this.props.room.roomId+"_hide_widget_drawer";if("appsDrawer"===e.action)e.show?localStorage.setItem(t,"false"):localStorage.setItem(t,"true")})),i()(this,"getApps",(()=>{const e={};return e[Xa.a.Top]=Xa.d.instance.getContainerWidgets(this.props.room,Xa.a.Top),e[Xa.a.Center]=Xa.d.instance.getContainerWidgets(this.props.room,Xa.a.Center),e})),i()(this,"topApps",(()=>this.state.apps[Xa.a.Top])),i()(this,"centerApps",(()=>this.state.apps[Xa.a.Center])),i()(this,"updateApps",(()=>{this.unmounted||this.setState({apps:this.getApps()})})),this.state={apps:this.getApps(),resizingVertical:!1,resizingHorizontal:!1,resizing:!1},this.resizer=this.createResizer(),this.props.resizeNotifier.on("isResizing",this.onIsResizing)}componentDidMount(){0===yl&&window.addEventListener("message",fl,!1),yl+=1,Xa.d.instance.on(Xa.d.emissionForRoom(this.props.room),this.updateApps),this.dispatcherRef=v.a.register(this.onAction)}componentWillUnmount(){this.unmounted=!0,function(){if(yl-=1,0===yl&&window.removeEventListener("message",fl),yl<0){const e=new Error("ScalarMessaging: mismatched startListening / stopListening detected. Negative count");ga.a.error(e)}}(),Xa.d.instance.off(Xa.d.emissionForRoom(this.props.room),this.updateApps),this.dispatcherRef&&v.a.unregister(this.dispatcherRef),this.resizeContainer&&this.resizer.detach(),this.props.resizeNotifier.off("isResizing",this.onIsResizing)}createResizer(){const e=new k(null,O,{onResizeStart:()=>{this.resizeContainer.classList.add("mx_AppsDrawer_resizing"),this.setState({resizingHorizontal:!0})},onResizeStop:()=>{this.resizeContainer.classList.remove("mx_AppsDrawer_resizing"),Xa.d.instance.setResizerDistributions(this.props.room,Xa.a.Top,this.topApps().slice(1).map(((e,t)=>this.resizer.forHandleAt(t).size))),this.setState({resizingHorizontal:!1})}});return e.setClassNames({handle:"mx_ResizeHandle",vertical:"mx_ResizeHandle_vertical",reverse:"mx_ResizeHandle_reverse"}),e}componentDidUpdate(e,t){e.userId!==this.props.userId||e.room!==this.props.room?this.updateApps():this.getAppsHash(this.topApps())!==this.getAppsHash(t.apps[Xa.a.Top])&&this.loadResizerPreferences()}isResizing(){return this.state.resizingVertical||this.state.resizingHorizontal}render(){if(!this.props.showApps)return r.a.createElement("div",null);const e=this.centerApps().length>0,t=(e?this.centerApps():this.topApps()).map(((e,t,a)=>r.a.createElement(vs,{key:e.id,app:e,fullWidth:a.length<2,room:this.props.room,userId:this.props.userId,creatorUserId:e.creatorUserId,widgetPageTitle:Aa.a.getWidgetDataTitle(e),waitForIframeLoad:e.waitForIframeLoad,pointerEvents:this.isResizing()?"none":void 0})));if(0===t.length)return r.a.createElement("div",null);let a;0===t.length&&Fo.a.roomHasPendingWidgets(this.props.room.roomId,Aa.a.getRoomWidgets(this.props.room))&&(a=r.a.createElement(Kn.a,null));const n=c()({mx_AppsDrawer:!0,mx_AppsDrawer_maximise:e,mx_AppsDrawer_fullWidth:t.length<2,mx_AppsDrawer_resizing:this.state.resizing,mx_AppsDrawer_2apps:2===t.length,mx_AppsDrawer_3apps:3===t.length}),i=r.a.createElement("div",{className:"mx_AppsContainer",ref:this.collectResizer},t.map(((e,a)=>a<1?e:r.a.createElement(r.a.Fragment,{key:e.key},r.a.createElement(y,{reverse:a>t.length/2}),e))));let s;return s=e?i:r.a.createElement(Sl,{room:this.props.room,minHeight:100,maxHeight:this.props.maxHeight-50,handleClass:"mx_AppsContainer_resizerHandle",handleWrapperClass:"mx_AppsContainer_resizerHandleContainer",className:"mx_AppsContainer_resizer",resizeNotifier:this.props.resizeNotifier},i),r.a.createElement("div",{className:n},s,a)}}i()(wl,"defaultProps",{showApps:!0});const Sl=e=>{let{room:t,minHeight:a,maxHeight:n,className:i,handleWrapperClass:s,handleClass:o,resizeNotifier:l,children:c}=e,d=Xa.d.instance.getContainerHeight(t,Xa.a.Top);return a||(a=100),n||(n=Q.b.instance.windowHeight/4*3),d?(d=Object(_l.a)(d,0,100),d=Object(_l.d)(d/100,a,n)):d=280,r.a.createElement(xa.Resizable,{size:{height:Math.min(d,n),width:void 0},minHeight:a,maxHeight:n,onResizeStart:()=>{l.startResizing()},onResize:()=>{l.notifyTimelineHeightChanged()},onResizeStop:(e,i,s,r)=>{let o=d+r.height;o=100*Object(_l.c)(o,a,n),Xa.d.instance.setContainerHeight(t,Xa.a.Top,o),l.stopResizing()},handleWrapperClass:s,handleClasses:{bottom:o},className:i,enable:{bottom:!0}},c)};var Ol=a(357);class Cl extends r.a.PureComponent{constructor(e){super(e),i()(this,"element",void 0),i()(this,"setElementRef",(e=>{var t;e?(this.element=e,e.addEventListener("resize",this.onResize)):null===(t=this.element)||void 0===t||t.removeEventListener("resize",this.onResize)})),i()(this,"onNewStream",(()=>{this.setState({audioMuted:this.props.feed.isAudioMuted(),videoMuted:this.props.feed.isVideoMuted()}),this.playMedia()})),i()(this,"onMuteStateChanged",(()=>{this.setState({audioMuted:this.props.feed.isAudioMuted(),videoMuted:this.props.feed.isVideoMuted()})})),i()(this,"onResize",(e=>{this.props.onResize&&!this.props.feed.isLocal()&&this.props.onResize(e)})),this.state={audioMuted:this.props.feed.isAudioMuted(),videoMuted:this.props.feed.isVideoMuted()}}componentDidMount(){this.updateFeed(null,this.props.feed),this.playMedia()}componentWillUnmount(){this.updateFeed(this.props.feed,null)}componentDidUpdate(e,t){this.updateFeed(e.feed,this.props.feed),t.videoMuted===this.state.videoMuted&&e.feed.stream===this.props.feed.stream||this.playMedia()}static getDerivedStateFromProps(e){return{audioMuted:e.feed.isAudioMuted(),videoMuted:e.feed.isVideoMuted()}}updateFeed(e,t){e!==t&&(e&&(this.props.feed.removeListener(pa.b.NewStream,this.onNewStream),this.props.feed.removeListener(pa.b.MuteStateChanged,this.onMuteStateChanged),this.props.feed.purpose===Ol.b.Usermedia&&this.props.feed.measureVolumeActivity(!1),this.stopMedia()),t&&(this.props.feed.addListener(pa.b.NewStream,this.onNewStream),this.props.feed.addListener(pa.b.MuteStateChanged,this.onMuteStateChanged),this.props.feed.purpose===Ol.b.Usermedia&&this.props.feed.measureVolumeActivity(!0),this.playMedia()))}async playMedia(){const e=this.element;if(e){e.muted=!0,e.srcObject=this.props.feed.stream,e.autoplay=!0;try{await e.play()}catch(e){ga.a.info(`Failed to play media element with feed for userId ${this.props.feed.userId} with purpose ${this.props.feed.purpose}`,e)}}}stopMedia(){const e=this.element;e&&(e.pause(),e.src=null)}render(){const{pipMode:e,primary:t,secondary:a,feed:n}=this.props,i=c()("mx_VideoFeed",{mx_VideoFeed_primary:t,mx_VideoFeed_secondary:a,mx_VideoFeed_voice:this.state.videoMuted}),s=c()("mx_VideoFeed_mic",{mx_VideoFeed_mic_muted:this.state.audioMuted,mx_VideoFeed_mic_unmuted:!this.state.audioMuted});let o,l;if(n.purpose===Ol.b.Screenshare||t||e||(o=r.a.createElement("div",{className:s})),this.state.videoMuted){var d;const a=B.b.instance.roomIdForCall(this.props.call),n=null!==(d=a?lt.a.get().getRoom(a):void 0)&&void 0!==d?d:void 0;let i;e&&t?i=76:e&&!t?i=16:!e&&t&&(i=160),l=r.a.createElement(ye.a,{room:n,height:i,width:i})}else{const e=c()("mx_VideoFeed_video",{mx_VideoFeed_video_mirror:this.props.feed.isLocal()&&this.props.feed.purpose===Ol.b.Usermedia&&b.b.getValue("VideoView.flipVideoHorizontally")});l=r.a.createElement("video",{className:e,ref:this.setElementRef})}return r.a.createElement("div",{className:i},o,l)}}var xl=a(259),jl=a(799);class kl extends r.a.Component{render(){const e=this.props.feeds.map((e=>r.a.createElement(Cl,{key:e.stream.id,feed:e,call:this.props.call,primary:!1,pipMode:this.props.pipMode}))),t=c()("mx_LegacyCallViewSidebar",{mx_LegacyCallViewSidebar_pipMode:this.props.pipMode});return r.a.createElement("div",{className:t},e)}}const Rl=e=>{let{onExpand:t,onPin:a,onMaximize:n}=e;return r.a.createElement("div",{className:"mx_LegacyCallViewHeader_controls"},n&&r.a.createElement(q.a,{className:"mx_LegacyCallViewHeader_button mx_LegacyCallViewHeader_button_fullscreen",onClick:n,title:Object(N.a)("Fill screen")}),a&&r.a.createElement(q.a,{className:"mx_LegacyCallViewHeader_button mx_LegacyCallViewHeader_button_pin",onClick:a,title:Object(N.a)("Pin")}),t&&r.a.createElement(q.a,{className:"mx_LegacyCallViewHeader_button mx_LegacyCallViewHeader_button_expand",onClick:t,title:Object(N.a)("Return to call")}))},Il=e=>{let{callRoom:t}=e;return r.a.createElement("span",{className:"mx_LegacyCallViewHeader_secondaryCallInfo"},r.a.createElement(ye.a,{room:t,height:16,width:16}),r.a.createElement("span",{className:"mx_LegacyCallView_secondaryCall_roomName"},Object(N.a)("%(name)s on hold",{name:t.name})))};var Tl=e=>{let{pipMode:t=!1,callRooms:a,onPipMouseDown:n,onExpand:i,onPin:s,onMaximize:o}=e;const[l,c]=a,d=l.name;return t?r.a.createElement("div",{className:"mx_LegacyCallViewHeader mx_LegacyCallViewHeader_pip",onMouseDown:n},r.a.createElement(ye.a,{room:l,height:32,width:32}),r.a.createElement("div",{className:"mx_LegacyCallViewHeader_callInfo"},r.a.createElement("div",{className:"mx_LegacyCallViewHeader_roomName"},d),c&&r.a.createElement(Il,{callRoom:c})),r.a.createElement(Rl,{onExpand:i,onPin:s,onMaximize:o})):r.a.createElement("div",{className:"mx_LegacyCallViewHeader"},r.a.createElement("div",{className:"mx_LegacyCallViewHeader_icon"}),r.a.createElement("span",{className:"mx_LegacyCallViewHeader_text"},Object(N.a)("Call")),r.a.createElement(Rl,{onMaximize:o}))};class Nl extends r.a.Component{constructor(e){super(e),i()(this,"onHoldClick",(()=>{this.props.call.setRemoteOnHold(!0),this.props.onFinished()})),i()(this,"onUnholdClick",(()=>{B.b.instance.setActiveCallRoomId(this.props.call.roomId),this.props.onFinished()})),i()(this,"onTransferClick",(()=>{B.b.instance.showTransferDialog(this.props.call),this.props.onFinished()}))}render(){const e=this.props.call.isRemoteOnHold()?Object(N.a)("Resume"):Object(N.a)("Hold"),t=this.props.call.isRemoteOnHold()?this.onUnholdClick:this.onHoldClick;let a;return this.props.call.opponentCanBeTransferred()&&(a=r.a.createElement(ce.d,{className:"mx_LegacyCallContextMenu_item",onClick:this.onTransferClick},Object(N.a)("Transfer"))),r.a.createElement(ce.n,this.props,r.a.createElement(ce.d,{className:"mx_LegacyCallContextMenu_item",onClick:t},e),a)}}var Pl=a(614);class Dl extends s.Component{constructor(e){super(e),i()(this,"numberEntryFieldRef",Object(s.createRef)()),i()(this,"onDigitPress",((e,t)=>{var a;(this.props.call.sendDtmfDigit(e),this.setState({value:this.state.value+e}),"click"===t.type)&&(null===(a=this.numberEntryFieldRef.current)||void 0===a||a.focus())})),i()(this,"onCancelClick",(()=>{this.props.onFinished()})),i()(this,"onKeyDown",(e=>{"Backspace"!==e.code&&"Delete"!==e.code||e.preventDefault()})),i()(this,"onChange",(e=>{this.setState({value:e.target.value})})),this.state={value:""}}render(){return s.createElement(ce.n,this.props,s.createElement("div",{className:"mx_DialPadContextMenuWrapper"},s.createElement("div",null,s.createElement(G.a,{className:"mx_DialPadContextMenu_cancel",onClick:this.onCancelClick})),s.createElement("div",{className:"mx_DialPadContextMenu_header"},s.createElement(ci.a,{ref:this.numberEntryFieldRef,className:"mx_DialPadContextMenu_dialled",value:this.state.value,autoFocus:!0,onKeyDown:this.onKeyDown,onChange:this.onChange})),s.createElement("div",{className:"mx_DialPadContextMenu_dialPad"},s.createElement(Pl.a,{onDigitPress:this.onDigitPress,hasDial:!1}))))}}const Ml=["deviceKinds"],Al={[p.b.AudioInput]:Object(N.c)("Input devices"),[p.b.AudioOutput]:Object(N.c)("Output devices"),[p.b.VideoInput]:Object(N.c)("Cameras")},Ll=e=>{let{label:t,selected:a,onClick:n}=e;return r.a.createElement(me.d,{iconClassName:"mx_DeviceContextMenu_device_icon",label:t,active:a,onClick:n})},Ul=e=>{let{deviceKind:t}=e;const[a,n]=Object(s.useState)([]),[i,o]=Object(s.useState)(p.c.getDevice(t));Object(s.useEffect)((()=>{(async()=>{n((await p.c.getDevices())[t])})()}),[t]);return r.a.createElement(me.c,{label:Object(N.a)(Al[t])},a.map((e=>{let{label:a,deviceId:n}=e;return r.a.createElement(Ll,{key:n,label:a,selected:i===n,onClick:()=>(e=>{p.c.instance.setDevice(e,t),o(e)})(n)})})))};var Fl=e=>{let{deviceKinds:t}=e,a=ve()(e,Ml);return r.a.createElement(me.e,Z()({compact:!0,className:"mx_DeviceContextMenu"},a),t.map((e=>r.a.createElement(Ul,{key:e,deviceKind:e}))))};const Bl=["children","state","className","onLabel","offLabel"],Vl=["state","deviceKinds"],Wl=e=>{let{children:t,state:a,className:n,onLabel:i,offLabel:s}=e,o=ve()(e,Bl);const l=c()("mx_LegacyCallViewButtons_button",n,{mx_LegacyCallViewButtons_button_on:a,mx_LegacyCallViewButtons_button_off:!a});return r.a.createElement(q.a,Z()({className:l,title:a?i:s,alignment:xi.a.Top},o),t)},Hl=e=>{let{state:t,deviceKinds:a}=e,n=ve()(e,Vl);const[i,o,l,d]=Object(ce.q)(),[m,u]=Object(s.useState)(!1),h=c()("mx_LegacyCallViewButtons_button","mx_LegacyCallViewButtons_dropdownButton",{mx_LegacyCallViewButtons_dropdownButton_collapsed:!i});return r.a.createElement(Wl,Z()({inputRef:o,forceHide:i||m,state:t},n),r.a.createElement(Wl,{className:h,onClick:e=>{e.stopPropagation(),l()},onHover:e=>u(e),state:t}),i&&o.current&&r.a.createElement(Fl,Z()({},Object(ce.k)(o.current.getBoundingClientRect()),{onFinished:d,deviceKinds:a})))};class zl extends r.a.Component{constructor(e){super(e),i()(this,"dialpadButton",Object(s.createRef)()),i()(this,"contextMenuButton",Object(s.createRef)()),i()(this,"controlsHideTimer",null),i()(this,"onControlsHideTimer",(()=>{this.state.hoveringControls||this.state.showDialpad||this.state.showMoreMenu||(this.controlsHideTimer=null,this.setState({visible:!1}))})),i()(this,"onMouseEnter",(()=>{this.setState({hoveringControls:!0})})),i()(this,"onMouseLeave",(()=>{this.setState({hoveringControls:!1})})),i()(this,"onDialpadClick",(()=>{this.state.showDialpad?this.setState({showDialpad:!1}):(this.setState({showDialpad:!0}),this.showControls())})),i()(this,"onMoreClick",(()=>{this.setState({showMoreMenu:!0}),this.showControls()})),i()(this,"closeDialpad",(()=>{this.setState({showDialpad:!1})})),i()(this,"closeContextMenu",(()=>{this.setState({showMoreMenu:!1})})),this.state={showDialpad:!1,hoveringControls:!1,showMoreMenu:!1,visible:!0}}componentDidMount(){this.showControls()}showControls(){this.state.showMoreMenu||this.state.showDialpad||(this.state.visible||this.setState({visible:!0}),null!==this.controlsHideTimer&&clearTimeout(this.controlsHideTimer),this.controlsHideTimer=window.setTimeout(this.onControlsHideTimer,2e3))}render(){const e=c()("mx_LegacyCallViewButtons",{mx_LegacyCallViewButtons_hidden:!this.state.visible});let t,a;return this.state.showDialpad&&this.dialpadButton.current&&(t=r.a.createElement(Dl,Z()({},Object(ce.l)(this.dialpadButton.current.getBoundingClientRect(),ce.a.None,8),{mountAsChild:!this.props.pipMode,onFinished:this.closeDialpad,call:this.props.call}))),this.state.showMoreMenu&&this.contextMenuButton.current&&(a=r.a.createElement(Nl,Z()({},Object(ce.l)(this.contextMenuButton.current.getBoundingClientRect(),ce.a.None,8),{mountAsChild:!this.props.pipMode,onFinished:this.closeContextMenu,call:this.props.call}))),r.a.createElement("div",{className:e,onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave},t,a,this.props.buttonsVisibility.dialpad&&r.a.createElement(ce.c,{className:"mx_LegacyCallViewButtons_button mx_LegacyCallViewButtons_dialpad",inputRef:this.dialpadButton,onClick:this.onDialpadClick,isExpanded:this.state.showDialpad,title:Object(N.a)("Dialpad"),alignment:xi.a.Top}),r.a.createElement(Hl,{state:!this.props.buttonsState.micMuted,className:"mx_LegacyCallViewButtons_button_mic",onLabel:Object(N.a)("Mute the microphone"),offLabel:Object(N.a)("Unmute the microphone"),onClick:this.props.handlers.onMicMuteClick,deviceKinds:[p.b.AudioInput,p.b.AudioOutput]}),this.props.buttonsVisibility.vidMute&&r.a.createElement(Hl,{state:!this.props.buttonsState.vidMuted,className:"mx_LegacyCallViewButtons_button_vid",onLabel:Object(N.a)("Stop the camera"),offLabel:Object(N.a)("Start the camera"),onClick:this.props.handlers.onVidMuteClick,deviceKinds:[p.b.VideoInput]}),this.props.buttonsVisibility.screensharing&&r.a.createElement(Wl,{state:this.props.buttonsState.screensharing,className:"mx_LegacyCallViewButtons_button_screensharing",onLabel:Object(N.a)("Stop sharing your screen"),offLabel:Object(N.a)("Start sharing your screen"),onClick:this.props.handlers.onScreenshareClick}),this.props.buttonsVisibility.sidebar&&r.a.createElement(Wl,{state:this.props.buttonsState.sidebarShown,className:"mx_LegacyCallViewButtons_button_sidebar",onLabel:Object(N.a)("Hide sidebar"),offLabel:Object(N.a)("Show sidebar"),onClick:this.props.handlers.onToggleSidebarClick}),this.props.buttonsVisibility.contextMenu&&r.a.createElement(ce.c,{className:"mx_LegacyCallViewButtons_button mx_LegacyCallViewButtons_button_more",onClick:this.onMoreClick,inputRef:this.contextMenuButton,isExpanded:this.state.showMoreMenu,title:Object(N.a)("More"),alignment:xi.a.Top}),r.a.createElement(q.a,{className:"mx_LegacyCallViewButtons_button mx_LegacyCallViewButtons_button_hangup",onClick:this.props.handlers.onHangupClick,title:Object(N.a)("Hangup"),alignment:xi.a.Top}))}}function Gl(){return document.fullscreenElement||document.webkitFullscreenElement||document.msFullscreenElement}function Kl(){const e=document.exitFullscreen||document.webkitExitFullscreen||document.msExitFullscreen;e&&e.call(document)}class ql extends r.a.Component{constructor(e){super(e),i()(this,"dispatcherRef",void 0),i()(this,"contentWrapperRef",Object(s.createRef)()),i()(this,"buttonsRef",Object(s.createRef)()),i()(this,"onAction",(e=>{if("video_fullscreen"===e.action){if(!this.contentWrapperRef.current)return;e.fullscreen?function(e){const t=e.requestFullscreen||e.webkitRequestFullScreen||e.msRequestFullscreen;t&&t.call(e)}(this.contentWrapperRef.current):Gl()&&Kl()}})),i()(this,"onCallState",(e=>{this.setState({callState:e})})),i()(this,"onFeedsChanged",(e=>{const{primary:t,secondary:a,sidebar:n}=ql.getOrderedFeeds(e);this.setState({primaryFeed:t,secondaryFeed:a,sidebarFeeds:n,micMuted:this.props.call.isMicrophoneMuted(),vidMuted:this.props.call.isLocalVideoMuted()})})),i()(this,"onCallLocalHoldUnhold",(()=>{this.setState({isLocalOnHold:this.props.call.isLocalOnHold()})})),i()(this,"onCallRemoteHoldUnhold",(()=>{this.setState({isRemoteOnHold:this.props.call.isRemoteOnHold(),isLocalOnHold:this.props.call.isLocalOnHold()})})),i()(this,"onMouseMove",(()=>{var e;null===(e=this.buttonsRef.current)||void 0===e||e.showControls()})),i()(this,"onMaximizeClick",(()=>{v.a.dispatch({action:"video_fullscreen",fullscreen:!0})})),i()(this,"onMicMuteClick",(async()=>{const e=!this.state.micMuted;this.setState({micMuted:await this.props.call.setMicrophoneMuted(e)})})),i()(this,"onVidMuteClick",(async()=>{const e=!this.state.vidMuted;this.setState({vidMuted:await this.props.call.setLocalVideoMuted(e)})})),i()(this,"onScreenshareClick",(async()=>{let e;var t;if(this.state.screensharing)e=await this.props.call.setScreensharingEnabled(!1);else if(null!==(t=I.a.get())&&void 0!==t&&t.supportsDesktopCapturer()){const{finished:t}=H.b.createDialog(jl.a),[a]=await t;if(!a)return;e=await this.props.call.setScreensharingEnabled(!0,{desktopCapturerSourceId:a})}else e=await this.props.call.setScreensharingEnabled(!0);this.setState({sidebarShown:!0,screensharing:e})})),i()(this,"onNativeKeyDown",(e=>{var t,a;let n=!1;switch(Object(J.a)().getCallAction(e)){case W.h.ToggleMicInCall:this.onMicMuteClick(),null===(t=this.buttonsRef.current)||void 0===t||t.showControls(),n=!0;break;case W.h.ToggleWebcamInCall:this.onVidMuteClick(),null===(a=this.buttonsRef.current)||void 0===a||a.showControls(),n=!0}n&&(e.stopPropagation(),e.preventDefault())})),i()(this,"onCallResumeClick",(()=>{const e=B.b.instance.roomIdForCall(this.props.call);B.b.instance.setActiveCallRoomId(e)})),i()(this,"onTransferClick",(()=>{const e=B.b.instance.getTransfereeForCallId(this.props.call.callId);this.props.call.transferToCall(e)})),i()(this,"onHangupClick",(()=>{B.b.instance.hangupOrReject(B.b.instance.roomIdForCall(this.props.call))})),i()(this,"onToggleSidebar",(()=>{this.setState({sidebarShown:!this.state.sidebarShown})}));const{primary:t,secondary:a,sidebar:n}=ql.getOrderedFeeds(this.props.call.getFeeds());this.state={isLocalOnHold:this.props.call.isLocalOnHold(),isRemoteOnHold:this.props.call.isRemoteOnHold(),micMuted:this.props.call.isMicrophoneMuted(),vidMuted:this.props.call.isLocalVideoMuted(),screensharing:this.props.call.isScreensharing(),callState:this.props.call.state,primaryFeed:t,secondaryFeed:a,sidebarFeeds:n,sidebarShown:!0},this.updateCallListeners(null,this.props.call)}componentDidMount(){this.dispatcherRef=v.a.register(this.onAction),document.addEventListener("keydown",this.onNativeKeyDown)}componentWillUnmount(){Gl()&&Kl(),document.removeEventListener("keydown",this.onNativeKeyDown),this.updateCallListeners(this.props.call,null),v.a.unregister(this.dispatcherRef)}static getDerivedStateFromProps(e){const{primary:t,secondary:a,sidebar:n}=ql.getOrderedFeeds(e.call.getFeeds());return{primaryFeed:t,secondaryFeed:a,sidebarFeeds:n}}componentDidUpdate(e){this.props.call!==e.call&&(this.setState({isLocalOnHold:this.props.call.isLocalOnHold(),isRemoteOnHold:this.props.call.isRemoteOnHold(),micMuted:this.props.call.isMicrophoneMuted(),vidMuted:this.props.call.isLocalVideoMuted(),callState:this.props.call.state}),this.updateCallListeners(null,this.props.call))}updateCallListeners(e,t){e!==t&&(e&&(e.removeListener(ha.d.State,this.onCallState),e.removeListener(ha.d.LocalHoldUnhold,this.onCallLocalHoldUnhold),e.removeListener(ha.d.RemoteHoldUnhold,this.onCallRemoteHoldUnhold),e.removeListener(ha.d.FeedsChanged,this.onFeedsChanged)),t&&(t.on(ha.d.State,this.onCallState),t.on(ha.d.LocalHoldUnhold,this.onCallLocalHoldUnhold),t.on(ha.d.RemoteHoldUnhold,this.onCallRemoteHoldUnhold),t.on(ha.d.FeedsChanged,this.onFeedsChanged)))}static getOrderedFeeds(e){if(e.length<=2)return{primary:e.find((e=>!e.isLocal())),secondary:e.find((e=>e.isLocal())),sidebar:[]};let t;const a=e.filter((e=>e.purpose===Ol.b.Screenshare));t=a.find((e=>!e.isLocal()))||a[0],t||(t=e.find((e=>!e.isLocal())));const n=[...e];return t&&n.splice(n.indexOf(t),1),n.sort(((e,t)=>e.isLocal()&&!t.isLocal()?-1:!e.isLocal()&&t.isLocal()?1:0)),{primary:t,sidebar:n}}renderCallControls(){const{call:e,pipMode:t}=this.props,{callState:a,micMuted:n,vidMuted:i,screensharing:s,sidebarShown:o,secondaryFeed:l,sidebarFeeds:c}=this.state,d=e.opponentSupportsSDPStreamMetadata()||e.hasLocalUserMediaVideoTrack,m=(e.opponentSupportsSDPStreamMetadata()||e.hasLocalUserMediaVideoTrack)&&e.state===ha.f.Connected,u=l&&!l.isVideoMuted()||c.length>0,h=a===ha.f.Connected,p=a===ha.f.Connected&&e.opponentSupportsDTMF();return r.a.createElement(zl,{ref:this.buttonsRef,call:e,pipMode:t,handlers:{onToggleSidebarClick:this.onToggleSidebar,onScreenshareClick:this.onScreenshareClick,onHangupClick:this.onHangupClick,onMicMuteClick:this.onMicMuteClick,onVidMuteClick:this.onVidMuteClick},buttonsState:{micMuted:n,vidMuted:i,sidebarShown:o,screensharing:s},buttonsVisibility:{vidMute:d,screensharing:m,sidebar:u,contextMenu:h,dialpad:p}})}renderToast(){var e;const{call:t}=this.props;if(!t.getFeeds().some((e=>e.purpose===Ol.b.Screenshare)))return null;const a=t.isScreensharing(),{primaryFeed:n,sidebarShown:i}=this.state,s=null==n||null===(e=n.getMember())||void 0===e?void 0:e.name;if(!s)return null;let o=a?Object(N.a)("You are presenting"):Object(N.a)("%(sharerName)s is presenting",{sharerName:s});return i||(o+=" • "+(t.isLocalVideoMuted()?Object(N.a)("Your camera is turned off"):Object(N.a)("Your camera is still enabled"))),r.a.createElement("div",{className:"mx_LegacyCallView_toast"},o)}renderContent(){var e;const{pipMode:t,call:a,onResize:n}=this.props,{isLocalOnHold:i,isRemoteOnHold:s,sidebarShown:o,primaryFeed:l,secondaryFeed:d,sidebarFeeds:m}=this.state,u=B.b.instance.roomIdForCall(a),h=null!==(e=u?lt.a.get().getRoom(u):void 0)&&void 0!==e?e:void 0,p=t?76:160,g=B.b.instance.getTransfereeForCallId(a.callId),v=i||s;let b;if(o&&d&&!d.isVideoMuted()&&(b=r.a.createElement(Cl,{feed:d,call:a,pipMode:t,onResize:n,secondary:!0})),g||v){const e=c()("mx_LegacyCallView_content",{mx_LegacyCallView_content_hold:v}),t=Object(xl.a)(a.getOpponentMember(),1024,1024,"crop");let n;if(g){const e=lt.a.get().getRoom(B.b.instance.roomIdForCall(a)),t=e?e.name:Object(N.a)("unknown person"),i=lt.a.get().getRoom(B.b.instance.roomIdForCall(g)),s=i?i.name:Object(N.a)("unknown person");n=r.a.createElement("div",{className:"mx_LegacyCallView_status"},Object(N.a)("Consulting with %(transferTarget)s. <a>Transfer to %(transferee)s</a>",{transferTarget:t,transferee:s},{a:e=>r.a.createElement(G.a,{kind:"link_inline",onClick:this.onTransferClick},e)}))}else{let e;if(s)e=Object(N.a)(B.b.instance.hasAnyUnheldCall()?Object(N.c)("You held the call <a>Switch</a>"):Object(N.c)("You held the call <a>Resume</a>"),{},{a:e=>r.a.createElement(G.a,{kind:"link_inline",onClick:this.onCallResumeClick},e)});else if(i){var f;e=Object(N.a)("%(peerName)s held the call",{peerName:null===(f=a.getOpponentMember())||void 0===f?void 0:f.name})}n=r.a.createElement("div",{className:"mx_LegacyCallView_status"},e)}return r.a.createElement("div",{className:e,onMouseMove:this.onMouseMove},r.a.createElement("div",{className:"mx_LegacyCallView_holdBackground",style:{backgroundImage:"url("+t+")"}}),n)}return a.noIncomingFeeds()?r.a.createElement("div",{className:"mx_LegacyCallView_content",onMouseMove:this.onMouseMove},r.a.createElement("div",{className:"mx_LegacyCallView_avatarsContainer"},r.a.createElement("div",{className:"mx_LegacyCallView_avatarContainer",style:{width:p,height:p}},r.a.createElement(ye.a,{room:h,height:p,width:p}))),r.a.createElement("div",{className:"mx_LegacyCallView_status"},Object(N.a)("Connecting")),b):t?r.a.createElement("div",{className:"mx_LegacyCallView_content",onMouseMove:this.onMouseMove},r.a.createElement(Cl,{feed:l,call:a,pipMode:t,onResize:n,primary:!0})):d?r.a.createElement("div",{className:"mx_LegacyCallView_content",onMouseMove:this.onMouseMove},r.a.createElement(Cl,{feed:l,call:a,pipMode:t,onResize:n,primary:!0}),b):r.a.createElement("div",{className:"mx_LegacyCallView_content",onMouseMove:this.onMouseMove},r.a.createElement(Cl,{feed:l,call:a,pipMode:t,onResize:n,primary:!0}),o&&r.a.createElement(kl,{feeds:m,call:a,pipMode:Boolean(t)}))}render(){const{call:e,secondaryCall:t,pipMode:a,showApps:n,onMouseDownOnHeader:i}=this.props,{sidebarShown:s,sidebarFeeds:o}=this.state,l=lt.a.get(),d=B.b.instance.roomIdForCall(e),m=B.b.instance.roomIdForCall(t),u=d?l.getRoom(d):null,h=m?l.getRoom(m):null,p=c()({mx_LegacyCallView:!0,mx_LegacyCallView_pip:a,mx_LegacyCallView_large:!a,mx_LegacyCallView_sidebar:s&&0!==o.length&&!a,mx_LegacyCallView_belowWidget:n});return r.a.createElement("div",{className:p},r.a.createElement(Tl,{onPipMouseDown:i,pipMode:a,callRooms:[u,h],onMaximize:this.onMaximizeClick}),r.a.createElement("div",{className:"mx_LegacyCallView_content_wrapper",ref:this.contentWrapperRef},this.renderToast(),this.renderContent(),this.renderCallControls()))}}class $l extends r.a.Component{constructor(e){super(e),i()(this,"updateCall",(()=>{const e=this.getCall();e!==this.state.call&&this.setState({call:e})})),i()(this,"onResizeStart",(()=>{this.props.resizeNotifier.startResizing()})),i()(this,"onResize",(()=>{this.props.resizeNotifier.notifyTimelineHeightChanged()})),i()(this,"onResizeStop",(()=>{this.props.resizeNotifier.stopResizing()})),this.state={call:this.getCall()}}componentDidMount(){B.b.instance.addListener(B.a.CallState,this.updateCall),B.b.instance.addListener(B.a.CallChangeRoom,this.updateCall)}componentWillUnmount(){B.b.instance.removeListener(B.a.CallState,this.updateCall),B.b.instance.removeListener(B.a.CallChangeRoom,this.updateCall)}getCall(){const e=B.b.instance.getCallForRoom(this.props.roomId);return e&&[ha.f.Ended,ha.f.Ringing].includes(e.state)?null:e}render(){return this.state.call?r.a.createElement("div",{className:"mx_LegacyCallViewForRoom"},r.a.createElement(xa.Resizable,{minHeight:380,maxHeight:"80vh",enable:{top:!1,right:!1,bottom:!0,left:!1,topRight:!1,bottomRight:!1,bottomLeft:!1,topLeft:!1},onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,className:"mx_LegacyCallViewForRoom_ResizeWrapper",handleClasses:{bottom:"mx_LegacyCallViewForRoom_ResizeHandle"}},r.a.createElement(ql,{call:this.state.call,pipMode:!1,showApps:this.props.showApps}))):null}}class Yl extends r.a.Component{constructor(e){super(e),i()(this,"onRoomStateEvents",(e=>{"re.jki.counter"===e.getType()&&this.updateCounters()})),i()(this,"updateCounters",Object(j.throttle)((()=>{this.setState({counters:this.computeCounters()})}),500,{leading:!0,trailing:!0})),this.state={counters:this.computeCounters()}}componentDidMount(){const e=lt.a.get();b.b.getValue("feature_state_counters")&&e.on(m.b.Events,this.onRoomStateEvents)}componentWillUnmount(){var e;b.b.getValue("feature_state_counters")&&(null===(e=lt.a.get())||void 0===e||e.removeListener(m.b.Events,this.onRoomStateEvents))}shouldComponentUpdate(e,t){return Object(hn.c)(this.props,e)||Object(hn.c)(this.state,t)}computeCounters(){const e=[];if(this.props.room&&b.b.getValue("feature_state_counters")){const t=this.props.room.currentState.getStateEvents("re.jki.counter");t.sort(((e,t)=>Object(un.x)(e.getStateKey(),t.getStateKey())));for(const a of t){const t=a.getContent().title,n=a.getContent().value,i=a.getContent().link,s=a.getContent().severity||"normal",r=a.getStateKey();t&&void 0!==n&&e.push({title:t,value:n,link:i,severity:s,stateKey:r})}}return e}render(){const e=r.a.createElement($l,{roomId:this.props.room.roomId,resizeNotifier:this.props.resizeNotifier,showApps:this.props.showApps});let t;b.b.getValue(oe.b.Widgets)&&(t=r.a.createElement(wl,{room:this.props.room,userId:this.props.userId,showApps:this.props.showApps,resizeNotifier:this.props.resizeNotifier}));let a=null;if(this.state.counters&&b.b.getValue("feature_state_counters")){const e=[];this.state.counters.forEach(((t,a)=>{const n=t.title,i=t.value,s=t.link,o=t.severity,l=t.stateKey;let c=r.a.createElement("span",null,n,": ",i);s&&(c=r.a.createElement("a",{href:s,target:"_blank",rel:"noreferrer noopener"},c)),c=r.a.createElement("span",{className:"m_RoomView_auxPanel_stateViews_span","data-severity":o,key:"x-"+l},c),e.push(c),e.push(r.a.createElement("span",{className:"m_RoomView_auxPanel_stateViews_delim",key:"delim"+a}," ","─"," "))})),e.length>0&&(e.pop(),a=r.a.createElement("div",{className:"m_RoomView_auxPanel_stateViews"},e))}return r.a.createElement(Et.a,{className:"mx_RoomView_auxPanel"},a,this.props.children,t,e)}}i()(Yl,"defaultProps",{showApps:!0});const Jl=["isHighlighted","isUnread","onClick","name","title"];class Ql extends r.a.Component{render(){const e=this.props,{isHighlighted:t,isUnread:a=!1,onClick:n,name:i,title:s}=e,o=ve()(e,Jl),l=c()({mx_RightPanel_headerButton:!0,mx_RightPanel_headerButton_highlight:t,mx_RightPanel_headerButton_unread:a,[`mx_RightPanel_${i}`]:!0});return r.a.createElement(q.a,Z()({},o,{"aria-selected":t,role:"tab",title:s,alignment:xi.a.Bottom,className:l,onClick:n}))}}let Xl;!function(e){e.Room="room"}(Xl||(Xl={}));class Zl extends r.a.Component{constructor(e,t){super(e),i()(this,"unmounted",!1),i()(this,"dispatcherRef",void 0),i()(this,"onRightPanelStoreUpdate",(()=>{this.unmounted||this.setState({phase:Ia.a.instance.currentCard.phase})}));const a=Ia.a.instance;this.state={headerKind:t,phase:a.currentCard.phase,threadNotificationColor:Ce.a.None,globalNotificationColor:Ce.a.None}}componentDidMount(){Ia.a.instance.on(pt.b,this.onRightPanelStoreUpdate),this.dispatcherRef=v.a.register(this.onAction.bind(this))}componentWillUnmount(){this.unmounted=!0,Ia.a.instance.off(pt.b,this.onRightPanelStoreUpdate),this.dispatcherRef&&v.a.unregister(this.dispatcherRef)}setPhase(e,t){const a=Ia.a.instance;a.currentCard.phase==e&&!t&&a.isOpen?a.togglePanel(null):(Ia.a.instance.setCard({phase:e,state:t}),a.isOpen||a.togglePanel(null))}isPhase(e){return!!Ia.a.instance.isOpen&&(Array.isArray(e)?e.includes(this.state.phase):e===this.state.phase)}render(){return r.a.createElement("div",{className:"mx_HeaderButtons",role:"tablist"},this.renderButtons())}}var ec=a(436);const tc=[Ra.a.RoomSummary,Ra.a.Widget,Ra.a.FilePanel,Ra.a.RoomMemberList,Ra.a.RoomMemberInfo,Ra.a.EncryptionPanel,Ra.a.Room3pidMemberInfo],ac=e=>{let{color:t}=e;if(t===Ce.a.None)return null;const a=c()({mx_Indicator:!0,mx_RightPanel_headerButton_unreadIndicator:!0,mx_Indicator_bold:t===Ce.a.Bold,mx_Indicator_gray:t===Ce.a.Grey,mx_Indicator_red:t===Ce.a.Red});return r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:"mx_RightPanel_headerButton_unreadIndicator_bg"}),r.a.createElement("div",{className:a}))},nc=e=>{let{room:t,isHighlighted:a,onClick:n}=e;const i=si(t),s=ri(t);if(null==i||!i.length)return null;let o;return i.some((e=>!s.has(e)))&&(o=r.a.createElement(ac,null)),r.a.createElement(Ql,{name:"pinnedMessagesButton",title:Object(N.a)("Pinned messages"),isHighlighted:a,isUnread:!!o,onClick:n},o)},ic=e=>{let t,{room:a,isHighlighted:n,onClick:i}=e;const s=Pe.a.instance.getRoomState(a).color;switch(s){case Ce.a.Bold:case Ce.a.Grey:case Ce.a.Red:t=r.a.createElement(ac,{color:s})}return r.a.createElement(Ql,{name:"timelineCardButton",title:Object(N.a)("Chat"),isHighlighted:n,onClick:i},t)};class sc extends Zl{constructor(e){super(e,Xl.Room),i()(this,"globalNotificationState",void 0),i()(this,"onNotificationUpdate",(()=>{this.setState({threadNotificationColor:this.notificationColor})})),i()(this,"onUpdateStatus",(e=>{this.globalNotificationState=e,this.setState({globalNotificationColor:e.color})})),i()(this,"onRoomSummaryClicked",(()=>{const e=Ia.a.instance.currentCard.phase;tc.includes(e)?this.state.phase===e?this.setPhase(e):this.setPhase(e,Ia.a.instance.currentCard.state):this.setPhase(Ra.a.RoomSummary)})),i()(this,"onNotificationsClicked",(()=>{this.setPhase(Ra.a.NotificationPanel)})),i()(this,"onPinnedMessagesClicked",(()=>{this.setPhase(Ra.a.PinnedMessages)})),i()(this,"onTimelineCardClicked",(()=>{this.setPhase(Ra.a.Timeline)})),i()(this,"onThreadsPanelClicked",(e=>{var t,a;sc.THREAD_PHASES.includes(this.state.phase)?Ia.a.instance.togglePanel(null!==(t=null===(a=this.props.room)||void 0===a?void 0:a.roomId)&&void 0!==t?t:null):(Ia.a.instance.setCard({phase:Ra.a.ThreadPanel}),re.b.trackInteraction("WebRoomHeaderButtonsThreadsButton",e))})),this.globalNotificationState=Pe.a.instance.globalState}componentDidMount(){var e,t,a,n,i,s,r,o;super.componentDidMount(),null===(e=this.props.room)||void 0===e||e.on(te.d.UnreadNotifications,this.onNotificationUpdate),null===(t=this.props.room)||void 0===t||t.on(te.d.Receipt,this.onNotificationUpdate),null===(a=this.props.room)||void 0===a||a.on(te.d.Timeline,this.onNotificationUpdate),null===(n=this.props.room)||void 0===n||n.on(te.d.Redaction,this.onNotificationUpdate),null===(i=this.props.room)||void 0===i||i.on(te.d.LocalEchoUpdated,this.onNotificationUpdate),null===(s=this.props.room)||void 0===s||s.on(te.d.MyMembership,this.onNotificationUpdate),null===(r=this.props.room)||void 0===r||r.on(Ea.f.New,this.onNotificationUpdate),null===(o=this.props.room)||void 0===o||o.on(Ea.f.Update,this.onNotificationUpdate),this.onNotificationUpdate(),Pe.a.instance.on(Pe.b,this.onUpdateStatus)}componentWillUnmount(){var e,t,a,n,i,s,r,o;super.componentWillUnmount(),null===(e=this.props.room)||void 0===e||e.off(te.d.UnreadNotifications,this.onNotificationUpdate),null===(t=this.props.room)||void 0===t||t.off(te.d.Receipt,this.onNotificationUpdate),null===(a=this.props.room)||void 0===a||a.off(te.d.Timeline,this.onNotificationUpdate),null===(n=this.props.room)||void 0===n||n.off(te.d.Redaction,this.onNotificationUpdate),null===(i=this.props.room)||void 0===i||i.off(te.d.LocalEchoUpdated,this.onNotificationUpdate),null===(s=this.props.room)||void 0===s||s.off(te.d.MyMembership,this.onNotificationUpdate),null===(r=this.props.room)||void 0===r||r.off(Ea.f.New,this.onNotificationUpdate),null===(o=this.props.room)||void 0===o||o.off(Ea.f.Update,this.onNotificationUpdate),Pe.a.instance.off(Pe.b,this.onUpdateStatus)}get notificationColor(){var e;switch(null===(e=this.props.room)||void 0===e?void 0:e.threadsAggregateNotificationType){case te.b.Highlight:return Ce.a.Red;case te.b.Total:return Ce.a.Grey}for(const e of this.props.room.getThreads())if(Object(ec.b)(e))return Ce.a.Bold;return Ce.a.None}onAction(e){e.action===U.a.ViewUser?e.member?e.push?Ia.a.instance.pushCard({phase:Ra.a.RoomMemberInfo,state:{member:e.member}}):Ia.a.instance.setCards([{phase:Ra.a.RoomSummary},{phase:Ra.a.RoomMemberList},{phase:Ra.a.RoomMemberInfo,state:{member:e.member}}]):this.setPhase(Ra.a.RoomMemberList):"view_3pid_invite"===e.action&&(e.event?this.setPhase(Ra.a.Room3pidMemberInfo,{memberInfoEvent:e.event}):this.setPhase(Ra.a.RoomMemberList))}renderButtons(){if(!this.props.room)return r.a.createElement(r.a.Fragment,null);const e=new Map;return b.b.getValue("feature_pinning")&&e.set(Ra.a.PinnedMessages,r.a.createElement(nc,{key:"pinnedMessagesButton",room:this.props.room,isHighlighted:this.isPhase(Ra.a.PinnedMessages),onClick:this.onPinnedMessagesClicked})),e.set(Ra.a.Timeline,r.a.createElement(ic,{key:"timelineButton",room:this.props.room,isHighlighted:this.isPhase(Ra.a.Timeline),onClick:this.onTimelineCardClicked})),e.set(Ra.a.ThreadPanel,r.a.createElement(Ql,{key:Ra.a.ThreadPanel,name:"threadsButton","data-testid":"threadsButton",title:Object(N.a)("Threads"),onClick:this.onThreadsPanelClicked,isHighlighted:this.isPhase(sc.THREAD_PHASES),isUnread:this.state.threadNotificationColor>0},r.a.createElement(ac,{color:this.state.threadNotificationColor}))),e.set(Ra.a.NotificationPanel,r.a.createElement(Ql,{key:"notifsButton",name:"notifsButton",title:Object(N.a)("Notifications"),isHighlighted:this.isPhase(Ra.a.NotificationPanel),onClick:this.onNotificationsClicked,isUnread:this.globalNotificationState.color===Ce.a.Red},this.globalNotificationState.color===Ce.a.Red?r.a.createElement(ac,{color:this.globalNotificationState.color}):null)),e.set(Ra.a.RoomSummary,r.a.createElement(Ql,{key:"roomSummaryButton",name:"roomSummaryButton",title:Object(N.a)("Room info"),isHighlighted:this.isPhase(tc),onClick:this.onRoomSummaryClicked})),r.a.createElement(r.a.Fragment,null,Array.from(e.keys()).map((t=>{var a;return null!==(a=this.props.excludedRightPanelPhaseButtons)&&void 0!==a&&a.includes(t)?null:e.get(t)})))}}i()(sc,"THREAD_PHASES",[Ra.a.ThreadPanel,Ra.a.ThreadView]);var rc=a(935),oc=a(491),lc=a(264),cc=a(404);const dc=["room","onFinished"];var mc=e=>{var t;let{room:a,onFinished:n}=e,i=ve()(e,dc);const o=Object(s.useContext)(R.a),l=Object(ie.b)(ea.c.instance,ea.b,(()=>ea.c.instance.getTagsForRoom(a)));let c;if(l.includes(T.a.Archived)){const e=e=>{e.preventDefault(),e.stopPropagation(),v.a.dispatch({action:"forget_room",room_id:a.roomId}),n()};c=r.a.createElement(me.b,{iconClassName:"mx_RoomTile_iconSignOut",label:Object(N.a)("Forget"),className:"mx_IconizedContextMenu_option_red",onClick:e})}else{const e=e=>{e.preventDefault(),e.stopPropagation(),v.a.dispatch({action:"leave_room",room_id:a.roomId}),n(),re.b.trackInteraction("WebRoomHeaderContextMenuLeaveItem",e)};c=r.a.createElement(me.b,{onClick:e,label:Object(N.a)("Leave"),className:"mx_IconizedContextMenu_option_red",iconClassName:"mx_RoomTile_iconSignOut"})}const d=Ha.a.shared().getUserIdForRoomId(a.roomId),m=Object(se.a)("feature_video_rooms"),u=Object(se.a)("feature_element_call_video_rooms"),h=m&&(a.isElementVideoRoom()||u&&a.isCallRoom());let p,g,f,y,E,_,w;if(a.canInvite(o.getUserId())&&!d){const e=e=>{e.preventDefault(),e.stopPropagation(),v.a.dispatch({action:"view_invite",roomId:a.roomId}),n(),re.b.trackInteraction("WebRoomHeaderContextMenuInviteItem",e)};p=r.a.createElement(me.b,{onClick:e,label:Object(N.a)("Invite"),iconClassName:"mx_RoomTile_iconInvite"})}if("join"===a.getMyMembership()){const e=l.includes(T.a.Favourite);g=r.a.createElement(me.a,{onClick:e=>{k(e,T.a.Favourite),re.b.trackInteraction("WebRoomHeaderContextMenuFavouriteToggle",e)},active:e,label:e?Object(N.a)("Favourited"):Object(N.a)("Favourite"),iconClassName:"mx_RoomTile_iconStar"});const t=l.includes(T.a.LowPriority);f=r.a.createElement(me.a,{onClick:e=>k(e,T.a.LowPriority),active:t,label:Object(N.a)("Low priority"),iconClassName:"mx_RoomTile_iconArrowDown"});let i,s;switch(oc.a.forRoom(a).notificationVolume){case lc.a.AllMessages:i=Object(N.a)("Default"),s="mx_RoomTile_iconNotificationsDefault";break;case lc.a.AllMessagesLoud:i=Object(N.a)("All messages"),s="mx_RoomTile_iconNotificationsAllMessages";break;case lc.a.MentionsOnly:i=Object(N.a)("Mentions only"),s="mx_RoomTile_iconNotificationsMentionsKeywords";break;case lc.a.Mute:i=Object(N.a)("Mute"),s="mx_RoomTile_iconNotificationsNone"}y=r.a.createElement(me.b,{onClick:e=>{e.preventDefault(),e.stopPropagation(),v.a.dispatch({action:"open_room_settings",room_id:a.roomId,initial_tab_id:cc.a}),n(),re.b.trackInteraction("WebRoomHeaderContextMenuNotificationsItem",e)},label:Object(N.a)("Notifications"),iconClassName:s},r.a.createElement("span",{className:"mx_IconizedContextMenu_sublabel"},i))}d||(E=r.a.createElement(me.b,{onClick:e=>{e.preventDefault(),e.stopPropagation(),I(e),Ia.a.instance.pushCard({phase:Ra.a.RoomMemberList},!1),n(),re.b.trackInteraction("WebRoomHeaderContextMenuPeopleItem",e)},label:Object(N.a)("People"),iconClassName:"mx_RoomTile_iconPeople"},r.a.createElement("span",{className:"mx_IconizedContextMenu_sublabel"},a.getJoinedMemberCount())),_=r.a.createElement(me.b,{onClick:e=>{e.preventDefault(),e.stopPropagation(),v.a.dispatch({action:"copy_room",room_id:a.roomId}),n()},label:Object(N.a)("Copy room link"),iconClassName:"mx_RoomTile_iconCopyLink"})),h||(w=r.a.createElement(me.b,{onClick:e=>{e.preventDefault(),e.stopPropagation(),I(e),Ia.a.instance.pushCard({phase:Ra.a.FilePanel},!1),n()},label:Object(N.a)("Files"),iconClassName:"mx_RoomTile_iconFiles"}));const S=Object(se.a)("feature_pinning"),O=null===(t=si(S&&a))||void 0===t?void 0:t.length;let C,x,j;S&&!h&&(C=r.a.createElement(me.b,{onClick:e=>{e.preventDefault(),e.stopPropagation(),I(e),Ia.a.instance.pushCard({phase:Ra.a.PinnedMessages},!1),n()},label:Object(N.a)("Pinned"),iconClassName:"mx_RoomTile_iconPins"},O>0&&r.a.createElement("span",{className:"mx_IconizedContextMenu_sublabel"},O))),h||(x=r.a.createElement(me.b,{onClick:e=>{e.preventDefault(),e.stopPropagation(),I(e),Ia.a.instance.setCard({phase:Ra.a.RoomSummary},!1),n()},label:Object(N.a)("Widgets"),iconClassName:"mx_RoomTile_iconWidgets"})),h||(j=r.a.createElement(me.b,{onClick:e=>{e.preventDefault(),e.stopPropagation(),H.b.createDialog(wi,{room:a}),n()},label:Object(N.a)("Export chat"),iconClassName:"mx_RoomTile_iconExport"}));const k=(e,t)=>{if(e.preventDefault(),e.stopPropagation(),t===T.a.Favourite||t===T.a.LowPriority){const e=t===T.a.Favourite?T.a.LowPriority:T.a.Favourite,n=ea.c.instance.getTagsForRoom(a).includes(t),i=n?t:e,s=n?null:t;v.a.dispatch(rc.a.tagRoom(o,a,i,s,void 0,0))}else ga.a.warn(`Unexpected tag ${t} applied to ${a.roomId}`);if(Object(J.a)().getAccessibilityAction(e)===W.h.Enter)n()},I=e=>{rt.b.instance.roomViewStore.getRoomId()!==a.roomId&&v.a.dispatch({action:U.a.ViewRoom,room_id:a.roomId,metricsTrigger:"RoomList",metricsViaKeyboard:"click"!==e.type},!0)};return r.a.createElement(me.e,Z()({},i,{onFinished:n,className:"mx_RoomTile_contextMenu",compact:!0}),r.a.createElement(me.c,null,p,y,g,E,w,C,x,f,_,r.a.createElement(me.b,{onClick:e=>{e.preventDefault(),e.stopPropagation(),v.a.dispatch({action:"open_room_settings",room_id:a.roomId}),n(),re.b.trackInteraction("WebRoomHeaderContextMenuSettingsItem",e)},label:Object(N.a)("Settings"),iconClassName:"mx_RoomTile_iconSettings"}),j,b.b.getValue("developerMode")&&r.a.createElement(me.b,{onClick:e=>{e.preventDefault(),e.stopPropagation(),H.b.createDialog(st.a,{roomId:rt.b.instance.roomViewStore.getRoomId()},"mx_DevtoolsDialog_wrapper"),n()},label:Object(N.a)("Developer tools"),iconClassName:"mx_RoomTile_iconDeveloperTools"}),c))},uc=a(450),hc=a(278),pc=a(339),gc=a(268),vc=a(340),bc=a(839),fc=a(838);const yc=e=>{let{liveBeaconIds:t,roomId:a}=e;const{onStopSharing:n,onResetLocationPublishError:i,beacon:s,stoppingInProgress:o,hasStopSharingError:l,hasLocationPublishError:c}=Object(gc.k)(t);if(!s)return null;const d=l||c,m=e=>t=>{null==t||t.stopPropagation(),e()};return r.a.createElement("div",{className:"mx_RoomLiveShareWarning",onClick:()=>{v.a.dispatch({action:U.a.ViewRoom,room_id:s.roomId,metricsTrigger:void 0,event_id:s.beaconInfoId,scroll_into_view:!0,highlighted:!0})}},r.a.createElement(vc.a,{className:"mx_RoomLiveShareWarning_icon",withError:d}),r.a.createElement("span",{className:"mx_RoomLiveShareWarning_label"},((e,t)=>e?Object(N.a)("An error occurred whilst sharing your live location, please try again"):t?Object(N.a)("An error occurred while stopping your live location, please try again"):Object(N.a)("You are sharing your live location"))(c,l)),o&&r.a.createElement("span",{className:"mx_RoomLiveShareWarning_spinner"},r.a.createElement(Kn.a,{h:16,w:16})),!o&&!d&&r.a.createElement(fc.a,{beacon:s}),r.a.createElement(G.a,{className:"mx_RoomLiveShareWarning_stopButton","data-testid":"room-live-share-primary-button",onClick:m((()=>{c?i():n()})),kind:"danger",element:"button",disabled:o},d?Object(N.a)("Retry"):Object(N.a)("Stop")),c&&r.a.createElement(G.a,{"data-testid":"room-live-share-wire-error-close-button",title:Object(N.a)("Stop and close"),element:"button",className:"mx_RoomLiveShareWarning_closeButton",onClick:m(n)},r.a.createElement(bc.a,{className:"mx_RoomLiveShareWarning_closeButtonIcon"})))};var Ec=e=>{let{roomId:t}=e;const a=Object(ie.b)(pc.a.instance,pc.b.MonitoringLivePosition,(()=>pc.a.instance.isMonitoringLiveLocation)),n=Object(ie.b)(pc.a.instance,pc.b.LivenessChange,(()=>pc.a.instance.getLiveBeaconIds(t)));return a&&n.length?r.a.createElement(yc,{liveBeaconIds:n,roomId:t}):null};const _c=e=>e.isElementVideoRoom()||b.b.getValue("feature_element_call_video_rooms")&&e.isCallRoom();var wc=a(280),Sc=a(798),Oc=a(203),Cc=a(613);const xc=e=>{let{roomId:t,call:a}=e;const n=Object(s.useCallback)((e=>{e.preventDefault(),v.b.dispatch({action:U.a.ViewRoom,room_id:t,view_call:!0,metricsTrigger:void 0})}),[t]),i=Object(s.useCallback)((()=>{const e=a.groupCall.room.currentState.getStateEvents(ee.b.GroupCallPrefix,a.groupCall.groupCallId);null!==e?v.a.dispatch({action:U.a.ViewRoom,room_id:t,metricsTrigger:void 0,event_id:e.getId(),scroll_into_view:!0,highlighted:!0}):ga.a.error("Couldn't find a group call event to jump to")}),[a,t]);return r.a.createElement("div",{className:"mx_RoomCallBanner",onClick:i},r.a.createElement("div",{className:"mx_RoomCallBanner_text"},r.a.createElement("span",{className:"mx_RoomCallBanner_label"},Object(N.a)("Video call")),r.a.createElement(Cc.b,{groupCall:a.groupCall})),r.a.createElement(G.a,{onClick:n,kind:"primary",element:"button",disabled:!1},Object(N.a)("Join")))};var jc=e=>{let{roomId:t}=e;const a=Object(wc.a)(t),n=Object(ie.b)(pc.a.instance,pc.b.MonitoringLivePosition,(()=>pc.a.instance.isMonitoringLiveLocation)),i=Object(ie.b)(pc.a.instance,pc.b.LivenessChange,(()=>pc.a.instance.getLiveBeaconIds(t)));return n&&i.length||rt.b.instance.roomViewStore.isViewingCall()?null:null!==a&&a.connectionState===Oc.c.Disconnected?r.a.createElement(xc,{call:a,roomId:t}):null};class kc{constructor(e){this.reason=e}}const Rc=e=>{let{room:t,busy:a,setBusy:n,behavior:i}=e;const{onClick:o,tooltip:l,disabled:c}=Object(s.useMemo)((()=>i instanceof kc?{onClick:()=>{},tooltip:i.reason,disabled:!0}:{onClick:async e=>{e.preventDefault(),n(!0),await B.b.instance.placeCall(t.roomId,ha.g.Voice),n(!1)},disabled:!1}),[i,t,n]);return r.a.createElement(q.a,{className:"mx_RoomHeader_button mx_RoomHeader_voiceCallButton",onClick:o,title:Object(N.a)("Voice call"),tooltip:null!=l?l:Object(N.a)("Voice call"),alignment:xi.a.Bottom,disabled:c||a})},Ic=e=>{let{room:t,busy:a,setBusy:n,behavior:i}=e;const[o,l,c,d]=Object(ce.q)(),m=Object(s.useCallback)((async()=>{n(!0),await B.b.instance.placeCall(t.roomId,ha.g.Video),n(!1)}),[n,t]),u=Object(s.useCallback)((()=>{n(!0),v.a.dispatch({action:U.a.ViewRoom,room_id:t.roomId,view_call:!0,metricsTrigger:void 0}),n(!1)}),[n,t]),{onClick:h,tooltip:p,disabled:g}=Object(s.useMemo)((()=>i instanceof kc?{onClick:()=>{},tooltip:i.reason,disabled:!0}:"legacy_or_jitsi"===i?{onClick:async e=>{e.preventDefault(),await m()},disabled:!1}:"element"===i?{onClick:async e=>{e.preventDefault(),u()},disabled:!1}:{onClick:async e=>{e.preventDefault(),c()},disabled:!1}),[i,m,u,c]),b=Object(s.useCallback)((async e=>{e.preventDefault(),d(),await m()}),[d,m]),f=Object(s.useCallback)((e=>{e.preventDefault(),d(),u()}),[d,u]);let y=null;if(o){var E;const e=l.current.getBoundingClientRect(),t=null!==(E=mt.b.get("element_call").brand)&&void 0!==E?E:mt.a.element_call.brand;y=r.a.createElement(me.e,Z()({},Object(ce.i)(e),{onFinished:d}),r.a.createElement(me.c,null,r.a.createElement(me.b,{label:Object(N.a)("Video call (Jitsi)"),onClick:b}),r.a.createElement(me.b,{label:Object(N.a)("Video call (%(brand)s)",{brand:t}),onClick:f})))}return r.a.createElement(r.a.Fragment,null,r.a.createElement(q.a,{inputRef:l,className:"mx_RoomHeader_button mx_RoomHeader_videoCallButton",onClick:h,title:Object(N.a)("Video call"),tooltip:null!=p?p:Object(N.a)("Video call"),alignment:xi.a.Bottom,disabled:g||a}),y)},Tc=e=>{let{room:t}=e;const[a,n]=Object(s.useState)(!1),i=Object(se.b)("showCallButtonsInComposer"),o=Object(se.a)("feature_group_calls"),l=Object(se.a)("feature_video_rooms"),c=Object(s.useMemo)((()=>l&&_c(t)),[l,t]),d=Object(s.useMemo)((()=>{var e;return null!==(e=mt.b.get("element_call").use_exclusively)&&void 0!==e?e:mt.a.element_call.use_exclusively}),[]),u=Object(ie.b)(B.b.instance,B.a.CallsChanged,Object(s.useCallback)((()=>null!==B.b.instance.getCallForRoom(t.roomId)),[t])),h=Zi(t),p=Object(s.useMemo)((()=>h.some((e=>Qa.a.JITSI.matches(e.type)))),[h]),g=null!==Object(wc.a)(t.roomId),[v,b,f]=Object(ie.d)(t,m.b.Update,Object(s.useCallback)((()=>[Object(Sc.a)(t),t.currentState.mayClientSendStateEvent("im.vector.modular.widgets",t.client),t.currentState.mayClientSendStateEvent(Oc.d.CALL_EVENT_TYPE.name,t.client)]),[t])),y=e=>r.a.createElement(Rc,{room:t,busy:a,setBusy:n,behavior:e}),E=e=>r.a.createElement(Ic,{room:t,busy:a,setBusy:n,behavior:e});if(c||!i)return null;if(o){if(d)return E(g?new kc(Object(N.a)("Ongoing call")):f?"element":new kc(Object(N.a)("You do not have permission to start video calls")));if(u||p||g)return r.a.createElement(r.a.Fragment,null,y(new kc(Object(N.a)("Ongoing call"))),E(new kc(Object(N.a)("Ongoing call"))));if(v.length<=1)return r.a.createElement(r.a.Fragment,null,y(new kc(Object(N.a)("There's no one here to call"))),E(new kc(Object(N.a)("There's no one here to call"))));if(2===v.length)return r.a.createElement(r.a.Fragment,null,y("legacy_or_jitsi"),E("legacy_or_jitsi"));if(b)return r.a.createElement(r.a.Fragment,null,y("legacy_or_jitsi"),E(f?"jitsi_or_element":"legacy_or_jitsi"));{const e=f?"element":new kc(Object(N.a)("You do not have permission to start video calls"));return r.a.createElement(r.a.Fragment,null,y(new kc(Object(N.a)("You do not have permission to start voice calls"))),E(e))}}return u||p?r.a.createElement(r.a.Fragment,null,y(new kc(Object(N.a)("Ongoing call"))),E(new kc(Object(N.a)("Ongoing call")))):v.length<=1?r.a.createElement(r.a.Fragment,null,y(new kc(Object(N.a)("There's no one here to call"))),E(new kc(Object(N.a)("There's no one here to call")))):2===v.length||b?r.a.createElement(r.a.Fragment,null,y("legacy_or_jitsi"),E("legacy_or_jitsi")):r.a.createElement(r.a.Fragment,null,y(new kc(Object(N.a)("You do not have permission to start voice calls"))),E(new kc(Object(N.a)("You do not have permission to start video calls"))))},Nc=e=>{let{call:t}=e;const a=Object(wc.e)(t),[n,i,o,l]=Object(ce.q)(),d=Object(s.useCallback)((e=>{e.preventDefault(),o()}),[o]),m=Object(s.useCallback)((e=>{e.preventDefault(),l(),t.setLayout(Oc.f.Tile)}),[l,t]),u=Object(s.useCallback)((e=>{e.preventDefault(),l(),t.setLayout(Oc.f.Spotlight)}),[l,t]);let h=null;if(n){const e=i.current.getBoundingClientRect();h=r.a.createElement(me.e,Z()({className:"mx_RoomHeader_layoutMenu"},Object(ce.i)(e),{onFinished:l}),r.a.createElement(me.c,null,r.a.createElement(me.d,{iconClassName:"mx_RoomHeader_freedomIcon",label:Object(N.a)("Freedom"),active:a===Oc.f.Tile,onClick:m}),r.a.createElement(me.d,{iconClassName:"mx_RoomHeader_spotlightIcon",label:Object(N.a)("Spotlight"),active:a===Oc.f.Spotlight,onClick:u})))}return r.a.createElement(r.a.Fragment,null,r.a.createElement(q.a,{inputRef:i,className:c()("mx_RoomHeader_button",{"mx_RoomHeader_layoutButton--freedom":a===Oc.f.Tile,"mx_RoomHeader_layoutButton--spotlight":a===Oc.f.Spotlight}),onClick:d,title:Object(N.a)("Change layout"),alignment:xi.a.Bottom,key:"layout"}),h)};class Pc extends r.a.Component{constructor(e,t){super(e,t),i()(this,"context",void 0),i()(this,"client",this.props.room.client),i()(this,"onRightPanelStoreUpdate",(()=>{this.setState({rightPanelOpen:Ia.a.instance.isOpen})})),i()(this,"onRoomStateEvents",(e=>{this.props.room&&e.getRoomId()===this.props.room.roomId&&this.rateLimitedUpdate()})),i()(this,"onNotificationUpdate",(()=>{this.forceUpdate()})),i()(this,"rateLimitedUpdate",Object(j.throttle)((()=>{this.forceUpdate()}),500,{leading:!0,trailing:!0})),i()(this,"onContextMenuOpenClick",(e=>{e.preventDefault(),e.stopPropagation();const t=e.target;this.setState({contextMenuPosition:t.getBoundingClientRect()})})),i()(this,"onContextMenuCloseClick",(()=>{this.setState({contextMenuPosition:void 0})})),i()(this,"onHideCallClick",(e=>{e.preventDefault(),v.a.dispatch({action:U.a.ViewRoom,room_id:this.props.room.roomId,view_call:!1,metricsTrigger:void 0})}));Pe.a.instance.getRoomState(e.room).on(hc.b.Update,this.onNotificationUpdate),this.state={rightPanelOpen:Ia.a.instance.isOpen}}componentDidMount(){this.client.on(m.b.Events,this.onRoomStateEvents),Ia.a.instance.on(pt.b,this.onRightPanelStoreUpdate)}componentWillUnmount(){this.client.removeListener(m.b.Events,this.onRoomStateEvents);Pe.a.instance.getRoomState(this.props.room).removeListener(hc.b.Update,this.onNotificationUpdate),Ia.a.instance.off(pt.b,this.onRightPanelStoreUpdate)}renderButtons(e){const t=[];this.props.viewingCall||!this.props.inRoom||this.context.tombstone||t.push(r.a.createElement(Tc,{key:"calls",room:this.props.room})),this.props.viewingCall&&this.props.activeCall instanceof Oc.d&&t.push(r.a.createElement(Nc,{key:"layout",call:this.props.activeCall})),!this.props.viewingCall&&this.props.onForgetClick&&t.push(r.a.createElement(q.a,{className:"mx_RoomHeader_button mx_RoomHeader_forgetButton",onClick:this.props.onForgetClick,title:Object(N.a)("Forget room"),alignment:xi.a.Bottom,key:"forget"})),!this.props.viewingCall&&this.props.onAppsClick&&t.push(r.a.createElement(q.a,{className:c()("mx_RoomHeader_button mx_RoomHeader_appsButton",{mx_RoomHeader_appsButton_highlight:this.props.appsShown}),onClick:this.props.onAppsClick,title:this.props.appsShown?Object(N.a)("Hide Widgets"):Object(N.a)("Show Widgets"),alignment:xi.a.Bottom,key:"apps"})),!this.props.viewingCall&&this.props.onSearchClick&&this.props.inRoom&&t.push(r.a.createElement(q.a,{className:"mx_RoomHeader_button mx_RoomHeader_searchButton",onClick:this.props.onSearchClick,title:Object(N.a)("Search"),alignment:xi.a.Bottom,key:"search"})),this.props.onInviteClick&&(!this.props.viewingCall||e)&&this.props.inRoom&&t.push(r.a.createElement(q.a,{className:"mx_RoomHeader_button mx_RoomHeader_inviteButton",onClick:this.props.onInviteClick,title:Object(N.a)("Invite"),alignment:xi.a.Bottom,key:"invite"}));const a=[];return this.props.viewingCall&&!e&&(null===this.props.activeCall?a.push(r.a.createElement(G.a,{className:"mx_RoomHeader_button mx_RoomHeader_closeButton",onClick:this.onHideCallClick,title:Object(N.a)("Close call"),key:"close"})):a.push(r.a.createElement(q.a,{className:"mx_RoomHeader_button mx_RoomHeader_minimiseButton",onClick:this.onHideCallClick,title:Object(N.a)("View chat timeline"),alignment:xi.a.Bottom,key:"minimise"}))),r.a.createElement(r.a.Fragment,null,t,r.a.createElement(sc,{room:this.props.room,excludedRightPanelPhaseButtons:this.props.excludedRightPanelPhaseButtons}),a)}renderName(e){let t=null;this.state.contextMenuPosition&&this.props.room&&(t=r.a.createElement(mc,Z()({},Object(uc.a)(this.state.contextMenuPosition),{room:this.props.room,onFinished:this.onContextMenuCloseClick})));let a=!1;const n=this.props.room?this.props.room.getJoinedMembers():void 0;if(n&&1===n.length&&n[0].userId===this.client.credentials.userId){const e=this.props.room.currentState.getStateEvents("m.room.name","");e&&e.getContent().name||(a=!0)}const i=c()("mx_RoomHeader_nametext",{mx_RoomHeader_settingsHint:a}),s=r.a.createElement(li.a,{room:this.props.room},(t=>{const a=t||e;return r.a.createElement("div",{dir:"auto",className:i,title:a,role:"heading","aria-level":1},a)}));return this.props.enableRoomOptionsMenu?r.a.createElement(ce.c,{className:"mx_RoomHeader_name",onClick:this.onContextMenuOpenClick,isExpanded:!!this.state.contextMenuPosition,title:Object(N.a)("Room options"),alignment:xi.a.Bottom},s,this.props.room&&r.a.createElement("div",{className:"mx_RoomHeader_chevron"}),t):r.a.createElement("div",{className:"mx_RoomHeader_name mx_RoomHeader_name--textonly"},s)}render(){var e;const t=b.b.getValue("feature_video_rooms")&&_c(this.props.room);let a=null;this.props.room&&(a=r.a.createElement(Xt.a,{room:this.props.room,avatarSize:24,oobData:this.props.oobData,viewAvatarOnClick:!0}));const n=this.props.viewingCall?r.a.createElement("div",{className:"mx_RoomHeader_icon mx_RoomHeader_icon_video"}):this.props.e2eStatus?r.a.createElement(Os.b,{className:"mx_RoomHeader_icon",status:this.props.e2eStatus,tooltipAlignment:xi.a.Bottom}):this.client.isRoomEncrypted(this.props.room.roomId)&&this.client.isCryptoEnabled()?r.a.createElement("div",{className:"mx_RoomHeader_icon"}):null,i=this.props.showButtons?this.renderButtons(t):null;let s=Object(N.a)("Join Room");this.props.oobData&&this.props.oobData.name&&(s=this.props.oobData.name);const o=this.renderName(s);if(this.props.viewingCall&&!t)return r.a.createElement("header",{className:"mx_RoomHeader light-panel"},r.a.createElement("div",{className:"mx_RoomHeader_wrapper","aria-owns":this.state.rightPanelOpen?"mx_RightPanel":void 0},r.a.createElement("div",{className:"mx_RoomHeader_avatar"},a),n,o,this.props.activeCall instanceof Oc.d&&r.a.createElement(Cc.b,{groupCall:this.props.activeCall.groupCall}),r.a.createElement("div",{className:"mx_RoomHeader_topic"}),i));let l=null;"number"==typeof(null===(e=this.props.searchInfo)||void 0===e?void 0:e.count)&&(l=r.a.createElement("div",{className:"mx_RoomHeader_searchStatus"}," ",Object(N.a)("(~%(count)s results)",{count:this.props.searchInfo.count})));const c=r.a.createElement(Qo,{room:this.props.room,className:"mx_RoomHeader_topic"}),d=t?r.a.createElement(de.a,{onClick:()=>v.a.dispatch({action:U.a.ViewUserSettings,initialTabId:Ae.a.Labs}),tooltipTitle:Object(N.a)("Video rooms are a beta feature")}):null;return r.a.createElement("header",{className:"mx_RoomHeader light-panel"},r.a.createElement("div",{className:"mx_RoomHeader_wrapper","aria-owns":this.state.rightPanelOpen?"mx_RightPanel":void 0},r.a.createElement("div",{className:"mx_RoomHeader_avatar"},a),n,o,l,c,d,i),!t&&r.a.createElement(jc,{roomId:this.props.room.roomId}),r.a.createElement(Ec,{roomId:this.props.room.roomId}))}}i()(Pc,"defaultProps",{inRoom:!1,excludedRightPanelPhaseButtons:[],showButtons:!0,enableRoomOptionsMenu:!0}),i()(Pc,"contextType",Ga.b);var Dc=e=>{let{roomWidth:t}=e;const n=Object(s.useRef)(null),i=Object(s.useRef)(new Map);return Object(s.useEffect)((()=>{const e=()=>{var e;n.current&&(null===(e=n.current)||void 0===e?void 0:e.height)!==Q.b.instance.windowHeight&&(n.current.height=Q.b.instance.windowHeight)},t=v.a.register((e=>{const t="effects.";if(0===e.action.indexOf(t)){(async e=>{if(!e)return null;let t=i.current.get(e)||null;if(null===t){var n;const s=null===(n=yn.CHAT_EFFECTS.find((t=>t.command===e)))||void 0===n?void 0:n.options;try{const{default:n}=await a(1514)(`./${e}`);t=new n(s),i.current.set(e,t)}catch(t){ga.a.warn(`Unable to load effect module at '../../../effects/${e}.`,t)}}return t})(e.action.slice(t.length)).then((e=>null==e?void 0:e.start(n.current)))}}));return n.current.height=Q.b.instance.windowHeight,Q.b.instance.on(Q.a.Resize,e),()=>{v.a.unregister(t),Q.b.instance.off(Q.a.Resize,e);const a=i.current;for(const e in a){const t=a.get(e);t&&t.isRunning&&t.stop()}}}),[]),r.a.createElement("canvas",{ref:n,width:t,style:{display:"block",zIndex:999999,pointerEvents:"none",position:"fixed",top:0,right:0}})},Mc=a(306);const Ac=e=>{let{kind:t,devices:a,setDevice:n,deviceListLabel:i,muted:o,disabled:l,toggle:d,unmutedTitle:m,mutedTitle:u}=e;const[h,p,g,v]=Object(ce.q)(),b=Object(s.useCallback)((e=>{n(e),v()}),[n,v]);let f=null;if(h){const e=p.current.getBoundingClientRect();f=r.a.createElement(me.e,Z()({},Object(ce.j)(e,void 0,10),{onFinished:v}),r.a.createElement(me.c,null,a.map((e=>r.a.createElement(me.b,{key:e.deviceId,label:e.label,onClick:()=>b(e)})))))}return a.length?r.a.createElement("div",{className:c()("mx_CallView_deviceButtonWrapper",{mx_CallView_deviceButtonWrapper_muted:o})},r.a.createElement(q.a,{className:`mx_CallView_deviceButton mx_CallView_deviceButton_${t}`,inputRef:p,title:o?u:m,alignment:xi.a.Top,onClick:d,disabled:l}),a.length>1?r.a.createElement(ce.b,{className:"mx_CallView_deviceListButton",onClick:g,isExpanded:h,label:i,disabled:l}):null,f):null},Lc=e=>{let{room:t,joinCallButtonDisabledTooltip:a,connect:n,children:i}=e;const[o,l]=Object(s.useState)(!1),c=Object(s.useMemo)((()=>t.getMember(t.myUserId)),[t]),d=Object(s.useRef)(null),[m,u]=Object(s.useState)((()=>p.c.getVideoInput())),[h,g]=Object(s.useState)((()=>p.c.startWithAudioMuted)),[v,b]=Object(s.useState)((()=>p.c.startWithVideoMuted)),f=Object(s.useCallback)((()=>{p.c.startWithAudioMuted=!h,g(!h)}),[h,g]),y=Object(s.useCallback)((()=>{p.c.startWithVideoMuted=!v,b(!v)}),[v,b]),[E,_,w]=Object(Yn.a)((async()=>{let e=await p.c.getDevices(),t=null;try{e.audioinput.length>0?t=await navigator.mediaDevices.getUserMedia({audio:!0,video:!v&&e.videoinput.length>0&&{deviceId:m}}):e.videoinput.length>0&&(t=await navigator.mediaDevices.getUserMedia({video:{deviceId:m}}))}catch(e){ga.a.error(`Failed to get stream for device ${m}`,e)}var a;(null!==t&&(e=await p.c.getDevices()),v)&&(null===(a=t)||void 0===a||a.getTracks().forEach((e=>e.stop())),t=null);return[t,e.audioinput,e.videoinput]}),[m,v],[null,[],[]]),S=Object(s.useCallback)((e=>{p.c.instance.setAudioInput(e.deviceId)}),[]),O=Object(s.useCallback)((e=>{p.c.instance.setVideoInput(e.deviceId),u(e.deviceId)}),[]);Object(s.useEffect)((()=>{if(E){const e=d.current;return e.srcObject=E,e.play(),()=>{E.getTracks().forEach((e=>e.stop())),e.srcObject=null}}}),[E]);const C=Object(s.useCallback)((async e=>{e.preventDefault(),l(!0);try{await n()}catch(e){ga.a.error(e),l(!1)}}),[n,l]);return r.a.createElement("div",{className:"mx_CallView_lobby"},i,r.a.createElement("div",{className:"mx_CallView_preview"},r.a.createElement(Qn.b,{key:c.userId,member:c,width:200,height:200,resizeMethod:"scale"}),r.a.createElement("video",{ref:d,style:{visibility:v?"hidden":void 0},muted:!0,playsInline:!0,disablePictureInPicture:!0}),r.a.createElement("div",{className:"mx_CallView_controls"},r.a.createElement(Ac,{kind:"audio",devices:_,setDevice:S,deviceListLabel:Object(N.a)("Audio devices"),muted:h,disabled:o,toggle:f,unmutedTitle:Object(N.a)("Mute microphone"),mutedTitle:Object(N.a)("Unmute microphone")}),r.a.createElement(Ac,{kind:"video",devices:w,setDevice:O,deviceListLabel:Object(N.a)("Video devices"),muted:v,disabled:o,toggle:y,unmutedTitle:Object(N.a)("Turn off camera"),mutedTitle:Object(N.a)("Turn on camera")}))),r.a.createElement(q.a,{className:"mx_CallView_connectButton",kind:"primary",disabled:o||void 0!==a,onClick:C,label:Object(N.a)("Join"),tooltip:o?Object(N.a)("Connecting"):a,alignment:xi.a.Bottom}))},Uc=e=>{let{room:t,resizing:a,call:n,setStartingCall:i}=e;const o=Object(s.useContext)(R.a),l=Object(s.useRef)();void 0===l.current&&(l.current=Object(un.m)());const c=l.current,[d,m]=Object(s.useState)((()=>null!==n&&Object(Oc.g)(n.connectionState)));Object(s.useEffect)((()=>{if(null!==n){const e=e=>m(Object(Oc.g)(e));return n.on(Oc.b.ConnectionState,e),()=>{n.off(Oc.b.ConnectionState,e)}}}),[n]);const u=Object(s.useCallback)((async()=>{i(!0),await Oc.d.create(t),await c.promise}),[t,i,c]);return Object(s.useEffect)((()=>{(async()=>{if(null!==n)try{await Promise.all([...Mc.a.instance.activeCalls].map((e=>e.disconnect()))),await n.connect(),c.resolve()}catch(e){c.reject(e)}})()}),[n,c]),r.a.createElement("div",{className:"mx_CallView"},d?null:r.a.createElement(Lc,{room:t,connect:u}),null!==n&&r.a.createElement(vs,{app:n.widget,room:t,userId:o.credentials.userId,creatorUserId:n.widget.creatorUserId,waitForIframeLoad:n.widget.waitForIframeLoad,showMenubar:!1,pointerEvents:a?"none":void 0}))},Fc=e=>{let{room:t,resizing:a,call:n}=e;const i=Object(s.useContext)(R.a),o=Object(Oc.g)(Object(wc.c)(n)),l=Object(wc.g)(n),c=Object(wc.d)(n),d=Object(s.useCallback)((async()=>{await Promise.all([...Mc.a.instance.activeCalls].map((e=>e.disconnect()))),await n.connect()}),[n]);Object(s.useEffect)((()=>{n.clean()}),[n]);let m=null;if(!o){let e=null;if(l.length){const t=l.slice(0,8),a=l.length>t.length;e=r.a.createElement("div",{className:"mx_CallView_participants"},Object(N.a)("%(count)s people joined",{count:l.length}),r.a.createElement(Xo.a,{members:t,faceSize:24,overflow:a}))}m=r.a.createElement(Lc,{room:t,connect:d,joinCallButtonDisabledTooltip:null!=c?c:void 0},e)}return r.a.createElement("div",{className:"mx_CallView"},m,r.a.createElement(vs,{app:n.widget,room:t,userId:i.credentials.userId,creatorUserId:n.widget.creatorUserId,waitForIframeLoad:n.widget.waitForIframeLoad,showMenubar:!1,pointerEvents:a?"none":void 0}))},Bc=e=>{let{room:t,resizing:a,waitForCall:n}=e;const i=Object(wc.a)(t.roomId),[o,l]=Object(s.useState)(!1);return null===i||o?n?null:r.a.createElement(Uc,{room:t,resizing:a,call:i,setStartingCall:l}):r.a.createElement(Fc,{room:t,resizing:a,call:i})};var Vc=a(274),Wc=a(617),Hc=a(219),zc=a(325);const Gc=(e,t)=>{const[a,n]=Object(s.useState)((()=>Array.isArray(t)?t:new Array(e).fill(t)));return[a,(e,t)=>n((a=>{const n=[...a];return n[e]=t,n}))]};var Kc=a(393),qc=a(803),$c=a(882),Yc=a(841),Jc=a(397),Qc=a(391);function Xc(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function Zc(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?Xc(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):Xc(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}const ed=e=>{var t;let{room:a,suggested:n,selected:i,hasPermissions:o,onToggleClick:l,onViewRoomClick:d,onJoinRoomClick:m,numChildRooms:u,children:h}=e;const p=Object(s.useContext)(R.a),[g,v]=Object(s.useState)((()=>{const e=p.getRoom(a.room_id);return"join"===(null==e?void 0:e.getMyMembership())?e:null})),b=Object(ie.d)(g,te.d.Name,(e=>null==e?void 0:e.name)),f=b||a.name||a.canonical_alias||(null===(t=a.aliases)||void 0===t?void 0:t[0])||(a.room_type===ee.j.Space?Object(N.a)("Unnamed Space"):Object(N.a)("Unnamed Room")),[y,E]=Object(Jc.a)(!0),[_,w,S]=Object(xe.i)(),[O,C]=Object(s.useState)(!1),x=e=>{e.preventDefault(),e.stopPropagation(),d()},j=async e=>{C(!0),e.preventDefault(),e.stopPropagation(),m().then((()=>Object(Qc.a)(p,a.room_id))).then(v).finally((()=>{C(!1)}))};let k,I,T;k=O?r.a.createElement(q.a,{disabled:!0,onClick:j,kind:"primary_outline",onFocus:_,tabIndex:w?0:-1,title:Object(N.a)("Joining")},r.a.createElement(Kn.a,{w:24,h:24})):g?r.a.createElement(G.a,{onClick:x,kind:"primary_outline",onFocus:_,tabIndex:w?0:-1},Object(N.a)("View")):r.a.createElement(G.a,{onClick:j,kind:"primary",onFocus:_,tabIndex:w?0:-1},Object(N.a)("Join")),l&&(I=o?r.a.createElement(De.b,{checked:!!i,onChange:l,tabIndex:w?0:-1}):r.a.createElement(Ua.a,{tooltip:Object(N.a)("You don't have permission"),onClick:e=>{e.stopPropagation()}},r.a.createElement(De.b,{disabled:!0,tabIndex:w?0:-1}))),T=g?r.a.createElement(ye.a,{room:g,width:20,height:20}):r.a.createElement(gt.a,{name:f,idName:a.room_id,url:a.avatar_url?Object(Fa.b)(a.avatar_url).getSquareThumbnailHttp(20):null,width:20,height:20});let P,D,M,A,L=Object(N.a)("%(count)s members",{count:a.num_joined_members});if(void 0!==u&&(L+=" · "+Object(N.a)("%(count)s rooms",{count:u})),g){const e=Object(Yo.a)(g);P=Object(zo.j)(null==e?void 0:e.text,null==e?void 0:e.html)}else P=a.topic;P&&(D=r.a.createElement(zo.a,{options:{attributes:{onClick(e){e.stopPropagation()}}}}," · ",P)),g&&(M=r.a.createElement("div",{className:"mx_SpaceHierarchy_roomTile_joined"},Object(N.a)("Joined"))),!n||g&&!o||(A=r.a.createElement(Yc.b,{tooltip:Object(N.a)("This room is suggested as a good one to join")},Object(N.a)("Suggested")));const U=r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:"mx_SpaceHierarchy_roomTile_item"},r.a.createElement("div",{className:"mx_SpaceHierarchy_roomTile_avatar"},T),r.a.createElement("div",{className:"mx_SpaceHierarchy_roomTile_name"},f,M,A),r.a.createElement("div",{className:"mx_SpaceHierarchy_roomTile_info"},L,D)),r.a.createElement("div",{className:"mx_SpaceHierarchy_actions"},k,I));let F,B,V;if(h){if(F=r.a.createElement("div",{className:c()("mx_SpaceHierarchy_subspace_toggle",{mx_SpaceHierarchy_subspace_toggle_shown:y}),onClick:e=>{e.stopPropagation(),E()}}),y){const e=e=>{var t;if(Object(J.a)().getAccessibilityAction(e)===W.h.ArrowLeft)e.preventDefault(),e.stopPropagation(),null===(t=S.current)||void 0===t||t.focus()};B=r.a.createElement("div",{className:"mx_SpaceHierarchy_subspace_children",onKeyDown:e,role:"group"},h)}V=e=>{let t=!1;switch(Object(J.a)().getAccessibilityAction(e)){case W.h.ArrowLeft:y&&(t=!0,E());break;case W.h.ArrowRight:if(t=!0,y){var a,n;const e=null===(a=S.current)||void 0===a?void 0:a.nextElementSibling;null==e||null===(n=e.querySelector(".mx_SpaceHierarchy_roomTile"))||void 0===n||n.focus()}else E()}t&&(e.preventDefault(),e.stopPropagation())}}return r.a.createElement("li",{className:"mx_SpaceHierarchy_roomTileWrapper",role:"treeitem","aria-selected":i,"aria-expanded":h?y:void 0},r.a.createElement(G.a,{className:c()("mx_SpaceHierarchy_roomTile",{mx_SpaceHierarchy_subspace:a.room_type===ee.j.Space,mx_SpaceHierarchy_joining:O}),onClick:o&&l?l:x,onKeyDown:V,inputRef:S,onFocus:_,tabIndex:w?0:-1},U,F),B)},td=(e,t,a,n)=>{var i,s;const r=t.roomMap.get(a);if(e.isGuest()&&!r.world_readable&&!r.guest_can_join)return void v.a.dispatch({action:"require_registration"});const o=Object(Ca.a)(null!==(i=null==r?void 0:r.canonical_alias)&&void 0!==i?i:"",null!==(s=null==r?void 0:r.aliases)&&void 0!==s?s:[])||void 0;v.a.dispatch({action:U.a.ViewRoom,should_peek:!0,room_alias:o,room_id:r.room_id,via_servers:Array.from(t.viaMap.get(a)||[]),oob_data:{avatarUrl:r.avatar_url,name:r.name||o||Object(N.a)("Unnamed room"),roomType:n},metricsTrigger:"RoomDirectory"})},ad=e=>{let{root:t,roomSet:a,hierarchy:n,parents:i,selectedMap:o,onViewRoomClick:l,onJoinRoomClick:c,onToggleClick:d}=e;const m=Object(s.useContext)(R.a),u=m.getRoom(t.room_id),h=null==u?void 0:u.currentState.maySendStateEvent(ee.b.SpaceChild,m.getUserId()),p=Object(j.sortBy)(t.children_state,(e=>Object($.b)(e.content.order,e.origin_server_ts,e.state_key))),[g,v]=p.reduce(((e,t)=>{const i=n.roomMap.get(t.state_key);return i&&a.has(i)&&e[i.room_type===ee.j.Space?0:1].push(((e,t,a)=>{const n=e.getRoomUpgradeHistory(t.room_id,!0);let i=null;for(let e=n.length-1;e>=0;--e)if(a.roomMap.get(n[e].roomId)){i=n[e];break}var s,r,o,l;return i?Zc(Zc({},t),{},{room_id:i.roomId,room_type:i.getType(),name:i.name,topic:null===(s=i.currentState.getStateEvents(ee.b.RoomTopic,""))||void 0===s?void 0:s.getContent().topic,avatar_url:i.getMxcAvatarUrl(),canonical_alias:null!==(r=i.getCanonicalAlias())&&void 0!==r?r:void 0,aliases:i.getAltAliases(),world_readable:(null===(o=i.currentState.getStateEvents(ee.b.RoomHistoryVisibility,""))||void 0===o?void 0:o.getContent().history_visibility)===_a.b.WorldReadable,guest_can_join:(null===(l=i.currentState.getStateEvents(ee.b.RoomGuestAccess,""))||void 0===l?void 0:l.getContent().guest_access)===_a.a.CanJoin,num_joined_members:i.getJoinedMemberCount()}):t})(m,i,n)),e}),[[],[]]),b=new Set(i).add(t.room_id);return r.a.createElement(r.a.Fragment,null,Object(j.uniqBy)(v,"room_id").map((e=>{var a;return r.a.createElement(ed,{key:e.room_id,room:e,suggested:n.isSuggested(t.room_id,e.room_id),selected:null==o||null===(a=o.get(t.room_id))||void 0===a?void 0:a.has(e.room_id),onViewRoomClick:()=>l(e.room_id,e.room_type),onJoinRoomClick:()=>c(e.room_id),hasPermissions:h,onToggleClick:d?()=>d(t.room_id,e.room_id):void 0})})),g.filter((e=>!b.has(e.room_id))).map((e=>{var i;return r.a.createElement(ed,{key:e.room_id,room:e,numChildRooms:e.children_state.filter((e=>{const t=n.roomMap.get(e.state_key);return t&&a.has(t)&&!t.room_type})).length,suggested:n.isSuggested(t.room_id,e.room_id),selected:null==o||null===(i=o.get(t.room_id))||void 0===i?void 0:i.has(e.room_id),onViewRoomClick:()=>l(e.room_id,ee.j.Space),onJoinRoomClick:()=>c(e.room_id),hasPermissions:h,onToggleClick:d?()=>d(t.room_id,e.room_id):void 0},r.a.createElement(ad,{root:e,roomSet:a,hierarchy:n,parents:b,selectedMap:o,onViewRoomClick:l,onJoinRoomClick:c,onToggleClick:d}))})))},nd=e=>{let{hierarchy:t,selected:a,setSelected:n,setError:i}=e;const o=Object(s.useContext)(R.a),[l,c]=Object(s.useState)(!1),[d,m]=Object(s.useState)(!1),u=Array.from(a.keys()).flatMap((e=>[...a.get(e).values()].map((t=>[e,t])))),h=u.every((e=>{let[a,n]=e;return t.isSuggested(a,n)})),p=!u.length||l||d;let g=G.a,v={};u.length||(g=q.a,v={tooltip:Object(N.a)("Select a room below first"),alignment:xi.a.Top});let b=Object(N.a)("Saving…");return d||(b=h?Object(N.a)("Mark as not suggested"):Object(N.a)("Mark as suggested")),r.a.createElement(r.a.Fragment,null,r.a.createElement(g,Z()({},v,{onClick:async()=>{c(!0);try{const e=o.getUserId();for(const[a,n]of u){await o.sendStateEvent(a,ee.b.SpaceChild,{},n);const i=o.getRoom(n),s=null==i?void 0:i.currentState.getStateEvents(ee.b.SpaceParent,a);null!=i&&i.currentState.maySendStateEvent(ee.b.SpaceParent,e)&&Array.isArray(null==s?void 0:s.getContent().via)&&await o.sendStateEvent(n,ee.b.SpaceParent,{},a),t.removeRelation(a,n)}}catch(e){i(Object(N.a)("Failed to remove some rooms. Try again later"))}c(!1),n(new Map)},kind:"danger_outline",disabled:p}),l?Object(N.a)("Removing…"):Object(N.a)("Remove")),r.a.createElement(g,Z()({},v,{onClick:async()=>{m(!0);try{for(const[a,n]of u){var e;const i=!h,s=null===(e=t.getRelation(a,n))||void 0===e?void 0:e.content;if(!s||s.suggested===i)continue;const r=Zc(Zc({},s),{},{suggested:!h});await o.sendStateEvent(a,ee.b.SpaceChild,r,n),s.suggested=r.suggested}}catch(e){i("Failed to update some suggestions. Try again later")}m(!1),n(new Map)},kind:"primary_outline",disabled:p}),b))};var id,sd=e=>{let{space:t,initialText:a="",showRoom:n,additionalButtons:i}=e;const o=Object(s.useContext)(R.a),[l,c]=Object(s.useState)(a),[d,m]=Object(s.useState)(new Map),{loading:u,rooms:h,hierarchy:p,loadMore:g,error:b}=(e=>{const[t,a]=Object(s.useState)([]),[n,i]=Object(s.useState)(),[r,o]=Object(s.useState)(),l=Object(s.useCallback)((()=>{o(void 0);const t=new $c.a(e,20);t.load().then((()=>{e===t.root&&a(t.rooms)}),o),i(t)}),[e]);Object(s.useEffect)(l,[l]),Object(ne.a)(v.a,(e=>{e.action===U.a.UpdateSpaceHierarchy&&(a([]),l())}));const c=Object(s.useCallback)((async e=>{n.loading||!n.canLoadMore||n.noSupport||r||(await n.load(e).catch(o),a(n.rooms))}),[r,n]);return(null==n?void 0:n.root)!==e?{loading:!0,loadMore:c}:{loading:n.loading,rooms:t,hierarchy:n,loadMore:c,error:r}})(t),f=Object(s.useMemo)((()=>{if(null==h||!h.length||!p)return new Set;const e=l.toLowerCase().trim();if(!e)return new Set(h);const t=h.filter((t=>{var a,n;return(null===(a=t.name)||void 0===a?void 0:a.toLowerCase().includes(e))||(null===(n=t.topic)||void 0===n?void 0:n.toLowerCase().includes(e))})),a=new Set,n=[...t.map((e=>e.room_id))];for(;n.length;){var i;const e=n.pop();a.add(e),null===(i=p.backRefs.get(e))||void 0===i||i.forEach((e=>{a.has(e)||n.push(e)}))}return new Set(h.filter((e=>a.has(e.room_id))))}),[h,p,l]),[y,E]=Object(s.useState)("");let _=y;!y&&b&&(_=Object(N.a)("Failed to load list of rooms."));const w=(e=>{const t=t=>{t[0].isIntersecting&&e()},a=Object(s.useRef)();return e=>{a.current?a.current.disconnect():e&&(a.current=new IntersectionObserver(t,{root:e.parentElement,rootMargin:"0px 0px 600px 0px"})),a.current&&e&&a.current.observe(e)}})(g);if(!u&&p.noSupport)return r.a.createElement("p",null,Object(N.a)("Your server does not support showing space hierarchies."));const S=(e,t)=>{if(E(""),!d.has(e))return void m(new Map(d.set(e,new Set([t]))));const a=d.get(e);a.has(t)?(a.delete(t),m(new Map(d.set(e,new Set(a))))):m(new Map(d.set(e,new Set([...a,t]))))};return r.a.createElement(xe.d,{onKeyDown:(e,t)=>{var a,n;Object(J.a)().getAccessibilityAction(e)===W.h.ArrowDown&&e.currentTarget.classList.contains("mx_SpaceHierarchy_search")&&(null===(a=t.refs[0])||void 0===a||null===(n=a.current)||void 0===n||n.focus())},handleHomeEnd:!0,handleUpDown:!0},(e=>{let s,{onKeyDownHandler:g}=e;if(p&&(!u||null!=h&&h.length)){const e="join"===(null==t?void 0:t.getMyMembership())&&t.currentState.maySendStateEvent(ee.b.SpaceChild,o.getUserId());let a,c;f.size?a=r.a.createElement(r.a.Fragment,null,r.a.createElement(ad,{root:p.roomMap.get(t.roomId),roomSet:f,hierarchy:p,parents:new Set,selectedMap:d,onToggleClick:e?S:void 0,onViewRoomClick:(e,t)=>n(o,p,e,t),onJoinRoomClick:e=>((e,t,a)=>{if(e.isGuest())return void v.a.dispatch({action:"require_registration"});const n=e.joinRoom(a,{viaServers:Array.from(t.viaMap.get(a)||[])});return n.then((()=>{v.a.dispatch({action:U.a.JoinRoomReady,roomId:a,metricsTrigger:"SpaceHierarchy"})}),(e=>{rt.b.instance.roomViewStore.showJoinRoomError(e,a)})),n})(o,p,e)})):p.canLoadMore||(a=r.a.createElement("div",{className:"mx_SpaceHierarchy_noResults"},r.a.createElement("h3",null,Object(N.a)("No results found")),r.a.createElement("div",null,Object(N.a)("You may want to try a different search or check for typos.")))),p.canLoadMore&&(c=r.a.createElement("div",{ref:w},r.a.createElement(Kn.a,null))),s=r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:"mx_SpaceHierarchy_listHeader"},r.a.createElement("h4",{className:"mx_SpaceHierarchy_listHeader_header"},l.trim()?Object(N.a)("Results"):Object(N.a)("Rooms and spaces")),r.a.createElement("div",{className:"mx_SpaceHierarchy_listHeader_buttons"},i,e&&r.a.createElement(nd,{hierarchy:p,selected:d,setSelected:m,setError:E}))),_&&r.a.createElement("div",{className:"mx_SpaceHierarchy_error"},_),r.a.createElement("ul",{className:"mx_SpaceHierarchy_list",onKeyDown:g,role:"tree","aria-label":Object(N.a)("Space")},a),c)}else s=r.a.createElement(Kn.a,null);return r.a.createElement(r.a.Fragment,null,r.a.createElement(_s.a,{className:"mx_SpaceHierarchy_search mx_textinput_icon mx_textinput_search",placeholder:Object(N.a)("Search names and descriptions"),onSearch:c,autoFocus:!0,initialValue:a,onKeyDown:g}),s)}))};!function(e){e[e.Landing=0]="Landing",e[e.PublicCreateRooms=1]="PublicCreateRooms",e[e.PublicShare=2]="PublicShare",e[e.PrivateScope=3]="PrivateScope",e[e.PrivateInvite=4]="PrivateInvite",e[e.PrivateCreateRooms=5]="PrivateCreateRooms",e[e.PrivateExistingRooms=6]="PrivateExistingRooms"}(id||(id={}));const rd=e=>{let{space:t}=e;const[a,n,i,s]=Object(ce.q)(),o=Object(ae.a)(oe.a.CreateRooms),l=Object(ae.a)(oe.a.CreateSpaces),c=Object(se.a)("feature_video_rooms"),d=Object(se.a)("feature_element_call_video_rooms");let m=null;if(a){const e=n.current.getBoundingClientRect();m=r.a.createElement(me.e,{left:e.left+window.scrollX+0,top:e.bottom+window.scrollY+8,chevronFace:ce.a.None,onFinished:s,className:"mx_RoomTile_contextMenu",compact:!0},r.a.createElement(me.c,{first:!0},o&&r.a.createElement(r.a.Fragment,null,r.a.createElement(me.b,{label:Object(N.a)("New room"),iconClassName:"mx_RoomList_iconNewRoom",onClick:async e=>{e.preventDefault(),e.stopPropagation(),s(),re.b.trackInteraction("WebSpaceHomeCreateRoomButton",e),await Object(le.g)(t)&&v.a.fire(U.a.UpdateSpaceHierarchy)}}),c&&r.a.createElement(me.b,{label:Object(N.a)("New video room"),iconClassName:"mx_RoomList_iconNewVideoRoom",onClick:async e=>{e.preventDefault(),e.stopPropagation(),s(),await Object(le.g)(t,d?ee.j.UnstableCall:ee.j.ElementVideo)&&v.a.fire(U.a.UpdateSpaceHierarchy)}},r.a.createElement(de.a,null))),r.a.createElement(me.b,{label:Object(N.a)("Add existing room"),iconClassName:"mx_RoomList_iconAddExistingRoom",onClick:e=>{e.preventDefault(),e.stopPropagation(),s(),Object(le.e)(t)}}),l&&r.a.createElement(me.b,{label:Object(N.a)("Add space"),iconClassName:"mx_RoomList_iconPlus",onClick:e=>{e.preventDefault(),e.stopPropagation(),s(),Object(le.h)(t)}},r.a.createElement(de.a,null))))}return r.a.createElement(r.a.Fragment,null,r.a.createElement(ce.b,{kind:"primary",inputRef:n,onClick:i,isExpanded:a,label:Object(N.a)("Add")},Object(N.a)("Add")),m)},od=e=>{let{space:t}=e;const a=Object(s.useContext)(R.a),n=Wn(t),i=a.getUserId(),o=Object(s.useCallback)((()=>{var e;return Ia.a.instance.isOpenForRoom(t.roomId)&&(null===(e=Ia.a.instance.currentCardForRoom(t.roomId))||void 0===e?void 0:e.phase)===Ra.a.SpaceMemberList}),[t.roomId]),l=Object(ie.b)(Ia.a.instance,pt.b,o);let c;Object(le.c)(t)&&Object(ae.a)(oe.a.InviteUsers)&&(c=r.a.createElement(G.a,{kind:"primary",className:"mx_SpaceRoomView_landing_inviteButton",onClick:()=>{Object(le.i)(t)}},Object(N.a)("Invite")));let d,m;"join"===n&&t.currentState.maySendStateEvent(ee.b.SpaceChild,i)&&(d=r.a.createElement(rd,{space:t})),Object(le.d)(t)&&(m=r.a.createElement(q.a,{className:"mx_SpaceRoomView_landing_settingsButton",onClick:()=>{Object(le.k)(t)},title:Object(N.a)("Settings")}));return r.a.createElement("div",{className:"mx_SpaceRoomView_landing"},r.a.createElement("div",{className:"mx_SpaceRoomView_landing_header"},r.a.createElement(ye.a,{room:t,height:80,width:80,viewAvatarOnClick:!0}),r.a.createElement(fe.b,null)),r.a.createElement("div",{className:"mx_SpaceRoomView_landing_name"},r.a.createElement(li.a,{room:t},(e=>{const t={name:()=>r.a.createElement("h1",null,e)};return Object(N.a)("Welcome to <name/>",{},t)}))),r.a.createElement("div",{className:"mx_SpaceRoomView_landing_infoBar"},r.a.createElement(nl,{room:t}),r.a.createElement("div",{className:"mx_SpaceRoomView_landing_infoBar_interactive"},r.a.createElement(al,{room:t,onlyKnownUsers:!1,numShown:7,onClick:l?void 0:()=>{Ia.a.instance.setCard({phase:Ra.a.SpaceMemberList})}}),c,m)),r.a.createElement(Qo,{room:t,className:"mx_SpaceRoomView_landing_topic"}),r.a.createElement(sd,{space:t,showRoom:td,additionalButtons:d}))},ld=e=>{let{space:t,title:a,description:n,onFinished:i}=e;const[o,l]=Object(s.useState)(!1),[c,d]=Object(s.useState)(""),m=[Object(N.a)("General"),Object(N.a)("Random"),Object(N.a)("Support")],[u,h]=Gc(3,[Object(N.a)("General"),Object(N.a)("Random"),""]),p=new Array(3).fill(0).map(((e,t)=>{const a="roomName"+t;return r.a.createElement(ci.a,{key:a,name:a,type:"text",label:Object(N.a)("Room name"),placeholder:m[t],value:u[t],onChange:e=>h(t,e.target.value),autoFocus:2===t,disabled:o,autoComplete:"off"})})),g=async e=>{if(e.preventDefault(),!o){d(""),l(!0);try{const e=t.getJoinRule()===_a.c.Public,a=u.map((e=>e.trim())).filter(Boolean),n=await Promise.all(a.map((a=>Object(Hc.b)({createOpts:{preset:e?_a.d.PublicChat:_a.d.PrivateChat,name:a},spinner:!1,encryption:!1,andView:!1,inlineErrors:!0,parentSpace:t,joinRule:e?void 0:_a.c.Restricted,suggested:!0}))));i(n[0])}catch(e){ga.a.error("Failed to create initial space rooms",e),d(Object(N.a)("Failed to create initial space rooms"))}l(!1)}};let v=e=>{e.preventDefault(),i()},b=Object(N.a)("Skip for now");return u.some((e=>e.trim()))&&(v=g,b=o?Object(N.a)("Creating rooms…"):Object(N.a)("Continue")),r.a.createElement("div",null,r.a.createElement("h1",null,a),r.a.createElement("div",{className:"mx_SpaceRoomView_description"},n),c&&r.a.createElement("div",{className:"mx_SpaceRoomView_errorText"},c),r.a.createElement("form",{onSubmit:v,id:"mx_SpaceSetupFirstRooms"},p),r.a.createElement("div",{className:"mx_SpaceRoomView_buttons"},r.a.createElement(G.a,{kind:"primary",disabled:o,onClick:v,element:"input",type:"submit",form:"mx_SpaceSetupFirstRooms",value:b})))},cd=e=>{let{space:t,onFinished:a}=e;return r.a.createElement("div",null,r.a.createElement("h1",null,Object(N.a)("What do you want to organise?")),r.a.createElement("div",{className:"mx_SpaceRoomView_description"},Object(N.a)("Pick rooms or conversations to add. This is just a space for you, no one will be informed. You can add more later.")),r.a.createElement(Kc.a,{space:t,emptySelectionButton:r.a.createElement(G.a,{kind:"primary",onClick:a},Object(N.a)("Skip for now")),filterPlaceholder:Object(N.a)("Search for rooms"),onFinished:a,roomsRenderer:Kc.f,dmsRenderer:Kc.e}))},dd=e=>{var t;let{justCreatedOpts:a,space:n,onFinished:i,firstRoomId:s}=e;return r.a.createElement("div",{className:"mx_SpaceRoomView_publicShare"},r.a.createElement("h1",null,Object(N.a)("Share %(name)s",{name:(null==a||null===(t=a.createOpts)||void 0===t?void 0:t.name)||n.name})),r.a.createElement("div",{className:"mx_SpaceRoomView_description"},Object(N.a)("It's just you at the moment, it will be even better with others.")),r.a.createElement(qc.a,{space:n}),r.a.createElement("div",{className:"mx_SpaceRoomView_buttons"},r.a.createElement(G.a,{kind:"primary",onClick:i},s?Object(N.a)("Go to my first room"):Object(N.a)("Go to my space"))))},md=e=>{var t;let{space:a,justCreatedOpts:n,onFinished:i}=e;return r.a.createElement("div",{className:"mx_SpaceRoomView_privateScope"},r.a.createElement("h1",null,Object(N.a)("Who are you working with?")),r.a.createElement("div",{className:"mx_SpaceRoomView_description"},Object(N.a)("Make sure the right people have access to %(name)s",{name:(null==n||null===(t=n.createOpts)||void 0===t?void 0:t.name)||a.name})),r.a.createElement(G.a,{className:"mx_SpaceRoomView_privateScope_justMeButton",onClick:()=>{i(!1)}},r.a.createElement("h3",null,Object(N.a)("Just me")),r.a.createElement("div",null,Object(N.a)("A private space to organise your rooms"))),r.a.createElement(G.a,{className:"mx_SpaceRoomView_privateScope_meAndMyTeammatesButton",onClick:()=>{i(!0)}},r.a.createElement("h3",null,Object(N.a)("Me and my teammates")),r.a.createElement("div",null,Object(N.a)("A private space for you and your teammates"))))},ud=Object(ui.a)({rules:[{key:"email",test:e=>{let{value:t}=e;return!t||zc.a(t)},invalid:()=>Object(N.a)("Doesn't look like a valid email address")}]}),hd=e=>{let{space:t,onFinished:a}=e;const[n,i]=Object(s.useState)(!1),[o,l]=Object(s.useState)(""),c=[Object(s.useRef)(),Object(s.useRef)(),Object(s.useRef)()],[d,m]=Gc(3,""),u=new Array(3).fill(0).map(((e,t)=>{const a="emailAddress"+t;return r.a.createElement(ci.a,{key:a,name:a,type:"text",label:Object(N.a)("Email address"),placeholder:Object(N.a)("Email"),value:d[t],onChange:e=>m(t,e.target.value),ref:c[t],onValidate:ud,autoFocus:0===t,disabled:n})})),h=async e=>{if(e.preventDefault(),n)return;l("");for(const e of c){if(!1===await e.current.validate({allowEmpty:!0}))return e.current.focus(),void e.current.validate({allowEmpty:!0,focused:!0})}i(!0);const s=d.map((e=>e.trim())).filter(Boolean);try{const e=await Object(ys.a)(t.roomId,s),n=Object.keys(e.states).filter((t=>"error"===e.states[t]));n.length>0?(ga.a.log("Failed to invite users to space: ",e),l(Object(N.a)("Failed to invite the following users to your space: %(csvUsers)s",{csvUsers:n.join(", ")}))):a()}catch(e){ga.a.error("Failed to invite users to space: ",e),l(Object(N.a)("We couldn't invite those users. Please check the users you want to invite and try again."))}i(!1)};let p=e=>{e.preventDefault(),a()},g=Object(N.a)("Skip for now");return d.some((e=>e.trim()))&&(p=h,g=n?Object(N.a)("Inviting…"):Object(N.a)("Continue")),r.a.createElement("div",{className:"mx_SpaceRoomView_inviteTeammates"},r.a.createElement("h1",null,Object(N.a)("Invite your teammates")),r.a.createElement("div",{className:"mx_SpaceRoomView_description"},Object(N.a)("Make sure the right people have access. You can invite more later.")),r.a.createElement("div",{className:"mx_SpaceRoomView_inviteTeammates_betaDisclaimer"},Object(N.a)("<b>This is an experimental feature.</b> For now, new users receiving an invite will have to open the invite on <link/> to actually join.",{},{b:e=>r.a.createElement("b",null,e),link:()=>r.a.createElement("a",{href:"https://app.element.io/",rel:"noreferrer noopener",target:"_blank"},"app.element.io")})),o&&r.a.createElement("div",{className:"mx_SpaceRoomView_errorText"},o),r.a.createElement("form",{onSubmit:p,id:"mx_SpaceSetupPrivateInvite"},u),r.a.createElement("div",{className:"mx_SpaceRoomView_inviteTeammates_buttons"},r.a.createElement(G.a,{className:"mx_SpaceRoomView_inviteTeammates_inviteDialogButton",onClick:()=>Object(ys.e)(t.roomId)},Object(N.a)("Invite by username"))),r.a.createElement("div",{className:"mx_SpaceRoomView_buttons"},r.a.createElement(G.a,{kind:"primary",disabled:n,onClick:p,element:"input",type:"submit",form:"mx_SpaceSetupPrivateInvite",value:g})))};class pd extends r.a.PureComponent{constructor(e,t){var a;super(e,t),i()(this,"context",void 0),i()(this,"creator",void 0),i()(this,"dispatcherRef",void 0),i()(this,"onMyMembership",((e,t)=>{e.roomId===this.props.space.roomId&&this.setState({myMembership:t})})),i()(this,"onRightPanelStoreUpdate",(()=>{this.setState({showRightPanel:Ia.a.instance.isOpenForRoom(this.props.space.roomId)})})),i()(this,"onAction",(e=>{if(e.action!==U.a.ViewRoom||e.room_id!==this.props.space.roomId){if(e.action===U.a.ViewUser||"view_3pid_invite"===e.action)if(e.action===U.a.ViewUser&&e.member){const t={phase:Ra.a.SpaceMemberInfo,state:{spaceId:this.props.space.roomId,member:e.member}};e.push?Ia.a.instance.pushCard(t):Ia.a.instance.setCards([{phase:Ra.a.SpaceMemberList,state:{spaceId:this.props.space.roomId}},t])}else"view_3pid_invite"===e.action&&e.event?Ia.a.instance.setCard({phase:Ra.a.Space3pidMemberInfo,state:{spaceId:this.props.space.roomId,memberInfoEvent:e.event}}):Ia.a.instance.setCard({phase:Ra.a.SpaceMemberList,state:{spaceId:this.props.space.roomId}})}else this.setState({phase:id.Landing})})),i()(this,"goToFirstRoom",(async()=>{this.state.firstRoomId?v.a.dispatch({action:U.a.ViewRoom,room_id:this.state.firstRoomId,metricsTrigger:void 0}):this.setState({phase:id.Landing})}));let n=id.Landing;this.creator=null===(a=this.props.space.currentState.getStateEvents(ee.b.RoomCreate,""))||void 0===a?void 0:a.getSender();this.props.justCreatedOpts&&t.getUserId()===this.creator&&(n=this.props.justCreatedOpts.createOpts.preset===_a.d.PublicChat?id.PublicCreateRooms:id.PrivateScope),this.state={phase:n,showRightPanel:Ia.a.instance.isOpenForRoom(this.props.space.roomId),myMembership:this.props.space.getMyMembership()},this.dispatcherRef=v.a.register(this.onAction),Ia.a.instance.on(pt.b,this.onRightPanelStoreUpdate)}componentDidMount(){this.context.on(te.d.MyMembership,this.onMyMembership)}componentWillUnmount(){v.a.unregister(this.dispatcherRef),Ia.a.instance.off(pt.b,this.onRightPanelStoreUpdate),this.context.off(te.d.MyMembership,this.onMyMembership)}renderBody(){var e,t;switch(this.state.phase){case id.Landing:return"join"===this.state.myMembership?r.a.createElement(od,{space:this.props.space}):r.a.createElement(il,{room:this.props.space,onJoinButtonClicked:this.props.onJoinButtonClicked,onRejectButtonClicked:this.props.onRejectButtonClicked});case id.PublicCreateRooms:return r.a.createElement(ld,{space:this.props.space,title:Object(N.a)("What are some things you want to discuss in %(spaceName)s?",{spaceName:(null===(e=this.props.justCreatedOpts)||void 0===e||null===(t=e.createOpts)||void 0===t?void 0:t.name)||this.props.space.name}),description:r.a.createElement(r.a.Fragment,null,Object(N.a)("Let's create a room for each of them."),r.a.createElement("br",null),Object(N.a)("You can add more later too, including already existing ones.")),onFinished:e=>this.setState({phase:id.PublicShare,firstRoomId:e})});case id.PublicShare:return r.a.createElement(dd,{justCreatedOpts:this.props.justCreatedOpts,space:this.props.space,onFinished:this.goToFirstRoom,firstRoomId:this.state.firstRoomId});case id.PrivateScope:return r.a.createElement(md,{space:this.props.space,justCreatedOpts:this.props.justCreatedOpts,onFinished:e=>{this.setState({phase:e?id.PrivateCreateRooms:id.PrivateExistingRooms})}});case id.PrivateInvite:return r.a.createElement(hd,{space:this.props.space,onFinished:()=>this.setState({phase:id.Landing})});case id.PrivateCreateRooms:return r.a.createElement(ld,{space:this.props.space,title:Object(N.a)("What projects are your team working on?"),description:r.a.createElement(r.a.Fragment,null,Object(N.a)("We'll create rooms for each of them."),r.a.createElement("br",null),Object(N.a)("You can add more later too, including already existing ones.")),onFinished:e=>this.setState({phase:id.PrivateInvite,firstRoomId:e})});case id.PrivateExistingRooms:return r.a.createElement(cd,{space:this.props.space,onFinished:()=>this.setState({phase:id.Landing})})}}render(){const e=this.state.showRightPanel&&this.state.phase===id.Landing?r.a.createElement(Ao,{room:this.props.space,resizeNotifier:this.props.resizeNotifier}):null;return r.a.createElement("main",{className:"mx_SpaceRoomView"},r.a.createElement(Vo.a,null,r.a.createElement(ja,{panel:e,resizeNotifier:this.props.resizeNotifier},this.renderBody())))}}i()(pd,"contextType",R.a);var gd=a(793);class vd extends r.a.PureComponent{render(){return r.a.createElement("div",{className:"mx_TopUnreadMessagesBar"},r.a.createElement(G.a,{className:"mx_TopUnreadMessagesBar_scrollUp",title:Object(N.a)("Jump to first unread message."),onClick:this.props.onScrollUpClick}),r.a.createElement(G.a,{className:"mx_TopUnreadMessagesBar_markAsRead",title:Object(N.a)("Mark all as read"),onClick:this.props.onCloseClick}))}}var bd=a(180),fd=a(297),yd=a(636),Ed=a(842),_d=a(794);const wd=e=>{let{text:t}=e;return r.a.createElement("div",{className:"mx_LargeLoader"},r.a.createElement(Kn.a,{w:45,h:45}),r.a.createElement("div",{className:"mx_LargeLoader_text"},t))};var Sd=a(501),Od=a(346);class Cd extends r.a.Component{constructor(e,t){super(e,t),i()(this,"context",void 0),i()(this,"callEventGroupers",new Map),this.buildLegacyCallEventGroupers(this.props.timeline)}buildLegacyCallEventGroupers(e){this.callEventGroupers=Object(br.c)(this.callEventGroupers,e)}render(){const e=this.props.timeline,t=e[this.props.ourEventsIndexes[0]],a=t.getId(),n=t.getTs(),i=[r.a.createElement(Sd.a,{key:n+"-search",roomId:t.getRoomId(),ts:n})],s=b.b.getValue("layout"),o=b.b.getValue("showTwelveHourTimestamps"),l=b.b.getValue("alwaysShowTimestamps");for(let t=0;t<e.length;t++){var c;const n=e[t];let u;const h=!this.props.ourEventsIndexes.includes(t);if(h||(u=this.props.searchHighlights),Object(gi.c)(n,null===(c=this.context)||void 0===c?void 0:c.showHiddenEvents)){var d;const c=e[t-1],p=c&&!Object(Xn.o)(c.getDate()||void 0,n.getDate()||void 0)&&Object(vr.b)(c,n,null===(d=this.context)||void 0===d?void 0:d.showHiddenEvents,Ga.a.Search);let g=!0;const v=e[t+1];if(v){var m;g=Object(Xn.o)(n.getDate()||void 0,v.getDate()||void 0)||n.getSender()!==v.getSender()||!Object(vr.b)(n,v,null===(m=this.context)||void 0===m?void 0:m.showHiddenEvents,Ga.a.Search)}i.push(r.a.createElement(Od.b,{key:`${a}+${t}`,mxEvent:n,layout:s,contextual:h,highlights:u,permalinkCreator:this.props.permalinkCreator,highlightLink:this.props.resultLink,onHeightChanged:this.props.onHeightChanged,isTwelveHour:o,alwaysShowTimestamps:l,lastInSection:g,continuation:p,callEventGrouper:this.callEventGroupers.get(n.getContent().call_id)}))}}return r.a.createElement("li",{"data-scroll-tokens":a},r.a.createElement("ol",null,i))}}i()(Cd,"contextType",Ga.b);var xd=a(423);const jd=10;async function kd(e,t,a){const n=lt.a.get(),i={limit:jd};void 0!==t&&(i.rooms=[t]);const s={search_categories:{room_events:{search_term:e,filter:i,order_by:xd.a.Recent,event_context:{before_limit:1,after_limit:1,include_profile:!0}}}};return{response:await n.search({body:s},a),query:s}}async function Rd(e,t,a){const n=lt.a.get(),i=await kd(e,t,a),s={abortSignal:a,_query:i.query,results:[],highlights:[]};return n.processRoomEventsSearch(s,i.response)}function Id(e,t){const a=e.result,n=t.result;return a.origin_server_ts>n.origin_server_ts?-1:a.origin_server_ts<n.origin_server_ts?1:0}async function Td(e,t){const a=lr.a.get(),n={search_term:e,before_limit:1,after_limit:1,limit:jd,order_by_recency:!0,room_id:void 0};void 0!==t&&(n.room_id=t);const i=await a.search(n);n.next_batch=i.next_batch;return{response:i,query:n}}function Nd(e,t){try{const a=e[e.length-1].result,n=t[t.length-1].result;return a.origin_server_ts<=n.origin_server_ts?-1:1}catch{return 0}}function Pd(e,t,a,n){const i=a.concat(n).sort(Id);t.results=i.slice(0,jd),e.cachedEvents=i.slice(jd)}function Dd(e,t,a){const n=function(e,t,a){const n={},i=e.cachedEvents;let s=e.oldestEventFrom;return n.highlights=e.highlights,t&&a&&a.results?(Nd(t.results,a.results)<0&&(s="local"),Pd(e,n,t.results,a.results),n.highlights=t.highlights.concat(a.highlights)):t?(Nd(t.results,i)<0&&(s="local"),Pd(e,n,t.results,i)):a&&a.results?(Nd(a.results,i)<0&&(s="server"),Pd(e,n,a.results,i)):(n.results=i,e.cachedEvents=[]),e.oldestEventFrom=s,n}(e,t,a);return e.count?n.count=e.count:n.count=t.count+a.count,t&&(e.seshatQuery.next_batch=t.next_batch),a&&(e.serverSideNextBatch=a.next_batch),e.seshatQuery.next_batch?n.next_batch=e.seshatQuery.next_batch:e.serverSideNextBatch&&(n.next_batch=e.serverSideNextBatch),!n.next_batch&&e.cachedEvents.length>0&&(n.next_batch="cached"),n}function Md(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];for(const t of e){const e=t.context.getTimeline();for(const t of e){const e=t.event;e.curve25519Key&&(t.makeEncrypted(ee.b.RoomMessageEncrypted,{algorithm:e.algorithm},e.curve25519Key,e.ed25519Key),t.forwardingCurve25519KeyChain=e.forwardingCurve25519KeyChain,delete e.curve25519Key,delete e.ed25519Key,delete e.algorithm,delete e.forwardingCurve25519KeyChain)}}}function Ad(e,t,a){let n;return n=void 0!==t?lt.a.get().isRoomEncrypted(t)?async function(e,t){const a={results:[],highlights:[]};if(""===e)return a;const n=await Td(e,t);a.seshatQuery=n.query;const i={search_categories:{room_events:n.response}},s=lt.a.get().processRoomEventsSearch(a,i);return Md(s.results),s}(e,t):Rd(e,t,a):async function(e,t){const a=lt.a.get(),n=kd(e,void 0,t),i=Td(e);await Promise.all([n,i]);const s=await i,r=await n,o=r.query,l=r.response,c=s.query,d=s.response,m={seshatQuery:c,_query:o,serverSideNextBatch:l.search_categories.room_events.next_batch,cachedEvents:[],oldestEventFrom:"server",results:[],highlights:[]},u={search_categories:{room_events:Dd(m,d,l.search_categories.room_events)}},h=a.processRoomEventsSearch(m,u);return Md(h.results),h}(e,a),n}function Ld(e){const t=lt.a.get(),a=e.seshatQuery,n=e._query;if(a){if(n){const t=async function(e){const t=lr.a.get(),a=lt.a.get(),n=e.seshatQuery,i=e.oldestEventFrom;let s,r,o;if(!n.next_batch||e.serverSideNextBatch&&"server"!==i||(s=await t.search(n)),e.serverSideNextBatch&&("local"===i||!n.next_batch)){const t={body:e._query,next_batch:e.serverSideNextBatch};r=await a.search(t)}r&&(o=r.search_categories.room_events);const l={search_categories:{room_events:Dd(e,s,o)}},c=e.results?e.results.length:0,d=a.processRoomEventsSearch(e,l),m=d.results.length-c;return Md(d.results.slice(Math.max(d.results.length-m,0))),e.pendingRequest=null,d}(e);return e.pendingRequest=t,t}{const t=async function(e){const t=lr.a.get(),a=e.seshatQuery,n=await t.search(a);e.seshatQuery.next_batch=n.next_batch;const i=n.results.length,s={search_categories:{room_events:n}},r=lt.a.get().processRoomEventsSearch(e,s);return Md(r.results.slice(Math.max(r.results.length-i,0))),e.pendingRequest=void 0,r}(e);return e.pendingRequest=t,t}}return t.backPaginateRoomEventsSearch(e)}function Ud(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}let Fd=function(e){};const Bd=Object(s.forwardRef)(((e,t)=>{let{term:a,scope:n,promise:o,abortController:l,resizeNotifier:c,permalinkCreator:d,className:m,onUpdate:u}=e;const h=Object(s.useContext)(R.a),p=Object(s.useContext)(Ga.b),[g,v]=Object(s.useState)(!0),[b,f]=Object(s.useState)(null),[y,E]=Object(s.useState)(null),_=Object(s.useRef)(!1),w=Object(s.useCallback)((e=>(v(!0),e.then((async e=>{if(Fd("search complete"),_.current)return ga.a.error("Discarding stale search results"),!1;let t=e.highlights;t.includes(a)||(t=t.concat(a)),t=t.sort((function(e,t){return t.length-e.length}));for(const t of e.results)for(const e of t.context.getTimeline()){if(!e.getServerAggregatedRelation(Ea.d.name)||e.getThread())continue;const t=h.getRoom(e.getRoomId()),a=null==t?void 0:t.findThreadForEvent(e);a?e.setThread(a):null==t||t.createThread(e.getId(),e,[],!0)}f(t),E(function(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?Ud(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):Ud(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}({},e))}),(e=>{var t;return _.current?(ga.a.error("Discarding stale search results"),!1):(ga.a.error("Search failed",e),H.b.createDialog(Ja.a,{title:Object(N.a)("Search failed"),description:null!==(t=null==e?void 0:e.message)&&void 0!==t?t:Object(N.a)("Server may be unavailable, overloaded, or search timed out :(")}),!1)})).finally((()=>{v(!1)})))),[h,a]);if(Object(s.useEffect)((()=>(_.current=!1,w(o),()=>{_.current=!0,null==l||l.abort()})),[]),void 0===(null==y?void 0:y.count))return r.a.createElement("div",{className:"mx_RoomView_messagePanel mx_RoomView_messagePanelSearchSpinner","data-testid":"messagePanelSearchSpinner"});const S=[];var O;(g&&S.push(r.a.createElement("li",{key:"search-spinner"},r.a.createElement(Kn.a,null))),y.next_batch)||(null!=y&&null!==(O=y.results)&&void 0!==O&&O.length?S.push(r.a.createElement("li",{key:"search-top-marker"},r.a.createElement("h2",{className:"mx_RoomView_topMarker"},Object(N.a)("No more results")))):S.push(r.a.createElement("li",{key:"search-top-marker"},r.a.createElement("h2",{className:"mx_RoomView_topMarker"},Object(N.a)("No results")))));const C=()=>{const e=t.current;null==e||e.checkScroll()};let x,j=[],k=[];for(let e=((null==y||null===(I=y.results)||void 0===I?void 0:I.length)||0)-1;e>=0;e--){var I;const t=y.results[e],a=t.context.getEvent(),i=a.getRoomId(),s=h.getRoom(i);if(!s){ga.a.log("Hiding search result from an unknown room",i);continue}if(!Object(gi.c)(a,p.showHiddenEvents))continue;n===sl.All&&i!==x&&(S.push(r.a.createElement("li",{key:a.getId()+"-room"},r.a.createElement("h2",null,Object(N.a)("Room"),": ",s.name))),x=i);const o="#/room/"+i+"/"+a.getId(),l=t.context.getTimeline(),c=e>0?y.results[e-1].context.getTimeline():[];if(e>0&&l[l.length-1].getId()==c[0].getId()){if(0==j.length){for(let e=0==j.length?0:1;e<t.context.getTimeline().length;e++)j.push(l[e]);k.push(t.context.getOurEventIndex())}for(let e=1;e<c.length;e++)j.push(c[e]);k.push(k[k.length-1]+y.results[e-1].context.getOurEventIndex()+1)}else 0==j.length&&(j=t.context.getTimeline(),k=[],k.push(t.context.getOurEventIndex())),S.push(r.a.createElement(Cd,{key:a.getId(),timeline:j,ourEventsIndexes:k,searchHighlights:null!=b?b:[],resultLink:o,permalinkCreator:d,onHeightChanged:C})),k=[],j=[]}return r.a.createElement(Bo.a,{ref:t,className:"mx_RoomView_searchResultsPanel "+m,onFillRequest:async e=>{if(!e)return!1;if(!y.next_batch)return Fd("no more search results"),!1;Fd("requesting more search results");const t=function(e){const t=lr.a.get(),a=lt.a.get();return e.pendingRequest?e.pendingRequest:null===t?a.backPaginateRoomEventsSearch(e):Ld(e)}(y);return w(t)},resizeNotifier:c},r.a.createElement("li",{className:"mx_RoomView_scrollheader"}),S)}));var Vd=a(387),Wd=a(896),Hd=a(281);const zd=e=>{let{roomView:t,resizeNotifier:a,inviteEvent:n}=e;const i=Object(Ga.c)();return r.a.createElement("div",{className:"mx_RoomView mx_RoomView--local"},r.a.createElement(Vo.a,null,r.a.createElement(Pc,{room:i.room,inRoom:!0,onSearchClick:null,onInviteClick:null,onForgetClick:null,e2eStatus:za.Normal,onAppsClick:null,appsShown:!1,excludedRightPanelPhaseButtons:[],showButtons:!1,enableRoomOptionsMenu:!1,viewingCall:!1,activeCall:null}),r.a.createElement("main",{className:"mx_RoomView_body",ref:t},r.a.createElement("div",{className:"mx_RoomView_timeline"},r.a.createElement(Bo.a,{className:"mx_RoomView_messagePanel",resizeNotifier:a},r.a.createElement(Hd.a,{className:"mx_cryptoEvent mx_cryptoEvent_icon",title:Object(N.a)("Waiting for users to join Element"),subtitle:Object(N.a)("Once invited users have joined Element, you will be able to chat and the room will be end-to-end encrypted")}),r.a.createElement(yd.a,null),r.a.createElement(Od.a,{mxEvent:n}))))))},Gd=["upgradeRecommendation"],Kd=["upgradeRecommendation"];function qd(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function $d(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?qd(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):qd(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}let Yd=function(e){};const Jd="sandbox"in document.createElement("iframe");var Qd;function Xd(e){const t=Object(s.useContext)(Ga.b),a=t.room,n=e.localRoom.currentState.getStateEvents(ee.b.RoomEncryption)[0];let i;n&&(i=r.a.createElement(Ed.a,{mxEvent:n}));const o=()=>{a.state=fd.c.NEW,v.b.dispatch({action:"local_room_event",roomId:a.roomId})};let l=null,c=null;if(a.isError){const e=r.a.createElement(G.a,{onClick:o,className:"mx_RoomStatusBar_unsentRetry"},Object(N.a)("Retry"));l=r.a.createElement(_d.a,{title:Object(N.a)("Some of your messages have not been sent"),notificationState:Oe.a.RED_EXCLAMATION,buttons:e})}else c=r.a.createElement(ro,{room:e.localRoom,resizeNotifier:e.resizeNotifier,permalinkCreator:e.permalinkCreator});return r.a.createElement("div",{className:"mx_RoomView mx_RoomView--local"},r.a.createElement(Vo.a,null,r.a.createElement(Pc,{room:t.room,searchInfo:void 0,inRoom:!0,onSearchClick:null,onInviteClick:null,onForgetClick:null,e2eStatus:za.Normal,onAppsClick:null,appsShown:!1,excludedRightPanelPhaseButtons:[],showButtons:!1,enableRoomOptionsMenu:!1,viewingCall:!1,activeCall:null}),r.a.createElement("main",{className:"mx_RoomView_body",ref:e.roomView},r.a.createElement(go,{parent:e.roomView.current,onFileDrop:e.onFileDrop}),r.a.createElement("div",{className:"mx_RoomView_timeline"},r.a.createElement(Bo.a,{className:"mx_RoomView_messagePanel",resizeNotifier:e.resizeNotifier},i,r.a.createElement(yd.a,null))),l,c)))}function Zd(e){const t=Object(s.useContext)(Ga.b),a=Object(N.a)("We're creating a room with %(names)s",{names:e.names});return r.a.createElement("div",{className:"mx_RoomView mx_RoomView--local"},r.a.createElement(Vo.a,null,r.a.createElement(Pc,{room:t.room,searchInfo:void 0,inRoom:!0,onSearchClick:null,onInviteClick:null,onForgetClick:null,e2eStatus:za.Normal,onAppsClick:null,appsShown:!1,excludedRightPanelPhaseButtons:[],showButtons:!1,enableRoomOptionsMenu:!1,viewingCall:!1,activeCall:null}),r.a.createElement("div",{className:"mx_RoomView_body"},r.a.createElement(wd,{text:a}))))}(function(e){e[e.Timeline=0]="Timeline",e[e.MaximisedWidget=1]="MaximisedWidget",e[e.Call=2]="Call"})(Qd||(Qd={}));class em extends r.a.Component{constructor(e,t){var a,n;if(super(e,t),a=this,i()(this,"dispatcherRef",void 0),i()(this,"settingWatchers",void 0),i()(this,"unmounted",!1),i()(this,"permalinkCreators",{}),i()(this,"roomView",Object(s.createRef)()),i()(this,"searchResultsPanel",Object(s.createRef)()),i()(this,"messagePanel",void 0),i()(this,"roomViewBody",Object(s.createRef)()),i()(this,"context",void 0),i()(this,"onIsResizing",(e=>{this.setState({resizing:e})})),i()(this,"onWidgetStoreUpdate",(()=>{this.state.room&&(this.checkWidgets(this.state.room),this.doMaybeRemoveOwnJitsiWidget())})),i()(this,"onWidgetEchoStoreUpdate",(()=>{this.state.room&&this.checkWidgets(this.state.room)})),i()(this,"onWidgetLayoutChange",(()=>{this.state.room&&(v.a.dispatch({action:"appsDrawer",show:!0}),this.context.widgetLayoutStore.hasMaximisedWidget(this.state.room)&&this.context.rightPanelStore.setCard({phase:Ra.a.Timeline}),this.checkWidgets(this.state.room))})),i()(this,"checkWidgets",(e=>{this.setState({hasPinnedWidgets:this.context.widgetLayoutStore.hasPinnedWidgets(e),mainSplitContentType:this.getMainSplitContentType(e),showApps:this.shouldShowApps(e)})})),i()(this,"getMainSplitContentType",(e=>b.b.getValue("feature_group_calls")&&this.context.roomViewStore.isViewingCall()||_c(e)?Qd.Call:this.context.widgetLayoutStore.hasMaximisedWidget(e)?Qd.MaximisedWidget:Qd.Timeline)),i()(this,"onRoomViewStoreUpdate",(async e=>{if(this.unmounted)return;if(!e&&this.state.roomId!==this.context.roomViewStore.getRoomId())return;const t=this.context.roomViewStore.getRoomId(),n=this.context.client.getRoom(t),i={roomId:t,roomAlias:this.context.roomViewStore.getRoomAlias(),roomLoading:this.context.roomViewStore.isRoomLoading(),roomLoadError:this.context.roomViewStore.getRoomLoadError(),joining:this.context.roomViewStore.isJoining(),replyToEvent:this.context.roomViewStore.getQuotingEvent(),shouldPeek:this.state.matrixClientIsReady&&this.context.roomViewStore.shouldPeek(),showReadReceipts:b.b.getValue("showReadReceipts",t),showRedactions:b.b.getValue("showRedactions",t),showJoinLeaves:b.b.getValue("showJoinLeaves",t),showAvatarChanges:b.b.getValue("showAvatarChanges",t),showDisplaynameChanges:b.b.getValue("showDisplaynameChanges",t),wasContextSwitch:this.context.roomViewStore.getWasContextSwitch(),mainSplitContentType:null===n?void 0:this.getMainSplitContentType(n),initialEventId:null,showRightPanel:this.context.rightPanelStore.isOpenForRoom(t),activeCall:Mc.a.instance.getActiveCall(t)};var s;this.state.mainSplitContentType!==Qd.Timeline&&i.mainSplitContentType===Qd.Timeline&&this.context.rightPanelStore.isOpen&&this.context.rightPanelStore.currentCard.phase===Ra.a.Timeline&&this.context.rightPanelStore.roomPhaseHistory.some((e=>e.phase===Ra.a.Timeline))&&(this.context.rightPanelStore.setCard({phase:Ra.a.RoomSummary}),this.context.rightPanelStore.togglePanel(null!==(s=this.state.roomId)&&void 0!==s?s:null),i.showRightPanel=!1);const r=this.context.roomViewStore.getInitialEventId();if(r){var o,l;let e=null==n?void 0:n.findEventById(r);e||(e=await Object(bd.f)(this.context.client,t,r)),i.initialEventPixelOffset=null;const a=null===(o=e)||void 0===o?void 0:o.getThread();var c;if(!a||null!==(l=e)&&void 0!==l&&l.isThreadRoot)i.initialEventId=r,i.isInitialEventHighlighted=this.context.roomViewStore.isInitialEventHighlighted(),i.initialEventScrollIntoView=this.context.roomViewStore.initialEventScrollIntoView(),a&&null!==(c=e)&&void 0!==c&&c.isThreadRoot&&v.a.dispatch({action:U.a.ShowThread,rootEvent:a.rootEvent,initialEvent:e,highlighted:this.context.roomViewStore.isInitialEventHighlighted(),scroll_into_view:this.context.roomViewStore.initialEventScrollIntoView()});else v.a.dispatch({action:U.a.ShowThread,rootEvent:a.rootEvent,initialEvent:e,highlighted:this.context.roomViewStore.isInitialEventHighlighted(),scroll_into_view:this.context.roomViewStore.initialEventScrollIntoView()})}if(this.settingWatchers=this.settingWatchers.concat([b.b.watchSetting("showReadReceipts",t,(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let[,,,i]=t;return a.setState({showReadReceipts:i})})),b.b.watchSetting("showRedactions",t,(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let[,,,i]=t;return a.setState({showRedactions:i})})),b.b.watchSetting("showJoinLeaves",t,(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let[,,,i]=t;return a.setState({showJoinLeaves:i})})),b.b.watchSetting("showAvatarChanges",t,(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let[,,,i]=t;return a.setState({showAvatarChanges:i})})),b.b.watchSetting("showDisplaynameChanges",t,(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let[,,,i]=t;return a.setState({showDisplaynameChanges:i})}))]),e||!this.state.shouldPeek||i.shouldPeek||this.context.client.stopPeeking(),ga.a.log("RVS update:",i.roomId,i.roomAlias,"loading?",i.roomLoading,"joining?",i.joining,"initial?",e,"shouldPeek?",i.shouldPeek),e&&(i.room=this.context.client.getRoom(i.roomId)||void 0,i.room&&(i.showApps=this.shouldShowApps(i.room),this.onRoomLoaded(i.room))),null===this.state.roomId&&null!==i.roomId&&!i.initialEventId){const e=Uo.getScrollState(i.roomId);e&&(i.initialEventId=e.focussedEvent,i.initialEventPixelOffset=e.pixelOffset)}var d,m;this.state.timelineRenderingType===Ga.a.Search&&this.state.initialEventId!==i.initialEventId&&(i.timelineRenderingType=Ga.a.Room,null===(d=this.state.search)||void 0===d||null===(m=d.abortController)||void 0===m||m.abort(),i.search=void 0);this.setState(i),e&&this.setupRoom(i.room,i.roomId,i.joining,i.shouldPeek)})),i()(this,"onActiveCalls",(()=>{if(void 0===this.state.roomId)return;const e=Mc.a.instance.getActiveCall(this.state.roomId);null===e&&v.a.dispatch({action:U.a.ViewRoom,room_id:this.state.roomId,view_call:!1,metricsTrigger:void 0},!0),this.setState({activeCall:e})})),i()(this,"getRoomId",(()=>this.state.room?this.state.room.roomId:this.state.roomId)),i()(this,"onRightPanelStoreUpdate",(()=>{this.setState({showRightPanel:this.context.rightPanelStore.isOpenForRoom(this.state.roomId)})})),i()(this,"onPageUnload",(e=>Oa.a.sharedInstance().getCurrentUploads().length>0?e.returnValue=Object(N.a)("You seem to be uploading files, are you sure you want to quit?"):this.getCallForRoom()&&"ended"!==this.state.callState?e.returnValue=Object(N.a)("You seem to be in a call, are you sure you want to quit?"):void 0)),i()(this,"onReactKeyDown",(e=>{let t=!1;switch(Object(J.a)().getRoomAction(e)){case W.h.DismissReadMarker:this.messagePanel.forgetReadMarker(),this.jumpToLiveTimeline(),t=!0;break;case W.h.JumpToOldestUnread:this.jumpToReadMarker(),t=!0;break;case W.h.UploadFile:v.a.dispatch({action:"upload_file",context:Ga.a.Room},!0),t=!0}t&&(e.stopPropagation(),e.preventDefault())})),i()(this,"onCallState",(e=>{if(!e)return;const t=this.getCallForRoom();this.setState({callState:t?t.state:null})})),i()(this,"onAction",(async e=>{var t;switch(e.action){case"message_sent":this.checkDesktopNotifications();break;case"post_sticker_message":this.injectSticker(e.data.content.url,e.data.content.info,e.data.description||e.data.name,e.data.threadId);break;case"picture_snapshot":Oa.a.sharedInstance().sendContentListToRoom([e.file],this.state.room.roomId,null,this.context.client);break;case"notifier_enabled":case U.a.UploadStarted:case U.a.UploadFinished:case U.a.UploadCanceled:this.forceUpdate();break;case"appsDrawer":this.setState({showApps:e.show});break;case"reply_to_event":!this.unmounted&&this.state.search&&(null===(t=e.event)||void 0===t?void 0:t.getRoomId())===this.state.roomId&&e.context===Ga.a.Search&&this.onCancelSearchClick();break;case"MatrixActions.sync":var a;if(!this.state.matrixClientIsReady)this.setState({matrixClientIsReady:null===(a=this.context.client)||void 0===a?void 0:a.isInitialSyncComplete()},(()=>{this.onRoomViewStoreUpdate(!0)}));break;case"focus_search":this.onSearchClick();break;case"local_room_event":this.onLocalRoomEvent(e.roomId);break;case U.a.EditEvent:{if(e.timelineRenderingType!==this.state.timelineRenderingType)return;const t=e.event?new oo(e.event):null;this.setState({editState:t},(()=>{var t;e.event&&(null===(t=this.messagePanel)||void 0===t||t.scrollToEventIfNeeded(e.event.getId()))}));break}case U.a.ComposerInsert:{if(e.composerType)break;let t=e.timelineRenderingType;if(t===Ga.a.Thread)break;this.state.timelineRenderingType===Ga.a.Search&&e.timelineRenderingType===Ga.a.Search&&(await this.onCancelSearchClick(),t=Ga.a.Room),v.a.dispatch($d($d({},e),{},{timelineRenderingType:t,composerType:this.state.editState?vo.a.Edit:vo.a.Send}));break}case U.a.FocusAComposer:v.a.dispatch($d($d({},e),{},{action:this.state.editState?U.a.FocusEditMessageComposer:U.a.FocusSendMessageComposer}));break;case"scroll_to_bottom":var n;if(e.timelineRenderingType===Ga.a.Room)null===(n=this.messagePanel)||void 0===n||n.jumpToLiveTimeline()}})),i()(this,"onRoomTimeline",((e,t,a,n,i)=>{var s;this.unmounted||t&&t.roomId===(null===(s=this.state.room)||void 0===s?void 0:s.roomId)&&i.timeline.getTimelineSet()===t.getUnfilteredTimelineSet()&&("org.matrix.room.preview_urls"===e.getType()&&this.updatePreviewUrlVisibility(t),"m.room.encryption"===e.getType()&&(this.updateE2EStatus(t),this.updatePreviewUrlVisibility(t)),!a&&null!=i&&i.liveEvent&&(this.state.joining||(e.isBeingDecrypted()||e.isDecryptionFailure()||this.handleEffects(e),e.getSender()!==this.context.client.credentials.userId&&(!this.state.search&&this.state.atEndOfLiveTimeline||Object(wa.a)(e,this.state)||this.setState((e=>({numUnreadMessages:e.numUnreadMessages+1})))))))})),i()(this,"onEventDecrypted",(e=>{this.state.room&&this.state.matrixClientIsReady&&e.getRoomId()===this.state.room.roomId&&(this.updateVisibleDecryptionFailures(),e.isDecryptionFailure()||this.handleEffects(e))})),i()(this,"handleEffects",(e=>{this.context.roomNotificationStateStore.getRoomState(this.state.room).isUnread&&yn.CHAT_EFFECTS.forEach((t=>{(Object(En.containsEmoji)(e.getContent(),t.emojis)||e.getContent().msgtype===t.msgType)&&(e.isRelation(Ea.d.name)||v.a.dispatch({action:`effects.${t.command}`}))}))})),i()(this,"onRoomName",(e=>{this.state.room&&e.roomId==this.state.room.roomId&&this.forceUpdate()})),i()(this,"onKeyBackupStatus",(()=>{this.forceUpdate()})),i()(this,"canResetTimeline",(()=>!this.messagePanel||this.messagePanel.canResetTimeline())),i()(this,"loadVirtualRoom",(async e=>{const t=(null==e?void 0:e.roomId)&&await Vd.a.sharedInstance().getVirtualRoomForRoom(null==e?void 0:e.roomId);this.setState({virtualRoom:t||void 0})})),i()(this,"onRoomLoaded",(e=>{this.unmounted||(this.context.widgetLayoutStore.on(Xa.d.emissionForRoom(e),this.onWidgetLayoutChange),this.calculatePeekRules(e),this.updatePreviewUrlVisibility(e),this.loadMembersIfJoined(e),this.calculateRecommendedVersion(e),this.updateE2EStatus(e),this.updatePermissions(e),this.checkWidgets(e),this.loadVirtualRoom(e),this.getMainSplitContentType(e)!==Qd.Timeline&&this.context.roomNotificationStateStore.getRoomState(e).isUnread&&this.context.rightPanelStore.setCard({phase:Ra.a.Timeline},!0,e.roomId),this.setState({tombstone:this.getRoomTombstone(e),liveTimeline:e.getLiveTimeline()}))})),i()(this,"onRoomTimelineReset",(e=>{var t;e&&e.roomId===(null===(t=this.state.room)||void 0===t?void 0:t.roomId)&&e.getLiveTimeline()!==this.state.liveTimeline&&(ga.a.log(`Live timeline of ${e.roomId} was reset`),this.setState({liveTimeline:e.getLiveTimeline()}))})),i()(this,"onRoom",(e=>{e&&e.roomId===this.state.roomId&&(this.state.room&&this.context.widgetLayoutStore.off(Xa.d.emissionForRoom(this.state.room),this.onWidgetLayoutChange),this.setState({room:e},(()=>{this.onRoomLoaded(e)})))})),i()(this,"onDeviceVerificationChanged",(e=>{const t=this.state.room;null!=t&&t.currentState.getMember(e)&&this.updateE2EStatus(t)})),i()(this,"onUserVerificationChanged",(e=>{const t=this.state.room;t&&t.currentState.getMember(e)&&this.updateE2EStatus(t)})),i()(this,"onCrossSigningKeysChanged",(()=>{const e=this.state.room;e&&this.updateE2EStatus(e)})),i()(this,"onUrlPreviewsEnabledChange",(()=>{this.state.room&&this.updatePreviewUrlVisibility(this.state.room)})),i()(this,"onRoomStateEvents",((e,t)=>{if(this.state.room&&this.state.room.roomId===t.roomId)if(e.getType()===ee.b.RoomTombstone)this.setState({tombstone:this.getRoomTombstone()});else this.updatePermissions(this.state.room)})),i()(this,"onRoomStateUpdate",(e=>{var t;e.roomId===(null===(t=this.state.room)||void 0===t?void 0:t.roomId)&&this.updateRoomMembers()})),i()(this,"onMyMembership",((e,t,a)=>{e.roomId===this.state.roomId&&(this.forceUpdate(),this.loadMembersIfJoined(e),this.updatePermissions(e))})),i()(this,"updateRoomMembers",Object(j.throttle)((()=>{this.updateDMState(),this.updateE2EStatus(this.state.room)}),500,{leading:!0,trailing:!0})),i()(this,"onInviteClick",(()=>{v.a.dispatch({action:"view_invite",roomId:this.state.room.roomId})})),i()(this,"onJoinButtonClicked",(()=>{var e;null!==(e=this.context.client)&&void 0!==e&&e.isGuest()?(v.a.dispatch({action:U.a.DoAfterSyncPrepared,deferred_action:{action:U.a.ViewRoom,room_id:this.getRoomId(),metricsTrigger:void 0}}),v.a.dispatch({action:"require_registration"})):Promise.resolve().then((()=>{var e,t;const a=null===(e=this.props.threepidInvite)||void 0===e?void 0:e.signUrl;return v.a.dispatch({action:U.a.JoinRoom,roomId:this.getRoomId(),opts:{inviteSignUrl:a},metricsTrigger:"invite"===(null===(t=this.state.room)||void 0===t?void 0:t.getMyMembership())?"Invite":"RoomPreview"}),Promise.resolve()}))})),i()(this,"updateVisibleDecryptionFailures",Object(j.throttle)((()=>this.setState((e=>{var t,a,n,i;return{visibleDecryptionFailures:null!==(t=null===(a=this.messagePanel)||void 0===a?void 0:a.getVisibleDecryptionFailures((null!==(n=null===(i=e.visibleDecryptionFailures)||void 0===i?void 0:i.length)&&void 0!==n?n:0)>0))&&void 0!==t?t:[]}}))),500,{leading:!1,trailing:!0})),i()(this,"onMessageListScroll",(()=>{this.messagePanel.isAtEndOfLiveTimeline()?this.setState({numUnreadMessages:0,atEndOfLiveTimeline:!0}):this.setState({atEndOfLiveTimeline:!1}),this.updateTopUnreadMessagesBar(),this.updateVisibleDecryptionFailures()})),i()(this,"resetJumpToEvent",(e=>{this.state.initialEventId&&this.state.initialEventScrollIntoView&&this.state.initialEventId===e&&(Yd("Removing scroll_into_view flag from initial event"),v.a.dispatch({action:U.a.ViewRoom,room_id:this.state.room.roomId,event_id:this.state.initialEventId,highlighted:this.state.isInitialEventHighlighted,scroll_into_view:!1,replyingToEvent:this.state.replyToEvent,metricsTrigger:void 0}))})),i()(this,"onSearch",((e,t)=>{const a=t===sl.Room?this.state.room.roomId:void 0;Yd("sending search request");const n=new AbortController,i=function(e,t,a){return null===lr.a.get()?Rd(e,t,a):Ad(e,t,a)}(e,a,n.signal);this.setState({search:{searchId:(new Date).getTime(),roomId:a,term:e,scope:t,promise:i,abortController:n}})})),i()(this,"onSearchUpdate",((e,t)=>{this.setState({search:$d($d({},this.state.search),{},{count:null==t?void 0:t.count,inProgress:e})})})),i()(this,"onAppsClick",(()=>{v.a.dispatch({action:"appsDrawer",show:!this.state.showApps})})),i()(this,"onForgetClick",(()=>{v.a.dispatch({action:"forget_room",room_id:this.state.room.roomId})})),i()(this,"onRejectButtonClicked",(()=>{this.setState({rejecting:!0}),this.context.client.leave(this.state.roomId).then((()=>{v.a.dispatch({action:U.a.ViewHomePage}),this.setState({rejecting:!1})}),(e=>{ga.a.error("Failed to reject invite: %s",e);const t=e.message?e.message:JSON.stringify(e);H.b.createDialog(Ja.a,{title:Object(N.a)("Failed to reject invite"),description:t}),this.setState({rejecting:!1,rejectError:e})}))})),i()(this,"onRejectAndIgnoreClick",(async()=>{this.setState({rejecting:!0});try{const e=this.state.room.getMember(this.context.client.getUserId()).events.member,t=this.context.client.getIgnoredUsers();t.push(e.getSender()),await this.context.client.setIgnoredUsers(t),await this.context.client.leave(this.state.roomId),v.a.dispatch({action:U.a.ViewHomePage}),this.setState({rejecting:!1})}catch(e){ga.a.error("Failed to reject invite: %s",e);const t=e.message?e.message:JSON.stringify(e);H.b.createDialog(Ja.a,{title:Object(N.a)("Failed to reject invite"),description:t}),this.setState({rejecting:!1,rejectError:e})}})),i()(this,"onRejectThreepidInviteButtonClicked",(()=>{v.a.fire(U.a.ViewRoomDirectory)})),i()(this,"onSearchClick",(()=>{this.setState({timelineRenderingType:this.state.timelineRenderingType===Ga.a.Search?Ga.a.Room:Ga.a.Search})})),i()(this,"onCancelSearchClick",(()=>new Promise((e=>{this.setState({timelineRenderingType:Ga.a.Room,search:null},e)})))),i()(this,"jumpToLiveTimeline",(()=>{this.state.initialEventId&&this.state.isInitialEventHighlighted?v.a.dispatch({action:U.a.ViewRoom,room_id:this.state.room.roomId,metricsTrigger:void 0}):(this.messagePanel.jumpToLiveTimeline(),v.a.fire(U.a.FocusSendMessageComposer))})),i()(this,"jumpToReadMarker",(()=>{this.messagePanel.jumpToReadMarker()})),i()(this,"forgetReadMarker",(e=>{e.stopPropagation(),this.messagePanel.forgetReadMarker()})),i()(this,"updateTopUnreadMessagesBar",(()=>{if(!this.messagePanel)return;const e=this.messagePanel.canJumpToReadMarker();this.state.showTopUnreadMessagesBar!=e&&this.setState({showTopUnreadMessagesBar:e})})),i()(this,"onStatusBarVisible",(()=>{this.unmounted||this.state.statusBarVisible||this.setState({statusBarVisible:!0})})),i()(this,"onStatusBarHidden",(()=>{!this.unmounted&&this.state.statusBarVisible&&this.setState({statusBarVisible:!1})})),i()(this,"handleScrollKey",(e=>{var t;let a;this.searchResultsPanel.current?a=this.searchResultsPanel.current:this.messagePanel&&(a=this.messagePanel),null===(t=a)||void 0===t||t.handleScrollKey(e)})),i()(this,"gatherTimelinePanelRef",(e=>{this.messagePanel=e})),i()(this,"onHiddenHighlightsClick",(()=>{const e=this.getOldRoom();e&&v.a.dispatch({action:U.a.ViewRoom,room_id:e.roomId,metricsTrigger:"Predecessor"})})),i()(this,"onFileDrop",(e=>{var t,a;return Oa.a.sharedInstance().sendContentListToRoom(Array.from(e.files),null!==(t=null===(a=this.state.room)||void 0===a?void 0:a.roomId)&&void 0!==t?t:this.state.roomId,null,this.context.client,Ga.a.Room)})),i()(this,"onMeasurement",(e=>{this.setState({narrow:e})})),!t.client)throw new Error("Unable to create RoomView without MatrixClient");const r=t.client.hasLazyLoadMembersEnabled();this.state={roomId:void 0,roomLoading:!0,peekLoading:!1,shouldPeek:!0,membersLoaded:!r,numUnreadMessages:0,callState:void 0,activeCall:null,canPeek:!1,canSelfRedact:!1,showApps:!1,isPeeking:!1,showRightPanel:!1,joining:!1,showTopUnreadMessagesBar:!1,statusBarVisible:!1,canReact:!1,canSendMessages:!1,resizing:!1,layout:b.b.getValue("layout"),lowBandwidth:b.b.getValue("lowBandwidth"),alwaysShowTimestamps:b.b.getValue("alwaysShowTimestamps"),showTwelveHourTimestamps:b.b.getValue("showTwelveHourTimestamps"),readMarkerInViewThresholdMs:b.b.getValue("readMarkerInViewThresholdMs"),readMarkerOutOfViewThresholdMs:b.b.getValue("readMarkerOutOfViewThresholdMs"),showHiddenEvents:b.b.getValue("showHiddenEventsInTimeline"),showReadReceipts:!0,showRedactions:!0,showJoinLeaves:!0,showAvatarChanges:!0,showDisplaynameChanges:!0,matrixClientIsReady:null===(n=t.client)||void 0===n?void 0:n.isInitialSyncComplete(),mainSplitContentType:Qd.Timeline,timelineRenderingType:Ga.a.Room,liveTimeline:void 0,narrow:!1,visibleDecryptionFailures:[],msc3946ProcessDynamicPredecessor:b.b.getValue("feature_dynamic_room_predecessors")},this.dispatcherRef=v.a.register(this.onAction),t.client.on(o.b.Room,this.onRoom),t.client.on(te.d.Timeline,this.onRoomTimeline),t.client.on(te.d.TimelineReset,this.onRoomTimelineReset),t.client.on(te.d.Name,this.onRoomName),t.client.on(m.b.Events,this.onRoomStateEvents),t.client.on(m.b.Update,this.onRoomStateUpdate),t.client.on(te.d.MyMembership,this.onMyMembership),t.client.on(ya.b.KeyBackupStatus,this.onKeyBackupStatus),t.client.on(ya.b.DeviceVerificationChanged,this.onDeviceVerificationChanged),t.client.on(ya.b.UserTrustStatusChanged,this.onUserVerificationChanged),t.client.on(ya.b.KeysChanged,this.onCrossSigningKeysChanged),t.client.on(fa.c.Decrypted,this.onEventDecrypted),t.roomViewStore.on(pt.b,this.onRoomViewStoreUpdate),t.rightPanelStore.on(pt.b,this.onRightPanelStoreUpdate),Fo.a.on(pt.b,this.onWidgetEchoStoreUpdate),t.widgetStore.on(pt.b,this.onWidgetStoreUpdate),Mc.a.instance.on(Mc.b.ActiveCalls,this.onActiveCalls),this.props.resizeNotifier.on("isResizing",this.onIsResizing),this.settingWatchers=[b.b.watchSetting("layout",null,(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let[,,,i]=t;return a.setState({layout:i})})),b.b.watchSetting("lowBandwidth",null,(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let[,,,i]=t;return a.setState({lowBandwidth:i})})),b.b.watchSetting("alwaysShowTimestamps",null,(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let[,,,i]=t;return a.setState({alwaysShowTimestamps:i})})),b.b.watchSetting("showTwelveHourTimestamps",null,(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let[,,,i]=t;return a.setState({showTwelveHourTimestamps:i})})),b.b.watchSetting("readMarkerInViewThresholdMs",null,(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let[,,,i]=t;return a.setState({readMarkerInViewThresholdMs:i})})),b.b.watchSetting("readMarkerOutOfViewThresholdMs",null,(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let[,,,i]=t;return a.setState({readMarkerOutOfViewThresholdMs:i})})),b.b.watchSetting("showHiddenEventsInTimeline",null,(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let[,,,i]=t;return a.setState({showHiddenEvents:i})})),b.b.watchSetting("urlPreviewsEnabled",null,this.onUrlPreviewsEnabledChange),b.b.watchSetting("urlPreviewsEnabled_e2ee",null,this.onUrlPreviewsEnabledChange),b.b.watchSetting("feature_dynamic_room_predecessors",null,(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let[,,,i]=t;return a.setState({msc3946ProcessDynamicPredecessor:i})}))]}doMaybeRemoveOwnJitsiWidget(){if(!this.state.roomId||!this.state.room||!this.context.client)return;const e=this.context.widgetStore.getApps(this.state.roomId).filter((e=>e.eventId&&Qa.a.JITSI.matches(e.type)));if(e.length<2)return;const t=this.context.client.getSafeUserId(),a=e.find((e=>e.creatorUserId===t));if(!a)return;const n=this.state.room.findEventById(a.eventId);if(!n)return;const i=n.getTs();if(!i)return;const s=e.reduce(((e,t)=>{var n;if(t.eventId===a.eventId)return e;const i=(null===(n=this.state.room.findEventById(t.eventId))||void 0===n?void 0:n.getTs())||0;return Math.max(e,i)}),0);s&&i>s&&i-s<3e4&&Aa.a.setRoomWidget(this.state.roomId,a.id)}getPermalinkCreatorForRoom(e){return this.permalinkCreators[e.roomId]||(this.permalinkCreators[e.roomId]=new Sa.a(e),this.state.room&&e.roomId===this.state.room.roomId?this.permalinkCreators[e.roomId].start():this.permalinkCreators[e.roomId].load()),this.permalinkCreators[e.roomId]}stopAllPermalinkCreators(){if(this.permalinkCreators)for(const e of Object.keys(this.permalinkCreators))this.permalinkCreators[e].stop()}setupRoom(e,t,a,n){!a&&t&&(!e&&n?(ga.a.info("Attempting to peek into room %s",t),this.setState({peekLoading:!0,isPeeking:!0}),this.context.client.peekInRoom(t).then((e=>{this.unmounted||(this.setState({room:e,peekLoading:!1}),this.onRoomLoaded(e))})).catch((e=>{if(!this.unmounted){if(this.setState({isPeeking:!1}),"M_GUEST_ACCESS_FORBIDDEN"!==e.errcode&&"M_FORBIDDEN"!==e.errcode)throw e;this.setState({peekLoading:!1})}}))):e&&(this.context.client.stopPeeking(),this.setState({isPeeking:!1})))}shouldShowApps(e){if(!Jd||!e)return!1;const t=e.roomId+"_hide_widget_drawer",a=localStorage.getItem(t),n=!a||"false"===a,i=this.context.widgetLayoutStore.getContainerWidgets(e,Xa.a.Top);return n&&i.length>0}componentDidMount(){this.onRoomViewStoreUpdate(!0);const e=this.getCallForRoom(),t=e?e.state:null;this.setState({callState:t}),this.context.legacyCallHandler.on(B.a.CallState,this.onCallState),window.addEventListener("beforeunload",this.onPageUnload)}shouldComponentUpdate(e,t){const a=Object(hn.c)(this.props,e),n=this.state,{upgradeRecommendation:i}=n,s=ve()(n,Gd),{upgradeRecommendation:r}=t,o=ve()(t,Kd),l=(null==r?void 0:r.needsUpgrade)!==(null==i?void 0:i.needsUpgrade)||Object(hn.c)(s,o);return a||l}componentDidUpdate(){this.messagePanel&&void 0===this.state.atEndOfLiveTimeline&&this.setState({atEndOfLiveTimeline:this.messagePanel.isAtEndOfLiveTimeline()})}componentWillUnmount(){this.unmounted=!0,this.context.legacyCallHandler.removeListener(B.a.CallState,this.onCallState),this.state.roomId&&Uo.setScrollState(this.state.roomId,this.getScrollState()),this.state.shouldPeek&&this.context.client.stopPeeking(),this.stopAllPermalinkCreators(),v.a.unregister(this.dispatcherRef),this.context.client&&(this.context.client.removeListener(o.b.Room,this.onRoom),this.context.client.removeListener(te.d.Timeline,this.onRoomTimeline),this.context.client.removeListener(te.d.TimelineReset,this.onRoomTimelineReset),this.context.client.removeListener(te.d.Name,this.onRoomName),this.context.client.removeListener(m.b.Events,this.onRoomStateEvents),this.context.client.removeListener(te.d.MyMembership,this.onMyMembership),this.context.client.removeListener(m.b.Update,this.onRoomStateUpdate),this.context.client.removeListener(ya.b.KeyBackupStatus,this.onKeyBackupStatus),this.context.client.removeListener(ya.b.DeviceVerificationChanged,this.onDeviceVerificationChanged),this.context.client.removeListener(ya.b.UserTrustStatusChanged,this.onUserVerificationChanged),this.context.client.removeListener(ya.b.KeysChanged,this.onCrossSigningKeysChanged),this.context.client.removeListener(fa.c.Decrypted,this.onEventDecrypted)),window.removeEventListener("beforeunload",this.onPageUnload),this.context.roomViewStore.off(pt.b,this.onRoomViewStoreUpdate),this.context.rightPanelStore.off(pt.b,this.onRightPanelStoreUpdate),Fo.a.removeListener(pt.b,this.onWidgetEchoStoreUpdate),this.context.widgetStore.removeListener(pt.b,this.onWidgetStoreUpdate),this.props.resizeNotifier.off("isResizing",this.onIsResizing),this.state.room&&this.context.widgetLayoutStore.off(Xa.d.emissionForRoom(this.state.room),this.onWidgetLayoutChange),Mc.a.instance.off(Mc.b.ActiveCalls,this.onActiveCalls),this.context.legacyCallHandler.off(B.a.CallState,this.onCallState),this.updateRoomMembers.cancel();for(const e of this.settingWatchers)b.b.unwatchSetting(e);this.viewsLocalRoom&&this.context.client.store.removeRoom(this.state.room.roomId)}onLocalRoomEvent(e){e===this.state.room.roomId&&Object(Fs.c)(this.context.client,this.state.room)}getRoomTombstone(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state.room;return null==e?void 0:e.currentState.getStateEvents(ee.b.RoomTombstone,"")}async calculateRecommendedVersion(e){const t=await e.getRecommendedVersion();this.unmounted||this.setState({upgradeRecommendation:t})}async loadMembersIfJoined(e){if(this.context.client.hasLazyLoadMembersEnabled()&&e&&"join"===e.getMyMembership())try{await e.loadMembersIfNeeded(),this.unmounted||this.setState({membersLoaded:!0})}catch(t){const a=`Fetching room members for ${e.roomId} failed. Room members will appear incomplete.`;ga.a.error(a),ga.a.error(t)}}calculatePeekRules(e){const t=e.currentState.getStateEvents(ee.b.RoomHistoryVisibility,"");this.setState({canPeek:(null==t?void 0:t.getContent().history_visibility)===_a.b.WorldReadable})}updatePreviewUrlVisibility(e){let{roomId:t}=e;const a=this.context.client.isRoomEncrypted(t)?"urlPreviewsEnabled_e2ee":"urlPreviewsEnabled";this.setState({showUrlPreview:b.b.getValue(a,t)})}async updateE2EStatus(e){if(!this.context.client.isRoomEncrypted(e.roomId))return;let t=za.Warning;this.context.client.isCryptoEnabled()&&(t=await async function(e,t){const a=(await t.getEncryptionTargetMembers()).map((e=>{let{userId:t}=e;return t})),n=!!Ha.a.shared().getUserIdForRoomId(t.roomId),i=[],s=[];a.filter((t=>t!==e.getUserId())).forEach((t=>{(e.checkUserTrust(t).isCrossSigningVerified()?i:s).push(t)}));for(const t of s)if(e.checkUserTrust(t).wasCrossSigningVerified())return za.Warning;const r=i.length>0&&!n&&2!==a.length||1===a.length?[...i,e.getUserId()]:i;for(const t of r)if(e.getStoredDevicesForUser(t).some((a=>{let{deviceId:n}=a;return!e.checkDeviceTrust(t,n).isVerified()})))return za.Warning;return 0===s.length?za.Verified:za.Normal}(this.context.client,e)),this.unmounted||this.setState({e2eStatus:t})}updatePermissions(e){if(e){const t=this.context.client.getUserId(),a="join"===e.getMyMembership()&&e.currentState.maySendEvent(ee.b.Reaction,t),n=e.maySendMessage(),i=e.currentState.maySendEvent(ee.b.RoomRedaction,t);this.setState({canReact:a,canSendMessages:n,canSelfRedact:i})}}checkDesktopNotifications(){this.state.room.getJoinedMemberCount()+this.state.room.getInvitedMemberCount()>1&&Vc.default.shouldShowPrompt()&&Object(Wc.b)(!0)}updateDMState(){const e=this.state.room;if("join"!=e.getMyMembership())return;const t=e.getDMInviter();t&&Ca.d(e.roomId,t)}injectSticker(e,t,a,n){this.context.client.isGuest()?v.a.dispatch({action:"require_registration"}):Oa.a.sharedInstance().sendStickerContentToRoom(e,this.state.room.roomId,n,t,a,this.context.client).then(void 0,(e=>{e.name}))}getScrollState(){const e=this.messagePanel;if(!e)return null;if(this.state.atEndOfLiveTimeline)return null;const t=e.getScrollState();return!t||t.stuckAtBottom?null:{focussedEvent:t.trackedScrollToken,pixelOffset:t.pixelOffset}}getCallForRoom(){return this.state.room?this.context.legacyCallHandler.getCallForRoom(this.state.room.roomId):null}getOldRoom(){var e,t;const{roomId:a}=(null===(e=this.state.room)||void 0===e?void 0:e.findPredecessor(this.state.msc3946ProcessDynamicPredecessor))||{};return(null===(t=this.context.client)||void 0===t?void 0:t.getRoom(a))||null}getHiddenHighlightCount(){const e=this.getOldRoom();return e?e.getUnreadNotificationCount(te.b.Highlight):0}get messagePanelClassNames(){return c()("mx_RoomView_messagePanel",{mx_IRCLayout:this.state.layout===wr.a.IRC})}get viewsLocalRoom(){return Object(eo.a)(this.state.room)}get permalinkCreator(){return this.getPermalinkCreatorForRoom(this.state.room)}renderLocalRoomCreateLoader(){const e=this.state.room.getDefaultRoomName(this.context.client.getUserId());return r.a.createElement(Ga.b.Provider,{value:this.state},r.a.createElement(Zd,{names:e,resizeNotifier:this.props.resizeNotifier}))}renderLocalRoomView(e){return r.a.createElement(Ga.b.Provider,{value:this.state},r.a.createElement(Xd,{localRoom:e,resizeNotifier:this.props.resizeNotifier,permalinkCreator:this.permalinkCreator,roomView:this.roomView,onFileDrop:this.onFileDrop}))}renderWaitingForThirdPartyRoomView(e){return r.a.createElement(Ga.b.Provider,{value:this.state},r.a.createElement(zd,{resizeNotifier:this.props.resizeNotifier,roomView:this.roomView,inviteEvent:e}))}render(){var e,t;if(this.state.room instanceof fd.b)return this.state.room.state===fd.c.CREATING?this.renderLocalRoomCreateLoader():this.renderLocalRoomView(this.state.room);if(this.state.room){const{shouldEncrypt:e,inviteEvent:t}=Object(Wd.a)(this.state.room);if(e)return this.renderWaitingForThirdPartyRoomView(t)}if(!this.state.room){const e=!this.state.matrixClientIsReady||this.state.roomLoading||this.state.peekLoading;if(e){const t=!this.state.matrixClientIsReady||!this.state.roomId||this.state.peekLoading;return r.a.createElement("div",{className:"mx_RoomView"},r.a.createElement(Vo.a,null,r.a.createElement(qo,{canPreview:!1,previewLoading:t&&!this.state.roomLoadError,error:this.state.roomLoadError,loading:e,joining:this.state.joining,oobData:this.props.oobData,roomId:this.state.roomId})))}{var a,n;let e;this.props.oobData&&(e=this.props.oobData.inviterName);const t=null===(a=this.props.threepidInvite)||void 0===a?void 0:a.toEmail,i=this.state.roomAlias;return r.a.createElement("div",{className:"mx_RoomView"},r.a.createElement(Vo.a,null,r.a.createElement(qo,{onJoinClick:this.onJoinButtonClicked,onForgetClick:this.onForgetClick,onRejectClick:this.onRejectThreepidInviteButtonClicked,canPreview:!1,error:this.state.roomLoadError,roomAlias:i,joining:this.state.joining,inviterName:e,invitedEmail:t,oobData:this.props.oobData,signUrl:null===(n=this.props.threepidInvite)||void 0===n?void 0:n.signUrl,roomId:this.state.roomId})))}}const i=this.state.room.getMyMembership();if(_c(this.state.room)&&(!b.b.getValue("feature_video_rooms")||"join"!==i))return r.a.createElement(Vo.a,null,r.a.createElement("div",{className:"mx_MainSplit"},r.a.createElement(il,{room:this.state.room,onJoinButtonClicked:this.onJoinButtonClicked,onRejectButtonClicked:this.onRejectButtonClicked})),";");if("invite"===i&&!this.state.room.isSpaceRoom()){if(this.state.joining||this.state.rejecting)return r.a.createElement(Vo.a,null,r.a.createElement(qo,{canPreview:!1,error:this.state.roomLoadError,joining:this.state.joining,rejecting:this.state.rejecting,roomId:this.state.roomId}));{const e=this.context.client.credentials.userId,t=this.state.room.getMember(e),a=t?t.events.member:null;let n=Object(N.a)("Unknown");return a&&(n=a.sender?a.sender.name:a.getSender()),r.a.createElement("div",{className:"mx_RoomView"},r.a.createElement(Vo.a,null,r.a.createElement(qo,{onJoinClick:this.onJoinButtonClicked,onForgetClick:this.onForgetClick,onRejectClick:this.onRejectButtonClicked,onRejectAndIgnoreClick:this.onRejectAndIgnoreClick,inviterName:n,canPreview:!1,joining:this.state.joining,room:this.state.room,roomId:this.state.roomId})))}}let s,o=null;{const e=this.getCallForRoom();e&&"ended"!==this.state.callState&&"ringing"!==this.state.callState&&(o=e)}let l=!0;Oa.a.sharedInstance().getCurrentUploads().length>0?s=r.a.createElement(mo,{room:this.state.room}):this.state.search||(l=this.state.statusBarVisible,s=r.a.createElement(gd.a,{room:this.state.room,isPeeking:"join"!==i,onInviteClick:this.onInviteClick,onVisible:this.onStatusBarVisible,onHidden:this.onStatusBarHidden}));const d=c()("mx_RoomView_statusArea",{mx_RoomView_statusArea_expanded:l}),m=s&&r.a.createElement("div",{className:d},r.a.createElement("div",{className:"mx_RoomView_statusAreaBox"},r.a.createElement("div",{className:"mx_RoomView_statusAreaBox_line"}),s)),u=this.state.upgradeRecommendation,h=u&&u.needsUpgrade&&this.state.room.userMayUpgradeRoom(this.context.client.credentials.userId),p=this.getHiddenHighlightCount();let g,v;var f;if(this.state.timelineRenderingType===Ga.a.Search)g=r.a.createElement(rl,{searchInProgress:null===(f=this.state.search)||void 0===f?void 0:f.inProgress,onCancelClick:this.onCancelSearchClick,onSearch:this.onSearch,isRoomEncrypted:this.context.client.isRoomEncrypted(this.state.room.roomId)});else if(h)g=r.a.createElement(ll,{room:this.state.room});else if("join"!==i){var y,E;let e;this.props.oobData&&(e=this.props.oobData.inviterName);const t=null===(y=this.props.threepidInvite)||void 0===y?void 0:y.toEmail;if(v=r.a.createElement(qo,{onJoinClick:this.onJoinButtonClicked,onForgetClick:this.onForgetClick,onRejectClick:this.onRejectThreepidInviteButtonClicked,joining:this.state.joining,inviterName:e,invitedEmail:t,oobData:this.props.oobData,canPreview:this.state.canPeek,room:this.state.room,roomId:this.state.roomId}),!(this.state.canPeek||null!==(E=this.state.room)&&void 0!==E&&E.isSpaceRoom()))return r.a.createElement("div",{className:"mx_RoomView"},v)}else p>0&&(g=r.a.createElement(G.a,{element:"div",className:"mx_RoomView_auxPanel_hiddenHighlights",onClick:this.onHiddenHighlightsClick},Object(N.a)("You have %(count)s unread notifications in a prior version of this room.",{count:p})));let _;if(this.state.visibleDecryptionFailures&&this.state.visibleDecryptionFailures.length>0&&(_=r.a.createElement(ml,{failures:this.state.visibleDecryptionFailures})),null!==(e=this.state.room)&&void 0!==e&&e.isSpaceRoom()&&!this.props.forceTimeline)return r.a.createElement(pd,{space:this.state.room,justCreatedOpts:this.props.justCreatedOpts,resizeNotifier:this.props.resizeNotifier,onJoinButtonClicked:this.onJoinButtonClicked,onRejectButtonClicked:this.props.threepidInvite?this.onRejectThreepidInviteButtonClicked:this.onRejectButtonClicked});const w=r.a.createElement(Yl,{room:this.state.room,userId:this.context.client.credentials.userId,showApps:this.state.showApps,resizeNotifier:this.props.resizeNotifier},g,_);let S;let O;"join"===i&&!this.state.search&&(S=r.a.createElement(ro,{room:this.state.room,e2eStatus:this.state.e2eStatus,resizeNotifier:this.props.resizeNotifier,replyToEvent:this.state.replyToEvent,permalinkCreator:this.permalinkCreator}));let C,x=!1;this.state.search&&(O=r.a.createElement(Bd,{key:this.state.search.searchId,ref:this.searchResultsPanel,term:this.state.search.term,scope:this.state.search.scope,promise:this.state.search.promise,abortController:this.state.search.abortController,resizeNotifier:this.props.resizeNotifier,permalinkCreator:this.permalinkCreator,className:this.messagePanelClassNames,onUpdate:this.onSearchUpdate}),x=!0),this.state.isInitialEventHighlighted&&(C=this.state.initialEventId);const j=r.a.createElement(_r,{ref:this.gatherTimelinePanelRef,timelineSet:this.state.room.getUnfilteredTimelineSet(),overlayTimelineSet:null===(t=this.state.virtualRoom)||void 0===t?void 0:t.getUnfilteredTimelineSet(),overlayTimelineSetFilter:br.d,showReadReceipts:this.state.showReadReceipts,manageReadReceipts:!this.state.isPeeking,sendReadReceiptOnLoad:!this.state.wasContextSwitch,manageReadMarkers:!this.state.isPeeking,hidden:x,highlightedEventId:C,eventId:this.state.initialEventId,eventScrollIntoView:this.state.initialEventScrollIntoView,eventPixelOffset:this.state.initialEventPixelOffset,onScroll:this.onMessageListScroll,onEventScrolledIntoView:this.resetJumpToEvent,onReadMarkerUpdated:this.updateTopUnreadMessagesBar,showUrlPreview:this.state.showUrlPreview,className:this.messagePanelClassNames,membersLoaded:this.state.membersLoaded,permalinkCreator:this.permalinkCreator,resizeNotifier:this.props.resizeNotifier,showReactions:!0,layout:this.state.layout,editState:this.state.editState});let k,R=null;this.state.showTopUnreadMessagesBar&&!this.state.search&&(R=r.a.createElement(vd,{onScrollUpClick:this.jumpToReadMarker,onCloseClick:this.forgetReadMarker})),!1!==this.state.atEndOfLiveTimeline||this.state.search||(k=r.a.createElement(To,{highlight:this.state.room.getUnreadNotificationCount(te.b.Highlight)>0,numUnreadMessages:this.state.numUnreadMessages,onScrollToBottomClick:this.jumpToLiveTimeline}));const I=this.state.room&&this.state.showRightPanel?r.a.createElement(Ao,{room:this.state.room,resizeNotifier:this.props.resizeNotifier,permalinkCreator:this.permalinkCreator,e2eStatus:this.state.e2eStatus}):null,T=c()("mx_RoomView_timeline",{mx_RoomView_timeline_rr_enabled:this.state.showReadReceipts}),P=c()("mx_RoomView",{mx_RoomView_inCall:Boolean(o),mx_RoomView_immersive:this.state.mainSplitContentType!==Qd.Timeline}),D=b.b.getValue("showChatEffects");let M,A;switch(this.state.mainSplitContentType){case Qd.Timeline:A="mx_MainSplit_timeline",M=r.a.createElement(r.a.Fragment,null,r.a.createElement(Sr,{sensor:this.roomViewBody.current,onMeasurement:this.onMeasurement}),w,r.a.createElement("div",{className:T},r.a.createElement(go,{parent:this.roomView.current,onFileDrop:this.onFileDrop}),R,k,j,O),m,v,S);break;case Qd.MaximisedWidget:A="mx_MainSplit_maximisedWidget",M=r.a.createElement(r.a.Fragment,null,r.a.createElement(wl,{room:this.state.room,userId:this.context.client.credentials.userId,resizeNotifier:this.props.resizeNotifier,showApps:!0}),v);break;case Qd.Call:A="mx_MainSplit_call",M=r.a.createElement(r.a.Fragment,null,r.a.createElement(Bc,{room:this.state.room,resizing:this.state.resizing,waitForCall:_c(this.state.room)}),v)}const L=c()("mx_RoomView_body",A);let U=[Ra.a.Timeline],F=this.onAppsClick,B=this.onForgetClick,V=this.onSearchClick,W=null,H=!1;switch(this.state.mainSplitContentType){case Qd.MaximisedWidget:U=[Ra.a.ThreadPanel,Ra.a.PinnedMessages],F=null,B=null,V=null;break;case Qd.Call:U=[Ra.a.ThreadPanel,Ra.a.PinnedMessages,Ra.a.NotificationPanel],_c(this.state.room)||(U.push(Ra.a.RoomSummary),null===this.state.activeCall&&U.push(Ra.a.Timeline)),F=null,B=null,V=null,this.state.room.canInvite(this.context.client.credentials.userId)&&(W=this.onInviteClick),H=!0}return r.a.createElement(Ga.b.Provider,{value:this.state},r.a.createElement("main",{className:P,ref:this.roomView,onKeyDown:this.onReactKeyDown},D&&this.roomView.current&&r.a.createElement(Dc,{roomWidth:this.roomView.current.offsetWidth}),r.a.createElement(Vo.a,null,r.a.createElement(Pc,{room:this.state.room,searchInfo:this.state.search,oobData:this.props.oobData,inRoom:"join"===i,onSearchClick:V,onInviteClick:W,onForgetClick:"leave"===i?B:null,e2eStatus:this.state.e2eStatus,onAppsClick:this.state.hasPinnedWidgets?F:null,appsShown:this.state.showApps,excludedRightPanelPhaseButtons:U,showButtons:!this.viewsLocalRoom,enableRoomOptionsMenu:!this.viewsLocalRoom,viewingCall:H,activeCall:this.state.activeCall}),r.a.createElement(ja,{panel:I,resizeNotifier:this.props.resizeNotifier},r.a.createElement("div",{className:L,ref:this.roomViewBody,"data-layout":this.state.layout},M)))))}}i()(em,"contextType",rt.a);var tm=em;class am extends s.Component{constructor(e){super(e),i()(this,"onToastStoreUpdate",(()=>{this.setState({toasts:D.a.sharedInstance().getToasts(),countSeen:D.a.sharedInstance().getCountSeen()})})),this.state={toasts:D.a.sharedInstance().getToasts(),countSeen:D.a.sharedInstance().getCountSeen()},D.a.sharedInstance().on("update",this.onToastStoreUpdate)}componentWillUnmount(){D.a.sharedInstance().removeListener("update",this.onToastStoreUpdate)}render(){const e=this.state.toasts.length,t=e>1;let a,n;if(0!==e){const i=this.state.toasts[0],{title:r,icon:o,key:l,component:d,className:m,bodyClassName:u,props:h}=i,p=c()("mx_Toast_body",u),g=c()("mx_Toast_toast",m,{mx_Toast_hasIcon:o,[`mx_Toast_icon_${o}`]:o}),v=Object.assign({},h,{key:l,toastKey:l}),b=s.createElement(d,v);let f,y;(r&&t||this.state.countSeen>0)&&(f=` (${this.state.countSeen+1}/${this.state.countSeen+e})`),r&&(y=s.createElement("div",{className:"mx_Toast_title"},s.createElement("h2",null,r),s.createElement("span",{className:"mx_Toast_title_countIndicator"},f))),a=s.createElement("div",{className:g},y,s.createElement("div",{className:p},b)),n=c()("mx_ToastContainer",{mx_ToastContainer_stacked:t})}return a?s.createElement("div",{className:n,role:"alert"},a):null}}class nm extends r.a.Component{constructor(e){super(e),this.state={loading:!0}}componentDidMount(){this.props.userId&&this.loadProfileInfo()}componentDidUpdate(e){e.userId!==this.props.userId&&this.props.userId&&this.loadProfileInfo()}async loadProfileInfo(){const e=lt.a.get();let t;this.setState({loading:!0});try{t=await e.getProfileInfo(this.props.userId)}catch(e){return H.b.createDialog(Ja.a,{title:Object(N.a)("Could not load user profile"),description:e&&e.message?e.message:Object(N.a)("Operation failed")}),void this.setState({loading:!1})}const a=new fa.b({type:"m.room.member",content:t}),n=new ka.a(null,this.props.userId);n.setMembershipEvent(a),this.setState({member:n,loading:!1})}render(){if(this.state.loading)return r.a.createElement(Kn.a,null);if(this.state.member){const e=r.a.createElement(Ao,{overwriteCard:{phase:Ra.a.RoomMemberInfo,state:{member:this.state.member}},resizeNotifier:this.props.resizeNotifier});return r.a.createElement(ja,{panel:e,resizeNotifier:this.props.resizeNotifier},r.a.createElement(oa.a,null))}return r.a.createElement("div",null)}}var im=e=>{let{backgroundImage:t,blurMultiplier:a}=e;if(!t)return null;const n={};if(a){const e=getComputedStyle(document.documentElement).getPropertyValue("--lp-background-blur").replace("px",""),t=parseInt(e,10);isNaN(t)||(n.filter=`blur(${t*a}px)`)}return r.a.createElement("div",{className:"mx_BackdropPanel"},r.a.createElement("img",{role:"presentation",alt:"",style:n,className:"mx_BackdropPanel--image",src:t}))},sm=a(607);var rm=e=>{let{isMinimized:t}=e;const a=Object(ie.b)(pc.a.instance,pc.b.MonitoringLivePosition,(()=>pc.a.instance.isMonitoringLiveLocation)),n=Object(ie.b)(pc.a.instance,pc.b.LocationPublishError,(()=>pc.a.instance.getLiveBeaconIdsWithLocationPublishError())),i=Object(ie.b)(pc.a.instance,pc.b.BeaconUpdateError,(()=>pc.a.instance.getLiveBeaconIds().filter((e=>pc.a.instance.beaconUpdateErrors.has(e))))),o=Object(ie.b)(pc.a.instance,pc.b.LivenessChange,(()=>pc.a.instance.getLiveBeaconIds())),l=!!n.length,d=!!i.length;if(((e,t)=>{Object(s.useEffect)((()=>{const a=()=>{"visible"===document.visibilityState&&e.forEach((e=>{var a;return null===(a=t.get(e))||void 0===a?void 0:a.monitorLiveness()}))};return e.length&&document.addEventListener("visibilitychange",a),()=>{document.removeEventListener("visibilitychange",a)}}),[e,t])})(o,pc.a.instance.beacons),!a)return null;const m=((e,t,a)=>{var n,i;const s=null!==(n=null!==(i=null==t?void 0:t[0])&&void 0!==i?i:null==a?void 0:a[0])&&void 0!==n?n:null==e?void 0:e[0];if(!s)return;return pc.a.instance.getBeaconById(s)})(o,i,n),u=m?e=>{v.a.dispatch({action:U.a.ViewRoom,room_id:m.roomId,metricsTrigger:void 0,event_id:m.beaconInfoId,scroll_into_view:!0,highlighted:!0})}:null,h=((e,t)=>e?Object(N.a)("An error occurred while stopping your live location"):t?Object(N.a)("An error occurred whilst sharing your live location"):Object(N.a)("You are sharing your live location"))(d,l);return r.a.createElement(G.a,{className:c()("mx_LeftPanelLiveShareWarning",{mx_LeftPanelLiveShareWarning__minimized:t,mx_LeftPanelLiveShareWarning__error:l||d}),title:t?h:void 0,onClick:u},t?r.a.createElement(sm.a,{height:10}):h)},om=a(1515),lm=a(597);class cm extends r.a.Component{constructor(e,t){super(e,t),i()(this,"context",void 0),i()(this,"room",void 0),this.room=t.getRoom(this.props.persistentRoomId)}render(){const e=Wa.a.instance.get(this.props.persistentWidgetId,this.props.persistentRoomId);return e?r.a.createElement(vs,{key:e.id,app:e,fullWidth:!0,room:this.room,userId:this.context.credentials.userId,creatorUserId:e.creatorUserId,widgetPageTitle:Aa.a.getWidgetDataTitle(e),waitForIframeLoad:e.waitForIframeLoad,miniMode:!0,showMenubar:!1,pointerEvents:this.props.pointerEvents,movePersistedElement:this.props.movePersistedElement}):null}}i()(cm,"contextType",R.a);var dm,mm,um=a(899);function hm(){return hm=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},hm.apply(this,arguments)}function pm(e){return s.createElement("svg",hm({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",role:"presentation","aria-hidden":!0},e),dm||(dm=s.createElement("path",{d:"M8.027 15.961c1.141 1.232 3.888 3.365 4.637 3.803l.151.09c1.143.679 4.722 2.807 7.33.815 2.021-1.542 1.364-3.278.684-3.794-.466-.362-1.838-1.36-3.128-2.26-1.268-.883-1.974-.175-2.452.303l-.026.026-.96.961c-.246.245-.618.156-.974-.125a26.02 26.02 0 01-2.692-2.385l-.004-.004c-.47-.47-1.4-1.4-2.373-2.68-.28-.356-.37-.728-.125-.973l.96-.961.027-.026c.478-.478 1.186-1.184.303-2.452-.9-1.29-1.898-2.662-2.26-3.128-.516-.68-2.252-1.337-3.794.684-1.992 2.608.136 6.187.815 7.33l.09.151c.438.75 2.56 3.484 3.791 4.625z",fill:"currentColor"})),mm||(mm=s.createElement("path",{d:"M20.697 3.078a.638.638 0 000-.893.615.615 0 00-.88 0L17 5.045l-2.817-2.86a.615.615 0 00-.88 0 .638.638 0 000 .893l2.817 2.86-2.938 2.984a.638.638 0 000 .893.615.615 0 00.88 0L17 6.832l2.938 2.983a.615.615 0 00.88 0 .638.638 0 000-.893L17.88 5.939l2.817-2.86z",fill:"currentColor"})))}const gm=e=>{let{widgetId:t,room:a,viewingRoom:n,onStartMoving:i,movePersistedElement:o}=e;const l=Object(s.useMemo)((()=>Wa.a.instance.getApps(a.roomId).find((e=>e.id===t))),[a,t]),c=Object(ie.d)(a,te.d.Name,Object(s.useCallback)((()=>a.name),[a])),d=Object(wc.b)(t,a.roomId),m=Object(s.useCallback)((e=>{e.preventDefault(),e.stopPropagation(),null!==d?v.a.dispatch({action:U.a.ViewRoom,room_id:a.roomId,view_call:!0,metricsTrigger:"WebFloatingCallWindow"}):n?Xa.d.instance.moveToContainer(a,l,Xa.a.Center):v.a.dispatch({action:U.a.ViewRoom,room_id:a.roomId,metricsTrigger:"WebFloatingCallWindow"})}),[a,d,l,n]),u=Object(s.useCallback)((e=>{var t;(e.preventDefault(),e.stopPropagation(),null!==d)?d.disconnect().catch((e=>console.error("Failed to leave call",e))):null===(t=$a.a.instance.getMessagingForUid(Aa.a.getWidgetUid(l)))||void 0===t||t.transport.send(Za.a.HangupCall,{}).catch((e=>console.error("Failed to leave Jitsi",e)))}),[d,l]);return r.a.createElement("div",{className:"mx_WidgetPip",onMouseDown:i,onClick:m},r.a.createElement(aa.a,{className:"mx_WidgetPip_header"},r.a.createElement(xe.a,{onClick:m,className:"mx_WidgetPip_backButton","aria-label":Object(N.a)("Back")},r.a.createElement(um.a,{className:"mx_Icon mx_Icon_16"}),c)),r.a.createElement(cm,{persistentWidgetId:t,persistentRoomId:a.roomId,pointerEvents:"none",movePersistedElement:o}),(null!==d||Qa.a.JITSI.matches(l.type))&&r.a.createElement(aa.a,{className:"mx_WidgetPip_footer"},r.a.createElement(xe.b,{onClick:u,tooltip:Object(N.a)("Leave"),"aria-label":Object(N.a)("Leave"),alignment:xi.a.Top},r.a.createElement(pm,{className:"mx_Icon mx_Icon_24"}))))},vm=[ha.f.Connected,ha.f.InviteSent,ha.f.Connecting,ha.f.CreateAnswer,ha.f.CreateOffer,ha.f.WaitLocalMedia];function bm(e){if(!e)return[null,[]];const t=B.b.instance.getAllActiveCallsForPip(e);let a=null,n=[];for(const e of t)vm.includes(e.state)&&(e.isRemoteOnHold()||null!==a?n.push(e):a=e);return null===a&&n.length>0&&(a=n[0],n=n.slice(1)),n.length>1&&ga.a.log("Found more than 1 secondary call! Other calls will not be shown."),[a,n]}class fm extends r.a.Component{constructor(e){super(e),i()(this,"onMove",(()=>{var e,t;return null===(e=(t=this.props.movePersistedElement).current)||void 0===e?void 0:e.call(t)})),i()(this,"onRoomViewStoreUpdate",(()=>{var e,t;const a=rt.b.instance.roomViewStore.getRoomId(),n=this.state.viewedRoomId;if(a===n)return;const i=null===(e=lt.a.get())||void 0===e?void 0:e.getRoom(n);i&&Xa.d.instance.off(Xa.d.emissionForRoom(i),this.updateCalls);const s=null===(t=lt.a.get())||void 0===t?void 0:t.getRoom(a||void 0);if(s&&Xa.d.instance.on(Xa.d.emissionForRoom(s),this.updateCalls),!a)return;const[r,o]=bm(a);this.setState({viewedRoomId:a,primaryCall:r,secondaryCall:o[0]}),this.updateShowWidgetInPip()})),i()(this,"onWidgetPersistence",(()=>{this.updateShowWidgetInPip()})),i()(this,"onWidgetDockChanges",(()=>{this.updateShowWidgetInPip()})),i()(this,"updateCalls",(()=>{if(!this.state.viewedRoomId)return;const[e,t]=bm(this.state.viewedRoomId);this.setState({primaryCall:e,secondaryCall:t[0]}),this.updateShowWidgetInPip()})),i()(this,"onCallRemoteHold",(()=>{if(!this.state.viewedRoomId)return;const[e,t]=bm(this.state.viewedRoomId);this.setState({primaryCall:e,secondaryCall:t[0]})})),i()(this,"onDoubleClick",(()=>{var e;const t=null===(e=this.state.primaryCall)||void 0===e?void 0:e.roomId;(null!=t?t:this.state.persistentRoomId)&&v.a.dispatch({action:U.a.ViewRoom,room_id:null!=t?t:this.state.persistentRoomId,metricsTrigger:"WebFloatingCallWindow"})}));const t=rt.b.instance.roomViewStore.getRoomId(),[a,n]=bm(t);this.state={viewedRoomId:t||void 0,primaryCall:a||null,secondaryCall:n[0],persistentWidgetId:On.b.instance.getPersistentWidgetId(),persistentRoomId:On.b.instance.getPersistentRoomId(),showWidgetInPip:!1}}componentDidMount(){var e;B.b.instance.addListener(B.a.CallChangeRoom,this.updateCalls),B.b.instance.addListener(B.a.CallState,this.updateCalls),rt.b.instance.roomViewStore.addListener(pt.b,this.onRoomViewStoreUpdate),lt.a.get().on(ha.d.RemoteHoldUnhold,this.onCallRemoteHold);const t=null===(e=lt.a.get())||void 0===e?void 0:e.getRoom(this.state.viewedRoomId);t&&Xa.d.instance.on(Xa.d.emissionForRoom(t),this.updateCalls),On.b.instance.on(On.a.Persistence,this.onWidgetPersistence),On.b.instance.on(On.a.Dock,this.onWidgetDockChanges),On.b.instance.on(On.a.Undock,this.onWidgetDockChanges)}componentWillUnmount(){B.b.instance.removeListener(B.a.CallChangeRoom,this.updateCalls),B.b.instance.removeListener(B.a.CallState,this.updateCalls);const e=lt.a.get();null==e||e.removeListener(ha.d.RemoteHoldUnhold,this.onCallRemoteHold),rt.b.instance.roomViewStore.removeListener(pt.b,this.onRoomViewStoreUpdate);const t=null==e?void 0:e.getRoom(this.state.viewedRoomId);t&&Xa.d.instance.off(Xa.d.emissionForRoom(t),this.updateCalls),On.b.instance.off(On.a.Persistence,this.onWidgetPersistence),On.b.instance.off(On.a.Dock,this.onWidgetDockChanges),On.b.instance.off(On.a.Undock,this.onWidgetDockChanges)}updateShowWidgetInPip(){const e=On.b.instance.getPersistentWidgetId(),t=On.b.instance.getPersistentRoomId();let a=!1,n=!1;e&<.a.get().getRoom(t)&&(n=!On.b.instance.isDocked(e,t),a=this.state.viewedRoomId!==t);const i=a||n;this.setState({showWidgetInPip:i,persistentWidgetId:e,persistentRoomId:t})}createVoiceBroadcastPlaybackPipContent(e){const t=this.state.viewedRoomId===e.infoEvent.getRoomId()?r.a.createElement(ft.j,{playback:e,pip:!0}):r.a.createElement(ft.B,{playback:e});return a=>{let{onStartMoving:n}=a;return r.a.createElement("div",{key:e.infoEvent.getId(),onMouseDown:n},t)}}createVoiceBroadcastPreRecordingPipContent(e){return t=>{let{onStartMoving:a}=t;return r.a.createElement("div",{onMouseDown:a},r.a.createElement(ft.p,{voiceBroadcastPreRecording:e}))}}createVoiceBroadcastRecordingPipContent(e){return t=>{let{onStartMoving:a}=t;return r.a.createElement("div",{onMouseDown:a},r.a.createElement(ft.w,{recording:e}))}}render(){let e=[];if(this.props.voiceBroadcastRecording?e=[this.createVoiceBroadcastRecordingPipContent(this.props.voiceBroadcastRecording)]:this.props.voiceBroadcastPreRecording?e=[this.createVoiceBroadcastPreRecordingPipContent(this.props.voiceBroadcastPreRecording)]:this.props.voiceBroadcastPlayback&&(e=[this.createVoiceBroadcastPlaybackPipContent(this.props.voiceBroadcastPlayback)]),this.state.primaryCall){const t=this.state.primaryCall;e.push((e=>{let{onStartMoving:a,onResize:n}=e;return r.a.createElement(ql,{onMouseDownOnHeader:a,call:t,secondaryCall:this.state.secondaryCall,pipMode:true,onResize:n})}))}return this.state.showWidgetInPip&&e.push((e=>{let{onStartMoving:t}=e;return r.a.createElement(gm,{widgetId:this.state.persistentWidgetId,room:lt.a.get().getRoom(this.state.persistentRoomId),viewingRoom:this.state.viewedRoomId===this.state.persistentRoomId,onStartMoving:t,movePersistedElement:this.props.movePersistedElement})})),e.length?r.a.createElement(om.a,{className:"mx_LegacyCallPreview",draggable:true,onDoubleClick:this.onDoubleClick,onMove:this.onMove},e):null}}const ym=()=>{const e=Object(s.useContext)(rt.a),t=e.voiceBroadcastPreRecordingStore,{currentVoiceBroadcastPreRecording:a}=Object(ft.Q)(t),n=e.voiceBroadcastRecordingsStore,{currentVoiceBroadcastRecording:i}=Object(ft.R)(n),o=e.voiceBroadcastPlaybacksStore,{currentVoiceBroadcastPlayback:l}=(c=o,{currentVoiceBroadcastPlayback:Object(ie.d)(c,lm.b.CurrentChanged,(e=>null!=e?e:c.getCurrent()))});var c;const d=Object(s.useRef)();return r.a.createElement(fm,{voiceBroadcastPlayback:l,voiceBroadcastPreRecording:a,voiceBroadcastRecording:i,movePersistedElement:d})};function Em(e){return e.closest("input, textarea, select, [contenteditable=true]")}class _m extends r.a.Component{constructor(e){super(e),i()(this,"_matrixClient",void 0),i()(this,"_roomView",void 0),i()(this,"_resizeContainer",void 0),i()(this,"resizeHandler",void 0),i()(this,"layoutWatcherRef",void 0),i()(this,"compactLayoutWatcherRef",void 0),i()(this,"backgroundImageWatcherRef",void 0),i()(this,"resizer",void 0),i()(this,"onCallState",(()=>{const e=B.b.instance.getAllActiveCalls();e!==this.state.activeCalls&&this.setState({activeCalls:e})})),i()(this,"refreshBackgroundImage",(async()=>{let e=b.b.getValue("RoomList.backgroundImage");e=e?Object(Fa.b)(e).srcHttp:ht.a.instance.getHttpAvatarUrl(),this.setState({backgroundImage:e})})),i()(this,"canResetTimelineInRoom",(e=>!this._roomView.current||this._roomView.current.canResetTimeline())),i()(this,"onAccountData",(e=>{"m.ignored_user_list"===e.getType()&&v.a.dispatch({action:"ignore_state_changed"})})),i()(this,"onCompactLayoutChanged",(()=>{this.setState({useCompactLayout:b.b.getValue("useCompactLayout")})})),i()(this,"onSync",((e,t,a)=>{var n,i,s;const r=null===(n=this.state.syncErrorData)||void 0===n||null===(i=n.error)||void 0===i?void 0:i.errcode,o=null==a||null===(s=a.error)||void 0===s?void 0:s.errcode;e===t&&r===o||(this.setState({syncErrorData:e===d.b.Error?a:null}),t===d.b.Prepared&&e===d.b.Syncing?this.updateServerNoticeEvents():this.calculateServerLimitToast(this.state.syncErrorData,this.state.usageLimitEventContent))})),i()(this,"onRoomStateEvents",(e=>{const t=ea.c.instance.orderedLists[T.a.ServerNotice];null!=t&&t.some((t=>t.roomId===e.getRoomId()))&&this.updateServerNoticeEvents()})),i()(this,"onUsageLimitDismissed",(()=>{this.setState({usageLimitDismissed:!0})})),i()(this,"updateServerNoticeEvents",(async()=>{const e=ea.c.instance.orderedLists[T.a.ServerNotice];if(!e)return;const t=[];let a=0;for(const n of e){const e=n.currentState.getStateEvents("m.room.pinned_events","");if(!e||!e.getContent().pinned)continue;a=e.getTs();const i=e.getContent().pinned.slice(0,2);for(const e of i){const a=(await this._matrixClient.getEventTimeline(n.getUnfilteredTimelineSet(),e)).getEvents().find((t=>t.getId()===e));a&&t.push(a)}}if(a&&this.state.usageLimitEventTs>a)return;const n=t.find((e=>e&&"m.room.message"===e.getType()&&"m.server_notice.usage_limit_reached"===e.getContent().server_notice_type)),i=null==n?void 0:n.getContent();this.calculateServerLimitToast(this.state.syncErrorData,i),this.setState({usageLimitEventContent:i,usageLimitEventTs:a,usageLimitDismissed:!1})})),i()(this,"onPaste",(e=>{const t=Em(e.target);if(t!==document.activeElement)if(null!=t&&t.focus)t.focus();else{const e=!!document.activeElement.closest(".mx_ThreadView");v.a.dispatch({action:U.a.FocusSendMessageComposer,context:e?Ga.a.Thread:Ga.a.Room},!0)}})),i()(this,"onReactKeyDown",(e=>{this.onKeyDown(e)})),i()(this,"onNativeKeyDown",(e=>{e.target===document.body&&this.onKeyDown(e)})),i()(this,"onKeyDown",(e=>{let t=!1;switch(Object(J.a)().getRoomAction(e)){case W.h.ScrollUp:case W.h.ScrollDown:case W.h.JumpToFirstMessage:case W.h.JumpToLatestMessage:this.onScrollKeyPressed(e),t=!0;break;case W.h.SearchInRoom:v.a.dispatch({action:"focus_search"}),t=!0}if(t)return e.stopPropagation(),void e.preventDefault();switch(Object(J.a)().getNavigationAction(e)){case W.h.FilterRooms:v.a.dispatch({action:"focus_room_filter"}),t=!0;break;case W.h.ToggleUserMenu:v.a.fire(U.a.ToggleUserMenu),t=!0;break;case W.h.ShowKeyboardSettings:v.a.dispatch({action:U.a.ViewUserSettings,initialTabId:Ae.a.Keyboard}),t=!0;break;case W.h.GoToHome:v.a.dispatch({action:U.a.ViewHomePage}),H.b.closeCurrentModal("homeKeyboardShortcut"),t=!0;break;case W.h.ToggleSpacePanel:v.a.fire(U.a.ToggleSpacePanel),t=!0;break;case W.h.ToggleRoomSidePanel:"room_view"===this.props.page_type&&(Ia.a.instance.togglePanel(null),t=!0);break;case W.h.SelectPrevRoom:v.a.dispatch({action:U.a.ViewRoomDelta,delta:-1,unread:!1}),t=!0;break;case W.h.SelectNextRoom:v.a.dispatch({action:U.a.ViewRoomDelta,delta:1,unread:!1}),t=!0;break;case W.h.SelectPrevUnreadRoom:v.a.dispatch({action:U.a.ViewRoomDelta,delta:-1,unread:!0});break;case W.h.SelectNextUnreadRoom:v.a.dispatch({action:U.a.ViewRoomDelta,delta:1,unread:!0});break;case W.h.PreviousVisitedRoomOrSpace:I.a.get().navigateForwardBack(!0),t=!0;break;case W.h.NextVisitedRoomOrSpace:I.a.get().navigateForwardBack(!1),t=!0}if(!t){switch(Object(J.a)().getLabsAction(e)){case W.h.ToggleHiddenEventVisibility:{const e=b.b.getValueAt(f.a.DEVICE,"showHiddenEventsInTimeline",void 0,!1);b.b.setValue("showHiddenEventsInTimeline",void 0,f.a.DEVICE,!e),t=!0;break}}}if(!t&&I.a.get().overrideBrowserShortcuts()&&e.code.startsWith("Digit")&&"Digit0"!==e.code&&Object(u.c)(e)&&(v.a.dispatch({action:U.a.SwitchSpace,num:parseInt(e.code.slice(5),10)}),t=!0),t)return e.stopPropagation(),void e.preventDefault();if(!(e.key===u.b.ALT||e.key===u.b.CONTROL||e.key===u.b.META||e.key===u.b.SHIFT)&&!e.ctrlKey&&!e.metaKey){const t=e.target!==document.body&&(e.key===u.b.SPACE||e.key===u.b.ENTER),a=1===e.key.length||"Dead"===e.key;if(!t&&a&&!Em(e.target)){const t=!!document.activeElement.closest(".mx_ThreadView");v.a.dispatch({action:U.a.FocusSendMessageComposer,context:t?Ga.a.Thread:Ga.a.Room},!0),e.stopPropagation()}}})),i()(this,"onScrollKeyPressed",(e=>{var t;null===(t=this._roomView.current)||void 0===t||t.handleScrollKey(e)})),this.state={syncErrorData:void 0,useCompactLayout:b.b.getValue("useCompactLayout"),usageLimitDismissed:!1,activeCalls:B.b.instance.getAllActiveCalls()},this._matrixClient=this.props.matrixClient,p.c.loadDevices(),Object(g.a)(),this._roomView=r.a.createRef(),this._resizeContainer=r.a.createRef(),this.resizeHandler=r.a.createRef()}componentDidMount(){document.addEventListener("keydown",this.onNativeKeyDown,!1),B.b.instance.addListener(B.a.CallState,this.onCallState),this.updateServerNoticeEvents(),this._matrixClient.on(o.b.AccountData,this.onAccountData),this._matrixClient.on(o.b.Sync,this.onSync),this.onSync(this._matrixClient.getSyncState(),null,this._matrixClient.getSyncStateData()),this._matrixClient.on(m.b.Events,this.onRoomStateEvents),this.layoutWatcherRef=b.b.watchSetting("layout",null,this.onCompactLayoutChanged),this.compactLayoutWatcherRef=b.b.watchSetting("useCompactLayout",null,this.onCompactLayoutChanged),this.backgroundImageWatcherRef=b.b.watchSetting("RoomList.backgroundImage",null,this.refreshBackgroundImage),this.resizer=this.createResizer(),this.resizer.attach(),ht.a.instance.on(pt.b,this.refreshBackgroundImage),this.loadResizerPreferences(),this.refreshBackgroundImage()}componentWillUnmount(){document.removeEventListener("keydown",this.onNativeKeyDown,!1),B.b.instance.removeListener(B.a.CallState,this.onCallState),this._matrixClient.removeListener(o.b.AccountData,this.onAccountData),this._matrixClient.removeListener(o.b.Sync,this.onSync),this._matrixClient.removeListener(m.b.Events,this.onRoomStateEvents),ht.a.instance.off(pt.b,this.refreshBackgroundImage),b.b.unwatchSetting(this.layoutWatcherRef),b.b.unwatchSetting(this.compactLayoutWatcherRef),b.b.unwatchSetting(this.backgroundImageWatcherRef),this.resizer.detach()}createResizer(){let e,t;const a={toggleSize:156,onCollapsed:e=>{t=e,e?(v.a.dispatch({action:"hide_left_panel"}),window.localStorage.setItem("mx_lhs_size","0")):v.a.dispatch({action:"show_left_panel"})},onResized:t=>{e=t,this.props.resizeNotifier.notifyLeftHandleResized()},onResizeStart:()=>{this.props.resizeNotifier.startResizing()},onResizeStop:()=>{t||window.localStorage.setItem("mx_lhs_size",""+e),this.props.resizeNotifier.stopResizing()},isItemCollapsed:e=>e.classList.contains("mx_LeftPanel_minimized"),handler:this.resizeHandler.current},n=new k(this._resizeContainer.current,x,a);return n.setClassNames({handle:"mx_ResizeHandle",vertical:"mx_ResizeHandle_vertical",reverse:"mx_ResizeHandle_reverse"}),n}loadResizerPreferences(){let e=parseInt(window.localStorage.getItem("mx_lhs_size"),10);isNaN(e)&&(e=350),this.resizer.forHandleWithId("lp-resizer").resize(e)}calculateServerLimitToast(e,t){var a;const n="M_RESOURCE_LIMIT_EXCEEDED"===(null==e||null===(a=e.error)||void 0===a?void 0:a.errcode);n&&(t=(null==e?void 0:e.error).data),t&&this.state.usageLimitDismissed?((e,t,a,n)=>{const i=Object(M.a)(e,a,{monthly_active_user:Object(N.c)("Your homeserver has exceeded its user limit."),hs_blocked:Object(N.c)("This homeserver has been blocked by its administrator."),"":Object(N.c)("Your homeserver has exceeded one of its resource limits.")}),s=Object(M.a)(e,a,{"":Object(N.c)("Contact your <a>server admin</a>.")});D.a.sharedInstance().addOrReplaceToast({key:A,title:Object(N.a)("Warning"),props:{description:r.a.createElement(r.a.Fragment,null,i," ",s),acceptLabel:Object(N.a)("Ok"),onAccept:()=>{L(),t&&t()}},component:P.a,priority:70})})(t.limit_type,this.onUsageLimitDismissed,t.admin_contact):L()}render(){let e;switch(this.props.page_type){case h.a.RoomView:e=r.a.createElement(tm,{ref:this._roomView,onRegistered:this.props.onRegistered,threepidInvite:this.props.threepidInvite,oobData:this.props.roomOobData,key:this.props.currentRoomId||"roomview",resizeNotifier:this.props.resizeNotifier,justCreatedOpts:this.props.roomJustCreatedOpts,forceTimeline:this.props.forceTimeline});break;case h.a.HomePage:e=r.a.createElement(oa.a,{justRegistered:this.props.justRegistered});break;case h.a.UserView:e=r.a.createElement(nm,{userId:this.props.currentUserId,resizeNotifier:this.props.resizeNotifier})}const t=c()({mx_MatrixChat_wrapper:!0,mx_MatrixChat_useCompactLayout:this.state.useCompactLayout}),a=c()({mx_MatrixChat:!0,"mx_MatrixChat--with-avatar":this.state.backgroundImage}),n=this.state.activeCalls.map((e=>r.a.createElement(ba,{call:e,key:e.callId})));return r.a.createElement(R.a.Provider,{value:this._matrixClient},r.a.createElement("div",{onPaste:this.onPaste,onKeyDown:this.onReactKeyDown,className:t,"aria-hidden":this.props.hideToSRUsers},r.a.createElement(am,null),r.a.createElement("div",{className:a},r.a.createElement("div",{className:"mx_LeftPanel_outerWrapper"},r.a.createElement(rm,{isMinimized:this.props.collapseLhs||!1}),r.a.createElement("nav",{className:"mx_LeftPanel_wrapper"},r.a.createElement(im,{blurMultiplier:.5,backgroundImage:this.state.backgroundImage}),r.a.createElement(Nt,null),r.a.createElement(im,{backgroundImage:this.state.backgroundImage}),r.a.createElement("div",{className:"mx_LeftPanel_wrapper--user",ref:this._resizeContainer,"data-collapsed":!!this.props.collapseLhs||void 0},r.a.createElement(da,{pageType:this.props.page_type,isMinimized:this.props.collapseLhs||!1,resizeNotifier:this.props.resizeNotifier})))),r.a.createElement(y,{passRef:this.resizeHandler,id:"lp-resizer"}),r.a.createElement("div",{className:"mx_RoomView_wrapper"},e))),r.a.createElement(ym,null),r.a.createElement(ua,null),n)}}i()(_m,"displayName","LoggedInView");t.a=_m},1545:function(e,t,a){"use strict";a.d(t,"a",(function(){return Ci}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(333),l=a(121),c=a(271),d=a(1),m=a(136),u=a(122),h=a(139),p=a(267),g=a(127),v=a(144),b=a(166),f=a(123),y=a(849),E=a(260),_=a(291),w=a(159);class S extends r.a.Component{constructor(e){var t,a,n;super(e),i()(this,"avatarUpload",Object(s.createRef)()),i()(this,"uploadAvatar",(()=>{var e;null===(e=this.avatarUpload.current)||void 0===e||e.click()})),i()(this,"removeAvatar",(()=>{this.avatarUpload.current.value="",this.setState({avatarUrl:void 0,avatarFile:null,enableProfileSave:!0})})),i()(this,"cancelProfileChanges",(async e=>{var t;e.stopPropagation(),e.preventDefault(),this.state.enableProfileSave&&this.setState({enableProfileSave:!1,displayName:this.state.originalDisplayName,avatarUrl:null!==(t=this.state.originalAvatarUrl)&&void 0!==t?t:void 0,avatarFile:null})})),i()(this,"saveProfile",(async e=>{if(e.stopPropagation(),e.preventDefault(),!this.state.enableProfileSave)return;this.setState({enableProfileSave:!1});const t=u.a.get(),a={},n=this.state.displayName.trim();try{if(this.state.originalDisplayName!==this.state.displayName&&(await t.setDisplayName(n),a.originalDisplayName=n,a.displayName=n),this.state.avatarFile){var i;d.a.log(`Uploading new avatar, ${this.state.avatarFile.name} of type ${this.state.avatarFile.type}, (${this.state.avatarFile.size}) bytes`);const{content_uri:e}=await t.uploadContent(this.state.avatarFile);await t.setAvatarUrl(e),a.avatarUrl=null!==(i=Object(b.b)(e).getSquareThumbnailHttp(96))&&void 0!==i?i:void 0,a.originalAvatarUrl=a.avatarUrl,a.avatarFile=null}else this.state.originalAvatarUrl!==this.state.avatarUrl&&await t.setAvatarUrl("")}catch(e){d.a.log("Failed to save profile",e),g.b.createDialog(v.a,{title:Object(l.a)("Failed to save your profile"),description:e&&e.message?e.message:Object(l.a)("The operation could not be completed")})}this.setState(a)})),i()(this,"onDisplayNameChanged",(e=>{this.setState({displayName:e.target.value,enableProfileSave:!0})})),i()(this,"onAvatarChanged",(e=>{var t;if(!e.target.files||!e.target.files.length)return void this.setState({avatarUrl:null!==(t=this.state.originalAvatarUrl)&&void 0!==t?t:void 0,avatarFile:null,enableProfileSave:!1});const a=e.target.files[0],n=new FileReader;n.onload=e=>{var t;this.setState({avatarUrl:null===(t=e.target)||void 0===t?void 0:t.result,avatarFile:a,enableProfileSave:!0})},n.readAsDataURL(a)}));const r=u.a.get();let o=p.a.instance.avatarMxc;o&&(o=Object(b.b)(o).getSquareThumbnailHttp(96)),this.state={userId:r.getUserId(),originalDisplayName:null!==(t=p.a.instance.displayName)&&void 0!==t?t:"",displayName:null!==(a=p.a.instance.displayName)&&void 0!==a?a:"",originalAvatarUrl:o,avatarUrl:null!==(n=o)&&void 0!==n?n:void 0,avatarFile:null,enableProfileSave:!1}}render(){var e;const t=E.a.getDisplayUserIdentifier(this.state.userId,{withDisplayName:!0}),a=null===(e=this.state.avatarUrl)||void 0===e?void 0:e.toString();return r.a.createElement("form",{onSubmit:this.saveProfile,autoComplete:"off",noValidate:!0,className:"mx_ProfileSettings"},r.a.createElement("input",{type:"file",ref:this.avatarUpload,className:"mx_ProfileSettings_avatarUpload",onClick:e=>{Object(_.a)(e),w.b.trackInteraction("WebProfileSettingsAvatarUploadButton",e)},onChange:this.onAvatarChanged,accept:"image/*"}),r.a.createElement("div",{className:"mx_ProfileSettings_profile"},r.a.createElement("div",{className:"mx_ProfileSettings_profile_controls"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Profile")),r.a.createElement(h.a,{label:Object(l.a)("Display Name"),type:"text",value:this.state.displayName,autoComplete:"off",onChange:this.onDisplayNameChanged}),r.a.createElement("p",null,t&&r.a.createElement("span",{className:"mx_ProfileSettings_profile_controls_userId"},t))),r.a.createElement(y.a,{avatarUrl:a,avatarName:this.state.displayName||this.state.userId,avatarAltText:Object(l.a)("Profile picture"),uploadAvatar:this.uploadAvatar,removeAvatar:this.removeAvatar})),r.a.createElement("div",{className:"mx_ProfileSettings_buttons"},r.a.createElement(f.a,{onClick:this.cancelProfileChanges,kind:"link",disabled:!this.state.enableProfileSave},Object(l.a)("Cancel")),r.a.createElement(f.a,{onClick:this.saveProfile,kind:"primary",disabled:!this.state.enableProfileSave},Object(l.a)("Save"))))}}var O=a(125),C=a(902),x=a(279),j=a(157),k=a(134);class R extends r.a.Component{constructor(e){super(e),this.onSearchChange=this.onSearchChange.bind(this),this.state={searchQuery:"",languages:null}}componentDidMount(){const e=j.a.get();e&&e.getAvailableSpellCheckLanguages().then((e=>{e.sort((function(e,t){return e<t?-1:e>t?1:0}));const t=[];e.forEach((e=>{t.push({label:e,value:e})})),this.setState({languages:t})})).catch((e=>{this.setState({languages:[{value:"en",label:"English"}]})}))}onSearchChange(e){this.setState({searchQuery:e})}render(){if(null===this.state.languages)return r.a.createElement(k.a,null);let e;e=this.state.searchQuery?this.state.languages.filter((e=>function(e,t){return!!t.label.toUpperCase().includes(e.toUpperCase())||t.value.toUpperCase()===e.toUpperCase()}(this.state.searchQuery,e))):this.state.languages;const t=e.map((e=>r.a.createElement("div",{key:e.value},e.label)));let a=O.b.getValue("language",null,!0),n=null;return a||(a=navigator.language||navigator.userLanguage),n=this.props.value||a,r.a.createElement(x.a,{id:"mx_LanguageDropdown",className:this.props.className,onOptionChange:this.props.onOptionChange,onSearchChange:this.onSearchChange,searchEnabled:!0,value:n,label:Object(l.a)("Language Dropdown"),placeholder:Object(l.a)("Choose a locale")},t)}}class I extends r.a.Component{constructor(){super(...arguments),i()(this,"onRemove",(e=>(e.stopPropagation(),e.preventDefault(),this.props.onRemoved(this.props.language))))}render(){return r.a.createElement("div",{className:"mx_ExistingSpellCheckLanguage"},r.a.createElement("span",{className:"mx_ExistingSpellCheckLanguage_language"},this.props.language),r.a.createElement(f.a,{onClick:this.onRemove,kind:"danger_sm"},Object(l.a)("Remove")))}}class T extends r.a.Component{constructor(e){super(e),i()(this,"onRemoved",(e=>{const t=this.props.languages.filter((t=>t!==e));this.props.onLanguagesChange(t)})),i()(this,"onAddClick",(e=>{e.stopPropagation(),e.preventDefault();const t=this.state.newLanguage;this.setState({newLanguage:""}),t&&(this.props.languages.includes(t)||(this.props.languages.push(t),this.props.onLanguagesChange(this.props.languages)))})),i()(this,"onNewLanguageChange",(e=>{this.state.newLanguage!==e&&this.setState({newLanguage:e})})),this.state={newLanguage:""}}render(){const e=this.props.languages.map((e=>r.a.createElement(I,{language:e,onRemoved:this.onRemoved,key:e}))),t=r.a.createElement(f.a,{onClick:this.onAddClick,kind:"primary"},Object(l.a)("Add"));return r.a.createElement("div",{className:"mx_SpellCheckLanguages"},e,r.a.createElement("form",{onSubmit:this.onAddClick,noValidate:!0},r.a.createElement(R,{className:"mx_GeneralUserSettingsTab_spellCheckLanguageInput",value:this.state.newLanguage,onOptionChange:this.onNewLanguageChange}),t))}}var N=a(520),P=a(319),D=a(177),M=a(135),A=a(124),L=a(128);class U extends r.a.Component{constructor(e){super(e),i()(this,"onStagePhaseChange",((e,t)=>{const a={[P.c.PHASE_PREAUTH]:{body:Object(l.a)("Confirm your account deactivation by using Single Sign On to prove your identity."),continueText:Object(l.a)("Single Sign On"),continueKind:"danger"},[P.c.PHASE_POSTAUTH]:{body:Object(l.a)("Are you sure you want to deactivate your account? This is irreversible."),continueText:Object(l.a)("Confirm account deactivation"),continueKind:"danger"}},n={[P.c.LOGIN_TYPE]:a,[P.c.UNSTABLE_LOGIN_TYPE]:a,[P.b.LOGIN_TYPE]:{[P.a]:{body:Object(l.a)("To continue, please enter your account password:")}}}[e];let i,s,r;if(n){const e=n[t];e&&(e.body&&(i=e.body),e.continueText&&(s=e.continueText),e.continueKind&&(r=e.continueKind))}this.setState({bodyText:i,continueText:s,continueKind:r})})),i()(this,"onUIAuthFinished",((e,t)=>{e||(t!==N.a?(d.a.error("Error during UI Auth:",{result:t}),this.setState({errStr:Object(l.a)("There was a problem communicating with the server. Please try again.")})):this.onCancel())})),i()(this,"onUIAuthComplete",(e=>{u.a.get().deactivateAccount(e,this.state.shouldErase).then((e=>{A.a.fire(L.a.TriggerLogout),this.props.onFinished(!0)})).catch((e=>{d.a.error(e),this.setState({errStr:Object(l.a)("There was a problem communicating with the server. Please try again.")})}))})),i()(this,"onEraseFieldChange",(e=>{this.setState({shouldErase:e.currentTarget.checked,authEnabled:!1}),this.initAuth(e.currentTarget.checked)})),this.state={shouldErase:!1,errStr:null,authData:null,authEnabled:!0},this.initAuth(!1)}onCancel(){this.props.onFinished(!1)}initAuth(e){u.a.get().deactivateAccount(null,e).then((e=>{d.a.warn("User's account got deactivated without confirmation: Server had no auth"),this.setState({errStr:Object(l.a)("Server did not require any authentication")})})).catch((e=>{e&&401===e.httpStatus&&e.data?this.setState({authData:e.data,authEnabled:!0}):this.setState({errStr:Object(l.a)("Server did not return valid authentication information.")})}))}render(){let e;this.state.errStr&&(e=r.a.createElement("div",{className:"error"},this.state.errStr));let t=r.a.createElement("div",null,Object(l.a)("Loading…"));return this.state.authData&&this.state.authEnabled&&(t=r.a.createElement("div",null,this.state.bodyText,r.a.createElement(N.b,{matrixClient:u.a.get(),authData:this.state.authData,makeRequest:this.onUIAuthComplete,onAuthFinished:this.onUIAuthFinished,onStagePhaseChange:this.onStagePhaseChange,continueText:this.state.continueText,continueKind:this.state.continueKind}))),r.a.createElement(M.a,{className:"mx_DeactivateAccountDialog",onFinished:this.props.onFinished,titleClass:"danger",title:Object(l.a)("Deactivate Account"),screenName:"DeactivateAccount"},r.a.createElement("div",{className:"mx_Dialog_content"},r.a.createElement("p",null,Object(l.a)("Confirm that you would like to deactivate your account. If you proceed:")),r.a.createElement("ul",null,r.a.createElement("li",null,Object(l.a)("You will not be able to reactivate your account")),r.a.createElement("li",null,Object(l.a)("You will no longer be able to log in")),r.a.createElement("li",null,Object(l.a)("No one will be able to reuse your username (MXID), including you: this username will remain unavailable")),r.a.createElement("li",null,Object(l.a)("You will leave all rooms and DMs that you are in")),r.a.createElement("li",null,Object(l.a)("You will be removed from the identity server: your friends will no longer be able to find you with your email or phone number"))),r.a.createElement("p",null,Object(l.a)("Your old messages will still be visible to people who received them, just like emails you sent in the past. Would you like to hide your sent messages from people who join rooms in the future?")),r.a.createElement("div",{className:"mx_DeactivateAccountDialog_input_section"},r.a.createElement("p",null,r.a.createElement(D.b,{checked:this.state.shouldErase,onChange:this.onEraseFieldChange},Object(l.a)("Hide my messages from new joiners"))),e,t)))}}var F=a(498),B=a(289),V=a(366);async function W(e,t){const a=e.getUserId();let{threepids:n}=await e.getThreePids();if(t&&(n=n.filter((e=>e.medium===t))),n.length>0&&e.getIdentityServerUrl())try{const i=new B.a,s=await i.getAccessToken({check:!1}),r=n.map((e=>{let{medium:t,address:a}=e;return[t,a]})),o=await e.bulkLookupThreePids(r,s);for(const[e,i,s]of o.threepids){if(s!==a)continue;if(t&&e!==t)continue;const r=n.find((t=>t.medium===e&&t.address===i));r&&(r.bound=!0)}}catch(e){if("M_TERMS_NOT_SIGNED"!==e.errcode)throw e}return n}var H=a(137),z=a(156);let G;!function(e){e.Email="email",e.Phone="msisdn"}(G||(G={}));var K=a(256);function q(){return u.a.get().idBaseUrl.split("://")[1]}class ${constructor(){i()(this,"sessionId",void 0),i()(this,"submitUrl",void 0),i()(this,"clientSecret",void 0),i()(this,"bind",void 0),i()(this,"makeAddThreepidOnlyRequest",(e=>u.a.get().addThreePidOnly({sid:this.sessionId,client_secret:this.clientSecret,auth:e}))),this.clientSecret=u.a.get().generateClientSecret()}addEmailAddress(e){return u.a.get().requestAdd3pidEmailToken(e,this.clientSecret,1).then((e=>(this.sessionId=e.sid,e)),(function(e){throw"M_THREEPID_IN_USE"===e.errcode?e.message=Object(l.a)("This email address is already in use"):e.httpStatus&&(e.message=e.message+` (Status ${e.httpStatus})`),e}))}async bindEmailAddress(e){if(this.bind=!0,await u.a.get().doesServerSupportSeparateAddAndBind()){var t;const a=new B.a,n=null!==(t=await a.getAccessToken())&&void 0!==t?t:void 0;return u.a.get().requestEmailToken(e,this.clientSecret,1,void 0,n).then((e=>(this.sessionId=e.sid,e)),(function(e){throw"M_THREEPID_IN_USE"===e.errcode?e.message=Object(l.a)("This email address is already in use"):e.httpStatus&&(e.message=e.message+` (Status ${e.httpStatus})`),e}))}return this.addEmailAddress(e)}addMsisdn(e,t){return u.a.get().requestAdd3pidMsisdnToken(e,t,this.clientSecret,1).then((e=>(this.sessionId=e.sid,this.submitUrl=e.submit_url,e)),(function(e){throw"M_THREEPID_IN_USE"===e.errcode?e.message=Object(l.a)("This phone number is already in use"):e.httpStatus&&(e.message=e.message+` (Status ${e.httpStatus})`),e}))}async bindMsisdn(e,t){if(this.bind=!0,await u.a.get().doesServerSupportSeparateAddAndBind()){var a;const n=new B.a,i=null!==(a=await n.getAccessToken())&&void 0!==a?a:void 0;return u.a.get().requestMsisdnToken(e,t,this.clientSecret,1,void 0,i).then((e=>(this.sessionId=e.sid,e)),(function(e){throw"M_THREEPID_IN_USE"===e.errcode?e.message=Object(l.a)("This phone number is already in use"):e.httpStatus&&(e.message=e.message+` (Status ${e.httpStatus})`),e}))}return this.addMsisdn(e,t)}async checkEmailLinkClicked(){try{if(await u.a.get().doesServerSupportSeparateAddAndBind())if(this.bind){const e=new B.a,t=await e.getAccessToken();await u.a.get().bindThreePid({sid:this.sessionId,client_secret:this.clientSecret,id_server:q(),id_access_token:t})}else try{return await this.makeAddThreepidOnlyRequest(),[!0]}catch(e){if(401!==e.httpStatus||!e.data||!e.data.flows)throw e;const t={[P.c.PHASE_PREAUTH]:{title:Object(l.a)("Use Single Sign On to continue"),body:Object(l.a)("Confirm adding this email address by using Single Sign On to prove your identity."),continueText:Object(l.a)("Single Sign On"),continueKind:"primary"},[P.c.PHASE_POSTAUTH]:{title:Object(l.a)("Confirm adding email"),body:Object(l.a)("Click the button below to confirm adding this email address."),continueText:Object(l.a)("Confirm"),continueKind:"primary"}},{finished:a}=g.b.createDialog(K.a,{title:Object(l.a)("Add Email Address"),matrixClient:u.a.get(),authData:e.data,makeRequest:this.makeAddThreepidOnlyRequest,aestheticsForStagePhases:{[P.c.LOGIN_TYPE]:t,[P.c.UNSTABLE_LOGIN_TYPE]:t}});return a}else await u.a.get().addThreePid({sid:this.sessionId,client_secret:this.clientSecret,id_server:q()},this.bind)}catch(e){throw 401===e.httpStatus?e.message=Object(l.a)("Failed to verify email address: make sure you clicked the link in the email"):e.httpStatus&&(e.message+=` (Status ${e.httpStatus})`),e}return[]}async haveMsisdnToken(e){const t=new B.a,a=await u.a.get().doesServerSupportSeparateAddAndBind();let n;if(this.submitUrl)n=await u.a.get().submitMsisdnTokenOtherUrl(this.submitUrl,this.sessionId,this.clientSecret,e);else{if(!this.bind&&a)throw new Error("The add / bind with MSISDN flow is misconfigured");n=await u.a.get().submitMsisdnToken(this.sessionId,this.clientSecret,e,await t.getAccessToken())}if(n.errcode)throw n;if(a)if(this.bind)await u.a.get().bindThreePid({sid:this.sessionId,client_secret:this.clientSecret,id_server:q(),id_access_token:await t.getAccessToken()});else try{return void await this.makeAddThreepidOnlyRequest()}catch(e){if(401!==e.httpStatus||!e.data||!e.data.flows)throw e;const t={[P.c.PHASE_PREAUTH]:{title:Object(l.a)("Use Single Sign On to continue"),body:Object(l.a)("Confirm adding this phone number by using Single Sign On to prove your identity."),continueText:Object(l.a)("Single Sign On"),continueKind:"primary"},[P.c.PHASE_POSTAUTH]:{title:Object(l.a)("Confirm adding phone number"),body:Object(l.a)("Click the button below to confirm adding this phone number."),continueText:Object(l.a)("Confirm"),continueKind:"primary"}},{finished:a}=g.b.createDialog(K.a,{title:Object(l.a)("Add Phone Number"),matrixClient:u.a.get(),authData:e.data,makeRequest:this.makeAddThreepidOnlyRequest,aestheticsForStagePhases:{[P.c.LOGIN_TYPE]:t,[P.c.UNSTABLE_LOGIN_TYPE]:t}});return a}else await u.a.get().addThreePid({sid:this.sessionId,client_secret:this.clientSecret,id_server:q()},this.bind)}}var Y=a(638);class J extends r.a.Component{constructor(e){super(e),i()(this,"onRemove",(e=>{e.stopPropagation(),e.preventDefault(),this.setState({verifyRemove:!0})})),i()(this,"onDontRemove",(e=>{e.stopPropagation(),e.preventDefault(),this.setState({verifyRemove:!1})})),i()(this,"onActuallyRemove",(e=>{e.stopPropagation(),e.preventDefault(),u.a.get().deleteThreePid(this.props.msisdn.medium,this.props.msisdn.address).then((()=>this.props.onRemoved(this.props.msisdn))).catch((e=>{d.a.error("Unable to remove contact information: "+e),g.b.createDialog(v.a,{title:Object(l.a)("Unable to remove contact information"),description:e&&e.message?e.message:Object(l.a)("Operation failed")})}))})),this.state={verifyRemove:!1}}render(){return this.state.verifyRemove?r.a.createElement("div",{className:"mx_ExistingPhoneNumber"},r.a.createElement("span",{className:"mx_ExistingPhoneNumber_promptText"},Object(l.a)("Remove %(phone)s?",{phone:this.props.msisdn.address})),r.a.createElement(f.a,{onClick:this.onActuallyRemove,kind:"danger_sm",className:"mx_ExistingPhoneNumber_confirmBtn"},Object(l.a)("Remove")),r.a.createElement(f.a,{onClick:this.onDontRemove,kind:"link_sm",className:"mx_ExistingPhoneNumber_confirmBtn"},Object(l.a)("Cancel"))):r.a.createElement("div",{className:"mx_ExistingPhoneNumber"},r.a.createElement("span",{className:"mx_ExistingPhoneNumber_address"},"+",this.props.msisdn.address),r.a.createElement(f.a,{onClick:this.onRemove,kind:"danger_sm"},Object(l.a)("Remove")))}}class Q extends r.a.Component{constructor(e){super(e),i()(this,"onRemoved",(e=>{const t=this.props.msisdns.filter((t=>t!==e));this.props.onMsisdnsChange(t)})),i()(this,"onChangeNewPhoneNumber",(e=>{this.setState({newPhoneNumber:e.target.value})})),i()(this,"onChangeNewPhoneNumberCode",(e=>{this.setState({newPhoneNumberCode:e.target.value})})),i()(this,"onAddClick",(e=>{if(e.stopPropagation(),e.preventDefault(),!this.state.newPhoneNumber)return;const t=this.state.newPhoneNumber,a=this.state.phoneCountry,n=new $;this.setState({verifying:!0,continueDisabled:!0,addTask:n}),n.addMsisdn(a,t).then((e=>{this.setState({continueDisabled:!1,verifyMsisdn:e.msisdn})})).catch((e=>{d.a.error("Unable to add phone number "+t+" "+e),this.setState({verifying:!1,continueDisabled:!1,addTask:null}),g.b.createDialog(v.a,{title:Object(l.a)("Error"),description:e&&e.message?e.message:Object(l.a)("Operation failed")})}))})),i()(this,"onContinueClick",(e=>{e.stopPropagation(),e.preventDefault(),this.setState({continueDisabled:!0});const t=this.state.newPhoneNumberCode,a=this.state.verifyMsisdn;this.state.addTask.haveMsisdnToken(t).then((e=>{let[t]=e,n=this.state.newPhoneNumber;if(t){const e=[...this.props.msisdns,{address:a,medium:G.Phone}];this.props.onMsisdnsChange(e),n=""}this.setState({addTask:null,continueDisabled:!1,verifying:!1,verifyMsisdn:"",verifyError:null,newPhoneNumber:n,newPhoneNumberCode:""})})).catch((e=>{this.setState({continueDisabled:!1}),"M_THREEPID_AUTH_FAILED"!==e.errcode?(d.a.error("Unable to verify phone number: "+e),g.b.createDialog(v.a,{title:Object(l.a)("Unable to verify phone number."),description:e&&e.message?e.message:Object(l.a)("Operation failed")})):this.setState({verifyError:Object(l.a)("Incorrect verification code")})}))})),i()(this,"onCountryChanged",(e=>{this.setState({phoneCountry:e.iso2})})),this.state={verifying:!1,verifyError:null,verifyMsisdn:"",addTask:null,continueDisabled:!1,phoneCountry:"",newPhoneNumber:"",newPhoneNumberCode:""}}render(){const e=this.props.msisdns.map((e=>r.a.createElement(J,{msisdn:e,onRemoved:this.onRemoved,key:e.address})));let t=r.a.createElement(f.a,{onClick:this.onAddClick,kind:"primary"},Object(l.a)("Add"));if(this.state.verifying){const e=this.state.verifyMsisdn;t=r.a.createElement("div",null,r.a.createElement("div",null,Object(l.a)("A text message has been sent to +%(msisdn)s. Please enter the verification code it contains.",{msisdn:e}),r.a.createElement("br",null),this.state.verifyError),r.a.createElement("form",{onSubmit:this.onContinueClick,autoComplete:"off",noValidate:!0},r.a.createElement(h.a,{type:"text",label:Object(l.a)("Verification code"),autoComplete:"off",disabled:this.state.continueDisabled,value:this.state.newPhoneNumberCode,onChange:this.onChangeNewPhoneNumberCode}),r.a.createElement(f.a,{onClick:this.onContinueClick,kind:"primary",disabled:this.state.continueDisabled||0===this.state.newPhoneNumberCode.length},Object(l.a)("Continue"))))}const a=r.a.createElement(Y.a,{onOptionChange:this.onCountryChanged,className:"mx_PhoneNumbers_country",value:this.state.phoneCountry,disabled:this.state.verifying,isSmall:!0,showPrefix:!0});return r.a.createElement("div",{className:"mx_PhoneNumbers"},e,r.a.createElement("form",{onSubmit:this.onAddClick,autoComplete:"off",noValidate:!0,className:"mx_PhoneNumbers_new"},r.a.createElement("div",{className:"mx_PhoneNumbers_input"},r.a.createElement(h.a,{type:"text",label:Object(l.a)("Phone Number"),autoComplete:"off",disabled:this.state.verifying,prefixComponent:a,value:this.state.newPhoneNumber,onChange:this.onChangeNewPhoneNumber}))),t)}}var X=a(325);class Z extends r.a.Component{constructor(e){super(e),i()(this,"onRemove",(e=>{e.stopPropagation(),e.preventDefault(),this.setState({verifyRemove:!0})})),i()(this,"onDontRemove",(e=>{e.stopPropagation(),e.preventDefault(),this.setState({verifyRemove:!1})})),i()(this,"onActuallyRemove",(e=>{e.stopPropagation(),e.preventDefault(),u.a.get().deleteThreePid(this.props.email.medium,this.props.email.address).then((()=>this.props.onRemoved(this.props.email))).catch((e=>{d.a.error("Unable to remove contact information: "+e),g.b.createDialog(v.a,{title:Object(l.a)("Unable to remove contact information"),description:e&&e.message?e.message:Object(l.a)("Operation failed")})}))})),this.state={verifyRemove:!1}}render(){return this.state.verifyRemove?r.a.createElement("div",{className:"mx_ExistingEmailAddress"},r.a.createElement("span",{className:"mx_ExistingEmailAddress_promptText"},Object(l.a)("Remove %(email)s?",{email:this.props.email.address})),r.a.createElement(f.a,{onClick:this.onActuallyRemove,kind:"danger_sm",className:"mx_ExistingEmailAddress_confirmBtn"},Object(l.a)("Remove")),r.a.createElement(f.a,{onClick:this.onDontRemove,kind:"link_sm",className:"mx_ExistingEmailAddress_confirmBtn"},Object(l.a)("Cancel"))):r.a.createElement("div",{className:"mx_ExistingEmailAddress"},r.a.createElement("span",{className:"mx_ExistingEmailAddress_email"},this.props.email.address),r.a.createElement(f.a,{onClick:this.onRemove,kind:"danger_sm"},Object(l.a)("Remove")))}}class ee extends r.a.Component{constructor(e){super(e),i()(this,"onRemoved",(e=>{const t=this.props.emails.filter((t=>t!==e));this.props.onEmailsChange(t)})),i()(this,"onChangeNewEmailAddress",(e=>{this.setState({newEmailAddress:e.target.value})})),i()(this,"onAddClick",(e=>{if(e.stopPropagation(),e.preventDefault(),!this.state.newEmailAddress)return;const t=this.state.newEmailAddress;if(!X.a(t))return void g.b.createDialog(v.a,{title:Object(l.a)("Invalid Email Address"),description:Object(l.a)("This doesn't appear to be a valid email address")});const a=new $;this.setState({verifying:!0,continueDisabled:!0,addTask:a}),a.addEmailAddress(t).then((()=>{this.setState({continueDisabled:!1})})).catch((e=>{d.a.error("Unable to add email address "+t+" "+e),this.setState({verifying:!1,continueDisabled:!1,addTask:null}),g.b.createDialog(v.a,{title:Object(l.a)("Unable to add email address"),description:e&&e.message?e.message:Object(l.a)("Operation failed")})}))})),i()(this,"onContinueClick",(e=>{var t;e.stopPropagation(),e.preventDefault(),this.setState({continueDisabled:!0}),null===(t=this.state.addTask)||void 0===t||t.checkEmailLinkClicked().then((e=>{let[t]=e,a=this.state.newEmailAddress;if(t){const e=this.state.newEmailAddress,t=[...this.props.emails,{address:e,medium:G.Email}];this.props.onEmailsChange(t),a=""}this.setState({addTask:null,continueDisabled:!1,verifying:!1,newEmailAddress:a})})).catch((e=>{this.setState({continueDisabled:!1}),"M_THREEPID_AUTH_FAILED"===e.errcode?g.b.createDialog(v.a,{title:Object(l.a)("Your email address hasn't been verified yet"),description:Object(l.a)("Click the link in the email you received to verify and then click continue again.")}):(d.a.error("Unable to verify email address: ",e),g.b.createDialog(v.a,{title:Object(l.a)("Unable to verify email address."),description:e&&e.message?e.message:Object(l.a)("Operation failed")}))}))})),this.state={verifying:!1,addTask:null,continueDisabled:!1,newEmailAddress:""}}render(){const e=this.props.emails.map((e=>r.a.createElement(Z,{email:e,onRemoved:this.onRemoved,key:e.address})));let t=r.a.createElement(f.a,{onClick:this.onAddClick,kind:"primary"},Object(l.a)("Add"));return this.state.verifying&&(t=r.a.createElement("div",null,r.a.createElement("div",null,Object(l.a)("We've sent you an email to verify your address. Please follow the instructions there and then click the button below.")),r.a.createElement(f.a,{onClick:this.onContinueClick,kind:"primary",disabled:this.state.continueDisabled},Object(l.a)("Continue")))),r.a.createElement("div",{className:"mx_EmailAddresses"},e,r.a.createElement("form",{onSubmit:this.onAddClick,autoComplete:"off",noValidate:!0,className:"mx_EmailAddresses_new"},r.a.createElement(h.a,{type:"text",label:Object(l.a)("Email Address"),autoComplete:"off",disabled:this.state.verifying,value:this.state.newEmailAddress,onChange:this.onChangeNewEmailAddress}),t))}}class te extends r.a.Component{constructor(e){super(e),i()(this,"onRevokeClick",(e=>{e.stopPropagation(),e.preventDefault(),this.changeBinding({bind:!1,label:"revoke",errorTitle:Object(l.a)("Unable to revoke sharing for email address")})})),i()(this,"onShareClick",(e=>{e.stopPropagation(),e.preventDefault(),this.changeBinding({bind:!0,label:"share",errorTitle:Object(l.a)("Unable to share email address")})})),i()(this,"onContinueClick",(async e=>{e.stopPropagation(),e.preventDefault(),this.setState({continueDisabled:!0});try{var t;await(null===(t=this.state.addTask)||void 0===t?void 0:t.checkEmailLinkClicked()),this.setState({addTask:null,continueDisabled:!1,verifying:!1})}catch(e){this.setState({continueDisabled:!1}),"M_THREEPID_AUTH_FAILED"===e.errcode?g.b.createDialog(v.a,{title:Object(l.a)("Your email address hasn't been verified yet"),description:Object(l.a)("Click the link in the email you received to verify and then click continue again.")}):(d.a.error("Unable to verify email address: "+e),g.b.createDialog(v.a,{title:Object(l.a)("Unable to verify email address."),description:e&&e.message?e.message:Object(l.a)("Operation failed")}))}}));const{bound:t}=e.email;this.state={verifying:!1,addTask:null,continueDisabled:!1,bound:t}}componentDidUpdate(e){if(this.props.email!==e.email){const{bound:e}=this.props.email;this.setState({bound:e})}}async changeBinding(e){let{bind:t,label:a,errorTitle:n}=e;if(!await u.a.get().doesServerSupportSeparateAddAndBind())return this.changeBindingTangledAddBind({bind:t,label:a,errorTitle:n});const{medium:i,address:s}=this.props.email;try{if(t){const e=new $;this.setState({verifying:!0,continueDisabled:!0,addTask:e}),await e.bindEmailAddress(s),this.setState({continueDisabled:!1})}else await u.a.get().unbindThreePid(i,s);this.setState({bound:t})}catch(e){d.a.error(`Unable to ${a} email address ${s} ${e}`),this.setState({verifying:!1,continueDisabled:!1,addTask:null}),g.b.createDialog(v.a,{title:n,description:e&&e.message?e.message:Object(l.a)("Operation failed")})}}async changeBindingTangledAddBind(e){let{bind:t,label:a,errorTitle:n}=e;const{medium:i,address:s}=this.props.email,r=new $;this.setState({verifying:!0,continueDisabled:!0,addTask:r});try{await u.a.get().deleteThreePid(i,s),t?await r.bindEmailAddress(s):await r.addEmailAddress(s),this.setState({continueDisabled:!1,bound:t})}catch(e){d.a.error(`Unable to ${a} email address ${s} ${e}`),this.setState({verifying:!1,continueDisabled:!1,addTask:null}),g.b.createDialog(v.a,{title:n,description:e&&e.message?e.message:Object(l.a)("Operation failed")})}}render(){const{address:e}=this.props.email,{verifying:t,bound:a}=this.state;let n;return n=t?r.a.createElement("span",null,Object(l.a)("Verify the link in your inbox"),r.a.createElement(f.a,{className:"mx_ExistingEmailAddress_confirmBtn",kind:"primary_sm",onClick:this.onContinueClick,disabled:this.state.continueDisabled},Object(l.a)("Complete"))):a?r.a.createElement(f.a,{className:"mx_ExistingEmailAddress_confirmBtn",kind:"danger_sm",onClick:this.onRevokeClick},Object(l.a)("Revoke")):r.a.createElement(f.a,{className:"mx_ExistingEmailAddress_confirmBtn",kind:"primary_sm",onClick:this.onShareClick},Object(l.a)("Share")),r.a.createElement("div",{className:"mx_ExistingEmailAddress"},r.a.createElement("span",{className:"mx_ExistingEmailAddress_email"},e),n)}}class ae extends r.a.Component{render(){let e;return e=this.props.emails.length>0?this.props.emails.map((e=>r.a.createElement(te,{email:e,key:e.address}))):r.a.createElement("span",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("Discovery options will appear once you have added an email above.")),r.a.createElement("div",{className:"mx_EmailAddresses"},e)}}class ne extends r.a.Component{constructor(e){super(e),i()(this,"onRevokeClick",(e=>{e.stopPropagation(),e.preventDefault(),this.changeBinding({bind:!1,label:"revoke",errorTitle:Object(l.a)("Unable to revoke sharing for phone number")})})),i()(this,"onShareClick",(e=>{e.stopPropagation(),e.preventDefault(),this.changeBinding({bind:!0,label:"share",errorTitle:Object(l.a)("Unable to share phone number")})})),i()(this,"onVerificationCodeChange",(e=>{this.setState({verificationCode:e.target.value})})),i()(this,"onContinueClick",(async e=>{e.stopPropagation(),e.preventDefault(),this.setState({continueDisabled:!0});const t=this.state.verificationCode;try{var a;await(null===(a=this.state.addTask)||void 0===a?void 0:a.haveMsisdnToken(t)),this.setState({addTask:null,continueDisabled:!1,verifying:!1,verifyError:null,verificationCode:""})}catch(e){this.setState({continueDisabled:!1}),"M_THREEPID_AUTH_FAILED"!==e.errcode?(d.a.error("Unable to verify phone number: "+e),g.b.createDialog(v.a,{title:Object(l.a)("Unable to verify phone number."),description:e&&e.message?e.message:Object(l.a)("Operation failed")})):this.setState({verifyError:Object(l.a)("Incorrect verification code")})}}));const{bound:t}=e.msisdn;this.state={verifying:!1,verificationCode:"",addTask:null,continueDisabled:!1,bound:t,verifyError:null}}componentDidUpdate(e){if(this.props.msisdn!==e.msisdn){const{bound:e}=this.props.msisdn;this.setState({bound:e})}}async changeBinding(e){let{bind:t,label:a,errorTitle:n}=e;if(!await u.a.get().doesServerSupportSeparateAddAndBind())return this.changeBindingTangledAddBind({bind:t,label:a,errorTitle:n});const{medium:i,address:s}=this.props.msisdn;try{if(t){const e=new $;this.setState({verifying:!0,continueDisabled:!0,addTask:e}),await e.bindMsisdn(null,`+${s}`),this.setState({continueDisabled:!1})}else await u.a.get().unbindThreePid(i,s);this.setState({bound:t})}catch(e){d.a.error(`Unable to ${a} phone number ${s} ${e}`),this.setState({verifying:!1,continueDisabled:!1,addTask:null}),g.b.createDialog(v.a,{title:n,description:e&&e.message?e.message:Object(l.a)("Operation failed")})}}async changeBindingTangledAddBind(e){let{bind:t,label:a,errorTitle:n}=e;const{medium:i,address:s}=this.props.msisdn,r=new $;this.setState({verifying:!0,continueDisabled:!0,addTask:r});try{await u.a.get().deleteThreePid(i,s),t?await r.bindMsisdn(null,`+${s}`):await r.addMsisdn(null,`+${s}`),this.setState({continueDisabled:!1,bound:t})}catch(e){d.a.error(`Unable to ${a} phone number ${s} ${e}`),this.setState({verifying:!1,continueDisabled:!1,addTask:null}),g.b.createDialog(v.a,{title:n,description:e&&e.message?e.message:Object(l.a)("Operation failed")})}}render(){const{address:e}=this.props.msisdn,{verifying:t,bound:a}=this.state;let n;return n=t?r.a.createElement("span",{className:"mx_ExistingPhoneNumber_verification"},r.a.createElement("span",null,Object(l.a)("Please enter verification code sent via text."),r.a.createElement("br",null),this.state.verifyError),r.a.createElement("form",{onSubmit:this.onContinueClick,autoComplete:"off",noValidate:!0},r.a.createElement(h.a,{type:"text",label:Object(l.a)("Verification code"),autoComplete:"off",disabled:this.state.continueDisabled,value:this.state.verificationCode,onChange:this.onVerificationCodeChange}))):a?r.a.createElement(f.a,{className:"mx_ExistingPhoneNumber_confirmBtn",kind:"danger_sm",onClick:this.onRevokeClick},Object(l.a)("Revoke")):r.a.createElement(f.a,{className:"mx_ExistingPhoneNumber_confirmBtn",kind:"primary_sm",onClick:this.onShareClick},Object(l.a)("Share")),r.a.createElement("div",{className:"mx_ExistingPhoneNumber"},r.a.createElement("span",{className:"mx_ExistingPhoneNumber_address"},"+",e),n)}}class ie extends r.a.Component{render(){let e;return e=this.props.msisdns.length>0?this.props.msisdns.map((e=>r.a.createElement(ne,{msisdn:e,key:e.address}))):r.a.createElement("span",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("Discovery options will appear once you have added a phone number above.")),r.a.createElement("div",{className:"mx_PhoneNumbers"},e)}}var se,re=a(200),oe=a(345),le=a(658),ce=a(155),de=a(142),me=a(152);!function(e){e.Display="display",e.Edit="edit"}(se||(se={}));class ue extends r.a.Component{constructor(e){super(e),i()(this,"value",""),i()(this,"placeholder",!1),i()(this,"editableDiv",Object(s.createRef)()),i()(this,"showPlaceholder",(e=>{e?(this.editableDiv.current.textContent=this.props.placeholder,this.editableDiv.current.setAttribute("class",this.props.className+" "+this.props.placeholderClassName),this.placeholder=!0,this.value=""):(this.editableDiv.current.textContent=this.value,this.editableDiv.current.setAttribute("class",this.props.className),this.placeholder=!1)})),i()(this,"cancelEdit",(()=>{this.setState({phase:se.Display}),this.value=this.props.initialValue,this.showPlaceholder(!this.value),this.onValueChanged(!1),this.editableDiv.current.blur()})),i()(this,"onValueChanged",(e=>{this.props.onValueChanged(this.value,e)})),i()(this,"onKeyDown",(e=>{this.placeholder&&this.showPlaceholder(!1);if(Object(me.a)().getAccessibilityAction(e)===de.h.Enter)e.stopPropagation(),e.preventDefault()})),i()(this,"onKeyUp",(e=>{e.target.textContent?this.placeholder||(this.value=e.target.textContent):this.showPlaceholder(!0);switch(Object(me.a)().getAccessibilityAction(e)){case de.h.Escape:this.cancelEdit();break;case de.h.Enter:this.onFinish(e)}})),i()(this,"onClickDiv",(()=>{this.props.editable&&this.setState({phase:se.Edit})})),i()(this,"onFocus",(e=>{const t=e.target.childNodes[0];if(t){const a=document.createRange();a.setStart(t,0),a.setEnd(t,e.target.childNodes.length);const n=window.getSelection();n.removeAllRanges(),n.addRange(a)}})),i()(this,"onFinish",((e,t)=>{const a=this,n=Object(me.a)().getAccessibilityAction(e)===de.h.Enter||t;this.setState({phase:se.Display},(()=>{this.value!==this.props.initialValue&&a.onValueChanged(n)}))})),i()(this,"onBlur",(e=>{window.getSelection().removeAllRanges(),this.props.blurToCancel?this.cancelEdit():this.onFinish(e,this.props.blurToSubmit),this.showPlaceholder(!this.value)})),this.state={phase:se.Display}}componentDidUpdate(e){e.initialValue!==this.props.initialValue&&(this.value=this.props.initialValue,this.editableDiv.current&&this.showPlaceholder(!this.value))}componentDidMount(){this.value=this.props.initialValue,this.editableDiv.current&&this.showPlaceholder(!this.value)}render(){const{className:e,editable:t,initialValue:a,label:n,labelClassName:i}=this.props;let s;return s=!t||this.state.phase===se.Display&&(n||i)&&!this.value?r.a.createElement("div",{className:e+" "+i,onClick:this.onClickDiv},n||a):r.a.createElement("div",{ref:this.editableDiv,contentEditable:!0,className:e,onKeyDown:this.onKeyDown,onKeyUp:this.onKeyUp,onFocus:this.onFocus,onBlur:this.onBlur}),s}}i()(ue,"defaultProps",{onValueChanged(){},initialValue:"",label:"",placeholder:"",editable:!0,className:"mx_EditableText",placeholderClassName:"mx_EditableText_placeholder",blurToSubmit:!1});class he extends r.a.Component{constructor(e){super(e),i()(this,"addThreepid",void 0),i()(this,"onEmailAddressChanged",(e=>{this.setState({emailAddress:e})})),i()(this,"onSubmit",(()=>{const e=this.state.emailAddress;X.a(e)?(this.addThreepid=new $,this.addThreepid.addEmailAddress(e).then((()=>{g.b.createDialog(ce.a,{title:Object(l.a)("Verification Pending"),description:Object(l.a)("Please check your email and click on the link it contains. Once this is done, click continue."),button:Object(l.a)("Continue"),onFinished:this.onEmailDialogFinished})}),(t=>{this.setState({emailBusy:!1}),d.a.error("Unable to add email address "+e+" "+t),g.b.createDialog(v.a,{title:Object(l.a)("Unable to add email address"),description:t&&t.message?t.message:Object(l.a)("Operation failed")})})),this.setState({emailBusy:!0})):g.b.createDialog(v.a,{title:Object(l.a)("Invalid Email Address"),description:Object(l.a)("This doesn't appear to be a valid email address")})})),i()(this,"onCancelled",(()=>{this.props.onFinished(!1)})),i()(this,"onEmailDialogFinished",(e=>{e?this.verifyEmailAddress():this.setState({emailBusy:!1})})),this.state={emailAddress:"",emailBusy:!1}}verifyEmailAddress(){this.addThreepid.checkEmailLinkClicked().then((()=>{this.props.onFinished(!0)}),(e=>{if(this.setState({emailBusy:!1}),"M_THREEPID_AUTH_FAILED"==e.errcode){const e=Object(l.a)("Unable to verify email address.")+" "+Object(l.a)("Please check your email and click on the link it contains. Once this is done, click continue.");g.b.createDialog(ce.a,{title:Object(l.a)("Verification Pending"),description:e,button:Object(l.a)("Continue"),onFinished:this.onEmailDialogFinished})}else d.a.error("Unable to verify email address: "+e),g.b.createDialog(v.a,{title:Object(l.a)("Unable to verify email address."),description:e&&e.message?e.message:Object(l.a)("Operation failed")})}))}render(){const e=this.state.emailBusy?r.a.createElement(k.a,null):r.a.createElement(ue,{initialValue:this.state.emailAddress,className:"mx_SetEmailDialog_email_input",placeholder:Object(l.a)("Email address"),placeholderClassName:"mx_SetEmailDialog_email_input_placeholder",blurToCancel:!1,onValueChanged:this.onEmailAddressChanged});return r.a.createElement(M.a,{className:"mx_SetEmailDialog",onFinished:this.onCancelled,title:this.props.title,contentId:"mx_Dialog_content"},r.a.createElement("div",{className:"mx_Dialog_content"},r.a.createElement("p",{id:"mx_Dialog_content"},Object(l.a)("This will allow you to reset your password and receive notifications.")),e),r.a.createElement("div",{className:"mx_Dialog_buttons"},r.a.createElement("input",{className:"mx_Dialog_primary",type:"submit",value:Object(l.a)("Continue"),onClick:this.onSubmit}),r.a.createElement("input",{type:"submit",value:Object(l.a)("Skip"),onClick:this.onCancelled})))}}const pe="field_old_password",ge="field_new_password",ve="field_new_password_confirm";var be;!function(e){e.Edit="edit",e.Uploading="uploading",e.Error="error"}(be||(be={}));class fe extends r.a.Component{constructor(e){super(e),i()(this,pe,void 0),i()(this,ge,void 0),i()(this,ve,void 0),i()(this,"onExportE2eKeysClicked",(()=>{g.b.createDialogAsync(a.e(7).then(a.bind(null,1536)),{matrixClient:u.a.get()})})),i()(this,"onChangeOldPassword",(e=>{this.setState({oldPassword:e.target.value})})),i()(this,"onOldPasswordValidate",(async e=>{const t=await this.validateOldPasswordRules(e);return this.markFieldValid(pe,t.valid),t})),i()(this,"validateOldPasswordRules",Object(re.a)({rules:[{key:"required",test:e=>{let{value:t,allowEmpty:a}=e;return a||!!t},invalid:()=>Object(l.a)("Passwords can't be empty")}]})),i()(this,"onChangeNewPassword",(e=>{this.setState({newPassword:e.target.value})})),i()(this,"onNewPasswordValidate",(e=>{this.markFieldValid(ge,e.valid)})),i()(this,"onChangeNewPasswordConfirm",(e=>{this.setState({newPasswordConfirm:e.target.value})})),i()(this,"onNewPasswordConfirmValidate",(async e=>{const t=await this.validatePasswordConfirmRules(e);return this.markFieldValid(ve,t.valid),t})),i()(this,"validatePasswordConfirmRules",Object(re.a)({rules:[{key:"required",test:e=>{let{value:t,allowEmpty:a}=e;return a||!!t},invalid:()=>Object(l.a)("Confirm password")},{key:"match",test(e){let{value:t}=e;return!t||t===this.state.newPassword},invalid:()=>Object(l.a)("Passwords don't match")}]})),i()(this,"onClickChange",(async e=>{e.preventDefault();if(!await this.verifyFieldsBeforeSubmit())return;const t=this.state.oldPassword,a=this.state.newPassword,n=this.state.newPasswordConfirm,i=this.checkPassword(t,a,n);if(!i)return this.onChangePassword(t,a);this.props.onError(i)})),this.state={fieldValid:{},phase:be.Edit,oldPassword:"",newPassword:"",newPasswordConfirm:""}}async onChangePassword(e,t){const a=u.a.get(),n=await a.doesServerSupportLogoutDevices(),i=(await a.getDevices()).devices.length>1;if(i&&!n&&this.props.confirm){const{finished:e}=g.b.createDialog(ce.a,{title:Object(l.a)("Warning!"),description:r.a.createElement("div",null,r.a.createElement("p",null,Object(l.a)("Changing your password on this homeserver will cause all of your other devices to be signed out. This will delete the message encryption keys stored on them, and may make encrypted chat history unreadable.")),r.a.createElement("p",null,Object(l.a)("If you want to retain access to your chat history in encrypted rooms you should first export your room keys and re-import them afterwards.")),r.a.createElement("p",null,Object(l.a)("You can also ask your homeserver admin to upgrade the server to change this behaviour."))),button:Object(l.a)("Continue"),extraButtons:[r.a.createElement("button",{key:"exportRoomKeys",className:"mx_Dialog_primary",onClick:this.onExportE2eKeysClicked},Object(l.a)("Export E2E room keys"))]}),[t]=await e;if(!t)return}this.changePassword(a,e,t,n,i)}changePassword(e,t,a,n,i){var s;const r={type:"m.login.password",identifier:{type:"m.id.user",user:e.credentials.userId},user:null!==(s=e.credentials.userId)&&void 0!==s?s:void 0,password:t};this.setState({phase:be.Uploading});const o=!n&&void 0,l=!n&&i;e.setPassword(r,a,o).then((()=>{if(this.props.shouldAskForEmail)return this.optionallySetEmail().then((e=>{this.props.onFinished({didSetEmail:e,didLogoutOutOtherDevices:l})}));this.props.onFinished({didLogoutOutOtherDevices:l})}),(e=>{this.props.onError(e)})).finally((()=>{this.setState({phase:be.Edit,oldPassword:"",newPassword:"",newPasswordConfirm:""})}))}checkPassword(e,t,a){return t!==a?{error:Object(l.a)("New passwords don't match")}:t&&0!==t.length?void 0:{error:Object(l.a)("Passwords can't be empty")}}optionallySetEmail(){return g.b.createDialog(he,{title:Object(l.a)("Do you want to set an email address?")}).finished.then((e=>{let[t]=e;return t}))}markFieldValid(e,t){const{fieldValid:a}=this.state;a[e]=t,this.setState({fieldValid:a})}async verifyFieldsBeforeSubmit(){const e=document.activeElement;e&&e.blur();const t=[pe,ge,ve];for(const e of t){const t=this[e];t&&await t.validate({allowEmpty:!1})}if(await new Promise((e=>this.setState({},e))),this.allFieldsValid())return!0;const a=this.findFirstInvalidField(t);return!a||(a.focus(),a.validate({allowEmpty:!1,focused:!0}),!1)}allFieldsValid(){return Object.values(this.state.fieldValid).every(Boolean)}findFirstInvalidField(e){for(const t of e)if(!this.state.fieldValid[t]&&this[t])return this[t];return null}render(){const e=this.props.rowClassName,t=this.props.buttonClassName;switch(this.state.phase){case be.Edit:return r.a.createElement("form",{className:this.props.className,onSubmit:this.onClickChange},r.a.createElement("div",{className:e},r.a.createElement(h.a,{ref:e=>this[pe]=e,type:"password",label:Object(l.a)("Current password"),value:this.state.oldPassword,onChange:this.onChangeOldPassword,onValidate:this.onOldPasswordValidate})),r.a.createElement("div",{className:e},r.a.createElement(oe.a,{fieldRef:e=>this[ge]=e,type:"password",label:Object(l.c)("New Password"),minScore:le.a,value:this.state.newPassword,autoFocus:this.props.autoFocusNewPasswordInput,onChange:this.onChangeNewPassword,onValidate:this.onNewPasswordValidate,autoComplete:"new-password"})),r.a.createElement("div",{className:e},r.a.createElement(h.a,{ref:e=>this[ve]=e,type:"password",label:Object(l.a)("Confirm password"),value:this.state.newPasswordConfirm,onChange:this.onChangeNewPasswordConfirm,onValidate:this.onNewPasswordConfirmValidate,autoComplete:"new-password"})),r.a.createElement(f.a,{className:t,kind:this.props.buttonKind,onClick:this.onClickChange},this.props.buttonLabel||Object(l.a)("Change Password")));case be.Uploading:return r.a.createElement("div",{className:"mx_Dialog_content"},r.a.createElement(k.a,null))}}}i()(fe,"defaultProps",{onFinished(){},onError(){},confirm:!0});var ye=a(185);class Ee extends r.a.Component{constructor(e){super(e),i()(this,"togglePolicy",(e=>{const t=Object(ye.a)(this.state.policies);t[e].checked=!t[e].checked,this.setState({policies:t})})),i()(this,"onContinue",(()=>{!!this.state.policies.some((e=>!e.checked))||(this.setState({busy:!0}),this.props.onFinished(this.state.policies.map((e=>e.url))))})),this.state={policies:[],busy:!1}}componentDidMount(){const e=[];for(const t of this.props.policiesAndServicePairs){const a=Object.values(t.policies);for(const t of a){const a=Object(l.j)(Object.keys(t).filter((e=>"version"!==e))),n={checked:!1,url:t[a].url,name:t[a].name};e.push(n)}}this.setState({policies:e})}renderCheckboxes(){const e=[];for(let t=0;t<this.state.policies.length;t++){const a=this.state.policies[t],n=Object(l.a)("Accept <policyLink /> to continue:",{},{policyLink:()=>r.a.createElement("a",{href:a.url,rel:"noreferrer noopener",target:"_blank"},a.name,r.a.createElement("span",{className:"mx_InlineTermsAgreement_link"}))});e.push(r.a.createElement("div",{key:t,className:"mx_InlineTermsAgreement_cbContainer"},r.a.createElement("div",null,n),r.a.createElement("div",{className:"mx_InlineTermsAgreement_checkbox"},r.a.createElement(D.b,{onChange:()=>this.togglePolicy(t),checked:a.checked},Object(l.a)("Accept")))))}return e}render(){const e=!!this.state.policies.some((e=>!e.checked));return r.a.createElement("div",null,this.props.introElement,this.renderCheckboxes(),r.a.createElement(f.a,{onClick:this.onContinue,disabled:e||this.state.busy,kind:"primary_sm"},Object(l.a)("Continue")))}}var _e=a(255),we=a.n(_e),Se=a(433),Oe=a(390),Ce=a(206);class xe extends r.a.Component{constructor(e){super(e),i()(this,"dispatcherRef",void 0),i()(this,"onAction",(e=>{"id_server_changed"===e.action&&this.setState({currentClientIdServer:u.a.get().getIdentityServerUrl()})})),i()(this,"onIdentityServerChanged",(e=>{const t=e.target.value;this.setState({idServer:t})})),i()(this,"getTooltip",(()=>this.state.checking?r.a.createElement("div",null,r.a.createElement(Ce.a,null),Object(l.a)("Checking server")):this.state.error?r.a.createElement("span",{className:"warning"},this.state.error):null)),i()(this,"idServerChangeEnabled",(()=>!!this.state.idServer&&!this.state.busy)),i()(this,"saveIdServer",(e=>{u.a.get().setAccountData("m.identity_server",{base_url:e}),this.setState({busy:!1,error:void 0,currentClientIdServer:e,idServer:""})})),i()(this,"checkIdServer",(async e=>{var t;e.preventDefault();const{idServer:a,currentClientIdServer:n}=this.state;this.setState({busy:!0,checking:!0,error:void 0});const i=Object(V.b)(a);let s=await async function(e){if("https:"!==we.a.parse(e).protocol)return Object(l.a)("Identity server URL must be HTTPS");try{const t=await fetch(e+"/_matrix/identity/v2");return t.ok?null:t.status<200||t.status>=300?Object(l.a)("Not a valid identity server (status code %(code)s)",{code:t.status}):Object(l.a)("Could not connect to identity server")}catch(e){return Object(l.a)("Could not connect to identity server")}}(i);if(!s)try{this.setState({checking:!1});const e=new B.a(i);await e.getAccessToken();let t=!0;if(!await Object(Se.b)(i)){const[e]=await this.showNoTermsWarning(i);t=!!e}if(t&&n&&i!==n){const[e]=await this.showServerChangeWarning({title:Object(l.a)("Change identity server"),unboundMessage:Object(l.a)("Disconnect from the identity server <current /> and connect to <new /> instead?",{},{current:e=>r.a.createElement("b",null,Object(V.a)(n)),new:e=>r.a.createElement("b",null,Object(V.a)(a))}),button:Object(l.a)("Continue")});t=!!e}t&&this.saveIdServer(i)}catch(e){d.a.error(e),s=Object(l.a)("Terms of service not accepted or the identity server is invalid.")}this.setState({busy:!1,checking:!1,error:null!==(t=s)&&void 0!==t?t:void 0,currentClientIdServer:u.a.get().getIdentityServerUrl()})})),i()(this,"onDisconnectClicked",(async()=>{this.setState({disconnectBusy:!0});try{const[e]=await this.showServerChangeWarning({title:Object(l.a)("Disconnect identity server"),unboundMessage:Object(l.a)("Disconnect from the identity server <idserver />?",{},{idserver:e=>r.a.createElement("b",null,Object(V.a)(this.state.currentClientIdServer))}),button:Object(l.a)("Disconnect")});e&&this.disconnectIdServer()}finally{this.setState({disconnectBusy:!1})}})),i()(this,"disconnectIdServer",(()=>{u.a.get().setAccountData("m.identity_server",{base_url:null});let e="";Object(Se.c)()&&(e=Object(V.a)(Object(Se.c)())),this.setState({busy:!1,error:void 0,currentClientIdServer:u.a.get().getIdentityServerUrl(),idServer:e})}));let t="";!u.a.get().getIdentityServerUrl()&&Object(Se.c)()&&(t=Object(V.a)(Object(Se.c)())),this.state={defaultIdServer:t,currentClientIdServer:u.a.get().getIdentityServerUrl(),idServer:"",busy:!1,disconnectBusy:!1,checking:!1}}componentDidMount(){this.dispatcherRef=A.a.register(this.onAction)}componentWillUnmount(){A.a.unregister(this.dispatcherRef)}showNoTermsWarning(e){const{finished:t}=g.b.createDialog(ce.a,{title:Object(l.a)("Identity server has no terms of service"),description:r.a.createElement("div",null,r.a.createElement("span",{className:"warning"},Object(l.a)("The identity server you have chosen does not have any terms of service.")),r.a.createElement("span",null," ",Object(l.a)("Only continue if you trust the owner of the server."))),button:Object(l.a)("Continue")});return t}async showServerChangeWarning(e){let{title:t,unboundMessage:a,button:n}=e;const{currentClientIdServer:i}=this.state;let s=[],o=!0;try{s=await Object(Oe.b)(W(u.a.get()),Promise.reject(new Error("Timeout attempting to reach identity server")),1e4)}catch(e){o=!1,d.a.warn(`Unable to reach identity server at ${i} to check for 3PIDs during IS change flow`),d.a.warn(e)}const c=s.filter((e=>e.bound));let m,h=!1;const p={idserver:e=>r.a.createElement("b",null,Object(V.a)(i)),b:e=>r.a.createElement("b",null,e)};o?c.length?(m=r.a.createElement("div",null,r.a.createElement("p",null,Object(l.a)("You are still <b>sharing your personal data</b> on the identity server <idserver />.",{},p)),r.a.createElement("p",null,Object(l.a)("We recommend that you remove your email addresses and phone numbers from the identity server before disconnecting."))),h=!0,n=Object(l.a)("Disconnect anyway")):m=a:(m=r.a.createElement("div",null,r.a.createElement("p",null,Object(l.a)("You should <b>remove your personal data</b> from identity server <idserver /> before disconnecting. Unfortunately, identity server <idserver /> is currently offline or cannot be reached.",{},p)),r.a.createElement("p",null,Object(l.a)("You should:")),r.a.createElement("ul",null,r.a.createElement("li",null,Object(l.a)("check your browser plugins for anything that might block the identity server (such as Privacy Badger)")),r.a.createElement("li",null,Object(l.a)("contact the administrators of identity server <idserver />",{},{idserver:p.idserver})),r.a.createElement("li",null,Object(l.a)("wait and try again later")))),h=!0,n=Object(l.a)("Disconnect anyway"));const{finished:v}=g.b.createDialog(ce.a,{title:t,description:m,button:n,cancelButton:Object(l.a)("Go back"),danger:h});return v}render(){const e=this.state.currentClientIdServer;let t,a,n;if(e?(t=Object(l.a)("Identity server (%(server)s)",{server:Object(V.a)(e)}),a=Object(l.a)("You are currently using <server></server> to discover and be discoverable by existing contacts you know. You can change your identity server below.",{},{server:t=>r.a.createElement("b",null,Object(V.a)(e))}),this.props.missingTerms&&(a=Object(l.a)("If you don't want to use <server /> to discover and be discoverable by existing contacts you know, enter another identity server below.",{},{server:t=>r.a.createElement("b",null,Object(V.a)(e))}))):(t=Object(l.a)("Identity server"),a=Object(l.a)("You are not currently using an identity server. To discover and be discoverable by existing contacts you know, add one below.")),e){let e=Object(l.a)("Disconnect"),t=Object(l.a)("Disconnecting from your identity server will mean you won't be discoverable by other users and you won't be able to invite others by email or phone.");this.props.missingTerms&&(t=Object(l.a)("Using an identity server is optional. If you choose not to use an identity server, you won't be discoverable by other users and you won't be able to invite others by email or phone."),e=Object(l.a)("Do not use an identity server")),this.state.disconnectBusy&&(e=r.a.createElement(Ce.a,null)),n=r.a.createElement("div",null,r.a.createElement("span",{className:"mx_SettingsTab_subsectionText"},t),r.a.createElement(f.a,{onClick:this.onDisconnectClicked,kind:"danger_sm"},e))}return r.a.createElement("form",{className:"mx_SetIdServer",onSubmit:this.checkIdServer},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},t),r.a.createElement("span",{className:"mx_SettingsTab_subsectionText"},a),r.a.createElement(h.a,{label:Object(l.a)("Enter a new identity server"),type:"text",autoComplete:"off",placeholder:this.state.defaultIdServer,value:this.state.idServer,onChange:this.onIdentityServerChanged,tooltipContent:this.getTooltip(),tooltipClassName:"mx_SetIdServer_tooltip",disabled:this.state.busy,forceValidity:!this.state.error&&void 0}),r.a.createElement(f.a,{type:"submit",kind:"primary_sm",onClick:this.checkIdServer,disabled:!this.idServerChangeEnabled()},Object(l.a)("Change")),n)}}var je=a(283),ke=a(392);class Re extends r.a.Component{constructor(e){super(e),i()(this,"onProvisioningToggled",(()=>{const e=this.state.provisioningEnabled;O.b.setValue("integrationProvisioning",null,H.a.ACCOUNT,!e).catch((t=>{d.a.error("Error changing integration manager provisioning"),d.a.error(t),this.setState({provisioningEnabled:e})})),this.setState({provisioningEnabled:!e})}));const t=je.a.sharedInstance().getPrimaryManager();this.state={currentManager:t,provisioningEnabled:O.b.getValue("integrationProvisioning")}}render(){const e=this.state.currentManager;let t,a;return e?(t=`(${e.name})`,a=Object(l.a)("Use an integration manager <b>(%(serverName)s)</b> to manage bots, widgets, and sticker packs.",{serverName:e.name},{b:e=>r.a.createElement("b",null,e)})):a=Object(l.a)("Use an integration manager to manage bots, widgets, and sticker packs."),r.a.createElement("div",{className:"mx_SetIntegrationManager"},r.a.createElement("div",{className:"mx_SettingsFlag"},r.a.createElement("div",{className:"mx_SetIntegrationManager_heading_manager"},r.a.createElement("span",{className:"mx_SettingsTab_heading"},Object(l.a)("Manage integrations")),r.a.createElement("span",{className:"mx_SettingsTab_subheading"},t)),r.a.createElement(ke.a,{checked:this.state.provisioningEnabled,disabled:!1,onChange:this.onProvisioningToggled})),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},a),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("Integration managers receive configuration data, and can modify widgets, send room invites, and set power levels on your behalf.")))}}var Ie=a(205);function Te(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function Ne(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?Te(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):Te(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}class Pe extends r.a.Component{constructor(e){super(e),i()(this,"dispatcherRef",void 0),i()(this,"onAction",(e=>{"id_server_changed"===e.action&&(this.setState({haveIdServer:Boolean(u.a.get().getIdentityServerUrl())}),this.getThreepidState())})),i()(this,"onEmailsChange",(e=>{this.setState({emails:e})})),i()(this,"onMsisdnsChange",(e=>{this.setState({msisdns:e})})),i()(this,"onLanguageChange",(e=>{if(this.state.language===e)return;O.b.setValue("language",null,H.a.DEVICE,e),this.setState({language:e});const t=j.a.get();t&&(t.setLanguage([e]),t.reload())})),i()(this,"onSpellCheckLanguagesChange",(e=>{var t;this.setState({spellCheckLanguages:e}),null===(t=j.a.get())||void 0===t||t.setSpellCheckLanguages(e)})),i()(this,"onSpellCheckEnabledChange",(e=>{var t;this.setState({spellCheckEnabled:e}),null===(t=j.a.get())||void 0===t||t.setSpellCheckEnabled(e)})),i()(this,"onPasswordChangeError",(e=>{let t=e.error||e.message||"";403===e.httpStatus?t=Object(l.a)("Failed to change password. Is your password correct?"):t||(t+=` (HTTP status ${e.httpStatus})`),d.a.error("Failed to change password: "+t),g.b.createDialog(v.a,{title:Object(l.a)("Error"),description:t})})),i()(this,"onPasswordChanged",(e=>{let{didLogoutOutOtherDevices:t}=e,a=Object(l.a)("Your password was successfully changed.");t&&(a+=" "+Object(l.a)("You will not receive push notifications on other devices until you sign back in to them.")),g.b.createDialog(v.a,{title:Object(l.a)("Success"),description:a})})),i()(this,"onDeactivateClicked",(()=>{g.b.createDialog(U,{onFinished:e=>{e&&this.props.closeSettingsFn()}})})),this.state={language:l.e(),spellCheckEnabled:!1,spellCheckLanguages:[],haveIdServer:Boolean(u.a.get().getIdentityServerUrl()),idServerHasUnsignedTerms:!1,requiredPolicyInfo:{hasTerms:!1,policiesAndServices:null,agreedUrls:null,resolve:null},emails:[],msisdns:[],loading3pids:!0,canChangePassword:!1},this.dispatcherRef=A.a.register(this.onAction),this.getCapabilities(),this.getThreepidState()}async componentDidMount(){const e=j.a.get(),[t,a]=await Promise.all([null==e?void 0:e.getSpellCheckEnabled(),null==e?void 0:e.getSpellCheckLanguages()]);a&&this.setState({spellCheckEnabled:t,spellCheckLanguages:a})}componentWillUnmount(){A.a.unregister(this.dispatcherRef)}async getCapabilities(){const e=u.a.get(),t=await e.doesServerSupportSeparateAddAndBind(),a=(await e.getCapabilities())["m.change_password"],n=!a||!1!==a.enabled,i=m.M_AUTHENTICATION.findIn(e.getClientWellKnown()),s=null==i?void 0:i.account;this.setState({serverSupportsSeparateAddAndBind:t,canChangePassword:n,externalAccountManagementUrl:s})}async getThreepidState(){const e=u.a.get();this.checkTerms();let t=[];try{t=await W(e)}catch(e){const t=u.a.get().getIdentityServerUrl();d.a.warn(`Unable to reach identity server at ${t} to check for 3PIDs bindings in Settings`),d.a.warn(e)}this.setState({emails:t.filter((e=>"email"===e.medium)),msisdns:t.filter((e=>"msisdn"===e.medium)),loading3pids:!1})}async checkTerms(){if(!this.state.haveIdServer)return void this.setState({idServerHasUnsignedTerms:!1});const e=u.a.get().getIdentityServerUrl(),t=new B.a;try{const a=await t.getAccessToken({check:!1});await Object(F.d)([new F.a(c.a.IS,e,a)],((t,a,n)=>new Promise(((n,i)=>{this.setState({idServerName:Object(V.a)(e),requiredPolicyInfo:{hasTerms:!0,policiesAndServices:t,agreedUrls:a,resolve:n}})})))),this.setState({requiredPolicyInfo:Ne(Ne({},this.state.requiredPolicyInfo),{},{hasTerms:!1})})}catch(t){d.a.warn(`Unable to reach identity server at ${e} to check for terms in Settings`),d.a.warn(t)}}renderProfileSection(){return r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement(S,null))}renderAccountSection(){let e=r.a.createElement(fe,{className:"mx_GeneralUserSettingsTab_changePassword",rowClassName:"",buttonKind:"primary",onError:this.onPasswordChangeError,onFinished:this.onPasswordChanged}),t=null;if(O.b.getValue(z.b.ThirdPartyID)&&(this.state.haveIdServer||!0===this.state.serverSupportsSeparateAddAndBind)){const e=this.state.loading3pids?r.a.createElement(k.a,null):r.a.createElement(ee,{emails:this.state.emails,onEmailsChange:this.onEmailsChange}),a=this.state.loading3pids?r.a.createElement(k.a,null):r.a.createElement(Q,{msisdns:this.state.msisdns,onMsisdnsChange:this.onMsisdnsChange});t=r.a.createElement("div",null,r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Email addresses")),e,r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Phone numbers")),a)}else null===this.state.serverSupportsSeparateAddAndBind&&(t=r.a.createElement(k.a,null));let a,n=Object(l.a)("Set a new account password…");if(this.state.canChangePassword||(n=null,e=null),this.state.externalAccountManagementUrl){const{hostname:e}=new URL(this.state.externalAccountManagementUrl);a=r.a.createElement(r.a.Fragment,null,r.a.createElement("p",{className:"mx_SettingsTab_subsectionText","data-testid":"external-account-management-outer"},Object(l.a)("Your account details are managed separately at <code>%(hostname)s</code>.",{hostname:e},{code:e=>r.a.createElement("code",null,e)})),r.a.createElement(f.a,{onClick:null,element:"a",kind:"primary",target:"_blank",rel:"noreferrer noopener",href:this.state.externalAccountManagementUrl,"data-testid":"external-account-management-link"},Object(l.a)("Manage account")))}return r.a.createElement("div",{className:"mx_SettingsTab_section mx_GeneralUserSettingsTab_accountSection"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Account")),a,r.a.createElement("p",{className:"mx_SettingsTab_subsectionText"},n),e,t)}renderLanguageSection(){return r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Language and region")),r.a.createElement(C.a,{className:"mx_GeneralUserSettingsTab_languageInput",onOptionChange:this.onLanguageChange,value:this.state.language}))}renderSpellCheckSection(){return r.a.createElement("div",{className:"mx_SettingsTab_section mx_SettingsTab_section_spellcheck"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Spell check"),r.a.createElement(ke.a,{checked:this.state.spellCheckEnabled,onChange:this.onSpellCheckEnabledChange})),this.state.spellCheckEnabled&&!Ie.a&&r.a.createElement(T,{languages:this.state.spellCheckLanguages,onLanguagesChange:this.onSpellCheckLanguagesChange}))}renderDiscoverySection(){if(this.state.requiredPolicyInfo.hasTerms){const e=r.a.createElement("span",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("Agree to the identity server (%(serverName)s) Terms of Service to allow yourself to be discoverable by email address or phone number.",{serverName:this.state.idServerName}));return r.a.createElement("div",null,r.a.createElement(Ee,{policiesAndServicePairs:this.state.requiredPolicyInfo.policiesAndServices,agreedUrls:this.state.requiredPolicyInfo.agreedUrls,onFinished:this.state.requiredPolicyInfo.resolve,introElement:e}),r.a.createElement(xe,{missingTerms:!0}))}const e=this.state.loading3pids?r.a.createElement(k.a,null):r.a.createElement(ae,{emails:this.state.emails}),t=this.state.loading3pids?r.a.createElement(k.a,null):r.a.createElement(ie,{msisdns:this.state.msisdns}),a=this.state.haveIdServer?r.a.createElement("div",{className:"mx_GeneralUserSettingsTab_discovery"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Email addresses")),e,r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Phone numbers")),t):null;return r.a.createElement("div",{className:"mx_SettingsTab_section"},a,r.a.createElement(xe,{missingTerms:!1}))}renderManagementSection(){return r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Account management")),r.a.createElement("span",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("Deactivating your account is a permanent action — be careful!")),r.a.createElement(f.a,{onClick:this.onDeactivateClicked,kind:"danger"},Object(l.a)("Deactivate Account")))}renderIntegrationManagerSection(){return O.b.getValue(z.b.Widgets)?r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement(Re,null)):null}render(){const e=j.a.get(),t=null==e?void 0:e.supportsSpellCheckSettings(),n=this.state.requiredPolicyInfo.hasTerms?r.a.createElement("img",{className:"mx_GeneralUserSettingsTab_warningIcon",src:a(796).default,width:"18",height:"18",alt:Object(l.a)("Warning")}):null;let i,s;return O.b.getValue(z.b.Deactivate)&&(i=r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(l.a)("Deactivate account")),this.renderManagementSection())),O.b.getValue(z.b.IdentityServer)&&(s=r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:"mx_SettingsTab_heading"},n," ",Object(l.a)("Discovery")),this.renderDiscoverySection())),r.a.createElement("div",{className:"mx_SettingsTab"},r.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(l.a)("General")),this.renderProfileSection(),this.renderAccountSection(),this.renderLanguageSection(),t?this.renderSpellCheckSection():null,s,this.renderIntegrationManagerSection(),i)}}var De=a(149),Me=a(131),Ae=a(286),Le=a(229),Ue=a(313),Fe=a(451),Be=a(146);class Ve extends r.a.Component{constructor(e){super(e),i()(this,"features",O.b.getFeatureSettingNames()),i()(this,"onChange",(()=>{const e=O.b.getFeatureSettingNames().filter((e=>O.b.isEnabled(e))),[t,a]=e.reduce(((e,t)=>(e[O.b.getBetaInfo(t)?1:0].push(t),e)),[[],[]]),n=Me.b.get("show_labs_settings")?t:[];(Object(Be.d)(n,this.state.labs)||Object(Be.d)(a,this.state.betas))&&this.setState({labs:n,betas:a})})),this.state={betas:[],labs:[]}}componentDidMount(){this.features.forEach((e=>{Ue.d.watchSetting(e,null,this.onChange)})),this.onChange()}componentWillUnmount(){Ue.d.unwatchSetting(this.onChange)}render(){let e,t;if(this.state.betas.length&&(e=r.a.createElement("div",{"data-testid":"labs-beta-section",className:"mx_SettingsTab_section"},this.state.betas.map((e=>r.a.createElement(Ae.b,{key:e,featureId:e}))))),this.state.labs.length){const e=new Fe.a;this.state.labs.forEach((t=>{e.getOrCreate(O.b.getLabGroup(t),[]).push(r.a.createElement(Le.a,{level:H.a.DEVICE,name:t,key:t}))})),e.getOrCreate(Ue.b.Experimental,[]).push(r.a.createElement(Le.a,{key:"lowBandwidth",name:"lowBandwidth",level:H.a.DEVICE})),e.getOrCreate(Ue.b.Analytics,[]).push(r.a.createElement(Le.a,{key:"automaticErrorReporting",name:"automaticErrorReporting",level:H.a.DEVICE}),r.a.createElement(Le.a,{key:"automaticDecryptionErrorReporting",name:"automaticDecryptionErrorReporting",level:H.a.DEVICE})),t=r.a.createElement(r.a.Fragment,null,Object(De.sortBy)(Array.from(e.entries()),"0").map((e=>{let[t,a]=e;return r.a.createElement("div",{className:"mx_SettingsTab_section",key:t,"data-testid":`labs-group-${t}`},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)(Ue.e[t])),a)})))}return r.a.createElement("div",{className:"mx_SettingsTab mx_LabsUserSettingsTab"},r.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(l.a)("Upcoming features")),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("What's next for %(brand)s? Labs are the best way to get things early, test out new features and help shape them before they actually launch.",{brand:Me.b.get("brand")})),e,t&&r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(l.a)("Early previews")),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("Feeling experimental? Try out our latest ideas in development. These features are not finalised; they may be unstable, may change, or may be dropped altogether. <a>Learn more</a>.",{},{a:e=>r.a.createElement("a",{href:"https://github.com/vector-im/element-web/blob/develop/docs/labs.md",rel:"noreferrer noopener",target:"_blank"},e)})),t))}}var We=a(126),He=a.n(We),ze=a(143),Ge=a(259),Ke=a(346),qe=a(194);class $e extends r.a.Component{constructor(e){super(e),this.state={message:e.message}}fakeEvent(e){var t=this;let{message:a}=e;const n={type:"m.room.message",sender:this.props.userId,content:{"m.new_content":{msgtype:"m.text",body:a,displayname:this.props.displayName,avatar_url:this.props.avatarUrl},msgtype:"m.text",body:a,displayname:this.props.displayName,avatar_url:this.props.avatarUrl},unsigned:{age:97},event_id:"$9999999999999999999999999999999999999999999",room_id:"!999999999999999999:example.org"},i=new ze.b(n);return i.sender={name:this.props.displayName||this.props.userId,rawDisplayName:this.props.displayName,userId:this.props.userId,getAvatarUrl:function(){return Ge.c({avatarUrl:t.props.avatarUrl},32,32,"crop")},getMxcAvatarUrl:()=>this.props.avatarUrl},i}render(){const e=He()(this.props.className,{mx_IRCLayout:this.props.layout==qe.a.IRC,mx_EventTilePreview_loader:!this.props.userId});if(!this.props.userId)return r.a.createElement("div",{className:e},r.a.createElement(k.a,null));const t=this.fakeEvent(this.state);return r.a.createElement("div",{className:e},r.a.createElement(Ke.b,{mxEvent:t,layout:this.props.layout,as:"div"}))}}var Ye=a(258);class Je extends r.a.Component{constructor(e){super(e),i()(this,"onLayoutChange",(e=>{const t=e.target.value;this.setState({layout:t}),O.b.setValue("layout",null,H.a.DEVICE,t),this.props.onLayoutChanged(t)})),this.state={layout:O.b.getValue("layout")}}render(){const e=He()("mx_LayoutSwitcher_RadioButton",{mx_LayoutSwitcher_RadioButton_selected:this.state.layout==qe.a.IRC}),t=He()("mx_LayoutSwitcher_RadioButton",{mx_LayoutSwitcher_RadioButton_selected:this.state.layout==qe.a.Group}),a=He()("mx_LayoutSwitcher_RadioButton",{mx_LayoutSwitcher_RadioButton_selected:this.state.layout===qe.a.Bubble});return r.a.createElement("div",{className:"mx_SettingsTab_section mx_LayoutSwitcher"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Message layout")),r.a.createElement("div",{className:"mx_LayoutSwitcher_RadioButtons"},r.a.createElement("label",{className:e},r.a.createElement($e,{className:"mx_LayoutSwitcher_RadioButton_preview",message:this.props.messagePreviewText,layout:qe.a.IRC,userId:this.props.userId,displayName:this.props.displayName,avatarUrl:this.props.avatarUrl}),r.a.createElement(Ye.a,{name:"layout",value:qe.a.IRC,checked:this.state.layout===qe.a.IRC,onChange:this.onLayoutChange},Object(l.a)("IRC (Experimental)"))),r.a.createElement("label",{className:t},r.a.createElement($e,{className:"mx_LayoutSwitcher_RadioButton_preview",message:this.props.messagePreviewText,layout:qe.a.Group,userId:this.props.userId,displayName:this.props.displayName,avatarUrl:this.props.avatarUrl}),r.a.createElement(Ye.a,{name:"layout",value:qe.a.Group,checked:this.state.layout==qe.a.Group,onChange:this.onLayoutChange},Object(l.a)("Modern"))),r.a.createElement("label",{className:a},r.a.createElement($e,{className:"mx_LayoutSwitcher_RadioButton_preview",message:this.props.messagePreviewText,layout:qe.a.Bubble,userId:this.props.userId,displayName:this.props.displayName,avatarUrl:this.props.avatarUrl}),r.a.createElement(Ye.a,{name:"layout",value:qe.a.Bubble,checked:this.state.layout==qe.a.Bubble,onChange:this.onLayoutChange},Object(l.a)("Message bubbles")))))}}class Qe extends s.Component{offset(e,t){const a=e.reduce(((e,a)=>t>a?e+1:e),0);if(0===a)return 0;if(a===e.length)return 100;const n=e[a-1],i=e[a],s=1/(e.length-1);return 100*(a-1+(t-n)/(i-n))*s}render(){const e=this.props.values.map((e=>s.createElement(Xe,{active:e<=this.props.value,label:this.props.displayFunc(e),onClick:this.props.disabled?()=>{}:()=>this.props.onSelectionChange(e),key:e,disabled:this.props.disabled})));let t=null;if(!this.props.disabled){const e=this.offset(this.props.values,this.props.value);t=s.createElement("div",{className:"mx_Slider_selection"},s.createElement("div",{className:"mx_Slider_selectionDot",style:{left:"calc(-1.195em + "+e+"%)"}},s.createElement("div",{className:"mx_Slider_selectionText"},this.props.value)),s.createElement("hr",{style:{width:e+"%"}}))}return s.createElement("div",{className:"mx_Slider"},s.createElement("div",null,s.createElement("div",{className:"mx_Slider_bar"},s.createElement("hr",{onClick:this.props.disabled?()=>{}:this.onClick.bind(this)}),t),s.createElement("div",{className:"mx_Slider_dotContainer"},e)))}onClick(e){const t=e.target.clientWidth,a=e.nativeEvent.offsetX/t,n=this.props.values[Math.round(a*(this.props.values.length-1))];this.props.onSelectionChange(n)}}class Xe extends s.PureComponent{render(){let e="mx_Slider_dot";return!this.props.disabled&&this.props.active&&(e+=" mx_Slider_dotActive"),s.createElement("span",{onClick:this.props.onClick,className:"mx_Slider_dotValue"},s.createElement("div",{className:e}),s.createElement("div",{className:"mx_Slider_labelContainer"},s.createElement("div",{className:"mx_Slider_label"},this.props.label)))}}var Ze=a(460);class et extends r.a.Component{constructor(e){super(e),i()(this,"MESSAGE_PREVIEW_TEXT",Object(l.a)("Hey you. You're the best!")),i()(this,"unmounted",!1),i()(this,"onFontSizeChanged",(e=>{this.setState({fontSize:e.toString()}),O.b.setValue("baseFontSize",null,H.a.DEVICE,e-Ze.a.SIZE_DIFF)})),i()(this,"onValidateFontSize",(async e=>{let{value:t}=e;const a=parseFloat(t),n=Ze.a.MIN_SIZE+Ze.a.SIZE_DIFF,i=Ze.a.MAX_SIZE+Ze.a.SIZE_DIFF;return isNaN(a)?{valid:!1,feedback:Object(l.a)("Size must be a number")}:n<=a&&a<=i?(O.b.setValue("baseFontSize",null,H.a.DEVICE,parseInt(t,10)-Ze.a.SIZE_DIFF),{valid:!0,feedback:Object(l.a)("Use between %(min)s pt and %(max)s pt",{min:n,max:i})}):{valid:!1,feedback:Object(l.a)("Custom font size can only be between %(min)s pt and %(max)s pt",{min:n,max:i})}})),this.state={fontSize:(O.b.getValue("baseFontSize",null)+Ze.a.SIZE_DIFF).toString(),useCustomFontSize:O.b.getValue("useCustomFontSize"),layout:O.b.getValue("layout")}}async componentDidMount(){const e=u.a.get(),t=e.getUserId(),a=await e.getProfileInfo(t);this.unmounted||this.setState({userId:t,displayName:a.displayname,avatarUrl:a.avatar_url})}componentWillUnmount(){this.unmounted=!0}render(){return r.a.createElement("div",{className:"mx_SettingsTab_section mx_FontScalingPanel"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Font size")),r.a.createElement($e,{className:"mx_FontScalingPanel_preview",message:this.MESSAGE_PREVIEW_TEXT,layout:this.state.layout,userId:this.state.userId,displayName:this.state.displayName,avatarUrl:this.state.avatarUrl}),r.a.createElement("div",{className:"mx_FontScalingPanel_fontSlider"},r.a.createElement("div",{className:"mx_FontScalingPanel_fontSlider_smallText"},"Aa"),r.a.createElement(Qe,{values:[13,14,15,16,18],value:parseInt(this.state.fontSize,10),onSelectionChange:this.onFontSizeChanged,displayFunc:e=>"",disabled:this.state.useCustomFontSize}),r.a.createElement("div",{className:"mx_FontScalingPanel_fontSlider_largeText"},"Aa")),r.a.createElement(Le.a,{name:"useCustomFontSize",level:H.a.ACCOUNT,onChange:e=>this.setState({useCustomFontSize:e}),useCheckbox:!0}),r.a.createElement(h.a,{type:"number",label:Object(l.a)("Font size"),autoComplete:"off",placeholder:this.state.fontSize.toString(),value:this.state.fontSize.toString(),id:"font_size_field",onValidate:this.onValidateFontSize,onChange:e=>this.setState({fontSize:e.target.value}),disabled:!this.state.useCustomFontSize,className:"mx_FontScalingPanel_customFontSizeField"}))}}var tt=a(884),at=a(466);class nt extends r.a.Component{constructor(e){super(e),i()(this,"onSizeChange",(e=>{const t=e.target.value;this.setState({size:t}),O.b.setValue("Images.size",null,H.a.ACCOUNT,t)})),this.state={size:O.b.getValue("Images.size")}}render(){return r.a.createElement("div",{className:"mx_SettingsTab_section mx_ImageSizePanel"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Image size in the timeline")),r.a.createElement("div",{className:"mx_ImageSizePanel_radios"},r.a.createElement("label",null,r.a.createElement("div",{className:"mx_ImageSizePanel_size mx_ImageSizePanel_sizeDefault"}),r.a.createElement(Ye.a,{name:"image_size",value:at.a.Normal,checked:this.state.size===at.a.Normal,onChange:this.onSizeChange},Object(l.a)("Default"))),r.a.createElement("label",null,r.a.createElement("div",{className:"mx_ImageSizePanel_size mx_ImageSizePanel_sizeLarge"}),r.a.createElement(Ye.a,{name:"image_size",value:at.a.Large,checked:this.state.size===at.a.Large,onChange:this.onSizeChange},Object(l.a)("Large")))))}}class it extends r.a.Component{constructor(e){super(e),i()(this,"MESSAGE_PREVIEW_TEXT",Object(l.a)("Hey you. You're the best!")),i()(this,"unmounted",!1),i()(this,"onLayoutChanged",(e=>{this.setState({layout:e})})),this.state={useSystemFont:O.b.getValue("useSystemFont"),systemFont:O.b.getValue("systemFont"),showAdvanced:!1,layout:O.b.getValue("layout")}}async componentDidMount(){const e=u.a.get(),t=e.getUserId(),a=await e.getProfileInfo(t);this.unmounted||this.setState({userId:t,displayName:a.displayname,avatarUrl:a.avatar_url})}componentWillUnmount(){this.unmounted=!0}renderAdvancedSection(){if(!O.b.getValue(z.b.AdvancedSettings))return null;const e=Me.b.get().brand,t=r.a.createElement(f.a,{kind:"link",onClick:()=>this.setState({showAdvanced:!this.state.showAdvanced})},this.state.showAdvanced?Object(l.a)("Hide advanced"):Object(l.a)("Show advanced"));let a;if(this.state.showAdvanced){const t=Object(l.a)("Set the name of a font installed on your system & %(brand)s will attempt to use it.",{brand:e});a=r.a.createElement(r.a.Fragment,null,r.a.createElement(Le.a,{name:"useCompactLayout",level:H.a.DEVICE,useCheckbox:!0}),r.a.createElement(Le.a,{name:"useSystemFont",level:H.a.DEVICE,useCheckbox:!0,onChange:e=>this.setState({useSystemFont:e})}),r.a.createElement(h.a,{className:"mx_AppearanceUserSettingsTab_systemFont",label:O.b.getDisplayName("systemFont"),onChange:e=>{this.setState({systemFont:e.target.value}),O.b.setValue("systemFont",null,H.a.DEVICE,e.target.value)},tooltipContent:t,forceTooltipVisible:!0,disabled:!this.state.useSystemFont,value:this.state.systemFont}))}return r.a.createElement("div",{className:"mx_SettingsTab_section mx_AppearanceUserSettingsTab_Advanced"},t,a)}render(){const e=Me.b.get().brand;return r.a.createElement("div",{className:"mx_SettingsTab mx_AppearanceUserSettingsTab"},r.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(l.a)("Customise your appearance")),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("Appearance Settings only affect this %(brand)s session.",{brand:e})),r.a.createElement(tt.a,null),r.a.createElement(Je,{userId:this.state.userId,displayName:this.state.displayName,avatarUrl:this.state.avatarUrl,messagePreviewText:this.MESSAGE_PREVIEW_TEXT,onLayoutChanged:this.onLayoutChanged}),r.a.createElement(et,null),this.renderAdvancedSection(),r.a.createElement(nt,null))}}var st=a(16),rt=a(140),ot=a(174),lt=a(241),ct=a(367),dt=a(250);class mt extends r.a.PureComponent{constructor(e){super(e),i()(this,"unmounted",!1),i()(this,"onKeyBackupSessionsRemaining",(e=>{this.setState({sessionsRemaining:e})})),i()(this,"onKeyBackupStatus",(()=>{this.loadBackupStatus()})),i()(this,"startNewBackup",(()=>{g.b.createDialogAsync(a.e(8).then(a.bind(null,912)),{onFinished:()=>{this.loadBackupStatus()}},void 0,!1,!0)})),i()(this,"deleteBackup",(()=>{g.b.createDialog(ce.a,{title:Object(l.a)("Delete Backup"),description:Object(l.a)("Are you sure? You will lose your encrypted messages if your keys are not backed up properly."),button:Object(l.a)("Delete Backup"),danger:!0,onFinished:e=>{e&&(this.setState({loading:!0}),u.a.get().deleteKeyBackupVersion(this.state.backupInfo.version).then((()=>{this.loadBackupStatus()})))}})})),i()(this,"restoreBackup",(async()=>{g.b.createDialog(ct.a,void 0,void 0,!1,!0)})),i()(this,"resetSecretStorage",(async()=>{this.setState({error:null});try{await Object(dt.b)((async()=>{}),!0)}catch(e){if(d.a.error("Error resetting secret storage",e),this.unmounted)return;this.setState({error:e})}this.unmounted||this.loadBackupStatus()})),this.state={loading:!0,error:null,backupKeyStored:null,backupKeyCached:null,backupKeyWellFormed:null,secretStorageKeyInAccount:null,secretStorageReady:null,backupInfo:null,backupSigStatus:null,sessionsRemaining:0}}componentDidMount(){this.checkKeyBackupStatus(),u.a.get().on(ot.b.KeyBackupStatus,this.onKeyBackupStatus),u.a.get().on(ot.b.KeyBackupSessionsRemaining,this.onKeyBackupSessionsRemaining)}componentWillUnmount(){this.unmounted=!0,u.a.get()&&(u.a.get().removeListener(ot.b.KeyBackupStatus,this.onKeyBackupStatus),u.a.get().removeListener(ot.b.KeyBackupSessionsRemaining,this.onKeyBackupSessionsRemaining))}async checkKeyBackupStatus(){this.getUpdatedDiagnostics();try{const{backupInfo:e,trustInfo:t}=await u.a.get().checkKeyBackup();this.setState({loading:!1,error:null,backupInfo:e,backupSigStatus:t})}catch(e){if(d.a.log("Unable to fetch check backup status",e),this.unmounted)return;this.setState({loading:!1,error:e,backupInfo:null,backupSigStatus:null})}}async loadBackupStatus(){this.setState({loading:!0}),this.getUpdatedDiagnostics();try{const e=await u.a.get().getKeyBackupVersion(),t=await u.a.get().isKeyBackupTrusted(e);if(this.unmounted)return;this.setState({loading:!1,error:null,backupInfo:e,backupSigStatus:t})}catch(e){if(d.a.log("Unable to fetch key backup status",e),this.unmounted)return;this.setState({loading:!1,error:e,backupInfo:null,backupSigStatus:null})}}async getUpdatedDiagnostics(){const e=u.a.get(),t=e.crypto.secretStorage,a=!!await e.isKeyBackupKeyStored(),n=await e.crypto.getSessionBackupPrivateKey(),i=!!n,s=n instanceof Uint8Array,r=await t.hasKey(),o=await e.isSecretStorageReady();this.unmounted||this.setState({backupKeyStored:a,backupKeyCached:i,backupKeyWellFormed:s,secretStorageKeyInAccount:r,secretStorageReady:o})}render(){const{loading:e,error:t,backupKeyStored:a,backupKeyCached:n,backupKeyWellFormed:i,secretStorageKeyInAccount:s,secretStorageReady:o,backupInfo:c,backupSigStatus:d,sessionsRemaining:m}=this.state;let h,p,g;const v=[];if(t)h=r.a.createElement("div",{className:"error"},Object(l.a)("Unable to load key backup status"));else if(e)h=r.a.createElement(k.a,null);else if(c){let e,t=Object(l.a)("Restore from Backup");u.a.get().getKeyBackupEnabled()?h=r.a.createElement("p",null,"✅ ",Object(l.a)("This session is backing up your keys.")):(h=r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,Object(l.a)("This session is <b>not backing up your keys</b>, but you do have an existing backup you can restore from and add to going forward.",{},{b:e=>r.a.createElement("b",null,e)})),r.a.createElement("p",null,Object(l.a)("Connect this session to key backup before signing out to avoid losing any keys that may only be on this session."))),t=Object(l.a)("Connect this session to Key Backup")),e=u.a.get().getKeyBackupEnabled()?m>0?r.a.createElement("div",null,Object(l.a)("Backing up %(sessionsRemaining)s keys…",{sessionsRemaining:m})," ",r.a.createElement("br",null)):r.a.createElement("div",null,Object(l.a)("All keys backed up")," ",r.a.createElement("br",null)):"";let a,n=d.sigs.map(((e,t)=>{const a=e.device?e.device.getDisplayName()||e.device.deviceId:null,n=t=>r.a.createElement("span",{className:e.valid?"mx_SecureBackupPanel_sigValid":"mx_SecureBackupPanel_sigInvalid"},t),i=t=>r.a.createElement("span",{className:e.device&&e.deviceTrust.isVerified()?"mx_SecureBackupPanel_deviceVerified":"mx_SecureBackupPanel_deviceNotVerified"},t),s=e=>r.a.createElement("span",{className:"mx_SecureBackupPanel_deviceName"},a),o=e.device&&e.device.getFingerprint()===u.a.get().getDeviceEd25519Key(),c=e.crossSigningId&&e.deviceId===u.a.get().getCrossSigningId();let d;return e.valid&&c?d=Object(l.a)("Backup has a <validity>valid</validity> signature from this user",{},{validity:n}):!e.valid&&c?d=Object(l.a)("Backup has a <validity>invalid</validity> signature from this user",{},{validity:n}):e.crossSigningId?d=Object(l.a)("Backup has a signature from <verify>unknown</verify> user with ID %(deviceId)s",{deviceId:e.deviceId},{verify:i}):e.device?e.valid&&o?d=Object(l.a)("Backup has a <validity>valid</validity> signature from this session",{},{validity:n}):!e.valid&&o?d=Object(l.a)("Backup has an <validity>invalid</validity> signature from this session",{},{validity:n}):e.valid&&e.deviceTrust.isVerified()?d=Object(l.a)("Backup has a <validity>valid</validity> signature from <verify>verified</verify> session <device></device>",{},{validity:n,verify:i,device:s}):e.valid&&!e.deviceTrust.isVerified()?d=Object(l.a)("Backup has a <validity>valid</validity> signature from <verify>unverified</verify> session <device></device>",{},{validity:n,verify:i,device:s}):!e.valid&&e.deviceTrust.isVerified()?d=Object(l.a)("Backup has an <validity>invalid</validity> signature from <verify>verified</verify> session <device></device>",{},{validity:n,verify:i,device:s}):e.valid||e.deviceTrust.isVerified()||(d=Object(l.a)("Backup has an <validity>invalid</validity> signature from <verify>unverified</verify> session <device></device>",{},{validity:n,verify:i,device:s})):d=Object(l.a)("Backup has a signature from <verify>unknown</verify> session with ID %(deviceId)s",{deviceId:e.deviceId},{verify:i}),r.a.createElement("div",{key:t},d)}));0===d.sigs.length&&(n=Object(l.a)("Backup is not signed by any of your sessions")),d.trusted_locally&&(a=Object(l.a)("This backup is trusted because it has been restored on this session")),p=r.a.createElement(r.a.Fragment,null,r.a.createElement("tr",null,r.a.createElement("td",null,Object(l.a)("Backup version:")),r.a.createElement("td",null,c.version)),r.a.createElement("tr",null,r.a.createElement("td",null,Object(l.a)("Algorithm:")),r.a.createElement("td",null,c.algorithm))),g=r.a.createElement(r.a.Fragment,null,e,r.a.createElement("div",null,n),r.a.createElement("div",null,a)),v.push(r.a.createElement(f.a,{key:"restore",kind:"primary",onClick:this.restoreBackup},t)),Object(lt.g)()||v.push(r.a.createElement(f.a,{key:"delete",kind:"danger",onClick:this.deleteBackup},Object(l.a)("Delete Backup")))}else h=r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,Object(l.a)("Your keys are <b>not being backed up from this session</b>.",{},{b:e=>r.a.createElement("b",null,e)})),r.a.createElement("p",null,Object(l.a)("Back up your keys before signing out to avoid losing them."))),v.push(r.a.createElement(f.a,{key:"setup",kind:"primary",onClick:this.startNewBackup},Object(l.a)("Set up")));s&&v.push(r.a.createElement(f.a,{key:"reset",kind:"danger",onClick:this.resetSecretStorage},Object(l.a)("Reset")));let b,y="";return n&&(y=", ",y+=i?Object(l.a)("well formed"):Object(l.a)("unexpected type")),v.length&&(b=r.a.createElement("div",{className:"mx_SecureBackupPanel_buttonRow"},v)),r.a.createElement("div",null,r.a.createElement("p",null,Object(l.a)("Back up your encryption keys with your account data in case you lose access to your sessions. Your keys will be secured with a unique Security Key.")),h,r.a.createElement("details",null,r.a.createElement("summary",null,Object(l.a)("Advanced")),r.a.createElement("table",{className:"mx_SecureBackupPanel_statusList"},r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,Object(l.a)("Backup key stored:")),r.a.createElement("td",null,!0===a?Object(l.a)("in secret storage"):Object(l.a)("not stored"))),r.a.createElement("tr",null,r.a.createElement("td",null,Object(l.a)("Backup key cached:")),r.a.createElement("td",null,n?Object(l.a)("cached locally"):Object(l.a)("not found locally"),y)),r.a.createElement("tr",null,r.a.createElement("td",null,Object(l.a)("Secret storage public key:")),r.a.createElement("td",null,s?Object(l.a)("in account data"):Object(l.a)("not found"))),r.a.createElement("tr",null,r.a.createElement("td",null,Object(l.a)("Secret storage:")),r.a.createElement("td",null,o?Object(l.a)("ready"):Object(l.a)("not ready"))),p)),g),b)}}const ut="e2ee.manuallyVerifyAllSessions";var ht=()=>r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Encryption")),r.a.createElement(Le.a,{name:ut,level:H.a.DEVICE}),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("Individually verify each session used by a user to mark it as trusted, not trusting cross-signed devices.")));var pt=a(211);class gt extends r.a.Component{constructor(e){super(e),i()(this,"onExportE2eKeysClicked",(()=>{g.b.createDialogAsync(a.e(7).then(a.bind(null,1536)),{matrixClient:u.a.get()})})),i()(this,"onImportE2eKeysClicked",(()=>{g.b.createDialogAsync(a.e(34).then(a.bind(null,1566)),{matrixClient:u.a.get()})})),i()(this,"updateBlacklistDevicesFlag",(e=>{u.a.get().setGlobalBlacklistUnverifiedDevices(e)}))}render(){const e=u.a.get(),t=e.deviceId;let a,n,i=e.getDeviceEd25519Key();return i=i?pt.e(i):Object(l.a)("<not supported>"),e.isCryptoEnabled()&&(a=r.a.createElement("div",{className:"mx_CryptographyPanel_importExportButtons"},r.a.createElement(f.a,{kind:"primary",onClick:this.onExportE2eKeysClicked},Object(l.a)("Export E2E room keys")),r.a.createElement(f.a,{kind:"primary",onClick:this.onImportE2eKeysClicked},Object(l.a)("Import E2E room keys")))),O.b.isEnabled("blacklistUnverifiedDevices")&&(n=r.a.createElement(Le.a,{name:"blacklistUnverifiedDevices",level:H.a.DEVICE,onChange:this.updateBlacklistDevicesFlag})),r.a.createElement("div",{className:"mx_SettingsTab_section mx_CryptographyPanel"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Cryptography")),r.a.createElement("table",{className:"mx_SettingsTab_subsectionText mx_CryptographyPanel_sessionInfo"},r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,Object(l.a)("Session ID:")),r.a.createElement("td",null,r.a.createElement("code",null,t))),r.a.createElement("tr",null,r.a.createElement("td",null,Object(l.a)("Session key:")),r.a.createElement("td",null,r.a.createElement("code",null,r.a.createElement("b",null,i)))))),a,n)}}var vt,bt=a(399),ft=a(472),yt=a(630),Et=a(175);function _t(){return _t=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},_t.apply(this,arguments)}var wt;function St(){return St=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},St.apply(this,arguments)}var Ot;function Ct(){return Ct=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Ct.apply(this,arguments)}var xt;function jt(){return jt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},jt.apply(this,arguments)}var kt;function Rt(){return Rt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Rt.apply(this,arguments)}function It(e){return s.createElement("svg",Rt({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 18 18",role:"presentation","aria-hidden":!0},e),kt||(kt=s.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 3.05v6.22C2 15.63 9 17 9 17s7-1.37 7-7.73V3.05L9 1 2 3.05zm9.94 2.47c.19-.18.49-.17.67.02.16.18.16.45.02.63l-4.22 5.11-.03.04c-.28.34-.79.39-1.13.11a.29.29 0 01-.077-.067.912.912 0 00-.023-.023L5.34 9.26c-.2-.24-.18-.6.06-.8.2-.18.49-.18.7-.04l1.57 1.1 4.27-4z",fill:"currentColor"})))}var Tt=a(620),Nt=a(474);const Pt={[Nt.a.Desktop]:function(e){return s.createElement("svg",St({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 22 19",role:"presentation","aria-hidden":!0},e),wt||(wt=s.createElement("path",{d:"M3 15.5c-.55 0-1.02-.196-1.412-.587A1.927 1.927 0 011 13.5v-11c0-.55.196-1.021.588-1.413A1.925 1.925 0 013 .5h16c.55 0 1.021.196 1.413.587.391.392.587.863.587 1.413v11c0 .55-.196 1.021-.587 1.413A1.928 1.928 0 0119 15.5H3zm0-2h16v-11H3v11zm-2 5a.965.965 0 01-.712-.288A.965.965 0 010 17.5c0-.283.096-.52.288-.712A.965.965 0 011 16.5h20c.283 0 .52.096.712.288A.965.965 0 0122 17.5c0 .283-.096.52-.288.712A.965.965 0 0121 18.5H1zm2-5v-11 11z",fill:"currentColor"})))},[Nt.a.Mobile]:function(e){return s.createElement("svg",jt({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 14 23",role:"presentation","aria-hidden":!0},e),xt||(xt=s.createElement("path",{d:"M12 .51L2 .5c-1.1 0-2 .9-2 2v18c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2v-18c0-1.1-.9-1.99-2-1.99zm0 17.99H2v-14h10v14z",fill:"currentColor"})))},[Nt.a.Web]:function(e){return s.createElement("svg",Ct({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 17",role:"presentation","aria-hidden":!0},e),Ot||(Ot=s.createElement("path",{d:"M18 16.5H2c-.55 0-1.02-.196-1.412-.587A1.927 1.927 0 010 14.5v-12c0-.55.196-1.02.588-1.412A1.923 1.923 0 012 .5h16c.55 0 1.021.196 1.413.588.391.391.587.862.587 1.412v12c0 .55-.196 1.021-.587 1.413A1.928 1.928 0 0118 16.5zM2 4.5v10h16v-10H2z",fill:"currentColor"})))},[Nt.a.Unknown]:function(e){return s.createElement("svg",_t({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 22 23",role:"presentation","aria-hidden":!0},e),vt||(vt=s.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 22.5c6.075 0 11-4.925 11-11S17.075.5 11 .5 0 5.425 0 11.5s4.925 11 11 11zm0-4.24a1.375 1.375 0 100-2.75 1.375 1.375 0 000 2.75zM9.09 9.428A1.91 1.91 0 0111 7.518c1.048 0 1.91.862 1.91 1.91 0 .485-.208.659-1.026 1.224-.363.25-.86.598-1.246 1.108-.415.546-.67 1.227-.67 2.093h2.063c0-.424.113-.666.25-.846.164-.217.402-.4.775-.659l.124-.084c.676-.46 1.792-1.219 1.792-2.836A3.98 3.98 0 0011 5.456a3.972 3.972 0 00-3.973 3.972H9.09z",fill:"currentColor"})))}},Dt={[Nt.a.Desktop]:Object(l.a)("Desktop session"),[Nt.a.Mobile]:Object(l.a)("Mobile session"),[Nt.a.Web]:Object(l.a)("Web session"),[Nt.a.Unknown]:Object(l.a)("Unknown session type")},Mt=e=>{let{isVerified:t,isSelected:a,deviceType:n}=e;const i=Pt[n]||Pt[Nt.a.Unknown],s=Dt[n]||Dt[Nt.a.Unknown];return r.a.createElement("div",{className:He()("mx_DeviceTypeIcon",{mx_DeviceTypeIcon_selected:a})},r.a.createElement("div",{className:"mx_DeviceTypeIcon_deviceIconWrapper"},r.a.createElement(i,{className:"mx_DeviceTypeIcon_deviceIcon",role:"img","aria-label":s})),t?r.a.createElement(It,{className:He()("mx_DeviceTypeIcon_verificationIcon","verified"),role:"img","aria-label":Object(l.a)("Verified")}):r.a.createElement(Tt.Icon,{className:He()("mx_DeviceTypeIcon_verificationIcon","unverified"),role:"img","aria-label":Object(l.a)("Unverified")}))};var At=a(609),Lt=a(865);const Ut=e=>{let{device:t}=e;return r.a.createElement(Et.a,{size:"h4"},t.display_name||t.device_id)};var Ft=e=>{let{device:t,children:a,isSelected:n,onClick:i}=e;return r.a.createElement("div",{className:He()("mx_DeviceTile",{mx_DeviceTile_interactive:!!i}),"data-testid":`device-tile-${t.device_id}`,onClick:i},r.a.createElement(Mt,{isVerified:t.isVerified,isSelected:n,deviceType:t.deviceType}),r.a.createElement("div",{className:"mx_DeviceTile_info"},r.a.createElement(Ut,{device:t}),r.a.createElement("div",{className:"mx_DeviceTile_metadata"},r.a.createElement(Lt.a,{device:t}))),r.a.createElement("div",{className:"mx_DeviceTile_actions",onClick:Object(At.a)((()=>{}))},a))};var Bt=e=>{let{children:t,device:a,isSelected:n,onSelect:i,onClick:s}=e;return r.a.createElement("div",{className:"mx_SelectableDeviceTile"},r.a.createElement(D.b,{kind:D.a.Solid,checked:n,onChange:i,className:"mx_SelectableDeviceTile_checkbox",id:`device-tile-checkbox-${a.device_id}`,"data-testid":`device-tile-checkbox-${a.device_id}`}),r.a.createElement(Ft,{device:a,onClick:s,isSelected:n},t))};function Vt(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function Wt(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?Vt(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):Vt(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}class Ht extends r.a.Component{constructor(e){super(e),i()(this,"onDeviceToggled",(()=>{this.props.onDeviceToggled(this.props.device)})),i()(this,"onRename",(()=>{this.setState({renaming:!0})})),i()(this,"onChangeDisplayName",(e=>{this.setState({displayName:e.target.value})})),i()(this,"onRenameSubmit",(async()=>{this.setState({renaming:!1}),await u.a.get().setDeviceDetails(this.props.device.device_id,{display_name:this.state.displayName}).catch((e=>{throw d.a.error("Error setting session display name",e),new Error(Object(l.a)("Failed to set display name"))})),this.props.onDeviceChange()})),i()(this,"onRenameCancel",(()=>{this.setState({renaming:!1})})),i()(this,"onOwnDeviceSignOut",(()=>{g.b.createDialog(yt.a,{},void 0,!1,!0)})),i()(this,"verify",(async()=>{if(this.props.isOwnDevice)g.b.createDialog(bt.a,{onFinished:this.props.onDeviceChange});else{const e=u.a.get(),t=e.getUserId(),a=e.requestVerification(t,[this.props.device.device_id]);g.b.createDialog(ft.a,{verificationRequestPromise:a,member:e.getUser(t),onFinished:async()=>{(await a).cancel(),this.props.onDeviceChange()}})}})),this.state={renaming:!1,displayName:e.device.display_name}}render(){let e,t,a="";null!==this.props.verified&&(a=this.props.verified?"mx_E2EIcon_verified":"mx_E2EIcon_warning",!this.props.verified&&this.props.canBeVerified&&(e=r.a.createElement(f.a,{kind:"primary",onClick:this.verify},Object(l.a)("Verify")))),this.props.isOwnDevice&&(t=r.a.createElement(f.a,{kind:"danger_outline",onClick:this.onOwnDeviceSignOut},Object(l.a)("Sign Out")));const n=this.state.renaming?r.a.createElement("form",{className:"mx_DevicesPanel_renameForm",onSubmit:this.onRenameSubmit},r.a.createElement(h.a,{label:Object(l.a)("Display Name"),type:"text",value:this.state.displayName,autoComplete:"off",onChange:this.onChangeDisplayName,autoFocus:!0}),r.a.createElement(f.a,{onClick:this.onRenameSubmit,kind:"confirm_sm"}),r.a.createElement(f.a,{onClick:this.onRenameCancel,kind:"cancel_sm"})):r.a.createElement(r.a.Fragment,null,t,e,r.a.createElement(f.a,{kind:"primary_outline",onClick:this.onRename},Object(l.a)("Rename"))),i=Wt(Wt({},this.props.device),{},{isVerified:this.props.verified,deviceType:Nt.a.Unknown});return this.props.isOwnDevice?r.a.createElement("div",{className:He()("mx_DevicesPanel_device","mx_DevicesPanel_myDevice")},r.a.createElement("div",{className:"mx_DevicesPanel_deviceTrust"},r.a.createElement("span",{className:"mx_DevicesPanel_icon mx_E2EIcon "+a})),r.a.createElement(Ft,{device:i},n)):r.a.createElement("div",{className:"mx_DevicesPanel_device"},r.a.createElement(Bt,{device:i,onSelect:this.onDeviceToggled,isSelected:this.props.selected},n))}}const zt=(e,t)=>async a=>e.deleteMultipleDevices(t,a),Gt=async(e,t,a)=>{if(t.length)try{await zt(e,t)(),a(!0,void 0)}catch(i){var n;if(401!==i.httpStatus||null===(n=i.data)||void 0===n||!n.flows)throw i;const s=t.length,r={[P.c.PHASE_PREAUTH]:{title:Object(l.a)("Use Single Sign On to continue"),body:Object(l.a)("Confirm logging out these devices by using Single Sign On to prove your identity.",{count:s}),continueText:Object(l.a)("Single Sign On"),continueKind:"primary"},[P.c.PHASE_POSTAUTH]:{title:Object(l.a)("Confirm signing out these devices",{count:s}),body:Object(l.a)("Click the button below to confirm signing out these devices.",{count:s}),continueText:Object(l.a)("Sign out devices",{count:s}),continueKind:"danger"}};g.b.createDialog(K.a,{title:Object(l.a)("Authentication"),matrixClient:e,authData:i.data,onFinished:a,makeRequest:zt(e,t),aestheticsForStagePhases:{[P.c.LOGIN_TYPE]:r,[P.c.UNSTABLE_LOGIN_TYPE]:r}})}};var Kt=a(133),qt=a(864);class $t extends r.a.Component{constructor(e){super(e),i()(this,"context",void 0),i()(this,"unmounted",!1),i()(this,"onDevicesUpdated",(e=>{e.includes(this.context.getUserId())&&this.loadDevices()})),i()(this,"onDeviceSelectionToggled",(e=>{if(this.unmounted)return;const t=e.device_id;this.setState(((e,a)=>{const n=e.selectedDevices.slice(),i=n.indexOf(t);return-1===i?n.push(t):n.splice(i,1),{selectedDevices:n}}))})),i()(this,"selectAll",(e=>{this.setState(((t,a)=>{const n=t.selectedDevices.slice();for(const t of e){const e=t.device_id;n.includes(e)||n.push(e)}return{selectedDevices:n}}))})),i()(this,"deselectAll",(e=>{this.setState(((t,a)=>{const n=t.selectedDevices.slice();for(const t of e){const e=t.device_id,a=n.indexOf(e);-1!==a&&n.splice(a,1)}return{selectedDevices:n}}))})),i()(this,"onDeleteClick",(async()=>{if(0!==this.state.selectedDevices.length){this.setState({deleting:!0});try{await Gt(this.context,this.state.selectedDevices,(e=>{e&&(this.setState({selectedDevices:[]}),this.loadDevices()),this.setState({deleting:!1})}))}catch(e){d.a.error("Error deleting sessions",e),this.setState({deleting:!1})}}})),i()(this,"renderDevice",(e=>{const t=this.context.getDeviceId(),a=this.state.devices.find((e=>e.device_id===t)),n=e.device_id===t,i=a&&this.isDeviceVerified(a)||n;return r.a.createElement(Ht,{key:e.device_id,device:e,selected:this.state.selectedDevices.includes(e.device_id),isOwnDevice:n,verified:this.isDeviceVerified(e),canBeVerified:i,onDeviceChange:this.loadDevices,onDeviceToggled:this.onDeviceSelectionToggled})})),this.state={devices:[],selectedDevices:[]},this.loadDevices=this.loadDevices.bind(this)}componentDidMount(){this.context.on(ot.b.DevicesUpdated,this.onDevicesUpdated),this.loadDevices()}componentWillUnmount(){this.context.off(ot.b.DevicesUpdated,this.onDevicesUpdated),this.unmounted=!0}loadDevices(){this.context.getDevices().then((e=>{this.unmounted||this.setState(((t,a)=>{const n=e.devices.map((e=>e.device_id)),i=t.selectedDevices.filter((e=>n.includes(e)));return{devices:e.devices||[],selectedDevices:i}}))}),(e=>{if(this.unmounted)return;let t;404==e.httpStatus?t=Object(l.a)("Your homeserver does not support device management."):(d.a.error("Error loading sessions:",e),t=Object(l.a)("Unable to load device list")),this.setState({deviceLoadError:t})}))}deviceCompare(e,t){const a=(t.last_seen_ts||0)-(e.last_seen_ts||0);if(0!==a)return a;const n=e.device_id,i=t.device_id;return n<i?-1:n>i?1:0}isDeviceVerified(e){return Object(qt.a)(e,this.context)}render(){const e=r.a.createElement("div",{className:He()(this.props.className,"error")},this.state.deviceLoadError);if(void 0!==this.state.deviceLoadError)return e;const t=this.state.devices;if(void 0===t)return r.a.createElement(k.a,null);const a=this.context.getDeviceId(),n=t.find((e=>e.device_id===a));if(!n)return e;const i=t.filter((e=>e.device_id!==a));i.sort(this.deviceCompare);const s=[],o=[],c=[];for(const e of i){const t=this.isDeviceVerified(e);!0===t?s.push(e):!1===t?o.push(e):c.push(e)}const d=(e,t,a)=>{if(0===a.length)return r.a.createElement(r.a.Fragment,null);let n;if(a.length>1){const e=a.some((e=>this.state.selectedDevices.includes(e.device_id))),t=e?()=>{this.deselectAll(a)}:()=>{this.selectAll(a)},i=e?Object(l.a)("Deselect all"):Object(l.a)("Select all");n=r.a.createElement("div",{className:"mx_DevicesPanel_header_button"},r.a.createElement(f.a,{className:"mx_DevicesPanel_selectButton",kind:"secondary",onClick:t},i))}return r.a.createElement(r.a.Fragment,null,r.a.createElement("hr",null),r.a.createElement("div",{className:"mx_DevicesPanel_header"},r.a.createElement("div",{className:"mx_DevicesPanel_header_trust"},e),r.a.createElement("div",{className:"mx_DevicesPanel_header_title"},t),n),a.map(this.renderDevice))},m=d(r.a.createElement("span",{className:"mx_DevicesPanel_header_icon mx_E2EIcon mx_E2EIcon_verified"}),Object(l.a)("Verified devices"),s),u=d(r.a.createElement("span",{className:"mx_DevicesPanel_header_icon mx_E2EIcon mx_E2EIcon_warning"}),Object(l.a)("Unverified devices"),o),h=d(r.a.createElement(r.a.Fragment,null),Object(l.a)("Devices without encryption support"),c),p=this.state.deleting?r.a.createElement(k.a,{w:22,h:22}):r.a.createElement(f.a,{className:"mx_DevicesPanel_deleteButton",onClick:this.onDeleteClick,kind:"danger_outline",disabled:0===this.state.selectedDevices.length,"data-testid":"sign-out-devices-btn"},Object(l.a)("Sign out %(count)s selected devices",{count:this.state.selectedDevices.length})),g=i.length>0?r.a.createElement(r.a.Fragment,null,m,u,h,p):r.a.createElement(r.a.Fragment,null,r.a.createElement("hr",null),r.a.createElement("div",{className:"mx_DevicesPanel_noOtherDevices"},Object(l.a)("You aren't signed into any other devices."))),v=He()(this.props.className,"mx_DevicesPanel");return r.a.createElement("div",{className:v},r.a.createElement("div",{className:"mx_DevicesPanel_header"},r.a.createElement("div",{className:"mx_DevicesPanel_header_title"},Object(l.a)("This device"))),this.renderDevice(n),g)}}i()($t,"contextType",Kt.a);var Yt=a(145);class Jt extends r.a.Component{constructor(){super(...arguments),i()(this,"onConfirm",(()=>{this.props.onFinished(!0)})),i()(this,"onDecline",(()=>{this.props.onFinished(!1)}))}render(){return r.a.createElement(M.a,{className:"mx_ConfirmDestroyCrossSigningDialog",hasCancel:!0,onFinished:this.props.onFinished,title:Object(l.a)("Destroy cross-signing keys?")},r.a.createElement("div",{className:"mx_ConfirmDestroyCrossSigningDialog_content"},r.a.createElement("p",null,Object(l.a)("Deleting cross-signing keys is permanent. Anyone you have verified with will see security alerts. You almost certainly don't want to do this, unless you've lost every device you can cross-sign from."))),r.a.createElement(Yt.a,{primaryButton:Object(l.a)("Clear cross-signing keys"),onPrimaryButtonClick:this.onConfirm,primaryButtonClass:"danger",cancelButton:Object(l.a)("Cancel"),onCancel:this.onDecline}))}}class Qt extends r.a.PureComponent{constructor(e){super(e),i()(this,"unmounted",!1),i()(this,"onAccountData",(e=>{const t=e.getType();(t.startsWith("m.cross_signing")||t.startsWith("m.secret_storage"))&&this.getUpdatedStatus()})),i()(this,"onBootstrapClick",(()=>{this.state.crossSigningPrivateKeysInStorage?g.b.createDialog(bt.a,{},void 0,!1,!0):Object(dt.b)()})),i()(this,"onStatusChanged",(()=>{this.getUpdatedStatus()})),i()(this,"bootstrapCrossSigning",(async e=>{let{forceReset:t=!1}=e;this.setState({error:void 0});try{const e=u.a.get();await e.bootstrapCrossSigning({authUploadDeviceSigningKeys:async t=>{const{finished:a}=g.b.createDialog(K.a,{title:Object(l.a)("Setting up keys"),matrixClient:e,makeRequest:t}),[n]=await a;if(!n)throw new Error("Cross-signing key upload auth canceled")},setupNewCrossSigning:t})}catch(e){this.setState({error:e}),d.a.error("Error bootstrapping cross-signing",e)}this.unmounted||this.getUpdatedStatus()})),i()(this,"resetCrossSigning",(()=>{g.b.createDialog(Jt,{onFinished:e=>{e&&this.bootstrapCrossSigning({forceReset:!0})}})})),this.state={}}componentDidMount(){const e=u.a.get();e.on(m.ClientEvent.AccountData,this.onAccountData),e.on(ot.b.UserTrustStatusChanged,this.onStatusChanged),e.on(ot.b.KeysChanged,this.onStatusChanged),this.getUpdatedStatus()}componentWillUnmount(){this.unmounted=!0;const e=u.a.get();e&&(e.removeListener(m.ClientEvent.AccountData,this.onAccountData),e.removeListener(ot.b.UserTrustStatusChanged,this.onStatusChanged),e.removeListener(ot.b.KeysChanged,this.onStatusChanged))}async getUpdatedStatus(){const e=u.a.get(),t=e.getCrossSigningCacheCallbacks(),a=e.crypto.crossSigningInfo,n=e.crypto.secretStorage,i=Boolean(a.getId()),s=Boolean(await a.isStoredInSecretStorage(n)),r=!(!t||!await t.getCrossSigningKeyCache("master")),o=!(!t||!await t.getCrossSigningKeyCache("self_signing")),l=!(!t||!await t.getCrossSigningKeyCache("user_signing")),c=await e.doesServerSupportUnstableFeature("org.matrix.e2e_cross_signing"),d=await e.isCrossSigningReady();this.setState({crossSigningPublicKeysOnDevice:i,crossSigningPrivateKeysInStorage:s,masterPrivateKeyCached:r,selfSigningPrivateKeyCached:o,userSigningPrivateKeyCached:l,homeserverSupportsCrossSigning:c,crossSigningReady:d})}render(){const{error:e,crossSigningPublicKeysOnDevice:t,crossSigningPrivateKeysInStorage:a,masterPrivateKeyCached:n,selfSigningPrivateKeyCached:i,userSigningPrivateKeyCached:s,homeserverSupportsCrossSigning:o,crossSigningReady:c}=this.state;let d,m;e&&(d=r.a.createElement("div",{className:"error"},e.toString())),m=void 0===o?r.a.createElement(k.a,null):o?c&&a?r.a.createElement("p",null,"✅ ",Object(l.a)("Cross-signing is ready for use.")):c&&!a?r.a.createElement("p",null,"⚠️ ",Object(l.a)("Cross-signing is ready but keys are not backed up.")):a?r.a.createElement("p",null,Object(l.a)("Your account has a cross-signing identity in secret storage, but it is not yet trusted by this session.")):r.a.createElement("p",null,Object(l.a)("Cross-signing is not set up.")):r.a.createElement("p",null,Object(l.a)("Your homeserver does not support cross-signing."));const u=t||a||n||i||s,h=[];if(!(t&&a&&n&&i&&s)&&o){let e=Object(l.a)("Set up Secure Backup");a&&(e=Object(l.a)("Verify this session")),h.push(r.a.createElement(f.a,{key:"setup",kind:"primary",onClick:this.onBootstrapClick},e))}let p;return u&&h.push(r.a.createElement(f.a,{key:"reset",kind:"danger",onClick:this.resetCrossSigning},Object(l.a)("Reset"))),h.length&&(p=r.a.createElement("div",{className:"mx_CrossSigningPanel_buttonRow"},h)),r.a.createElement("div",null,m,r.a.createElement("details",null,r.a.createElement("summary",null,Object(l.a)("Advanced")),r.a.createElement("table",{className:"mx_CrossSigningPanel_statusList"},r.a.createElement("tbody",null,r.a.createElement("tr",null,r.a.createElement("td",null,Object(l.a)("Cross-signing public keys:")),r.a.createElement("td",null,t?Object(l.a)("in memory"):Object(l.a)("not found"))),r.a.createElement("tr",null,r.a.createElement("td",null,Object(l.a)("Cross-signing private keys:")),r.a.createElement("td",null,a?Object(l.a)("in secret storage"):Object(l.a)("not found in storage"))),r.a.createElement("tr",null,r.a.createElement("td",null,Object(l.a)("Master private key:")),r.a.createElement("td",null,n?Object(l.a)("cached locally"):Object(l.a)("not found locally"))),r.a.createElement("tr",null,r.a.createElement("td",null,Object(l.a)("Self signing private key:")),r.a.createElement("td",null,i?Object(l.a)("cached locally"):Object(l.a)("not found locally"))),r.a.createElement("tr",null,r.a.createElement("td",null,Object(l.a)("User signing private key:")),r.a.createElement("td",null,s?Object(l.a)("cached locally"):Object(l.a)("not found locally"))),r.a.createElement("tr",null,r.a.createElement("td",null,Object(l.a)("Homeserver feature support:")),r.a.createElement("td",null,o?Object(l.a)("exists"):Object(l.a)("not found")))))),d,p)}}var Xt=a(316);class Zt extends r.a.PureComponent{render(){return r.a.createElement(M.a,{hasCancel:!0,onFinished:this.props.onFinished.bind(null,!1),title:Object(l.a)("Reset event store?")},r.a.createElement("div",null,r.a.createElement("p",null,Object(l.a)("You most likely do not want to reset your event index store"),r.a.createElement("br",null),Object(l.a)("If you do, please note that none of your messages will be deleted, but the search experience might be degraded for a few moments whilst the index is recreated"))),r.a.createElement(Yt.a,{primaryButton:Object(l.a)("Reset event store"),onPrimaryButtonClick:this.props.onFinished.bind(null,!0),primaryButtonClass:"danger",cancelButton:Object(l.a)("Cancel"),onCancel:this.props.onFinished.bind(null,!1)}))}}class ea extends r.a.Component{constructor(e){super(e),i()(this,"updateCurrentRoom",(async()=>{const e=Xt.a.get();let t;try{t=await(null==e?void 0:e.getStats())}catch{return}this.setState({eventIndexSize:t.size,roomCount:t.roomCount})})),i()(this,"onManage",(async()=>{g.b.createDialogAsync(a.e(38).then(a.bind(null,1567)),{onFinished:()=>{}},null,!1,!0)})),i()(this,"onEnable",(async()=>{var e,t;this.setState({enabling:!0}),await Xt.a.initEventIndex(),await(null===(e=Xt.a.get())||void 0===e?void 0:e.addInitialCheckpoints()),null===(t=Xt.a.get())||void 0===t||t.startCrawler(),await O.b.setValue("enableEventIndexing",null,H.a.DEVICE,!0),await this.updateState()})),i()(this,"confirmEventStoreReset",(()=>{const{close:e}=g.b.createDialog(Zt,{onFinished:async t=>{t&&(await O.b.setValue("enableEventIndexing",null,H.a.DEVICE,!1),await Xt.a.deleteEventIndex(),await this.onEnable(),e())}})})),this.state={enabling:!1,eventIndexSize:0,roomCount:0,eventIndexingEnabled:O.b.getValueAt(H.a.DEVICE,"enableEventIndexing")}}componentWillUnmount(){const e=Xt.a.get();null!==e&&e.removeListener("changedCheckpoint",this.updateCurrentRoom)}componentDidMount(){this.updateState()}async updateState(){const e=Xt.a.get(),t=O.b.getValueAt(H.a.DEVICE,"enableEventIndexing");let a=0,n=0;if(null!==e){e.on("changedCheckpoint",this.updateCurrentRoom);try{const t=await e.getStats();a=t.size,n=t.roomCount}catch{}}this.setState({enabling:!1,eventIndexSize:a,roomCount:n,eventIndexingEnabled:t})}render(){let e;const t=Me.b.get().brand;if(null!==Xt.a.get())e=r.a.createElement("div",null,r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("Securely cache encrypted messages locally for them to appear in search results, using %(size)s to store messages from %(rooms)s rooms.",{size:Object(pt.a)(this.state.eventIndexSize,0),count:this.state.roomCount,rooms:Object(pt.d)(this.state.roomCount)})),r.a.createElement("div",null,r.a.createElement(f.a,{kind:"primary",onClick:this.onManage},Object(l.a)("Manage"))));else if(!this.state.eventIndexingEnabled&&Xt.a.supportIsInstalled())e=r.a.createElement("div",null,r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("Securely cache encrypted messages locally for them to appear in search results.")),r.a.createElement("div",null,r.a.createElement(f.a,{kind:"primary",disabled:this.state.enabling,onClick:this.onEnable},Object(l.a)("Enable")),this.state.enabling?r.a.createElement(Ce.a,null):r.a.createElement("div",null)));else if(Xt.a.platformHasSupport()&&!Xt.a.supportIsInstalled()){const a="https://github.com/vector-im/element-desktop/blob/develop/docs/native-node-modules.md#adding-seshat-for-search-in-e2e-encrypted-rooms";e=r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("%(brand)s is missing some components required for securely caching encrypted messages locally. If you'd like to experiment with this feature, build a custom %(brand)s Desktop with <nativeLink>search components added</nativeLink>.",{brand:t},{nativeLink:e=>r.a.createElement("a",{href:a,target:"_blank",rel:"noreferrer noopener"},e)}))}else e=Xt.a.platformHasSupport()?r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},r.a.createElement("p",null,this.state.enabling?r.a.createElement(Ce.a,null):Object(l.a)("Message search initialisation failed")),Xt.a.error&&r.a.createElement("details",null,r.a.createElement("summary",null,Object(l.a)("Advanced")),r.a.createElement("code",null,Xt.a.error.message),r.a.createElement("p",null,r.a.createElement(f.a,{key:"delete",kind:"danger",onClick:this.confirmEventStoreReset},Object(l.a)("Reset"))))):r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("%(brand)s can't securely cache encrypted messages locally while running in a web browser. Use <desktopLink>%(brand)s Desktop</desktopLink> for encrypted messages to appear in search results.",{brand:t},{desktopLink:e=>r.a.createElement("a",{href:"https://element.io/get-started",target:"_blank",rel:"noreferrer noopener"},e)}));return e}}var ta=a(189),aa=a(901),na=a(307),ia=a(651),sa=a(398);class ra extends r.a.Component{constructor(e){super(e)}render(){var e,t,a,n;const i=!(null===(e=this.props.versions)||void 0===e||null===(t=e.unstable_features)||void 0===t||!t["org.matrix.msc3882"]),s=!(null===(a=this.props.versions)||void 0===a||null===(n=a.unstable_features)||void 0===n||!n["org.matrix.msc3886"]);return i&&s?r.a.createElement(sa.a,{heading:Object(l.a)("Sign in with QR code")},r.a.createElement("div",{className:"mx_LoginWithQRSection"},r.a.createElement("p",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("You can use this device to sign in a new device with a QR code. You will need to scan the QR code shown on this device with your device that's signed out.")),r.a.createElement(f.a,{onClick:this.props.onShowQr,kind:"primary"},Object(l.a)("Show QR code")))):null}}class oa extends r.a.Component{constructor(){super(...arguments),i()(this,"onUnignoreClicked",(()=>{this.props.onUnignored(this.props.userId)}))}render(){const e=`mx_SecurityUserSettingsTab_ignoredUser_${this.props.userId}`;return r.a.createElement("div",{className:"mx_SecurityUserSettingsTab_ignoredUser"},r.a.createElement(f.a,{onClick:this.onUnignoreClicked,kind:"primary_sm","aria-describedby":e,disabled:this.props.inProgress},Object(l.a)("Unignore")),r.a.createElement("span",{id:e},this.props.userId))}}class la extends r.a.Component{constructor(e){super(e),i()(this,"dispatcherRef",void 0),i()(this,"onAction",(e=>{let{action:t}=e;if("ignore_state_changed"===t){const e=u.a.get().getIgnoredUsers(),t=this.state.waitingUnignored.filter((t=>e.includes(t)));this.setState({ignoredUserIds:e,waitingUnignored:t})}})),i()(this,"onMyMembership",((e,t)=>{e.isSpaceRoom()||("invite"===t?this.addInvitedRoom(e):this.state.invitedRoomIds.has(e.roomId)&&this.removeInvitedRoom(e.roomId))})),i()(this,"addInvitedRoom",(e=>{this.setState((t=>{let{invitedRoomIds:a}=t;return{invitedRoomIds:new Set(a).add(e.roomId)}}))})),i()(this,"removeInvitedRoom",(e=>{this.setState((t=>{let{invitedRoomIds:a}=t;const n=new Set(a);return n.delete(e),{invitedRoomIds:n}}))})),i()(this,"onUserUnignored",(async e=>{const{ignoredUserIds:t,waitingUnignored:a}=this.state,n=t.filter((e=>!a.includes(e))),i=n.indexOf(e);-1!==i&&(n.splice(i,1),this.setState((t=>{let{waitingUnignored:a}=t;return{waitingUnignored:[...a,e]}})),u.a.get().setIgnoredUsers(n))})),i()(this,"getInvitedRooms",(()=>u.a.get().getRooms().filter((e=>e.hasMembershipState(u.a.get().getUserId(),"invite"))))),i()(this,"manageInvites",(async e=>{this.setState({managingInvites:!0});const t=Array.from(this.state.invitedRoomIds),a=u.a.get(),n=e?a.joinRoom.bind(a):a.leave.bind(a);for(let e=0;e<t.length;e++){const a=t[e];await n(a).then((()=>{this.removeInvitedRoom(a)}),(async t=>{"M_LIMIT_EXCEEDED"===t.errcode?(await Object(st.N)(t.retry_after_ms||2500),e--):d.a.warn(t)}))}this.setState({managingInvites:!1})})),i()(this,"onAcceptAllInvitesClicked",(()=>{this.manageInvites(!0)})),i()(this,"onRejectAllInvitesClicked",(()=>{this.manageInvites(!1)})),i()(this,"onShowQRClicked",(()=>{this.setState({showLoginWithQR:ia.b.Show})})),i()(this,"onLoginWithQRFinished",(()=>{this.setState({showLoginWithQR:null})}));const t=new Set(this.getInvitedRooms().map((e=>e.roomId)));this.state={ignoredUserIds:u.a.get().getIgnoredUsers(),waitingUnignored:[],managingInvites:!1,invitedRoomIds:t,showLoginWithQR:null}}componentDidMount(){this.dispatcherRef=A.a.register(this.onAction),u.a.get().on(rt.d.MyMembership,this.onMyMembership),u.a.get().getVersions().then((e=>this.setState({versions:e})))}componentWillUnmount(){A.a.unregister(this.dispatcherRef),u.a.get().removeListener(rt.d.MyMembership,this.onMyMembership)}renderIgnoredUsers(){const{waitingUnignored:e,ignoredUserIds:t}=this.state,a=null!=t&&t.length?t.map((t=>r.a.createElement(oa,{userId:t,onUnignored:this.onUserUnignored,key:t,inProgress:e.includes(t)}))):Object(l.a)("You have no ignored users.");return r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Ignored users")),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},a))}renderManageInvites(){const{invitedRoomIds:e}=this.state;return 0===e.size?null:r.a.createElement("div",{className:"mx_SettingsTab_section mx_SecurityUserSettingsTab_bulkOptions"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Bulk options")),r.a.createElement(f.a,{onClick:this.onAcceptAllInvitesClicked,kind:"primary",disabled:this.state.managingInvites},Object(l.a)("Accept all %(invitedRooms)s invites",{invitedRooms:e.size})),r.a.createElement(f.a,{onClick:this.onRejectAllInvitesClicked,kind:"danger",disabled:this.state.managingInvites},Object(l.a)("Reject all %(invitedRooms)s invites",{invitedRooms:e.size})),this.state.managingInvites?r.a.createElement(Ce.a,null):r.a.createElement("div",null))}render(){const e=r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Secure Backup")),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},r.a.createElement(mt,null))),t=r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Message search")),r.a.createElement(ea,null)),a=r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Cross-signing")),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},r.a.createElement(Qt,null)));let n,i,s;if(Object(na.a)()||(n=r.a.createElement("div",{className:"mx_SecurityUserSettingsTab_warning"},Object(l.a)("Your server admin has disabled end-to-end encryption by default in private rooms & Direct Messages."))),ta.a.instance.isEnabled()){const e=()=>{Object(aa.b)({primaryButton:Object(l.a)("Okay"),hasCancel:!1})};i=r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(l.a)("Privacy")),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Analytics")),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},r.a.createElement("p",null,Object(l.a)("Share anonymous data to help us identify issues. Nothing personal. No third parties.")),r.a.createElement(f.a,{kind:"link",onClick:e},Object(l.a)("Learn more"))),ta.a.instance.isEnabled()&&r.a.createElement(Le.a,{name:"pseudonymousAnalyticsOptIn",level:H.a.ACCOUNT}),r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Sessions")),r.a.createElement(Le.a,{name:"deviceClientInformationOptIn",level:H.a.ACCOUNT})))}if(O.b.getValue(z.b.AdvancedSettings)){const e=this.renderIgnoredUsers(),t=this.renderManageInvites(),a=O.b.isEnabled(ut)?r.a.createElement(ht,null):null;(e||t||a)&&(s=r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(l.a)("Advanced")),r.a.createElement("div",{className:"mx_SettingsTab_section"},e,t,a)))}const o=O.b.getValue("feature_new_device_manager")?null:r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(l.a)("Where you're signed in")),r.a.createElement("div",{className:"mx_SettingsTab_section","data-testid":"devices-section"},r.a.createElement("span",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("Manage your signed-in devices below. A device's name is visible to people you communicate with.")),r.a.createElement($t,null)),r.a.createElement(ra,{onShowQr:this.onShowQRClicked,versions:this.state.versions})),c=u.a.get();return this.state.showLoginWithQR?r.a.createElement("div",{className:"mx_SettingsTab mx_SecurityUserSettingsTab"},r.a.createElement(ia.d,{onFinished:this.onLoginWithQRFinished,mode:this.state.showLoginWithQR,client:c})):r.a.createElement("div",{className:"mx_SettingsTab mx_SecurityUserSettingsTab"},n,o,r.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(l.a)("Encryption")),r.a.createElement("div",{className:"mx_SettingsTab_section"},e,t,a,r.a.createElement(gt,null)),i,s)}}var ca=a(231),da=a(320);class ma{static encodeActions(e){const t=e.notify,a=e.sound,n=e.highlight;if(t){const e=[ca.d.Notify];return a&&e.push({set_tweak:"sound",value:a}),n?e.push({set_tweak:"highlight"}):e.push({set_tweak:"highlight",value:!1}),e}return[ca.d.DontNotify]}static decodeActions(e){let t,a=!1,n=!1;for(let i=0;i<e.length;++i){const s=e[i];if(s===ca.d.Notify)a=!0;else if(s===ca.d.DontNotify)a=!1;else{if("object"!=typeof s)return null;if("sound"===s.set_tweak)t=s.value;else{if("highlight"!==s.set_tweak)return null;n=s.value}}}void 0===n&&(n=!0);const i={notify:a,highlight:n};return void 0!==t&&(i.sound=t),i}}const ua=ma.encodeActions;class ha{}let pa;i()(ha,"ACTION_NOTIFY",ua({notify:!0})),i()(ha,"ACTION_NOTIFY_DEFAULT_SOUND",ua({notify:!0,sound:"default"})),i()(ha,"ACTION_NOTIFY_RING_SOUND",ua({notify:!0,sound:"ring"})),i()(ha,"ACTION_HIGHLIGHT",ua({notify:!0,highlight:!0})),i()(ha,"ACTION_HIGHLIGHT_DEFAULT_SOUND",ua({notify:!0,sound:"default",highlight:!0})),i()(ha,"ACTION_DONT_NOTIFY",ua({notify:!1})),i()(ha,"ACTION_DISABLED",void 0),function(e){e.Off="off",e.On="on",e.Loud="loud"}(pa||(pa={}));class ga{static actionsFor(e){return e===pa.On?ha.ACTION_NOTIFY:e===pa.Loud?ha.ACTION_HIGHLIGHT_DEFAULT_SOUND:[]}static contentRuleVectorStateKind(e){const t=ma.decodeActions(e.actions);if(!t)return null;let a=0;t.sound&&a++,t.highlight&&a++;let n=null;switch(a){case 0:n=pa.On;break;case 2:n=pa.Loud}return n}}i()(ga,"OFF",pa.Off),i()(ga,"ON",pa.On),i()(ga,"LOUD",pa.Loud),i()(ga,"states",pa);class va{constructor(e){i()(this,"description",void 0),i()(this,"vectorStateToActions",void 0),i()(this,"syncedRuleIds",void 0),this.description=e.description,this.vectorStateToActions=e.vectorStateToActions,this.syncedRuleIds=e.syncedRuleIds}ruleToVectorState(e){let t=!1;e&&(t=e.enabled);for(const a of Object.values(ga.states)){const n=this.vectorStateToActions[a];if(n){if(t&&JSON.stringify(ma.decodeActions(e.actions))===JSON.stringify(ma.decodeActions(n)))return a}else if(!t)return a}d.a.error(`Cannot translate rule actions into Vector rule state. Rule: ${JSON.stringify(e)}, Expected: ${JSON.stringify(this.vectorStateToActions)}`)}}const ba={".m.rule.contains_display_name":new va({description:Object(l.c)("Messages containing my display name"),vectorStateToActions:{[pa.On]:ha.ACTION_NOTIFY,[pa.Loud]:ha.ACTION_HIGHLIGHT_DEFAULT_SOUND,[pa.Off]:ha.ACTION_DISABLED}}),".m.rule.contains_user_name":new va({description:Object(l.c)("Messages containing my username"),vectorStateToActions:{[pa.On]:ha.ACTION_NOTIFY,[pa.Loud]:ha.ACTION_HIGHLIGHT_DEFAULT_SOUND,[pa.Off]:ha.ACTION_DISABLED}}),".m.rule.roomnotif":new va({description:Object(l.c)("Messages containing @room"),vectorStateToActions:{[pa.On]:ha.ACTION_NOTIFY,[pa.Loud]:ha.ACTION_HIGHLIGHT,[pa.Off]:ha.ACTION_DISABLED}}),".m.rule.room_one_to_one":new va({description:Object(l.c)("Messages in one-to-one chats"),vectorStateToActions:{[pa.On]:ha.ACTION_NOTIFY,[pa.Loud]:ha.ACTION_NOTIFY_DEFAULT_SOUND,[pa.Off]:ha.ACTION_DONT_NOTIFY},syncedRuleIds:[ca.f.PollStartOneToOne,ca.f.PollStartOneToOneUnstable,ca.f.PollEndOneToOne,ca.f.PollEndOneToOneUnstable]}),".m.rule.encrypted_room_one_to_one":new va({description:Object(l.c)("Encrypted messages in one-to-one chats"),vectorStateToActions:{[pa.On]:ha.ACTION_NOTIFY,[pa.Loud]:ha.ACTION_NOTIFY_DEFAULT_SOUND,[pa.Off]:ha.ACTION_DONT_NOTIFY}}),".m.rule.message":new va({description:Object(l.c)("Messages in group chats"),vectorStateToActions:{[pa.On]:ha.ACTION_NOTIFY,[pa.Loud]:ha.ACTION_NOTIFY_DEFAULT_SOUND,[pa.Off]:ha.ACTION_DONT_NOTIFY},syncedRuleIds:[ca.f.PollStart,ca.f.PollStartUnstable,ca.f.PollEnd,ca.f.PollEndUnstable]}),".m.rule.encrypted":new va({description:Object(l.c)("Encrypted messages in group chats"),vectorStateToActions:{[pa.On]:ha.ACTION_NOTIFY,[pa.Loud]:ha.ACTION_NOTIFY_DEFAULT_SOUND,[pa.Off]:ha.ACTION_DONT_NOTIFY}}),".m.rule.invite_for_me":new va({description:Object(l.c)("When I'm invited to a room"),vectorStateToActions:{[pa.On]:ha.ACTION_NOTIFY,[pa.Loud]:ha.ACTION_NOTIFY_DEFAULT_SOUND,[pa.Off]:ha.ACTION_DISABLED}}),".m.rule.call":new va({description:Object(l.c)("Call invitation"),vectorStateToActions:{[pa.On]:ha.ACTION_NOTIFY,[pa.Loud]:ha.ACTION_NOTIFY_RING_SOUND,[pa.Off]:ha.ACTION_DISABLED}}),".m.rule.suppress_notices":new va({description:Object(l.c)("Messages sent by bot"),vectorStateToActions:{[pa.On]:ha.ACTION_DISABLED,[pa.Loud]:ha.ACTION_NOTIFY_DEFAULT_SOUND,[pa.Off]:ha.ACTION_DONT_NOTIFY}}),".m.rule.tombstone":new va({description:Object(l.c)("When rooms are upgraded"),vectorStateToActions:{[pa.On]:ha.ACTION_NOTIFY,[pa.Loud]:ha.ACTION_HIGHLIGHT,[pa.Off]:ha.ACTION_DISABLED}})};class fa{static parseContentRules(e){const t=fa.categoriseContentRules(e);return t.loud.length?{vectorState:pa.Loud,rules:t.loud,externalRules:[...t.loud_but_disabled,...t.on,...t.on_but_disabled,...t.other]}:t.loud_but_disabled.length?{vectorState:pa.Off,rules:t.loud_but_disabled,externalRules:[...t.on,...t.on_but_disabled,...t.other]}:t.on.length?{vectorState:pa.On,rules:t.on,externalRules:[...t.on_but_disabled,...t.other]}:t.on_but_disabled.length?{vectorState:pa.Off,rules:t.on_but_disabled,externalRules:t.other}:{vectorState:pa.On,rules:[],externalRules:t.other}}static categoriseContentRules(e){const t={on:[],on_but_disabled:[],loud:[],loud_but_disabled:[],other:[]};for(const a in e.global)for(let n=0;n<Object.keys(e.global[a]).length;++n){const i=e.global[a][n];if("."!==i.rule_id[0]&&a===ca.e.ContentSpecific)switch(i.kind=a,ga.contentRuleVectorStateKind(i)){case pa.On:i.enabled?t.on.push(i):t.on_but_disabled.push(i);break;case pa.Loud:i.enabled?t.loud.push(i):t.loud_but_disabled.push(i);break;default:t.other.push(i)}}return t}}var ya=a(235),Ea=a(464);const _a=e=>{let{icon:t,label:a,onDeleteClick:n,disabled:i=!1}=e;return r.a.createElement("div",{className:"mx_Tag"},null==t?void 0:t(),a,n&&r.a.createElement(f.a,{className:"mx_Tag_delete",onClick:n,disabled:i},r.a.createElement(Ea.a,null)))};class wa extends r.a.PureComponent{constructor(e){super(e),i()(this,"onInputChange",(e=>{this.setState({newTag:e.target.value})})),i()(this,"onAdd",(e=>{e.preventDefault(),this.state.newTag&&(this.props.onAdd(this.state.newTag),this.setState({newTag:""}))})),this.state={newTag:""}}onRemove(e){this.props.onRemove(e)}render(){return r.a.createElement("div",{className:"mx_TagComposer"},r.a.createElement("form",{className:"mx_TagComposer_input",onSubmit:this.onAdd},r.a.createElement(h.a,{value:this.state.newTag,onChange:this.onInputChange,label:this.props.label||Object(l.a)("Keyword"),placeholder:this.props.placeholder||Object(l.a)("New keyword"),disabled:this.props.disabled,autoComplete:"off"}),r.a.createElement(f.a,{onClick:this.onAdd,kind:"primary",disabled:this.props.disabled},Object(l.a)("Add"))),r.a.createElement("div",{className:"mx_TagComposer_tags"},this.props.tags.map(((e,t)=>r.a.createElement(_a,{label:e,key:e,onDeleteClick:this.onRemove.bind(this,e),disabled:this.props.disabled})))))}}var Sa,Oa,Ca=a(388);function xa(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function ja(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?xa(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):xa(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}!function(e){e.Loading="loading",e.Ready="ready",e.Persisting="persisting",e.Error="error"}(Sa||(Sa={})),function(e){e.Master="master",e.VectorGlobal="vector_global",e.VectorMentions="vector_mentions",e.VectorOther="vector_other",e.Other="other"}(Oa||(Oa={}));const ka="_keywords",Ra=Oa.VectorMentions,Ia=[ca.f.DM,ca.f.EncryptedDM,ca.f.Message,ca.f.EncryptedMessage,ca.f.ContainsDisplayName,ca.f.ContainsUserName,ca.f.AtRoomNotification,ca.f.InviteToSelf,ca.f.IncomingCall,ca.f.SuppressNotices,ca.f.Tombstone],Ta=[pa.Off,pa.On,pa.Loud],Na=(e,t,a)=>{var n;if(null===(n=a.syncedRuleIds)||void 0===n||!n.length)return;const i=a.syncedRuleIds.reduce(((t,n)=>{if(t===pa.Loud)return t;const i=((e,t)=>{for(const a in t){const n=t[a].find((t=>t.rule_id===e));if(n)return n}})(n,e);if(i){const e=a.ruleToVectorState(i);if(Ta.indexOf(e)>Ta.indexOf(t))return e}return t}),a.ruleToVectorState(t));return i};class Pa extends r.a.PureComponent{constructor(e){var t,a;super(e),a=this,i()(this,"settingWatchers",void 0),i()(this,"pushProcessor",void 0),i()(this,"onMasterRuleChanged",(async e=>{this.setState({phase:Sa.Persisting});try{const t=this.state.masterPushRule;await u.a.get().setPushRuleEnabled("global",t.kind,t.rule_id,!e),await this.refreshFromServer()}catch(e){this.setState({phase:Sa.Error}),d.a.error("Error updating master push rule:",e),this.showSaveError()}})),i()(this,"updateDeviceNotifications",(async e=>{await O.b.setValue("deviceNotificationsEnabled",null,H.a.DEVICE,e)})),i()(this,"onEmailNotificationsChanged",(async(e,t)=>{this.setState({phase:Sa.Persisting});try{if(t)await u.a.get().setPusher({kind:"email",app_id:"m.email",pushkey:e,app_display_name:"Email Notifications",device_display_name:e,lang:navigator.language,data:{brand:Me.b.get().brand},append:!0});else{const t=this.state.pushers.find((t=>"email"===t.kind&&t.pushkey===e));t.kind=null,await u.a.get().setPusher(t)}await this.refreshFromServer()}catch(e){this.setState({phase:Sa.Error}),d.a.error("Error updating email pusher:",e),this.showSaveError()}})),i()(this,"onDesktopNotificationsChanged",(async e=>{await O.b.setValue("notificationsEnabled",null,H.a.DEVICE,e)})),i()(this,"onDesktopShowBodyChanged",(async e=>{await O.b.setValue("notificationBodyEnabled",null,H.a.DEVICE,e)})),i()(this,"onAudioNotificationsChanged",(async e=>{await O.b.setValue("audioNotificationsEnabled",null,H.a.DEVICE,e)})),i()(this,"setPushRuleActions",(async(e,t,a)=>{const n=u.a.get();a?(await n.setPushRuleActions("global",t,e,a),await n.setPushRuleEnabled("global",t,e,!0)):await n.setPushRuleEnabled("global",t,e,!1)})),i()(this,"updateSyncedRules",(async(e,t)=>{const a=null==e?void 0:e.map((e=>this.pushProcessor.getPushRuleAndKindById(e))).filter(Boolean);if(null!=a&&a.length)for(const{kind:e,rule:n}of a)await this.setPushRuleActions(n.rule_id,e,t)})),i()(this,"onRadioChecked",(async(e,t)=>{this.setState({phase:Sa.Persisting});try{const a=u.a.get();if(e.ruleId===ka)for(const e of this.state.vectorKeywordRuleInfo.rules){let n,i;t===pa.On?(1!==e.actions.length&&(i=ga.actionsFor(t)),this.state.vectorKeywordRuleInfo.vectorState===pa.Off&&(n=!0)):t===pa.Loud?(3!==e.actions.length&&(i=ga.actionsFor(t)),this.state.vectorKeywordRuleInfo.vectorState===pa.Off&&(n=!0)):n=!1,i&&await a.setPushRuleActions("global",e.kind,e.rule_id,i),void 0!==n&&await a.setPushRuleEnabled("global",e.kind,e.rule_id,n)}else{const a=ba[e.ruleId],n=a.vectorStateToActions[t];await this.setPushRuleActions(e.rule.rule_id,e.rule.kind,n),await this.updateSyncedRules(a.syncedRuleIds,n)}await this.refreshFromServer()}catch(e){this.setState({phase:Sa.Error}),d.a.error("Error updating push rule:",e),this.showSaveError()}})),i()(this,"onClearNotificationsClicked",(async()=>{try{this.setState({clearingNotifications:!0});const e=u.a.get();await Object(Ca.a)(e)}finally{this.setState({clearingNotifications:!1})}})),i()(this,"onKeywordAdd",(e=>{const t=Object(ye.a)(this.state.vectorKeywordRuleInfo.rules);this.setState({phase:Sa.Persisting,vectorKeywordRuleInfo:ja(ja({},this.state.vectorKeywordRuleInfo),{},{rules:[...this.state.vectorKeywordRuleInfo.rules,{pattern:e}]})},(async()=>{await this.setKeywords(this.state.vectorKeywordRuleInfo.rules.map((e=>e.pattern)),t)}))})),i()(this,"onKeywordRemove",(e=>{const t=Object(ye.a)(this.state.vectorKeywordRuleInfo.rules);this.setState({phase:Sa.Persisting,vectorKeywordRuleInfo:ja(ja({},this.state.vectorKeywordRuleInfo),{},{rules:this.state.vectorKeywordRuleInfo.rules.filter((t=>t.pattern!==e))})},(async()=>{await this.setKeywords(this.state.vectorKeywordRuleInfo.rules.map((e=>e.pattern)),t)}))})),this.state={phase:Sa.Loading,deviceNotificationsEnabled:null===(t=O.b.getValue("deviceNotificationsEnabled"))||void 0===t||t,desktopNotifications:O.b.getValue("notificationsEnabled"),desktopShowBody:O.b.getValue("notificationBodyEnabled"),audioNotifications:O.b.getValue("audioNotificationsEnabled"),clearingNotifications:!1},this.settingWatchers=[O.b.watchSetting("notificationsEnabled",null,(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let[,,,,i]=t;return a.setState({desktopNotifications:i})})),O.b.watchSetting("deviceNotificationsEnabled",null,(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let[,,,,i]=t;a.setState({deviceNotificationsEnabled:i})})),O.b.watchSetting("notificationBodyEnabled",null,(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let[,,,,i]=t;return a.setState({desktopShowBody:i})})),O.b.watchSetting("audioNotificationsEnabled",null,(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let[,,,,i]=t;return a.setState({audioNotifications:i})}))],this.pushProcessor=new da.a(u.a.get())}get isInhibited(){var e;return!(null===(e=this.state.masterPushRule)||void 0===e||!e.enabled)}componentDidMount(){this.refreshFromServer(),this.refreshFromAccountData()}componentWillUnmount(){this.settingWatchers.forEach((e=>O.b.unwatchSetting(e)))}componentDidUpdate(e,t){this.state.deviceNotificationsEnabled!==t.deviceNotificationsEnabled&&this.persistLocalNotificationSettings(this.state.deviceNotificationsEnabled)}async refreshFromServer(){try{const e=(await Promise.all([this.refreshRules(),this.refreshPushers(),this.refreshThreepids()])).reduce(((e,t)=>Object.assign(t,e)),{});this.setState(ja(ja({},e),{},{phase:Sa.Ready}))}catch(e){d.a.error("Error setting up notifications for settings: ",e),this.setState({phase:Sa.Error})}}async refreshFromAccountData(){const e=u.a.get(),t=e.getAccountData(Object(Ca.d)(e.deviceId));if(t){const e=!t.getContent().is_silenced;await this.updateDeviceNotifications(e)}}persistLocalNotificationSettings(e){const t=u.a.get();return t.setAccountData(Object(Ca.d)(t.deviceId),{is_silenced:!e})}async refreshRules(){const e=await u.a.get().getPushRules(),t={[ca.f.Master]:Oa.Master,[ca.f.DM]:Oa.VectorGlobal,[ca.f.EncryptedDM]:Oa.VectorGlobal,[ca.f.Message]:Oa.VectorGlobal,[ca.f.EncryptedMessage]:Oa.VectorGlobal,[ca.f.ContainsDisplayName]:Oa.VectorMentions,[ca.f.ContainsUserName]:Oa.VectorMentions,[ca.f.AtRoomNotification]:Oa.VectorMentions,[ca.f.InviteToSelf]:Oa.VectorOther,[ca.f.IncomingCall]:Oa.VectorOther,[ca.f.SuppressNotices]:Oa.VectorOther,[ca.f.Tombstone]:Oa.VectorOther},a={[Oa.Master]:[],[Oa.VectorGlobal]:[],[Oa.VectorMentions]:[],[Oa.VectorOther]:[],[Oa.Other]:[]};for(const i in e.global){const s=i;for(const i of e.global[s]){var n;const e=Object.assign(i,{kind:s}),r=null!==(n=t[e.rule_id])&&void 0!==n?n:Oa.Other;"."===e.rule_id[0]&&a[r].push(e)}}const i={};if(!(a.master.length>0))throw new Error("Failed to locate a master push rule");i.masterPushRule=a.master[0],i.vectorKeywordRuleInfo=fa.parseContentRules(e),i.vectorPushRules={};const s=[Oa.VectorGlobal,Oa.VectorMentions,Oa.VectorOther];for(const e of s){i.vectorPushRules[e]=[];for(const t of a[e]){const n=ba[t.rule_id],s=n.ruleToVectorState(t);i.vectorPushRules[e].push({ruleId:t.rule_id,rule:t,vectorState:s,syncedVectorState:Na(a,t,n),description:Object(l.a)(n.description)})}i.vectorPushRules[e].sort(((e,t)=>{let a=Ia.indexOf(e.ruleId),n=Ia.indexOf(t.ruleId);return a<0&&(a=Ia.length),n<0&&(n=Ia.length),a-n})),e===Ra&&i.vectorPushRules[e].push({ruleId:ka,description:Object(l.a)("Messages containing keywords"),vectorState:i.vectorKeywordRuleInfo.vectorState})}return i}refreshPushers(){return u.a.get().getPushers()}refreshThreepids(){return u.a.get().getThreePids()}showSaveError(){g.b.createDialog(v.a,{title:Object(l.a)("Error saving notification preferences"),description:Object(l.a)("An error occurred whilst saving your notification preferences.")})}async setKeywords(e,t){try{e=Array.from(new Set(e)).filter((e=>!!e));const a=Array.from(new Set(t.map((e=>e.pattern)))).filter((e=>!!e)),n=Object(Be.a)(a,e);for(const e of n.removed)for(const a of t.filter((t=>t.pattern===e)))await u.a.get().deletePushRule("global",a.kind,a.rule_id);let i=this.state.vectorKeywordRuleInfo.vectorState;i===pa.Off&&(i=t.length?ga.contentRuleVectorStateKind(t[0]):pa.On);const s=ca.e.ContentSpecific;for(const e of n.added)await u.a.get().addPushRule("global",s,e,{actions:ga.actionsFor(i),pattern:e}),i===pa.Off&&await u.a.get().setPushRuleEnabled("global",s,e,!1);await this.refreshFromServer()}catch(e){this.setState({phase:Sa.Error}),d.a.error("Error updating keyword push rules:",e),this.showSaveError()}}renderTopSection(){const e=r.a.createElement(ya.a,{"data-testid":"notif-master-switch",value:!this.isInhibited,label:Object(l.a)("Enable notifications for this account"),caption:Object(l.a)("Turn off to disable notifications on all your devices and sessions"),onChange:this.onMasterRuleChanged,disabled:this.state.phase===Sa.Persisting});if(this.isInhibited)return e;const t=(this.state.threepids||[]).filter((e=>e.medium===G.Email)).map((e=>r.a.createElement(ya.a,{"data-testid":"notif-email-switch",key:e.address,value:this.state.pushers.some((t=>"email"===t.kind&&t.pushkey===e.address)),label:Object(l.a)("Enable email notifications for %(email)s",{email:e.address}),onChange:this.onEmailNotificationsChanged.bind(this,e.address),disabled:this.state.phase===Sa.Persisting})));return r.a.createElement(r.a.Fragment,null,e,r.a.createElement(ya.a,{"data-testid":"notif-device-switch",value:this.state.deviceNotificationsEnabled,label:Object(l.a)("Enable notifications for this device"),onChange:e=>this.updateDeviceNotifications(e),disabled:this.state.phase===Sa.Persisting}),this.state.deviceNotificationsEnabled&&r.a.createElement(r.a.Fragment,null,r.a.createElement(ya.a,{"data-testid":"notif-setting-notificationsEnabled",value:this.state.desktopNotifications,onChange:this.onDesktopNotificationsChanged,label:Object(l.a)("Enable desktop notifications for this session"),disabled:this.state.phase===Sa.Persisting}),r.a.createElement(ya.a,{"data-testid":"notif-setting-notificationBodyEnabled",value:this.state.desktopShowBody,onChange:this.onDesktopShowBodyChanged,label:Object(l.a)("Show message in desktop notification"),disabled:this.state.phase===Sa.Persisting}),r.a.createElement(ya.a,{"data-testid":"notif-setting-audioNotificationsEnabled",value:this.state.audioNotifications,onChange:this.onAudioNotificationsChanged,label:Object(l.a)("Enable audible notifications for this session"),disabled:this.state.phase===Sa.Persisting})),t)}renderCategory(e){var t;if(e!==Oa.VectorOther&&this.isInhibited)return null;let a,n;if(e===Oa.VectorOther&&u.a.get().getRooms().some((e=>e.getUnreadNotificationCount()>0))&&(a=r.a.createElement(f.a,{onClick:this.onClearNotificationsClicked,disabled:this.state.clearingNotifications,kind:"danger",className:"mx_UserNotifSettings_clearNotifsButton","data-testid":"clear-notifications"},Object(l.a)("Mark all as read"))),e===Oa.VectorOther&&this.isInhibited)return a?r.a.createElement("div",{className:"mx_UserNotifSettings_floatingSection"},r.a.createElement("div",null,Object(l.a)("Other")),a):null;var i;e===Oa.VectorMentions&&(n=r.a.createElement(wa,{tags:null===(i=this.state.vectorKeywordRuleInfo)||void 0===i?void 0:i.rules.map((e=>e.pattern)),onAdd:this.onKeywordAdd,onRemove:this.onKeywordRemove,disabled:this.state.phase===Sa.Persisting,label:Object(l.a)("Keyword"),placeholder:Object(l.a)("New keyword")}));const s={[pa.On]:Object(l.a)("On"),[pa.Off]:Object(l.a)("Off"),[pa.Loud]:Object(l.a)("Noisy")},o=(e,t)=>{var a;return r.a.createElement(Ye.a,{key:e.ruleId+t,name:e.ruleId,checked:(null!==(a=e.syncedVectorState)&&void 0!==a?a:e.vectorState)===t,onChange:this.onRadioChecked.bind(this,e,t),disabled:this.state.phase===Sa.Persisting,"aria-label":s[t]})},c=null===(t=this.state.vectorPushRules[e])||void 0===t?void 0:t.map((t=>r.a.createElement("fieldset",{key:e+t.ruleId,"data-testid":e+t.ruleId,className:"mx_UserNotifSettings_gridRowContainer"},r.a.createElement("legend",{className:"mx_UserNotifSettings_gridRowLabel"},t.description),o(t,pa.Off),o(t,pa.On),o(t,pa.Loud))));let d;switch(e){case Oa.VectorGlobal:d=Object(l.a)("Global");break;case Oa.VectorMentions:d=Object(l.a)("Mentions & keywords");break;case Oa.VectorOther:d=Object(l.a)("Other");break;default:throw new Error("Developer error: Unnamed notifications section: "+e)}return r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{"data-testid":`notif-section-${e}`,className:"mx_UserNotifSettings_grid"},r.a.createElement("span",{className:"mx_UserNotifSettings_gridRowLabel mx_UserNotifSettings_gridRowHeading"},d),r.a.createElement("span",{className:"mx_UserNotifSettings_gridColumnLabel"},s[pa.Off]),r.a.createElement("span",{className:"mx_UserNotifSettings_gridColumnLabel"},s[pa.On]),r.a.createElement("span",{className:"mx_UserNotifSettings_gridColumnLabel"},s[pa.Loud]),c),a,n)}renderTargets(){var e;if(this.isInhibited)return null;const t=null===(e=this.state.pushers)||void 0===e?void 0:e.map((e=>r.a.createElement("tr",{key:e.kind+e.pushkey},r.a.createElement("td",null,e.app_display_name),r.a.createElement("td",null,e.device_display_name))));return t.length?r.a.createElement("div",{className:"mx_UserNotifSettings_floatingSection"},r.a.createElement("div",null,Object(l.a)("Notification targets")),r.a.createElement("table",null,r.a.createElement("tbody",null,t))):null}render(){return this.state.phase===Sa.Loading?r.a.createElement(k.a,null):this.state.phase===Sa.Error?r.a.createElement("p",{"data-testid":"error-message"},Object(l.a)("There was an error loading your notification settings.")):r.a.createElement("div",{className:"mx_UserNotifSettings"},this.renderTopSection(),this.renderCategory(Oa.VectorGlobal),this.renderCategory(Oa.VectorMentions),this.renderCategory(Oa.VectorOther),this.renderTargets())}}class Da extends r.a.Component{render(){return r.a.createElement("div",{className:"mx_SettingsTab"},r.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(l.a)("Notifications")),r.a.createElement("div",{className:"mx_SettingsTab_section mx_SettingsTab_subsectionText"},r.a.createElement(Pa,null)))}}var Ma=a(214),Aa=a(489);class La extends r.a.Component{constructor(e){super(e),i()(this,"onAutocompleteDelayChange",(e=>{this.setState({autocompleteDelay:e.target.value}),O.b.setValue("autocompleteDelay",null,H.a.DEVICE,e.target.value)})),i()(this,"onReadMarkerInViewThresholdMs",(e=>{this.setState({readMarkerInViewThresholdMs:e.target.value}),O.b.setValue("readMarkerInViewThresholdMs",null,H.a.DEVICE,e.target.value)})),i()(this,"onReadMarkerOutOfViewThresholdMs",(e=>{this.setState({readMarkerOutOfViewThresholdMs:e.target.value}),O.b.setValue("readMarkerOutOfViewThresholdMs",null,H.a.DEVICE,e.target.value)})),i()(this,"onKeyboardShortcutsClicked",(()=>{A.a.dispatch({action:L.a.ViewUserSettings,initialTabId:Ma.a.Keyboard})})),this.state={disablingReadReceiptsSupported:!1,autocompleteDelay:O.b.getValueAt(H.a.DEVICE,"autocompleteDelay").toString(10),readMarkerInViewThresholdMs:O.b.getValueAt(H.a.DEVICE,"readMarkerInViewThresholdMs").toString(10),readMarkerOutOfViewThresholdMs:O.b.getValueAt(H.a.DEVICE,"readMarkerOutOfViewThresholdMs").toString(10)}}async componentDidMount(){const e=u.a.get();this.setState({disablingReadReceiptsSupported:await e.doesServerSupportUnstableFeature("org.matrix.msc2285.stable")||await e.isVersionSupported("v1.4")})}renderGroup(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:H.a.ACCOUNT;return e.map((e=>{const a=!O.b.isEnabled(e);return r.a.createElement(Le.a,{key:e,name:e,level:t,disabled:a})}))}render(){const e=O.b.getValue("FTUE.useCaseSelection"),t=La.ROOM_LIST_SETTINGS.filter((e=>"breadcrumbs"!==e||!O.b.getValue("feature_breadcrumbs_v2"))).filter((t=>"FTUE.userOnboardingButton"!==t||Object(Aa.b)(e)));return r.a.createElement("div",{className:"mx_SettingsTab mx_PreferencesUserSettingsTab"},r.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(l.a)("Preferences")),t.length>0&&r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Room list")),this.renderGroup(t)),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Spaces")),this.renderGroup(La.SPACES_SETTINGS,H.a.ACCOUNT)),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Keyboard shortcuts")),r.a.createElement("div",{className:"mx_SettingsFlag"},Object(l.a)("To view all keyboard shortcuts, <a>click here</a>.",{},{a:e=>r.a.createElement(f.a,{kind:"link_inline",onClick:this.onKeyboardShortcutsClicked},e)})),this.renderGroup(La.KEYBINDINGS_SETTINGS)),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Displaying time")),this.renderGroup(La.TIME_SETTINGS)),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Presence")),r.a.createElement("span",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("Share your activity and status with others.")),r.a.createElement(Le.a,{disabled:!this.state.disablingReadReceiptsSupported&&O.b.getValue("sendReadReceipts"),disabledDescription:Object(l.a)("Your server doesn't support disabling sending read receipts."),name:"sendReadReceipts",level:H.a.ACCOUNT}),this.renderGroup(La.PRESENCE_SETTINGS)),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Composer")),this.renderGroup(La.COMPOSER_SETTINGS)),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Code blocks")),this.renderGroup(La.CODE_BLOCKS_SETTINGS)),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Images, GIFs and videos")),this.renderGroup(La.IMAGES_AND_VIDEOS_SETTINGS)),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Timeline")),this.renderGroup(La.TIMELINE_SETTINGS)),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Room directory")),this.renderGroup(La.ROOM_DIRECTORY_SETTINGS)),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("General")),this.renderGroup(La.GENERAL_SETTINGS),r.a.createElement(Le.a,{name:"Electron.showTrayIcon",level:H.a.PLATFORM,hideIfCannotSet:!0}),r.a.createElement(Le.a,{name:"Electron.enableHardwareAcceleration",level:H.a.PLATFORM,hideIfCannotSet:!0,label:Object(l.a)("Enable hardware acceleration (restart %(appName)s to take effect)",{appName:Me.b.get().brand})}),r.a.createElement(Le.a,{name:"Electron.alwaysShowMenuBar",level:H.a.PLATFORM,hideIfCannotSet:!0}),r.a.createElement(Le.a,{name:"Electron.autoLaunch",level:H.a.PLATFORM,hideIfCannotSet:!0}),r.a.createElement(Le.a,{name:"Electron.warnBeforeExit",level:H.a.PLATFORM,hideIfCannotSet:!0}),r.a.createElement(h.a,{label:Object(l.a)("Autocomplete delay (ms)"),type:"number",value:this.state.autocompleteDelay,onChange:this.onAutocompleteDelayChange}),r.a.createElement(h.a,{label:Object(l.a)("Read Marker lifetime (ms)"),type:"number",value:this.state.readMarkerInViewThresholdMs,onChange:this.onReadMarkerInViewThresholdMs}),r.a.createElement(h.a,{label:Object(l.a)("Read Marker off-screen lifetime (ms)"),type:"number",value:this.state.readMarkerOutOfViewThresholdMs,onChange:this.onReadMarkerOutOfViewThresholdMs})))}}i()(La,"ROOM_LIST_SETTINGS",["breadcrumbs","FTUE.userOnboardingButton"]),i()(La,"SPACES_SETTINGS",["Spaces.allRoomsInHome"]),i()(La,"KEYBINDINGS_SETTINGS",["ctrlFForSearch"]),i()(La,"PRESENCE_SETTINGS",["sendTypingNotifications"]),i()(La,"COMPOSER_SETTINGS",["MessageComposerInput.autoReplaceEmoji","MessageComposerInput.useMarkdown","MessageComposerInput.suggestEmoji","MessageComposerInput.ctrlEnterToSend","MessageComposerInput.surroundWith","MessageComposerInput.showStickersButton","MessageComposerInput.insertTrailingColon"]),i()(La,"TIME_SETTINGS",["showTwelveHourTimestamps","alwaysShowTimestamps"]),i()(La,"CODE_BLOCKS_SETTINGS",["enableSyntaxHighlightLanguageDetection","expandCodeByDefault","showCodeLineNumbers"]),i()(La,"IMAGES_AND_VIDEOS_SETTINGS",["urlPreviewsEnabled","autoplayGifs","autoplayVideo","showImages"]),i()(La,"TIMELINE_SETTINGS",["showTypingNotifications","showRedactions","showReadReceipts","showJoinLeaves","showDisplaynameChanges","showChatEffects","showAvatarChanges","Pill.shouldShowPillAvatar","TextualBody.enableBigEmoji","scrollToBottomOnMessageSent","useOnlyCurrentProfiles"]),i()(La,"ROOM_DIRECTORY_SETTINGS",["SpotlightSearch.showNsfwPublicRooms"]),i()(La,"GENERAL_SETTINGS",["promptBeforeInviteUnknownUsers"]);var Ua=a(245),Fa=a(817);class Ba extends r.a.Component{constructor(e){super(e),i()(this,"refreshMediaDevices",(async e=>{this.setState({mediaDevices:await Ua.c.getDevices(),[Ua.b.AudioOutput]:Ua.c.getAudioOutput(),[Ua.b.AudioInput]:Ua.c.getAudioInput(),[Ua.b.VideoInput]:Ua.c.getVideoInput()}),e&&e.getTracks().forEach((e=>e.stop()))})),i()(this,"requestMediaPermissions",(async()=>{const e=await Object(Fa.a)();e&&this.refreshMediaDevices(e)})),i()(this,"setDevice",((e,t)=>{Ua.c.instance.setDevice(e,t),this.setState({[t]:e})})),i()(this,"changeWebRtcMethod",(e=>{u.a.get().setForceTURN(!e)})),i()(this,"changeFallbackICEServerAllowed",(e=>{u.a.get().setFallbackICEServerAllowed(e)})),this.state={mediaDevices:null,[Ua.b.AudioOutput]:null,[Ua.b.AudioInput]:null,[Ua.b.VideoInput]:null,audioAutoGainControl:Ua.c.getAudioAutoGainControl(),audioEchoCancellation:Ua.c.getAudioEchoCancellation(),audioNoiseSuppression:Ua.c.getAudioNoiseSuppression()}}async componentDidMount(){await Ua.c.hasAnyLabeledDevices()&&this.refreshMediaDevices()}renderDeviceOptions(e,t){return e.map((e=>r.a.createElement("option",{key:`${t}-${e.deviceId}`,value:e.deviceId},e.label)))}renderDropdown(e,t){const a=this.state.mediaDevices[e].slice(0);if(0===a.length)return null;const n=Ua.c.getDefaultDevice(a);return r.a.createElement(h.a,{element:"select",label:t,value:this.state[e]||n,onChange:t=>this.setDevice(t.target.value,e)},this.renderDeviceOptions(a,e))}render(){let e,t,a,n;return this.state.mediaDevices?this.state.mediaDevices&&(t=this.renderDropdown(Ua.b.AudioOutput,Object(l.a)("Audio Output"))||r.a.createElement("p",null,Object(l.a)("No Audio Outputs detected")),a=this.renderDropdown(Ua.b.AudioInput,Object(l.a)("Microphone"))||r.a.createElement("p",null,Object(l.a)("No Microphones detected")),n=this.renderDropdown(Ua.b.VideoInput,Object(l.a)("Camera"))||r.a.createElement("p",null,Object(l.a)("No Webcams detected"))):e=r.a.createElement("div",{className:"mx_VoiceUserSettingsTab_missingMediaPermissions"},r.a.createElement("p",null,Object(l.a)("Missing media permissions, click the button below to request.")),r.a.createElement(f.a,{onClick:this.requestMediaPermissions,kind:"primary"},Object(l.a)("Request media permissions"))),r.a.createElement("div",{className:"mx_SettingsTab mx_VoiceUserSettingsTab"},r.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(l.a)("Voice & Video")),e,r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Voice settings")),t,a,r.a.createElement(ya.a,{value:this.state.audioAutoGainControl,onChange:async e=>{await Ua.c.setAudioAutoGainControl(e),this.setState({audioAutoGainControl:Ua.c.getAudioAutoGainControl()})},label:Object(l.a)("Automatically adjust the microphone volume"),"data-testid":"voice-auto-gain"})),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Video settings")),n,r.a.createElement(Le.a,{name:"VideoView.flipVideoHorizontally",level:H.a.ACCOUNT})),r.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(l.a)("Advanced")),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Voice processing")),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement(ya.a,{value:this.state.audioNoiseSuppression,onChange:async e=>{await Ua.c.setAudioNoiseSuppression(e),this.setState({audioNoiseSuppression:Ua.c.getAudioNoiseSuppression()})},label:Object(l.a)("Noise suppression"),"data-testid":"voice-noise-suppression"}),r.a.createElement(ya.a,{value:this.state.audioEchoCancellation,onChange:async e=>{await Ua.c.setAudioEchoCancellation(e),this.setState({audioEchoCancellation:Ua.c.getAudioEchoCancellation()})},label:Object(l.a)("Echo cancellation"),"data-testid":"voice-echo-cancellation"})),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Connection")),r.a.createElement(Le.a,{name:"webRtcAllowPeerToPeer",level:H.a.DEVICE,onChange:this.changeWebRtcMethod}),r.a.createElement(Le.a,{name:"fallbackICEServerAllowed",level:H.a.DEVICE,onChange:this.changeFallbackICEServerAllowed}))))}}var Va=a(219),Wa=a(132),Ha=a.n(Wa),za=a(342),Ga=a(237);const Ka=["action"];function qa(){var e;null===(e=j.a.get())||void 0===e||e.installUpdate()}const $a=[za.d.Ready,za.d.Error,za.d.NotAvailable];var Ya=()=>{const[e,t]=Object(s.useState)(null);Object(Ga.a)(A.a,(e=>{let{action:a}=e,n=Ha()(e,Ka);a===L.a.CheckUpdates&&t(n)}));const a=!!e&&!$a.includes(e.status);let n;return e&&(n=r.a.createElement("span",{className:"mx_UpdateCheckButton_summary"},function(e,t){switch(e){case za.d.Error:return Object(l.a)("Error encountered (%(errorDetail)s).",{errorDetail:t});case za.d.Checking:return Object(l.a)("Checking for an update…");case za.d.NotAvailable:return Object(l.a)("No update available.");case za.d.Downloading:return Object(l.a)("Downloading update…");case za.d.Ready:return Object(l.a)("New version available. <a>Update now.</a>",{},{a:e=>r.a.createElement(f.a,{kind:"link_inline",onClick:qa},e)})}}(e.status,e.detail),a&&r.a.createElement(Ce.a,null))),r.a.createElement(r.a.Fragment,null,r.a.createElement(f.a,{onClick:()=>{var e;t(null),null===(e=j.a.get())||void 0===e||e.startUpdateCheck()},kind:"primary",disabled:a},Object(l.a)("Check for update")),n)},Ja=a(276),Qa=a(298);class Xa extends r.a.Component{constructor(e){super(e),i()(this,"onClearCacheAndReload",(()=>{j.a.get()&&(d.a.log("Clear cache & reload clicked"),u.a.get().stopClient(),u.a.get().store.deleteAllData().then((()=>{var e;null===(e=j.a.get())||void 0===e||e.reload()})))})),i()(this,"onBugReport",(()=>{g.b.createDialog(Ja.a,{})})),i()(this,"onStartBotChat",(()=>{this.props.closeSettingsFn(),Object(Va.b)({dmUserId:Me.b.get("welcome_user_id"),andView:!0})})),i()(this,"getVersionTextToCopy",(()=>{const{appVersion:e,olmVersion:t}=this.getVersionInfo();return`${e}\n${t}`})),i()(this,"onKeyboardShortcutsClicked",(()=>{A.a.dispatch({action:L.a.ViewUserSettings,initialTabId:Ma.a.Keyboard})})),this.state={appVersion:null,canUpdate:!1}}componentDidMount(){var e,t;null===(e=j.a.get())||void 0===e||e.getAppVersion().then((e=>this.setState({appVersion:e}))).catch((e=>{d.a.error("Error getting vector version: ",e)})),null===(t=j.a.get())||void 0===t||t.canSelfUpdate().then((e=>this.setState({canUpdate:e}))).catch((e=>{d.a.error("Error getting self updatability: ",e)}))}getVersionInfo(){const e=Me.b.get().brand,t=this.state.appVersion||"unknown",a=u.a.get().olmVersion,n=a?`${a[0]}.${a[1]}.${a[2]}`:"<not-enabled>";return{appVersion:`${Object(l.a)("%(brand)s version:",{brand:e})} ${t}`,olmVersion:`${Object(l.a)("Olm version:")} ${n}`}}renderLegal(){const e=Me.b.get().terms_and_conditions_links;if(!e)return null;const t=[];for(const a of e)t.push(r.a.createElement("div",{key:a.url},r.a.createElement("a",{href:a.url,rel:"noreferrer noopener",target:"_blank"},a.text)));return r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Legal")),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},t))}renderCredits(){return r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Credits")),r.a.createElement("ul",{className:"mx_SettingsTab_subsectionText"},r.a.createElement("li",null,"The"," ",r.a.createElement("a",{href:"themes/element/img/backgrounds/lake.jpg",rel:"noreferrer noopener",target:"_blank"},"default cover photo")," ","is © ",r.a.createElement("a",{href:"https://www.flickr.com/golan",rel:"noreferrer noopener",target:"_blank"},"Jesús Roncero")," ","used under the terms of ",r.a.createElement("a",{href:"https://creativecommons.org/licenses/by-sa/4.0/",rel:"noreferrer noopener",target:"_blank"},"CC-BY-SA 4.0"),"."),r.a.createElement("li",null,"The"," ",r.a.createElement("a",{href:"https://github.com/matrix-org/twemoji-colr",rel:"noreferrer noopener",target:"_blank"},"twemoji-colr")," ","font is © ",r.a.createElement("a",{href:"https://mozilla.org",rel:"noreferrer noopener",target:"_blank"},"Mozilla Foundation")," ","used under the terms of ",r.a.createElement("a",{href:"https://www.apache.org/licenses/LICENSE-2.0",rel:"noreferrer noopener",target:"_blank"},"Apache 2.0"),"."),r.a.createElement("li",null,"The"," ",r.a.createElement("a",{href:"https://twemoji.twitter.com/",rel:"noreferrer noopener",target:"_blank"},"Twemoji")," ","emoji art is © ",r.a.createElement("a",{href:"https://twemoji.twitter.com/",rel:"noreferrer noopener",target:"_blank"},"Twitter, Inc and other contributors")," ","used under the terms of ",r.a.createElement("a",{href:"https://creativecommons.org/licenses/by/4.0/",rel:"noreferrer noopener",target:"_blank"},"CC-BY 4.0"),".")))}render(){const e=Me.b.get().brand;let t,a,n=Object(l.a)("For help with using %(brand)s, click <a>here</a>.",{brand:e},{a:e=>r.a.createElement("a",{href:"https://element.io/help",rel:"noreferrer noopener",target:"_blank"},e)});Me.b.get("welcome_user_id")&&Object(l.e)().startsWith("en")&&(n=r.a.createElement("div",null,Object(l.a)("For help with using %(brand)s, click <a>here</a> or start a chat with our bot using the button below.",{brand:e},{a:e=>r.a.createElement("a",{href:"https://element.io/help",rel:"noreferrer noopener",target:"_blank"},e)}),r.a.createElement("div",null,r.a.createElement(f.a,{onClick:this.onStartBotChat,kind:"primary"},Object(l.a)("Chat with %(brand)s Bot",{brand:e}))))),this.state.canUpdate&&(t=r.a.createElement(Ya,null)),Me.b.get().bug_report_endpoint_url&&(a=r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Bug reporting")),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("If you've submitted a bug via GitHub, debug logs can help us track down the problem. "),Object(l.a)("Debug logs contain application usage data including your username, the IDs or aliases of the rooms you have visited, which UI elements you last interacted with, and the usernames of other users. They do not contain messages.")),r.a.createElement(f.a,{onClick:this.onBugReport,kind:"primary"},Object(l.a)("Submit debug logs")),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("To report a Matrix-related security issue, please read the Matrix.org <a>Security Disclosure Policy</a>.",{},{a:e=>r.a.createElement("a",{href:"https://matrix.org/security-disclosure-policy/",rel:"noreferrer noopener",target:"_blank"},e)}))));const{appVersion:i,olmVersion:s}=this.getVersionInfo();return r.a.createElement("div",{className:"mx_SettingsTab mx_HelpUserSettingsTab"},r.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(l.a)("Help & About")),a,r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("FAQ")),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},n),r.a.createElement(f.a,{kind:"primary",onClick:this.onKeyboardShortcutsClicked},Object(l.a)("Keyboard Shortcuts"))),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Versions")),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},r.a.createElement(Qa.a,{getTextToCopy:this.getVersionTextToCopy},i,r.a.createElement("br",null),s,r.a.createElement("br",null)),t)),this.renderLegal(),this.renderCredits(),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Advanced")),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},r.a.createElement("div",null,Object(l.a)("Homeserver is <code>%(homeserverUrl)s</code>",{homeserverUrl:u.a.get().getHomeserverUrl()},{code:e=>r.a.createElement("code",null,e)})),r.a.createElement("div",null,Object(l.a)("Identity server is <code>%(identityServerUrl)s</code>",{identityServerUrl:u.a.get().getIdentityServerUrl()},{code:e=>r.a.createElement("code",null,e)})),r.a.createElement("details",null,r.a.createElement("summary",null,Object(l.a)("Access Token")),r.a.createElement("b",null,Object(l.a)("Your access token gives full access to your account. Do not share it with anyone.")),r.a.createElement(Qa.a,{getTextToCopy:()=>u.a.get().getAccessToken()},u.a.get().getAccessToken())),r.a.createElement(f.a,{onClick:this.onClearCacheAndReload,kind:"danger"},Object(l.a)("Clear cache and reload")))))}}var Za=a(526),en=a(493);class tn extends r.a.Component{constructor(e){super(e),i()(this,"onPersonalRuleChanged",(e=>{this.setState({newPersonalRule:e.target.value})})),i()(this,"onNewListChanged",(e=>{this.setState({newList:e.target.value})})),i()(this,"onAddPersonalRule",(async e=>{e.preventDefault(),e.stopPropagation();let t=en.d;this.state.newPersonalRule.startsWith("@")&&(t=en.e),this.setState({busy:!0});try{const e=await Za.a.sharedInstance().getOrCreatePersonalList();await e.banEntity(t,this.state.newPersonalRule,Object(l.a)("Ignored/Blocked")),this.setState({newPersonalRule:""})}catch(e){d.a.error(e),g.b.createDialog(v.a,{title:Object(l.a)("Error adding ignored user/server"),description:Object(l.a)("Something went wrong. Please try again or view your console for hints.")})}finally{this.setState({busy:!1})}})),i()(this,"onSubscribeList",(async e=>{e.preventDefault(),e.stopPropagation(),this.setState({busy:!0});try{const e=await u.a.get().joinRoom(this.state.newList);await Za.a.sharedInstance().subscribeToList(e.roomId),this.setState({newList:""})}catch(e){d.a.error(e),g.b.createDialog(v.a,{title:Object(l.a)("Error subscribing to list"),description:Object(l.a)("Please verify the room ID or address and try again.")})}finally{this.setState({busy:!1})}})),this.state={busy:!1,newPersonalRule:"",newList:""}}async removePersonalRule(e){this.setState({busy:!0});try{const t=Za.a.sharedInstance().getPersonalList();await t.unbanEntity(e.kind,e.entity)}catch(e){d.a.error(e),g.b.createDialog(v.a,{title:Object(l.a)("Error removing ignored user/server"),description:Object(l.a)("Something went wrong. Please try again or view your console for hints.")})}finally{this.setState({busy:!1})}}async unsubscribeFromList(e){this.setState({busy:!0});try{await Za.a.sharedInstance().unsubscribeFromList(e.roomId),await u.a.get().leave(e.roomId)}catch(e){d.a.error(e),g.b.createDialog(v.a,{title:Object(l.a)("Error unsubscribing from list"),description:Object(l.a)("Please try again or view your console for hints.")})}finally{this.setState({busy:!1})}}viewListRules(e){const t=u.a.get().getRoom(e.roomId),a=t?t.name:e.roomId,n=e=>{if(0===e.length)return r.a.createElement("i",null,Object(l.a)("None"));const t=[];for(const a of e)t.push(r.a.createElement("li",{key:a.kind+a.entity},r.a.createElement("code",null,a.entity)));return r.a.createElement("ul",null,t)};g.b.createDialog(ce.a,{title:Object(l.a)("Ban list rules - %(roomName)s",{roomName:a}),description:r.a.createElement("div",null,r.a.createElement("h3",null,Object(l.a)("Server rules")),n(e.serverRules),r.a.createElement("h3",null,Object(l.a)("User rules")),n(e.userRules)),button:Object(l.a)("Close"),hasCancelButton:!1})}renderPersonalBanListRules(){const e=Za.a.sharedInstance().getPersonalList(),t=e?[...e.userRules,...e.serverRules]:[];if(!e||t.length<=0)return r.a.createElement("i",null,Object(l.a)("You have not ignored anyone."));const a=[];for(const e of t)a.push(r.a.createElement("li",{key:e.entity,className:"mx_MjolnirUserSettingsTab_listItem"},r.a.createElement(f.a,{kind:"danger_sm",onClick:()=>this.removePersonalRule(e),disabled:this.state.busy},Object(l.a)("Remove"))," ",r.a.createElement("code",null,e.entity)));return r.a.createElement("div",null,r.a.createElement("p",null,Object(l.a)("You are currently ignoring:")),r.a.createElement("ul",null,a))}renderSubscribedBanLists(){const e=Za.a.sharedInstance().getPersonalList(),t=Za.a.sharedInstance().lists.filter((t=>!e||e.roomId!==t.roomId));if(!t||t.length<=0)return r.a.createElement("i",null,Object(l.a)("You are not subscribed to any lists"));const a=[];for(const e of t){const t=u.a.get().getRoom(e.roomId),n=t?r.a.createElement("span",null,t.name," (",r.a.createElement("code",null,e.roomId),")"):r.a.createElement("code",null,"list.roomId");a.push(r.a.createElement("li",{key:e.roomId,className:"mx_MjolnirUserSettingsTab_listItem"},r.a.createElement(f.a,{kind:"danger_sm",onClick:()=>this.unsubscribeFromList(e),disabled:this.state.busy},Object(l.a)("Unsubscribe"))," ",r.a.createElement(f.a,{kind:"primary_sm",onClick:()=>this.viewListRules(e),disabled:this.state.busy},Object(l.a)("View rules"))," ",n))}return r.a.createElement("div",null,r.a.createElement("p",null,Object(l.a)("You are currently subscribed to:")),r.a.createElement("ul",null,a))}render(){const e=Me.b.get().brand;return r.a.createElement("div",{className:"mx_SettingsTab mx_MjolnirUserSettingsTab"},r.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(l.a)("Ignored users")),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},r.a.createElement("span",{className:"warning"},Object(l.a)("⚠ These settings are meant for advanced users.")),r.a.createElement("br",null),r.a.createElement("br",null),Object(l.a)("Add users and servers you want to ignore here. Use asterisks to have %(brand)s match any characters. For example, <code>@bot:*</code> would ignore all users that have the name 'bot' on any server.",{brand:e},{code:e=>r.a.createElement("code",null,e)}),r.a.createElement("br",null),r.a.createElement("br",null),Object(l.a)("Ignoring people is done through ban lists which contain rules for who to ban. Subscribing to a ban list means the users/servers blocked by that list will be hidden from you."))),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Personal ban list")),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},Object(l.a)("Your personal ban list holds all the users/servers you personally don't want to see messages from. After ignoring your first user/server, a new room will show up in your room list named '%(myBanList)s' - stay in this room to keep the ban list in effect.",{myBanList:Object(l.a)("My Ban List")})),r.a.createElement("div",null,this.renderPersonalBanListRules()),r.a.createElement("div",null,r.a.createElement("form",{onSubmit:this.onAddPersonalRule,autoComplete:"off"},r.a.createElement(h.a,{type:"text",label:Object(l.a)("Server or user ID to ignore"),placeholder:Object(l.a)("eg: @bot:* or example.org"),value:this.state.newPersonalRule,onChange:this.onPersonalRuleChanged}),r.a.createElement(f.a,{type:"submit",kind:"primary",onClick:this.onAddPersonalRule,disabled:this.state.busy},Object(l.a)("Ignore"))))),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Subscribed lists")),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},r.a.createElement("span",{className:"warning"},Object(l.a)("Subscribing to a ban list will cause you to join it!"))," ",r.a.createElement("span",null,Object(l.a)("If this isn't what you want, please use a different tool to ignore users."))),r.a.createElement("div",null,this.renderSubscribedBanLists()),r.a.createElement("div",null,r.a.createElement("form",{onSubmit:this.onSubscribeList,autoComplete:"off"},r.a.createElement(h.a,{type:"text",label:Object(l.a)("Room ID or address of ban list"),value:this.state.newList,onChange:this.onNewListChanged}),r.a.createElement(f.a,{type:"submit",kind:"primary",onClick:this.onSubscribeList,disabled:this.state.busy},Object(l.a)("Subscribe"))))))}}var an=a(883),nn=a(677),sn=a(639);const rn=Object.entries(de.b).filter((e=>{let[t]=e;return t!==de.c.LABS||Me.b.get("show_labs_settings")})),on=e=>{let{name:t}=e;const a=Object(nn.a)(t),n=Object(nn.b)(t);return a&&n?r.a.createElement("div",{className:"mx_KeyboardShortcut_shortcutRow"},a,r.a.createElement(sn.a,{value:n})):null},ln=e=>{let{categoryName:t,category:a}=e;return a.categoryLabel?r.a.createElement("div",{className:"mx_SettingsTab_section",key:t},r.a.createElement("div",{className:"mx_SettingsTab_subheading"},Object(l.a)(a.categoryLabel)),r.a.createElement("div",null," ",a.settingNames.map((e=>r.a.createElement(on,{key:e,name:e})))," ")):null};var cn=()=>r.a.createElement("div",{className:"mx_SettingsTab mx_KeyboardUserSettingsTab"},r.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(l.a)("Keyboard")),rn.map((e=>{let[t,a]=e;return r.a.createElement(ln,{key:t,categoryName:t,category:a})}))),dn=a(867),mn=a(141);function un(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function hn(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?un(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):un(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}const pn=(e,t,a)=>{try{const n=e.getUserId();if(!n)throw new Error("No user id");const i=e.getStoredDevice(n,a.device_id);if(!i)throw new Error("No device info available");return t.checkDeviceTrust(t,i,!1,!0).isCrossSigningVerified()}catch(e){return d.a.error("Error getting device cross-signing info",e),null}},gn=(e,t)=>{const{name:a,version:n,url:i}=Object(dn.a)(e,t.device_id);return{appName:a,appVersion:n,url:i}};let vn;!function(e){e.Unsupported="Unsupported",e.Default="Default"}(vn||(vn={}));const bn=()=>{var e;const t=Object(s.useContext)(Kt.a),a=t.getDeviceId(),n=t.getSafeUserId(),[i,r]=Object(s.useState)({}),[o,c]=Object(s.useState)([]),[u,h]=Object(s.useState)(new Map),[p,g]=Object(s.useState)(!0),[v,b]=Object(s.useState)(!0),[f,y]=Object(s.useState)();Object(s.useEffect)((()=>{t.doesServerSupportUnstableFeature("org.matrix.msc3881").then((e=>{b(e)}))}),[t]);const E=Object(s.useCallback)((async()=>{g(!0);try{const e=await(async(e,t)=>{const{devices:a}=await e.getDevices(),n=e.getStoredCrossSigningForUser(t);return a.reduce(((t,a)=>hn(hn({},t),{},{[a.device_id]:hn(hn(hn({},a),{},{isVerified:pn(e,n,a)},gn(e,a)),Object(Nt.b)(a[m.UNSTABLE_MSC3852_LAST_SEEN_UA.name]))})),{})})(t,n);r(e);const{pushers:a}=await t.getPushers();c(a);const i=new Map;Object.keys(e).forEach((e=>{const a=`${m.LOCAL_NOTIFICATION_SETTINGS_PREFIX.name}.${e}`,n=t.getAccountData(a);n&&i.set(e,n.getContent())})),h(i),g(!1)}catch(e){404==e.httpStatus?y(vn.Unsupported):(d.a.error("Error loading sessions:",e),y(vn.Default)),g(!1)}}),[t,n]);Object(s.useEffect)((()=>{E()}),[E]),Object(s.useEffect)((()=>{const e=Object.keys(i);e.length&&Object(dn.b)(e,t)}),[i,t]),Object(mn.a)(t,ot.b.DevicesUpdated,(e=>{e.includes(n)&&E()})),Object(mn.a)(t,m.ClientEvent.AccountData,(e=>{const t=e.getType();if(t.startsWith(m.LOCAL_NOTIFICATION_SETTINGS_PREFIX.name)){const a=new Map(u),n=t.slice(t.lastIndexOf(".")+1);a.set(n,e.getContent()),h(a)}}));const _=!(null===(e=i[a])||void 0===e||!e.isVerified)&&n?async e=>await t.requestVerification(n,[e]):void 0,w=Object(s.useCallback)((async(e,a)=>{const n=i[e];if(a!==(null==n?void 0:n.display_name))try{await t.setDeviceDetails(e,{display_name:a}),await E()}catch(e){throw d.a.error("Error setting session display name",e),new Error(Object(l.a)("Failed to set display name"))}}),[t,i,E]),S=Object(s.useCallback)((async(e,a)=>{try{const n=o.find((t=>t[m.PUSHER_DEVICE_ID.name]===e));n?await t.setPusher(hn(hn({},n),{},{[m.PUSHER_ENABLED.name]:a})):u.has(e)&&await t.setLocalNotificationSettings(e,{is_silenced:!a})}catch(e){throw d.a.error("Error setting pusher state",e),new Error(Object(l.a)("Failed to set pusher state"))}finally{await E()}}),[t,o,u,E]);return{devices:i,pushers:o,localNotificationSettings:u,currentDeviceId:a,isLoadingDeviceList:p,error:f,requestDeviceVerification:_,refreshDevices:E,saveDeviceName:w,setPushNotifications:S,supportsMSC3881:v}};var fn,yn=a(129),En=a(130),_n=a.n(En);function wn(){return wn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},wn.apply(this,arguments)}function Sn(e){return s.createElement("svg",wn({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 18 18",role:"presentation","aria-hidden":!0},e),fn||(fn=s.createElement("path",{d:"M4 8.818L7.125 12 14 5",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})))}const On=["value","options","selectedLabel","className"],Cn=(e,t)=>a=>{const n=e.find((e=>{let{id:t}=e;return t===a}));return n?t?`${t}: ${n.label}`:n.label:null},xn=e=>{let{value:t,options:a,selectedLabel:n,className:i}=e,s=Ha()(e,On);return r.a.createElement(x.a,_n()({},s,{value:t,className:He()("mx_FilterDropdown",i),getShortOption:Cn(a,n)}),a.map((e=>{let{id:a,label:n,description:i}=e;return r.a.createElement("div",{className:"mx_FilterDropdown_option","data-testid":`filter-option-${a}`,key:a},a===t&&r.a.createElement(Sn,{className:"mx_FilterDropdown_optionSelectedIcon"}),r.a.createElement("span",{className:"mx_FilterDropdown_optionLabel"},n),!!i&&r.a.createElement("span",{className:"mx_FilterDropdown_optionDescription"},i))})))};var jn=a(165),kn=a(213);const Rn=["title","description"];var In=e=>{let{title:t,description:a}=e,n=Ha()(e,Rn);return r.a.createElement(f.a,_n()({},n,{kind:"link_inline",onClick:()=>{g.b.createDialog(kn.a,{title:t,description:a,button:Object(l.a)("Got it"),hasCloseButton:!0})},className:"mx_LearnMore_button"}),Object(l.a)("Learn more"))},Tn=a(461);const Nn=e=>{let{device:t,saveDeviceName:a,stopEditing:n}=e;const[i,o]=Object(s.useState)(t.display_name||""),[c,d]=Object(s.useState)(!1),[m,u]=Object(s.useState)(null);Object(s.useEffect)((()=>{o(t.display_name||"")}),[t.display_name]);const p=async e=>{d(!0),u(null),e.preventDefault();try{await a(i),n()}catch(e){u(Object(l.a)("Failed to set display name")),d(!1)}},g=`device-rename-${t.device_id}`,v=`device-rename-description-${t.device_id}`;return r.a.createElement("form",{"aria-disabled":c,className:"mx_DeviceDetailHeading_renameForm",onSubmit:p,method:"post"},r.a.createElement("p",{id:g,className:"mx_DeviceDetailHeading_renameFormHeading"},Object(l.a)("Rename session")),r.a.createElement("div",null,r.a.createElement(h.a,{"data-testid":"device-rename-input",type:"text",value:i,autoComplete:"off",onChange:e=>o(e.target.value),autoFocus:!0,disabled:c,"aria-labelledby":g,"aria-describedby":v,className:"mx_DeviceDetailHeading_renameFormInput",maxLength:100}),r.a.createElement(Tn.a,{id:v},Object(l.a)("Please be aware that session names are also visible to people you communicate with."),r.a.createElement(In,{title:Object(l.a)("Renaming sessions"),description:r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,Object(l.a)("Other users in direct messages and rooms that you join are able to view a full list of your sessions.")),r.a.createElement("p",null,Object(l.a)("This provides them with confidence that they are really speaking to you, but it also means they can see the session name you enter here.")))}),!!m&&r.a.createElement("span",{"data-testid":"device-rename-error",className:"mx_DeviceDetailHeading_renameFormError"},m))),r.a.createElement("div",{className:"mx_DeviceDetailHeading_renameFormButtons"},r.a.createElement(f.a,{onClick:p,kind:"primary","data-testid":"device-rename-submit-cta",disabled:c},Object(l.a)("Save")),r.a.createElement(f.a,{onClick:n,kind:"secondary","data-testid":"device-rename-cancel-cta",disabled:c},Object(l.a)("Cancel")),c&&r.a.createElement(k.a,{w:16,h:16})))},Pn=e=>{let{device:t,saveDeviceName:a}=e;const[n,i]=Object(s.useState)(!1);return n?r.a.createElement(Nn,{device:t,saveDeviceName:a,stopEditing:()=>i(!1)}):r.a.createElement("div",{className:"mx_DeviceDetailHeading","data-testid":"device-detail-heading"},r.a.createElement(Et.a,{size:"h4"},t.display_name||t.device_id),r.a.createElement(f.a,{kind:"link_inline",onClick:()=>i(!0),className:"mx_DeviceDetailHeading_renameCta","data-testid":"device-heading-rename-cta"},Object(l.a)("Rename")))};var Dn=a(866),Mn=a(344);const An={[Mn.a.Inactive]:Dn.a,[Mn.a.Verified]:It,[Mn.a.Unverified]:Tt.Icon,[Mn.a.Unverifiable]:Tt.Icon},Ln=e=>{let{variation:t}=e;const a=An[t];return r.a.createElement("div",{className:He()("mx_DeviceSecurityCard_icon",t)},r.a.createElement(a,{height:16,width:16}))};var Un=e=>{let{variation:t,heading:a,description:n,children:i}=e;return r.a.createElement("div",{className:"mx_DeviceSecurityCard"},r.a.createElement(Ln,{variation:t}),r.a.createElement("div",{className:"mx_DeviceSecurityCard_content"},r.a.createElement("p",{className:"mx_DeviceSecurityCard_heading"},a),r.a.createElement("p",{className:"mx_DeviceSecurityCard_description"},n),!!i&&r.a.createElement("div",{className:"mx_DeviceSecurityCard_actions"},i)))};const Fn={[Mn.a.Verified]:{title:Object(l.a)("Verified sessions"),description:r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,Object(l.a)("Verified sessions are anywhere you are using this account after entering your passphrase or confirming your identity with another verified session.")),r.a.createElement("p",null,Object(l.a)("This means that you have all the keys needed to unlock your encrypted messages and confirm to other users that you trust this session.")))},[Mn.a.Unverified]:{title:Object(l.a)("Unverified sessions"),description:r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,Object(l.a)("Unverified sessions are sessions that have logged in with your credentials but have not been cross-verified.")),r.a.createElement("p",null,Object(l.a)("You should make especially certain that you recognise these sessions as they could represent an unauthorised use of your account.")))},[Mn.a.Unverifiable]:{title:Object(l.a)("Unverified session"),description:r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,Object(l.a)("This session doesn't support encryption and thus can't be verified.")),r.a.createElement("p",null,Object(l.a)("You won't be able to participate in rooms where encryption is enabled when using this session.")),r.a.createElement("p",null,Object(l.a)("For best security and privacy, it is recommended to use Matrix clients that support encryption.")))},[Mn.a.Inactive]:{title:Object(l.a)("Inactive sessions"),description:r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,Object(l.a)("Inactive sessions are sessions you have not used in some time, but they continue to receive encryption keys.")),r.a.createElement("p",null,Object(l.a)("Removing inactive sessions improves security and performance, and makes it easier for you to identify if a new session is suspicious.")))}},Bn=e=>{let{variation:t}=e;const{title:a,description:n}=Fn[t];return r.a.createElement(In,{title:a,description:n})},Vn=e=>{let{device:t,isCurrentDevice:a,onVerifyDevice:n}=e;const i=((e,t)=>{if(e.isVerified){const e=t?Object(l.a)("Your current session is ready for secure messaging."):Object(l.a)("This session is ready for secure messaging.");return{variation:Mn.a.Verified,heading:Object(l.a)("Verified session"),description:r.a.createElement(r.a.Fragment,null,e,r.a.createElement(Bn,{variation:Mn.a.Verified}))}}if(null===e.isVerified)return{variation:Mn.a.Unverified,heading:Object(l.a)("Unverified session"),description:r.a.createElement(r.a.Fragment,null,Object(l.a)("This session doesn't support encryption and thus can't be verified."),r.a.createElement(Bn,{variation:Mn.a.Unverifiable}))};const a=t?Object(l.a)("Verify your current session for enhanced secure messaging."):Object(l.a)("Verify or sign out from this session for best security and reliability.");return{variation:Mn.a.Unverified,heading:Object(l.a)("Unverified session"),description:r.a.createElement(r.a.Fragment,null,a,r.a.createElement(Bn,{variation:Mn.a.Unverified}))}})(t,a);return r.a.createElement(Un,i,!1===t.isVerified&&!!n&&r.a.createElement(f.a,{kind:"primary",onClick:n,"data-testid":`verification-status-button-${t.device_id}`},Object(l.a)("Verify session")))};function Wn(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function Hn(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?Wn(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):Wn(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}var zn,Gn=e=>{let{device:t,pusher:a,localNotificationSettings:n,isSigningOut:i,onVerifyDevice:s,onSignOutDevice:o,saveDeviceName:c,setPushNotifications:d,supportsMSC3881:m,className:u,isCurrentDevice:h}=e;const p=[{id:"session",values:[{label:Object(l.a)("Session ID"),value:t.device_id},{label:Object(l.a)("Last activity"),value:t.last_seen_ts&&Object(jn.a)(new Date(t.last_seen_ts))}]},{id:"application",heading:Object(l.a)("Application"),values:[{label:Object(l.a)("Name"),value:t.appName},{label:Object(l.a)("Version"),value:t.appVersion},{label:Object(l.a)("URL"),value:t.url}]},{id:"device",heading:Object(l.a)("Device"),values:[{label:Object(l.a)("Model"),value:t.deviceModel},{label:Object(l.a)("Operating system"),value:t.deviceOperatingSystem},{label:Object(l.a)("Browser"),value:t.client},{label:Object(l.a)("IP address"),value:t.last_seen_ip}]}].map((e=>Hn(Hn({},e),{},{values:e.values.filter((e=>!!e.value))}))).filter((e=>e.values.length)),g=!!a||!!n;return r.a.createElement("div",{className:He()("mx_DeviceDetails",u),"data-testid":`device-detail-${t.device_id}`},r.a.createElement("section",{className:"mx_DeviceDetails_section"},r.a.createElement(Pn,{device:t,saveDeviceName:c}),r.a.createElement(Vn,{device:t,onVerifyDevice:s,isCurrentDevice:!0})),r.a.createElement("section",{className:"mx_DeviceDetails_section"},r.a.createElement("p",{className:"mx_DeviceDetails_sectionHeading"},Object(l.a)("Session details")),p.map(((e,t)=>{let{heading:a,values:n,id:i}=e;return r.a.createElement("table",{className:"mx_DeviceDetails_metadataTable",key:t,"data-testid":`device-detail-metadata-${i}`},a&&r.a.createElement("thead",null,r.a.createElement("tr",null,r.a.createElement("th",null,a))),r.a.createElement("tbody",null,n.map((e=>{let{label:t,value:a}=e;return r.a.createElement("tr",{key:t},r.a.createElement("td",{className:"mxDeviceDetails_metadataLabel"},t),r.a.createElement("td",{className:"mxDeviceDetails_metadataValue"},a))}))))}))),g&&r.a.createElement("section",{className:"mx_DeviceDetails_section mx_DeviceDetails_pushNotifications","data-testid":"device-detail-push-notification"},r.a.createElement(ke.a,{checked:function(e,t){return e?e[yn.g.name]:!n||!n.is_silenced}(a),disabled:function(e,t){return!n&&!(!e||m)}(a),onChange:e=>null==d?void 0:d(t.device_id,e),title:Object(l.a)("Toggle push notifications on this session."),"data-testid":"device-detail-push-notification-checkbox"}),r.a.createElement("p",{className:"mx_DeviceDetails_sectionHeading"},Object(l.a)("Push notifications"),r.a.createElement("small",{className:"mx_DeviceDetails_sectionSubheading"},Object(l.a)("Receive push notifications on this session.")))),r.a.createElement("section",{className:"mx_DeviceDetails_section"},r.a.createElement(f.a,{onClick:o,kind:"danger_inline",disabled:i,"data-testid":"device-detail-sign-out-cta"},r.a.createElement("span",{className:"mx_DeviceDetails_signOutButtonContent"},Object(l.a)("Sign out of this session"),i&&r.a.createElement(k.a,{w:16,h:16})))))};function Kn(){return Kn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Kn.apply(this,arguments)}function qn(e){return s.createElement("svg",Kn({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 10 6",role:"presentation","aria-hidden":!0},e),zn||(zn=s.createElement("g",{fill:"none",fillRule:"evenodd",stroke:"currentColor",strokeLinecap:"round",strokeWidth:1.3},s.createElement("path",{d:"M1.5 1.5l3.859 3.254M9.132 1.56L5.359 4.754"}))))}var $n=a(148);const Yn=["isExpanded","onClick"],Jn=e=>{let{isExpanded:t,onClick:a}=e,n=Ha()(e,Yn);const i=t?Object(l.a)("Hide details"):Object(l.a)("Show details");return r.a.createElement($n.a,_n()({},n,{"aria-label":i,title:i,kind:"icon",className:He()("mx_DeviceExpandDetailsButton",{mx_DeviceExpandDetailsButton_expanded:t}),onClick:a}),r.a.createElement(qn,{className:"mx_DeviceExpandDetailsButton_icon"}))};var Qn=a(621),Xn=a(161),Zn=a(244);const ei=["selectedDeviceCount","isAllSelected","toggleSelectAll","children"];var ti=e=>{let{selectedDeviceCount:t,isAllSelected:a,toggleSelectAll:n,children:i}=e,s=Ha()(e,ei);const o=a?Object(l.a)("Deselect all"):Object(l.a)("Select all");return r.a.createElement("div",_n()({className:"mx_FilteredDeviceListHeader"},s),r.a.createElement(Zn.a,{label:o,alignment:Xn.a.Top},r.a.createElement(D.b,{kind:D.a.Solid,checked:a,onChange:n,id:"device-select-all-checkbox","data-testid":"device-select-all-checkbox","aria-label":o})),r.a.createElement("span",{className:"mx_FilteredDeviceListHeader_label"},t>0?Object(l.a)("%(count)s sessions selected",{count:t}):Object(l.a)("Sessions")),i)};const ai=(e,t)=>t.includes(e),ni=(e,t)=>(t.last_seen_ts||0)-(e.last_seen_ts||0)||(e.display_name||e.device_id).localeCompare(t.display_name||t.device_id),ii="ALL",si={[Mn.a.Verified]:{title:Object(l.a)("Verified sessions"),description:Object(l.a)("For best security, sign out from any session that you don't recognize or use anymore.")},[Mn.a.Unverified]:{title:Object(l.a)("Unverified sessions"),description:Object(l.a)("Verify your sessions for enhanced secure messaging or sign out from those you don't recognize or use anymore.")},[Mn.a.Unverifiable]:{title:Object(l.a)("Unverified session"),description:Object(l.a)("This session doesn't support encryption and thus can't be verified.")},[Mn.a.Inactive]:{title:Object(l.a)("Inactive sessions"),description:Object(l.a)("Consider signing out from old sessions (%(inactiveAgeDays)s days or older) you don't use anymore.",{inactiveAgeDays:Qn.a})}},ri=e=>{let{filter:t}=e;if((e=>!!e&&[Mn.a.Inactive,Mn.a.Unverified,Mn.a.Verified].includes(e))(t)){const{title:e,description:a}=si[t];return r.a.createElement("div",{className:"mx_FilteredDeviceList_securityCard"},r.a.createElement(Un,{variation:t,heading:e,description:r.a.createElement("span",null,a,r.a.createElement(Bn,{variation:t}))}))}return null},oi=e=>{let{filter:t,clearFilter:a}=e;return r.a.createElement("div",{className:"mx_FilteredDeviceList_noResults"},(e=>{switch(e){case Mn.a.Verified:return Object(l.a)("No verified sessions found.");case Mn.a.Unverified:return Object(l.a)("No unverified sessions found.");case Mn.a.Inactive:return Object(l.a)("No inactive sessions found.");default:return Object(l.a)("No sessions found.")}})(t),!!t&&r.a.createElement(r.a.Fragment,null," ",r.a.createElement(f.a,{kind:"link_inline",onClick:a,"data-testid":"devices-clear-filter-btn"},Object(l.a)("Show all"))))},li=e=>{let{device:t,pusher:a,localNotificationSettings:n,isExpanded:i,isSigningOut:s,isSelected:o,onDeviceExpandToggle:l,onSignOutDevice:c,saveDeviceName:d,onRequestDeviceVerification:m,setPushNotifications:u,toggleSelected:h,supportsMSC3881:p}=e;return r.a.createElement("li",{className:"mx_FilteredDeviceList_listItem"},r.a.createElement(Bt,{isSelected:o,onSelect:h,onClick:l,device:t},s&&r.a.createElement(k.a,{w:16,h:16}),r.a.createElement(Jn,{isExpanded:i,onClick:l})),i&&r.a.createElement(Gn,{device:t,pusher:a,localNotificationSettings:n,isSigningOut:s,onVerifyDevice:m,onSignOutDevice:c,saveDeviceName:d,setPushNotifications:u,supportsMSC3881:p,className:"mx_FilteredDeviceList_deviceDetails"}))},ci=Object(s.forwardRef)(((e,t)=>{let{devices:a,pushers:n,localNotificationSettings:i,filter:s,expandedDeviceIds:o,signingOutDeviceIds:c,selectedDeviceIds:d,onFilterChange:m,onDeviceExpandToggle:u,saveDeviceName:h,onSignOutDevices:p,onRequestDeviceVerification:g,setPushNotifications:v,setSelectedDeviceIds:b,supportsMSC3881:y}=e;const E=((e,t)=>Object(Qn.b)(Object.values(e),t?[t]:[]).sort(ni))(a,s);function _(e){return n.find((t=>t[yn.f.name]===e.device_id))}const w=[{id:ii,label:Object(l.a)("All")},{id:Mn.a.Verified,label:Object(l.a)("Verified"),description:Object(l.a)("Ready for secure messaging")},{id:Mn.a.Unverified,label:Object(l.a)("Unverified"),description:Object(l.a)("Not ready for secure messaging")},{id:Mn.a.Inactive,label:Object(l.a)("Inactive"),description:Object(l.a)("Inactive for %(inactiveAgeDays)s days or longer",{inactiveAgeDays:Qn.a})}],S=d.length>=E.length,O=!!c.length;return r.a.createElement("div",{className:"mx_FilteredDeviceList",ref:t},r.a.createElement(ti,{selectedDeviceCount:d.length,isAllSelected:S,toggleSelectAll:()=>{b(S?[]:E.map((e=>e.device_id)))}},d.length?r.a.createElement(r.a.Fragment,null,r.a.createElement(f.a,{"data-testid":"sign-out-selection-cta",kind:"danger_inline",disabled:O,onClick:()=>p(d),className:"mx_FilteredDeviceList_headerButton"},O&&r.a.createElement(k.a,{w:16,h:16}),Object(l.a)("Sign out")),r.a.createElement(f.a,{"data-testid":"cancel-selection-cta",kind:"content_inline",disabled:O,onClick:()=>b([]),className:"mx_FilteredDeviceList_headerButton"},Object(l.a)("Cancel"))):r.a.createElement(xn,{id:"device-list-filter",label:Object(l.a)("Filter devices"),value:s||ii,onOptionChange:e=>{m(e===ii?void 0:e)},options:w,selectedLabel:Object(l.a)("Show")})),E.length?r.a.createElement(ri,{filter:s}):r.a.createElement(oi,{filter:s,clearFilter:()=>m(void 0)}),r.a.createElement("ol",{className:"mx_FilteredDeviceList_list"},E.map((e=>r.a.createElement(li,{key:e.device_id,device:e,pusher:_(e),localNotificationSettings:i.get(e.device_id),isExpanded:o.includes(e.device_id),isSigningOut:c.includes(e.device_id),isSelected:ai(e.device_id,d),onDeviceExpandToggle:()=>u(e.device_id),onSignOutDevice:()=>p([e.device_id]),saveDeviceName:t=>h(e.device_id,t),onRequestDeviceVerification:g?()=>g(e.device_id):void 0,setPushNotifications:v,toggleSelected:()=>{return t=e.device_id,void(ai(t,d)?b(d.filter((e=>e!==t))):b([...d,t]));var t},supportsMSC3881:y})))))}));var di=a(616),mi=a(623),ui=a(150),hi=a(176);const pi=["options","title"],gi=e=>{let{options:t,title:a}=e,n=Ha()(e,pi);const[i,s,o,l]=Object(ui.q)();return r.a.createElement(r.a.Fragment,null,r.a.createElement(ui.b,_n()({},n,{onClick:o,title:a,isExpanded:i,inputRef:s}),r.a.createElement(mi.a,{className:"mx_KebabContextMenu_icon"})),i&&r.a.createElement(hi.e,_n()({onFinished:l,compact:!0,rightAligned:!0,closeOnInteraction:!0},{left:(c=s.current.getBoundingClientRect()).left+window.scrollX+c.width,top:c.bottom+window.scrollY,chevronFace:ui.a.None}),r.a.createElement(hi.c,null,t)));var c},vi=e=>{let{onSignOutCurrentDevice:t,signOutAllOtherSessions:a,otherSessionsCount:n,disabled:i}=e;const s=[r.a.createElement(hi.b,{key:"sign-out",label:Object(l.a)("Sign out"),onClick:t,isDestructive:!0}),...a?[r.a.createElement(hi.b,{key:"sign-out-all-others",label:Object(l.a)("Sign out of all other sessions (%(otherSessionsCount)s)",{otherSessionsCount:n}),onClick:a,isDestructive:!0})]:[]];return r.a.createElement(di.a,{heading:Object(l.a)("Current session")},r.a.createElement(gi,{disabled:i,title:Object(l.a)("Options"),options:s,"data-testid":"current-session-menu"}))};var bi=e=>{let{device:t,isLoading:a,isSigningOut:n,localNotificationSettings:i,otherSessionsCount:o,setPushNotifications:l,onVerifyCurrentDevice:c,onSignOutCurrentDevice:d,signOutAllOtherSessions:m,saveDeviceName:u}=e;const[h,p]=Object(s.useState)(!1);return r.a.createElement(sa.a,{"data-testid":"current-session-section",heading:r.a.createElement(vi,{onSignOutCurrentDevice:d,signOutAllOtherSessions:m,otherSessionsCount:o,disabled:a||!t||n})},a&&!t&&r.a.createElement(k.a,null),!!t&&r.a.createElement(r.a.Fragment,null,r.a.createElement(Ft,{device:t,onClick:()=>p(!h)},r.a.createElement(Jn,{"data-testid":"current-session-toggle-details",isExpanded:h,onClick:()=>p(!h)})),h?r.a.createElement(Gn,{device:t,localNotificationSettings:i,setPushNotifications:l,isSigningOut:n,onVerifyDevice:c,onSignOutDevice:d,saveDeviceName:u,className:"mx_CurrentDeviceSection_deviceDetails"}):r.a.createElement(r.a.Fragment,null,r.a.createElement("br",null),r.a.createElement(Vn,{device:t,onVerifyDevice:c,isCurrentDevice:!0}))))};var fi=e=>{let{devices:t,currentDeviceId:a,goToFilteredList:n}=e;const i=Object.values(t),s=Object(Qn.b)(i,[Mn.a.Unverified]).filter((e=>e.device_id!==a)).length,o=Object(Qn.b)(i,[Mn.a.Inactive]).length;if(!(s|o))return null;const c=Qn.a;return r.a.createElement(sa.a,{heading:Object(l.a)("Security recommendations"),description:Object(l.a)("Improve your account security by following these recommendations."),"data-testid":"security-recommendations-section"},!!s&&r.a.createElement(Un,{variation:Mn.a.Unverified,heading:Object(l.a)("Unverified sessions"),description:r.a.createElement(r.a.Fragment,null,Object(l.a)("Verify your sessions for enhanced secure messaging or sign out from those you don't recognize or use anymore."),r.a.createElement(Bn,{variation:Mn.a.Unverified}))},r.a.createElement(f.a,{kind:"link_inline",onClick:()=>n(Mn.a.Unverified),"data-testid":"unverified-devices-cta"},Object(l.a)("View all")+` (${s})`)),!!o&&r.a.createElement(r.a.Fragment,null,!!s&&r.a.createElement("div",{className:"mx_SecurityRecommendations_spacing"}),r.a.createElement(Un,{variation:Mn.a.Inactive,heading:Object(l.a)("Inactive sessions"),description:r.a.createElement(r.a.Fragment,null,Object(l.a)("Consider signing out from old sessions (%(inactiveAgeDays)s days or older) you don't use anymore.",{inactiveAgeDays:c}),r.a.createElement(Bn,{variation:Mn.a.Inactive}))},r.a.createElement(f.a,{kind:"link_inline",onClick:()=>n(Mn.a.Inactive),"data-testid":"inactive-devices-cta"},Object(l.a)("View all")+` (${o})`))))},yi=a(851),Ei=a(248);const _i=e=>{let{otherSessionsCount:t,disabled:a,signOutAllOtherSessions:n}=e;const i=[r.a.createElement(hi.b,{key:"sign-out-all-others",label:Object(l.a)("Sign out of %(count)s sessions",{count:t}),onClick:n,isDestructive:!0})];return r.a.createElement(di.a,{heading:Object(l.a)("Other sessions")},r.a.createElement(gi,{disabled:a,title:Object(l.a)("Options"),options:i,"data-testid":"other-sessions-menu"}))};function wi(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var a=e[Symbol.toPrimitive];if(void 0!==a){var n=a.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}const Si=(e,t)=>{const[a,n]=Object(s.useState)([]);return{onSignOutCurrentDevice:()=>{g.b.createDialog(yt.a,{},void 0,!1,!0)},onSignOutOtherDevices:async i=>{if(!i.length)return;if(await(async e=>{const{finished:t}=g.b.createDialog(ce.a,{title:Object(l.a)("Sign out"),description:r.a.createElement("div",null,r.a.createElement("p",null,Object(l.a)("Are you sure you want to sign out of %(count)s sessions?",{count:e}))),cancelButton:Object(l.a)("Cancel"),button:Object(l.a)("Sign out")}),[a]=await t;return a})(i.length))try{n([...a,...i]),await Gt(e,i,(async e=>{e&&await t(),n(a.filter((e=>!i.includes(e))))}))}catch(e){d.a.error("Error deleting sessions",e),n(a.filter((e=>!i.includes(e))))}},signingOutDeviceIds:a}};var Oi=()=>{const{devices:e,pushers:t,localNotificationSettings:a,currentDeviceId:n,isLoadingDeviceList:i,requestDeviceVerification:o,refreshDevices:c,saveDeviceName:d,setPushNotifications:m,supportsMSC3881:u}=bn(),[h,p]=Object(s.useState)(),[v,b]=Object(s.useState)([]),[f,y]=Object(s.useState)([]),E=Object(s.useRef)(null),_=Object(s.useRef)(),w=Object(s.useContext)(Kt.a),S=w.getUserId(),O=S&&w.getUser(S)||void 0,C=Object(Ei.a)((()=>w.getVersions()),[w]),{[n]:x}=e,j=Ha()(e,[n].map(wi)),k=Object.keys(j).length,R=k>0,I=Object(s.useCallback)((e=>{if(!o)return;const t=o(e);g.b.createDialog(ft.a,{verificationRequestPromise:t,member:O,onFinished:async()=>{(await t).cancel(),await c()}})}),[o,c,O]),{onSignOutCurrentDevice:T,onSignOutOtherDevices:N,signingOutDeviceIds:P}=Si(w,(async()=>{await c(),y([])}));Object(s.useEffect)((()=>()=>{clearTimeout(_.current)}),[_]),Object(s.useEffect)((()=>{y([])}),[h,y]);const D=R?()=>{N(Object.keys(j))}:void 0,[M,A]=Object(s.useState)(),L=Object(s.useCallback)((()=>{A(null)}),[A]),U=Object(s.useCallback)((()=>{A(ia.b.Show)}),[A]);return M?r.a.createElement(ia.d,{mode:M,onFinished:L,client:w}):r.a.createElement(yi.a,{heading:Object(l.a)("Sessions")},r.a.createElement(fi,{devices:e,goToFilteredList:e=>{p(e),clearTimeout(_.current),_.current=window.setTimeout((()=>{var e;return null===(e=E.current)||void 0===e?void 0:e.scrollIntoView({block:"start",inline:"nearest",behavior:"smooth"})}))},currentDeviceId:n}),r.a.createElement(bi,{device:x,localNotificationSettings:a.get(n),setPushNotifications:m,isSigningOut:P.includes(n),isLoading:i,saveDeviceName:e=>d(n,e),onVerifyCurrentDevice:()=>{g.b.createDialog(bt.a,{onFinished:c})},onSignOutCurrentDevice:T,signOutAllOtherSessions:D,otherSessionsCount:k}),R&&r.a.createElement(sa.a,{heading:r.a.createElement(_i,{otherSessionsCount:k,signOutAllOtherSessions:D,disabled:!!P.length}),description:Object(l.a)("For best security, verify your sessions and sign out from any session that you don't recognize or use anymore."),"data-testid":"other-sessions-section"},r.a.createElement(ci,{devices:j,pushers:t,localNotificationSettings:a,filter:h,expandedDeviceIds:v,signingOutDeviceIds:P,selectedDeviceIds:f,setSelectedDeviceIds:y,onFilterChange:p,onDeviceExpandToggle:e=>{v.includes(e)?b(v.filter((t=>t!==e))):b([...v,e])},onRequestDeviceVerification:o?I:void 0,onSignOutDevices:N,saveDeviceName:d,setPushNotifications:m,ref:E,supportsMSC3881:u})),r.a.createElement(ra,{onShowQr:U,versions:C}))};class Ci extends r.a.Component{constructor(e){super(e),i()(this,"settingsWatchers",[]),i()(this,"mjolnirChanged",((e,t,a,n)=>{this.setState({mjolnirEnabled:n})})),i()(this,"sessionManagerChanged",((e,t,a,n)=>{this.setState({newSessionManagerEnabled:n})})),this.state={mjolnirEnabled:O.b.getValue("feature_mjolnir"),newSessionManagerEnabled:O.b.getValue("feature_new_device_manager")}}componentDidMount(){this.settingsWatchers=[O.b.watchSetting("feature_mjolnir",null,this.mjolnirChanged),O.b.watchSetting("feature_new_device_manager",null,this.sessionManagerChanged)]}componentWillUnmount(){this.settingsWatchers.forEach((e=>O.b.unwatchSetting(e)))}getTabs(){const e=[];return e.push(new o.a(Ma.a.General,Object(l.c)("General"),"mx_UserSettingsDialog_settingsIcon",r.a.createElement(Pe,{closeSettingsFn:this.props.onFinished}),"UserSettingsGeneral")),e.push(new o.a(Ma.a.Appearance,Object(l.c)("Appearance"),"mx_UserSettingsDialog_appearanceIcon",r.a.createElement(it,null),"UserSettingsAppearance")),e.push(new o.a(Ma.a.Notifications,Object(l.c)("Notifications"),"mx_UserSettingsDialog_bellIcon",r.a.createElement(Da,null),"UserSettingsNotifications")),e.push(new o.a(Ma.a.Preferences,Object(l.c)("Preferences"),"mx_UserSettingsDialog_preferencesIcon",r.a.createElement(La,{closeSettingsFn:this.props.onFinished}),"UserSettingsPreferences")),e.push(new o.a(Ma.a.Keyboard,Object(l.c)("Keyboard"),"mx_UserSettingsDialog_keyboardIcon",r.a.createElement(cn,null),"UserSettingsKeyboard")),e.push(new o.a(Ma.a.Sidebar,Object(l.c)("Sidebar"),"mx_UserSettingsDialog_sidebarIcon",r.a.createElement(an.a,null),"UserSettingsSidebar")),O.b.getValue(z.b.Voip)&&e.push(new o.a(Ma.a.Voice,Object(l.c)("Voice & Video"),"mx_UserSettingsDialog_voiceIcon",r.a.createElement(Ba,null),"UserSettingsVoiceVideo")),e.push(new o.a(Ma.a.Security,Object(l.c)("Security & Privacy"),"mx_UserSettingsDialog_securityIcon",r.a.createElement(la,{closeSettingsFn:this.props.onFinished}),"UserSettingsSecurityPrivacy")),this.state.newSessionManagerEnabled&&e.push(new o.a(Ma.a.SessionManager,Object(l.c)("Sessions"),"mx_UserSettingsDialog_sessionsIcon",r.a.createElement(Oi,null),void 0)),(Me.b.get("show_labs_settings")||O.b.getFeatureSettingNames().some((e=>O.b.getBetaInfo(e))))&&e.push(new o.a(Ma.a.Labs,Object(l.c)("Labs"),"mx_UserSettingsDialog_labsIcon",r.a.createElement(Ve,null),"UserSettingsLabs")),this.state.mjolnirEnabled&&e.push(new o.a(Ma.a.Mjolnir,Object(l.c)("Ignored users"),"mx_UserSettingsDialog_mjolnirIcon",r.a.createElement(tn,null),"UserSettingMjolnir")),e.push(new o.a(Ma.a.Help,Object(l.c)("Help & About"),"mx_UserSettingsDialog_helpIcon",r.a.createElement(Xa,{closeSettingsFn:()=>this.props.onFinished()}),"UserSettingsHelpAbout")),e}render(){return r.a.createElement(M.a,{className:"mx_UserSettingsDialog",hasCancel:!0,onFinished:this.props.onFinished,title:Object(l.a)("Settings")},r.a.createElement("div",{className:"mx_SettingsDialog_content"},r.a.createElement(o.c,{tabs:this.getTabs(),initialTabId:this.props.initialTabId,screenName:"UserSettings"})))}}},1546:function(e,t,a){"use strict";a.d(t,"a",(function(){return G}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(1),l=a(136),c=a(16),d=a(121),m=a(127);class u{constructor(e,t){i()(this,"client",void 0),i()(this,"clientSecret",void 0),i()(this,"password",""),i()(this,"sessionId",""),i()(this,"logoutDevices",!1),i()(this,"sendAttempt",0),this.client=Object(l.createClient)({baseUrl:e,idBaseUrl:t}),this.clientSecret=this.client.generateClientSecret()}async resetPassword(e,t){let a=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.password=t,this.logoutDevices=a,this.sendAttempt++;try{const t=await this.client.requestPasswordEmailToken(e,this.clientSecret,this.sendAttempt);return this.sessionId=t.sid,t}catch(e){throw"M_THREEPID_NOT_FOUND"===e.errcode?e.message=Object(d.a)("This email address was not found"):e.httpStatus&&(e.message=e.message+` (Status ${e.httpStatus})`),e}}requestResetToken(e){return this.sendAttempt++,this.client.requestPasswordEmailToken(e,this.clientSecret,this.sendAttempt).then((e=>(this.sessionId=e.sid,e)),(function(e){throw"M_THREEPID_NOT_FOUND"===e.errcode?e.message=Object(d.a)("This email address was not found"):e.httpStatus&&(e.message=e.message+` (Status ${e.httpStatus})`),e}))}setLogoutDevices(e){this.logoutDevices=e}async setNewPassword(e){this.password=e,await this.checkEmailLinkClicked()}async checkEmailLinkClicked(){const e={sid:this.sessionId,client_secret:this.clientSecret};try{await this.client.setPassword({type:"m.login.email.identity",threepid_creds:e,threepidCreds:e},this.password,this.logoutDevices)}catch(e){throw 401===e.httpStatus?e.message=Object(d.a)("Failed to verify email address: make sure you clicked the link in the email"):404===e.httpStatus?e.message=Object(d.a)("Your email address does not appear to be associated with a Matrix ID on this homeserver."):e.httpStatus&&(e.message+=` (Status ${e.httpStatus})`),e}}}var h,p=a(318),g=a(345),v=a(658),b=a(480),f=a(481),y=a(904),E=a(177);function _(){return _=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},_.apply(this,arguments)}function w(e){return s.createElement("svg",_({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 21.333 26.667",role:"presentation","aria-hidden":!0},e),h||(h=s.createElement("path",{fill:"#8e99a4",fillRule:"evenodd",d:"M9.778 0a7.111 7.111 0 00-7.111 7.111v3.556H2a2 2 0 00-2 2v12a2 2 0 002 2h17.333a2 2 0 002-2v-12a2 2 0 00-2-2h-.666V7.11A7.111 7.111 0 0011.555 0zm5.333 10.667V7.11a3.556 3.556 0 00-3.556-3.555H9.778A3.556 3.556 0 006.222 7.11v3.556z",clipRule:"evenodd"})))}var S,O=a(155);function C(){return C=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},C.apply(this,arguments)}function x(e){return s.createElement("svg",C({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 40 29",role:"presentation","aria-hidden":!0},e),S||(S=s.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M.261 2.576L18.905 21.16a1.64 1.64 0 002.316 0L39.773 2.668C39.92 3.084 40 3.533 40 4v21a4 4 0 01-4 4H4a4 4 0 01-4-4V4c0-.502.092-.982.261-1.424zM2.582.259C3.022.09 3.501 0 4 0h32c.533 0 1.042.104 1.508.294l-17.445 17.39L2.583.26z",fill:"#737D8C"})))}var j=a(479),k=a(394);const R=e=>{let{message:t}=e;const a=t?r.a.createElement(k.Icon,{className:"mx_Icon mx_Icon_16"}):null;return r.a.createElement("div",{className:"mx_ErrorMessage"},a,t)};var I=a(134),T=a(123);const N=e=>{let{email:t,errorText:a,homeserver:n,loading:i,onInputChanged:o,onLoginClick:l,onSubmitForm:c}=e;const m=i?r.a.createElement(I.a,{w:16,h:16}):Object(d.a)("Send email"),u=Object(s.useRef)(null);return r.a.createElement(r.a.Fragment,null,r.a.createElement(x,{className:"mx_AuthBody_icon"}),r.a.createElement("h1",null,Object(d.a)("Enter your email to reset password")),r.a.createElement("p",{className:"mx_AuthBody_text"},Object(d.a)("<b>%(homeserver)s</b> will send you a verification link to let you reset your password.",{homeserver:n},{b:e=>r.a.createElement("b",null,e)})),r.a.createElement("form",{onSubmit:async e=>{var t,a,n;await(null===(t=u.current)||void 0===t?void 0:t.validate({allowEmpty:!1}))?c(e):(null===(a=u.current)||void 0===a||a.focus(),null===(n=u.current)||void 0===n||n.validate({allowEmpty:!1,focused:!0}))}},r.a.createElement("fieldset",{disabled:i},r.a.createElement("div",{className:"mx_AuthBody_fieldRow"},r.a.createElement(j.a,{name:"reset_email",label:"Email address",labelRequired:Object(d.c)("The email address linked to your account must be entered."),labelInvalid:Object(d.c)("The email address doesn't appear to be valid."),value:t,autoFocus:!0,onChange:e=>o("email",e),fieldRef:u})),a&&r.a.createElement(R,{message:a}),r.a.createElement("button",{type:"submit",className:"mx_Login_submit"},m),r.a.createElement("div",{className:"mx_AuthBody_button-container"},r.a.createElement(T.a,{className:"mx_AuthBody_sign-in-instead-button",element:"button",kind:"link",onClick:e=>{e.preventDefault(),l()}},Object(d.a)("Sign in instead"))))))};var P=a(521),D=a(624),M=a(161);const A=(e,t)=>{const a=Object(s.useRef)(),[n,i]=Object(s.useState)(e);return Object(s.useEffect)((()=>()=>{clearTimeout(a.current)})),{toggle:()=>{i(!e),a.current=window.setTimeout((()=>i(e)),t)},value:n}},L=e=>{let{email:t,errorText:a,onReEnterEmailClick:n,onSubmitForm:i,onResendClick:s}=e;const{toggle:o,value:l}=A(!1,2500);return r.a.createElement(r.a.Fragment,null,r.a.createElement(P.a,{className:"mx_AuthBody_emailPromptIcon--shifted"}),r.a.createElement("h1",null,Object(d.a)("Check your email to continue")),r.a.createElement("div",{className:"mx_AuthBody_text"},r.a.createElement("p",null,Object(d.a)("Follow the instructions sent to <b>%(email)s</b>",{email:t},{b:e=>r.a.createElement("b",null,e)})),r.a.createElement("div",{className:"mx_AuthBody_did-not-receive"},r.a.createElement("span",{className:"mx_VerifyEMailDialog_text-light"},Object(d.a)("Wrong email address?")),r.a.createElement(T.a,{className:"mx_AuthBody_resend-button",kind:"link",onClick:n},Object(d.a)("Re-enter email address")))),a&&r.a.createElement(R,{message:a}),r.a.createElement("input",{onClick:i,type:"button",className:"mx_Login_submit",value:Object(d.a)("Next")}),r.a.createElement("div",{className:"mx_AuthBody_did-not-receive"},r.a.createElement("span",{className:"mx_VerifyEMailDialog_text-light"},Object(d.a)("Did not receive it?")),r.a.createElement(T.a,{className:"mx_AuthBody_resend-button",kind:"link",onClick:async()=>{await s(),o()}},r.a.createElement(D.a,{className:"mx_Icon mx_Icon_16"}),Object(d.a)("Resend"),r.a.createElement(M.b,{label:Object(d.a)("Verification link email resent!"),alignment:M.a.Top,visible:l}))))};var U;function F(){return F=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},F.apply(this,arguments)}function B(e){return s.createElement("svg",F({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",role:"presentation","aria-hidden":!0},e),U||(U=s.createElement("path",{d:"M5.092 17.049l6.515 6.709L26.91 8",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round"})))}const V=e=>{let{email:t,errorText:a,onCloseClick:n,onReEnterEmailClick:i,onResendClick:s}=e;const{toggle:o,value:l}=A(!1,2500);return r.a.createElement(r.a.Fragment,null,r.a.createElement(P.a,{className:"mx_AuthBody_emailPromptIcon"}),r.a.createElement("h1",null,Object(d.a)("Verify your email to continue")),r.a.createElement("p",null,Object(d.a)("We need to know it’s you before resetting your password. Click the link in the email we just sent to <b>%(email)s</b>",{email:t},{b:e=>r.a.createElement("b",null,e)})),r.a.createElement("div",{className:"mx_AuthBody_did-not-receive"},r.a.createElement("span",{className:"mx_VerifyEMailDialog_text-light"},Object(d.a)("Did not receive it?")),r.a.createElement(T.a,{className:"mx_AuthBody_resend-button",kind:"link",onClick:async()=>{await s(),o()}},r.a.createElement(D.a,{className:"mx_Icon mx_Icon_16"}),Object(d.a)("Resend"),r.a.createElement(M.b,{label:Object(d.a)("Verification link email resent!"),alignment:M.a.Top,visible:l})),a&&r.a.createElement(R,{message:a})),r.a.createElement("div",{className:"mx_AuthBody_did-not-receive"},r.a.createElement("span",{className:"mx_VerifyEMailDialog_text-light"},Object(d.a)("Wrong email address?")),r.a.createElement(T.a,{className:"mx_AuthBody_resend-button",kind:"link",onClick:i},Object(d.a)("Re-enter email address"))),r.a.createElement(T.a,{onClick:n,className:"mx_Dialog_cancelButton","aria-label":Object(d.a)("Close dialog")}))};var W=a(165),H=a(349);var z;!function(e){e[e.EnterEmail=1]="EnterEmail",e[e.SendingEmail=2]="SendingEmail",e[e.EmailSent=3]="EmailSent",e[e.PasswordInput=4]="PasswordInput",e[e.ResettingPassword=5]="ResettingPassword",e[e.Done=6]="Done"}(z||(z={}));class G extends r.a.Component{constructor(e){super(e),i()(this,"reset",void 0),i()(this,"fieldPassword",null),i()(this,"fieldPasswordConfirm",null),i()(this,"sendVerificationMail",(async()=>{try{return await this.reset.requestResetToken(this.state.email),!0}catch(e){this.handleError(e)}return!1})),i()(this,"onSubmitForm",(async e=>{if(e.preventDefault(),![z.SendingEmail,z.ResettingPassword].includes(this.state.phase)&&(this.setState({errorText:""}),await this.checkServerLiveliness(this.props.serverConfig),this.state.serverIsAlive))switch(this.state.phase){case z.EnterEmail:this.onPhaseEmailInputSubmit();break;case z.EmailSent:this.onPhaseEmailSentSubmit();break;case z.PasswordInput:this.onPhasePasswordInputSubmit()}})),i()(this,"onInputChanged",((e,t)=>{let a=t.currentTarget.value;"email"===e&&(a=a.trim()),this.setState({[e]:a})})),this.state={phase:z.EnterEmail,email:"",password:"",password2:"",errorText:null,serverIsAlive:!0,serverDeadError:"",serverSupportsControlOfDevicesLogout:!1,logoutDevices:!1},this.reset=new u(this.props.serverConfig.hsUrl,this.props.serverConfig.isUrl)}componentDidMount(){this.checkServerCapabilities(this.props.serverConfig)}componentDidUpdate(e){e.serverConfig.hsUrl===this.props.serverConfig.hsUrl&&e.serverConfig.isUrl===this.props.serverConfig.isUrl||(this.checkServerLiveliness(this.props.serverConfig),this.checkServerCapabilities(this.props.serverConfig))}async checkServerLiveliness(e){try{await H.a.validateServerConfigWithStaticUrls(e.hsUrl,e.isUrl),this.setState({serverIsAlive:!0})}catch(e){const{serverIsAlive:t,serverDeadError:a}=H.a.authComponentStateForError(e,"forgot_password");this.setState({serverIsAlive:t,errorText:a})}}async checkServerCapabilities(e){const t=Object(l.createClient)({baseUrl:e.hsUrl}),a=await t.doesServerSupportLogoutDevices();this.setState({logoutDevices:!a,serverSupportsControlOfDevicesLogout:a})}async onPhaseEmailInputSubmit(){this.phase=z.SendingEmail,await this.sendVerificationMail()?this.phase=z.EmailSent:this.phase=z.EnterEmail}handleError(e){if(429!==(null==e?void 0:e.httpStatus))"ConnectionError"!==(null==e?void 0:e.name)?this.setState({errorText:e.message}):this.setState({errorText:Object(d.a)("Cannot reach homeserver")+": "+Object(d.a)("Ensure you have a stable internet connection, or get in touch with the server admin")});else{var t;const a=parseInt(null==e||null===(t=e.data)||void 0===t?void 0:t.retry_after_ms,10),n=isNaN(a)?Object(d.a)("Too many attempts in a short time. Wait some time before trying again."):Object(d.a)("Too many attempts in a short time. Retry after %(timeout)s.",{timeout:Object(W.l)(a/1e3)});this.setState({errorText:n})}}async onPhaseEmailSentSubmit(){this.setState({phase:z.PasswordInput})}set phase(e){this.setState({phase:e})}async verifyFieldsBeforeSubmit(){const e=[this.fieldPassword,this.fieldPasswordConfirm],t=[];for(const a of e){if(!a)continue;await a.validate({allowEmpty:!1})||t.push(a)}return 0===t.length||(t[0].focus(),t[0].validate({allowEmpty:!1,focused:!0}),!1)}async onPhasePasswordInputSubmit(){if(!await this.verifyFieldsBeforeSubmit())return;if(this.state.logoutDevices){if(!await this.renderConfirmLogoutDevicesDialog())return}this.phase=z.ResettingPassword,this.reset.setLogoutDevices(this.state.logoutDevices);try{return await this.reset.setNewPassword(this.state.password),void this.setState({phase:z.Done})}catch(e){if(401!==e.httpStatus)return void this.handleError(e)}const e=m.b.createDialog(V,{email:this.state.email,errorText:this.state.errorText,onCloseClick:()=>{e.close(),this.setState({phase:z.PasswordInput})},onReEnterEmailClick:()=>{e.close(),this.setState({phase:z.EnterEmail})},onResendClick:this.sendVerificationMail},"mx_VerifyEMailDialog",!1,!1,{onBeforeClose:async e=>("backgroundClick"===e&&this.setState({phase:z.PasswordInput}),!0)});for(;this.state.phase===z.ResettingPassword;)try{await this.reset.setNewPassword(this.state.password),this.setState({phase:z.Done}),e.close()}catch(e){await Object(c.N)(2e3)}}renderEnterEmail(){return r.a.createElement(N,{email:this.state.email,errorText:this.state.errorText,homeserver:this.props.serverConfig.hsName,loading:this.state.phase===z.SendingEmail,onInputChanged:this.onInputChanged,onLoginClick:this.props.onLoginClick,onSubmitForm:this.onSubmitForm})}async renderConfirmLogoutDevicesDialog(){const{finished:e}=m.b.createDialog(O.a,{title:Object(d.a)("Warning!"),description:r.a.createElement("div",null,r.a.createElement("p",null,this.state.serverSupportsControlOfDevicesLogout?Object(d.a)("Signing out your devices will delete the message encryption keys stored on them, making encrypted chat history unreadable."):Object(d.a)("Resetting your password on this homeserver will cause all of your devices to be signed out. This will delete the message encryption keys stored on them, making encrypted chat history unreadable.")),r.a.createElement("p",null,Object(d.a)("If you want to retain access to your chat history in encrypted rooms, set up Key Backup or export your message keys from one of your other devices before proceeding."))),button:Object(d.a)("Continue")}),[t]=await e;return t}renderCheckEmail(){return r.a.createElement(L,{email:this.state.email,errorText:this.state.errorText,onReEnterEmailClick:()=>this.setState({phase:z.EnterEmail}),onResendClick:this.sendVerificationMail,onSubmitForm:this.onSubmitForm})}renderSetPassword(){const e=this.state.phase===z.ResettingPassword?r.a.createElement(I.a,{w:16,h:16}):Object(d.a)("Reset password");return r.a.createElement(r.a.Fragment,null,r.a.createElement(w,{className:"mx_AuthBody_lockIcon"}),r.a.createElement("h1",null,Object(d.a)("Reset your password")),r.a.createElement("form",{onSubmit:this.onSubmitForm},r.a.createElement("fieldset",{disabled:this.state.phase===z.ResettingPassword},r.a.createElement("div",{className:"mx_AuthBody_fieldRow"},r.a.createElement(g.a,{name:"reset_password",type:"password",label:Object(d.c)("New Password"),value:this.state.password,minScore:v.a,fieldRef:e=>this.fieldPassword=e,onChange:this.onInputChanged.bind(this,"password"),autoComplete:"new-password"}),r.a.createElement(y.a,{name:"reset_password_confirm",label:Object(d.c)("Confirm new password"),labelRequired:Object(d.c)("A new password must be entered."),labelInvalid:Object(d.c)("New passwords must match each other."),value:this.state.password2,password:this.state.password,fieldRef:e=>this.fieldPasswordConfirm=e,onChange:this.onInputChanged.bind(this,"password2"),autoComplete:"new-password"})),this.state.serverSupportsControlOfDevicesLogout?r.a.createElement("div",{className:"mx_AuthBody_fieldRow"},r.a.createElement(E.b,{onChange:()=>this.setState({logoutDevices:!this.state.logoutDevices}),checked:this.state.logoutDevices},Object(d.a)("Sign out of all devices"))):null,this.state.errorText&&r.a.createElement(R,{message:this.state.errorText}),r.a.createElement("button",{type:"submit",className:"mx_Login_submit"},e))))}renderDone(){return r.a.createElement(r.a.Fragment,null,r.a.createElement(B,{className:"mx_Icon mx_Icon_32 mx_Icon_accent"}),r.a.createElement("h1",null,Object(d.a)("Your password has been reset.")),this.state.logoutDevices?r.a.createElement("p",null,Object(d.a)("You have been logged out of all devices and will no longer receive push notifications. To re-enable notifications, sign in again on each device.")):null,r.a.createElement("input",{className:"mx_Login_submit",type:"button",onClick:this.props.onComplete,value:Object(d.a)("Return to login screen")}))}render(){let e;switch(this.state.phase){case z.EnterEmail:case z.SendingEmail:e=this.renderEnterEmail();break;case z.EmailSent:e=this.renderCheckEmail();break;case z.PasswordInput:case z.ResettingPassword:e=this.renderSetPassword();break;case z.Done:e=this.renderDone();break;default:return o.a.warn(`unknown forgot password phase ${this.state.phase}`),void this.setState({phase:z.EnterEmail})}return r.a.createElement(p.a,null,r.a.createElement(b.a,null),r.a.createElement(f.a,{className:"mx_AuthBody_forgot-password"},e))}}},1547:function(e,t,a){"use strict";a.d(t,"a",(function(){return We}));var n=a(13),i=a.n(n),s=a(126),r=a.n(s),o=a(124),l=a(127),c=a(404),d=a(132),m=a.n(d),u=a(120),h=a.n(u),p=a(143),g=a(129),v=a(30),b=a(269),f=a(204),y=a(121),E=a(167),_=a(194),w=a(135),S=a(259),O=a(346),C=a(334),x=a(317),j=a(161),k=a(148),R=a(212),I=a(331),T=a(246),N=a(435),P=a(301),D=a(558),M=a(625),A=a(191),L=a(128),U=a(180),F=a(230),B=a(657);const V=["m.relates_to"];function W(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function H(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?W(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):W(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}var z;!function(e){e[e.CanSend=0]="CanSend",e[e.Sending=1]="Sending",e[e.Sent=2]="Sent",e[e.Failed=3]="Failed"}(z||(z={}));const G=e=>{let{room:t,type:a,content:n,matrixClient:i,onFinished:s}=e;const[r,l]=Object(u.useState)(z.CanSend);let c,d,m,p=!1;return r===z.CanSend?(c="mx_ForwardList_canSend",t.maySendMessage()||(p=!0,d=Object(y.a)("You don't have permission to do this"))):r===z.Sending?(c="mx_ForwardList_sending",p=!0,d=Object(y.a)("Sending"),m=h.a.createElement("div",{className:"mx_ForwardList_sendIcon","aria-label":d})):r===z.Sent?(c="mx_ForwardList_sent",p=!0,d=Object(y.a)("Sent"),m=h.a.createElement("div",{className:"mx_ForwardList_sendIcon","aria-label":d})):(c="mx_ForwardList_sendFailed",p=!0,d=Object(y.a)("Failed to send"),m=h.a.createElement(T.a,{notification:I.a.RED_EXCLAMATION})),h.a.createElement("div",{className:"mx_ForwardList_entry"},h.a.createElement(k.a,{className:"mx_ForwardList_roomButton",onClick:e=>{o.a.dispatch({action:L.a.ViewRoom,room_id:t.roomId,metricsTrigger:"WebForwardShortcut",metricsViaKeyboard:"click"!==e.type}),s(!0)},title:Object(y.a)("Open room"),alignment:j.a.Top},h.a.createElement(x.a,{room:t,avatarSize:32}),h.a.createElement("span",{className:"mx_ForwardList_entry_name"},t.name),h.a.createElement(B.a,{component:"span",className:"mx_ForwardList_entry_detail",room:t})),h.a.createElement(k.a,{kind:r===z.Failed?"danger_outline":"primary_outline",className:`mx_ForwardList_sendButton ${c}`,onClick:async()=>{l(z.Sending);try{await i.sendEvent(t.roomId,a,n),l(z.Sent)}catch(e){l(z.Failed)}},disabled:p,title:d,alignment:j.a.Top},h.a.createElement("div",{className:"mx_ForwardList_sendLabel"},Object(y.a)("Send")),m))};var K=e=>{let{matrixClient:t,event:n,permalinkCreator:i,onFinished:s}=e;const o=t.getUserId(),[l,c]=Object(u.useState)({});Object(u.useEffect)((()=>{t.getProfileInfo(o).then((e=>c(e)))}),[t,o]);const{type:d,content:x}=(e=>{const t=e.getContent(),{"m.relates_to":a}=t,n=m()(t,V),i=f.a.matches(e.getType())?g.b.RoomMessage:e.getType();if(Object(U.l)(e)&&Object(F.f)(n)||f.a.matches(e.getType())){const t=v.d.findIn(n),a=Object(F.g)(e);return{type:i,content:H(H({},n),Object(b.makeLocationContent)(void 0,a,t||Date.now(),void 0,v.a.Pin))}}return{type:i,content:n}})(n),j=new p.b({type:"m.room.message",sender:o,content:x,unsigned:{age:97},event_id:"$9999999999999999999999999999999999999999999",room_id:n.getRoomId()});j.sender={name:l.displayname||o,rawDisplayName:l.displayname,userId:o,getAvatarUrl:function(){return Object(S.c)({avatarUrl:l.avatar_url},30,30,"crop")},getMxcAvatarUrl:()=>l.avatar_url};const[k,I]=Object(u.useState)(""),T=k.toLowerCase(),L=Object(E.b)("layout");let B=Object(u.useMemo)((()=>Object(N.b)(t.getVisibleRooms().filter((e=>"join"===e.getMyMembership()&&!e.isSpaceRoom())))),[t]);T&&(B=new P.a(B,{keys:["name"],funcs:[e=>[e.getCanonicalAlias(),...e.getAltAliases()].filter(Boolean)],shouldMatchWordsOnly:!1}).match(T));const[W,z]=Object(u.useState)(20);return h.a.createElement(w.a,{title:Object(y.a)("Forward message"),className:"mx_ForwardDialog",contentId:"mx_ForwardList",onFinished:s,fixedWidth:!1},h.a.createElement("h3",null,Object(y.a)("Message preview")),h.a.createElement("div",{className:r()("mx_ForwardDialog_preview",{mx_IRCLayout:L==_.a.IRC})},h.a.createElement(O.b,{mxEvent:j,layout:L,permalinkCreator:i,as:"div"})),h.a.createElement("hr",null),h.a.createElement("div",{className:"mx_ForwardList",id:"mx_ForwardList"},h.a.createElement(C.a,{className:"mx_textinput_icon mx_textinput_search",placeholder:Object(y.a)("Search for rooms or people"),onSearch:I,autoFocus:!0}),h.a.createElement(R.a,{className:"mx_ForwardList_content"},B.length>0?h.a.createElement("div",{className:"mx_ForwardList_results"},h.a.createElement(D.a,{className:"mx_ForwardList_resultsList",truncateAt:W,createOverflowElement:function(e,t){const n=Object(y.a)("and %(count)s others...",{count:e});return h.a.createElement(M.b,{className:"mx_EntityTile_ellipsis",avatarJsx:h.a.createElement(A.a,{url:a(875).default,name:"...",width:36,height:36}),name:n,presenceState:"online",suppressOnHover:!0,onClick:()=>z(t)})},getChildren:(e,a)=>B.slice(e,a).map((e=>h.a.createElement(G,{key:e.roomId,room:e,type:d,content:x,matrixClient:t,onFinished:s}))),getChildCount:()=>B.length})):h.a.createElement("span",{className:"mx_ForwardList_noResults"},Object(y.a)("No results")))))},q=a(122),$=a(1),Y=a(219),J=a(131),Q=a(932),X=a(125),Z=a(258),ee=a(145),te=a(139),ae=a(134),ne=a(876);const ie=["org.matrix.msc3215.room.moderation.moderated_by"];var se,re;!function(e){e.Disagreement="org.matrix.msc3215.abuse.nature.disagreement",e.Toxic="org.matrix.msc3215.abuse.nature.toxic",e.Illegal="org.matrix.msc3215.abuse.nature.illegal",e.Spam="org.matrix.msc3215.abuse.nature.spam",e.Other="org.matrix.msc3215.abuse.nature.other"}(se||(se={})),function(e){e.Admin="non-standard.abuse.nature.admin"}(re||(re={}));class oe extends h.a.Component{constructor(e){super(e),i()(this,"moderation",void 0),i()(this,"onIgnoreUserTooChanged",(e=>{this.setState({ignoreUserToo:e})})),i()(this,"onReasonChange",(e=>{let{target:{value:t}}=e;this.setState({reason:t})})),i()(this,"onNatureChosen",(e=>{this.setState({nature:e.currentTarget.value})})),i()(this,"onCancel",(()=>{this.props.onFinished(!1)})),i()(this,"onSubmit",(async()=>{let e=this.state.reason||"";if(e=e.trim(),this.moderation){if(!this.state.nature||(this.state.nature==se.Other||this.state.nature==re.Admin)&&!e)return void this.setState({err:Object(y.a)("Please fill why you're reporting.")})}else if(!e)return void this.setState({err:Object(y.a)("Please fill why you're reporting.")});this.setState({busy:!0,err:null});try{const e=q.a.get(),t=this.props.mxEvent;if(this.moderation&&this.state.nature!==re.Admin){const a=this.state.nature,n=await Object(Y.c)(e,this.moderation.moderationBotUserId);await e.sendEvent(n,"org.matrix.msc3215.abuse.report",{event_id:t.getId(),room_id:t.getRoomId(),moderated_by_id:this.moderation.moderationRoomId,nature:a,reporter:e.getUserId(),comment:this.state.reason.trim()})}else await e.reportEvent(t.getRoomId(),t.getId(),-100,this.state.reason.trim());this.state.ignoreUserToo&&await e.setIgnoredUsers([...e.getIgnoredUsers(),t.getSender()]),this.props.onFinished(!0)}catch(e){$.a.error(e),this.setState({busy:!1,err:e.message})}}));let t=null,a=null;if(X.b.getValue("feature_report_to_moderators")){const n=q.a.get().getRoom(e.mxEvent.getRoomId());for(const e of ie){const i=n.currentState.getStateEvents(e,e);if(!i)continue;if(Array.isArray(i))throw new TypeError(`getStateEvents(${e}, ${e}) should return at most one state event`);const s=i.event;if(!("content"in s)||"object"!=typeof s.content){console.debug("Moderation error","state event",e,"should have an object field `content`, got",s);continue}const r=s.content;"room_id"in r&&"string"==typeof r.room_id?"user_id"in r&&"string"==typeof r.user_id?(t=r.room_id,a=r.user_id):console.debug("Moderation error","state event",e,"should have a string field `content.user_id`, got",s):console.debug("Moderation error","state event",e,"should have a string field `content.room_id`, got",s)}t&&a&&(this.moderation={moderationRoomId:t,moderationBotUserId:a})}this.state={reason:"",busy:!1,err:null,nature:null,ignoreUserToo:!1}}render(){var e;let t=null;this.state.err&&(t=h.a.createElement("div",{className:"error"},this.state.err));let a=null;this.state.busy&&(a=h.a.createElement("div",{className:"progress"},h.a.createElement(ae.a,null)));const n=h.a.createElement(ne.a,{value:this.state.ignoreUserToo,label:Object(y.a)("Ignore user"),byline:Object(y.a)("Check if you want to hide all current and future messages from this user."),onChange:this.onIgnoreUserTooChanged,disabled:this.state.busy}),i=null===(e=J.b.getObject("report_event"))||void 0===e?void 0:e.get("admin_message_md","adminMessageMD");let s;if(i){const e=new Q.a(i).toHTML({externalLinks:!0});s=h.a.createElement("p",{dangerouslySetInnerHTML:{__html:e}})}if(this.moderation){const e=q.a.get(),i=J.b.get("validated_server_config").hsName;let s;switch(this.state.nature){case se.Disagreement:s=Object(y.a)("What this user is writing is wrong.\nThis will be reported to the room moderators.");break;case se.Toxic:s=Object(y.a)("This user is displaying toxic behaviour, for instance by insulting other users or sharing adult-only content in a family-friendly room or otherwise violating the rules of this room.\nThis will be reported to the room moderators.");break;case se.Illegal:s=Object(y.a)("This user is displaying illegal behaviour, for instance by doxing people or threatening violence.\nThis will be reported to the room moderators who may escalate this to legal authorities.");break;case se.Spam:s=Object(y.a)("This user is spamming the room with ads, links to ads or to propaganda.\nThis will be reported to the room moderators.");break;case re.Admin:s=e.isRoomEncrypted(this.props.mxEvent.getRoomId())?Object(y.a)("This room is dedicated to illegal or toxic content or the moderators fail to moderate illegal or toxic content.\nThis will be reported to the administrators of %(homeserver)s. The administrators will NOT be able to read the encrypted content of this room.",{homeserver:i}):Object(y.a)("This room is dedicated to illegal or toxic content or the moderators fail to moderate illegal or toxic content.\nThis will be reported to the administrators of %(homeserver)s.",{homeserver:i});break;case se.Other:s=Object(y.a)("Any other reason. Please describe the problem.\nThis will be reported to the room moderators.");break;default:s=Object(y.a)("Please pick a nature and describe what makes this message abusive.")}return h.a.createElement(w.a,{className:"mx_ReportEventDialog",onFinished:this.props.onFinished,title:Object(y.a)("Report Content"),contentId:"mx_ReportEventDialog"},h.a.createElement("div",null,h.a.createElement(Z.a,{name:"nature",value:se.Disagreement,checked:this.state.nature==se.Disagreement,onChange:this.onNatureChosen},Object(y.a)("Disagree")),h.a.createElement(Z.a,{name:"nature",value:se.Toxic,checked:this.state.nature==se.Toxic,onChange:this.onNatureChosen},Object(y.a)("Toxic Behaviour")),h.a.createElement(Z.a,{name:"nature",value:se.Illegal,checked:this.state.nature==se.Illegal,onChange:this.onNatureChosen},Object(y.a)("Illegal Content")),h.a.createElement(Z.a,{name:"nature",value:se.Spam,checked:this.state.nature==se.Spam,onChange:this.onNatureChosen},Object(y.a)("Spam or propaganda")),h.a.createElement(Z.a,{name:"nature",value:re.Admin,checked:this.state.nature==re.Admin,onChange:this.onNatureChosen},Object(y.a)("Report the entire room")),h.a.createElement(Z.a,{name:"nature",value:se.Other,checked:this.state.nature==se.Other,onChange:this.onNatureChosen},Object(y.a)("Other")),h.a.createElement("p",null,s),h.a.createElement(te.a,{className:"mx_ReportEventDialog_reason",element:"textarea",label:Object(y.a)("Reason"),rows:5,onChange:this.onReasonChange,value:this.state.reason,disabled:this.state.busy}),a,t,n),h.a.createElement(ee.a,{primaryButton:Object(y.a)("Send report"),onPrimaryButtonClick:this.onSubmit,focus:!0,onCancel:this.onCancel,disabled:this.state.busy}))}return h.a.createElement(w.a,{className:"mx_ReportEventDialog",onFinished:this.props.onFinished,title:Object(y.a)("Report Content to Your Homeserver Administrator"),contentId:"mx_ReportEventDialog"},h.a.createElement("div",{className:"mx_ReportEventDialog",id:"mx_ReportEventDialog"},h.a.createElement("p",null,Object(y.a)("Reporting this message will send its unique 'event ID' to the administrator of your homeserver. If messages in this room are encrypted, your homeserver administrator will not be able to read the message text or view any files or images.")),s,h.a.createElement(te.a,{className:"mx_ReportEventDialog_reason",element:"textarea",label:Object(y.a)("Reason"),rows:5,onChange:this.onReasonChange,value:this.state.reason,disabled:this.state.busy}),a,t,n),h.a.createElement(ee.a,{primaryButton:Object(y.a)("Send report"),onPrimaryButtonClick:this.onSubmit,focus:!0,onCancel:this.onCancel,disabled:this.state.busy}))}}var le=a(333),ce=a(177),de=a(137),me=a(282);let ue;!function(e){e.Appearance="SPACE_PREFERENCE_APPEARANCE_TAB"}(ue||(ue={}));const he=e=>{let{space:t}=e;const a=Object(E.b)("Spaces.showPeopleInSpace",t.roomId);return h.a.createElement("div",{className:"mx_SettingsTab"},h.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(y.a)("Sections to show")),h.a.createElement("div",{className:"mx_SettingsTab_section"},h.a.createElement(ce.b,{checked:!!a,onChange:e=>{X.b.setValue("Spaces.showPeopleInSpace",t.roomId,de.a.ROOM_ACCOUNT,!a)}},Object(y.a)("People")),h.a.createElement("p",null,Object(y.a)("This groups your chats with members of this space. Turning this off will hide those chats from your view of %(spaceName)s.",{spaceName:t.name}))))};var pe=e=>{let{space:t,initialTabId:a,onFinished:n}=e;const i=[new le.a(ue.Appearance,Object(y.c)("Appearance"),"mx_SpacePreferencesDialog_appearanceIcon",h.a.createElement(he,{space:t}))];return h.a.createElement(w.a,{className:"mx_SpacePreferencesDialog",hasCancel:!0,onFinished:n,title:Object(y.a)("Preferences"),fixedWidth:!1},h.a.createElement("h4",null,h.a.createElement(me.a,{room:t})),h.a.createElement("div",{className:"mx_SettingsDialog_content"},h.a.createElement(le.c,{tabs:i,initialTabId:a})))},ge=a(237),ve=a(123),be=a(805),fe=a(381),ye=a(496),Ee=a(626);var _e=e=>{var t,a,n;let{matrixClient:i,space:s}=e;const[r,o]=Object(u.useState)(!1),[l,c]=Object(u.useState)(""),d=i.getUserId(),[m,p]=Object(u.useState)(null),v=s.currentState.maySendStateEvent(g.b.RoomAvatar,d),b=null!==m,[f,E]=Object(u.useState)(s.name),_=s.currentState.maySendStateEvent(g.b.RoomName,d),w=f!==s.name,O=null!==(t=null===(a=Object(Ee.a)(s))||void 0===a?void 0:a.text)&&void 0!==t?t:"",[C,x]=Object(u.useState)(O),j=s.currentState.maySendStateEvent(g.b.RoomTopic,d),k=C!==O;return h.a.createElement("div",{className:"mx_SettingsTab"},h.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(y.a)("General")),h.a.createElement("div",null,Object(y.a)("Edit settings relating to your space.")),l&&h.a.createElement("div",{className:"mx_SpaceRoomView_errorText"},l),h.a.createElement("div",{className:"mx_SettingsTab_section"},h.a.createElement(be.b,{avatarUrl:null!==(n=Object(S.b)(s,80,80,"crop"))&&void 0!==n?n:void 0,avatarDisabled:r||!v,setAvatar:p,name:f,nameDisabled:r||!_,setName:E,topic:C,topicDisabled:r||!j,setTopic:x}),h.a.createElement(ve.a,{onClick:()=>{p(null),E(s.name),x(O)},disabled:r||!(b||w||k),kind:"link"},Object(y.a)("Cancel")),h.a.createElement(ve.a,{onClick:async()=>{o(!0);const e=[];if(b&&(m?e.push((async()=>{const{content_uri:e}=await i.uploadContent(m);await i.sendStateEvent(s.roomId,g.b.RoomAvatar,{url:e},"")})()):e.push(i.sendStateEvent(s.roomId,g.b.RoomAvatar,{},""))),w&&e.push(i.setRoomName(s.roomId,f)),k){const t=Object(fe.b)(C,{forceHTML:!1});e.push(i.setRoomTopic(s.roomId,C,t))}const t=await Promise.allSettled(e);o(!1);const a=t.filter((e=>"rejected"===e.status));a.length>0&&($.a.error("Failed to save space settings: ",a),c(Object(y.a)("Failed to save space settings.")))},disabled:r,kind:"primary"},r?Object(y.a)("Saving…"):Object(y.a)("Save Changes"))),h.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(y.a)("Leave Space")),h.a.createElement("div",{className:"mx_SettingsTab_section mx_SettingsTab_subsectionText"},h.a.createElement(ve.a,{kind:"danger",onClick:()=>{Object(ye.b)(s)}},Object(y.a)("Leave Space"))))},we=a(160),Se=a(923),Oe=a(397),Ce=a(235),xe=a(850),je=a(937),ke=a(309),Re=a(341),Ie=a(248);var Te=e=>{let{matrixClient:t,space:a,closeSettingsFn:n}=e;const[i,s]=Object(u.useState)(""),r=Object(Ie.a)((async()=>t.doesServerSupportUnstableFeature("org.matrix.msc3827.stable")),[t],!1),o=t.getUserId(),l=Object(ke.a)(a,(e=>e.getJoinRule())),[c,d]=Object(xe.a)((()=>{var e,t;return(null===(e=a.currentState.getStateEvents(g.b.RoomGuestAccess,""))||void 0===e||null===(t=e.getContent())||void 0===t?void 0:t.guest_access)===we.a.CanJoin}),(e=>t.sendStateEvent(a.roomId,g.b.RoomGuestAccess,{guest_access:e?we.a.CanJoin:we.a.Forbidden},"")),(()=>s(Object(y.a)("Failed to update the guest access of this space")))),[m,p]=Object(xe.a)((()=>{var e,t;return(null===(e=a.currentState.getStateEvents(g.b.RoomHistoryVisibility,""))||void 0===e||null===(t=e.getContent())||void 0===t?void 0:t.history_visibility)||we.b.Shared}),(e=>t.sendStateEvent(a.roomId,g.b.RoomHistoryVisibility,{history_visibility:e},"")),(()=>s(Object(y.a)("Failed to update the history visibility of this space")))),[v,b]=Object(Oe.a)(),f=a.currentState.maySendStateEvent(g.b.RoomGuestAccess,o),E=a.currentState.maySendStateEvent(g.b.RoomHistoryVisibility,o),_=a.currentState.mayClientSendStateEvent(g.b.RoomCanonicalAlias,t),w=a.currentState.getStateEvents(g.b.RoomCanonicalAlias,"");let S,O;return l===we.c.Public&&(S=h.a.createElement("div",null,h.a.createElement(ve.a,{"data-testid":"toggle-guest-access-btn",onClick:b,kind:"link",className:"mx_SettingsTab_showAdvanced"},v?Object(y.a)("Hide advanced"):Object(y.a)("Show advanced")),v&&h.a.createElement("div",{className:"mx_SettingsTab_toggleWithDescription"},h.a.createElement(Ce.a,{value:c,onChange:d,disabled:!f,label:Object(y.a)("Enable guest access")}),h.a.createElement("p",null,Object(y.a)("Guests can join a space without having an account."),h.a.createElement("br",null),Object(y.a)("This may be useful for public spaces."))))),a.getJoinRule()===we.c.Public&&(O=h.a.createElement(h.a.Fragment,null,h.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(y.a)("Address")),h.a.createElement(Se.a,{roomId:a.roomId,canSetCanonicalAlias:_,canSetAliases:!0,canonicalAliasEvent:null!=w?w:void 0,hidePublishSetting:!r}))),h.a.createElement("div",{className:"mx_SettingsTab"},h.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(y.a)("Visibility")),i&&h.a.createElement("div",{"data-testid":"space-settings-error",className:"mx_SpaceRoomView_errorText"},i),h.a.createElement(Re.a,{"data-testid":"access-fieldset",legend:Object(y.a)("Access"),description:Object(y.a)("Decide who can view and join %(spaceName)s.",{spaceName:a.name})},h.a.createElement(je.a,{room:a,onError:()=>s(Object(y.a)("Failed to update the visibility of this space")),closeSettingsFn:n}),S,h.a.createElement("div",{className:"mx_SettingsTab_toggleWithDescription"},h.a.createElement(Ce.a,{value:m===we.b.WorldReadable,onChange:e=>{p(e?we.b.WorldReadable:we.b.Shared)},disabled:!E,label:Object(y.a)("Preview Space")}),h.a.createElement("p",null,Object(y.a)("Allow people to preview your space before they join."),h.a.createElement("br",null),h.a.createElement("b",null,Object(y.a)("Recommended for public spaces."))))),O)},Ne=a(156),Pe=a(847),De=a(921);let Me;!function(e){e.General="SPACE_GENERAL_TAB",e.Visibility="SPACE_VISIBILITY_TAB",e.Roles="SPACE_ROLES_TAB",e.Advanced="SPACE_ADVANCED_TAB"}(Me||(Me={}));var Ae=e=>{let{matrixClient:t,space:a,onFinished:n}=e;Object(ge.a)(o.a,(e=>{e.action===L.a.AfterLeaveRoom&&e.room_id===a.roomId&&n()}));const i=Object(u.useMemo)((()=>[new le.a(Me.General,Object(y.c)("General"),"mx_SpaceSettingsDialog_generalIcon",h.a.createElement(_e,{matrixClient:t,space:a})),new le.a(Me.Visibility,Object(y.c)("Visibility"),"mx_SpaceSettingsDialog_visibilityIcon",h.a.createElement(Te,{matrixClient:t,space:a,closeSettingsFn:n})),new le.a(Me.Roles,Object(y.c)("Roles & Permissions"),"mx_RoomSettingsDialog_rolesIcon",h.a.createElement(De.a,{roomId:a.roomId})),X.b.getValue(Ne.b.AdvancedSettings)?new le.a(Me.Advanced,Object(y.c)("Advanced"),"mx_RoomSettingsDialog_warningIcon",h.a.createElement(Pe.a,{roomId:a.roomId,closeSettingsFn:n})):null].filter(Boolean)),[t,a,n]);return h.a.createElement(w.a,{title:Object(y.a)("Settings - %(spaceName)s",{spaceName:a.name||Object(y.a)("Unnamed Space")}),className:"mx_SpaceSettingsDialog",contentId:"mx_SpaceSettingsDialog",onFinished:n,fixedWidth:!1},h.a.createElement("div",{className:"mx_SpaceSettingsDialog_content",id:"mx_SpaceSettingsDialog"},h.a.createElement(le.c,{tabs:i})))},Le=a(929),Ue=a(393),Fe=a(159),Be=a(249),Ve=a(154);class We{constructor(){i()(this,"isRegistered",!1),i()(this,"onDispatch",(e=>{switch(e.action){case"open_room_settings":l.b.createDialog(c.c,{roomId:e.room_id||Ve.b.instance.roomViewStore.getRoomId(),initialTabId:e.initial_tab_id},void 0,!1,!0);break;case L.a.OpenForwardDialog:l.b.createDialog(K,{matrixClient:q.a.get(),event:e.event,permalinkCreator:e.permalinkCreator});break;case L.a.OpenReportEventDialog:l.b.createDialog(oe,{mxEvent:e.event},"mx_Dialog_reportEvent");break;case L.a.OpenSpacePreferences:l.b.createDialog(pe,{initialTabId:e.initalTabId,space:e.space},void 0,!1,!0);break;case L.a.OpenSpaceSettings:l.b.createDialog(Ae,{matrixClient:e.space.client,space:e.space},void 0,!1,!0);break;case L.a.OpenInviteDialog:l.b.createDialog(Le.a,{kind:e.kind,call:e.call,roomId:e.roomId},r()("mx_InviteDialog_flexWrapper",e.className),!1,!0).finished.then((t=>{var a;null===(a=e.onFinishedCallback)||void 0===a||a.call(e,t)}));break;case L.a.OpenAddToExistingSpaceDialog:{const t=e.space;l.b.createDialog(Ue.d,{onCreateRoomClick:e=>{Object(Be.g)(t),Fe.b.trackInteraction("WebAddExistingToSpaceDialogCreateRoomButton",e)},onAddSubspaceClick:()=>Object(Be.f)(t),space:t,onFinished:e=>{e&&Ve.b.instance.roomViewStore.getRoomId()===t.roomId&&o.a.fire(L.a.UpdateSpaceHierarchy)}},"mx_AddExistingToSpaceDialog_wrapper");break}}}))}prepare(){this.isRegistered||(o.a.register(this.onDispatch),this.isRegistered=!0)}}i()(We,"instance",new We)},1549:function(e,t,a){"use strict";a.d(t,"a",(function(){return $}));var n=a(13),i=a.n(n),s=a(1),r=a(174),o=a(136),l=a(122),c=a(124),d=a(121),m=a(236),u=a(198),h=a(128);const p="mx_snooze_bulk_unverified_device_nag",g="reviewsessions",v=e=>{u.a.sharedInstance().addOrReplaceToast({key:g,title:Object(d.a)("You have unverified sessions"),icon:"verification_warning",props:{description:Object(d.a)("Review to ensure your account is safe"),acceptLabel:Object(d.a)("Review"),onAccept:()=>{$.sharedInstance().dismissUnverifiedSessions(e),c.a.dispatch({action:h.a.ViewUserDeviceSettings})},rejectLabel:Object(d.a)("Later"),onReject:()=>{$.sharedInstance().dismissUnverifiedSessions(e),(()=>{try{localStorage.setItem(p,String(Date.now()))}catch(e){s.a.error("Failed to persist bulk unverified device nag snooze",e)}})()}},component:m.a,priority:50})};var b=a(127),f=a(399),y=a(250),E=a(292),_=a(134);const w="setupencryption",S=e=>{switch(e){case j.SET_UP_ENCRYPTION:return Object(d.a)("Set up Secure Backup");case j.UPGRADE_ENCRYPTION:return Object(d.a)("Encryption upgrade available");case j.VERIFY_THIS_SESSION:return Object(d.a)("Verify this session")}},O=e=>{switch(e){case j.SET_UP_ENCRYPTION:case j.UPGRADE_ENCRYPTION:return"secure_backup";case j.VERIFY_THIS_SESSION:return"verification_warning"}},C=e=>{switch(e){case j.SET_UP_ENCRYPTION:return Object(d.a)("Continue");case j.UPGRADE_ENCRYPTION:return Object(d.a)("Upgrade");case j.VERIFY_THIS_SESSION:return Object(d.a)("Verify")}},x=e=>{switch(e){case j.SET_UP_ENCRYPTION:case j.UPGRADE_ENCRYPTION:return Object(d.a)("Safeguard against losing access to encrypted messages & data");case j.VERIFY_THIS_SESSION:return Object(d.a)("Other users may not trust it")}};let j;!function(e){e.SET_UP_ENCRYPTION="set_up_encryption",e.UPGRADE_ENCRYPTION="upgrade_encryption",e.VERIFY_THIS_SESSION="verify_this_session"}(j||(j={}));const k=()=>{$.sharedInstance().dismissEncryptionSetup()},R=e=>{var t;if(null!==(t=E.a.setupEncryptionNeeded)&&void 0!==t&&t.call(E.a,e))return;u.a.sharedInstance().addOrReplaceToast({key:w,title:S(e),icon:O(e),props:{description:x(e),acceptLabel:C(e),onAccept:async()=>{if(e===j.VERIFY_THIS_SESSION)b.b.createDialog(f.a,{},void 0,!1,!0);else{const e=b.b.createDialog(_.a,void 0,"mx_Dialog_spinner",!1,!0);try{await Object(y.b)()}finally{e.close()}}},rejectLabel:Object(d.a)("Later"),onReject:k},component:m.a,priority:e===j.VERIFY_THIS_SESSION?95:40})},I=()=>{u.a.sharedInstance().dismissToast(w)};var T=a(120),N=a.n(T),P=a(864),D=a(474),M=a(865);function A(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function L(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?A(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):A(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function U(e){return"unverified_session_"+e}const F=async e=>{const t=l.a.get(),a=await t.getDevice(e),n=L(L({},a),{},{isVerified:Object(P.a)(a,t),deviceType:D.a.Unknown});u.a.sharedInstance().addOrReplaceToast({key:U(e),title:Object(d.a)("New login. Was this you?"),icon:"verification_warning",props:{description:a.display_name,detail:N.a.createElement(M.a,{device:n}),acceptLabel:Object(d.a)("Yes, it was me"),onAccept:()=>{$.sharedInstance().dismissUnverifiedSessions([e])},rejectLabel:Object(d.a)("No"),onReject:()=>{$.sharedInstance().dismissUnverifiedSessions([e]),c.a.dispatch({action:h.a.ViewUserDeviceSettings})}},component:m.a,priority:80})},B=e=>{u.a.sharedInstance().dismissToast(U(e))};var V=a(241),W=a(362);var H=a(131),z=a(157),G=a(867),K=a(125),q=a(156);class ${constructor(){i()(this,"dispatcherRef",void 0),i()(this,"dismissed",new Set),i()(this,"dismissedThisDeviceToast",!1),i()(this,"keyBackupInfo",null),i()(this,"keyBackupFetchedAt",null),i()(this,"keyBackupStatusChecked",!1),i()(this,"ourDeviceIdsAtStart",null),i()(this,"displayingToastsForDeviceIds",new Set),i()(this,"running",!1),i()(this,"shouldRecordClientInformation",!1),i()(this,"enableBulkUnverifiedSessionsReminder",!0),i()(this,"deviceClientInformationSettingWatcherRef",void 0),i()(this,"onWillUpdateDevices",(async(e,t)=>{if(t)return;const a=l.a.get().getUserId();e.includes(a)&&this.ensureDeviceIdsAtStartPopulated()})),i()(this,"onDevicesUpdated",(e=>{e.includes(l.a.get().getUserId())&&this.recheck()})),i()(this,"onDeviceVerificationChanged",(e=>{e===l.a.get().getUserId()&&this.recheck()})),i()(this,"onUserTrustStatusChanged",(e=>{e===l.a.get().getUserId()&&this.recheck()})),i()(this,"onCrossSingingKeysChanged",(()=>{this.recheck()})),i()(this,"onAccountData",(e=>{(e.getType().startsWith("m.secret_storage.")||e.getType().startsWith("m.cross_signing.")||"m.megolm_backup.v1"===e.getType())&&this.recheck()})),i()(this,"onSync",((e,t)=>{"PREPARED"===e&&null===t&&this.recheck()})),i()(this,"onRoomStateEvents",(e=>{e.getType()===o.EventType.RoomEncryption&&this.recheck()})),i()(this,"onAction",(e=>{let{action:t}=e;t===h.a.OnLoggedIn&&(this.recheck(),this.updateClientInformation())})),i()(this,"checkKeyBackupStatus",(async()=>{if(this.keyBackupStatusChecked)return;const e=l.a.get().getKeyBackupEnabled();this.keyBackupStatusChecked=null!==e,!1===e&&c.a.dispatch({action:h.a.ReportKeyBackupNotEnabled})})),i()(this,"onRecordClientInformationSettingChange",((e,t,a,n,i)=>{const s=this.shouldRecordClientInformation;this.shouldRecordClientInformation=!!i,this.shouldRecordClientInformation!==s&&this.updateClientInformation()})),i()(this,"updateClientInformation",(async()=>{try{this.shouldRecordClientInformation?await Object(G.c)(l.a.get(),H.b.get(),z.a.get()):await Object(G.d)(l.a.get())}catch(e){s.a.error("Failed to update client information",e)}}))}static sharedInstance(){return window.mxDeviceListener||(window.mxDeviceListener=new $),window.mxDeviceListener}start(){this.running=!0,l.a.get().on(r.b.WillUpdateDevices,this.onWillUpdateDevices),l.a.get().on(r.b.DevicesUpdated,this.onDevicesUpdated),l.a.get().on(r.b.DeviceVerificationChanged,this.onDeviceVerificationChanged),l.a.get().on(r.b.UserTrustStatusChanged,this.onUserTrustStatusChanged),l.a.get().on(r.b.KeysChanged,this.onCrossSingingKeysChanged),l.a.get().on(o.ClientEvent.AccountData,this.onAccountData),l.a.get().on(o.ClientEvent.Sync,this.onSync),l.a.get().on(o.RoomStateEvent.Events,this.onRoomStateEvents),this.shouldRecordClientInformation=K.b.getValue("deviceClientInformationOptIn"),this.enableBulkUnverifiedSessionsReminder=K.b.getValue(q.b.BulkUnverifiedSessionsReminder),this.deviceClientInformationSettingWatcherRef=K.b.watchSetting("deviceClientInformationOptIn",null,this.onRecordClientInformationSettingChange),this.dispatcherRef=c.a.register(this.onAction),this.recheck(),this.updateClientInformation()}stop(){this.running=!1,l.a.get()&&(l.a.get().removeListener(r.b.WillUpdateDevices,this.onWillUpdateDevices),l.a.get().removeListener(r.b.DevicesUpdated,this.onDevicesUpdated),l.a.get().removeListener(r.b.DeviceVerificationChanged,this.onDeviceVerificationChanged),l.a.get().removeListener(r.b.UserTrustStatusChanged,this.onUserTrustStatusChanged),l.a.get().removeListener(r.b.KeysChanged,this.onCrossSingingKeysChanged),l.a.get().removeListener(o.ClientEvent.AccountData,this.onAccountData),l.a.get().removeListener(o.ClientEvent.Sync,this.onSync),l.a.get().removeListener(o.RoomStateEvent.Events,this.onRoomStateEvents)),this.deviceClientInformationSettingWatcherRef&&K.b.unwatchSetting(this.deviceClientInformationSettingWatcherRef),this.dispatcherRef&&(c.a.unregister(this.dispatcherRef),this.dispatcherRef=null),this.dismissed.clear(),this.dismissedThisDeviceToast=!1,this.keyBackupInfo=null,this.keyBackupFetchedAt=null,this.keyBackupStatusChecked=!1,this.ourDeviceIdsAtStart=null,this.displayingToastsForDeviceIds=new Set}async dismissUnverifiedSessions(e){s.a.log("Dismissing unverified sessions: "+Array.from(e).join(","));for(const t of e)this.dismissed.add(t);this.recheck()}dismissEncryptionSetup(){this.dismissedThisDeviceToast=!0,this.recheck()}ensureDeviceIdsAtStartPopulated(){if(null===this.ourDeviceIdsAtStart){const e=l.a.get();this.ourDeviceIdsAtStart=new Set(e.getStoredDevicesForUser(e.getUserId()).map((e=>e.deviceId)))}}async getKeyBackupInfo(){const e=(new Date).getTime();return(!this.keyBackupInfo||this.keyBackupFetchedAt<e-3e5)&&(this.keyBackupInfo=await l.a.get().getKeyBackupVersion(),this.keyBackupFetchedAt=e),this.keyBackupInfo}shouldShowSetupEncryptionToast(){if(Object(y.d)())return!1;const e=l.a.get();return e&&e.getRooms().some((t=>e.isRoomEncrypted(t.roomId)))}async recheck(){if(!this.running)return;const e=l.a.get();if(!await e.doesServerSupportUnstableFeature("org.matrix.e2e_cross_signing"))return;if(!e.isCryptoEnabled())return;if(!e.isInitialSyncComplete())return;const t=await e.isCrossSigningReady(),a=await e.isSecretStorageReady(),n=t&&a;if(this.dismissedThisDeviceToast||n)I(),this.checkKeyBackupStatus();else if(this.shouldShowSetupEncryptionToast())if(await e.downloadKeys([e.getUserId()]),!e.getCrossSigningId()&&e.getStoredCrossSigningForUser(e.getUserId()))R(j.VERIFY_THIS_SESSION),this.checkKeyBackupStatus();else{await this.getKeyBackupInfo()?R(j.UPGRADE_ENCRYPTION):(await e.waitForClientWellKnown(),Object(V.g)()&&function(){const e=window.matrixChat;return(null==e?void 0:e.state.view)===W.a.LOGGED_IN}()?(I(),Object(y.b)()):R(j.SET_UP_ENCRYPTION))}this.ensureDeviceIdsAtStartPopulated();const i=new Set,r=new Set,o=t&&await e.checkDeviceTrust(e.getUserId(),e.deviceId).isCrossSigningVerified();if(t){const t=e.getStoredDevicesForUser(e.getUserId());for(const a of t){if(a.deviceId===e.deviceId)continue;var c;if(!(await e.checkDeviceTrust(e.getUserId(),a.deviceId)).isCrossSigningVerified()&&!this.dismissed.has(a.deviceId))null!==(c=this.ourDeviceIdsAtStart)&&void 0!==c&&c.has(a.deviceId)?i.add(a.deviceId):r.add(a.deviceId)}}s.a.debug("Old unverified sessions: "+Array.from(i).join(",")),s.a.debug("New unverified sessions: "+Array.from(r).join(",")),s.a.debug("Currently showing toasts for: "+Array.from(this.displayingToastsForDeviceIds).join(","));const d=(()=>{try{const e=localStorage.getItem(p),t=Number.parseInt(e||"",10);return Number.isInteger(t)&&t+6048e5>Date.now()}catch(e){return!1}})();i.size>0&&o&&this.enableBulkUnverifiedSessionsReminder&&!d?v(i):u.a.sharedInstance().dismissToast(g);for(const e of r)F(e);for(const e of this.displayingToastsForDeviceIds)r.has(e)||(s.a.debug("Hiding unverified session toast for "+e),B(e));this.displayingToastsForDeviceIds=r}}},1552:function(e,t,a){"use strict";a.d(t,"a",(function(){return E}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(512),l=a(420),c=a(1),d=a(122),m=a(121),u=a(166),h=a(145);class p extends r.a.Component{render(){return r.a.createElement("div",null,r.a.createElement("h2",null,Object(m.a)("Verified!")),r.a.createElement("p",null,Object(m.a)("You've successfully verified this user.")),r.a.createElement("p",null,Object(m.a)("Secure messages with this user are end-to-end encrypted and not able to be read by third parties.")),r.a.createElement(h.a,{onPrimaryButtonClick:this.props.onDone,primaryButton:Object(m.a)("Got It"),hasCancel:!1}))}}class g extends r.a.Component{render(){return r.a.createElement("div",null,r.a.createElement("p",null,Object(m.a)("The other party cancelled the verification.")),r.a.createElement(h.a,{primaryButton:Object(m.a)("OK"),hasCancel:!1,onPrimaryButtonClick:this.props.onDone}))}}var v=a(191),b=a(134),f=a(861),y=a(135);class E extends r.a.Component{constructor(e){super(e),i()(this,"showSasEvent",void 0),i()(this,"onFinished",(()=>{this.props.onFinished(3===this.state.phase)})),i()(this,"onCancelClick",(()=>{this.props.onFinished(3===this.state.phase)})),i()(this,"onContinueClick",(()=>{this.setState({phase:2}),this.props.verifier.verify().then((()=>{this.setState({phase:3})})).catch((e=>{c.a.log("Verification failed",e)}))})),i()(this,"onVerifierShowSas",(e=>{this.showSasEvent=e,this.setState({phase:1,sas:e.sas})})),i()(this,"onVerifierCancel",(()=>{this.setState({phase:4})})),i()(this,"onSasMatchesClick",(()=>{this.showSasEvent.confirm(),this.setState({phase:2})})),i()(this,"onVerifiedDoneClick",(()=>{this.props.onFinished(!0)}));let t=0;this.props.verifier.hasBeenCancelled&&(c.a.log("Verifier was cancelled in the background."),t=4),this.showSasEvent=null,this.state={phase:t,sasVerified:!1,opponentProfile:null,opponentProfileError:null,sas:null},this.props.verifier.on(o.b.ShowSas,this.onVerifierShowSas),this.props.verifier.on(l.c.Cancel,this.onVerifierCancel),this.fetchOpponentProfile()}componentWillUnmount(){4!==this.state.phase&&3!==this.state.phase&&this.props.verifier.cancel(new Error("User cancel")),this.props.verifier.removeListener(o.b.ShowSas,this.onVerifierShowSas)}async fetchOpponentProfile(){try{const e=await d.a.get().getProfileInfo(this.props.verifier.userId);this.setState({opponentProfile:e})}catch(e){this.setState({opponentProfileError:e})}}renderPhaseStart(){const e=this.props.verifier.userId===d.a.get().getUserId();let t;const a=this.state.opponentProfile;if(a){const e=a.avatar_url?Object(u.b)(a.avatar_url).getSquareThumbnailHttp(48):null;t=r.a.createElement("div",{className:"mx_IncomingSasDialog_opponentProfile"},r.a.createElement(v.a,{name:a.displayname,idName:this.props.verifier.userId,url:e,width:48,height:48,resizeMethod:"crop"}),r.a.createElement("h2",null,a.displayname))}else t=this.state.opponentProfileError?r.a.createElement("div",null,r.a.createElement(v.a,{name:this.props.verifier.userId.slice(1),idName:this.props.verifier.userId,width:48,height:48}),r.a.createElement("h2",null,this.props.verifier.userId)):r.a.createElement(b.a,null);const n=[r.a.createElement("p",{key:"p1"},Object(m.a)("Verify this user to mark them as trusted. Trusting users gives you extra peace of mind when using end-to-end encrypted messages.")),r.a.createElement("p",{key:"p2"},Object(m.a)("Verifying this user will mark their session as trusted, and also mark your session as trusted to them."))],i=[r.a.createElement("p",{key:"p1"},Object(m.a)("Verify this device to mark it as trusted. Trusting this device gives you and other users extra peace of mind when using end-to-end encrypted messages.")),r.a.createElement("p",{key:"p2"},Object(m.a)("Verifying this device will mark it as trusted, and users who have verified with you will trust this device."))];return r.a.createElement("div",null,t,e?i:n,r.a.createElement(h.a,{primaryButton:Object(m.a)("Continue"),hasCancel:!0,onPrimaryButtonClick:this.onContinueClick,onCancel:this.onCancelClick}))}renderPhaseShowSas(){return r.a.createElement(f.a,{sas:this.showSasEvent.sas,onCancel:this.onCancelClick,onDone:this.onSasMatchesClick,isSelf:this.props.verifier.userId===d.a.get().getUserId(),inDialog:!0})}renderPhaseWaitForPartnerToConfirm(){return r.a.createElement("div",null,r.a.createElement(b.a,null),r.a.createElement("p",null,Object(m.a)("Waiting for partner to confirm…")))}renderPhaseVerified(){return r.a.createElement(p,{onDone:this.onVerifiedDoneClick})}renderPhaseCancelled(){return r.a.createElement(g,{onDone:this.onCancelClick})}render(){let e;switch(this.state.phase){case 0:e=this.renderPhaseStart();break;case 1:e=this.renderPhaseShowSas();break;case 2:e=this.renderPhaseWaitForPartnerToConfirm();break;case 3:e=this.renderPhaseVerified();break;case 4:e=this.renderPhaseCancelled()}return r.a.createElement(y.a,{title:Object(m.a)("Incoming Verification Request"),onFinished:this.onFinished,fixedWidth:!1},e)}}},1553:function(e,t,a){"use strict";a.d(t,"a",(function(){return f}));var n=a(126),i=a.n(n),s=a(120),r=a.n(s),o=a(121),l=a(478),c=a(130),d=a.n(c),m=a(132),u=a.n(m);const h=["children","className"];function p(e){let{children:t,className:a}=e,n=u()(e,h);const s=i()(a,"mx_SplashPage");return r.a.createElement("main",d()({},n,{className:s}),t)}var g=a(123);function v(e){let t,{useCase:a,onClick:n,selected:s}=e;switch(a){case l.a.PersonalMessaging:t=Object(o.a)("Friends and family");break;case l.a.WorkMessaging:t=Object(o.a)("Coworkers and teams");break;case l.a.CommunityMessaging:t=Object(o.a)("Online community members")}return r.a.createElement(g.a,{className:i()("mx_UseCaseSelectionButton",{mx_UseCaseSelectionButton_selected:s}),onClick:async()=>n(a)},r.a.createElement("div",{className:i()("mx_UseCaseSelectionButton_icon",{mx_UseCaseSelectionButton_messaging:a===l.a.PersonalMessaging,mx_UseCaseSelectionButton_work:a===l.a.WorkMessaging,mx_UseCaseSelectionButton_community:a===l.a.CommunityMessaging})}),r.a.createElement("span",null,t),r.a.createElement("div",{className:"mx_UseCaseSelectionButton_selectedIcon"}))}const b=1500;function f(e){let{onFinished:t}=e;const[a,n]=Object(s.useState)(null);return Object(s.useEffect)((()=>{if(a){let e=window.setTimeout((()=>{e=null,t(a)}),b);return()=>{clearTimeout(e),e=null}}}),[a,t]),r.a.createElement(p,{className:i()("mx_UseCaseSelection",{mx_UseCaseSelection_selected:null!==a})},r.a.createElement("div",{className:"mx_UseCaseSelection_title mx_UseCaseSelection_slideIn"},r.a.createElement("h1",null,Object(o.a)("You're in"))),r.a.createElement("div",{className:"mx_UseCaseSelection_info mx_UseCaseSelection_slideInDelayed"},r.a.createElement("h2",null,Object(o.a)("Who will you chat to the most?")),r.a.createElement("h3",null,Object(o.a)("We'll help you get connected."))),r.a.createElement("div",{className:"mx_UseCaseSelection_options mx_UseCaseSelection_slideInDelayed"},r.a.createElement(v,{useCase:l.a.PersonalMessaging,selected:a===l.a.PersonalMessaging,onClick:n}),r.a.createElement(v,{useCase:l.a.WorkMessaging,selected:a===l.a.WorkMessaging,onClick:n}),r.a.createElement(v,{useCase:l.a.CommunityMessaging,selected:a===l.a.CommunityMessaging,onClick:n})),r.a.createElement("div",{className:"mx_UseCaseSelection_skip mx_UseCaseSelection_slideInDelayed"},r.a.createElement(g.a,{kind:"link",onClick:async()=>n(l.a.Skip)},Object(o.a)("Skip"))))}},1555:function(e,t,a){"use strict";a.d(t,"a",(function(){return g}));var n=a(120),i=a.n(n),s=a(126),r=a.n(s),o=a(131),l=a(318),c=a(121),d=a(125),m=a(156),u=a(908),h=a(633);const p=`<a href="https://matrix.org" target="_blank" rel="noreferrer noopener">\n <img width="79" height="34" alt="Matrix" style="padding-left: 1px;vertical-align: middle" src="${a(1524).default}"/>\n</a>`;Object(c.c)("Sign in with SSO");class g extends i.a.PureComponent{render(){const e=o.b.getObject("embedded_pages");let t;return e&&(t=e.get("welcome_url")),t||(t="welcome.html"),i.a.createElement(l.a,null,i.a.createElement("div",{className:r()("mx_Welcome",{mx_WelcomePage_registrationDisabled:!d.b.getValue(m.b.Registration)})},i.a.createElement(h.a,{className:"mx_WelcomePage",url:t,replaceMap:{"$riot:ssoUrl":"#/start_sso","$riot:casUrl":"#/start_cas",$matrixLogo:p,"[matrix]":p}}),i.a.createElement(u.a,null)))}}},1556:function(e,t,a){"use strict";a.d(t,"a",(function(){return y}));var n=a(120),i=a.n(n),s=a(318),r=a(907),o=a(13),l=a.n(o),c=a(1),d=a(122),m=a(121),u=a(127),h=a(319),p=a(145),g=a(135),v=a(134),b=a(256);class f extends i.a.PureComponent{constructor(e){super(e),l()(this,"doBootstrapUIAuth",(async e=>{if(this.state.canUploadKeysWithPasswordOnly&&this.state.accountPassword)await e({type:"m.login.password",identifier:{type:"m.id.user",user:d.a.get().getUserId()},user:d.a.get().getUserId(),password:this.state.accountPassword});else if(this.props.tokenLogin)await e({});else{const t={[h.c.PHASE_PREAUTH]:{title:Object(m.a)("Use Single Sign On to continue"),body:Object(m.a)("To continue, use Single Sign On to prove your identity."),continueText:Object(m.a)("Single Sign On"),continueKind:"primary"},[h.c.PHASE_POSTAUTH]:{title:Object(m.a)("Confirm encryption setup"),body:Object(m.a)("Click the button below to confirm setting up encryption."),continueText:Object(m.a)("Confirm"),continueKind:"primary"}},{finished:a}=u.b.createDialog(b.a,{title:Object(m.a)("Setting up keys"),matrixClient:d.a.get(),makeRequest:e,aestheticsForStagePhases:{[h.c.LOGIN_TYPE]:t,[h.c.UNSTABLE_LOGIN_TYPE]:t}}),[n]=await a;if(!n)throw new Error("Cross-signing key upload auth canceled")}})),l()(this,"bootstrapCrossSigning",(async()=>{this.setState({error:null});const e=d.a.get();try{await e.bootstrapCrossSigning({authUploadDeviceSigningKeys:this.doBootstrapUIAuth}),this.props.onFinished(!0)}catch(e){if(this.props.tokenLogin)return void this.props.onFinished(!1);this.setState({error:e}),c.a.error("Error bootstrapping cross-signing",e)}})),l()(this,"onCancel",(()=>{this.props.onFinished(!1)})),this.state={error:null,canUploadKeysWithPasswordOnly:!!e.accountPassword||null,accountPassword:e.accountPassword||""},this.state.accountPassword||this.queryKeyUploadAuth()}componentDidMount(){this.bootstrapCrossSigning()}async queryKeyUploadAuth(){try{await d.a.get().uploadDeviceSigningKeys(null,{}),c.a.log("uploadDeviceSigningKeys unexpectedly succeeded without UI auth!")}catch(e){if(!e.data||!e.data.flows)return void c.a.log("uploadDeviceSigningKeys advertised no flows!");const t=e.data.flows.some((e=>1===e.stages.length&&"m.login.password"===e.stages[0]));this.setState({canUploadKeysWithPasswordOnly:t})}}render(){let e;return e=this.state.error?i.a.createElement("div",null,i.a.createElement("p",null,Object(m.a)("Unable to set up keys")),i.a.createElement("div",{className:"mx_Dialog_buttons"},i.a.createElement(p.a,{primaryButton:Object(m.a)("Retry"),onPrimaryButtonClick:this.bootstrapCrossSigning,onCancel:this.onCancel}))):i.a.createElement("div",null,i.a.createElement(v.a,null)),i.a.createElement(g.a,{className:"mx_CreateCrossSigningDialog",onFinished:this.props.onFinished,title:Object(m.a)("Setting up keys"),hasCancel:!1,fixedWidth:!1},i.a.createElement("div",null,e))}}class y extends i.a.Component{render(){return i.a.createElement(s.a,null,i.a.createElement(r.a,null,i.a.createElement(f,{onFinished:this.props.onFinished,accountPassword:this.props.accountPassword,tokenLogin:this.props.tokenLogin})))}}},1557:function(e,t,a){"use strict";a.d(t,"a",(function(){return D}));var n=a(13),i=a.n(n),s=a(136),r=a(120),o=a.n(r),l=a(126),c=a.n(l),d=a(1),m=a(343),u=a(121),h=a(386),p=a(349),g=a(470),v=a(122),b=a(318),f=a(471),y=a(124),E=a(640),_=a(931),w=a(658),S=a(123),O=a(481),C=a(480),x=a(520),j=a(134),k=a(522);function R(e){var t,a;let{title:n,icon:i,serverPicker:s,children:l}=e;const c=Object(r.useContext)(k.a);if(!c)return null;const d=c.state.length?c.state[0]:null;return o.a.createElement(r.Fragment,null,null!==(t=null==d?void 0:d.icon)&&void 0!==t?t:i,o.a.createElement("h1",null,null!==(a=null==d?void 0:d.title)&&void 0!==a?a:n),l,!0!==(null==d?void 0:d.hideServerPicker)&&s)}var I=a(690),T=a(125);function N(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}const P=function(){if(T.b.getValue("debug_registration")){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];d.a.log.call(console,"Registration debuglog:",...t)}};class D extends o.a.Component{constructor(e){super(e),i()(this,"loginLogic",void 0),i()(this,"latestServerConfig",void 0),i()(this,"unloadCallback",(e=>{if(this.state.doingUIAuth)return e.preventDefault(),e.returnValue="",""})),i()(this,"onFormSubmit",(async e=>{this.setState({errorText:"",busy:!0,formVals:e,doingUIAuth:!0})})),i()(this,"requestEmailToken",((e,t,a,n)=>{if(!this.state.matrixClient)throw new Error("Matrix client has not yet been loaded");return this.state.matrixClient.requestRegisterEmailToken(e,t,a,this.props.makeRegistrationUrl({client_secret:t,hs_url:this.state.matrixClient.getHomeserverUrl(),is_url:this.state.matrixClient.getIdentityServerUrl(),session_id:n}))})),i()(this,"onUIAuthFinished",(async(e,t)=>{if(!this.state.matrixClient)throw new Error("Matrix client has not yet been loaded");if(P("Registration: ui authentication finished: ",{success:e,response:t}),!e){var a;let e=t.message||t.toString();if(t instanceof s.MatrixError&&"M_RESOURCE_LIMIT_EXCEEDED"===t.errcode){const a=Object(h.a)(t.data.limit_type,t.data.admin_contact,{monthly_active_user:Object(u.c)("This homeserver has hit its Monthly Active User limit."),hs_blocked:Object(u.c)("This homeserver has been blocked by its administrator."),"":Object(u.c)("This homeserver has exceeded one of its resource limits.")}),n=Object(h.a)(t.data.limit_type,t.data.admin_contact,{"":Object(u.c)("Please <a>contact your service administrator</a> to continue using this service.")});e=o.a.createElement("div",null,o.a.createElement("p",null,a),o.a.createElement("p",null,n))}else if(null!==(a=t.required_stages)&&void 0!==a&&a.includes(s.AuthType.Msisdn)){var n;(null!==(n=t.available_flows)&&void 0!==n?n:[]).some((e=>e.stages.includes(s.AuthType.Msisdn)))||(e=Object(u.a)("This server does not support authentication with a phone number."))}else t instanceof s.MatrixError&&"M_USER_IN_USE"===t.errcode?e=Object(u.a)("Someone already has that username, please try another."):t instanceof s.MatrixError&&"M_THREEPID_IN_USE"===t.errcode&&(e=Object(u.a)("That e-mail address or phone number is already in use."));return void this.setState({busy:!1,doingUIAuth:!1,errorText:e})}const i=t.user_id,r=t.access_token;if(!i||!r)throw new Error("Registration failed");v.a.setJustRegisteredUserId(i);const l={doingUIAuth:!1,registeredUsername:t.user_id,differentLoggedInUserId:void 0,completedNoSignin:!1,busy:!0},[c,m]=await g.b();c&&!m&&c!==t.user_id&&(d.a.log(`Found a session for ${c} but ${t.user_id} has just registered.`),l.differentLoggedInUserId=c);const p=Boolean(this.state.formVals.email),b=Boolean(t.access_token);P("Registration: ui auth finished:",{hasEmail:p,hasAccessToken:b}),p||!b||l.differentLoggedInUserId?(l.busy=!1,l.completedNoSignin=!0):(await this.props.onLoggedIn({userId:i,deviceId:t.device_id,homeserverUrl:this.state.matrixClient.getHomeserverUrl(),identityServerUrl:this.state.matrixClient.getIdentityServerUrl(),accessToken:r},this.state.formVals.password),this.setupPushers()),this.setState(l)})),i()(this,"onLoginClick",(e=>{e.preventDefault(),e.stopPropagation(),this.props.onLoginClick()})),i()(this,"onGoToFormClicked",(e=>{e.preventDefault(),e.stopPropagation(),this.replaceClient(this.props.serverConfig),this.setState({busy:!1,doingUIAuth:!1})})),i()(this,"makeRegisterRequest",(e=>{if(!this.state.matrixClient)throw new Error("Matrix client has not yet been loaded");const t={username:this.state.formVals.username,password:this.state.formVals.password,initial_device_display_name:this.props.defaultDeviceDisplayName,auth:void 0,inhibit_login:void 0};return e&&(t.auth=e),P("Registration: sending registration request:",e),this.state.matrixClient.registerRequest(t)})),i()(this,"onLoginClickWithCheck",(async e=>{e.preventDefault();const t=await g.h({ignoreGuest:!0});return t||this.props.onLoginClick(),t})),this.state={busy:!1,errorText:null,formVals:{email:this.props.email},doingUIAuth:Boolean(this.props.sessionId),flows:null,completedNoSignin:!1,serverIsAlive:!0,serverErrorIsFatal:!1,serverDeadError:""};const{hsUrl:t,isUrl:a}=this.props.serverConfig;this.loginLogic=new f.a(t,a,null,{defaultDeviceDisplayName:"Element login check"})}componentDidMount(){this.replaceClient(this.props.serverConfig),window.addEventListener("beforeunload",this.unloadCallback)}componentWillUnmount(){window.removeEventListener("beforeunload",this.unloadCallback)}componentDidUpdate(e){e.serverConfig.hsUrl===this.props.serverConfig.hsUrl&&e.serverConfig.isUrl===this.props.serverConfig.isUrl||this.replaceClient(this.props.serverConfig)}async replaceClient(e){this.latestServerConfig=e;const{hsUrl:t,isUrl:a}=e;this.setState({errorText:null,serverDeadError:null,serverErrorIsFatal:!1,busy:!0});try{if(await p.a.validateServerConfigWithStaticUrls(t,a),e!==this.latestServerConfig)return;this.setState({serverIsAlive:!0,serverErrorIsFatal:!1})}catch(t){if(e!==this.latestServerConfig)return;if(this.setState(function(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?N(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):N(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}({busy:!1},p.a.authComponentStateForError(t,"register"))),this.state.serverErrorIsFatal)return}const n=Object(s.createClient)({baseUrl:t,idBaseUrl:a});let r;this.loginLogic.setHomeserverUrl(t),this.loginLogic.setIdentityServerUrl(a);try{const t=await this.loginLogic.getFlows();if(e!==this.latestServerConfig)return;r=t.find((e=>"m.login.sso"===e.type||"m.login.cas"===e.type))}catch(t){if(e!==this.latestServerConfig)return;d.a.error("Failed to get login flows to check for SSO support",t)}this.setState({matrixClient:n,ssoFlow:r,busy:!1});try{if(!this.state.doingUIAuth){if(await this.makeRegisterRequest(null),e!==this.latestServerConfig)return;d.a.log("Expecting 401 from register request but got success!")}}catch(t){if(e!==this.latestServerConfig)return;401===t.httpStatus?this.setState({flows:t.data.flows}):403===t.httpStatus||"M_FORBIDDEN"===t.errcode?r?y.a.dispatch({action:"start_login"}):this.setState({serverErrorIsFatal:!0,errorText:Object(u.a)("Registration has been disabled on this homeserver."),flows:[]}):(d.a.log("Unable to query for supported registration methods.",t),this.setState({errorText:Object(u.a)("Unable to query for supported registration methods."),flows:[]}))}}setupPushers(){if(!this.props.brand)return Promise.resolve();const e=v.a.get();return e.getPushers().then((t=>{const a=t.pushers;for(let t=0;t<a.length;++t)if("email"===a[t].kind){const n=a[t];n.data={brand:this.props.brand},e.setPusher(n).then((()=>{d.a.log("Set email branding to "+this.props.brand)}),(e=>{d.a.error("Couldn't set email branding: "+e)}))}}),(e=>{d.a.error("Couldn't get pushers: "+e)}))}getUIAuthInputs(){return{emailAddress:this.state.formVals.email,phoneCountry:this.state.formVals.phoneCountry,phoneNumber:this.state.formVals.phoneNumber}}renderRegisterComponent(){if(this.state.matrixClient&&this.state.doingUIAuth)return o.a.createElement(x.b,{matrixClient:this.state.matrixClient,makeRequest:this.makeRegisterRequest,onAuthFinished:this.onUIAuthFinished,inputs:this.getUIAuthInputs(),requestEmailToken:this.requestEmailToken,sessionId:this.props.sessionId,clientSecret:this.props.clientSecret,emailSid:this.props.idSid,poll:!0});if(!this.state.matrixClient&&!this.state.busy)return null;if(this.state.busy||!this.state.flows)return o.a.createElement("div",{className:"mx_AuthBody_spinner"},o.a.createElement(j.a,null));if(this.state.matrixClient&&this.state.flows.length){let e;if(this.state.ssoFlow){let t;(this.state.ssoFlow.identity_providers||[]).length>1&&(t=o.a.createElement("h2",{className:"mx_AuthBody_centered"},Object(u.a)("Continue with %(ssoButtons)s",{ssoButtons:""}).trim())),e=o.a.createElement(o.a.Fragment,null,t,o.a.createElement(E.a,{matrixClient:this.loginLogic.createTemporaryClient(),flow:this.state.ssoFlow,loginType:"m.login.sso"===this.state.ssoFlow.type?"sso":"cas",fragmentAfterLogin:this.props.fragmentAfterLogin,action:m.c.REGISTER}),o.a.createElement("h2",{className:"mx_AuthBody_centered"},Object(u.a)("%(ssoButtons)s Or %(usernamePassword)s",{ssoButtons:"",usernamePassword:""}).trim()))}return o.a.createElement(o.a.Fragment,null,e,o.a.createElement(w.b,{defaultUsername:this.state.formVals.username,defaultEmail:this.state.formVals.email,defaultPhoneCountry:this.state.formVals.phoneCountry,defaultPhoneNumber:this.state.formVals.phoneNumber,defaultPassword:this.state.formVals.password,onRegisterClick:this.onFormSubmit,flows:this.state.flows,serverConfig:this.props.serverConfig,canSubmit:!this.state.serverErrorIsFatal,matrixClient:this.state.matrixClient}))}return null}render(){let e;const t=this.state.errorText;let a;if(t&&(e=o.a.createElement("div",{className:"mx_Login_error"},t)),!this.state.serverIsAlive){const e=c()({mx_Login_error:!0,mx_Login_serverError:!0,mx_Login_serverErrorNonFatal:!this.state.serverErrorIsFatal});a=o.a.createElement("div",{className:e},this.state.serverDeadError)}const n=o.a.createElement("span",{className:"mx_AuthBody_changeFlow"},Object(u.a)("Already have an account? <a>Sign in here</a>",{},{a:e=>o.a.createElement(S.a,{kind:"link_inline",onClick:this.onLoginClick},e)}));let i,s;if(this.state.doingUIAuth&&(i=o.a.createElement(S.a,{kind:"link",className:"mx_AuthBody_changeFlow",onClick:this.onGoToFormClicked},Object(u.a)("Go back"))),this.state.completedNoSignin){let e;e=this.state.differentLoggedInUserId?o.a.createElement("div",null,o.a.createElement("p",null,Object(u.a)("Your new account (%(newAccountId)s) is registered, but you're already logged into a different account (%(loggedInUserId)s).",{newAccountId:this.state.registeredUsername,loggedInUserId:this.state.differentLoggedInUserId})),o.a.createElement("p",null,o.a.createElement(S.a,{kind:"link_inline",onClick:async e=>{await this.onLoginClickWithCheck(e)&&y.a.dispatch({action:"view_welcome_page"})}},Object(u.a)("Continue with previous account")))):o.a.createElement("h2",null,Object(u.a)("<a>Log in</a> to your new account.",{},{a:e=>o.a.createElement(S.a,{kind:"link_inline",onClick:async e=>{await this.onLoginClickWithCheck(e)&&y.a.dispatch({action:"view_home_page"})}},e)})),s=o.a.createElement("div",null,o.a.createElement("h1",null,Object(u.a)("Registration Successful")),e)}else s=o.a.createElement(r.Fragment,null,o.a.createElement("div",{className:"mx_Register_mainContent"},o.a.createElement(R,{title:Object(u.a)("Create account"),serverPicker:o.a.createElement(_.a,{title:Object(u.a)("Host account on"),dialogTitle:Object(u.a)("Decide where your account is hosted"),serverConfig:this.props.serverConfig,onServerConfigChange:this.state.doingUIAuth?void 0:this.props.onServerConfigChange})},e,a),this.renderRegisterComponent()),o.a.createElement("div",{className:"mx_Register_footerActions"},i,n));return o.a.createElement(b.a,null,o.a.createElement(C.a,null),o.a.createElement(I.b,null,o.a.createElement(O.a,{flex:!0},s)))}}},1558:function(e,t,a){"use strict";a.d(t,"a",(function(){return V}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(193),l=a(126),c=a.n(l),d=a(1),m=a(343),u=a(121),h=a(471),p=a(131),g=a(386),v=a(349),b=a(318),f=a(157),y=a(125),E=a(156),_=a(123),w=a(200),S=a(139),O=a(638),C=a(479);let x,j,k;const R=/^[0-9()\-\s]*$/;var I;!function(e){e.Email="login_field_email",e.MatrixId="login_field_mxid",e.Phone="login_field_phone",e.Password="login_field_phone"}(I||(I={})),x=I.Email,j=I.Phone,k=I.MatrixId;class T extends r.a.PureComponent{constructor(e){super(e),i()(this,x,void 0),i()(this,j,void 0),i()(this,k,void 0),i()(this,"onForgotPasswordClick",(e=>{var t,a;e.preventDefault(),e.stopPropagation(),null===(t=(a=this.props).onForgotPasswordClick)||void 0===t||t.call(a)})),i()(this,"onSubmitForm",(async e=>{e.preventDefault();if(await this.verifyFieldsBeforeSubmit())switch(this.state.loginType){case I.Email:case I.MatrixId:this.props.onSubmit(this.props.username,void 0,void 0,this.state.password);break;case I.Phone:this.props.onSubmit(void 0,this.props.phoneCountry,this.props.phoneNumber,this.state.password)}})),i()(this,"onUsernameChanged",(e=>{var t,a;null===(t=(a=this.props).onUsernameChanged)||void 0===t||t.call(a,e.target.value)})),i()(this,"onUsernameBlur",(e=>{var t,a;null===(t=(a=this.props).onUsernameBlur)||void 0===t||t.call(a,e.target.value)})),i()(this,"onLoginTypeChange",(e=>{var t,a;const n=e.target.value;this.setState({loginType:n}),null===(t=(a=this.props).onUsernameChanged)||void 0===t||t.call(a,"")})),i()(this,"onPhoneCountryChanged",(e=>{var t,a;null===(t=(a=this.props).onPhoneCountryChanged)||void 0===t||t.call(a,e.iso2)})),i()(this,"onPhoneNumberChanged",(e=>{var t,a;null===(t=(a=this.props).onPhoneNumberChanged)||void 0===t||t.call(a,e.target.value)})),i()(this,"onPasswordChanged",(e=>{this.setState({password:e.target.value})})),i()(this,"validateUsernameRules",Object(w.a)({rules:[{key:"required",test(e){let{value:t,allowEmpty:a}=e;return a||!!t},invalid:()=>Object(u.a)("Enter username")}]})),i()(this,"onUsernameValidate",(async e=>{const t=await this.validateUsernameRules(e);return this.markFieldValid(I.MatrixId,t.valid),t})),i()(this,"onEmailValidate",(e=>{this.markFieldValid(I.Email,e.valid)})),i()(this,"validatePhoneNumberRules",Object(w.a)({rules:[{key:"required",test(e){let{value:t,allowEmpty:a}=e;return a||!!t},invalid:()=>Object(u.a)("Enter phone number")},{key:"number",test:e=>{let{value:t}=e;return!t||R.test(t)},invalid:()=>Object(u.a)("That phone number doesn't look quite right, please check and try again")}]})),i()(this,"onPhoneNumberValidate",(async e=>{const t=await this.validatePhoneNumberRules(e);return this.markFieldValid(I.Password,t.valid),t})),i()(this,"validatePasswordRules",Object(w.a)({rules:[{key:"required",test(e){let{value:t,allowEmpty:a}=e;return a||!!t},invalid:()=>Object(u.a)("Enter password")}]})),i()(this,"onPasswordValidate",(async e=>{const t=await this.validatePasswordRules(e);return this.markFieldValid(I.Password,t.valid),t})),this.state={fieldValid:{},loginType:I.MatrixId,password:""}}async verifyFieldsBeforeSubmit(){const e=document.activeElement;e&&e.blur();const t=[this.state.loginType,I.Password];for(const e of t){const t=this[e];t&&await t.validate({allowEmpty:!1})}if(await new Promise((e=>this.setState({},e))),this.allFieldsValid())return!0;const a=this.findFirstInvalidField(t);return!a||(a.focus(),a.validate({allowEmpty:!1,focused:!0}),!1)}allFieldsValid(){return Object.values(this.state.fieldValid).every(Boolean)}findFirstInvalidField(e){for(const t of e)if(!this.state.fieldValid[t]&&this[t])return this[t];return null}markFieldValid(e,t){const{fieldValid:a}=this.state;a[e]=t,this.setState({fieldValid:a})}renderLoginField(e,t){const a={error:!1};switch(e){case I.Email:return a.error=this.props.loginIncorrect&&!this.props.username,r.a.createElement(C.a,{id:"mx_LoginForm_email",className:c()(a),name:"username",autoComplete:"email",type:"email",key:"email_input",placeholder:"joe@example.com",value:this.props.username,onChange:this.onUsernameChanged,onBlur:this.onUsernameBlur,disabled:this.props.busy,autoFocus:t,onValidate:this.onEmailValidate,fieldRef:e=>{this[I.Email]=e}});case I.MatrixId:return a.error=this.props.loginIncorrect&&!this.props.username,r.a.createElement(S.a,{id:"mx_LoginForm_username",className:c()(a),name:"username",autoComplete:"username",key:"username_input",type:"text",label:Object(u.a)("Username"),placeholder:Object(u.a)("Username").toLocaleLowerCase(),value:this.props.username,onChange:this.onUsernameChanged,onBlur:this.onUsernameBlur,disabled:this.props.busy,autoFocus:t,onValidate:this.onUsernameValidate,ref:e=>{this[I.MatrixId]=e}});case I.Phone:{a.error=this.props.loginIncorrect&&!this.props.phoneNumber;const e=r.a.createElement(O.a,{value:this.props.phoneCountry,isSmall:!0,showPrefix:!0,onOptionChange:this.onPhoneCountryChanged});return r.a.createElement(S.a,{id:"mx_LoginForm_phone",className:c()(a),name:"phoneNumber",autoComplete:"tel-national",key:"phone_input",type:"text",label:Object(u.a)("Phone"),value:this.props.phoneNumber,prefixComponent:e,onChange:this.onPhoneNumberChanged,disabled:this.props.busy,autoFocus:t,onValidate:this.onPhoneNumberValidate,ref:e=>{this[I.Password]=e}})}}}isLoginEmpty(){switch(this.state.loginType){case I.Email:case I.MatrixId:return!this.props.username;case I.Phone:return!this.props.phoneCountry||!this.props.phoneNumber}}render(){let e;this.props.onForgotPasswordClick&&(e=r.a.createElement(_.a,{className:"mx_Login_forgot",disabled:this.props.busy,kind:"link",onClick:this.onForgotPasswordClick},Object(u.a)("Forgot password?")));const t=c()({error:this.props.loginIncorrect&&!this.isLoginEmpty()}),a=!this.isLoginEmpty(),n=this.renderLoginField(this.state.loginType,!a);let i;return p.b.get().disable_3pid_login||(i=r.a.createElement("div",{className:"mx_Login_type_container"},r.a.createElement("label",{className:"mx_Login_type_label"},Object(u.a)("Sign in with")),r.a.createElement(S.a,{element:"select",value:this.state.loginType,onChange:this.onLoginTypeChange,disabled:this.props.busy},r.a.createElement("option",{key:I.MatrixId,value:I.MatrixId},Object(u.a)("Username")),r.a.createElement("option",{key:I.Email,value:I.Email},Object(u.a)("Email address")),r.a.createElement("option",{key:I.Password,value:I.Password},Object(u.a)("Phone"))))),r.a.createElement("div",null,r.a.createElement("form",{onSubmit:this.onSubmitForm},i,n,r.a.createElement(S.a,{id:"mx_LoginForm_password",className:t,autoComplete:"current-password",type:"password",name:"password",label:Object(u.a)("Password"),value:this.state.password,onChange:this.onPasswordChanged,disabled:this.props.busy,autoFocus:a,onValidate:this.onPasswordValidate,ref:e=>this[I.Password]=e}),e,!this.props.busy&&r.a.createElement("input",{className:"mx_Login_submit",type:"submit",value:Object(u.a)("Sign in"),disabled:this.props.disableSubmit})))}}i()(T,"defaultProps",{onUsernameChanged:function(){},onUsernameBlur:function(){},onPhoneCountryChanged:function(){},onPhoneNumberChanged:function(){},loginIncorrect:!1,disableSubmit:!1});var N=a(206),P=a(134),D=a(640),M=a(931),A=a(481),L=a(480),U=a(146);function F(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function B(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?F(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):F(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}Object(u.c)("Invalid homeserver discovery response"),Object(u.c)("Failed to get autodiscovery configuration from server"),Object(u.c)("Invalid base_url for m.homeserver"),Object(u.c)("Homeserver URL does not appear to be a valid Matrix homeserver"),Object(u.c)("Invalid identity server discovery response"),Object(u.c)("Invalid base_url for m.identity_server"),Object(u.c)("Identity server URL does not appear to be a valid identity server"),Object(u.c)("General failure");class V extends r.a.PureComponent{constructor(e){super(e),i()(this,"unmounted",!1),i()(this,"loginLogic",void 0),i()(this,"stepRendererMap",void 0),i()(this,"isBusy",(()=>!!this.state.busy||!!this.props.busy)),i()(this,"onPasswordLogin",(async(e,t,a,n)=>{if(!this.state.serverIsAlive){this.setState({busy:!0});let e=!0;try{await v.a.validateServerConfigWithStaticUrls(this.props.serverConfig.hsUrl,this.props.serverConfig.isUrl),this.setState({serverIsAlive:!0,errorText:""})}catch(t){const a=v.a.authComponentStateForError(t);this.setState(B({busy:!1,busyLoggingIn:!1},a)),e=!a.serverErrorIsFatal}if(!e)return}this.setState({busy:!0,busyLoggingIn:!0,errorText:null,loginIncorrect:!1}),this.loginLogic.loginViaPassword(e,t,a,n).then((e=>{this.setState({serverIsAlive:!0}),this.props.onLoggedIn(e,n)}),(t=>{if(this.unmounted)return;let a;const n=(null==e?void 0:e.indexOf("@"))>0;if(400===t.httpStatus&&n)a=Object(u.a)("This homeserver does not support login using email address.");else if("M_RESOURCE_LIMIT_EXCEEDED"===t.errcode){const e=Object(g.a)(t.data.limit_type,t.data.admin_contact,{monthly_active_user:Object(u.c)("This homeserver has hit its Monthly Active User limit."),hs_blocked:Object(u.c)("This homeserver has been blocked by its administrator."),"":Object(u.c)("This homeserver has exceeded one of its resource limits.")}),n=Object(g.a)(t.data.limit_type,t.data.admin_contact,{"":Object(u.c)("Please <a>contact your service administrator</a> to continue using this service.")});a=r.a.createElement("div",null,r.a.createElement("div",null,e),r.a.createElement("div",{className:"mx_Login_smallError"},n))}else a=401===t.httpStatus||403===t.httpStatus?"M_USER_DEACTIVATED"===t.errcode?Object(u.a)("This account has been deactivated."):p.b.get("disable_custom_urls")?r.a.createElement("div",null,r.a.createElement("div",null,Object(u.a)("Incorrect username and/or password.")),r.a.createElement("div",{className:"mx_Login_smallError"},Object(u.a)("Please note you are logging into the %(hs)s server, not matrix.org.",{hs:this.props.serverConfig.hsName}))):Object(u.a)("Incorrect username and/or password."):this.errorTextFromError(t);this.setState({busy:!1,busyLoggingIn:!1,errorText:a,loginIncorrect:401===t.httpStatus||403===t.httpStatus})}))})),i()(this,"onUsernameChanged",(e=>{this.setState({username:e})})),i()(this,"onUsernameBlur",(async e=>{const t="@"===e[0];if(this.setState({username:e,busy:t,errorText:null,canTryLogin:!0}),t){const t=e.split(":").slice(1).join(":");try{const e=await v.a.validateServerName(t);this.props.onServerConfigChange(e),this.setState({busy:!1})}catch(e){d.a.error("Problem parsing URL or unhandled error doing .well-known discovery:",e);let t=Object(u.a)("Failed to perform homeserver discovery");e.translatedMessage&&(t=e.translatedMessage);let a=t,n={};v.a.isLivelinessError(e)&&(a=this.state.errorText,n=v.a.authComponentStateForError(e)),this.setState(B({busy:!1,errorText:a},n))}}})),i()(this,"onPhoneCountryChanged",(e=>{this.setState({phoneCountry:e})})),i()(this,"onPhoneNumberChanged",(e=>{this.setState({phoneNumber:e})})),i()(this,"onRegisterClick",(e=>{e.preventDefault(),e.stopPropagation(),this.props.onRegisterClick()})),i()(this,"onTryRegisterClick",(e=>{var t,a;const n=null===(t=this.state.flows)||void 0===t?void 0:t.find((e=>"m.login.password"===e.type)),i=null===(a=this.state.flows)||void 0===a?void 0:a.find((e=>"m.login.sso"===e.type||"m.login.cas"===e.type));if(i&&!n){var s;e.preventDefault(),e.stopPropagation();const t="m.login.sso"===i.type?"sso":"cas";null===(s=f.a.get())||void 0===s||s.startSingleSignOn(this.loginLogic.createTemporaryClient(),t,this.props.fragmentAfterLogin,m.c.REGISTER)}else this.onRegisterClick(e)})),i()(this,"isSupportedFlow",(e=>!!this.stepRendererMap[e.type]||(d.a.log("Skipping flow",e,"due to unsupported login type",e.type),!1))),i()(this,"renderPasswordStep",(()=>r.a.createElement(T,{onSubmit:this.onPasswordLogin,username:this.state.username,phoneCountry:this.state.phoneCountry,phoneNumber:this.state.phoneNumber,onUsernameChanged:this.onUsernameChanged,onUsernameBlur:this.onUsernameBlur,onPhoneCountryChanged:this.onPhoneCountryChanged,onPhoneNumberChanged:this.onPhoneNumberChanged,onForgotPasswordClick:this.props.onForgotPasswordClick,loginIncorrect:this.state.loginIncorrect,serverConfig:this.props.serverConfig,disableSubmit:this.isBusy(),busy:this.props.isSyncing||this.state.busyLoggingIn}))),i()(this,"renderSsoStep",(e=>{const t=this.state.flows.find((t=>t.type==="m.login."+e));return r.a.createElement(D.a,{matrixClient:this.loginLogic.createTemporaryClient(),flow:t,loginType:e,fragmentAfterLogin:this.props.fragmentAfterLogin,primary:!this.state.flows.find((e=>"m.login.password"===e.type)),action:m.c.LOGIN})})),this.state={busy:!1,errorText:null,loginIncorrect:!1,canTryLogin:!0,username:e.defaultUsername?e.defaultUsername:"",phoneNumber:"",serverIsAlive:!0,serverErrorIsFatal:!1,serverDeadError:""},this.stepRendererMap={"m.login.password":this.renderPasswordStep,"m.login.cas":()=>this.renderSsoStep("cas"),"m.login.sso":()=>this.renderSsoStep("sso")}}componentDidMount(){this.initLoginLogic(this.props.serverConfig)}componentWillUnmount(){this.unmounted=!0}componentDidUpdate(e){e.serverConfig.hsUrl===this.props.serverConfig.hsUrl&&e.serverConfig.isUrl===this.props.serverConfig.isUrl||this.initLoginLogic(this.props.serverConfig)}async initLoginLogic(e){let{hsUrl:t,isUrl:a}=e,n=!1;this.props.serverConfig.isDefault&&t===this.props.serverConfig.hsUrl&&a===this.props.serverConfig.isUrl&&(n=!0);const i=n?this.props.fallbackHsUrl:null,s=new h.a(t,a,i,{defaultDeviceDisplayName:this.props.defaultDeviceDisplayName});this.loginLogic=s,this.setState({busy:!0,loginIncorrect:!1});try{const{warning:e}=await v.a.validateServerConfigWithStaticUrls(t,a);e?this.setState(B(B({},v.a.authComponentStateForError(e)),{},{errorText:""})):this.setState({serverIsAlive:!0,errorText:""})}catch(e){this.setState(B({busy:!1},v.a.authComponentStateForError(e)))}s.getFlows().then((e=>{const t=e.filter(this.isSupportedFlow);t.length>0?this.setState({flows:t}):this.setState({errorText:Object(u.a)("This homeserver doesn't offer any login flows which are supported by this client.")})}),(e=>{this.setState({errorText:this.errorTextFromError(e),loginIncorrect:!1,canTryLogin:!1})})).finally((()=>{this.setState({busy:!1})}))}errorTextFromError(e){let t=e.errcode;!t&&e.httpStatus&&(t="HTTP "+e.httpStatus);let a=Object(u.a)("There was a problem communicating with the homeserver, please try again later.")+(t?" ("+t+")":"");return e instanceof o.b&&(a="https:"!==window.location.protocol||!this.props.serverConfig.hsUrl.startsWith("http:")&&this.props.serverConfig.hsUrl.startsWith("http")?r.a.createElement("span",null,Object(u.a)("Can't connect to homeserver - please check your connectivity, ensure your <a>homeserver's SSL certificate</a> is trusted, and that a browser extension is not blocking requests.",{},{a:e=>r.a.createElement("a",{target:"_blank",rel:"noreferrer noopener",href:this.props.serverConfig.hsUrl},e)})):r.a.createElement("span",null,Object(u.a)("Can't connect to homeserver via HTTP when an HTTPS URL is in your browser bar. Either use HTTPS or <a>enable unsafe scripts</a>.",{},{a:e=>r.a.createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://www.google.com/search?&q=enable%20unsafe%20scripts"},e)}))),a}renderLoginComponentForFlows(){if(!this.state.flows)return null;const e=Object(U.n)(["m.login.password","m.login.sso"].map((e=>this.state.flows.find((t=>t.type===e)))));return r.a.createElement(r.a.Fragment,null,e.map((e=>{const t=this.stepRendererMap[e.type];return r.a.createElement(r.a.Fragment,{key:e.type},t())})))}render(){const e=this.isBusy()&&!this.state.busyLoggingIn?r.a.createElement("div",{className:"mx_Login_loader"},r.a.createElement(P.a,null)):null,t=this.state.errorText;let a,n,i;if(t&&(a=r.a.createElement("div",{className:"mx_Login_error"},t)),!this.state.serverIsAlive){const e=c()({mx_Login_error:!0,mx_Login_serverError:!0,mx_Login_serverErrorNonFatal:!this.state.serverErrorIsFatal});n=r.a.createElement("div",{className:e},this.state.serverDeadError)}return this.props.isSyncing||this.state.busyLoggingIn?i=r.a.createElement("div",{className:"mx_AuthBody_paddedFooter"},r.a.createElement("div",{className:"mx_AuthBody_paddedFooter_title"},r.a.createElement(N.a,{w:20,h:20}),this.props.isSyncing?Object(u.a)("Syncing…"):Object(u.a)("Signing In…")),this.props.isSyncing&&r.a.createElement("div",{className:"mx_AuthBody_paddedFooter_subtitle"},Object(u.a)("If you've joined lots of rooms, this might take a while"))):y.b.getValue(E.b.Registration)&&(i=r.a.createElement("span",{className:"mx_AuthBody_changeFlow"},Object(u.a)("New? <a>Create account</a>",{},{a:e=>r.a.createElement(_.a,{kind:"link_inline",onClick:this.onTryRegisterClick},e)}))),r.a.createElement(b.a,null,r.a.createElement(L.a,{disableLanguageSelector:this.props.isSyncing||this.state.busyLoggingIn}),r.a.createElement(A.a,null,r.a.createElement("h1",null,Object(u.a)("Sign in"),e),a,n,r.a.createElement(M.a,{serverConfig:this.props.serverConfig,onServerConfigChange:this.props.onServerConfigChange}),this.renderLoginComponentForFlows(),i))}}},1559:function(e,t,a){"use strict";a.d(t,"b",(function(){return o})),a.d(t,"a",(function(){return r}));var n=a(13),i=a.n(n),s=a(1);let r;!function(e){e.APP_STARTUP="mx_AppStartup",e.PAGE_CHANGE="mx_PageChange",e.RESEND_EVENT="mx_ResendEvent",e.SEND_E2EE_EVENT="mx_SendE2EEEvent",e.SEND_ATTACHMENT="mx_SendAttachment",e.SWITCH_ROOM="mx_SwithRoom",e.JUMP_TO_ROOM="mx_JumpToRoom",e.JOIN_ROOM="mx_JoinRoom",e.CREATE_DM="mx_CreateDM",e.PEEK_ROOM="mx_PeekRoom",e.VERIFY_E2EE_USER="mx_VerifyE2EEUser",e.LOGIN="mx_Login",e.REGISTER="mx_Register",e.SETUP_VOIP_CALL="mx_SetupVoIPCall"}(r||(r={}));class o{constructor(){i()(this,"START_PREFIX","start:"),i()(this,"STOP_PREFIX","stop:"),i()(this,"listeners",[]),i()(this,"entries",[])}static get instance(){return o._instance||(o._instance=new o),o._instance}start(e,t){if(!this.supportsPerformanceApi())return;const a=this.buildKey(e,t);performance.getEntriesByName(this.START_PREFIX+a).length>0?s.a.warn(`Recording already started for: ${e}`):performance.mark(this.START_PREFIX+a)}stop(e,t){if(!this.supportsPerformanceApi())return;const a=this.buildKey(e,t);if(0===performance.getEntriesByName(this.START_PREFIX+a).length)return void s.a.warn(`No recording started for: ${e}`);performance.mark(this.STOP_PREFIX+a),performance.measure(a,this.START_PREFIX+a,this.STOP_PREFIX+a),this.clear(e,t);const n=performance.getEntriesByName(a).pop();return this.entries.push(n),this.listeners.forEach((e=>{this.shouldEmit(e,n)&&e.callback([n])})),n}clear(e,t){if(!this.supportsPerformanceApi())return;const a=this.buildKey(e,t);performance.clearMarks(this.START_PREFIX+a),performance.clearMarks(this.STOP_PREFIX+a)}getEntries(){let{name:e,type:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.entries.filter((a=>{const n=!e||a.name===e,i=!t||a.entryType===t;return n&&i}))}addPerformanceDataCallback(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.listeners.push(e),t){const t=this.entries.filter((t=>this.shouldEmit(e,t)));t.length>0&&e.callback(t)}}removePerformanceDataCallback(e){e?this.listeners.splice(this.listeners.findIndex((t=>t.callback===e)),1):this.listeners=[]}supportsPerformanceApi(){return void 0!==performance&&void 0!==performance.mark}shouldEmit(e,t){return!e.entryNames||e.entryNames.includes(t.name)}buildKey(e,t){return`${e}${t?`:${t}`:""}`}}i()(o,"_instance",void 0),window.mxPerformanceMonitor=o.instance,window.mxPerformanceEntryNames=r},1560:function(e,t,a){"use strict";a.d(t,"a",(function(){return k}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(1),l=a(343),c=a(121),d=a(124),m=a(470),u=a(127),h=a(122),p=a(471),g=a(318),v=a(342),b=a(640),f=a(135),y=a(145);class E extends r.a.Component{constructor(){super(...arguments),i()(this,"onConfirm",(()=>{this.props.onFinished(!0)})),i()(this,"onDecline",(()=>{this.props.onFinished(!1)}))}render(){return r.a.createElement(f.a,{className:"mx_ConfirmWipeDeviceDialog",hasCancel:!0,onFinished:this.props.onFinished,title:Object(c.a)("Clear all data in this session?")},r.a.createElement("div",{className:"mx_ConfirmWipeDeviceDialog_content"},r.a.createElement("p",null,Object(c.a)("Clearing all data from this session is permanent. Encrypted messages will be lost unless their keys have been backed up."))),r.a.createElement(y.a,{primaryButton:Object(c.a)("Clear all data"),onPrimaryButtonClick:this.onConfirm,primaryButtonClass:"danger",cancelButton:Object(c.a)("Cancel"),onCancel:this.onDecline}))}}var _,w=a(139),S=a(123),O=a(134),C=a(480),x=a(481);!function(e){e[e.Loading=0]="Loading",e[e.Password=1]="Password",e[e.CAS=2]="CAS",e[e.SSO=3]="SSO",e[e.PasswordWithSocialSignOn=4]="PasswordWithSocialSignOn",e[e.Unsupported=5]="Unsupported"}(_||(_={}));const j={"m.login.password":_.Password,"m.login.cas":_.CAS,"m.login.sso":_.SSO};class k extends r.a.Component{constructor(e){super(e),i()(this,"onClearAll",(()=>{u.b.createDialog(E,{onFinished:e=>{e&&(o.a.log("Clearing data from soft-logged-out session"),m.i())}})})),i()(this,"onPasswordChange",(e=>{this.setState({password:e.target.value})})),i()(this,"onForgotPassword",(()=>{d.a.dispatch({action:"start_password_recovery"})})),i()(this,"onPasswordLogin",(async e=>{e.preventDefault(),e.stopPropagation(),this.setState({busy:!0});const t=h.a.get().getHomeserverUrl(),a=h.a.get().getIdentityServerUrl(),n={identifier:{type:"m.id.user",user:h.a.get().getUserId()},password:this.state.password,device_id:h.a.get().getDeviceId()};let i=null;try{i=await Object(p.b)(t,a,"m.login.password",n)}catch(e){let t=Object(c.a)("Failed to re-authenticate due to a homeserver problem");return"M_FORBIDDEN"!==e.errcode||401!==e.httpStatus&&403!==e.httpStatus||(t=Object(c.a)("Incorrect password")),void this.setState({busy:!1,errorText:t})}m.e(i).catch((e=>{o.a.error(e),this.setState({busy:!1,errorText:Object(c.a)("Failed to re-authenticate")})}))})),this.state={loginView:_.Loading,keyBackupNeeded:!0,busy:!1,password:"",errorText:"",flows:[]}}componentDidMount(){if(!m.g())return void d.a.dispatch({action:"start_login"});this.initLogin();const e=h.a.get();e.isCryptoEnabled()&&e.countSessionsNeedingBackup().then((e=>{this.setState({keyBackupNeeded:e>0})}))}async initLogin(){const e=this.props.realQueryParams;if(e&&e.loginToken)return this.setState({loginView:_.Loading}),void this.trySsoLogin();const t=h.a.get(),a=(await t.loginFlows()).flows,n=a.map((e=>j[e.type])),i=n.includes(_.Password)&&n.includes(_.SSO),s=n.filter((e=>!!e))[0]||_.Unsupported,r=i?_.PasswordWithSocialSignOn:s;this.setState({flows:a,loginView:r})}async trySsoLogin(){this.setState({busy:!0});const e=localStorage.getItem(v.a),t=localStorage.getItem(v.c)||h.a.get().getIdentityServerUrl(),a={token:this.props.realQueryParams.loginToken,device_id:h.a.get().getDeviceId()};let n=null;try{n=await Object(p.b)(e,t,"m.login.token",a)}catch(e){return o.a.error(e),void this.setState({busy:!1,loginView:_.Unsupported})}m.e(n).then((()=>{this.props.onTokenLoginCompleted&&this.props.onTokenLoginCompleted()})).catch((e=>{o.a.error(e),this.setState({busy:!1,loginView:_.Unsupported})}))}renderPasswordForm(e){let t=null;return this.state.errorText&&(t=r.a.createElement("span",{className:"mx_Login_error"},this.state.errorText)),r.a.createElement("form",{onSubmit:this.onPasswordLogin},e?r.a.createElement("p",null,e):null,t,r.a.createElement(w.a,{type:"password",label:Object(c.a)("Password"),onChange:this.onPasswordChange,value:this.state.password,disabled:this.state.busy}),r.a.createElement(S.a,{onClick:this.onPasswordLogin,kind:"primary",type:"submit",disabled:this.state.busy},Object(c.a)("Sign In")),r.a.createElement(S.a,{onClick:this.onForgotPassword,kind:"link"},Object(c.a)("Forgotten your password?")))}renderSsoForm(e){const t=this.state.loginView===_.CAS?"cas":"sso",a=this.state.flows.find((e=>e.type==="m.login."+t));return r.a.createElement("div",null,e?r.a.createElement("p",null,e):null,r.a.createElement(b.a,{matrixClient:h.a.get(),flow:a,loginType:t,fragmentAfterLogin:this.props.fragmentAfterLogin,primary:!this.state.flows.find((e=>"m.login.password"===e.type)),action:l.c.LOGIN}))}renderSignInSection(){if(this.state.loginView===_.Loading)return r.a.createElement(O.a,null);let e=null;return this.state.keyBackupNeeded&&(e=Object(c.a)("Regain access to your account and recover encryption keys stored in this session. Without them, you won't be able to read all of your secure messages in any session.")),this.state.loginView===_.Password?(e||(e=Object(c.a)("Enter your password to sign in and regain access to your account.")),this.renderPasswordForm(e)):this.state.loginView===_.SSO||this.state.loginView===_.CAS?(e||(e=Object(c.a)("Sign in and regain access to your account.")),this.renderSsoForm(e)):this.state.loginView===_.PasswordWithSocialSignOn?(e||(e=Object(c.a)("Sign in and regain access to your account.")),r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,e),this.renderSsoForm(null),r.a.createElement("h2",{className:"mx_AuthBody_centered"},Object(c.a)("%(ssoButtons)s Or %(usernamePassword)s",{ssoButtons:"",usernamePassword:""}).trim()),this.renderPasswordForm(null))):r.a.createElement("p",null,Object(c.a)("You cannot sign in to your account. Please contact your homeserver admin for more information."))}render(){return r.a.createElement(g.a,null,r.a.createElement(C.a,null),r.a.createElement(x.a,null,r.a.createElement("h1",null,Object(c.a)("You're signed out")),r.a.createElement("h2",null,Object(c.a)("Sign in")),r.a.createElement("div",null,this.renderSignInSection()),r.a.createElement("h2",null,Object(c.a)("Clear personal data")),r.a.createElement("p",null,Object(c.a)("Warning: your personal data (including encryption keys) is still stored in this session. Clear it if you're finished using this session, or want to sign in to another account.")),r.a.createElement("div",null,r.a.createElement(S.a,{onClick:this.onClearAll,kind:"danger"},Object(c.a)("Clear all data")))))}}},1563:function(e,t,a){"use strict";a.d(t,"a",(function(){return N}));var n=a(13),i=a.n(n),s=a(149),r=a(120),o=a.n(r),l=a(445),c=a(121),d=a(122),m=a(127),u=a(131),h=a(137),p=a(125),g=a(130),v=a.n(g),b=a(126),f=a.n(b),y=a(150);function E(e){let{label:t,description:a,onClick:n,isSelected:i,adornment:s}=e;return o.a.createElement(l.a,{active:i,className:"mx_GenericDropdownMenu_Option mx_GenericDropdownMenu_Option--item",onClick:n},o.a.createElement("div",{className:"mx_GenericDropdownMenu_Option--label"},o.a.createElement("span",null,t),o.a.createElement("span",null,a)),s)}function _(e){let{label:t,description:a,adornment:n,children:i}=e;return o.a.createElement(o.a.Fragment,null,o.a.createElement("div",{className:"mx_GenericDropdownMenu_Option mx_GenericDropdownMenu_Option--header"},o.a.createElement("div",{className:"mx_GenericDropdownMenu_Option--label"},o.a.createElement("span",null,t),o.a.createElement("span",null,a)),n),i)}function w(e){return"options"in e}function S(e){let{value:t,onChange:a,options:n,selectedLabel:i,onOpen:s,onClose:r,toKey:l,className:c,AdditionalOptions:d}=e;const[m,u,h,p]=Object(y.q)(),g=n.flatMap((e=>w(e)?[e,...e.options]:[e])).find((e=>l?l(e.key)===l(t):e.key===t));let b;b=n&&w(n[0])?o.a.createElement(o.a.Fragment,null,n.map((e=>{var t;return o.a.createElement(_,{key:null!==(t=null==l?void 0:l(e.key))&&void 0!==t?t:e.key,label:e.label,description:e.description,adornment:e.adornment},e.options.map((e=>{var t;return o.a.createElement(E,{key:null!==(t=null==l?void 0:l(e.key))&&void 0!==t?t:e.key,label:e.label,description:e.description,onClick:t=>{a(e.key),p(),null==r||r(t)},adornment:e.adornment,isSelected:e===g})})))}))):o.a.createElement(o.a.Fragment,null,n.map((e=>{var t;return o.a.createElement(E,{key:null!==(t=null==l?void 0:l(e.key))&&void 0!==t?t:e.key,label:e.label,description:e.description,onClick:t=>{a(e.key),p(),null==r||r(t)},adornment:e.adornment,isSelected:e===g})})));const S=m?o.a.createElement(y.n,v()({onFinished:p,chevronFace:y.a.Top,wrapperClassName:f()("mx_GenericDropdownMenu_wrapper",c)},Object(y.i)(u.current.getBoundingClientRect())),b,d&&o.a.createElement(d,{menuDisplayed:m,openMenu:h,closeMenu:p})):null;return o.a.createElement(o.a.Fragment,null,o.a.createElement(y.b,{className:"mx_GenericDropdownMenu_button",inputRef:u,isExpanded:m,onClick:e=>{h(),null==s||s(e)}},i(g)),S)}var O=a(560),C=a(123),x=a(200);function j(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}const k="room_directory_servers",R=Object(x.a)({deriveData:async e=>{let{value:t}=e;try{return await d.a.get().publicRooms({limit:1,server:t}),{}}catch(e){return{error:e}}},rules:[{key:"required",test:async e=>{let{value:t}=e;return!!t},invalid:()=>Object(c.a)("Enter a server name")},{key:"available",final:!0,test:async(e,t)=>{let{error:a}=t;return!a},valid:()=>Object(c.a)("Looks good"),invalid:e=>{let{error:t}=e;return"M_FORBIDDEN"===(null==t?void 0:t.errcode)?Object(c.a)("You are not allowed to view this server's rooms list"):Object(c.a)("Can't find this server or its room list")}}]});function I(e){for(var t=arguments.length,a=new Array(t>1?t-1:0),n=1;n<t;n++)a[n-1]=arguments[n];for(const t of a)e.delete(t)}function T(){var e,t;const[a,n]=function(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const[i,s]=Object(r.useState)(p.b.getValue(e,null!=a?a:void 0,n)),o=Object(r.useCallback)((async n=>{s(n),p.b.setValue(e,a,t,n)}),[t,a,e]);return Object(r.useEffect)((()=>{const t=p.b.watchSetting(e,a,(()=>{s(p.b.getValue(e,a,n))}));return()=>{p.b.unwatchSetting(t)}}),[e,a,n]),[i,o]}(k,h.a.ACCOUNT),i=d.a.getHomeserverName(),s=new Set(null!==(e=null===(t=u.b.getObject("room_directory"))||void 0===t?void 0:t.get("servers"))&&void 0!==e?e:[]);I(s,i);const o=new Set(a);return I(o,i),I(o,...s),{allServers:[i,...Array.from(s).sort(),...Array.from(o).sort()],homeServer:i,userDefinedServers:Array.from(o).sort(),setUserDefinedServers:n}}const N=e=>{let{protocols:t,config:a,setConfig:n}=e;const{allServers:d,homeServer:u,userDefinedServers:h,setUserDefinedServers:p}=T(),g=d.map((e=>function(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?j(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):j(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}({key:{roomServer:e,instanceId:null},label:e,description:e===u?Object(c.a)("Your server"):null,options:[{key:{roomServer:e,instanceId:void 0},label:Object(c.a)("Matrix")},...e===u&&t?Object.values(t).flatMap((e=>e.instances)).map((t=>({key:{roomServer:e,instanceId:t.instance_id},label:t.desc}))):[]]},h.includes(e)?{adornment:o.a.createElement(C.a,{className:"mx_NetworkDropdown_removeServer",alt:Object(c.a)("Remove server “%(roomServer)s”",{roomServer:e}),onClick:()=>p(Object(s.without)(h,e))})}:{}))),v=Object(r.useCallback)((e=>{let{closeMenu:t}=e;return o.a.createElement(o.a.Fragment,null,o.a.createElement("span",{className:"mx_GenericDropdownMenu_divider"}),o.a.createElement(l.a,{active:!1,className:"mx_GenericDropdownMenu_Option mx_GenericDropdownMenu_Option--item",onClick:async()=>{t();const{finished:e}=m.b.createDialog(O.a,{title:Object(c.a)("Add a new server"),description:Object(c.a)("Enter the name of a new server you want to explore."),button:Object(c.a)("Add"),hasCancel:!1,placeholder:Object(c.a)("Server name"),validator:R,fixedWidth:!1},"mx_NetworkDropdown_dialog"),[a,i]=await e;a&&(d.includes(i)||(p([...h,i]),n({roomServer:i})))}},o.a.createElement("div",{className:"mx_GenericDropdownMenu_Option--label"},o.a.createElement("span",{className:"mx_NetworkDropdown_addServer"},Object(c.a)("Add new server…")))))}),[d,n,p,h]);return o.a.createElement(S,{className:"mx_NetworkDropdown_wrapper",value:a,toKey:e=>e?`${e.roomServer}-${e.instanceId}`:"null",options:g,onChange:e=>n(e),selectedLabel:e=>null!=e&&e.key?Object(c.a)("Show: %(instance)s rooms (%(server)s)",{server:e.key.roomServer,instance:e.key.instanceId?e.label:"Matrix"}):Object(c.a)("Show: Matrix rooms"),AdditionalOptions:v})}},282:function(e,t,a){"use strict";var n=a(120),i=a.n(n),s=a(140),r=a(141);t.a=e=>{let{room:t,children:a}=e;const[o,l]=Object(n.useState)(null==t?void 0:t.name);return Object(r.c)(t,s.d.Name,(()=>{l(null==t?void 0:t.name)})),Object(n.useEffect)((()=>{l(null==t?void 0:t.name)}),[t]),a?a(o):i.a.createElement(i.a.Fragment,null,o||"")}},311:function(e,t,a){"use strict";var n=a(171).default;t.__esModule=!0,t.default=t.ReactReduxContext=void 0;var i=n(a(120)).default.createContext(null);t.ReactReduxContext=i;var s=i;t.default=s},316:function(e,t,a){"use strict";var n=a(13),i=a.n(n),s=a(1),r=a(157),o=a(17),l=a(184),c=a(179),d=a(140),m=a(151),u=a(16),h=a(129),p=a(147),g=a(122),v=a(125),b=a(137);class f extends o.EventEmitter{constructor(){super(...arguments),i()(this,"crawlerCheckpoints",[]),i()(this,"crawler",null),i()(this,"currentCheckpoint",null),i()(this,"onSync",(async(e,t,a)=>{var n;const i=null===(n=r.a.get())||void 0===n?void 0:n.getEventIndexingManager();if(i){if("PREPARED"===t&&"SYNCING"===e){return await i.isEventIndexEmpty()&&await this.addInitialCheckpoints(),void this.startCrawler()}"SYNCING"===t&&"SYNCING"===e&&await i.commitLiveEvents()}})),i()(this,"onRoomTimeline",(async(e,t,a,n,i)=>{if(!t)return;const s=g.a.get();return s.isRoomEncrypted(e.getRoomId())?e.isRedaction()?this.redactEvent(e):void(!a&&i&&i.liveEvent&&!e.isRedacted()&&(await s.decryptEventIfNeeded(e),await this.addLiveEventToIndex(e))):void 0})),i()(this,"onRoomStateEvent",(async(e,t)=>{g.a.get().isRoomEncrypted(t.roomId)&&(e.getType()!==h.b.RoomEncryption||await this.isRoomIndexed(t.roomId)||(s.a.log("EventIndex: Adding a checkpoint for a newly encrypted room",t.roomId),this.addRoomCheckpoint(t.roomId,!0)))})),i()(this,"redactEvent",(async e=>{var t;const a=null===(t=r.a.get())||void 0===t?void 0:t.getEventIndexingManager();if(a)try{await a.deleteEvent(e.getAssociatedId())}catch(e){s.a.log("EventIndex: Error deleting event from index",e)}})),i()(this,"onTimelineReset",(async e=>{e&&g.a.get().isRoomEncrypted(e.roomId)&&(s.a.log("EventIndex: Adding a checkpoint because of a limited timeline",e.roomId),this.addRoomCheckpoint(e.roomId,!1))}))}async init(){var e;const t=null===(e=r.a.get())||void 0===e?void 0:e.getEventIndexingManager();t&&(this.crawlerCheckpoints=await t.loadCheckpoints(),s.a.log("EventIndex: Loaded checkpoints",this.crawlerCheckpoints),this.registerListeners())}registerListeners(){const e=g.a.get();e.on(p.b.Sync,this.onSync),e.on(d.d.Timeline,this.onRoomTimeline),e.on(d.d.TimelineReset,this.onTimelineReset),e.on(m.b.Events,this.onRoomStateEvent)}removeListeners(){const e=g.a.get();null!==e&&(e.removeListener(p.b.Sync,this.onSync),e.removeListener(d.d.Timeline,this.onRoomTimeline),e.removeListener(d.d.TimelineReset,this.onTimelineReset),e.removeListener(m.b.Events,this.onRoomStateEvent))}async addInitialCheckpoints(){var e;const t=null===(e=r.a.get())||void 0===e?void 0:e.getEventIndexingManager();if(!t)return;const a=g.a.get(),n=a.getRooms().filter((e=>a.isRoomEncrypted(e.roomId)));s.a.log("EventIndex: Adding initial crawler checkpoints"),await Promise.all(n.map((async e=>{const a=e.getLiveTimeline().getPaginationToken(c.a.Backward),n={roomId:e.roomId,token:a,direction:c.a.Backward,fullCrawl:!0},i={roomId:e.roomId,token:a,direction:c.a.Forward};try{n.token&&(await t.addCrawlerCheckpoint(n),this.crawlerCheckpoints.push(n)),i.token&&(await t.addCrawlerCheckpoint(i),this.crawlerCheckpoints.push(i))}catch(t){s.a.log("EventIndex: Error adding initial checkpoints for room",e.roomId,n,i,t)}})))}isValidEvent(e){const t=[h.b.RoomMessage,h.b.RoomName,h.b.RoomTopic].includes(e.getType())&&!e.isRedacted()&&!e.isDecryptionFailure();let a=!0,n=!0;if(e.getType()!==h.b.RoomMessage||e.isRedacted())e.getType()!==h.b.RoomTopic||e.isRedacted()?e.getType()!==h.b.RoomName||e.isRedacted()||e.getContent().name||(n=!1):e.getContent().topic||(n=!1);else{const t=e.getContent().msgtype;a=!!t&&!t.startsWith("m.key.verification"),e.getContent().body||(n=!1)}return t&&a&&n}eventToJson(e){const t=e.toJSON(),a=e.isEncrypted()?t.decrypted:t;return e.isEncrypted()?(a.curve25519Key=e.getSenderKey(),a.ed25519Key=e.getClaimedEd25519Key(),a.algorithm=e.getWireContent().algorithm,a.forwardingCurve25519KeyChain=e.getForwardingCurve25519KeyChain()):(delete a.curve25519Key,delete a.ed25519Key,delete a.algorithm,delete a.forwardingCurve25519KeyChain),a}async addLiveEventToIndex(e){var t,a,n;const i=null===(t=r.a.get())||void 0===t?void 0:t.getEventIndexingManager();if(!i||!this.isValidEvent(e))return;const s=this.eventToJson(e),o={displayname:null===(a=e.sender)||void 0===a?void 0:a.rawDisplayName,avatar_url:null===(n=e.sender)||void 0===n?void 0:n.getMxcAvatarUrl()};await i.addEventToIndex(s,o)}emitNewCheckpoint(){this.emit("changedCheckpoint",this.currentRoom())}async addEventsFromLiveTimeline(e){const t=e.getEvents();for(let e=0;e<t.length;e++){const a=t[e];await this.addLiveEventToIndex(a)}}async addRoomCheckpoint(e){var t;let a=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=null===(t=r.a.get())||void 0===t?void 0:t.getEventIndexingManager();if(!n)return;const i=g.a.get().getRoom(e);if(!i)return;const o=i.getLiveTimeline(),l=o.getPaginationToken(c.a.Backward);if(!l)return void await this.addEventsFromLiveTimeline(o);const d={roomId:i.roomId,token:l,fullCrawl:a,direction:c.a.Backward};s.a.log("EventIndex: Adding checkpoint",d);try{await n.addCrawlerCheckpoint(d)}catch(e){s.a.log("EventIndex: Error adding new checkpoint for room",i.roomId,d,e)}this.crawlerCheckpoints.push(d)}async crawlerFunc(){var e;let t=!1;const a=g.a.get(),n=null===(e=r.a.get())||void 0===e?void 0:e.getEventIndexingManager();if(!n)return;this.crawler={cancel:()=>{t=!0}};let i=!1;for(;!t;){let e=v.b.getValueAt(b.a.DEVICE,"crawlerSleepTime");if(e=Math.max(e,100),i&&(e=5e3),null!==this.currentCheckpoint&&(this.currentCheckpoint=null,this.emitNewCheckpoint()),await Object(u.N)(e),t)break;const r=this.crawlerCheckpoints.shift();if(void 0===r){i=!0;continue}this.currentCheckpoint=r,this.emitNewCheckpoint(),i=!1;const o=a.getEventMapper({preventReEmit:!0});let l;try{l=await a.createMessagesRequest(r.roomId,r.token,100,r.direction)}catch(e){if(403===e.httpStatus){s.a.log("EventIndex: Removing checkpoint as we don't have ","permissions to fetch messages from this room.",r);try{await n.removeCrawlerCheckpoint(r)}catch(e){s.a.log("EventIndex: Error removing checkpoint",r,e)}continue}s.a.log("EventIndex: Error crawling using checkpoint:",r,",",e),this.crawlerCheckpoints.push(r);continue}if(t){this.crawlerCheckpoints.push(r);break}if(0===l.chunk.length){s.a.log("EventIndex: Done with the checkpoint",r);try{await n.removeCrawlerCheckpoint(r)}catch(e){s.a.log("EventIndex: Error removing checkpoint",r,e)}continue}const c=l.chunk.map(o);let d=[];void 0!==l.state&&(d=l.state.map(o));const m={};d.forEach((e=>{e.event.content&&"join"===e.event.content.membership&&(m[e.event.sender]={displayname:e.event.content.displayname,avatar_url:e.event.content.avatar_url})}));const h=c.filter((e=>e.isEncrypted())).map((e=>a.decryptEventIfNeeded(e,{isRetry:!0,emit:!1})));await Promise.all(h);const p=c.filter(this.isValidEvent),g=c.filter((e=>e.isRedaction())),f=p.map((e=>{const t=this.eventToJson(e);let a={};t.sender in m&&(a=m[t.sender]);return{event:t,profile:a}}));let y;l.end&&(y={roomId:r.roomId,token:l.end,fullCrawl:r.fullCrawl,direction:r.direction});try{for(let e=0;e<g.length;e++){const t=g[e],a=t.getAssociatedId();a?await n.deleteEvent(a):s.a.warn("EventIndex: Redaction event doesn't contain a valid associated event id",t)}const e=await n.addHistoricEvents(f,y,r);if(!y){s.a.log("EventIndex: The server didn't return a valid ","new checkpoint, not continuing the crawl.",r);continue}!0===e&&!0!==y.fullCrawl?(s.a.log("EventIndex: Checkpoint had already all events","added, stopping the crawl",r),await n.removeCrawlerCheckpoint(y)):(!0===e&&s.a.log("EventIndex: Checkpoint had already all events","added, but continuing due to a full crawl",r),this.crawlerCheckpoints.push(y))}catch(e){s.a.log("EventIndex: Error during a crawl",e),this.crawlerCheckpoints.push(r)}}this.crawler=null}startCrawler(){null===this.crawler&&this.crawlerFunc()}stopCrawler(){null!==this.crawler&&this.crawler.cancel()}async close(){var e;const t=null===(e=r.a.get())||void 0===e?void 0:e.getEventIndexingManager();this.removeListeners(),this.stopCrawler(),await(null==t?void 0:t.closeEventIndex())}async search(e){var t;const a=null===(t=r.a.get())||void 0===t?void 0:t.getEventIndexingManager();return null==a?void 0:a.searchEventIndex(e)}async loadFileEvents(e){var t;let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:c.b.BACKWARDS;const o=g.a.get(),d=null===(t=r.a.get())||void 0===t?void 0:t.getEventIndexingManager();if(!d)return[];const m={roomId:e.roomId,limit:a};let u;n&&(m.fromEvent=n,m.direction=i);try{u=await d.loadFileEvents(m)}catch(e){return s.a.log("EventIndex: Error getting file events",e),[]}const p=o.getEventMapper();return u.map((t=>{const a=p(t.event),n=new l.a(e.roomId,a.getSender());n.name=t.profile.displayname+" ("+a.getSender()+")";const i=p({content:{membership:"join",avatar_url:t.profile.avatar_url,displayname:t.profile.displayname},type:h.b.RoomMember,event_id:a.getId()+":eventIndex",room_id:a.getRoomId(),sender:a.getSender(),origin_server_ts:a.getTs(),state_key:a.getSender()});return n.events.member=i,a.sender=n,a}))}async populateFileTimeline(e,t,a){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10,i=arguments.length>4?arguments[4]:void 0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:c.b.BACKWARDS;const o=await this.loadFileEvents(a,n,i,r);null===i&&(o.reverse(),r=r==c.b.BACKWARDS?c.b.FORWARDS:c.b.BACKWARDS),o.forEach((a=>{e.eventIdToTimeline(a.getId())||e.addEventToTimeline(a,t,r==c.b.BACKWARDS)}));let l=!1,d="";return o.length>0&&(d=o[o.length-1].getId(),l=!0),s.a.log("EventIndex: Populating file panel with",o.length,"events and setting the pagination token to",d),t.setPaginationToken(d,c.b.BACKWARDS),l}paginateTimelineWindow(e,t,a,n){const i=t.getTimelineIndex(a);if(!i)return Promise.resolve(!1);if(i.pendingPaginate)return i.pendingPaginate;if(t.extend(a,n))return Promise.resolve(!0);const s=(async(e,t,a,n,i)=>{var s;const r=t.timeline,o=r.getTimelineSet(),l=null!==(s=r.getPaginationToken(n))&&void 0!==s?s:void 0,c=await this.populateFileTimeline(o,r,a,i,l,n);return t.pendingPaginate=void 0,e.extend(n,i),c})(t,i,e,a,n);return i.pendingPaginate=s,s}async getStats(){var e;const t=null===(e=r.a.get())||void 0===e?void 0:e.getEventIndexingManager();return null==t?void 0:t.getStats()}async isRoomIndexed(e){var t;const a=null===(t=r.a.get())||void 0===t?void 0:t.getEventIndexingManager();return null==a?void 0:a.isRoomIndexed(e)}currentRoom(){if(null===this.currentCheckpoint&&0===this.crawlerCheckpoints.length)return null;const e=g.a.get();return null!==this.currentCheckpoint?e.getRoom(this.currentCheckpoint.roomId):e.getRoom(this.crawlerCheckpoints[0].roomId)}crawlingRooms(){const e=new Set,t=new Set;this.crawlerCheckpoints.forEach(((e,a)=>{t.add(e.roomId)})),null!==this.currentCheckpoint&&t.add(this.currentCheckpoint.roomId);const a=g.a.get();return a.getRooms().filter((e=>a.isRoomEncrypted(e.roomId))).forEach(((t,a)=>{e.add(t.roomId)})),{crawlingRooms:t,totalRooms:e}}}class y{constructor(){i()(this,"index",null),i()(this,"error",null),i()(this,"_supportIsInstalled",!1)}async init(){var e;const t=null===(e=r.a.get())||void 0===e?void 0:e.getEventIndexingManager();return t?(this._supportIsInstalled=await t.supportsEventIndexing(),this.supportIsInstalled()?v.b.getValueAt(b.a.DEVICE,"enableEventIndexing")?this.initEventIndex():(s.a.log("EventIndex: Event indexing is disabled, not initializing"),!1):(s.a.log("EventIndex: Event indexing isn't installed for the platform, not initializing."),!1)):(s.a.log("EventIndex: Platform doesn't support event indexing, not initializing."),!1)}async initEventIndex(){var e;const t=new f,a=null===(e=r.a.get())||void 0===e?void 0:e.getEventIndexingManager(),n=g.a.get();if(!a||!n)throw new Error("Unable to init event index");const i=n.getUserId(),o=n.getDeviceId();try{await a.initEventIndex(i,o);const e=await a.getUserVersion(),n=await a.isEventIndexEmpty();n?await a.setUserVersion(1):0!==e||n||(await a.closeEventIndex(),await this.deleteEventIndex(),await a.initEventIndex(i,o),await a.setUserVersion(1)),s.a.log("EventIndex: Successfully initialized the event index"),await t.init()}catch(e){return s.a.log("EventIndex: Error initializing the event index",e),this.error=e,!1}return this.index=t,!0}platformHasSupport(){var e;return null!=(null===(e=r.a.get())||void 0===e?void 0:e.getEventIndexingManager())}supportIsInstalled(){return this._supportIsInstalled}get(){return this.index}start(){null!==this.index&&this.index.startCrawler()}stop(){null!==this.index&&this.index.stopCrawler()}async unset(){null!==this.index&&(await this.index.close(),this.index=null)}async deleteEventIndex(){var e;const t=null===(e=r.a.get())||void 0===e?void 0:e.getEventIndexingManager();t&&(await this.unset(),s.a.log("EventIndex: Deleting event index."),await t.deleteEventIndex())}}window.mxEventIndexPeg||(window.mxEventIndexPeg=new y);t.a=window.mxEventIndexPeg},32:function(e,t,a){"use strict";let n;a.d(t,"a",(function(){return n})),function(e){e.CanChangeViewedRoom="io.element.view_room",e.RequiresClient="io.element.requires_client"}(n||(n={}))},343:function(e,t,a){"use strict";a.d(t,"a",(function(){return n})),a.d(t,"b",(function(){return i})),a.d(t,"c",(function(){return s}));const n=new(a(15).c)("delegated_oidc_compatibility","org.matrix.msc3824.delegated_oidc_compatibility");let i,s;!function(e){e.Gitlab="gitlab",e.Github="github",e.Apple="apple",e.Google="google",e.Facebook="facebook",e.Twitter="twitter"}(i||(i={})),function(e){e.LOGIN="login",e.REGISTER="register"}(s||(s={}))},344:function(e,t,a){"use strict";let n;a.d(t,"a",(function(){return n})),function(e){e.Verified="Verified",e.Unverified="Unverified",e.Inactive="Inactive",e.Unverifiable="Unverifiable"}(n||(n={}))},345:function(e,t,a){"use strict";var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(126),l=a.n(o),c=a(131),d=a(200),m=a(121),u=a(139);class h extends s.PureComponent{constructor(){super(...arguments),i()(this,"validate",Object(d.a)({description:function(e){const t=e?e.score:0;return r.a.createElement("progress",{className:"mx_PassphraseField_progress",max:4,value:t})},deriveData:async e=>{let{value:t}=e;if(!t)return null;const{scorePassword:n}=await a.e(31).then(a.bind(null,915));return n(t)},rules:[{key:"required",test:e=>{let{value:t,allowEmpty:a}=e;return a||!!t},invalid:()=>Object(m.a)(this.props.labelEnterPassword)},{key:"complexity",test:async function(e,t){let{value:a}=e;if(!a||!t)return!1;const n=t.score>=this.props.minScore;return c.b.get("dangerously_allow_unsafe_and_insecure_passwords")||n},valid:function(e){return e&&e.score>=this.props.minScore?Object(m.a)(this.props.labelStrongPassword):Object(m.a)(this.props.labelAllowedButUnsafe)},invalid:function(e){if(!e)return null;const{feedback:t}=e;return t.warning||t.suggestions[0]||Object(m.a)("Keep going…")}}]})),i()(this,"onValidate",(async e=>{const t=await this.validate(e);return this.props.onValidate&&this.props.onValidate(t),t}))}render(){return r.a.createElement(u.a,{id:this.props.id,autoFocus:this.props.autoFocus,className:l()("mx_PassphraseField",this.props.className),ref:this.props.fieldRef,type:"password",autoComplete:"new-password",label:Object(m.a)(this.props.label),value:this.props.value,onChange:this.props.onChange,onValidate:this.onValidate})}}i()(h,"defaultProps",{label:Object(m.c)("Password"),labelEnterPassword:Object(m.c)("Enter password"),labelStrongPassword:Object(m.c)("Nice, strong password!"),labelAllowedButUnsafe:Object(m.c)("Password is allowed, but unsafe")}),t.a=h},346:function(e,t,a){"use strict";a.d(t,"a",(function(){return Ft}));var n=a(130),i=a.n(n),s=a(13),r=a.n(s),o=a(120),l=a.n(o),c=a(126),d=a.n(c),m=a(129),u=a(143),h=a(170),p=a(1),g=a(140),v=a(188),b=a(174),f=a(121),y=a(124),E=a(168),_=a(125),w=a(211),S=a(128),O=a(134),C=a(941),x=a(551),j=a(123),k=a(227),R=a(138),I=a(122);class T extends l.a.Component{constructor(e,t){super(e,t),r()(this,"context",void 0),r()(this,"unmounted",!1),r()(this,"room",void 0),r()(this,"blockquoteRef",l.a.createRef()),r()(this,"canCollapse",(()=>this.state.events.length>1)),r()(this,"collapse",(()=>{this.initialize()})),r()(this,"onQuoteClick",(async e=>{const t=[this.state.loadedEv,...this.state.events];let a=null;t.length>0&&(a=await this.getNextEvent(t[0])),this.setState({loadedEv:a,events:t}),y.a.fire(S.a.FocusSendMessageComposer)})),this.state={events:[],loadedEv:null,loading:!0,err:!1},this.room=this.matrixClient.getRoom(this.props.parentEv.getRoomId())}get matrixClient(){return I.a.get()}componentDidMount(){this.initialize(),this.trySetExpandableQuotes()}componentDidUpdate(){this.props.onHeightChanged(),this.trySetExpandableQuotes()}componentWillUnmount(){this.unmounted=!0}trySetExpandableQuotes(){if(void 0===this.props.isQuoteExpanded&&this.blockquoteRef.current){const e=this.blockquoteRef.current.querySelector(".mx_EventTile_body");if(e){const t=e.querySelector("code"),a=!!t&&t.offsetHeight>=60;(e.offsetHeight>=60||a)&&this.props.setQuoteExpanded(!1)}}}async initialize(){const{parentEv:e}=this.props,t=await this.getEvent(Object(k.b)(e));if(!this.unmounted)if(t){const e=await this.getNextEvent(t);this.setState({events:[t],loadedEv:e,loading:!1})}else this.setState({err:!0})}async getNextEvent(e){try{const t=Object(k.b)(e);return await this.getEvent(t)}catch(e){return null}}async getEvent(e){if(!e)return null;const t=this.room.findEventById(e);if(t)return t;try{await this.matrixClient.getEventTimeline(this.room.getUnfilteredTimelineSet(),e)}catch(e){return null}return this.room.findEventById(e)}getReplyChainColorClass(e){return Object(w.f)(e.getSender()).replace("Username","ReplyChain")}render(){let e=null;if(this.state.err)e=l.a.createElement("blockquote",{className:"mx_ReplyChain mx_ReplyChain_error"},Object(f.a)("Unable to load event that was replied to, it either does not exist or you do not have permission to view it."));else if(this.state.loadedEv&&Object(k.c)(this.state.events[0])){const t=this.state.loadedEv,a=this.matrixClient.getRoom(t.getRoomId());e=l.a.createElement("blockquote",{className:`mx_ReplyChain ${this.getReplyChainColorClass(t)}`},Object(f.a)("<a>In reply to</a> <pill>",{},{a:e=>l.a.createElement(j.a,{kind:"link_inline",className:"mx_ReplyChain_show",onClick:this.onQuoteClick},e),pill:l.a.createElement(x.b,{type:x.a.UserMention,room:a,url:Object(E.i)(t.getSender()),shouldShowPillAvatar:_.b.getValue("Pill.shouldShowPillAvatar")})}))}else if(this.props.forExport){const t=Object(k.b)(this.props.parentEv);e=l.a.createElement("p",{className:"mx_ReplyChain_Export"},Object(f.a)("In reply to <a>this message</a>",{},{a:e=>l.a.createElement("a",{className:"mx_reply_anchor",href:`#${t}`,"data-scroll-to":t}," ",e," ")}))}else this.state.loading&&(e=l.a.createElement(O.a,{w:16,h:16}));const{isQuoteExpanded:t}=this.props,a=this.state.events.map((e=>{const a=d()({mx_ReplyChain:!0,[this.getReplyChainColorClass(e)]:!0,"mx_ReplyChain--expanded":!0===t,"mx_ReplyChain--collapsed":!1===t});return l.a.createElement("blockquote",{ref:this.blockquoteRef,className:a,key:e.getId()},l.a.createElement(C.a,{mxEvent:e,onHeightChanged:this.props.onHeightChanged,permalinkCreator:this.props.permalinkCreator,toggleExpandedQuote:()=>this.props.setQuoteExpanded(!this.props.isQuoteExpanded),getRelationsForEvent:this.props.getRelationsForEvent}))}));return l.a.createElement("div",{className:"mx_ReplyChain_wrapper"},l.a.createElement("div",null,e),l.a.createElement("div",null,a))}}r()(T,"contextType",R.b);var N,P=a(194),D=a(165),M=a(840),A=a(266),L=a(162),U=a(650),F=a(150),B=a(185),V=a(161),W=a(331),H=a(246),z=a(157),G=a(172),K=a(869),q=a(753),$=a(204),Y=a(623);function J(){return J=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},J.apply(this,arguments)}function Q(e){return o.createElement("svg",J({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 18 18",role:"presentation","aria-hidden":!0},e),N||(N=o.createElement("path",{d:"M3 14h12M5 10.5l7-7",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})))}var X,Z,ee=a(871),te=a(624);function ae(){return ae=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},ae.apply(this,arguments)}function ne(e){return o.createElement("svg",ae({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 18 18",role:"presentation","aria-hidden":!0},e),X||(X=o.createElement("path",{fill:"currentColor",d:"M5 5.25a.75.75 0 000 1.5h8a.75.75 0 000-1.5H5zm0 3a.75.75 0 000 1.5h4a.75.75 0 100-1.5H5z"})),Z||(Z=o.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M3 .25A2.75 2.75 0 00.25 3v14a.75.75 0 001.2.6L4.916 15c.217-.162.48-.25.75-.25H15A2.75 2.75 0 0017.75 12V3A2.75 2.75 0 0015 .25H3zM1.75 3c0-.69.56-1.25 1.25-1.25h12c.69 0 1.25.56 1.25 1.25v9c0 .69-.56 1.25-1.25 1.25H5.666a2.75 2.75 0 00-1.65.55L1.75 15.5V3z",clipRule:"evenodd"})))}var ie;function se(){return se=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},se.apply(this,arguments)}function re(e){return o.createElement("svg",se({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",role:"presentation","aria-hidden":!0},e),ie||(ie=o.createElement("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V9c0-1.1-.9-2-2-2H8c-1.1 0-2 .9-2 2v10zM18 4h-2.5l-.71-.71c-.18-.18-.44-.29-.7-.29H9.91c-.26 0-.52.11-.7.29L8.5 4H6c-.55 0-1 .45-1 1s.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1z",fill:"currentColor"})))}var oe;function le(){return le=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},le.apply(this,arguments)}function ce(e){return o.createElement("svg",le({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 21.87 20.801",role:"presentation","aria-hidden":!0},e),oe||(oe=o.createElement("path",{fill:"currentColor",d:"M4.178 20.801l6.758-4.91 6.756 4.91-2.58-7.946 6.758-4.91h-8.352L10.936 0 8.354 7.945H0l6.758 4.91-2.58 7.946z"})))}var de,me=a(872);function ue(){return ue=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},ue.apply(this,arguments)}function he(e){return o.createElement("svg",ue({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 11 14",role:"presentation","aria-hidden":!0},e),de||(de=o.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M.22 8.494a.753.753 0 011.062-.002l3.724 3.7L8.718 8.48a.753.753 0 011.062-.002.747.747 0 01.002 1.06L5.54 13.78a.753.753 0 01-1.063.002L.221 9.552a.747.747 0 01-.002-1.058zm9.562-2.988a.753.753 0 01-1.062.002l-3.724-3.7L1.283 5.52a.753.753 0 01-1.062.002.747.747 0 01-.002-1.06L4.462.22A.753.753 0 015.524.218l4.257 4.23a.747.747 0 01.001 1.058z",clipRule:"evenodd"})))}var pe;function ge(){return ge=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},ge.apply(this,arguments)}function ve(e){return o.createElement("svg",ge({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 11 14",role:"presentation","aria-hidden":!0},e),pe||(pe=o.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M.22.234A.753.753 0 011.281.232l3.724 3.7L8.718.22A.753.753 0 019.781.218a.747.747 0 01.001 1.06L5.54 5.52a.753.753 0 01-1.063.002L.221 1.292A.747.747 0 01.219.235zm9.562 13.532a.753.753 0 01-1.062.002l-3.724-3.7-3.713 3.712a.753.753 0 01-1.062.002.747.747 0 01-.002-1.06L4.462 8.48a.753.753 0 011.062-.002l4.257 4.23a.747.747 0 01.001 1.058z",clipRule:"evenodd"})))}var be=a(180),fe=a(475),ye=a(169),Ee=a(446),_e=a(499),we=a(826),Se=a(825);class Oe extends l.a.PureComponent{constructor(e){super(e),r()(this,"downloader",new Se.a),r()(this,"onDownloadClick",(async()=>{if(this.state.loading)return;if(this.props.mediaEventHelperGet().media.isEncrypted&&this.setState({tooltip:Object(f.c)("Decrypting")}),this.setState({loading:!0}),this.state.blob)return this.doDownload();const e=await this.props.mediaEventHelperGet().sourceBlob.value;this.setState({blob:e}),await this.doDownload()})),this.state={loading:!1,tooltip:Object(f.c)("Downloading")}}async doDownload(){await this.downloader.download({blob:this.state.blob,name:this.props.mediaEventHelperGet().fileName}),this.setState({loading:!1})}render(){let e;this.state.loading&&(e=l.a.createElement(O.a,{w:18,h:18}));const t=d()({mx_MessageActionBar_iconButton:!0,mx_MessageActionBar_downloadButton:!0,mx_MessageActionBar_downloadSpinnerButton:!!e});return l.a.createElement(ye.b,{className:t,title:e?Object(f.a)(this.state.tooltip):Object(f.a)("Download"),onClick:this.onDownloadClick,disabled:!!e},l.a.createElement(we.Icon,null),e)}}var Ce,xe,je=a(553),ke=a(375),Re=a(205),Ie=a(142);const Te=JSON.parse(null!==(Ce=null===(xe=localStorage)||void 0===xe?void 0:xe.getItem("io_element_favouriteMessages"))&&void 0!==Ce?Ce:"[]");var Ne=a(261);const Pe=e=>{let{mxEvent:t,getTile:a,getReplyChain:n,permalinkCreator:s,onFocusChange:r,getRelationsForEvent:c}=e;const[d,m,u,h]=Object(F.q)(),[p,g]=Object(ye.i)(m);Object(o.useEffect)((()=>{r(d)}),[r,d]);const v=Object(o.useCallback)((e=>{e.preventDefault(),e.stopPropagation(),u(),p()}),[u,p]);let b;if(d){const e=a&&a(),r=n&&n(),o=m.current.getBoundingClientRect();b=l.a.createElement(U.a,i()({},Object(F.i)(o),{mxEvent:t,permalinkCreator:s,eventTileOps:e&&e.getEventTileOps?e.getEventTileOps():void 0,collapseReplyChain:r&&r.canCollapse()?r.collapse:void 0,onFinished:h,getRelationsForEvent:c}))}return l.a.createElement(l.a.Fragment,null,l.a.createElement(F.c,{className:"mx_MessageActionBar_iconButton mx_MessageActionBar_optionsButton",title:Object(f.a)("Options"),onClick:v,onContextMenu:v,isExpanded:d,inputRef:m,onFocus:p,tabIndex:g?0:-1},l.a.createElement(Y.a,null)),b)},De=e=>{let{mxEvent:t,reactions:a,onFocusChange:n}=e;const[s,r,c,d]=Object(F.q)(),[m,u]=Object(ye.i)(r);let h;if(Object(o.useEffect)((()=>{n(s)}),[n,s]),s){const e=r.current.getBoundingClientRect();h=l.a.createElement(F.n,i()({},Object(F.i)(e),{onFinished:d,managed:!1}),l.a.createElement(je.a,{mxEvent:t,reactions:a,onFinished:d}))}const p=Object(o.useCallback)((e=>{e.preventDefault(),e.stopPropagation(),c(),m()}),[c,m]);return l.a.createElement(l.a.Fragment,null,l.a.createElement(F.c,{className:"mx_MessageActionBar_iconButton",title:Object(f.a)("React"),onClick:p,onContextMenu:p,isExpanded:s,inputRef:r,onFocus:m,tabIndex:u?0:-1},l.a.createElement(ee.a,null)),h)},Me=e=>{var t;let{mxEvent:a}=e;const n=Object(o.useContext)(ke.a),i=null==a||null===(t=a.getRelation())||void 0===t?void 0:t.rel_type,s=!!i&&i!==m.h.Thread,r=e=>{e.preventDefault(),e.stopPropagation(),a.getThread()&&!a.isThreadRoot?y.b.dispatch({action:S.a.ShowThread,rootEvent:a.getThread().rootEvent,initialEvent:a,scroll_into_view:!0,highlighted:!0,push:n.isCard}):y.b.dispatch({action:S.a.ShowThread,rootEvent:a,push:n.isCard})};return l.a.createElement(ye.b,{className:"mx_MessageActionBar_iconButton mx_MessageActionBar_threadButton",disabled:s,tooltip:l.a.createElement(l.a.Fragment,null,l.a.createElement("div",{className:"mx_Tooltip_title"},s?Object(f.a)("Can't create a thread from an event with an existing relation"):Object(f.a)("Reply in thread"))),title:s?Object(f.a)("Can't create a thread from an event with an existing relation"):Object(f.a)("Reply in thread"),onClick:r,onContextMenu:r},l.a.createElement(ne,null))},Ae=e=>{let{mxEvent:t}=e;const{isFavourite:a,toggleFavourite:n}=function(){const[,e]=Object(o.useState)(),t=e=>Te.includes(e);return{isFavourite:t,toggleFavourite:a=>{t(a)?Te.splice(Te.indexOf(a),1):Te.push(a),localStorage.setItem("io_element_favouriteMessages",JSON.stringify(Te)),e([])}}}(),i=t.getId(),s=d()("mx_MessageActionBar_iconButton mx_MessageActionBar_favouriteButton",{mx_MessageActionBar_favouriteButton_fillstar:a(i)}),r=Object(o.useCallback)((e=>{e.preventDefault(),e.stopPropagation(),n(i)}),[n,i]);return l.a.createElement(ye.b,{className:s,title:Object(f.a)("Favourite"),onClick:r,onContextMenu:r,"data-testid":i},l.a.createElement(ce,null))};class Le extends l.a.PureComponent{constructor(){super(...arguments),r()(this,"onDecrypted",(()=>{this.forceUpdate()})),r()(this,"onBeforeRedaction",(()=>{this.forceUpdate()})),r()(this,"onSent",(()=>{this.forceUpdate()})),r()(this,"onFocusChange",(e=>{var t,a;null===(t=(a=this.props).onFocusChange)||void 0===t||t.call(a,e)})),r()(this,"onReplyClick",(e=>{e.preventDefault(),e.stopPropagation(),y.a.dispatch({action:"reply_to_event",event:this.props.mxEvent,context:this.context.timelineRenderingType})})),r()(this,"onEditClick",(e=>{e.preventDefault(),e.stopPropagation(),Object(be.e)(this.props.mxEvent,this.context.timelineRenderingType,this.props.getRelationsForEvent)})),r()(this,"forbiddenThreadHeadMsgType",[m.e.KeyVerificationRequest]),r()(this,"onResendClick",(e=>{e.preventDefault(),e.stopPropagation(),this.runActionOnFailedEv((e=>Ee.a.resend(e)))})),r()(this,"onCancelClick",(e=>{this.runActionOnFailedEv((e=>Ee.a.removeFromQueue(e)),(e=>Object(be.b)(e.status)))}))}componentDidMount(){this.props.mxEvent.status&&this.props.mxEvent.status!==u.a.SENT&&this.props.mxEvent.on(u.c.Status,this.onSent);I.a.get().decryptEventIfNeeded(this.props.mxEvent),this.props.mxEvent.isBeingDecrypted()&&this.props.mxEvent.once(u.c.Decrypted,this.onDecrypted),this.props.mxEvent.on(u.c.BeforeRedaction,this.onBeforeRedaction)}componentWillUnmount(){this.props.mxEvent.off(u.c.Status,this.onSent),this.props.mxEvent.off(u.c.Decrypted,this.onDecrypted),this.props.mxEvent.off(u.c.BeforeRedaction,this.onBeforeRedaction)}get showReplyInThreadAction(){const e=this.context.timelineRenderingType!==R.a.Thread,t=!(this.forbiddenThreadHeadMsgType.includes(this.props.mxEvent.getContent().msgtype)||$.b.matches(this.props.mxEvent.getType())||this.props.mxEvent.getType()===Ne.b);return e&&t}runActionOnFailedEv(e,t){t||(t=()=>!0);const a=this.props.mxEvent,n=a.replacingEvent(),i=[a.localRedactionEvent(),n,a];for(const a of i)if(a&&t(a)){e(a);break}}render(){const e=[];Object(be.c)(this.props.mxEvent)&&e.push(l.a.createElement(ye.b,{className:"mx_MessageActionBar_iconButton",title:Object(f.a)("Edit"),onClick:this.onEditClick,onContextMenu:this.onEditClick,key:"edit"},l.a.createElement(Q,null)));const t=l.a.createElement(ye.b,{className:"mx_MessageActionBar_iconButton",title:Object(f.a)("Delete"),onClick:this.onCancelClick,onContextMenu:this.onCancelClick,key:"cancel"},l.a.createElement(re,null)),a=l.a.createElement(Me,{mxEvent:this.props.mxEvent,key:"reply_thread"}),n=this.props.mxEvent,i=n.replacingEvent()&&n.replacingEvent().status,s=n.localRedactionEvent()&&n.localRedactionEvent().status,r=Object(be.b)(n.status)||Object(be.b)(i)||Object(be.b)(s),o=[n.status,i,s].includes(u.a.NOT_SENT);if(r&&o)e.splice(0,0,l.a.createElement(ye.b,{className:"mx_MessageActionBar_iconButton",title:Object(f.a)("Retry"),onClick:this.onResendClick,onContextMenu:this.onResendClick,key:"resend"},l.a.createElement(te.a,null))),e.push(t);else{if(Object(be.k)(this.props.mxEvent)?(this.context.canSendMessages&&(this.showReplyInThreadAction&&e.splice(0,0,a),e.splice(0,0,l.a.createElement(ye.b,{className:"mx_MessageActionBar_iconButton",title:Object(f.a)("Reply"),onClick:this.onReplyClick,onContextMenu:this.onReplyClick,key:"reply"},l.a.createElement(me.a,null)))),this.context.canReact&&e.splice(0,0,l.a.createElement(De,{mxEvent:this.props.mxEvent,reactions:this.props.reactions,onFocusChange:this.onFocusChange,key:"react"})),_.b.getValue("feature_favourite_messages")&&e.splice(-1,0,l.a.createElement(Ae,{key:"favourite",mxEvent:this.props.mxEvent})),_e.a.isEligible(this.props.mxEvent)&&e.splice(0,0,l.a.createElement(Oe,{mxEvent:this.props.mxEvent,mediaEventHelperGet:()=>{var e,t,a,n;return null===(e=(t=this.props).getTile)||void 0===e||null===(a=(n=e.call(t)).getMediaHelper)||void 0===a?void 0:a.call(n)},key:"download"}))):this.context.timelineRenderingType===R.a.Room&&this.props.mxEvent.getThread()&&e.unshift(a),r&&e.push(t),void 0!==this.props.isQuoteExpanded&&Object(k.c)(this.props.mxEvent)){const t=d()({mx_MessageActionBar_iconButton:!0,mx_MessageActionBar_expandCollapseMessageButton:!0}),a=l.a.createElement(l.a.Fragment,null,l.a.createElement("div",{className:"mx_Tooltip_title"},this.props.isQuoteExpanded?Object(f.a)("Collapse quotes"):Object(f.a)("Expand quotes")),l.a.createElement("div",{className:"mx_Tooltip_sub"},Object(f.a)(Ie.a[Re.b.SHIFT])+" + "+Object(f.a)("Click")));e.push(l.a.createElement(ye.b,{className:t,title:this.props.isQuoteExpanded?Object(f.a)("Collapse quotes"):Object(f.a)("Expand quotes"),tooltip:a,onClick:this.props.toggleThreadExpanded,key:"expand"},this.props.isQuoteExpanded?l.a.createElement(ve,null):l.a.createElement(he,null)))}e.push(l.a.createElement(Pe,{mxEvent:this.props.mxEvent,getReplyChain:this.props.getReplyChain,getTile:this.props.getTile,permalinkCreator:this.props.permalinkCreator,onFocusChange:this.onFocusChange,key:"menu",getRelationsForEvent:this.props.getRelationsForEvent}))}return l.a.createElement(fe.a,{className:"mx_MessageActionBar","aria-label":Object(f.a)("Message Actions"),"aria-live":"off"},e)}}r()(Le,"contextType",R.b);var Ue=a(354),Fe=a(328),Be=a(196),Ve=a(133);class We extends l.a.PureComponent{constructor(){super(...arguments),r()(this,"context",void 0)}render(){const{content:e,reactionEvents:t,mxEvent:a,visible:n}=this.props,i=this.context.getRoom(a.getRoomId());let s,r;if(i){const a=[];for(const e of t){const t=i.getMember(e.getSender()),n=t?t.name:e.getSender();a.push(n)}const n=Object(Be.k)(e);s=l.a.createElement("div",null,Object(f.a)("<reactors/><reactedWith>reacted with %(shortName)s</reactedWith>",{shortName:n},{reactors:()=>l.a.createElement("div",{className:"mx_Tooltip_title"},Object(w.b)(a,6)),reactedWith:e=>n?l.a.createElement("div",{className:"mx_Tooltip_sub"},e):null}))}return s&&(r=l.a.createElement(V.b,{visible:n,label:s})),r}}r()(We,"contextType",Ve.a);class He extends l.a.PureComponent{constructor(){super(...arguments),r()(this,"context",void 0),r()(this,"state",{tooltipRendered:!1,tooltipVisible:!1}),r()(this,"onClick",(()=>{const{mxEvent:e,myReactionEvent:t,content:a}=this.props;t?this.context.redactEvent(e.getRoomId(),t.getId()):(this.context.sendEvent(e.getRoomId(),"m.reaction",{"m.relates_to":{rel_type:"m.annotation",event_id:e.getId(),key:a}}),y.a.dispatch({action:"message_sent"}))})),r()(this,"onMouseOver",(()=>{this.setState({tooltipRendered:!0,tooltipVisible:!0})})),r()(this,"onMouseLeave",(()=>{this.setState({tooltipVisible:!1})}))}render(){const{mxEvent:e,content:t,count:a,reactionEvents:n,myReactionEvent:i}=this.props,s=d()({mx_ReactionsRowButton:!0,mx_ReactionsRowButton_selected:!!i});let r;this.state.tooltipRendered&&(r=l.a.createElement(We,{mxEvent:this.props.mxEvent,content:t,reactionEvents:n,visible:this.state.tooltipVisible}));const o=this.context.getRoom(e.getRoomId());let c;if(o){const e=[];for(const t of n){const a=o.getMember(t.getSender());e.push((null==a?void 0:a.name)||t.getSender())}const a=Object(w.b)(e,6);c=t?Object(f.a)("%(reactors)s reacted with %(content)s",{reactors:a,content:t}):a}return l.a.createElement(j.a,{className:s,"aria-label":c,onClick:this.onClick,disabled:this.props.disabled,onMouseOver:this.onMouseOver,onMouseLeave:this.onMouseLeave},l.a.createElement("span",{className:"mx_ReactionsRowButton_content","aria-hidden":"true"},t),l.a.createElement("span",{className:"mx_ReactionsRowButton_count","aria-hidden":"true"},a),r)}}r()(He,"contextType",Ve.a);const ze=e=>{let{mxEvent:t,reactions:a}=e;const[n,s,r,o]=Object(F.q)();let c;if(n){const e=s.current.getBoundingClientRect();c=l.a.createElement(F.n,i()({},Object(F.i)(e),{onFinished:o,managed:!1}),l.a.createElement(je.a,{mxEvent:t,reactions:a,onFinished:o}))}return l.a.createElement(l.a.Fragment,null,l.a.createElement(Fe.a,{className:d()("mx_ReactionsRow_addReactionButton",{mx_ReactionsRow_addReactionButton_active:n}),title:Object(f.a)("Add reaction"),onClick:r,onContextMenu:e=>{e.preventDefault(),r()},isExpanded:n,inputRef:s}),c)};class Ge extends l.a.PureComponent{constructor(e,t){super(e,t),r()(this,"context",void 0),r()(this,"onDecrypted",(()=>{this.forceUpdate()})),r()(this,"onReactionsChange",(()=>{this.setState({myReactions:this.getMyReactions()}),this.forceUpdate()})),r()(this,"onShowAllClick",(()=>{this.setState({showAll:!0})})),this.context=t,this.state={myReactions:this.getMyReactions(),showAll:!1}}componentDidMount(){const{mxEvent:e,reactions:t}=this.props;(e.isBeingDecrypted()||e.shouldAttemptDecryption())&&e.once(u.c.Decrypted,this.onDecrypted),t&&(t.on(Ue.b.Add,this.onReactionsChange),t.on(Ue.b.Remove,this.onReactionsChange),t.on(Ue.b.Redaction,this.onReactionsChange))}componentWillUnmount(){const{mxEvent:e,reactions:t}=this.props;e.off(u.c.Decrypted,this.onDecrypted),t&&(t.off(Ue.b.Add,this.onReactionsChange),t.off(Ue.b.Remove,this.onReactionsChange),t.off(Ue.b.Redaction,this.onReactionsChange))}componentDidUpdate(e){this.props.reactions&&e.reactions!==this.props.reactions&&(this.props.reactions.on(Ue.b.Add,this.onReactionsChange),this.props.reactions.on(Ue.b.Remove,this.onReactionsChange),this.props.reactions.on(Ue.b.Redaction,this.onReactionsChange),this.onReactionsChange())}getMyReactions(){const e=this.props.reactions;if(!e)return null;const t=this.context.room.client.getUserId(),a=e.getAnnotationsBySender()[t];return a?[...a.values()]:null}render(){const{mxEvent:e,reactions:t}=this.props,{myReactions:a,showAll:n}=this.state;if(!t||!Object(be.k)(e))return null;let i,s,r=t.getSortedAnnotationsByKey().map((t=>{let[n,i]=t;const s=i.size;if(!s)return null;const r=a&&a.find((e=>!e.isRedacted()&&e.getRelation().key===n));return l.a.createElement(He,{key:n,content:n,count:s,mxEvent:e,reactionEvents:i,myReactionEvent:r,disabled:!this.context.canReact||r&&!r.isRedacted()&&!this.context.canSelfRedact})})).filter((e=>!!e));return r.length?(r.length>9&&!n&&(r=r.slice(0,8),i=l.a.createElement(j.a,{kind:"link_inline",className:"mx_ReactionsRow_showAll",onClick:this.onShowAllClick},Object(f.a)("Show all"))),this.context.canReact&&(s=l.a.createElement(ze,{mxEvent:e,reactions:t})),l.a.createElement("div",{className:"mx_ReactionsRow",role:"toolbar","aria-label":Object(f.a)("Reactions")},r,i,s)):null}}r()(Ge,"contextType",R.b);var Ke=a(622),qe=a(646),$e=a(228),Ye=a(873),Je=a(527),Qe=a(159),Xe=a(127),Ze=a(131),et=a(276),tt=a(554);class at extends l.a.Component{constructor(e){super(e),r()(this,"onBugReport",(()=>{Xe.b.createDialog(et.a,{label:"react-soft-crash-tile",error:this.state.error})})),r()(this,"onViewSource",(()=>{Xe.b.createDialog(tt.a,{mxEvent:this.props.mxEvent},"mx_Dialog_viewsource")})),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}render(){if(this.state.error){const{mxEvent:e}=this.props,t={mx_EventTile:!0,mx_EventTile_info:!0,mx_EventTile_content:!0,mx_EventTile_tileError:!0};let a,n;return Ze.b.get().bug_report_endpoint_url&&(a=l.a.createElement(l.a.Fragment,null," ",l.a.createElement(j.a,{kind:"link",onClick:this.onBugReport},Object(f.a)("Submit logs")))),e&&_.b.getValue("developerMode")&&(n=l.a.createElement(l.a.Fragment,null," ",l.a.createElement(j.a,{onClick:this.onViewSource,kind:"link"},Object(f.a)("View Source")))),l.a.createElement("li",{className:d()(t),"data-layout":this.props.layout},l.a.createElement("div",{className:"mx_EventTile_line"},l.a.createElement("span",null,Object(f.a)("Can't load this message"),e&&` (${e.getType()})`,a,n)))}return this.props.children}}var nt=a(238),it=a(132),st=a.n(it),rt=a(141),ot=a(248);const lt=["mxEvent","thread"],ct=e=>{var t,a,n;let{thread:i,showDisplayname:s=!1}=e;const r=Object(o.useContext)(Ve.a),c=null!==(t=Object(rt.d)(i,h.f.Update,(()=>i.replyToEvent)))&&void 0!==t?t:void 0,[d,m]=Object(o.useState)(null==c?void 0:c.getContent());Object(rt.c)(c,u.c.Replaced,(()=>{m(c.getContent())}));const p=(null==c?void 0:c.shouldAttemptDecryption())||(null==c?void 0:c.isBeingDecrypted());Object(rt.c)(p?c:void 0,u.c.Decrypted,(()=>{m(c.getContent())}));const g=Object(ot.a)((async()=>{if(c)return await r.decryptEventIfNeeded(c),qe.a.instance.generatePreviewForEvent(c)}),[c,d]);return g&&c?l.a.createElement(l.a.Fragment,null,l.a.createElement(G.b,{member:c.sender,fallbackUserId:c.getSender(),width:24,height:24,className:"mx_ThreadSummary_avatar"}),s&&l.a.createElement("div",{className:"mx_ThreadSummary_sender"},null!==(a=null===(n=c.sender)||void 0===n?void 0:n.name)&&void 0!==a?a:c.getSender()),c.isDecryptionFailure()?l.a.createElement("div",{className:"mx_ThreadSummary_content mx_DecryptionFailureBody",title:Object(f.a)("Unable to decrypt message")},l.a.createElement("span",{className:"mx_ThreadSummary_message-preview"},Object(f.a)("Unable to decrypt message"))):l.a.createElement("div",{className:"mx_ThreadSummary_content",title:g},l.a.createElement("span",{className:"mx_ThreadSummary_message-preview"},g))):null};var dt=e=>{let{mxEvent:t,thread:a}=e,n=st()(e,lt);const s=Object(o.useContext)(R.b),r=Object(o.useContext)(ke.a),c=Object(rt.d)(a,h.f.Update,(()=>a.length));if(!c)return null;let d=c;return s.narrow||(d=Object(f.a)("%(count)s reply",{count:c})),l.a.createElement(j.a,i()({},n,{className:"mx_ThreadSummary",onClick:e=>{y.a.dispatch({action:S.a.ShowThread,rootEvent:t,push:r.isCard}),Qe.b.trackInteraction("WebRoomTimelineThreadSummaryButton",e)},"aria-label":Object(f.a)("Open thread")}),l.a.createElement("span",{className:"mx_ThreadSummary_replies_amount"},d),l.a.createElement(ct,{thread:a,showDisplayname:!s.narrow}),l.a.createElement("div",{className:"mx_ThreadSummary_chevron"}))},mt=a(186),ut=a.n(mt);class ht extends l.a.Component{constructor(e){super(e),r()(this,"nodes",{}),r()(this,"children",void 0),this.updateChildren(this.props.children)}componentDidUpdate(){this.updateChildren(this.props.children)}applyStyles(e,t){Object.entries(t).forEach((t=>{let[a,n]=t;e.style[a]=n}))}updateChildren(e){const t=this.children||{};this.children={},l.a.Children.toArray(e).forEach((e=>{if(t[e.key]){const a=t[e.key],n=ut.a.findDOMNode(this.nodes[a.key]);n&&n.style.left!==e.props.style.left&&this.applyStyles(n,{left:e.props.style.left}),this.children[e.key]=l.a.cloneElement(a,e.props,e.props.children)}else{const t={},a=e.props.style,n=this.props.startStyles;if(n.length>0){const e=n[0];t.style=e}t.ref=t=>this.collectNode(e.key,t,a),this.children[e.key]=l.a.cloneElement(e,t)}}))}collectNode(e,t,a){if(t&&void 0===this.nodes[e]&&this.props.startStyles.length>0){const e=this.props.startStyles,n=ut.a.findDOMNode(t);for(let t=1;t<e.length;++t)this.applyStyles(n,e[t]);window.setTimeout((()=>{this.applyStyles(n,a)}),0)}this.nodes[e]=t}render(){return l.a.createElement(l.a.Fragment,null,Object.values(this.children))}}r()(ht,"defaultProps",{startStyles:[]});var pt=a(552);class gt extends l.a.PureComponent{constructor(e){super(e),r()(this,"avatar",Object(o.createRef)()),this.state={suppressDisplay:!this.props.suppressAnimation}}componentWillUnmount(){const e=this.props.readReceiptInfo;e&&(this.props.checkUnmounting&&this.props.checkUnmounting()||this.buildReadReceiptInfo(e))}componentDidMount(){this.state.suppressDisplay&&this.animateMarker()}componentDidUpdate(e){const t=e.offset!==this.props.offset,a=e.hidden!==this.props.hidden;(t||a)&&this.animateMarker()}buildReadReceiptInfo(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=this.avatar.current,a=t.offsetParent;if(!(a&&a instanceof HTMLElement))return p.a.warn(`ReadReceiptMarker for ${this.props.fallbackUserId} has no valid horizontalContainer`),e.top=0,e.right=0,e.parent=void 0,e;const n=a.offsetParent;return n&&n instanceof HTMLElement?(e.top=t.offsetTop,e.right=t.getBoundingClientRect().right-a.getBoundingClientRect().right,e.parent=n,e):(p.a.warn(`ReadReceiptMarker for ${this.props.fallbackUserId} has no valid verticalContainer`),e.top=0,e.right=0,e.parent=void 0,e)}readReceiptPosition(e){return e.parent?e.top+e.parent.getBoundingClientRect().top:(p.a.warn(`ReadReceiptMarker for ${this.props.fallbackUserId} has no offsetParent`),0)}animateMarker(){const e=this.props.readReceiptInfo,t=this.buildReadReceiptInfo(),a=this.readReceiptPosition(t),n=e?this.readReceiptPosition(e):-_t,i=[];null!=e&&e.right&&i.push({top:n-a,right:e.right}),i.push({top:n-a,right:0}),this.setState({suppressDisplay:!1,startStyles:i})}render(){var e;if(this.state.suppressDisplay)return l.a.createElement("div",{ref:this.avatar});const t={right:Object(pt.a)(this.props.offset),top:"0px"};return l.a.createElement(ht,{startStyles:this.state.startStyles},l.a.createElement(G.a,{member:null!==(e=this.props.member)&&void 0!==e?e:null,fallbackUserId:this.props.fallbackUserId,"aria-hidden":"true","aria-live":"off",width:14,height:14,resizeMethod:"crop",style:t,inputRef:this.avatar,hideTitle:!0,tabIndex:-1}))}}var vt=a(212);function bt(e){const[t,a]=Object(o.useState)(!1);return[{showTooltip:()=>a(!0),hideTooltip:()=>a(!1)},l.a.createElement(V.b,i()({},e,{visible:t}))]}const ft=3,yt=ft+1,Et=10,_t=16;function wt(e){let{readReceipts:t,readReceiptMap:a,checkUnmounting:n,suppressAnimation:s,isTwelveHour:r}=e;const[o,c,d,m]=Object(F.q)(),u=t.length>yt,h=u?ft:yt,p=function(e,t){return t?Object(f.a)("%(members)s and more",{members:e.join(", ")}):e.length>1?Object(f.a)("%(members)s and %(last)s",{last:e.pop(),members:e.join(", ")}):e.length?e[0]:void 0}(t.slice(0,h).map((e=>{var t,a;return null!==(t=null===(a=e.roomMember)||void 0===a?void 0:a.name)&&void 0!==t?t:e.userId})),u),[{showTooltip:g,hideTooltip:v},b]=bt({label:l.a.createElement(l.a.Fragment,null,l.a.createElement("div",{className:"mx_Tooltip_title"},Object(f.a)("Seen by %(count)s people",{count:t.length})),l.a.createElement("div",{className:"mx_Tooltip_sub"},p)),alignment:V.a.TopRight});if(0===t.length)return l.a.createElement("div",{className:"mx_EventTile_msgOption"},l.a.createElement("div",{className:"mx_ReadReceiptGroup"},l.a.createElement("div",{className:"mx_ReadReceiptGroup_button"},l.a.createElement("span",{className:"mx_ReadReceiptGroup_container"}))));const y=t.map(((e,t)=>{const{hidden:i,position:o}=function(e,t){return e<t?{hidden:!1,position:e}:{hidden:!0,position:0}}(t,h),c=e.userId;let d;return a&&(d=a[c],d||(d={},a[c]=d)),l.a.createElement(gt,{key:c,member:e.roomMember,fallbackUserId:c,offset:o*Et,hidden:i,readReceiptInfo:d,checkUnmounting:n,suppressAnimation:s,timestamp:e.ts,showTwelveHour:r})})).reverse();let E;const _=t.length-h;let w;if(_>0&&(E=l.a.createElement("span",{className:"mx_ReadReceiptGroup_remainder","aria-live":"off"},"+",_)),o){const e=c.current.getBoundingClientRect();w=l.a.createElement(F.n,i()({menuClassName:"mx_ReadReceiptGroup_popup",onFinished:m},Object(F.i)(e)),l.a.createElement(vt.a,null,l.a.createElement(Ot,{className:"mx_ReadReceiptGroup_title"},Object(f.a)("Seen by %(count)s people",{count:t.length})),t.map((e=>l.a.createElement(St,i()({key:e.userId},e,{isTwelveHour:r,onAfterClick:m}))))))}return l.a.createElement("div",{className:"mx_EventTile_msgOption"},l.a.createElement("div",{className:"mx_ReadReceiptGroup",role:"group","aria-label":Object(f.a)("Read receipts")},l.a.createElement(j.a,{className:"mx_ReadReceiptGroup_button",inputRef:c,"aria-label":p,"aria-haspopup":"true",onClick:d,onMouseOver:g,onMouseLeave:v,onFocus:g,onBlur:v},E,l.a.createElement("span",{className:"mx_ReadReceiptGroup_container",style:{width:Math.min(h,t.length)*Et+_t-Et}},y)),b,w))}function St(e){var t,a;let{userId:n,roomMember:i,ts:s,isTwelveHour:r,onAfterClick:o}=e;const[{showTooltip:c,hideTooltip:d},m]=bt({alignment:V.a.Top,tooltipClassName:"mx_ReadReceiptGroup_person--tooltip",label:l.a.createElement(l.a.Fragment,null,l.a.createElement("div",{className:"mx_Tooltip_title"},null!==(t=null==i?void 0:i.rawDisplayName)&&void 0!==t?t:n),l.a.createElement("div",{className:"mx_Tooltip_sub"},n))});return l.a.createElement(F.d,{className:"mx_ReadReceiptGroup_person",onClick:()=>{y.a.dispatch({action:S.a.ViewUser,member:null!=i?i:{userId:n},push:!1}),null==o||o()},onMouseOver:c,onMouseLeave:d,onFocus:c,onBlur:d,onWheel:d},l.a.createElement(G.b,{member:i,fallbackUserId:n,width:24,height:24,"aria-hidden":"true","aria-live":"off",resizeMethod:"crop",hideTitle:!0}),l.a.createElement("div",{className:"mx_ReadReceiptGroup_name"},l.a.createElement("p",null,null!==(a=null==i?void 0:i.name)&&void 0!==a?a:n),l.a.createElement("p",{className:"mx_ReadReceiptGroup_secondary"},Object(D.a)(new Date(s),r))),m)}function Ot(e){let{className:t,children:a}=e;const n=Object(o.useRef)(),[i]=Object(ye.i)(n);return l.a.createElement("h3",{className:t,role:"menuitem",onFocus:i,tabIndex:-1,ref:n},a)}var Ct,xt=a(217),jt=a(203),kt=a(820),Rt=a(795);function It(e){let{room:t,threadId:a}=e;const{symbol:n,count:i,color:s}=Object(kt.a)(t,a);return l.a.createElement(Rt.a,{symbol:n,count:i,color:s})}function Tt(){return Tt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Tt.apply(this,arguments)}function Nt(e){return o.createElement("svg",Tt({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",role:"presentation","aria-hidden":!0},e),Ct||(Ct=o.createElement("path",{d:"M12.528 6.54l.5-.498c1.377-1.378 3.598-1.391 4.96-.03 1.361 1.362 1.348 3.583-.03 4.96l-2.37 2.37c-1.378 1.378-3.599 1.391-4.96.03m.844 4.087l-.5.499c-1.377 1.378-3.598 1.391-4.96.03-1.361-1.362-1.348-3.583.03-4.96l2.37-2.37c1.378-1.378 3.599-1.391 4.96-.03",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round"})))}var Pt;function Dt(){return Dt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},Dt.apply(this,arguments)}function Mt(e){return o.createElement("svg",Dt({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",role:"presentation","aria-hidden":!0},e),Pt||(Pt=o.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M1 2.75A.75.75 0 011.75 2h.005a.75.75 0 010 1.5H1.75A.75.75 0 011 2.75zm2.495 0a.75.75 0 01.75-.75h.01a.75.75 0 010 1.5h-.01a.75.75 0 01-.75-.75zm2.5 0a.75.75 0 01.75-.75h.01a.75.75 0 010 1.5h-.01a.75.75 0 01-.75-.75zm2.5 0a.75.75 0 01.75-.75h.01a.75.75 0 010 1.5h-.01a.75.75 0 01-.75-.75zm2.5 0a.75.75 0 01.75-.75h.01a.75.75 0 010 1.5h-.01a.75.75 0 01-.75-.75zm2.5 0a.75.75 0 01.75-.75h.005a.75.75 0 010 1.5h-.005a.75.75 0 01-.75-.75zM1 6.75A.75.75 0 011.75 6h8.5a.75.75 0 010 1.5h-8.5A.75.75 0 011 6.75zm0 3A.75.75 0 011.75 9h4.5a.75.75 0 010 1.5h-4.5A.75.75 0 011 9.75zm0 4a.75.75 0 01.75-.75h.005a.75.75 0 010 1.5H1.75a.75.75 0 01-.75-.75zm2.495 0a.75.75 0 01.75-.75h.01a.75.75 0 010 1.5h-.01a.75.75 0 01-.75-.75zm2.5 0a.75.75 0 01.75-.75h.01a.75.75 0 010 1.5h-.01a.75.75 0 01-.75-.75zm2.5 0a.75.75 0 01.75-.75h.01a.75.75 0 010 1.5h-.01a.75.75 0 01-.75-.75zm2.5 0a.75.75 0 01.75-.75h.01a.75.75 0 010 1.5h-.01a.75.75 0 01-.75-.75zm2.5 0a.75.75 0 01.75-.75h.005a.75.75 0 010 1.5h-.005a.75.75 0 01-.75-.75z",clipRule:"evenodd"})))}function At(e){let{viewInRoom:t,copyLinkToThread:a}=e;return l.a.createElement(fe.a,{className:"mx_MessageActionBar","aria-label":Object(f.a)("Message Actions"),"aria-live":"off"},l.a.createElement(ye.b,{className:"mx_MessageActionBar_iconButton",onClick:t,title:Object(f.a)("View in room"),key:"view_in_room"},l.a.createElement(Mt,null)),l.a.createElement(ye.b,{className:"mx_MessageActionBar_iconButton",onClick:a,title:Object(f.a)("Copy link to thread"),key:"copy_link_to_thread"},l.a.createElement(Nt,null)))}function Lt(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function Ut(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?Lt(Object(a),!0).forEach((function(t){r()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):Lt(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}class Ft extends l.a.Component{constructor(e,t){super(e,t),r()(this,"suppressReadReceiptAnimation",void 0),r()(this,"isListeningForReceipts",void 0),r()(this,"tile",l.a.createRef()),r()(this,"replyChain",l.a.createRef()),r()(this,"ref",Object(o.createRef)()),r()(this,"context",void 0),r()(this,"updateThread",(e=>{this.setState({thread:e})})),r()(this,"onNewThread",(e=>{if(e.id===this.props.mxEvent.getId()){this.updateThread(e);I.a.get().getRoom(this.props.mxEvent.getRoomId()).off(h.f.New,this.onNewThread)}})),r()(this,"viewInRoom",(e=>{e.preventDefault(),e.stopPropagation(),y.a.dispatch({action:S.a.ViewRoom,event_id:this.props.mxEvent.getId(),highlighted:!0,room_id:this.props.mxEvent.getRoomId(),metricsTrigger:void 0})})),r()(this,"copyLinkToThread",(async e=>{e.preventDefault(),e.stopPropagation();const{permalinkCreator:t,mxEvent:a}=this.props,n=t.forEvent(a.getId());await Object($e.b)(n)})),r()(this,"onRoomReceipt",((e,t)=>{t===I.a.get().getRoom(this.props.mxEvent.getRoomId())&&(this.shouldShowSentReceipt||this.shouldShowSendingReceipt||this.isListeningForReceipts)&&this.forceUpdate((()=>{this.shouldShowSentReceipt||this.shouldShowSendingReceipt||(I.a.get().removeListener(g.d.Receipt,this.onRoomReceipt),this.isListeningForReceipts=!1)}))})),r()(this,"onDecrypted",(()=>{this.verifyEvent(),this.forceUpdate(this.props.onHeightChanged)})),r()(this,"onDeviceVerificationChanged",((e,t)=>{e===this.props.mxEvent.getSender()&&this.verifyEvent()})),r()(this,"onUserVerificationChanged",((e,t)=>{e===this.props.mxEvent.getSender()&&this.verifyEvent()})),r()(this,"onReplaced",(()=>{this.verifyEvent()})),r()(this,"onSenderProfileClick",(()=>{y.a.dispatch({action:S.a.ComposerInsert,userId:this.props.mxEvent.getSender(),timelineRenderingType:this.context.timelineRenderingType})})),r()(this,"onPermalinkClicked",(e=>{e.preventDefault(),y.a.dispatch({action:S.a.ViewRoom,event_id:this.props.mxEvent.getId(),highlighted:!0,room_id:this.props.mxEvent.getRoomId(),metricsTrigger:this.context.timelineRenderingType===R.a.Search?"MessageSearch":void 0})})),r()(this,"onActionBarFocusChange",(e=>{this.setState({actionBarFocused:e})})),r()(this,"getTile",(()=>this.tile.current)),r()(this,"getReplyChain",(()=>this.replyChain.current)),r()(this,"getReactions",(()=>{if(!this.props.showReactions||!this.props.getRelationsForEvent)return null;const e=this.props.mxEvent.getId();return this.props.getRelationsForEvent(e,"m.annotation","m.reaction")})),r()(this,"onReactionsCreated",((e,t)=>{"m.annotation"===e&&"m.reaction"===t&&this.setState({reactions:this.getReactions()})})),r()(this,"onContextMenu",(e=>{this.showContextMenu(e)})),r()(this,"onTimestampContextMenu",(e=>{var t;this.showContextMenu(e,null===(t=this.props.permalinkCreator)||void 0===t?void 0:t.forEvent(this.props.mxEvent.getId()))})),r()(this,"onCloseMenu",(()=>{this.setState({contextMenu:null,actionBarFocused:!1})})),r()(this,"setQuoteExpanded",(e=>{this.setState({isQuoteExpanded:e})}));const a=this.thread;this.state={actionBarFocused:!1,verified:null,reactions:this.getReactions(),contextMenu:null,hover:!1,thread:a},this.suppressReadReceiptAnimation=!0,this.isListeningForReceipts=!1}get isEligibleForSpecialReceipt(){if(this.props.readReceipts&&this.props.readReceipts.length>0)return!1;if(!this.props.mxEvent)return!1;if(!I.a.get().getRoom(this.props.mxEvent.getRoomId()))return!1;const e=I.a.get().getUserId();if(this.props.mxEvent.getSender()!==e)return!1;return!![m.b.Sticker,m.b.RoomMessage,m.b.RoomMessageEncrypted,m.b.PollStart].includes(this.props.mxEvent.getType())}get shouldShowSentReceipt(){if(!this.isEligibleForSpecialReceipt)return!1;if(!this.props.lastSuccessful)return!1;if(this.props.eventSendStatus&&this.props.eventSendStatus!==u.a.SENT)return!1;const e=this.props.readReceipts||[],t=I.a.get().getUserId();return!e.some((e=>e.userId!==t))}get shouldShowSendingReceipt(){return!!this.isEligibleForSpecialReceipt&&!(!this.props.eventSendStatus||this.props.eventSendStatus===u.a.SENT)}componentDidMount(){this.suppressReadReceiptAnimation=!1;const e=I.a.get();this.props.forExport||(e.on(b.b.DeviceVerificationChanged,this.onDeviceVerificationChanged),e.on(b.b.UserTrustStatusChanged,this.onUserVerificationChanged),this.props.mxEvent.on(u.c.Decrypted,this.onDecrypted),this.props.mxEvent.on(u.c.Replaced,this.onReplaced),Ye.a.instance.addVisibleEvent(this.props.mxEvent),this.props.showReactions&&this.props.mxEvent.on(u.c.RelationsCreated,this.onReactionsCreated),(this.shouldShowSentReceipt||this.shouldShowSendingReceipt)&&(e.on(g.d.Receipt,this.onRoomReceipt),this.isListeningForReceipts=!0)),this.props.mxEvent.on(h.f.Update,this.updateThread),e.decryptEventIfNeeded(this.props.mxEvent);const t=e.getRoom(this.props.mxEvent.getRoomId());null==t||t.on(h.f.New,this.onNewThread),this.verifyEvent()}shouldComponentUpdate(e,t){return!!Object(B.c)(this.state,t)||!this.propsEqual(this.props,e)}componentWillUnmount(){const e=I.a.get();if(e){e.removeListener(b.b.DeviceVerificationChanged,this.onDeviceVerificationChanged),e.removeListener(b.b.UserTrustStatusChanged,this.onUserVerificationChanged),e.removeListener(g.d.Receipt,this.onRoomReceipt);const t=e.getRoom(this.props.mxEvent.getRoomId());null==t||t.off(h.f.New,this.onNewThread)}this.isListeningForReceipts=!1,this.props.mxEvent.removeListener(u.c.Decrypted,this.onDecrypted),this.props.mxEvent.removeListener(u.c.Replaced,this.onReplaced),this.props.showReactions&&this.props.mxEvent.removeListener(u.c.RelationsCreated,this.onReactionsCreated),this.props.mxEvent.off(h.f.Update,this.updateThread)}componentDidUpdate(e,t){t.verified!==this.state.verified&&this.props.onHeightChanged&&this.props.onHeightChanged(),this.isListeningForReceipts||!this.shouldShowSentReceipt&&!this.shouldShowSendingReceipt||(I.a.get().on(g.d.Receipt,this.onRoomReceipt),this.isListeningForReceipts=!0),e.eventSendStatus!==this.props.eventSendStatus&&this.verifyEvent()}get thread(){var e;let t=this.props.mxEvent.getThread();if(!t){const e=I.a.get().getRoom(this.props.mxEvent.getRoomId());t=null==e?void 0:e.findThreadForEvent(this.props.mxEvent)}return null!==(e=t)&&void 0!==e?e:null}renderThreadPanelSummary(){return this.state.thread?l.a.createElement("div",{className:"mx_ThreadPanel_replies"},l.a.createElement("span",{className:"mx_ThreadPanel_replies_amount"},this.state.thread.length),l.a.createElement(ct,{thread:this.state.thread})):null}renderThreadInfo(){var e;return(null===(e=this.state.thread)||void 0===e?void 0:e.id)===this.props.mxEvent.getId()?l.a.createElement(dt,{mxEvent:this.props.mxEvent,thread:this.state.thread,"data-testid":"thread-summary"}):this.context.timelineRenderingType===R.a.Search&&this.props.mxEvent.threadRootId?this.props.highlightLink?l.a.createElement("a",{className:"mx_ThreadSummary_icon",href:this.props.highlightLink},Object(f.a)("From a thread")):l.a.createElement("p",{className:"mx_ThreadSummary_icon"},Object(f.a)("From a thread")):void 0}verifyEvent(){var e;const t=null!==(e=this.props.mxEvent.replacingEvent())&&void 0!==e?e:this.props.mxEvent;if(!t.isEncrypted()||t.isRedacted())return void this.setState({verified:null});const a=I.a.get().getEventEncryptionInfo(t),n=t.getSender(),i=I.a.get().checkUserTrust(n);if(a.mismatchedSender)return void this.setState({verified:A.a.Warning});if(!i.isCrossSigningVerified())return void this.setState({verified:a.authenticated?A.a.Normal:A.a.Unauthenticated});const s=a.sender&&I.a.get().checkDeviceTrust(n,a.sender.deviceId);s?s.isVerified()?a.authenticated?this.setState({verified:A.a.Verified}):this.setState({verified:A.a.Unauthenticated}):this.setState({verified:A.a.Warning}):this.setState({verified:A.a.Unknown})}propsEqual(e,t){const a=Object.keys(e),n=Object.keys(t);if(a.length!==n.length)return!1;for(let n=0;n<a.length;n++){const i=a[n];if(!t.hasOwnProperty(i))return!1;if("readReceipts"===i){const a=e[i],n=t[i];if(a===n)continue;if(!a||!n)return!1;if(a.length!==n.length)return!1;for(let e=0;e<a.length;e++){if(a[e].userId!==n[e].userId)return!1;if(a[e].roomMember!==n[e].roomMember)return!1}}else if(e[i]!==t[i])return!1}return!0}shouldHighlight(){if(this.props.forExport)return!1;if(this.context.timelineRenderingType===R.a.Notification)return!1;if(this.context.timelineRenderingType===R.a.ThreadsList)return!1;const e=I.a.get().getPushActionsForEvent(this.props.mxEvent.replacingEvent()||this.props.mxEvent);return!(!e||!e.tweaks)&&(this.props.mxEvent.getSender()!==I.a.get().credentials.userId&&e.tweaks.highlight)}renderE2EPadlock(){var e;const t=null!==(e=this.props.mxEvent.replacingEvent())&&void 0!==e?e:this.props.mxEvent;if(!Object(xt.a)(t.getRoomId())){if(t.isDecryptionFailure())return l.a.createElement(Kt,null);if(t.isEncrypted()&&!t.isRedacted())return this.state.verified===A.a.Normal||this.state.verified===A.a.Verified?void 0:this.state.verified===A.a.Unauthenticated?l.a.createElement(Gt,null):this.state.verified===A.a.Unknown?l.a.createElement(zt,null):l.a.createElement(Wt,null);if(I.a.get().isRoomEncrypted(t.getRoomId())){if(t.status===u.a.ENCRYPTING)return;if(t.status===u.a.NOT_SENT)return;if(t.isState())return;if(t.isRedacted())return;return l.a.createElement(Ht,null)}return null}}showContextMenu(e,t){const a=e.target,n=a instanceof HTMLAnchorElement?a:a.closest("a");a instanceof HTMLImageElement||(z.a.get().allowOverridingNativeContextMenus()||!Object($e.c)()&&!n)&&(this.props.editState||(e.preventDefault(),e.stopPropagation(),this.setState({contextMenu:{position:{left:e.clientX,top:e.clientY,bottom:e.clientY},link:(null==n?void 0:n.href)||t},actionBarFocused:!0})))}shouldHideEvent(){var e;return(null===(e=this.props.callEventGrouper)||void 0===e?void 0:e.hangupReason)===v.c.Replaced}renderContextMenu(){if(!this.state.contextMenu)return null;const e=this.getTile(),t=this.getReplyChain(),a=null!=e&&e.getEventTileOps?e.getEventTileOps():void 0,n=null!=t&&t.canCollapse()?t.collapse:void 0;return l.a.createElement(U.a,i()({},Object(F.j)(this.state.contextMenu.position),{mxEvent:this.props.mxEvent,permalinkCreator:this.props.permalinkCreator,eventTileOps:a,collapseReplyChain:n,onFinished:this.onCloseMenu,rightClick:!0,reactions:this.state.reactions,link:this.state.contextMenu.link,getRelationsForEvent:this.props.getRelationsForEvent}))}render(){var e,t,a;const n=this.props.mxEvent.getContent().msgtype,i=this.props.mxEvent.getType(),{hasRenderer:s,isBubbleMessage:r,isInfoMessage:o,isLeftAlignedBubbleMessage:c,noBubbleEvent:u,isSeeingThroughMessageHiddenForModeration:h}=Object(Ke.a)(this.props.mxEvent,this.context.showHiddenEvents,this.shouldHideEvent()),{isQuoteExpanded:g}=this.state;if(!s){const{mxEvent:e}=this.props;return p.a.warn(`Event type not supported: type:${i} isState:${e.isState()}`),l.a.createElement("div",{className:"mx_EventTile mx_EventTile_info mx_MNoticeBody"},l.a.createElement("div",{className:"mx_EventTile_line"},Object(f.a)("This event could not be displayed")))}const v=_e.a.isEligible(this.props.mxEvent),b=d()("mx_EventTile_line",{mx_EventTile_mediaLine:v,mx_EventTile_image:this.props.mxEvent.getType()===m.b.RoomMessage&&this.props.mxEvent.getContent().msgtype===m.e.Image,mx_EventTile_sticker:this.props.mxEvent.getType()===m.b.Sticker,mx_EventTile_emote:this.props.mxEvent.getType()===m.b.RoomMessage&&this.props.mxEvent.getContent().msgtype===m.e.Emote}),E=-1!==["sending","queued","encrypting"].indexOf(this.props.eventSendStatus),_=Object(nt.d)(this.props.mxEvent)&&this.props.isRedacted,w=this.props.mxEvent.isDecryptionFailure();let O=this.props.continuation;this.context.timelineRenderingType!==R.a.Room&&this.context.timelineRenderingType!==R.a.Search&&this.context.timelineRenderingType!==R.a.Thread&&this.props.layout!==P.a.Bubble&&(O=!1);const C=this.context.timelineRenderingType===R.a.Notification,x=!!this.props.editState,j=d()({mx_EventTile_bubbleContainer:r,mx_EventTile_leftAlignedBubble:c,mx_EventTile:!0,mx_EventTile_isEditing:x,mx_EventTile_info:o,mx_EventTile_12hr:this.props.isTwelveHour,mx_EventTile_sending:!x&&E,mx_EventTile_highlight:this.shouldHighlight(),mx_EventTile_selected:this.props.isSelectedEvent||this.state.contextMenu,mx_EventTile_continuation:O||i===m.b.CallInvite||jt.d.CALL_EVENT_TYPE.matches(i),mx_EventTile_last:this.props.last,mx_EventTile_lastInSection:this.props.lastInSection,mx_EventTile_contextual:this.props.contextual,mx_EventTile_actionBarFocused:this.state.actionBarFocused,mx_EventTile_verified:!r&&this.state.verified===A.a.Verified,mx_EventTile_unverified:!r&&this.state.verified===A.a.Warning,mx_EventTile_unknown:!r&&this.state.verified===A.a.Unknown,mx_EventTile_bad:w,mx_EventTile_emote:n===m.e.Emote,mx_EventTile_noSender:this.props.hideSender,mx_EventTile_clamp:this.context.timelineRenderingType===R.a.ThreadsList||C,mx_EventTile_noBubble:u}),N=null!==this.props.eventSendStatus?"off":void 0;let U="#";this.props.permalinkCreator&&(U=this.props.permalinkCreator.forEvent(this.props.mxEvent.getId()));const F=this.props.mxEvent.status?void 0:this.props.mxEvent.getId();let B,V,W=null,H=null;if(C?(B=24,V=!0):o?(B=14,V=!1):this.context.timelineRenderingType===R.a.ThreadsList||this.context.timelineRenderingType===R.a.Thread&&!this.props.continuation?(B=32,V=!0):i===m.b.RoomCreate||r?(B=0,V=!1):this.props.layout==P.a.IRC?(B=14,V=!0):this.props.continuation&&this.context.timelineRenderingType!==R.a.File||i===m.b.CallInvite||jt.d.CALL_EVENT_TYPE.matches(i)?(B=0,V=!1):(B=30,V=!0),this.props.mxEvent.sender&&B){let e;e=this.props.mxEvent.getContent().third_party_invite?this.props.mxEvent.target:this.props.mxEvent.sender;const t=![R.a.ThreadsList,R.a.Notification].includes(this.context.timelineRenderingType);W=l.a.createElement("div",{className:"mx_EventTile_avatar"},l.a.createElement(G.b,{member:e,width:B,height:B,viewUserOnClick:t,forceHistorical:this.props.mxEvent.getType()===m.b.RoomMember}))}V&&!0!==this.props.hideSender&&(H=this.context.timelineRenderingType===R.a.Room||this.context.timelineRenderingType===R.a.Search||this.context.timelineRenderingType===R.a.Pinned||this.context.timelineRenderingType===R.a.Thread?l.a.createElement(K.a,{onClick:this.onSenderProfileClick,mxEvent:this.props.mxEvent}):this.context.timelineRenderingType===R.a.ThreadsList?l.a.createElement(K.a,{mxEvent:this.props.mxEvent,withTooltip:!0}):l.a.createElement(K.a,{mxEvent:this.props.mxEvent}));const z=!x&&!this.props.forExport?l.a.createElement(Le,{mxEvent:this.props.mxEvent,reactions:this.state.reactions,permalinkCreator:this.props.permalinkCreator,getTile:this.getTile,getReplyChain:this.getReplyChain,onFocusChange:this.onActionBarFocusChange,isQuoteExpanded:g,toggleThreadExpanded:()=>this.setQuoteExpanded(!g),getRelationsForEvent:this.props.getRelationsForEvent}):void 0,$=this.props.mxEvent.getTs()&&(this.props.alwaysShowTimestamps||this.props.last||this.state.hover||this.state.actionBarFocused||Boolean(this.state.contextMenu));let Y=this.context.timelineRenderingType!==R.a.ThreadsList?this.props.mxEvent.getTs():null===(e=this.state.thread)||void 0===e||null===(t=e.replyToEvent)||void 0===t?void 0:t.getTs();"number"!=typeof Y&&(Y=this.props.mxEvent.getTs());const J=l.a.createElement(q.a,{showRelative:this.context.timelineRenderingType===R.a.ThreadsList,showTwelveHour:this.props.isTwelveHour,ts:Y}),Q=$&&Y?J:null;let X;_||(X=l.a.createElement(Ge,{mxEvent:this.props.mxEvent,reactions:this.state.reactions,key:"mx_EventTile_reactionsRow"}));const Z=l.a.createElement("a",{href:U,onClick:this.onPermalinkClicked,"aria-label":Object(D.m)(new Date(this.props.mxEvent.getTs()),this.props.isTwelveHour),onContextMenu:this.onTimestampContextMenu},Q),ee=this.props.layout===P.a.IRC,te=ee?null:Z,ae=ee?Z:null,ne=this.props.layout===P.a.Bubble?J:null,ie=!ee&&!r&&this.renderE2EPadlock(),se=ee&&!r&&this.renderE2EPadlock();let re;var oe,le;this.props.showReadReceipts&&(re=this.shouldShowSentReceipt||this.shouldShowSendingReceipt?l.a.createElement($t,{messageState:this.props.mxEvent.getAssociatedStatus()}):l.a.createElement(wt,{readReceipts:null!==(oe=this.props.readReceipts)&&void 0!==oe?oe:[],readReceiptMap:null!==(le=this.props.readReceiptMap)&&void 0!==le?le:{},checkUnmounting:this.props.checkUnmounting,suppressAnimation:this.suppressReadReceiptAnimation,isTwelveHour:this.props.isTwelveHour}));let ce;Object(nt.c)(this.props.mxEvent,this.context.showHiddenEvents)&&Object(k.c)(this.props.mxEvent)&&(ce=l.a.createElement(T,{parentEv:this.props.mxEvent,onHeightChanged:this.props.onHeightChanged,ref:this.replyChain,forExport:this.props.forExport,permalinkCreator:this.props.permalinkCreator,layout:this.props.layout,alwaysShowTimestamps:this.props.alwaysShowTimestamps||this.state.hover,isQuoteExpanded:g,setQuoteExpanded:this.setQuoteExpanded,getRelationsForEvent:this.props.getRelationsForEvent}));const de=(null===(a=this.props.mxEvent)||void 0===a?void 0:a.getSender())===I.a.get().getUserId();switch(this.context.timelineRenderingType){case R.a.Thread:return l.a.createElement(this.props.as||"li",{ref:this.ref,className:j,"aria-live":N,"aria-atomic":!0,"data-scroll-tokens":F,"data-has-reply":!!ce,"data-layout":this.props.layout,"data-self":de,"data-event-id":this.props.mxEvent.getId(),onMouseEnter:()=>this.setState({hover:!0}),onMouseLeave:()=>this.setState({hover:!1})},[l.a.createElement("div",{className:"mx_EventTile_senderDetails",key:"mx_EventTile_senderDetails"},W,H),l.a.createElement("div",{className:b,key:"mx_EventTile_line",onContextMenu:this.onContextMenu},this.renderContextMenu(),ce,Object(nt.g)(R.a.Thread,Ut(Ut({},this.props),{},{ref:this.tile,isSeeingThroughMessageHiddenForModeration:h,highlights:this.props.highlights,highlightLink:this.props.highlightLink,onHeightChanged:()=>this.props.onHeightChanged,permalinkCreator:this.props.permalinkCreator}),this.context.showHiddenEvents),z,l.a.createElement("a",{href:U,onClick:this.onPermalinkClicked},Q),re),X]);case R.a.Notification:case R.a.ThreadsList:{const e=I.a.get().getRoom(this.props.mxEvent.getRoomId());return l.a.createElement(this.props.as||"li",{ref:this.ref,className:j,tabIndex:-1,"aria-live":N,"aria-atomic":"true","data-scroll-tokens":F,"data-layout":this.props.layout,"data-shape":this.context.timelineRenderingType,"data-self":de,"data-has-reply":!!ce,onMouseEnter:()=>this.setState({hover:!0}),onMouseLeave:()=>this.setState({hover:!1}),onClick:e=>{var t;const a=e.currentTarget;let n=-1;switch(a.parentElement&&(n=Array.from(a.parentElement.children).indexOf(a)),this.context.timelineRenderingType){case R.a.Notification:this.viewInRoom(e);break;case R.a.ThreadsList:y.a.dispatch({action:S.a.ShowThread,rootEvent:this.props.mxEvent,push:!0}),Qe.b.trackInteraction("WebThreadsPanelThreadItem",e,null!==(t=n)&&void 0!==t?t:-1)}}},l.a.createElement(l.a.Fragment,null,l.a.createElement("div",{className:"mx_EventTile_details"},H,C&&e?l.a.createElement("span",{className:"mx_EventTile_truncated"}," ",Object(f.a)(" in <strong>%(room)s</strong>",{room:e.name},{strong:e=>l.a.createElement("strong",null,e)})):"",Q),C&&e?l.a.createElement("div",{className:"mx_EventTile_avatar"},l.a.createElement(L.a,{room:e,width:28,height:28})):W,l.a.createElement("div",{className:b,key:"mx_EventTile_line"},l.a.createElement("div",{className:"mx_EventTile_body"},this.props.mxEvent.isRedacted()?l.a.createElement(Je.a,{mxEvent:this.props.mxEvent}):this.props.mxEvent.isDecryptionFailure()?l.a.createElement(M.a,{mxEvent:this.props.mxEvent}):qe.a.instance.generatePreviewForEvent(this.props.mxEvent)),this.renderThreadPanelSummary()),this.context.timelineRenderingType===R.a.ThreadsList&&l.a.createElement(At,{viewInRoom:this.viewInRoom,copyLinkToThread:this.copyLinkToThread}),re,l.a.createElement(It,{room:e||void 0,threadId:this.props.mxEvent.getId()})))}case R.a.File:return l.a.createElement(this.props.as||"li",{className:j,"aria-live":N,"aria-atomic":!0,"data-scroll-tokens":F},[l.a.createElement("div",{className:b,key:"mx_EventTile_line",onContextMenu:this.onContextMenu},this.renderContextMenu(),Object(nt.g)(R.a.File,Ut(Ut({},this.props),{},{ref:this.tile,isSeeingThroughMessageHiddenForModeration:h,highlights:this.props.highlights,highlightLink:this.props.highlightLink,onHeightChanged:this.props.onHeightChanged,permalinkCreator:this.props.permalinkCreator}),this.context.showHiddenEvents)),l.a.createElement("a",{className:"mx_EventTile_senderDetailsLink",key:"mx_EventTile_senderDetailsLink",href:U,onClick:this.onPermalinkClicked},l.a.createElement("div",{className:"mx_EventTile_senderDetails",onContextMenu:this.onTimestampContextMenu},H,Q))]);default:return l.a.createElement(this.props.as||"li",{ref:this.ref,className:j,tabIndex:-1,"aria-live":N,"aria-atomic":"true","data-scroll-tokens":F,"data-layout":this.props.layout,"data-self":de,"data-event-id":this.props.mxEvent.getId(),"data-has-reply":!!ce,onMouseEnter:()=>this.setState({hover:!0}),onMouseLeave:()=>this.setState({hover:!1})},l.a.createElement(l.a.Fragment,null,ae,H,se,W,l.a.createElement("div",{className:b,key:"mx_EventTile_line",onContextMenu:this.onContextMenu},this.renderContextMenu(),te,ie,ce,Object(nt.g)(this.context.timelineRenderingType,Ut(Ut({},this.props),{},{ref:this.tile,isSeeingThroughMessageHiddenForModeration:h,timestamp:ne,highlights:this.props.highlights,highlightLink:this.props.highlightLink,onHeightChanged:this.props.onHeightChanged,permalinkCreator:this.props.permalinkCreator}),this.context.showHiddenEvents),z,this.props.layout===P.a.IRC&&l.a.createElement(l.a.Fragment,null,X,this.renderThreadInfo())),this.props.layout!==P.a.IRC&&l.a.createElement(l.a.Fragment,null,X,this.renderThreadInfo()),re))}}}r()(Ft,"defaultProps",{onHeightChanged:function(){},forExport:!1,layout:P.a.Group}),r()(Ft,"contextType",R.b);const Bt=Object(o.forwardRef)(((e,t)=>l.a.createElement(l.a.Fragment,null,l.a.createElement(at,{mxEvent:e.mxEvent,layout:e.layout},l.a.createElement(Ft,i()({ref:t},e))))));var Vt;t.b=Bt;function Wt(e){return l.a.createElement(qt,i()({title:Object(f.a)("Encrypted by an unverified session"),icon:Vt.Warning},e))}function Ht(e){return l.a.createElement(qt,i()({title:Object(f.a)("Unencrypted"),icon:Vt.Warning},e))}function zt(e){return l.a.createElement(qt,i()({title:Object(f.a)("Encrypted by a deleted session"),icon:Vt.Normal},e))}function Gt(e){return l.a.createElement(qt,i()({title:Object(f.a)("The authenticity of this encrypted message can't be guaranteed on this device."),icon:Vt.Normal},e))}function Kt(e){return l.a.createElement(qt,i()({title:Object(f.a)("This message could not be decrypted"),icon:Vt.DecryptionFailure},e))}!function(e){e.Normal="normal",e.Warning="warning",e.DecryptionFailure="decryption_failure"}(Vt||(Vt={}));class qt extends l.a.Component{constructor(e){super(e),r()(this,"onHoverStart",(()=>{this.setState({hover:!0})})),r()(this,"onHoverEnd",(()=>{this.setState({hover:!1})})),this.state={hover:!1}}render(){let e=null;this.state.hover&&(e=l.a.createElement(V.b,{className:"mx_EventTile_e2eIcon_tooltip",label:this.props.title}));const t=`mx_EventTile_e2eIcon mx_EventTile_e2eIcon_${this.props.icon}`;return l.a.createElement("div",{className:t,onMouseEnter:this.onHoverStart,onMouseLeave:this.onHoverEnd},e)}}function $t(e){let{messageState:t}=e;const a=!t||"sent"===t,n="not_sent"===t,i=d()({mx_EventTile_receiptSent:a,mx_EventTile_receiptSending:!a&&!n});let s=null;n&&(s=l.a.createElement(H.a,{notification:W.a.RED_EXCLAMATION}));let r=Object(f.a)("Sending your message…");"encrypting"===t?r=Object(f.a)("Encrypting your message…"):a?r=Object(f.a)("Your message was sent"):n&&(r=Object(f.a)("Failed to send"));const[{showTooltip:o,hideTooltip:c},m]=bt({label:r,alignment:V.a.TopRight});return l.a.createElement("div",{className:"mx_EventTile_msgOption"},l.a.createElement("div",{className:"mx_ReadReceiptGroup"},l.a.createElement("div",{className:"mx_ReadReceiptGroup_button",onMouseOver:o,onMouseLeave:c,onFocus:o,onBlur:c},l.a.createElement("span",{className:"mx_ReadReceiptGroup_container"},l.a.createElement("span",{className:i},s))),m))}},349:function(e,t,a){"use strict";a.d(t,"a",(function(){return h}));var n=a(120),i=a.n(n),s=a(321),r=a(1),o=a(121);var l=a(131),c=a(13),d=a.n(c);class m{constructor(){d()(this,"hsUrl",void 0),d()(this,"hsName",void 0),d()(this,"hsNameIsDifferent",void 0),d()(this,"isUrl",void 0),d()(this,"isDefault",void 0),d()(this,"isNameResolvable",void 0),d()(this,"warning",void 0)}}const u=[s.a.ERROR_INVALID_HOMESERVER,s.a.ERROR_INVALID_IDENTITY_SERVER];class h{static isLivelinessError(e){return!!e&&!!u.find((t=>"string"==typeof e?t===e:t===e.message))}static authComponentStateForError(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"login";if(!e)return{serverIsAlive:!0,serverErrorIsFatal:!1,serverDeadError:null};let a=Object(o.a)("Cannot reach homeserver"),n=Object(o.a)("Ensure you have a stable internet connection, or get in touch with the server admin");if(!h.isLivelinessError(e)){const e=l.b.get().brand;a=Object(o.a)("Your %(brand)s is misconfigured",{brand:e}),n=Object(o.a)("Ask your %(brand)s admin to check <a>your config</a> for incorrect or duplicate entries.",{brand:e},{a:e=>i.a.createElement("a",{href:"https://github.com/vector-im/element-web/blob/master/docs/config.md",target:"_blank",rel:"noreferrer noopener"},e)})}let r=!0;return("string"==typeof e?e:e.message)===s.a.ERROR_INVALID_IDENTITY_SERVER&&(r=!1,a=Object(o.a)("Cannot reach identity server"),n="register"===t?Object(o.a)("You can register, but some features will be unavailable until the identity server is back online. If you keep seeing this warning, check your configuration or contact a server admin."):"reset_password"===t?Object(o.a)("You can reset your password, but some features will be unavailable until the identity server is back online. If you keep seeing this warning, check your configuration or contact a server admin."):Object(o.a)("You can log in, but some features will be unavailable until the identity server is back online. If you keep seeing this warning, check your configuration or contact a server admin.")),{serverIsAlive:!1,serverErrorIsFatal:r,serverDeadError:i.a.createElement("div",null,i.a.createElement("strong",null,a),i.a.createElement("div",null,n))}}static async validateServerConfigWithStaticUrls(e,t){let a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!e)throw Object(o.i)(Object(o.c)("No homeserver URL provided"));const n={"m.homeserver":{base_url:e}};t&&(n["m.identity_server"]={base_url:t});const i=await s.a.fromDiscoveryConfig(n),r=new URL(e).hostname;return h.buildValidatedConfigFromDiscovery(r,i,a,!0)}static async validateServerName(e){const t=await s.a.findClientConfig(e);return h.buildValidatedConfigFromDiscovery(e,t)}static buildValidatedConfigFromDiscovery(e,t){let a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!t||!t["m.homeserver"])throw r.a.error("Ended up in a state of not knowing which homeserver to connect to."),Object(o.i)(Object(o.c)("Unexpected error resolving homeserver configuration"));const i=t["m.homeserver"],c=t["m.identity_server"],d=l.b.get("validated_server_config");let u=d&&d.isUrl;if(c&&c.state===s.a.SUCCESS)u=c.base_url;else if(c&&c.state!==s.a.PROMPT){if(r.a.error("Error determining preferred identity server URL:",c),c.state===s.a.FAIL_ERROR){if(-1!==s.a.ALL_ERRORS.indexOf(c.error))throw Object(o.i)(c.error);throw Object(o.i)(Object(o.c)("Unexpected error resolving identity server configuration"))}i.error=s.a.ERROR_INVALID_IDENTITY_SERVER,c.base_url&&(u=c.base_url)}if(i.state!==s.a.SUCCESS&&(r.a.error("Error processing homeserver config:",i),!a||!h.isLivelinessError(i.error))){if(-1!==s.a.ALL_ERRORS.indexOf(i.error))throw Object(o.i)(i.error);throw Object(o.i)(Object(o.c)("Unexpected error resolving homeserver configuration"))}const p=i.base_url;let g=e||i.server_name;const v=new URL(p);if(g||(g=v.hostname),!g)throw r.a.error("Failed to parse homeserver name from homeserver URL"),Object(o.i)(Object(o.c)("Unexpected error resolving homeserver configuration"));return function(e,t){const a=new e;return Object.assign(a,t),a}(m,{hsUrl:p,hsName:g,hsNameIsDifferent:v.hostname!==g,isUrl:u,isDefault:!1,warning:i.error,isNameResolvable:!n})}}},399:function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(859),l=a(135),c=a(121),d=a(473);function m(e){return e===d.a.Done?a(1429).default:a(863).default}class u extends r.a.Component{constructor(e){super(e),i()(this,"store",void 0),i()(this,"onStoreUpdate",(()=>{this.setState({icon:m(this.store.phase)})})),this.store=d.b.sharedInstance(),this.state={icon:m(this.store.phase)}}componentDidMount(){this.store.on("update",this.onStoreUpdate)}componentWillUnmount(){this.store.removeListener("update",this.onStoreUpdate)}render(){return r.a.createElement(l.a,{headerImage:this.state.icon,onFinished:this.props.onFinished,title:Object(c.a)("Verify this session")},r.a.createElement(o.a,{onFinished:this.props.onFinished}))}}},400:function(e,t,a){(function(a){var n,i,s;i=[],void 0===(s="function"==typeof(n=function(){"use strict";function t(e,t){return void 0===t?t={autoBom:!1}:"object"!=typeof t&&(console.warn("Deprecated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\ufeff",e],{type:e.type}):e}function n(e,t,a){var n=new XMLHttpRequest;n.open("GET",e),n.responseType="blob",n.onload=function(){l(n.response,t,a)},n.onerror=function(){console.error("could not download file")},n.send()}function i(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return 200<=t.status&&299>=t.status}function s(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(a){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var r="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof a&&a.global===a?a:void 0,o=r.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),l=r.saveAs||("object"!=typeof window||window!==r?function(){}:"download"in HTMLAnchorElement.prototype&&!o?function(e,t,a){var o=r.URL||r.webkitURL,l=document.createElement("a");t=t||e.name||"download",l.download=t,l.rel="noopener","string"==typeof e?(l.href=e,l.origin===location.origin?s(l):i(l.href)?n(e,t,a):s(l,l.target="_blank")):(l.href=o.createObjectURL(e),setTimeout((function(){o.revokeObjectURL(l.href)}),4e4),setTimeout((function(){s(l)}),0))}:"msSaveOrOpenBlob"in navigator?function(e,a,r){if(a=a||e.name||"download","string"!=typeof e)navigator.msSaveOrOpenBlob(t(e,r),a);else if(i(e))n(e,a,r);else{var o=document.createElement("a");o.href=e,o.target="_blank",setTimeout((function(){s(o)}))}}:function(e,t,a,i){if((i=i||open("","_blank"))&&(i.document.title=i.document.body.innerText="downloading..."),"string"==typeof e)return n(e,t,a);var s="application/octet-stream"===e.type,l=/constructor/i.test(r.HTMLElement)||r.safari,c=/CriOS\/[\d]+/.test(navigator.userAgent);if((c||s&&l||o)&&"undefined"!=typeof FileReader){var d=new FileReader;d.onloadend=function(){var e=d.result;e=c?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),i?i.location.href=e:location=e,i=null},d.readAsDataURL(e)}else{var m=r.URL||r.webkitURL,u=m.createObjectURL(e);i?i.location=u:location.href=u,i=null,setTimeout((function(){m.revokeObjectURL(u)}),4e4)}});r.saveAs=l.saveAs=l,e.exports=l})?n.apply(t,i):n)||(e.exports=s)}).call(this,a(14))},401:function(e,t,a){"use strict";a.d(t,"a",(function(){return g}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(1),l=a(121),c=a(122),d=a(157),m=a(127),u=a(131),h=a(276),p=a(123);class g extends r.a.PureComponent{constructor(e){super(e),i()(this,"onClearCacheAndReload",(()=>{d.a.get()&&(c.a.get().stopClient(),c.a.get().store.deleteAllData().then((()=>{d.a.get().reload()})))})),i()(this,"onBugReport",(()=>{m.b.createDialog(h.a,{label:"react-soft-crash",error:this.state.error})})),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){let{componentStack:a}=t;o.a.error(e),o.a.error("The above error occurred while React was rendering the following components:",a)}render(){if(this.state.error){const e="https://github.com/vector-im/element-web/issues/new/choose";let t,a;return u.b.get().bug_report_endpoint_url&&(t=r.a.createElement(r.a.Fragment,null,r.a.createElement("p",null,Object(l.a)("Please <newIssueLink>create a new issue</newIssueLink> on GitHub so that we can investigate this bug.",{},{newIssueLink:t=>r.a.createElement("a",{target:"_blank",rel:"noreferrer noopener",href:e},t)})),r.a.createElement("p",null,Object(l.a)("If you've submitted a bug via GitHub, debug logs can help us track down the problem. "),Object(l.a)("Debug logs contain application usage data including your username, the IDs or aliases of the rooms you have visited, which UI elements you last interacted with, and the usernames of other users. They do not contain messages.")),r.a.createElement(p.a,{onClick:this.onBugReport,kind:"primary"},Object(l.a)("Submit debug logs")))),c.a.get()&&(a=r.a.createElement(p.a,{onClick:this.onClearCacheAndReload,kind:"danger"},Object(l.a)("Clear cache and reload"))),r.a.createElement("div",{className:"mx_ErrorBoundary"},r.a.createElement("div",{className:"mx_ErrorBoundary_body"},r.a.createElement("h1",null,Object(l.a)("Something went wrong!")),t,a))}return this.props.children}}},470:function(e,t,a){"use strict";(function(e){a.d(t,"h",(function(){return q})),a.d(t,"b",(function(){return $})),a.d(t,"a",(function(){return Y})),a.d(t,"d",(function(){return J})),a.d(t,"c",(function(){return Q})),a.d(t,"j",(function(){return ee})),a.d(t,"k",(function(){return te})),a.d(t,"e",(function(){return ae})),a.d(t,"i",(function(){return oe})),a.d(t,"l",(function(){return le})),a.d(t,"g",(function(){return ce})),a.d(t,"f",(function(){return de})),a.d(t,"m",(function(){return pe}));var n=a(136),i=a(288),s=a(322),r=a(1),o=a(343),l=a(122),c=a(292),d=a(316),m=a(928),u=a(274),h=a(618),p=a(1426),g=a(124),v=a(164),b=a(127),f=a(332),y=a(157),E=a(471),_=a(432),w=a(125),S=a(198),O=a(283),C=a(526),x=a(1549),j=a(565),k=a(342),R=a(868),I=a(189),T=a(183),N=a(1430),P=a(144),D=a(121),M=a(1431),A=a(1432),L=a(1433),U=a(1434),F=a(576),B=a(131),V=a(1547),W=a(128),H=a(524),z=a(154);const G="mx_hs_url",K="mx_is_url";async function q(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{let t=e.enableGuest||!1;const a=e.guestHsUrl,i=e.guestIsUrl,s=e.fragmentQueryParams||{},o=e.defaultDeviceDisplayName;if(t&&!a&&(r.a.warn("Cannot enable guest access: can't determine HS URL to use"),t=!1),t&&s.guest_user_id&&s.guest_access_token)return r.a.log("Using guest access credentials"),ne({userId:s.guest_user_id,accessToken:s.guest_access_token,homeserverUrl:a,identityServerUrl:i,guest:!0},!0).then((()=>!0));return!!await ee({ignoreGuest:Boolean(e.ignoreGuest)})||!!t&&function(e,t,a){r.a.log(`Doing guest login on ${e}`);return Object(n.createClient)({baseUrl:e}).registerGuest({body:{initial_device_display_name:a}}).then((a=>(r.a.log(`Registered as guest: ${a.user_id}`),ne({userId:a.user_id,deviceId:a.device_id,accessToken:a.access_token,homeserverUrl:e,identityServerUrl:t,guest:!0},!0).then((()=>!0)))),(e=>(r.a.error("Failed to register as guest",e),!1)))}(a,i,o)}catch(e){return!(e instanceof ie)&&async function(e){r.a.error("Unable to load session",e);const t=b.b.createDialog(L.a,{error:e}),[a]=await t.finished;if(a)return await he(),!1;return q()}(e)}}async function $(){const{hsUrl:e,userId:t,hasAccessToken:a,isGuest:n}=await Q();return e&&t&&a?[t,n]:[null,null]}function Y(e,t,a){if(!e.loginToken)return Promise.resolve(!1);const i=localStorage.getItem(k.a),s=localStorage.getItem(k.c);return i?Object(E.b)(i,s,"m.login.token",{token:e.loginToken,initial_device_display_name:t}).then((function(e){return r.a.log("Logged in with token"),he().then((async()=>(await se(e),sessionStorage.setItem("mx_fresh_login",String(!0)),!0)))})).catch((e=>(b.b.createDialog(P.a,{title:Object(D.a)("We couldn't log you in"),description:"ConnectionError"===e.name?Object(D.a)("Your homeserver was unreachable and was not able to log you in. Please try again. If this continues, please contact your homeserver administrator."):Object(D.a)("Your homeserver rejected your log in attempt. This could be due to things just taking too long. Please try again. If this continues, please contact your homeserver administrator."),button:Object(D.a)("Try again"),onFinished:e=>{if(e){var t;const e=Object(n.createClient)({baseUrl:i,idBaseUrl:s}),r=localStorage.getItem(k.b)||void 0;null===(t=y.a.get())||void 0===t||t.startSingleSignOn(e,"sso",a,r,o.c.LOGIN)}}}),r.a.error("Failed to log in with login token:"),r.a.error(e),!1))):(r.a.warn("Cannot log in with token: can't determine HS URL to use"),b.b.createDialog(P.a,{title:Object(D.a)("We couldn't log you in"),description:Object(D.a)("We asked the browser to remember which homeserver you use to let you sign in, but unfortunately your browser has forgotten it. Go to the sign in page and try again."),button:Object(D.a)("Try again")}),Promise.resolve(!1))}function J(e){if(e.reason===i.c.TOGGLED_LAZY_LOADING)return Promise.resolve().then((()=>{const t=e.value;return new Promise(t?e=>{b.b.createDialog(M.a,{onFinished:e})}:e=>{b.b.createDialog(A.a,{onFinished:e,host:window.location.host})})})).then((()=>l.a.get().store.deleteAllData())).then((()=>{var e;null===(e=y.a.get())||void 0===e||e.reload()}))}async function Q(){const e=localStorage.getItem(G),t=localStorage.getItem(K);let a;try{a=await _.c("account","mx_access_token")}catch(e){r.a.error("StorageManager.idbLoad failed for account:mx_access_token",e)}if(!a&&(a=localStorage.getItem("mx_access_token"),a))try{await _.d("account","mx_access_token",a),localStorage.removeItem("mx_access_token")}catch(e){r.a.error("migration of access token to IndexedDB failed",e)}const n="true"===localStorage.getItem("mx_has_access_token")||!!a,i=localStorage.getItem("mx_user_id"),s=localStorage.getItem("mx_device_id");let o;return o=null!==localStorage.getItem("mx_is_guest")?"true"===localStorage.getItem("mx_is_guest"):"true"===localStorage.getItem("matrix-is-guest"),{hsUrl:e,isUrl:t,hasAccessToken:n,accessToken:a,userId:i,deviceId:s,isGuest:o}}async function X(e){const t=new Uint8Array(e.length);for(let a=0;a<e.length;a++)t[a]=e.charCodeAt(a);const a=await window.crypto.subtle.importKey("raw",t,"HKDF",!1,["deriveBits"]);return t.fill(0),new Uint8Array(await window.crypto.subtle.deriveBits({name:"HKDF",hash:"SHA-256",salt:new Uint8Array(32),info:new Uint8Array(0)},a,256))}async function Z(){if(await new Promise((e=>{b.b.createDialog(U.a,{onFinished:e})})))throw await he(),new ie("Aborting login in progress because of storage inconsistency")}async function ee(e){const t=null==e?void 0:e.ignoreGuest;if(!localStorage)return!1;const{hsUrl:a,isUrl:n,hasAccessToken:i,accessToken:o,userId:l,deviceId:c,isGuest:d}=await Q();if(i&&!o&&await Z(),o&&l&&a){if(t&&d)return r.a.log("Ignoring stored guest account: "+l),!1;let e=o;const i=await y.a.get().getPickleKey(l,c);if(i){if(r.a.log("Got pickle key"),"string"!=typeof o){const t=await X(i);e=await Object(s.b)(o,t,"access_token"),t.fill(0)}}else r.a.log("No pickle key available");const m="true"===sessionStorage.getItem("mx_fresh_login");return sessionStorage.removeItem("mx_fresh_login"),r.a.log(`Restoring session for ${l}`),await ne({userId:l,deviceId:c,accessToken:e,homeserverUrl:a,identityServerUrl:n,guest:d,pickleKey:i,freshLogin:m},!1),!0}return r.a.log("No previous session found."),!1}async function te(e){var t;e.freshLogin=!0,pe();const a=e.userId&&e.deviceId?await(null===(t=y.a.get())||void 0===t?void 0:t.createPickleKey(e.userId,e.deviceId)):null;return a?r.a.log("Created pickle key"):r.a.log("Pickle key not created"),ne(Object.assign({},e,{pickleKey:a}),!0)}async function ae(e){const t=l.a.get().getUserId(),a=l.a.get().getDeviceId();pe(),localStorage.removeItem("mx_soft_logout"),re=!1;const n=e.userId!==t||e.deviceId!==a;return n&&r.a.warn("Clearing all data: Old session belongs to a different user/session"),e.pickleKey||(r.a.info("Lifecycle#hydrateSession: Pickle key not provided - trying to get one"),e.pickleKey=await y.a.get().getPickleKey(e.userId,e.deviceId)),ne(e,n)}async function ne(e,t){e.guest=Boolean(e.guest);const a=ce();r.a.log("setLoggedIn: mxid: "+e.userId+" deviceId: "+e.deviceId+" guest: "+e.guest+" hs: "+e.homeserverUrl+" softLogout: "+a," freshLogin: "+e.freshLogin),g.a.dispatch({action:"on_logging_in"},!0),t&&await he();const n=await _.a();n.dataInLocalStorage&&n.cryptoInited&&!n.dataInCryptoStore&&await Z(),l.a.replaceUsingCreds(e),Object(F.c)(e.userId),I.a.instance.isEnabled()&&I.a.instance.startListeningToSettingsChanges();const i=l.a.get();if(e.freshLogin&&w.b.getValue("feature_dehydration")){const t=await i.rehydrateDevice();t&&(e.deviceId=t),delete e.freshLogin}if(localStorage)try{await se(e),sessionStorage.removeItem("mx_fresh_login")}catch(e){r.a.warn("Error using local storage: can't persist session!",e)}else r.a.warn("No local storage available: can't persist session!");return g.a.fire(W.a.OnLoggedIn),await me(!a),i}g.a.register((e=>{if(e.action===W.a.TriggerLogout)ue();else if(e.action===W.a.OverwriteLogin){ne(e.credentials,!0)}}));class ie extends Error{}async function se(e){var t;if(localStorage.setItem(G,e.homeserverUrl),e.identityServerUrl&&localStorage.setItem(K,e.identityServerUrl),localStorage.setItem("mx_user_id",e.userId),localStorage.setItem("mx_is_guest",JSON.stringify(e.guest)),e.accessToken?localStorage.setItem("mx_has_access_token","true"):localStorage.deleteItem("mx_has_access_token"),e.pickleKey){let t;try{const a=await X(e.pickleKey);t=await Object(s.c)(e.accessToken,a,"access_token"),a.fill(0)}catch(e){r.a.warn("Could not encrypt access token",e)}try{await _.d("account","mx_access_token",t||e.accessToken)}catch(t){localStorage.setItem("mx_access_token",e.accessToken)}localStorage.setItem("mx_has_pickle_key",String(!0))}else{try{await _.d("account","mx_access_token",e.accessToken)}catch(t){localStorage.setItem("mx_access_token",e.accessToken)}"true"===localStorage.getItem("mx_has_pickle_key")&&r.a.error("Expected a pickle key, but none provided. Encryption may not work.")}e.deviceId&&localStorage.setItem("mx_device_id",e.deviceId),null===(t=c.a.persistCredentials)||void 0===t||t.call(c.a,e),r.a.log(`Session persisted for ${e.userId}`)}let re=!1;function oe(){if(!l.a.get())return;if(I.a.instance.logout(),l.a.get().isGuest())return void e((()=>ue()));re=!0;const t=l.a.get();y.a.get().destroyPickleKey(t.getUserId(),t.getDeviceId()),t.logout(!0).then(ue,(e=>{r.a.warn("Failed to call logout API: token will not be invalidated",e),ue()}))}function le(){l.a.get()&&(localStorage.setItem("mx_soft_logout","true"),r.a.log("Soft logout initiated"),re=!0,g.a.dispatch({action:"on_client_not_viable"}),pe(!1))}function ce(){return"true"===localStorage.getItem("mx_soft_logout")}function de(){return re}async function me(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];r.a.log("Lifecycle: Starting MatrixClient"),g.a.dispatch({action:"will_start_client"},!0),z.b.instance.typingStore.reset(),S.a.sharedInstance().reset(),V.a.instance.prepare(),u.default.start(),h.a.sharedInstance().start(),v.a.makeShared().start(),O.a.sharedInstance().startWatching(),f.b.instance.start(),T.b.instance.start(),C.a.sharedInstance().start(),e?(await d.a.init(),await l.a.start()):(r.a.warn("Caller requested only auxiliary services be started"),await l.a.assign()),w.b.runMigrations(),x.a.sharedInstance().start(),w.b.getValue("lowBandwidth")||p.a.start(),j.a.getInstance().start(),g.a.dispatch({action:"client_started"}),ce()&&le()}async function ue(){var e;g.a.fire(W.a.OnLoggedOut,!0),pe(),await he({deleteEverything:!0}),null===(e=N.a.onLoggedOutAndStorageCleared)||void 0===e||e.call(N.a),B.b.get().logout_redirect_url&&(r.a.log("Redirecting to external provider to finish logout"),window.setTimeout((()=>{window.location.href=B.b.get().logout_redirect_url}),100)),re=!1}async function he(e){var t;if(window.localStorage){const t=R.a.instance.getWireInvites(),a=window.localStorage.getItem("mx_registration_time");window.localStorage.clear(),H.a.clear();try{await _.b("account","mx_access_token")}catch(e){r.a.error("idbDelete failed for account:mx_access_token",e)}null!=e&&e.deleteEverything||(t.forEach((e=>{const t=e.roomId;delete e.roomId,R.a.instance.storeInvite(t,e)})),a&&window.localStorage.setItem("mx_registration_time",a))}null===(t=window.sessionStorage)||void 0===t||t.clear();const a=Object(m.a)({baseUrl:""});await d.a.deleteEventIndex(),await a.clearStores()}function pe(){var e;let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];u.default.stop(),T.b.instance.stop(),h.a.sharedInstance().stop(),z.b.instance.typingStore.reset(),p.a.stop(),f.b.instance.stop(),O.a.sharedInstance().stopWatching(),C.a.sharedInstance().stop(),x.a.sharedInstance().stop(),null===(e=v.a.shared())||void 0===e||e.stop(),d.a.stop();const a=l.a.get();a&&(a.stopClient(),a.removeAllListeners(),t&&(l.a.unset(),d.a.unset()))}window.mxLoginWithAccessToken=async(e,t)=>{const a=Object(n.createClient)({baseUrl:e,accessToken:t}),{user_id:i}=await a.whoami();await ne({homeserverUrl:e,accessToken:t,userId:i},!0)}}).call(this,a(54).setImmediate)},471:function(e,t,a){"use strict";a.d(t,"a",(function(){return c})),a.d(t,"b",(function(){return d}));var n=a(13),i=a.n(n),s=a(136),r=a(1),o=a(343),l=a(292);class c{constructor(e,t,a,n){this.hsUrl=e,this.isUrl=t,this.fallbackHsUrl=a,i()(this,"flows",[]),i()(this,"defaultDeviceDisplayName",void 0),i()(this,"tempClient",null),this.defaultDeviceDisplayName=n.defaultDeviceDisplayName}getHomeserverUrl(){return this.hsUrl}getIdentityServerUrl(){return this.isUrl}setHomeserverUrl(e){this.tempClient=null,this.hsUrl=e}setIdentityServerUrl(e){this.tempClient=null,this.isUrl=e}createTemporaryClient(){return this.tempClient||(this.tempClient=Object(s.createClient)({baseUrl:this.hsUrl,idBaseUrl:this.isUrl})),this.tempClient}async getFlows(){const e=this.createTemporaryClient(),{flows:t}=await e.loginFlows(),a=t.find((e=>"m.login.sso"===e.type&&o.a.findIn(e)));return this.flows=a?[a]:t,this.flows}loginViaPassword(e,t,a,n){const i=!!e&&e.indexOf("@")>0;let s;s=t&&a?{type:"m.id.phone",country:t,phone:a,number:a}:i?{type:"m.id.thirdparty",medium:"email",address:e}:{type:"m.id.user",user:e};const o={password:n,identifier:s,initial_device_display_name:this.defaultDeviceDisplayName},l=e=>d(this.fallbackHsUrl,this.isUrl,"m.login.password",o).catch((t=>{throw r.a.log("fallback HS login failed",t),e}));let c=null;return d(this.hsUrl,this.isUrl,"m.login.password",o).catch((e=>{if(c=e,403===e.httpStatus&&this.fallbackHsUrl)return l(c);throw c})).catch((e=>{throw r.a.log("Login failed",e),e}))}}async function d(e,t,a,n){var i;const o=Object(s.createClient)({baseUrl:e,idBaseUrl:t}),c=await o.login(a,n),d=c.well_known;d&&(d["m.homeserver"]&&d["m.homeserver"].base_url&&(e=d["m.homeserver"].base_url,r.a.log(`Overrode homeserver setting with ${e} from login response`)),d["m.identity_server"]&&d["m.identity_server"].base_url&&(t=d["m.identity_server"].base_url,r.a.log(`Overrode IS setting with ${t} from login response`)));const m={homeserverUrl:e,identityServerUrl:t,userId:c.user_id,deviceId:c.device_id,accessToken:c.access_token};return null===(i=l.a.examineLoginResponse)||void 0===i||i.call(l.a,c,m),m}},472:function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(120),i=a.n(n),s=a(122),r=a(121),o=a(135),l=a(652);class c extends i.a.Component{constructor(e){var t;super(e),this.state={verificationRequest:this.props.verificationRequest},null===(t=this.props.verificationRequestPromise)||void 0===t||t.then((e=>{this.setState({verificationRequest:e})}))}render(){const e=this.state.verificationRequest,t=null==e?void 0:e.otherUserId,a=this.props.member||(t?s.a.get().getUser(t):null),n=null!=e&&e.isSelfVerification?Object(r.a)("Verify other device"):Object(r.a)("Verification Request");return i.a.createElement(o.a,{className:"mx_InfoDialog",onFinished:this.props.onFinished,contentId:"mx_Dialog_content",title:n,hasCancel:!0},i.a.createElement(l.a,{layout:"dialog",verificationRequest:this.props.verificationRequest,verificationRequestPromise:this.props.verificationRequestPromise,onClose:this.props.onFinished,member:a,isRoomEncrypted:!1}))}}},473:function(e,t,a){"use strict";a.d(t,"a",(function(){return v})),a.d(t,"b",(function(){return b}));var n=a(13),i=a.n(n),s=a(17),r=a.n(s),o=a(239),l=a(1),c=a(174),d=a(122),m=a(250),u=a(127),h=a(256),p=a(121),g=a(154);let v;!function(e){e[e.Loading=0]="Loading",e[e.Intro=1]="Intro",e[e.Busy=2]="Busy",e[e.Done=3]="Done",e[e.ConfirmSkip=4]="ConfirmSkip",e[e.Finished=5]="Finished",e[e.ConfirmReset=6]="ConfirmReset"}(v||(v={}));class b extends r.a{constructor(){super(...arguments),i()(this,"started",void 0),i()(this,"phase",void 0),i()(this,"verificationRequest",null),i()(this,"backupInfo",null),i()(this,"keyId",null),i()(this,"keyInfo",null),i()(this,"hasDevicesToVerifyAgainst",void 0),i()(this,"onUserTrustStatusChanged",(e=>{if(e!==d.a.get().getUserId())return;d.a.get().getCrossSigningId()&&(this.phase=v.Done,this.emit("update"))})),i()(this,"onVerificationRequest",(e=>{this.setActiveVerificationRequest(e)})),i()(this,"onVerificationRequestChange",(()=>{var e,t;if(null!==(e=this.verificationRequest)&&void 0!==e&&e.cancelled)this.verificationRequest.off(o.l.Change,this.onVerificationRequestChange),this.verificationRequest=null,this.emit("update");else if((null===(t=this.verificationRequest)||void 0===t?void 0:t.phase)===o.b){this.verificationRequest.off(o.l.Change,this.onVerificationRequestChange),this.verificationRequest=null;const e=d.a.get().getCrossSigningId();this.phase=e?v.Done:v.Busy,this.emit("update")}}))}static sharedInstance(){return window.mxSetupEncryptionStore||(window.mxSetupEncryptionStore=new b),window.mxSetupEncryptionStore}start(){if(this.started)return;this.started=!0,this.phase=v.Loading;const e=d.a.get();e.on(c.b.VerificationRequest,this.onVerificationRequest),e.on(c.b.UserTrustStatusChanged,this.onUserTrustStatusChanged);const t=e.getVerificationRequestsToDeviceInProgress(e.getUserId());t.length&&this.setActiveVerificationRequest(t[t.length-1]),this.fetchKeyInfo()}stop(){var e;this.started&&(this.started=!1,null===(e=this.verificationRequest)||void 0===e||e.off(o.l.Change,this.onVerificationRequestChange),d.a.get()&&(d.a.get().removeListener(c.b.VerificationRequest,this.onVerificationRequest),d.a.get().removeListener(c.b.UserTrustStatusChanged,this.onUserTrustStatusChanged)))}async fetchKeyInfo(){if(!this.started)return;const e=d.a.get(),t=await e.isSecretStored("m.cross_signing.master");null===t||0===Object.keys(t).length?(this.keyId=null,this.keyInfo=null):(this.keyId=Object.keys(t)[0],this.keyInfo=t[this.keyId]);const a=await e.getDehydratedDevice(),n=e.getUserId(),i=e.getStoredCrossSigningForUser(n);this.hasDevicesToVerifyAgainst=e.getStoredDevicesForUser(n).some((e=>e.getIdentityKey()&&(!a||e.deviceId!=a.device_id)&&(null==i?void 0:i.checkDeviceTrust(i,e,!1,!0).isCrossSigningVerified()))),this.phase=v.Intro,this.emit("update")}async usePassPhrase(){this.phase=v.Busy,this.emit("update");const e=d.a.get();try{const t=await e.getKeyBackupVersion();this.backupInfo=t,this.emit("update"),await new Promise(((a,n)=>{Object(m.b)((async()=>{await e.checkOwnCrossSigningTrust(),a(),t&&await e.restoreKeyBackupWithSecretStorage(t)})).catch(n)})),e.getCrossSigningId()&&(this.phase=v.Done,this.emit("update"))}catch(e){e instanceof m.a||l.a.log(e),this.phase=v.Intro,this.emit("update")}}skip(){this.phase=v.ConfirmSkip,this.emit("update")}skipConfirm(){this.phase=v.Finished,this.emit("update")}returnAfterSkip(){this.phase=v.Intro,this.emit("update")}reset(){this.phase=v.ConfirmReset,this.emit("update")}async resetConfirm(){try{await Object(m.b)((async()=>{const e=d.a.get();await e.bootstrapCrossSigning({authUploadDeviceSigningKeys:async t=>{const a=g.b.instance.accountPasswordStore.getPassword();if(a)return void await t({type:"m.login.password",identifier:{type:"m.id.user",user:e.getUserId()},user:e.getUserId(),password:a});const{finished:n}=u.b.createDialog(h.a,{title:Object(p.a)("Setting up keys"),matrixClient:e,makeRequest:t}),[i]=await n;if(!i)throw new Error("Cross-signing key upload auth canceled")},setupNewCrossSigning:!0}),this.phase=v.Finished}),!0)}catch(e){l.a.error("Error resetting cross-signing",e),this.phase=v.Intro}this.emit("update")}returnAfterReset(){this.phase=v.Intro,this.emit("update")}done(){var e;this.phase=v.Finished,this.emit("update"),null===(e=d.a.get().crypto)||void 0===e||e.cancelAndResendAllOutgoingKeyRequests()}async setActiveVerificationRequest(e){this.started&&e.otherUserId===d.a.get().getUserId()&&(this.verificationRequest&&this.verificationRequest.off(o.l.Change,this.onVerificationRequestChange),this.verificationRequest=e,await e.accept(),e.on(o.l.Change,this.onVerificationRequestChange),this.emit("update"))}lostKeys(){return!this.hasDevicesToVerifyAgainst&&!this.keyInfo}}},474:function(e,t,a){"use strict";a.d(t,"a",(function(){return s})),a.d(t,"b",(function(){return o}));var n=a(858),i=a.n(n);let s;!function(e){e.Desktop="Desktop",e.Mobile="Mobile",e.Web="Web",e.Unknown="Unknown"}(s||(s={}));const r=(e,t)=>e&&[e,t].filter(Boolean).join(" "),o=e=>{if(!e)return{deviceType:s.Unknown};const t=new i.a(e),a=t.getBrowser(),n=t.getDevice(),o=t.getOS(),l=((e,t,a,n)=>{var i;return"Electron"===a.name?s.Desktop:a.name?s.Web:"mobile"===t.type||null!==(i=n.name)&&void 0!==i&&i.includes("Android")||e.indexOf("; iOS ")>-1?s.Mobile:s.Unknown})(e,n,a,o),c=l===s.Web||l===s.Desktop,d=r(o.name,c?void 0:o.version),m=r(n.vendor,n.model),u=r(a.name,a.version),{customDeviceModel:h,customDeviceOS:p}=l!==s.Unknown?(e=>{if(e.includes("Mozilla/"))return{};if(!e.includes("("))return{};const t=e.substring(e.indexOf("(")+1).split("; ");return{customDeviceModel:t[0]||void 0,customDeviceOS:t[1]||void 0}})(e):{};return{deviceType:l,deviceModel:m||h,deviceOperatingSystem:d||p,client:u}}},475:function(e,t,a){"use strict";var n=a(130),i=a.n(n),s=a(132),r=a.n(s),o=a(120),l=a.n(o),c=a(169),d=a(152),m=a(142);const u=["children"];t.a=e=>{let{children:t}=e,a=r()(e,u);return l.a.createElement(c.d,{handleHomeEnd:!0,handleLeftRight:!0,onKeyDown:e=>{const t=e.target;if("INPUT"===t.tagName)return;let a=!0;switch(Object(d.a)().getAccessibilityAction(e)){case m.h.ArrowUp:case m.h.ArrowDown:t.hasAttribute("aria-haspopup")&&t.click();break;default:a=!1}a&&(e.preventDefault(),e.stopPropagation())}},(e=>{let{onKeyDownHandler:n}=e;return l.a.createElement("div",i()({},a,{onKeyDown:n,role:"toolbar"}),t)}))}},476:function(e,t,a){"use strict";a.d(t,"a",(function(){return p}));var n=a(13),i=a.n(n),s=a(140),r=a(16),o=a(147),l=a(125),c=a(202),d=a(124),m=a(146),u=a(137),h=a(128);class p extends c.a{constructor(){super(d.a),i()(this,"waitingRooms",[]),i()(this,"onMyMembership",(async e=>{const t=l.b.getValue("breadcrumbs",null,!0);this.meetsRoomRequirement&&Object(r.u)(t)&&await l.b.setValue("breadcrumbs",null,u.a.ACCOUNT,!0)})),i()(this,"onRoom",(async e=>{const t=this.waitingRooms.find((t=>t.roomId===e.roomId));t&&(this.waitingRooms.splice(this.waitingRooms.indexOf(t),1),Date.now()-t.addedTs>9e4||await this.appendRoom(e))})),l.b.monitorSetting("breadcrumb_rooms",null),l.b.monitorSetting("breadcrumbs",null),l.b.monitorSetting("feature_breadcrumbs_v2",null)}static get instance(){return p.internalInstance}get rooms(){return this.state.rooms||[]}get visible(){return!!this.state.enabled&&this.meetsRoomRequirement}get meetsRoomRequirement(){var e;return!!l.b.getValue("feature_breadcrumbs_v2")||(null===(e=this.matrixClient)||void 0===e?void 0:e.getVisibleRooms().length)>=20}async onAction(e){if(this.matrixClient)if(e.action===h.a.SettingUpdated)"breadcrumb_rooms"===e.settingName?await this.updateRooms():"breadcrumbs"!==e.settingName&&"feature_breadcrumbs_v2"!==e.settingName||await this.updateState({enabled:l.b.getValue("breadcrumbs",null)});else if(e.action===h.a.ViewRoom)if(e.auto_join&&!this.matrixClient.getRoom(e.room_id))this.waitingRooms.push({roomId:e.room_id,addedTs:Date.now()});else{const t=this.matrixClient.getRoom(e.room_id),a=null==t?void 0:t.getMyMembership();t&&"join"===a&&await this.appendRoom(t)}else if(e.action===h.a.JoinRoom){const t=this.matrixClient.getRoom(e.roomId);t&&await this.appendRoom(t)}}async onReady(){await this.updateRooms(),await this.updateState({enabled:l.b.getValue("breadcrumbs",null)}),this.matrixClient.on(s.d.MyMembership,this.onMyMembership),this.matrixClient.on(o.b.Room,this.onRoom)}async onNotReady(){this.matrixClient.removeListener(s.d.MyMembership,this.onMyMembership),this.matrixClient.removeListener(o.b.Room,this.onRoom)}async updateRooms(){let e=l.b.getValue("breadcrumb_rooms");e&&0!==e.length||(e=[]);const t=e.map((e=>this.matrixClient.getRoom(e))).filter((e=>!!e)),a=this.state.rooms||[];Object(m.d)(t,a)&&await this.updateState({rooms:t})}async appendRoom(e){let t=!1;const a=(this.state.rooms||[]).slice(),n=this.matrixClient.getRoomUpgradeHistory(e.roomId);if(n.length>1){e=n[n.length-1];for(let e=0;e<n.length-1;e++){const i=a.findIndex((t=>t.roomId===n[e].roomId));-1!==i&&(a.splice(i,1),t=!0)}}const i=a.findIndex((t=>t.roomId===e.roomId));if(0!==i&&(-1!==i&&a.splice(i,1),a.splice(0,0,e),t=!0),a.length>20&&(a.splice(20,a.length-20),t=!0),t){await this.updateState({rooms:a});const e=a.map((e=>e.roomId));e.length>0&&await l.b.setValue("breadcrumb_rooms",null,u.a.ACCOUNT,e)}}}i()(p,"internalInstance",(()=>{const e=new p;return e.start(),e})())},477:function(e,t,a){"use strict";a.d(t,"a",(function(){return r})),a.d(t,"b",(function(){return o}));var n=a(1),i=a(241),s=a(26);function r(e){const t=new s.a(e).get("embedded_pages");let a=t?new s.a(t).get("home_url"):null;var r;(a||(a=e.welcomePageUrl,a&&n.a.warn("You are using a deprecated config option: `welcomePageUrl`. Please use `embedded_pages.home_url` instead, per https://github.com/vector-im/element-web/issues/21428")),a)||(a=null===(r=Object(i.d)())||void 0===r?void 0:r.home_url);return a}function o(e){const t=new s.a(e).get("embedded_pages");return!!t&&!0===new s.a(t).get("login_for_welcome")}},478:function(e,t,a){"use strict";let n;a.d(t,"a",(function(){return n})),function(e){e.PersonalMessaging="PersonalMessaging",e.WorkMessaging="WorkMessaging",e.CommunityMessaging="CommunityMessaging",e.Skip="Skip"}(n||(n={}))},479:function(e,t,a){"use strict";var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(139),l=a(121),c=a(200),d=a(325);class m extends s.PureComponent{constructor(){super(...arguments),i()(this,"validate",Object(c.a)({rules:[{key:"required",test:e=>{let{value:t,allowEmpty:a}=e;return a||!!t},invalid:()=>Object(l.a)(this.props.labelRequired)},{key:"email",test:e=>{let{value:t}=e;return!t||d.a(t)},invalid:()=>Object(l.a)(this.props.labelInvalid)}]})),i()(this,"onValidate",(async e=>{let t=this.validate;this.props.validationRules&&(t=this.props.validationRules);const a=await t(e);return this.props.onValidate&&this.props.onValidate(a),a}))}render(){return r.a.createElement(o.a,{id:this.props.id,ref:this.props.fieldRef,type:"text",label:Object(l.a)(this.props.label),value:this.props.value,autoFocus:this.props.autoFocus,onChange:this.props.onChange,onValidate:this.onValidate})}}i()(m,"defaultProps",{label:Object(l.c)("Email"),labelRequired:Object(l.c)("Enter email address"),labelInvalid:Object(l.c)("Doesn't look like a valid email address")}),t.a=m},480:function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(120),i=a.n(n),s=a(1525),r=a(908);class o extends i.a.Component{render(){return i.a.createElement("div",{className:"mx_AuthHeader"},i.a.createElement(s.a,null),i.a.createElement(r.a,{disabled:this.props.disableLanguageSelector}))}}},481:function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(126),i=a.n(n),s=a(120),r=a.n(s);function o(e){let{flex:t,className:a,children:n}=e;return r.a.createElement("main",{className:i()("mx_AuthBody",a,{mx_AuthBody_flex:t})},n)}},489:function(e,t,a){"use strict";a.d(t,"b",(function(){return dt})),a.d(t,"a",(function(){return ut}));var n=a(120),i=a.n(n),s=a(136),r=a(122),o=a(141);var l=a(167),c=a(1),d=a(274),m=a(164);const u=5e3;function h(e,t){const[a,i]=Object(n.useState)(e),o=r.a.get(),l=function(e){const t=Object(n.useRef)(e);return t.current=e,Object(n.useCallback)((function(){return t.current(...arguments)}),[])}(t);return Object(n.useEffect)((()=>{if(a)return;let e=null,t=!0;const n=async()=>{null!==e&&(clearTimeout(e),e=null),i(await l(o)),t&&(e=window.setTimeout(n,u))};return n().catch((e=>c.a.warn("could not update user onboarding context",e))),o.on(s.ClientEvent.AccountData,n),()=>{t=!1,o.off(s.ClientEvent.AccountData,n),null!==e&&(clearTimeout(e),e=null)}}),[o,l,a]),a}var p,g,v,b,f,y,E,_,w,S,O,C,x,j,k,R,I,T,N,P,D,M,A,L,U,F,B,V=a(13),W=a.n(V);function H(){return H=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},H.apply(this,arguments)}function z(e){return n.createElement("svg",H({viewBox:"0 0 564 168",xmlns:"http://www.w3.org/2000/svg",role:"presentation","aria-hidden":!0},e),p||(p=n.createElement("defs",null,n.createElement("radialGradient",{id:"f-droid_svg__a",cx:113,cy:-12.89,r:59.662,gradientTransform:"matrix(0 1.9611 -1.9778 0 5.51 -198.6)",gradientUnits:"userSpaceOnUse"},n.createElement("stop",{stopColor:"#fff",stopOpacity:.098,offset:0}),n.createElement("stop",{stopColor:"#fff",stopOpacity:0,offset:1})))),g||(g=n.createElement("path",{d:"M22 2h520c11.08 0 20 8.92 20 20v124c0 11.08-8.92 20-20 20H22c-11.08 0-20-8.92-20-20V22C2 10.92 10.92 2 22 2z",stroke:"#a6a6a6",strokeWidth:4})),v||(v=n.createElement("path",{d:"M199.26 45.46v-6.682h-5.499v-2.766h8.831v10.681q-1.949 1.383-4.299 2.1-2.349.7-5.015.7-5.832 0-9.131-3.4-3.283-3.415-3.283-9.497 0-6.099 3.283-9.498 3.3-3.416 9.131-3.416 2.433 0 4.616.6 2.2.6 4.049 1.766v3.583q-1.867-1.583-3.966-2.383-2.1-.8-4.416-.8-4.565 0-6.865 2.55-2.283 2.549-2.283 7.598 0 5.032 2.283 7.581 2.3 2.55 6.865 2.55 1.783 0 3.183-.3 1.4-.317 2.516-.967zm9.48-21.33h15.729v2.833h-12.364v7.365h11.847v2.832h-11.847v9.015h12.664v2.832H208.74zm18.12 0h21.045v2.833h-8.831v22.045h-3.383V26.963h-8.83zm35.14 0h3.366v24.877H262zm6.61 0h21.045v2.833h-8.831v22.045h-3.383V26.963h-8.83zm45.24 2.28q-3.666 0-5.832 2.733-2.15 2.732-2.15 7.448 0 4.699 2.15 7.431 2.166 2.733 5.832 2.733t5.799-2.733q2.15-2.732 2.15-7.431 0-4.716-2.15-7.448-2.133-2.733-5.799-2.733zm0-2.733q5.232 0 8.365 3.516 3.132 3.5 3.132 9.398 0 5.882-3.132 9.397-3.133 3.5-8.365 3.5-5.249 0-8.398-3.5-3.132-3.499-3.132-9.397t3.132-9.398q3.15-3.516 8.398-3.516zm16.76.453h4.532l11.031 20.812V24.13h3.266v24.877h-4.532l-11.031-20.812v20.812h-3.266z",fill:"#fff","aria-label":"GET IT ON"})),b||(b=n.createElement("path",{d:"M180.81 136v-8.118l7.19-1.391V78.017l-7.19-1.392v-8.164h53.762v18.508h-10.391l-.603-8.071h-22.034v18.6h23.657v10.438h-23.657v18.555l7.236 1.391V136zm62.16-23.66v-10.437h26.162v10.437zM277.29 136v-8.118l7.283-1.53v-48.15l-7.283-1.577v-8.164h29.641q9.045 0 15.957 4.268 6.912 4.221 10.762 11.736 3.897 7.468 3.897 17.163v1.252q0 9.602-3.85 17.117-3.804 7.468-10.67 11.736-6.865 4.268-15.91 4.268zm20.828-10.344h8.303q5.613 0 9.51-2.922 3.896-2.97 5.937-8.118 2.087-5.149 2.087-11.736v-1.299q0-6.68-2.087-11.782-2.041-5.149-5.938-8.025-3.896-2.922-9.509-2.922h-8.303zM344.79 136v-8.118l6.494-1.391V95.366l-7.19-1.392V85.81h19.807l.51 6.216.093 1.113q1.856-4.082 4.593-6.17 2.736-2.087 6.54-2.087 1.206 0 2.644.232 1.438.186 2.551.51l-1.438 12.478-6.726-.37q-2.876-.14-4.685.974-1.763 1.113-3.154 3.2v24.585l6.494 1.392V136zm63.08.98q-7.422 0-12.756-3.247t-8.164-9q-2.83-5.797-2.83-13.312v-.974q0-7.469 2.83-13.22 2.83-5.799 8.118-9.046 5.334-3.293 12.71-3.293 7.468 0 12.756 3.293 5.288 3.247 8.117 9t2.83 13.266v.974q0 7.515-2.83 13.313-2.83 5.752-8.117 9-5.289 3.247-12.664 3.247zm0-10.391q3.525 0 5.752-1.902t3.293-5.288q1.067-3.433 1.067-7.979v-.974q0-4.453-1.067-7.839-1.066-3.433-3.34-5.335-2.226-1.948-5.798-1.948-3.479 0-5.752 1.948-2.273 1.902-3.34 5.335-1.02 3.386-1.02 7.84v.973q0 4.546 1.02 7.979 1.067 3.433 3.34 5.334 2.273 1.856 5.845 1.856zM437.1 136v-8.118l6.54-1.391V95.366l-7.236-1.392V85.81h20.781v40.681l6.494 1.392V136zm6.077-60.813v-11.55h14.009v11.55zm44.293 61.793q-5.984 0-10.298-3.062-4.268-3.107-6.54-8.627-2.273-5.567-2.273-12.988v-.975q0-7.932 2.273-13.87 2.319-5.937 6.586-9.23 4.268-3.34 10.205-3.34 4.129 0 7.237 1.67 3.108 1.623 5.38 4.638V73.198l-7.236-1.391v-8.164h20.781v62.854l6.494 1.391v8.118h-18.23l-1.02-6.123q-2.366 3.479-5.66 5.288-3.246 1.81-7.7 1.81zm4.036-10.53q2.83 0 4.963-1.206 2.134-1.206 3.572-3.479v-21.292q-1.392-2.412-3.526-3.71-2.133-1.346-4.917-1.346-3.386 0-5.566 2.04-2.134 1.995-3.154 5.567-.974 3.572-.974 8.303v.975q0 6.587 2.226 10.39 2.227 3.758 7.376 3.758z",fill:"#fff","aria-label":"F-Droid"})),f||(f=n.createElement("path",{d:"M146.34 25.898l-11.184 14.474",fill:"#8ab000",stroke:"#769616",strokeLinecap:"round",strokeWidth:6.579})),y||(y=n.createElement("path",{d:"M146.29 22.477c1.192.032 2.003.497 2.579 1.182-5.332 6.34-6.232 7.344-13.513 16.37-2.684 3.472-5.479 1.677-2.795-1.794l11.184-14.474a3.26 3.26 0 012.545-1.284z",color:"#000",fill:"#fff",fillOpacity:.298})),E||(E=n.createElement("path",{d:"M148.89 23.793a3.29 3.29 0 01.058 4.095l-11.184 14.474c-2.684 3.474-3.026-1.61-3.026-1.61s9.829-11.87 14.153-16.959z",color:"#000",fill:"#263238",fillOpacity:.2})),_||(_=n.createElement("path",{d:"M147 23.003c1.153 0 2.526.374 2.168 2.103-.27 1.318-12.263 15.984-12.263 15.984-2.684 3.47-6.563 1.779-3.879-1.693l11.142-14.4c.685-.763 1.603-1.957 2.832-1.994z",color:"#000",fill:"#8ab000"})),w||(w=n.createElement("path",{d:"M33.653 25.898l11.184 14.474",fill:"#8ab000",stroke:"#769616",strokeLinecap:"round",strokeWidth:6.579})),S||(S=n.createElement("path",{d:"M33.711 22.477c-1.192.032-2.003.497-2.579 1.182 5.332 6.34 6.232 7.344 13.513 16.37 2.684 3.472 5.479 1.677 2.795-1.794L36.256 23.76a3.26 3.26 0 00-2.545-1.284z",color:"#000",fill:"#fff",fillOpacity:.298})),O||(O=n.createElement("path",{d:"M31.108 23.793a3.29 3.29 0 00-.058 4.095l11.184 14.474c2.684 3.474 3.026-1.61 3.026-1.61s-9.829-11.87-14.153-16.959z",color:"#000",fill:"#263238",fillOpacity:.2})),C||(C=n.createElement("path",{d:"M32.993 23.003c-1.153 0-2.526.374-2.168 2.103.27 1.318 12.263 15.984 12.263 15.984 2.684 3.47 6.563 1.779 3.879-1.693l-11.142-14.4c-.685-.763-1.603-1.957-2.832-1.994z",color:"#000",fill:"#8ab000"})),x||(x=n.createElement("path",{d:"M47.893 35.109h84.211a7.878 7.878 0 017.895 7.894v18.211a7.878 7.878 0 01-7.895 7.895H47.893a7.878 7.878 0 01-7.895-7.895v-18.21a7.878 7.878 0 017.895-7.895z",fill:"#aeea00"})),j||(j=n.createElement("path",{d:"M47.893 42.74h84.211a7.878 7.878 0 017.895 7.895v10.526a7.878 7.878 0 01-7.895 7.895H47.893a7.878 7.878 0 01-7.895-7.895V50.635a7.878 7.878 0 017.895-7.895z",fill:"#263238",fillOpacity:.2})),k||(k=n.createElement("path",{d:"M47.893 35.109h84.211a7.878 7.878 0 017.895 7.894V53.53a7.878 7.878 0 01-7.895 7.895H47.893a7.878 7.878 0 01-7.895-7.895V43.003a7.878 7.878 0 017.895-7.894z",fill:"#fff",fillOpacity:.298})),R||(R=n.createElement("path",{d:"M47.893 38.003h84.211c4.374 0 7.895 2.883 7.895 6.462v15.079c0 3.58-3.521 6.462-7.895 6.462H47.893c-4.374 0-7.895-2.882-7.895-6.462V44.465c0-3.58 3.521-6.462 7.895-6.462z",fill:"#aeea00"})),I||(I=n.createElement("path",{d:"M47.893 71.944h84.211a7.878 7.878 0 017.895 7.895v52.211a7.878 7.878 0 01-7.895 7.895H47.893a7.878 7.878 0 01-7.895-7.895V79.839a7.878 7.878 0 017.895-7.895z",fill:"#1976d2"})),T||(T=n.createElement("path",{d:"M47.893 105.89h84.211a7.878 7.878 0 017.895 7.895v18.42a7.878 7.878 0 01-7.895 7.896H47.893a7.878 7.878 0 01-7.895-7.895v-18.421a7.878 7.878 0 017.895-7.895z",fill:"#263238",fillOpacity:.2})),N||(N=n.createElement("path",{d:"M47.893 71.681h84.211a7.878 7.878 0 017.895 7.895v18.421a7.878 7.878 0 01-7.895 7.895H47.893a7.878 7.878 0 01-7.895-7.895V79.576a7.878 7.878 0 017.895-7.895z",fill:"#fff",fillOpacity:.2})),P||(P=n.createElement("path",{d:"M47.893 75.102h84.211c4.374 0 7.895 3.19 7.895 7.154v47.693c0 3.963-3.521 7.153-7.895 7.153H47.893c-4.374 0-7.895-3.19-7.895-7.153V82.256c0-3.963 3.521-7.154 7.895-7.154z",fill:"#1976d2"})),D||(D=n.createElement("path",{d:"M89.998 89.714c-7.579 0-14 5.224-15.876 12.237h8.455a8.46 8.46 0 017.421-4.342 8.495 8.495 0 018.553 8.553 8.495 8.495 0 01-8.553 8.552 8.471 8.471 0 01-7.71-4.868h-8.3c1.69 7.279 8.242 12.763 16.01 12.763 9.038 0 16.449-7.41 16.449-16.448 0-9.037-7.41-16.448-16.448-16.448z",color:"#000",fill:"#0d47a1"})),M||(M=n.createElement("path",{d:"M115.13 106.16a25.132 25.132 0 01-25.132 25.132 25.132 25.132 0 01-25.131-25.132 25.132 25.132 0 0125.131-25.132 25.132 25.132 0 0125.132 25.132z",fill:"none",stroke:"#0d47a1",strokeLinecap:"round",strokeWidth:5})),A||(A=n.createElement("path",{d:"M73.55 52.477a8.882 10.197 0 01-8.88 10.198 8.882 10.197 0 01-8.882-10.198 8.882 10.197 0 018.881-10.197 8.882 10.197 0 018.882 10.197z",fill:"#263238",fillOpacity:.2})),L||(L=n.createElement("path",{d:"M73.55 53.793a8.882 8.882 0 01-8.88 8.882 8.882 8.882 0 01-8.882-8.882 8.882 8.882 0 018.881-8.882 8.882 8.882 0 018.882 8.882z",fill:"#fff"})),U||(U=n.createElement("path",{d:"M124.87 52.477a8.882 10.197 0 01-8.882 10.198 8.882 10.197 0 01-8.881-10.198 8.882 10.197 0 018.881-10.197 8.882 10.197 0 018.882 10.197z",fill:"#263238",fillOpacity:.2})),F||(F=n.createElement("path",{d:"M124.87 53.793a8.882 8.882 0 01-8.882 8.882 8.882 8.882 0 01-8.881-8.882 8.882 8.882 0 018.881-8.882 8.882 8.882 0 018.882 8.882z",fill:"#fff"})),B||(B=n.createElement("path",{d:"M33.71 22.47a3.29 3.29 0 00-2.662 5.336l9.474 12.262a7.894 7.894 0 00-.527 2.824v18.211a7.877 7.877 0 007.895 7.895h84.21a7.877 7.877 0 007.895-7.895v-18.21c0-1-.19-1.95-.525-2.827l9.472-12.26a3.29 3.29 0 00-2.433-5.334 3.29 3.29 0 00-2.772 1.31l-9.013 11.666a7.91 7.91 0 00-2.623-.45H47.89c-.922 0-1.8.163-2.621.45l-9.016-11.666a3.29 3.29 0 00-2.543-1.312zm14.18 49.527a7.877 7.877 0 00-7.894 7.894v52.211a7.877 7.877 0 007.894 7.895h84.211a7.877 7.877 0 007.894-7.895v-52.21a7.877 7.877 0 00-7.894-7.895z",color:"#000",fill:"url(#f-droid_svg__a)",fillRule:"evenodd"})))}var G,K,q,$,Y,J,Q,X,Z,ee,te,ae,ne,ie,se,re,oe,le,ce,de,me,ue;function he(){return he=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},he.apply(this,arguments)}function pe(e){return n.createElement("svg",he({viewBox:"0 0 180 53.332",xmlns:"http://www.w3.org/2000/svg",role:"presentation","aria-hidden":!0},e),G||(G=n.createElement("defs",null,n.createElement("linearGradient",{id:"google-play_svg__a",x2:1,gradientTransform:"scale(-31.64 31.64) rotate(45 -.903 -.925)",gradientUnits:"userSpaceOnUse"},n.createElement("stop",{stopColor:"#00a0ff",offset:0}),n.createElement("stop",{stopColor:"#00a1ff",offset:.007}),n.createElement("stop",{stopColor:"#00beff",offset:.26}),n.createElement("stop",{stopColor:"#00d2ff",offset:.512}),n.createElement("stop",{stopColor:"#00dfff",offset:.76}),n.createElement("stop",{stopColor:"#00e3ff",offset:1})),n.createElement("linearGradient",{id:"google-play_svg__b",x2:1,gradientTransform:"matrix(-32.255 0 0 32.255 45.098 26.675)",gradientUnits:"userSpaceOnUse"},n.createElement("stop",{stopColor:"#ffe000",offset:0}),n.createElement("stop",{stopColor:"#ffbd00",offset:.409}),n.createElement("stop",{stopColor:"orange",offset:.775}),n.createElement("stop",{stopColor:"#ff9c00",offset:1})),n.createElement("linearGradient",{id:"google-play_svg__c",x2:1,gradientTransform:"scale(-42.903 42.903) rotate(45 -1.222 -.585)",gradientUnits:"userSpaceOnUse"},n.createElement("stop",{stopColor:"#ff3a44",offset:0}),n.createElement("stop",{stopColor:"#c31162",offset:1})),n.createElement("linearGradient",{id:"google-play_svg__d",x2:1,gradientTransform:"scale(19.156 -19.156) rotate(-44.998 .238 -.62)",gradientUnits:"userSpaceOnUse"},n.createElement("stop",{stopColor:"#32a071",offset:0}),n.createElement("stop",{stopColor:"#2da771",offset:.069}),n.createElement("stop",{stopColor:"#15cf74",offset:.476}),n.createElement("stop",{stopColor:"#06e775",offset:.801}),n.createElement("stop",{stopColor:"#00f076",offset:1})),n.createElement("linearGradient",{id:"google-play_svg__e",x2:1,gradientTransform:"matrix(-32.255 0 0 32.255 45.098 26.675)",gradientUnits:"userSpaceOnUse"},n.createElement("stop",{stopColor:"#ccb300",offset:0}),n.createElement("stop",{stopColor:"#cc9700",offset:.409}),n.createElement("stop",{stopColor:"#cc8400",offset:.775}),n.createElement("stop",{stopColor:"#cc7d00",offset:1})),n.createElement("linearGradient",{id:"google-play_svg__f",x2:1,gradientTransform:"scale(-42.903 42.903) rotate(45 -1.222 -.585)",gradientUnits:"userSpaceOnUse"},n.createElement("stop",{stopColor:"#cc2e36",offset:0}),n.createElement("stop",{stopColor:"#9c0e4e",offset:1})),n.createElement("linearGradient",{id:"google-play_svg__g",x2:1,gradientTransform:"scale(-31.64 31.64) rotate(45 -.903 -.925)",gradientUnits:"userSpaceOnUse"},n.createElement("stop",{stopColor:"#008de0",offset:0}),n.createElement("stop",{stopColor:"#008de0",offset:.007}),n.createElement("stop",{stopColor:"#00a7e0",offset:.26}),n.createElement("stop",{stopColor:"#00b8e0",offset:.512}),n.createElement("stop",{stopColor:"#00c4e0",offset:.76}),n.createElement("stop",{stopColor:"#00c7e0",offset:1})),n.createElement("linearGradient",{id:"google-play_svg__h",x2:1,gradientTransform:"scale(-42.903 42.903) rotate(45 -1.222 -.585)",gradientUnits:"userSpaceOnUse"},n.createElement("stop",{stopColor:"#e0333c",offset:0}),n.createElement("stop",{stopColor:"#ab0f56",offset:1})),n.createElement("linearGradient",{id:"google-play_svg__i",x2:1,gradientTransform:"matrix(-32.255 0 0 32.255 45.098 26.675)",gradientUnits:"userSpaceOnUse"},n.createElement("stop",{stopColor:"#e0c500",offset:0}),n.createElement("stop",{stopColor:"#e0a600",offset:.409}),n.createElement("stop",{stopColor:"#e09100",offset:.775}),n.createElement("stop",{stopColor:"#e08900",offset:1})),n.createElement("linearGradient",{id:"google-play_svg__j",x2:1,gradientTransform:"matrix(-32.255 0 0 32.255 45.098 26.675)",gradientUnits:"userSpaceOnUse"},n.createElement("stop",{stopColor:"#ffe840",offset:0}),n.createElement("stop",{stopColor:"#ffce40",offset:.409}),n.createElement("stop",{stopColor:"#ffbc40",offset:.775}),n.createElement("stop",{stopColor:"#ffb540",offset:1})),n.createElement("linearGradient",{id:"google-play_svg__k",x2:1,gradientTransform:"scale(-31.64 31.64) rotate(45 -.903 -.925)",gradientUnits:"userSpaceOnUse"},n.createElement("stop",{stopColor:"#40b8ff",offset:0}),n.createElement("stop",{stopColor:"#40b9ff",offset:.007}),n.createElement("stop",{stopColor:"#40ceff",offset:.26}),n.createElement("stop",{stopColor:"#40ddff",offset:.512}),n.createElement("stop",{stopColor:"#40e7ff",offset:.76}),n.createElement("stop",{stopColor:"#40eaff",offset:1})),n.createElement("linearGradient",{id:"google-play_svg__l",x2:1,gradientTransform:"scale(19.156 -19.156) rotate(-44.998 .238 -.62)",gradientUnits:"userSpaceOnUse"},n.createElement("stop",{stopColor:"#65b895",offset:0}),n.createElement("stop",{stopColor:"#62bd95",offset:.069}),n.createElement("stop",{stopColor:"#50db97",offset:.476}),n.createElement("stop",{stopColor:"#44ed98",offset:.801}),n.createElement("stop",{stopColor:"#40f498",offset:1})))),K||(K=n.createElement("path",{d:"M173.33 53.332H6.67c-3.667 0-6.667-3-6.667-6.667V6.668c0-3.667 3-6.667 6.667-6.667h166.66c3.667 0 6.667 3 6.667 6.667v39.997c0 3.666-3 6.666-6.667 6.666"})),q||(q=n.createElement("path",{d:"M101.93 17.465v-5.118l-.044-1.544-.202.074 4.107 6.588h1.28V9.199h-1.295v4.816l.044 1.544.202-.074-3.927-6.286h-1.458v8.266",fill:"#fff"})),$||($=n.createElement("path",{d:"M173.33 0H6.67C3.003 0 .003 3 .003 6.666v40c0 3.666 3 6.666 6.667 6.666h166.66c3.667 0 6.667-3 6.667-6.667V6.668c0-3.667-3-6.667-6.667-6.667m0 1.067c3.088 0 5.6 2.512 5.6 5.6v39.997c0 3.087-2.512 5.6-5.6 5.6H6.67a5.607 5.607 0 01-5.6-5.6v-40c0-3.087 2.512-5.6 5.6-5.6h166.66",fill:"#a6a6a6"})),Y||(Y=n.createElement("path",{d:"M63.356 13.657c0-.203-.02-.41-.058-.628l-.02-.11h-4.121v1.229h3.038v-.134l-.133-.011c-.058.67-.272 1.176-.632 1.537-.573.571-1.276.853-2.14.854-.81 0-1.499-.28-2.092-.85-.587-.568-.88-1.294-.881-2.212.001-.917.294-1.643.881-2.21.593-.571 1.281-.85 2.092-.851.902.002 1.582.3 2.088.901l.094.112.806-.807.086-.087-.079-.093c-.327-.39-.764-.7-1.3-.93a4.259 4.259 0 00-1.695-.347c-1.185-.001-2.208.416-3.038 1.24-.833.823-1.252 1.857-1.251 3.072-.001 1.215.418 2.25 1.252 3.073.829.824 1.852 1.24 3.037 1.24 1.234 0 2.258-.41 3.036-1.226l-.003.002c.691-.69 1.034-1.622 1.033-2.764M69.502 9.2h-4.937v8.265h4.937v-1.25h-3.643v-2.27h3.286v-1.227h-3.286v-2.27h3.643m4.335 0h2.234v-1.25h-5.764v1.25h2.235v7.017h1.295m7.239 0V9.199h-1.294v8.266m5.853-7.017h2.235v-1.25h-5.764v1.25h2.234v7.017h1.295m6.652-4.132c0-.903.284-1.627.85-2.203.57-.575 1.252-.858 2.078-.86.825.002 1.509.285 2.078.86.566.576.85 1.3.85 2.203s-.284 1.627-.85 2.202c-.57.576-1.253.858-2.078.86-.826-.002-1.508-.284-2.076-.86s-.852-1.3-.852-2.202zm5.957 3.058c.808-.83 1.217-1.86 1.216-3.058 0-1.193-.41-2.22-1.221-3.054-.813-.837-1.83-1.26-3.024-1.259-1.2-.001-2.221.42-3.028 1.254-.81.83-1.217 1.86-1.216 3.059-.001 1.199.406 2.228 1.214 3.06s1.83 1.253 3.03 1.251c1.2.002 2.22-.419 3.029-1.253m-7.387 12.612c-3.136 0-5.693 2.384-5.693 5.67 0 3.266 2.557 5.67 5.693 5.67s5.691-2.405 5.691-5.67c0-3.287-2.555-5.67-5.691-5.67zm0 2.232c1.719 0 3.2 1.397 3.2 3.438 0 2.019-1.481 3.435-3.2 3.435-1.718 0-3.201-1.416-3.201-3.435 0-2.041 1.483-3.438 3.201-3.438zm-12.422-2.232c-3.136 0-5.693 2.384-5.693 5.67 0 3.266 2.557 5.67 5.693 5.67s5.693-2.405 5.693-5.67c0-3.287-2.557-5.67-5.693-5.67zm0 2.232c1.718 0 3.201 1.397 3.201 3.438 0 2.019-1.483 3.435-3.201 3.435-1.719 0-3.2-1.416-3.2-3.435 0-2.041 1.481-3.438 3.2-3.438zm-14.772-.494v2.407h5.757c-.172 1.353-.623 2.34-1.31 3.028-.838.838-2.148 1.762-4.447 1.762-3.544 0-6.315-2.857-6.315-6.401s2.771-6.402 6.315-6.402c1.912 0 3.308.752 4.34 1.719l1.696-1.697c-1.439-1.375-3.35-2.427-6.036-2.427-4.854 0-8.935 3.952-8.935 8.807s4.08 8.806 8.935 8.806c2.621 0 4.597-.859 6.143-2.47 1.59-1.59 2.084-3.823 2.084-5.627 0-.56-.043-1.074-.129-1.504zm55.554-1.74c-2.921 0-5.348 2.3-5.348 5.672 0 3.179 2.405 5.67 5.627 5.67 2.6 0 4.105-1.59 4.727-2.514l-1.934-1.287c-.644.946-1.525 1.566-2.793 1.566-1.267 0-2.17-.578-2.75-1.716l7.582-3.137-.256-.645c-.472-1.268-1.912-3.609-4.855-3.609zm.086 2.191c.989 0 1.826.495 2.105 1.203l-5.068 2.106c-.065-2.191 1.696-3.309 2.963-3.309zm-9.126 8.807h2.493V23.332h-2.492zm-7.15-10.996c-2.835 0-5.434 2.49-5.434 5.691 0 3.18 2.599 5.65 5.434 5.65 1.353 0 2.428-.602 2.986-1.29h.086v.816c0 2.17-1.16 3.33-3.03 3.33-1.524 0-2.47-1.095-2.856-2.02l-2.17.903c.624 1.504 2.278 3.352 5.027 3.352 2.921 0 5.39-1.72 5.39-5.908v-10.18h-2.36v.921h-.087c-.558-.666-1.633-1.265-2.986-1.265zm.215 2.232c1.697 0 3.03 1.461 3.03 3.46 0 1.975-1.333 3.414-3.03 3.414-1.72 0-3.158-1.439-3.158-3.415 0-1.997 1.44-3.459 3.158-3.459zm26.545-7.904v16.668h2.486v-6.315h3.475c2.758 0 5.469-1.997 5.469-5.177s-2.711-5.176-5.47-5.176zm2.486 2.32h3.54c1.86 0 2.915 1.54 2.915 2.858 0 1.29-1.056 2.855-2.916 2.855h-3.539zm18.914 3.321c-1.8 0-3.667.792-4.44 2.55l2.21.923c.472-.922 1.349-1.223 2.273-1.223 1.286 0 2.594.773 2.615 2.144v.172c-.45-.257-1.414-.642-2.594-.642-2.38 0-4.804 1.308-4.804 3.752 0 2.23 1.951 3.668 4.138 3.668 1.673 0 2.596-.751 3.176-1.631h.084v1.287h2.402v-6.39c0-2.96-2.208-4.61-5.06-4.61zm.385 5.938c1.095 0 1.608.236 2.273.558-.193 1.544-1.52 2.639-2.957 2.639l-.002-.002c-.815 0-1.951-.405-1.951-1.414 0-1.286 1.416-1.781 2.637-1.781zm13.415-5.575l-2.852 7.227h-.085l-2.96-7.227h-2.68l4.438 10.1-2.53 5.619h2.596l6.84-15.719zm-22.4 10.664h2.488V23.331h-2.488z",fill:"#fff"})),J||(J=n.createElement("path",{d:"M14.007 43.191l-.099-.095c-.388-.41-.617-1.047-.617-1.873v.194V11.93v.203c0-.894.267-1.567.714-1.97l16.516 16.515-16.515 16.515m-.71-31.48v-.004.003m0-.01",fill:"url(#google-play_svg__a)"})),Q||(Q=n.createElement("path",{d:"M36.025 32.378l.126-.071 6.522-3.706c.622-.354 1.036-.782 1.243-1.236-.206.454-.621.883-1.243 1.236l-6.522 3.706-.126.071m.002-.195l-5.506-5.507 5.505-5.506 6.647 3.776c.844.48 1.318 1.098 1.397 1.73v.002c-.08.63-.553 1.248-1.397 1.728l-6.646 3.777",fill:"url(#google-play_svg__b)"})),X||(X=n.createElement("path",{d:"M15.184 43.819a1.723 1.723 0 00.002 0 2.515 2.515 0 00-.002 0m0-.195c-.46 0-.863-.15-1.177-.433l16.515-16.516 5.506 5.507L16.68 43.176c-.536.304-1.043.447-1.494.447m-1.182-.241a1.814 1.814 0 01-.086-.084l.086.084",fill:"url(#google-play_svg__c)"})),Z||(Z=n.createElement("path",{d:"M30.52 26.676L14.004 10.16a1.716 1.716 0 011.177-.433c.452 0 .96.145 1.496.449L36.025 21.17l-5.506 5.506m5.63-5.63L16.677 9.98c-.536-.304-1.044-.448-1.496-.448h-.005.007c.451 0 .959.144 1.494.448L36.15 21.045",fill:"url(#google-play_svg__d)"})),ee||(ee=n.createElement("path",{d:"M15.313 43.811c.42-.024.883-.168 1.371-.445l19.353-10.995-19.353 10.994c-.487.277-.952.42-1.371.445m-1.301-.43l-.004-.004a.038.038 0 01.004.004m-.09-.088l-.009-.008c.004.002.006.006.009.008"})),te||(te=n.createElement("path",{d:"M36.025 32.378l.126-.071-.126.071",fill:"url(#google-play_svg__e)"})),ae||(ae=n.createElement("path",{d:"M15.185 43.819c-.461 0-.864-.15-1.178-.434a.038.038 0 00-.005-.003l-.086-.084-.008-.008.099-.1c.314.284.716.434 1.177.434.451 0 .958-.144 1.494-.448l19.348-10.994.124.124-.126.072L16.677 43.37c-.488.276-.952.42-1.37.444a2.515 2.515 0 01-.123.004",fill:"url(#google-play_svg__f)"})),ne||(ne=n.createElement("path",{d:"M13.914 43.285c-.388-.411-.617-1.049-.617-1.874 0 .825.23 1.462.617 1.873"})),ie||(ie=n.createElement("path",{d:"M13.908 43.29c-.388-.41-.617-1.047-.617-1.873v-.194c0 .825.23 1.462.617 1.873l.099.095-.099.099",fill:"url(#google-play_svg__g)"})),se||(se=n.createElement("path",{d:"M13.908 43.29l.099-.1v.001l-.099.099",fill:"url(#google-play_svg__h)"})),re||(re=n.createElement("path",{d:"M36.151 32.307l-.124-.124 6.646-3.777c.844-.48 1.318-1.098 1.397-1.728 0 .231-.051.463-.154.688-.207.453-.62.882-1.243 1.235l-6.522 3.706",fill:"url(#google-play_svg__i)"})),oe||(oe=n.createElement("path",{d:"M44.083 26.667c0-.698-.467-1.395-1.398-1.924l-6.523-3.707 6.523 3.706c.932.53 1.399 1.228 1.398 1.925",fill:"#404040"})),le||(le=n.createElement("path",{d:"M44.07 26.675c-.08-.632-.553-1.25-1.397-1.73l-6.647-3.775.124-.124 6.523 3.706c.93.529 1.397 1.226 1.397 1.923",fill:"url(#google-play_svg__j)"})),ce||(ce=n.createElement("path",{d:"M13.297 11.917v-.002.002m.006-.217v-.003.003m0-.006v-.006.006m0-.008c.077-1.37.822-2.16 1.876-2.165a1.715 1.715 0 00-1.166.433l-.004.003c-.033.03-.064.061-.095.093-.35.37-.57.925-.61 1.636",fill:"#404040"})),de||(de=n.createElement("path",{d:"M13.291 12.132v-.204c0-.073.002-.145.006-.215V11.7c.04-.71.261-1.265.61-1.635l.098.097c-.447.404-.714 1.077-.714 1.97m.712-2.16l.003-.004-.003.003",fill:"url(#google-play_svg__k)"})),me||(me=n.createElement("path",{d:"M15.178 9.521h.004-.004",fill:"#404040"})),ue||(ue=n.createElement("path",{d:"M36.025 21.17L16.677 10.176c-.536-.304-1.044-.448-1.496-.448-.46 0-.863.15-1.177.432l-.097-.097a1.78 1.78 0 01.095-.094l.003-.003c.312-.28.71-.43 1.166-.433h.01c.452 0 .96.144 1.496.448l19.472 11.064-.125.125",fill:"url(#google-play_svg__l)"})))}var ge,ve,be;function fe(){return fe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},fe.apply(this,arguments)}function ye(e){return n.createElement("svg",fe({viewBox:"0 0 159.55 53.333",xmlns:"http://www.w3.org/2000/svg",role:"presentation","aria-hidden":!0},e),ge||(ge=n.createElement("path",{d:"M146.84.001H12.71c-.489 0-.972 0-1.46.003-.407.002-.812.01-1.224.016-.888.023-1.786.077-2.672.236a8.876 8.876 0 00-2.535.836A8.58 8.58 0 001.09 4.825a8.782 8.782 0 00-.833 2.538c-.16.883-.216 1.776-.24 2.669-.012.409-.013.82-.02 1.228v30.818c.007.414.008.815.02 1.23.024.893.08 1.786.24 2.669.155.893.418 1.73.833 2.539a8.28 8.28 0 001.571 2.152 8.356 8.356 0 002.158 1.571 8.95 8.95 0 002.535.842c.886.158 1.784.21 2.672.235.412.01.817.015 1.225.015.488.002.97.002 1.46.002h134.13c.48 0 .966 0 1.445-.002.408 0 .824-.006 1.23-.015.894-.025 1.79-.077 2.667-.235a9.083 9.083 0 002.544-.842 8.417 8.417 0 002.157-1.57 8.556 8.556 0 001.573-2.153c.41-.809.676-1.646.826-2.54.165-.882.216-1.775.249-2.669.004-.414.004-.815.004-1.229.01-.484.01-.966.01-1.458V12.715c0-.488 0-.972-.01-1.455 0-.409 0-.82-.004-1.228-.033-.893-.084-1.786-.25-2.67a8.763 8.763 0 00-.825-2.537 8.626 8.626 0 00-1.573-2.162 8.641 8.641 0 00-2.157-1.57 9.02 9.02 0 00-2.544-.837c-.877-.159-1.773-.213-2.667-.236-.406-.006-.822-.014-1.23-.016C147.807 0 147.322 0 146.84 0",fill:"#b2b1b1"})),ve||(ve=n.createElement("path",{d:"M11.267 52.166c-.407 0-.803-.005-1.206-.014-.745-.021-1.63-.062-2.492-.217a7.847 7.847 0 01-2.21-.731 7.214 7.214 0 01-1.862-1.355 7.092 7.092 0 01-1.36-1.862 7.616 7.616 0 01-.724-2.21c-.163-.897-.205-1.807-.222-2.5-.01-.28-.02-1.217-.02-1.217v-30.8s.012-.922.02-1.193c.017-.698.059-1.607.22-2.495.143-.818.38-1.54.725-2.216.354-.7.808-1.325 1.353-1.864a7.423 7.423 0 011.87-1.363 7.762 7.762 0 012.204-.726c.898-.16 1.808-.2 2.5-.219l1.204-.016h137.02l1.217.017c.684.017 1.595.057 2.48.217.802.14 1.53.38 2.227.73.684.35 1.31.808 1.855 1.354a7.38 7.38 0 011.365 1.873c.344.681.577 1.403.715 2.198.153.841.2 1.705.23 2.517.004.377.004.783.004 1.187.012.5.012.975.012 1.455V40.62c0 .485 0 .957-.012 1.434 0 .434 0 .831-.005 1.24-.028.785-.076 1.648-.228 2.47a7.664 7.664 0 01-.72 2.228 7.297 7.297 0 01-1.353 1.847 7.268 7.268 0 01-1.866 1.363 7.855 7.855 0 01-2.225.733c-.853.155-1.737.197-2.492.218-.39.009-.8.014-1.197.014l-1.445.003-135.58-.003",fill:"#040403"})),be||(be=n.createElement("path",{d:"M33.032 27.068c-.034-3.668 3.002-5.452 3.141-5.536-1.72-2.507-4.385-2.85-5.321-2.877-2.239-.235-4.41 1.34-5.551 1.34-1.162 0-2.92-1.317-4.81-1.278-2.436.038-4.715 1.448-5.964 3.638-2.579 4.464-.656 11.026 1.814 14.633 1.236 1.769 2.68 3.742 4.57 3.672 1.85-.077 2.54-1.18 4.773-1.18 2.212 0 2.86 1.18 4.788 1.135 1.984-.032 3.235-1.775 4.427-3.559 1.428-2.026 2.002-4.02 2.024-4.123-.046-.016-3.854-1.469-3.891-5.865m-3.643-10.786c.994-1.244 1.675-2.936 1.486-4.654-1.44.064-3.24.995-4.276 2.213-.918 1.072-1.738 2.83-1.526 4.481 1.618.12 3.278-.816 4.316-2.04m21.362 17.839h5.002l-2.466-7.261h-.068zm5.658 2.066h-6.312l-1.515 4.475h-2.673l5.977-16.557h2.778l5.977 16.557h-2.718l-1.514-4.475m14.596-1.56c0-2.444-1.263-4.05-3.19-4.05-1.893 0-3.166 1.64-3.166 4.05 0 2.432 1.273 4.061 3.166 4.061 1.927 0 3.19-1.595 3.19-4.061zm2.547 0c0 3.751-2.008 6.161-5.038 6.161-1.72 0-3.086-.77-3.798-2.112h-.057v5.98h-2.478V28.591h2.398v2.007h.046c.689-1.295 2.157-2.134 3.844-2.134 3.063 0 5.083 2.422 5.083 6.162m10.738.001c0-2.444-1.263-4.05-3.19-4.05-1.893 0-3.166 1.64-3.166 4.05 0 2.432 1.273 4.061 3.166 4.061 1.927 0 3.19-1.595 3.19-4.061zm2.547 0c0 3.751-2.008 6.161-5.038 6.161-1.72 0-3.086-.77-3.798-2.112h-.057v5.98h-2.478V28.591h2.398v2.007h.046c.689-1.295 2.157-2.134 3.844-2.134 3.063 0 5.083 2.422 5.083 6.162m8.78 1.422c.184 1.642 1.78 2.72 3.96 2.72 2.088 0 3.59-1.078 3.59-2.558 0-1.285-.906-2.055-3.052-2.582l-2.146-.517c-3.04-.735-4.451-2.157-4.451-4.463 0-2.857 2.489-4.82 6.024-4.82 3.499 0 5.897 1.963 5.978 4.82h-2.501c-.15-1.653-1.516-2.65-3.512-2.65s-3.362 1.01-3.362 2.477c0 1.171.873 1.86 3.007 2.387l1.824.448c3.397.804 4.808 2.168 4.808 4.59 0 3.097-2.467 5.038-6.392 5.038-3.671 0-6.15-1.895-6.31-4.89h2.536m15.514-10.314v2.857h2.296v1.962h-2.296v6.655c0 1.034.46 1.515 1.469 1.515.253 0 .655-.035.815-.057v1.95c-.274.07-.826.115-1.376.115-2.444 0-3.397-.918-3.397-3.26v-6.918h-1.755V28.59h1.755v-2.857h2.49m12.551 8.894c0-2.605-1.194-4.143-3.202-4.143-2.007 0-3.2 1.55-3.2 4.143 0 2.616 1.193 4.142 3.2 4.142 2.008 0 3.202-1.526 3.202-4.142zm-8.927 0c0-3.798 2.237-6.184 5.725-6.184 3.5 0 5.727 2.386 5.727 6.184 0 3.809-2.215 6.185-5.727 6.185-3.51 0-5.725-2.376-5.725-6.185m13.495-6.036h2.363v2.055h.058c.378-1.367 1.48-2.182 2.903-2.182.356 0 .653.047.85.093v2.318c-.197-.082-.633-.15-1.114-.15-1.595 0-2.582 1.079-2.582 2.777v7.16h-2.478V28.591m9.218 4.922h6.035c-.058-1.847-1.239-3.064-2.96-3.064-1.71 0-2.948 1.24-3.075 3.064zm8.376 3.603c-.333 2.192-2.467 3.696-5.197 3.696-3.512 0-5.692-2.353-5.692-6.128 0-3.786 2.192-6.242 5.588-6.242 3.34 0 5.44 2.294 5.44 5.954v.85h-8.527v.15c0 2.064 1.298 3.418 3.248 3.418 1.376 0 2.456-.654 2.788-1.698h2.352M48.803 18.473h1.5c1.664 0 2.623-1.037 2.623-2.862 0-1.797-.975-2.845-2.623-2.845h-1.5zm1.638-6.831c2.36 0 3.744 1.45 3.744 3.953 0 2.542-1.374 4.003-3.744 4.003h-2.873v-7.956h2.873m9.583 4.951c0-1.301-.584-2.062-1.61-2.062-1.03 0-1.61.76-1.61 2.062 0 1.312.58 2.067 1.61 2.067 1.026 0 1.61-.76 1.61-2.067zm-4.443 0c0-1.936 1.08-3.115 2.833-3.115 1.748 0 2.829 1.18 2.829 3.115 0 1.946-1.076 3.12-2.83 3.12-1.758 0-2.832-1.174-2.832-3.12m13.188 3.005H67.54l-1.24-4.422h-.095l-1.235 4.422h-1.218l-1.654-6.004h1.201l1.076 4.581h.088l1.234-4.58h1.138l1.234 4.58h.094l1.07-4.58h1.185l-1.649 6.003m3.042-6.004h1.14v.954h.089c.291-.667.888-1.07 1.791-1.07 1.34 0 2.078.805 2.078 2.233v3.887h-1.184v-3.59c0-.965-.42-1.444-1.296-1.444s-1.434.585-1.434 1.522v3.512h-1.184v-6.004m6.986-2.344h1.185v8.347h-1.185V11.25m7.276 5.343c0-1.301-.585-2.062-1.61-2.062-1.03 0-1.61.76-1.61 2.062 0 1.312.58 2.067 1.61 2.067 1.025 0 1.61-.76 1.61-2.067zm-4.444 0c0-1.936 1.08-3.115 2.833-3.115 1.749 0 2.83 1.18 2.83 3.115 0 1.946-1.076 3.12-2.83 3.12-1.758 0-2.833-1.174-2.833-3.12m10.769.794v-.501l-1.466.093c-.827.056-1.202.337-1.202.866 0 .54.47.855 1.113.855.894 0 1.555-.569 1.555-1.313zm-3.86.513c0-1.08.805-1.703 2.234-1.792l1.626-.094v-.518c0-.634-.42-.992-1.23-.992-.66 0-1.119.243-1.25.667h-1.147c.12-1.031 1.09-1.693 2.453-1.693 1.505 0 2.354.75 2.354 2.018v4.102h-1.14v-.844h-.095c-.357.601-1.014.943-1.803.943-1.158 0-2.001-.7-2.001-1.797m7.82-1.307c0 1.273.6 2.04 1.604 2.04 1 0 1.617-.778 1.617-2.035 0-1.251-.624-2.04-1.617-2.04-.997 0-1.604.772-1.604 2.035zm-1.224 0c0-1.897.976-3.1 2.492-3.1.822 0 1.516.392 1.842 1.054h.088V11.25h1.185v8.347h-1.135v-.948h-.094c-.358.656-1.058 1.047-1.886 1.047-1.527 0-2.492-1.201-2.492-3.103m14.953 0c0-1.301-.584-2.062-1.61-2.062-1.03 0-1.61.76-1.61 2.062 0 1.312.58 2.067 1.61 2.067 1.026 0 1.61-.76 1.61-2.067zm-4.443 0c0-1.936 1.08-3.115 2.833-3.115 1.748 0 2.829 1.18 2.829 3.115 0 1.946-1.076 3.12-2.83 3.12-1.757 0-2.832-1.174-2.832-3.12m7.252-2.999h1.141v.954h.089c.291-.667.888-1.07 1.791-1.07 1.34 0 2.078.805 2.078 2.233v3.887h-1.184v-3.59c0-.965-.42-1.444-1.296-1.444s-1.434.585-1.434 1.522v3.512h-1.184v-6.004m11.793-1.494v1.521h1.3v.999h-1.3v3.087c0 .629.258.904.849.904.182 0 .286-.011.451-.027v.987c-.193.032-.414.06-.644.06-1.318 0-1.843-.464-1.843-1.621v-3.39h-.953v-.999h.953V12.1h1.187m2.919-.85h1.175v3.308h.094c.291-.673.925-1.075 1.83-1.075 1.279 0 2.068.81 2.068 2.238v3.876h-1.186v-3.583c0-.96-.447-1.445-1.284-1.445-.972 0-1.512.612-1.512 1.522v3.506h-1.185V11.25m7.914 4.792h3.033c-.028-.943-.601-1.555-1.479-1.555-.876 0-1.488.617-1.554 1.555zm4.168 1.935c-.27 1.075-1.23 1.737-2.602 1.737-1.72 0-2.773-1.18-2.773-3.1 0-1.918 1.076-3.136 2.768-3.136 1.67 0 2.679 1.142 2.679 3.026v.414h-4.24v.067c.04 1.052.652 1.72 1.598 1.72.719 0 1.21-.26 1.43-.728h1.14",fill:"#fff"})))}var Ee=a(121),_e=a(131),we=a(123),Se=a(449),Oe=a(175),Ce=a(135);const xe="https://play.google.com/store/apps/details?id=im.vector.app",je=e=>{var t,a,n,s,r;let{onFinished:o}=e;const l=_e.b.get("brand"),c=_e.b.getObject("desktop_builds"),d=_e.b.getObject("mobile_builds"),m=null!==(t=null==d?void 0:d.get("ios"))&&void 0!==t?t:"https://apps.apple.com/app/vector/id1083446067",u=null!==(a=null!==(n=null==d?void 0:d.get("android"))&&void 0!==n?n:null==d?void 0:d.get("fdroid"))&&void 0!==a?a:xe,h=null!==(s=null==d?void 0:d.get("android"))&&void 0!==s?s:xe,p=null!==(r=null==d?void 0:d.get("fdroid"))&&void 0!==r?r:"https://f-droid.org/repository/browse/?fdid=im.vector.app";return i.a.createElement(Ce.a,{title:Object(Ee.a)("Download %(brand)s",{brand:l}),className:"mx_AppDownloadDialog",fixedWidth:!0,onFinished:o},(null==c?void 0:c.get("available"))&&i.a.createElement("div",{className:"mx_AppDownloadDialog_desktop"},i.a.createElement(Oe.a,{size:"h3"},Object(Ee.a)("Download %(brand)s Desktop",{brand:l})),i.a.createElement(we.a,{kind:"primary",element:"a",href:null==c?void 0:c.get("url"),target:"_blank",onClick:()=>{}},Object(Ee.a)("Download %(brand)s Desktop",{brand:l}))),i.a.createElement("div",{className:"mx_AppDownloadDialog_mobile"},i.a.createElement("div",{className:"mx_AppDownloadDialog_app"},i.a.createElement(Oe.a,{size:"h3"},Object(Ee.a)("iOS")),i.a.createElement(Se.a,{data:m,margin:0,width:172}),i.a.createElement("div",{className:"mx_AppDownloadDialog_info"},Object(Ee.a)("%(qrCode)s or %(appLinks)s",{appLinks:"",qrCode:""})),i.a.createElement("div",{className:"mx_AppDownloadDialog_links"},i.a.createElement(we.a,{element:"a",href:m,target:"_blank","aria-label":Object(Ee.a)("Download on the App Store"),onClick:()=>{}},i.a.createElement(ye,null)))),i.a.createElement("div",{className:"mx_AppDownloadDialog_app"},i.a.createElement(Oe.a,{size:"h3"},Object(Ee.a)("Android")),i.a.createElement(Se.a,{data:u,margin:0,width:172}),i.a.createElement("div",{className:"mx_AppDownloadDialog_info"},Object(Ee.a)("%(qrCode)s or %(appLinks)s",{appLinks:"",qrCode:""})),i.a.createElement("div",{className:"mx_AppDownloadDialog_links"},i.a.createElement(we.a,{element:"a",href:h,target:"_blank","aria-label":Object(Ee.a)("Get it on Google Play"),onClick:()=>{}},i.a.createElement(pe,null)),i.a.createElement(we.a,{element:"a",href:p,target:"_blank","aria-label":Object(Ee.a)("Get it on F-Droid"),onClick:()=>{}},i.a.createElement(z,null))))),i.a.createElement("div",{className:"mx_AppDownloadDialog_legal"},i.a.createElement("p",null,Object(Ee.a)("App Store® and the Apple logo® are trademarks of Apple Inc.")),i.a.createElement("p",null,Object(Ee.a)("Google Play and the Google Play logo are trademarks of Google LLC."))))};var ke=a(214),Re=a(128),Ie=a(124),Te=a(127),Ne=a(159),Pe=a(478);function De(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function Me(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?De(Object(a),!0).forEach((function(t){W()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):De(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}const Ae=e=>{Ne.b.trackInteraction("WebUserOnboardingTaskSendDm",e),Ie.a.dispatch({action:"view_create_chat"})},Le=[{id:"create-account",title:Object(Ee.a)("Create account"),description:Object(Ee.a)("You made it!"),completed:()=>!0},{id:"find-friends",title:Object(Ee.a)("Find and invite your friends"),description:Object(Ee.a)("It’s what you’re here for, so lets get to it"),completed:e=>e.hasDmRooms,relevant:[Pe.a.PersonalMessaging,Pe.a.Skip],action:{label:Object(Ee.a)("Find friends"),onClick:Ae}},{id:"find-coworkers",title:Object(Ee.a)("Find and invite your co-workers"),description:Object(Ee.a)("Get stuff done by finding your teammates"),completed:e=>e.hasDmRooms,relevant:[Pe.a.WorkMessaging],action:{label:Object(Ee.a)("Find people"),onClick:Ae}},{id:"find-community-members",title:Object(Ee.a)("Find and invite your community members"),description:Object(Ee.a)("Get stuff done by finding your teammates"),completed:e=>e.hasDmRooms,relevant:[Pe.a.CommunityMessaging],action:{label:Object(Ee.a)("Find people"),onClick:Ae}},{id:"download-apps",title:()=>Object(Ee.a)("Download %(brand)s",{brand:_e.b.get("brand")}),description:()=>Object(Ee.a)("Don’t miss a thing by taking %(brand)s with you",{brand:_e.b.get("brand")}),completed:e=>e.hasDevices,action:{label:Object(Ee.a)("Download apps"),onClick:e=>{Ne.b.trackInteraction("WebUserOnboardingTaskDownloadApps",e),Te.b.createDialog(je,{},"mx_AppDownloadDialog_wrapper",!1,!0)}}},{id:"setup-profile",title:Object(Ee.a)("Set up your profile"),description:Object(Ee.a)("Make sure people know it’s really you"),completed:e=>e.hasAvatar,action:{label:Object(Ee.a)("Your profile"),onClick:e=>{Ne.b.trackInteraction("WebUserOnboardingTaskSetupProfile",e),Ie.a.dispatch({action:Re.a.ViewUserSettings,initialTabId:ke.a.General})}}},{id:"permission-notifications",title:Object(Ee.a)("Turn on notifications"),description:Object(Ee.a)("Don’t miss a reply or important message"),completed:e=>e.hasNotificationsEnabled,action:{label:Object(Ee.a)("Enable notifications"),onClick:e=>{Ne.b.trackInteraction("WebUserOnboardingTaskEnableNotifications",e),d.Notifier.setEnabled(!0)},hideOnComplete:!0}}];var Ue=a(477),Fe=a(212),Be=a(633),Ve=a(191),We=a(267),He=a(153),ze=a(133),Ge=a(893);const Ke=e=>{Ne.b.trackInteraction("WebHomeCreateChatButton",e),Ie.a.dispatch({action:"view_create_chat"})},qe=e=>{Ne.b.trackInteraction("WebHomeExploreRoomsButton",e),Ie.a.fire(Re.a.ViewRoomDirectory)},$e=e=>{Ne.b.trackInteraction("WebHomeCreateRoomButton",e),Ie.a.dispatch({action:"view_create_room"})},Ye=e=>{var t;return{displayName:We.a.instance.displayName||e,avatarUrl:null!==(t=We.a.instance.getHttpAvatarUrl(Ge.a))&&void 0!==t?t:void 0}},Je=()=>{const e=Object(n.useContext)(ze.a),t=e.getUserId(),[a,i]=Object(n.useState)(Ye(t));return Object(o.a)(We.a.instance,He.b,(()=>{i(Ye(t))})),n.createElement("div",null,n.createElement(Ge.b,{hasAvatar:!!a.avatarUrl,hasAvatarLabel:Object(Ee.b)("Great, that'll help people know it's you"),noAvatarLabel:Object(Ee.b)("Add a photo so people know it's you."),setAvatarUrl:t=>e.setAvatarUrl(t),isUserAvatar:!0,onClick:e=>Ne.b.trackInteraction("WebHomeMiniAvatarUploadButton",e)},n.createElement(Ve.a,{idName:t,name:a.displayName,url:a.avatarUrl,width:Ge.a,height:Ge.a,resizeMethod:"crop"})),n.createElement("h1",null,Object(Ee.b)("Welcome %(name)s",{name:a.displayName})),n.createElement("h2",null,Object(Ee.b)("Now, let's help you get started")))};var Qe=e=>{let{justRegistered:t=!1}=e;const a=_e.b.get(),i=Object(Ue.a)(a);if(i)return n.createElement(Be.a,{className:"mx_HomePage",url:i,scrollbar:!0});let s;if(t||!We.a.instance.getHttpAvatarUrl(Ge.a))s=n.createElement(Je,null);else{var r;const e=_e.b.getObject("branding"),t=null!==(r=null==e?void 0:e.get("auth_header_logo_url"))&&void 0!==r?r:"themes/element/img/logos/element-logo.svg";s=n.createElement(n.Fragment,null,n.createElement("img",{src:t,alt:a.brand}),n.createElement("h1",null,Object(Ee.b)("Welcome to %(appName)s",{appName:a.brand})),n.createElement("h2",null,Object(Ee.b)("Own your conversations.")))}return n.createElement(Fe.a,{className:"mx_HomePage mx_HomePage_default",element:"main"},n.createElement("div",{className:"mx_HomePage_default_wrapper"},s,n.createElement("div",{className:"mx_HomePage_default_buttons"},n.createElement(we.a,{onClick:Ke,className:"mx_HomePage_button_sendDm"},Object(Ee.b)("Send a Direct Message")),n.createElement(we.a,{onClick:qe,className:"mx_HomePage_button_explore"},Object(Ee.b)("Explore Public Rooms")),n.createElement(we.a,{onClick:$e,className:"mx_HomePage_button_createGroup"},Object(Ee.b)("Create a Group Chat")))))};const Xe=e=>{Ne.b.trackInteraction("WebUserOnboardingHeaderSendDm",e),Ie.a.dispatch({action:"view_create_chat"})};function Ze(e){let t,i,s,r,{useCase:o}=e;switch(o){case Pe.a.PersonalMessaging:t=Object(Ee.a)("Secure messaging for friends and family"),i=Object(Ee.a)("With free end-to-end encrypted messaging, and unlimited voice and video calls, %(brand)s is a great way to stay in touch.",{brand:_e.b.get("brand")}),s=a(894),r=Object(Ee.a)("Start your first chat");break;case Pe.a.WorkMessaging:t=Object(Ee.a)("Secure messaging for work"),i=Object(Ee.a)("With free end-to-end encrypted messaging, and unlimited voice and video calls, %(brand)s is a great way to stay in touch.",{brand:_e.b.get("brand")}),s=a(1492),r=Object(Ee.a)("Find your co-workers");break;case Pe.a.CommunityMessaging:t=Object(Ee.a)("Community ownership"),i=Object(Ee.a)("Keep ownership and control of community discussion.\nScale to support millions, with powerful moderation and interoperability."),s=a(1493),r=Object(Ee.a)("Find your people");break;default:t=Object(Ee.a)("Welcome to %(brand)s",{brand:_e.b.get("brand")}),i=Object(Ee.a)("With free end-to-end encrypted messaging, and unlimited voice and video calls, %(brand)s is a great way to stay in touch.",{brand:_e.b.get("brand")}),s=a(894),r=Object(Ee.a)("Start your first chat")}return n.createElement("div",{className:"mx_UserOnboardingHeader"},n.createElement("div",{className:"mx_UserOnboardingHeader_content"},n.createElement(Oe.a,{size:"h1"},t,n.createElement("span",{className:"mx_UserOnboardingHeader_dot"},".")),n.createElement("p",null,i),n.createElement(we.a,{onClick:Xe,kind:"primary"},r)),n.createElement("img",{className:"mx_UserOnboardingHeader_image",src:s,alt:""}))}var et=a(494),tt=a(628),at=a(462);function nt(){return Object(at.a)()?i.a.createElement("div",{className:"mx_UserOnboardingFeedback","data-testid":"user-onboarding-feedback"},i.a.createElement("div",{className:"mx_UserOnboardingFeedback_content"},i.a.createElement(Oe.a,{size:"h4",className:"mx_UserOnboardingFeedback_title"},Object(Ee.a)("How are you finding %(brand)s so far?",{brand:_e.b.get("brand")})),i.a.createElement("div",{className:"mx_UserOnboardingFeedback_text"},Object(Ee.a)("We’d appreciate any feedback on how you’re finding %(brand)s.",{brand:_e.b.get("brand")}))),i.a.createElement(we.a,{kind:"primary_outline",className:"mx_UserOnboardingFeedback_action",onClick:()=>{Te.b.createDialog(tt.a,{feature:"use-case-selection"})}},Object(Ee.a)("Feedback"))):i.a.createElement(i.a.Fragment,null)}var it=a(126),st=a.n(it);function rt(e){var t;let{task:a,completed:i=!1}=e;const s="function"==typeof a.title?a.title():a.title,r="function"==typeof a.description?a.description():a.description;return n.createElement("li",{"data-testid":"user-onboarding-task",className:st()("mx_UserOnboardingTask",{mx_UserOnboardingTask_completed:i})},n.createElement("div",{className:"mx_UserOnboardingTask_number",role:"checkbox","aria-disabled":"true","aria-checked":i,"aria-labelledby":`mx_UserOnboardingTask_${a.id}`}),n.createElement("div",{id:`mx_UserOnboardingTask_${a.id}`,className:"mx_UserOnboardingTask_content"},n.createElement(Oe.a,{size:"h4",className:"mx_UserOnboardingTask_title"},s),n.createElement("div",{className:"mx_UserOnboardingTask_description"},r)),a.action&&(!a.action.hideOnComplete||!i)&&n.createElement(we.a,{element:"a",className:"mx_UserOnboardingTask_action",kind:"primary_outline",href:a.action.href,target:"_blank",onClick:null!==(t=a.action.onClick)&&void 0!==t?t:null},a.action.label))}const ot=e=>{const t=e.filter((e=>!0===e.completed)).length,a=e.filter((e=>!1===e.completed)).length;return{completed:t,waiting:a,total:t+a}};function lt(e){let{tasks:t}=e;const{completed:a,waiting:i,total:s}=ot(t);return n.createElement("div",{className:"mx_UserOnboardingList","data-testid":"user-onboarding-list"},n.createElement("div",{className:"mx_UserOnboardingList_header"},n.createElement(Oe.a,{size:"h3",className:"mx_UserOnboardingList_title"},i>0?Object(Ee.a)("Only %(count)s steps to go",{count:i}):Object(Ee.a)("You did it!")),n.createElement("div",{className:"mx_UserOnboardingList_hint"},Object(Ee.a)("Complete these to get the most out of %(brand)s",{brand:_e.b.get("brand")}))),n.createElement("div",{className:"mx_UserOnboardingList_progress"},n.createElement(et.a,{value:a,max:s,animated:!0}),0===i&&n.createElement(nt,null)),n.createElement("ol",{className:"mx_UserOnboardingList_list"},t.map((e=>n.createElement(rt,{key:e.id,completed:e.completed,task:e})))))}const ct=new Date(1656633600);function dt(e){return null!==e||r.a.userRegisteredAfter(ct)}const mt=2800;function ut(e){let{justRegistered:t=!1}=e;const a=_e.b.get(),i=Object(Ue.a)(a),c=Object(l.b)("FTUE.useCaseSelection"),u=function(e){var t;const a=null!==(t=Object(l.b)("FTUE.useCaseSelection"))&&void 0!==t?t:Pe.a.Skip;return Object(n.useMemo)((()=>Le.filter((e=>!e.relevant||e.relevant.includes(a))).map((t=>Me(Me({},t),{},{completed:t.completed(e)})))),[e,a])}(function(){const e=h(!1,(async e=>{const t=await e.getProfileInfo(e.getUserId());return Boolean(null==t?void 0:t.avatar_url)})),t=h(!1,(async e=>{const t=e.getDeviceId(),a=await e.getDevices();return Boolean(a.devices.find((e=>e.device_id!==t)))})),a=h(!1,(async()=>{var e;const t=null!==(e=m.a.shared().getUniqueRoomsWithIndividuals())&&void 0!==e?e:{};return Boolean(Object.keys(t).length)})),i=h(!1,(async()=>d.Notifier.isPossible()));return Object(n.useMemo)((()=>({hasAvatar:e,hasDevices:t,hasDmRooms:a,hasNotificationsEnabled:i})),[e,t,a,i])}()),p=function(){const e=r.a.get();return Object(o.b)(e,s.ClientEvent.Sync,(()=>e.isInitialSyncComplete()))}(),[g,v]=Object(n.useState)(!1);return Object(n.useEffect)((()=>{if(p){const e=window.setTimeout((()=>{v(!0)}),mt);return()=>{clearTimeout(e)}}v(!1)}),[p,v]),dt(c)?i?n.createElement(Be.a,{className:"mx_HomePage",url:i,scrollbar:!0}):n.createElement(Fe.a,{className:"mx_UserOnboardingPage"},n.createElement(Ze,{useCase:c}),g&&n.createElement(lt,{tasks:u})):n.createElement(Qe,{justRegistered:t})}},490:function(e,t,a){"use strict";a.d(t,"a",(function(){return u})),a.d(t,"b",(function(){return h})),a.d(t,"c",(function(){return p})),a.d(t,"d",(function(){return g}));var n,i,s=a(13),r=a.n(s),o=a(10),l=a(413),c=a(1),d=a(16);!function(e){e.Start="m.login.start",e.Finish="m.login.finish",e.Progress="m.login.progress"}(n||(n={})),function(e){e.Success="success",e.Failure="failure",e.Verified="verified",e.Declined="declined",e.Unsupported="unsupported"}(i||(i={}));const m=new o.UnstableValue("login_token","org.matrix.msc3906.login_token");class u{constructor(e,t,a){this.channel=e,this.client=t,this.onFailure=a,r()(this,"newDeviceId",void 0),r()(this,"newDeviceKey",void 0),r()(this,"ourIntent",g.RECIPROCATE_LOGIN_ON_EXISTING_DEVICE),r()(this,"_code",void 0)}get code(){return this._code}async generateCode(){this._code||(this._code=JSON.stringify(await this.channel.generateCode(this.ourIntent)))}async startAfterShowingCode(){const e=await this.channel.connect();c.a.info(`Connected to secure channel with checksum: ${e} our intent is ${this.ourIntent}`);if((await Object(l.c)(await this.client.getVersions())).get(l.a.LoginTokenRequest)===l.b.Unsupported)return c.a.info("Server doesn't support MSC3882"),await this.send({type:n.Finish,outcome:i.Unsupported}),void await this.cancel(p.HomeserverLacksSupport);await this.send({type:n.Progress,protocols:[m.name]}),c.a.info("Waiting for other device to chose protocol");const{type:t,protocol:a,outcome:s}=await this.receive();if(t!==n.Finish)if(t===n.Progress){if(a&&m.matches(a))return e;await this.cancel(p.UnsupportedAlgorithm)}else await this.cancel(p.Unknown);else if("unsupported"===(null!=s?s:""))await this.cancel(p.UnsupportedAlgorithm);else await this.cancel(p.Unknown)}async receive(){return await this.channel.receive()}async send(e){await this.channel.send(e)}async declineLoginOnExistingDevice(){c.a.info("User declined sign in"),await this.send({type:n.Finish,outcome:i.Declined})}async approveLoginOnExistingDevice(e){await this.send({type:n.Progress,login_token:e,homeserver:this.client.baseUrl}),c.a.info("Waiting for outcome");const t=await this.receive();if(!t)return;const{outcome:a,device_id:i,device_key:s}=t;if("success"!==a)throw new Error("Linking failed");return this.newDeviceId=i,this.newDeviceKey=s,i}async verifyAndCrossSignDevice(e){if(!this.client.crypto)throw new Error("Crypto not available on client");if(!this.newDeviceId)throw new Error("No new device ID set");if(e.getFingerprint()!==this.newDeviceKey)throw new Error(`New device has different keys than expected: ${this.newDeviceKey} vs ${e.getFingerprint()}`);const t=this.client.getUserId();if(!t)throw new Error("No user ID set");c.a.info(`Marking device ${this.newDeviceId} as verified`);const a=await this.client.crypto.setDeviceVerification(t,this.newDeviceId,!0,!1,!0),s=this.client.crypto.crossSigningInfo.getId("master");return await this.send({type:n.Finish,outcome:i.Verified,verifying_device_id:this.client.getDeviceId(),verifying_device_key:this.client.getDeviceEd25519Key(),master_key:s}),a}async verifyNewDeviceOnExistingDevice(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e4;if(!this.newDeviceId)throw new Error("No new device to sign");if(!this.newDeviceKey)return void c.a.info("No new device key to sign");if(!this.client.crypto)throw new Error("Crypto not available on client");const t=this.client.getUserId();if(!t)throw new Error("No user ID set");let a=this.client.crypto.getStoredDevice(t,this.newDeviceId);if(a||(c.a.info("Going to wait for new device to be online"),await Object(d.N)(e),a=this.client.crypto.getStoredDevice(t,this.newDeviceId)),a)return await this.verifyAndCrossSignDevice(a);throw new Error("Device not online within timeout")}async cancel(e){var t;null===(t=this.onFailure)||void 0===t||t.call(this,e),await this.channel.cancel(e)}async close(){await this.channel.close()}}class h extends Error{constructor(e,t){super(e),this.code=t}}let p,g;!function(e){e.UserDeclined="user_declined",e.OtherDeviceNotSignedIn="other_device_not_signed_in",e.OtherDeviceAlreadySignedIn="other_device_already_signed_in",e.Unknown="unknown",e.Expired="expired",e.UserCancelled="user_cancelled",e.InvalidCode="invalid_code",e.UnsupportedAlgorithm="unsupported_algorithm",e.DataMismatch="data_mismatch",e.UnsupportedTransport="unsupported_transport",e.HomeserverLacksSupport="homeserver_lacks_support"}(p||(p={})),function(e){e.LOGIN_ON_NEW_DEVICE="login.start",e.RECIPROCATE_LOGIN_ON_EXISTING_DEVICE="login.reciprocate"}(g||(g={}))},620:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return r}));var n,i=a(120);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},s.apply(this,arguments)}function r(e){return i.createElement("svg",s({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 18 18",role:"presentation","aria-hidden":!0},e),n||(n=i.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 9.27V3.05L9 1l7 2.05v6.22C16 15.63 9 17 9 17s-7-1.37-7-7.73zM8.92 4.4c-.57.04-.99.54-.94 1.11l.32 4c.03.35.3.62.65.65h.06c.37 0 .68-.28.71-.65l.32-4v-.16a1.06 1.06 0 00-1.12-.95zm.96 7.72a.88.88 0 11-1.76 0 .88.88 0 011.76 0z",fill:"currentColor"})))}t.default="img/e2e/warning.d370b49.svg"},621:function(e,t,a){"use strict";a.d(t,"a",(function(){return s})),a.d(t,"c",(function(){return r})),a.d(t,"b",(function(){return l}));var n=a(344);const i=7776e6,s=90,r=e=>!!e.last_seen_ts&&e.last_seen_ts<Date.now()-i,o={[n.a.Verified]:e=>!!e.isVerified,[n.a.Unverified]:e=>!e.isVerified,[n.a.Inactive]:r},l=(e,t)=>{const a=t.map((e=>o[e]));return a.length?e.filter((e=>a.every((t=>t(e))))):e}},622:function(e,t,a){"use strict";a.d(t,"a",(function(){return h}));var n=a(129),i=a(187),s=a(204),r=a(125),o=a(238),l=a(122),c=a(180),d=a(203),m=a(192);const u=(e,t,a,r)=>!(a||r||e===n.b.RoomMessage||e===n.b.RoomMessageEncrypted||e===n.b.Sticker||e===n.b.RoomCreate||i.e.matches(e)||i.a.matches(e)||s.b.matches(e)||e===m.g&&(null==t?void 0:t.state)===m.h.Started);function h(e,t,a){const h=e.getContent(),p=h.msgtype,g=e.getType();let v=!1;if(r.b.getValue("feature_msc3531_hide_messages_pending_moderation"))switch(Object(c.h)(e)){case c.a.VISIBLE_FOR_ALL:case c.a.HIDDEN_TO_CURRENT_USER:break;case c.a.SEE_THROUGH_FOR_CURRENT_USER:v=!0}let b=Object(o.e)(e,l.a.get(),t),f=g.startsWith("m.key.verification")||g===n.b.RoomMessage&&(null==p?void 0:p.startsWith("m.key.verification"))||g===n.b.RoomCreate||g===n.b.RoomEncryption||b===o.b;const y=!f&&(g===n.b.CallInvite||d.d.CALL_EVENT_TYPE.matches(g));let E=u(g,h,f,y);const _=g===n.b.RoomMessage&&p===n.e.Emote||i.e.matches(g)||s.b.matches(g)||Object(c.l)(e)||g===m.g;return!a&&Object(o.c)(e,t)||(b=Object(o.e)(e,l.a.get(),t,!0),b===o.a&&(f=!1,E=!0)),{hasRenderer:!!b,isInfoMessage:E,isBubbleMessage:f,isLeftAlignedBubbleMessage:y,noBubbleEvent:_,isSeeingThroughMessageHiddenForModeration:v}}},623:function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n,i,s,r=a(120);function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},o.apply(this,arguments)}function l(e){return r.createElement("svg",o({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 18 18",role:"presentation","aria-hidden":!0},e),n||(n=r.createElement("circle",{cx:4.25,cy:9,r:1.25,fill:"currentColor"})),i||(i=r.createElement("circle",{cx:9,cy:9,r:1.25,fill:"currentColor"})),s||(s=r.createElement("circle",{cx:13.75,cy:9,r:1.25,fill:"currentColor"})))}},624:function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n,i=a(120);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},s.apply(this,arguments)}function r(e){return i.createElement("svg",s({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 16",role:"presentation","aria-hidden":!0},e),n||(n=i.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M4.523 2.964a6.418 6.418 0 0110.36 4.369h1.29c.26 0 .416.292.272.51l-2.006 3.011a.327.327 0 01-.544 0l-2.006-3.012a.327.327 0 01.272-.509h1.21a4.918 4.918 0 00-7.918-3.192 3.684 3.684 0 01-.184.136l-.014.01-.004.003-.002.001h-.001v.001l-.415-.625.414.625a.75.75 0 01-.83-1.25l.003-.001.02-.014a1.7 1.7 0 00.083-.063zm-.895 5.703H4.84a.327.327 0 00.272-.51L3.106 5.146a.327.327 0 00-.545 0L.555 8.157a.328.328 0 00.273.51h1.29a6.418 6.418 0 0010.503 4.251.75.75 0 00-.963-1.15 4.918 4.918 0 01-8.03-3.102z",clipRule:"evenodd"})))}},625:function(e,t,a){"use strict";a.d(t,"a",(function(){return p})),a.d(t,"b",(function(){return b}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(126),l=a.n(o),c=a(123),d=a(121),m=a(266),u=a(191),h=a(874);let p;!function(e){e.Admin="admin",e.Moderator="moderator"}(p||(p={}));const g={[p.Admin]:Object(d.c)("Admin"),[p.Moderator]:Object(d.c)("Mod")},v={offline:"mx_EntityTile_offline",online:"mx_EntityTile_online",unavailable:"mx_EntityTile_unavailable"};class b extends r.a.PureComponent{constructor(e){super(e),this.state={hover:!1}}render(){const e={mx_EntityTile:!0,mx_EntityTile_noHover:this.props.suppressOnHover};this.props.className&&(e[this.props.className]=!0);var t,n;let i;e[(t=this.props.presenceState,n=this.props.presenceLastActiveAgo,!1===this.props.showPresence?"mx_EntityTile_online_beenactive":"offline"===t?n?v.offline+"_beenactive":v.offline+"_neveractive":t?v[t]:v.offline+"_neveractive")]=!0;const s=this.props.nameJSX||this.props.name;if(this.props.suppressOnHover)i=this.props.subtextLabel?r.a.createElement("div",{className:"mx_EntityTile_details"},r.a.createElement("div",{className:"mx_EntityTile_name"},s),r.a.createElement("span",{className:"mx_EntityTile_subtext"},this.props.subtextLabel)):r.a.createElement("div",{className:"mx_EntityTile_name"},s);else{const e=this.props.presenceLastActiveAgo?Date.now()-(this.props.presenceLastTs-this.props.presenceLastActiveAgo):-1;let t=null;this.props.showPresence&&(t=r.a.createElement(h.a,{activeAgo:e,currentlyActive:this.props.presenceCurrentlyActive,presenceState:this.props.presenceState})),this.props.subtextLabel&&(t=r.a.createElement("span",{className:"mx_EntityTile_subtext"},this.props.subtextLabel)),i=r.a.createElement("div",{className:"mx_EntityTile_details"},r.a.createElement("div",{className:"mx_EntityTile_name"},s),t)}let o,p;this.props.showInviteButton&&(o=r.a.createElement("div",{className:"mx_EntityTile_invite"},r.a.createElement("img",{src:a(1435).default,width:"16",height:"16"})));const b=this.props.powerStatus;if(b){const e=Object(d.a)(g[b]);p=r.a.createElement("div",{className:"mx_EntityTile_power"},e)}let f;const{e2eStatus:y}=this.props;y&&(f=r.a.createElement(m.b,{status:y,isUser:!0,bordered:!0}));const E=this.props.avatarJsx||r.a.createElement(u.a,{name:this.props.name,width:36,height:36,"aria-hidden":"true"});return r.a.createElement("div",null,r.a.createElement(c.a,{className:l()(e),title:this.props.title,onClick:this.props.onClick},r.a.createElement("div",{className:"mx_EntityTile_avatar"},E,f),i,p,o))}}i()(b,"defaultProps",{onClick:()=>{},presenceState:"offline",presenceLastActiveAgo:0,presenceLastTs:0,showInviteButton:!1,suppressOnHover:!1,showPresence:!0})},626:function(e,t,a){"use strict";a.d(t,"a",(function(){return l})),a.d(t,"b",(function(){return c}));var n=a(120),i=a(129),s=a(151),r=a(269),o=a(141);const l=e=>{var t,a;const n=null==e||null===(t=e.currentState)||void 0===t||null===(a=t.getStateEvents(i.b.RoomTopic,""))||void 0===a?void 0:a.getContent();return n?Object(r.parseTopicContent)(n):null};function c(e){const[t,a]=Object(n.useState)(l(e));return Object(o.c)(e.currentState,s.b.Events,(t=>{t.getType()===i.b.RoomTopic&&a(l(e))})),Object(n.useEffect)((()=>{a(l(e))}),[e]),t}},627:function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));var n=a(120);const i=e=>{const t=Object(n.useRef)(null);return[Object(n.useCallback)((e=>{t.current=e}),[]),Object(n.useCallback)(((a,n)=>{t.current===a&&e(n)}),[e])]}},628:function(e,t,a){"use strict";var n=a(120),i=a.n(n),s=a(155),r=a(121),o=a(139),l=a(123),c=a(131),d=a(127),m=a(276),u=a(213),h=a(384),p=a(397),g=a(177);t.a=e=>{const t=Object(n.useRef)(),[a,v]=Object(n.useState)(""),[b,f]=Object(p.a)(!1);Object(n.useEffect)((()=>{var e;null===(e=t.current)||void 0===e||e.focus()}),[]);const y=()=>{e.onFinished(),d.b.createDialog(m.a,{})},E=c.b.get().bug_report_endpoint_url,_=!!E;let w;E&&(w=i.a.createElement("div",{className:"mx_FeedbackDialog_section mx_FeedbackDialog_rateApp"},i.a.createElement("h3",null,Object(r.a)("Comment")),i.a.createElement("p",null,Object(r.a)("Your platform and username will be noted to help us use your feedback as much as we can.")),i.a.createElement(o.a,{id:"feedbackComment",label:Object(r.a)("Feedback"),type:"text",autoComplete:"off",value:a,element:"textarea",onChange:e=>{v(e.target.value)},ref:t}),i.a.createElement(g.b,{checked:b,onChange:f},Object(r.a)("You may contact me if you want to follow up or to let me test out upcoming ideas"))));let S=null;return E&&(S=i.a.createElement("p",{className:"mx_FeedbackDialog_section_microcopy"},Object(r.a)("PRO TIP: If you start a bug, please submit <debugLogsLink>debug logs</debugLogsLink> to help us track down the problem.",{},{debugLogsLink:e=>i.a.createElement(l.a,{kind:"link_inline",onClick:y},e)}))),i.a.createElement(s.a,{className:"mx_FeedbackDialog",hasCancelButton:!!_,title:Object(r.a)("Feedback"),description:i.a.createElement(i.a.Fragment,null,i.a.createElement("div",{className:"mx_FeedbackDialog_section mx_FeedbackDialog_reportBug"},i.a.createElement("h3",null,Object(r.a)("Report a bug")),i.a.createElement("p",null,Object(r.a)("Please view <existingIssuesLink>existing bugs on Github</existingIssuesLink> first. No match? <newIssueLink>Start a new one</newIssueLink>.",{},{existingIssuesLink:e=>i.a.createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://github.com/vector-im/element-web/issues?q=is%3Aopen+is%3Aissue+sort%3Areactions-%2B1-desc"},e),newIssueLink:e=>i.a.createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://github.com/vector-im/element-web/issues/new/choose"},e)})),S),w),button:_?Object(r.a)("Send feedback"):Object(r.a)("Go back"),buttonDisabled:_&&!a,onFinished:t=>{if(_&&t){if(E){const t=e.feature?`${e.feature}-feedback`:"feedback";Object(h.c)(E,t,a,b)}d.b.createDialog(u.a,{title:Object(r.a)("Feedback sent"),description:Object(r.a)("Thank you!")})}e.onFinished()}})}},629:function(e,t,a){"use strict";var n=a(130),i=a.n(n),s=a(132),r=a.n(s),o=a(120),l=a.n(o),c=a(129),d=a(176),m=a(121),u=a(249),h=a(496),p=a(133),g=a(124),v=a(286),b=a(125),f=a(167),y=a(128),E=a(221),_=a(156),w=a(159);const S=["space","hideHeader","onFinished"];t.a=e=>{let{space:t,hideHeader:a,onFinished:n}=e,s=r()(e,S);const O=Object(o.useContext)(p.a).getUserId();let C=null;if("public"===t.getJoinRule()||t.canInvite(O)){const e=e=>{e.preventDefault(),e.stopPropagation(),Object(u.i)(t),n()};C=l.a.createElement(d.b,{"data-testid":"invite-option",className:"mx_SpacePanel_contextMenu_inviteButton",iconClassName:"mx_SpacePanel_iconInvite",label:Object(m.a)("Invite"),onClick:e})}let x=null,j=null;if(Object(u.d)(t)){const e=e=>{e.preventDefault(),e.stopPropagation(),Object(u.k)(t),n()};x=l.a.createElement(d.b,{"data-testid":"settings-option",iconClassName:"mx_SpacePanel_iconSettings",label:Object(m.a)("Settings"),onClick:e})}else{const e=e=>{e.preventDefault(),e.stopPropagation(),Object(h.b)(t),n()};j=l.a.createElement(d.b,{"data-testid":"leave-option",iconClassName:"mx_SpacePanel_iconLeave",className:"mx_IconizedContextMenu_option_red",label:Object(m.a)("Leave space"),onClick:e})}let k=null;if(b.b.getValue("developerMode")){const e=e=>{e.preventDefault(),e.stopPropagation(),g.a.dispatch({action:y.a.ViewRoom,room_id:t.roomId,forceTimeline:!0,metricsTrigger:void 0}),n()};k=l.a.createElement(d.b,{iconClassName:"mx_SpacePanel_iconSettings",label:Object(m.a)("See room timeline (devtools)"),onClick:e})}const R=Object(f.a)("feature_video_rooms"),I=Object(f.a)("feature_element_call_video_rooms"),T=t.currentState.maySendStateEvent(c.b.SpaceChild,O),N=T&&Object(E.a)(_.a.CreateRooms),P=N&&R,D=T&&Object(E.a)(_.a.CreateSpaces);let M=null;if(N||D){const e=e=>{e.preventDefault(),e.stopPropagation(),w.b.trackInteraction("WebSpaceContextMenuNewRoomItem",e),Object(u.g)(t),n()},a=e=>{e.preventDefault(),e.stopPropagation(),Object(u.g)(t,I?c.j.UnstableCall:c.j.ElementVideo),n()},i=e=>{e.preventDefault(),e.stopPropagation(),Object(u.h)(t),n()};M=l.a.createElement(l.a.Fragment,null,l.a.createElement("div",{"data-testid":"add-to-space-header",className:"mx_SpacePanel_contextMenu_separatorLabel"},Object(m.a)("Add")),N&&l.a.createElement(d.b,{"data-testid":"new-room-option",iconClassName:"mx_SpacePanel_iconPlus",label:Object(m.a)("Room"),onClick:e}),P&&l.a.createElement(d.b,{"data-testid":"new-video-room-option",iconClassName:"mx_SpacePanel_iconPlus",label:Object(m.a)("Video room"),onClick:a},l.a.createElement(v.a,null)),D&&l.a.createElement(d.b,{"data-testid":"new-subspace-option",iconClassName:"mx_SpacePanel_iconPlus",label:Object(m.a)("Space"),onClick:i},l.a.createElement(v.a,null)))}const A=e=>{e.preventDefault(),e.stopPropagation(),g.a.dispatch({action:y.a.ViewRoom,room_id:t.roomId,metricsTrigger:void 0}),n()};return l.a.createElement(d.e,i()({},s,{onFinished:n,className:"mx_SpacePanel_contextMenu",compact:!0}),!a&&l.a.createElement("div",{className:"mx_SpacePanel_contextMenu_header"},t.name),l.a.createElement(d.c,{first:!0},l.a.createElement(d.b,{iconClassName:"mx_SpacePanel_iconHome",label:Object(m.a)("Space home"),onClick:e=>{w.b.trackInteraction("WebSpaceContextMenuHomeItem",e),A(e)}}),C,l.a.createElement(d.b,{iconClassName:"mx_SpacePanel_iconExplore",label:N?Object(m.a)("Manage & explore rooms"):Object(m.a)("Explore rooms"),onClick:e=>{w.b.trackInteraction("WebSpaceContextMenuExploreRoomsItem",e),A(e)}}),l.a.createElement(d.b,{iconClassName:"mx_SpacePanel_iconPreferences",label:Object(m.a)("Preferences"),onClick:e=>{e.preventDefault(),e.stopPropagation(),Object(u.j)(t),n()}}),k,x,j,M))}},630:function(e,t,a){"use strict";a.d(t,"a",(function(){return b}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(1),l=a(127),c=a(124),d=a(121),m=a(122),u=a(367),h=a(155),p=a(135),g=a(134),v=a(145);class b extends r.a.Component{constructor(e){super(e),i()(this,"onExportE2eKeysClicked",(()=>{l.b.createDialogAsync(a.e(7).then(a.bind(null,1536)),{matrixClient:m.a.get()})})),i()(this,"onFinished",(e=>{e&&c.a.dispatch({action:"logout"}),this.props.onFinished(e)})),i()(this,"onSetRecoveryMethodClick",(()=>{this.state.backupInfo?l.b.createDialog(u.a,void 0,void 0,!1,!0):l.b.createDialogAsync(a.e(8).then(a.bind(null,912)),void 0,void 0,!1,!0),this.props.onFinished(!0)})),i()(this,"onLogoutConfirm",(()=>{c.a.dispatch({action:"logout"}),this.props.onFinished(!0)}));const t=m.a.get(),n=t.isCryptoEnabled()&&!t.getKeyBackupEnabled();this.state={shouldLoadBackupStatus:n,loading:n,backupInfo:null},n&&this.loadBackupStatus()}async loadBackupStatus(){try{const e=await m.a.get().getKeyBackupVersion();this.setState({loading:!1,backupInfo:e})}catch(e){o.a.log("Unable to fetch key backup status",e),this.setState({loading:!1,error:e})}}render(){if(this.state.shouldLoadBackupStatus){const e=r.a.createElement("div",null,r.a.createElement("p",null,Object(d.a)("Encrypted messages are secured with end-to-end encryption. Only you and the recipient(s) have the keys to read these messages.")),r.a.createElement("p",null,Object(d.a)("When you sign out, these keys will be deleted from this device, which means you won't be able to read encrypted messages unless you have the keys for them on your other devices, or backed them up to the server.")),r.a.createElement("p",null,Object(d.a)("Back up your keys before signing out to avoid losing them.")));let t;if(this.state.loading)t=r.a.createElement(g.a,null);else{let a;a=this.state.backupInfo?Object(d.a)("Connect this session to Key Backup"):Object(d.a)("Start using Key Backup"),t=r.a.createElement("div",null,r.a.createElement("div",{className:"mx_Dialog_content",id:"mx_Dialog_content"},e),r.a.createElement(v.a,{primaryButton:a,hasCancel:!1,onPrimaryButtonClick:this.onSetRecoveryMethodClick,focus:!0},r.a.createElement("button",{onClick:this.onLogoutConfirm},Object(d.a)("I don't want my encrypted messages"))),r.a.createElement("details",null,r.a.createElement("summary",null,Object(d.a)("Advanced")),r.a.createElement("p",null,r.a.createElement("button",{onClick:this.onExportE2eKeysClicked},Object(d.a)("Manually export keys")))))}return r.a.createElement(p.a,{title:Object(d.a)("You'll lose access to your encrypted messages"),contentId:"mx_Dialog_content",hasCancel:!0,onFinished:this.onFinished},t)}return r.a.createElement(h.a,{hasCancelButton:!0,title:Object(d.a)("Sign out"),description:Object(d.a)("Are you sure you want to sign out?"),button:Object(d.a)("Sign out"),onFinished:this.onFinished})}}i()(b,"defaultProps",{onFinished:function(){}})},631:function(e,t,a){"use strict";t.__esModule=!0,t.createSubscription=function(e,t){var a,s=i;function r(){l.onStateChange&&l.onStateChange()}function o(){var i,o,l;a||(a=t?t.addNestedSub(r):e.subscribe(r),i=(0,n.getBatch)(),o=null,l=null,s={clear:function(){o=null,l=null},notify:function(){i((function(){for(var e=o;e;)e.callback(),e=e.next}))},get:function(){for(var e=[],t=o;t;)e.push(t),t=t.next;return e},subscribe:function(e){var t=!0,a=l={callback:e,next:null,prev:l};return a.prev?a.prev.next=a:o=a,function(){t&&null!==o&&(t=!1,a.next?a.next.prev=a.prev:l=a.prev,a.prev?a.prev.next=a.next:o=a.next)}}})}var l={addNestedSub:function(e){return o(),s.subscribe(e)},notifyNestedSubs:function(){s.notify()},handleChangeWrapper:r,isSubscribed:function(){return Boolean(a)},trySubscribe:o,tryUnsubscribe:function(){a&&(a(),a=void 0,s.clear(),s=i)},getListeners:function(){return s}};return l};var n=a(885);var i={notify:function(){},get:function(){return[]}}},632:function(e,t,a){"use strict";t.__esModule=!0,t.useIsomorphicLayoutEffect=void 0;var n=a(120),i="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?n.useLayoutEffect:n.useEffect;t.useIsomorphicLayoutEffect=i},633:function(e,t,a){"use strict";a.d(t,"a",(function(){return b}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(439),l=a.n(o),c=a(126),d=a.n(c),m=a(1),u=a(121),h=a(124),p=a(122),g=a(133),v=a(212);class b extends r.a.PureComponent{constructor(e,t){super(e,t),i()(this,"unmounted",!1),i()(this,"dispatcherRef",null),i()(this,"onAction",(e=>{"client_started"===e.action&&this.forceUpdate()})),this.state={page:""}}translate(e){return l()(Object(u.a)(e))}async fetchEmbed(){let e;try{e=await fetch(this.props.url,{method:"GET"})}catch(e){if(this.unmounted)return;return m.a.warn(`Error loading page: ${e}`),void this.setState({page:Object(u.a)("Couldn't load page")})}if(this.unmounted)return;if(!e.ok)return m.a.warn(`Error loading page: ${e.status}`),void this.setState({page:Object(u.a)("Couldn't load page")});let t=(await e.text()).replace(/_t\(['"]([\s\S]*?)['"]\)/gm,((e,t)=>this.translate(t)));this.props.replaceMap&&Object.keys(this.props.replaceMap).forEach((e=>{t=t.split(e).join(this.props.replaceMap[e])})),this.setState({page:t})}componentDidMount(){this.unmounted=!1,this.props.url&&(this.fetchEmbed(),this.dispatcherRef=h.a.register(this.onAction))}componentWillUnmount(){this.unmounted=!0,null!==this.dispatcherRef&&h.a.unregister(this.dispatcherRef)}render(){const e=this.context||p.a.get(),t=!e||e.isGuest(),a=this.props.className,n=d()(a,{[`${a}_guest`]:t,[`${a}_loggedIn`]:!!e}),i=r.a.createElement("div",{className:`${a}_body`,dangerouslySetInnerHTML:{__html:this.state.page}});return this.props.scrollbar?r.a.createElement(v.a,{className:n},i):r.a.createElement("div",{className:n},i)}}i()(b,"contextType",g.a)},634:function(e,t,a){"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.WidgetLifecycle=void 0,t.WidgetLifecycle=n,function(e){e.CapabilitiesRequest="capabilities_request",e.PreLoadRequest="preload_request",e.IdentityRequest="identity_request"}(n||(t.WidgetLifecycle=n={}))},635:function(e,t,a){"use strict";a.d(t,"a",(function(){return f}));var n=a(13),i=a.n(n),s=a(179),r=a(400),o=a(1),l=a(1502),c=a.n(l),d=a(122),m=a(895),u=a(528),h=a(166),p=a(165),g=a(180),v=a(121),b=a(131);class f{constructor(e,t,a,n){if(this.room=e,this.exportType=t,this.exportOptions=a,this.setProgressText=n,i()(this,"files",[]),i()(this,"client",void 0),i()(this,"cancelled",!1),a.maxSize<1048576||a.maxSize>8388608e3||a.numberOfMessages>10**8)throw new Error("Invalid export options");this.client=d.a.get(),window.addEventListener("beforeunload",this.onBeforeUnload)}get destinationFileName(){return this.makeFileNameNoExtension(b.b.get().brand)+".zip"}onBeforeUnload(e){return e.preventDefault(),e.returnValue=Object(v.a)("Are you sure you want to exit during this export?")}updateProgress(e){let t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];(!(arguments.length>1&&void 0!==arguments[1])||arguments[1])&&o.a.log(e),t&&this.setProgressText(e)}addFile(e,t){const a={name:e,blob:t};this.files.push(a)}makeFileNameNoExtension(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"matrix";const a=c()(null!==(e=this.room.name)&&void 0!==e?e:Object(v.a)("Unnamed Room")).trim()||"Unnamed Room",n=Object(p.e)(new Date).replace(/:/g,"-");return`${c()(t)} - ${a} - Chat Export - ${n}`}async downloadZIP(){const e=this.destinationFileName,t=e.substring(0,e.lastIndexOf(".")),{default:n}=await a.e(42).then(a.t.bind(null,1537,7)),i=new n;if(this.cancelled)return this.cleanUp();this.updateProgress(Object(v.a)("Generating a ZIP"));for(const e of this.files)i.file(t+"/"+e.name,e.blob);const s=await i.generateAsync({type:"blob"});Object(r.saveAs)(s,t+".zip")}cleanUp(){return o.a.log("Cleaning up..."),window.removeEventListener("beforeunload",this.onBeforeUnload),""}async cancelExport(){o.a.log("Cancelling export..."),this.cancelled=!0}downloadPlainText(e,t){const a=new Blob([t],{type:"text/plain"});Object(r.saveAs)(a,e)}setEventMetadata(e){const t=this.client.getRoom(this.room.roomId).currentState;return e.sender=t.getSentinelMember(e.getSender()),"m.room.member"===e.getType()&&(e.target=t.getSentinelMember(e.getStateKey())),e}getLimit(){let e;switch(this.exportType){case m.b.LastNMessages:e=this.exportOptions.numberOfMessages;break;case m.b.Timeline:e=40;break;default:e=10**8}return e}async getRequiredEvents(){const e=this.client.getEventMapper();let t=null,a=this.getLimit();const n=[];for(;a;){const i=Math.min(a,1e3),r=await this.client.createMessagesRequest(this.room.roomId,t,i,s.a.Backward);if(this.cancelled)return this.cleanUp(),[];if(0===r.chunk.length)break;a-=r.chunk.length;const o=r.chunk.map(e);for(const e of o)n.push(e);this.exportType===m.b.LastNMessages?this.updateProgress(Object(v.a)("Fetched %(count)s events out of %(total)s",{count:n.length,total:this.exportOptions.numberOfMessages})):this.updateProgress(Object(v.a)("Fetched %(count)s events so far",{count:n.length})),t=r.end}for(let e=0;e<Math.floor(n.length/2);e++)[n[e],n[n.length-e-1]]=[n[n.length-e-1],n[e]];const i=n.filter((e=>e.isEncrypted())).map((e=>this.client.decryptEventIfNeeded(e,{isRetry:!0,emit:!1})));await Promise.all(i);for(let e=0;e<n.length;e++)this.setEventMetadata(n[e]);return n}async getMediaBlob(e){let t;try{const a=e.isEncrypted(),n=e.getContent();if(a&&n.hasOwnProperty("file")&&"m.sticker"!==e.getType())t=await Object(u.c)(n.file);else{const e=Object(h.a)(n),a=await fetch(e.srcHttp);t=await a.blob()}}catch(e){o.a.log("Error decrypting media")}return t}splitFileName(e){const t=e.lastIndexOf(".");if(-1===t)return[e,""];return[e.slice(0,t),"."+e.slice(t+1)]}getFilePath(e){let t;switch(e.getContent().msgtype){case"m.image":t="images";break;case"m.video":t="videos";break;case"m.audio":t="audio";break;default:t="m.sticker"===e.getType()?"stickers":"files"}const a=Object(p.d)(new Date(e.getTs()));let[n,i]=this.splitFileName(e.getContent().body);return"m.sticker"===e.getType()&&(i=".png"),Object(g.m)(e)&&(i=".ogg"),t+"/"+n+"-"+a+i}isReply(e){const t=(e.isEncrypted()?e.event.content:e.getContent())["m.relates_to"];return!(!t||!t["m.in_reply_to"])}isAttachment(e){const t=["m.sticker","m.image","m.file","m.video","m.audio"];return e.getType()===t[0]||t.includes(e.getContent().msgtype)}}},636:function(e,t,a){"use strict";(function(e){var n=a(120),i=a.n(n),s=a(129),r=a(133),o=a(138),l=a(164),c=a(121),d=a(123),m=a(893),u=a(162),h=a(124),p=a(128),g=a(178),v=a(249),b=a(281),f=a(404),y=a(122),E=a(221),_=a(156),w=a(307),S=a(297),O=a(896);t.a=()=>{var t;const a=Object(n.useContext)(r.a),{room:C,roomId:x}=Object(n.useContext)(o.b);if(!C||!x)throw new Error("Unable to create a NewRoomIntro without room and roomId");const j=C instanceof S.b,k=j?null===(t=C.targets[0])||void 0===t?void 0:t.userId:l.a.shared().getUserIdForRoomId(x);let R;if(k){const{shouldEncrypt:e}=Object(O.a)(C),t=((e,t)=>e instanceof S.b?Object(c.c)("Send your first message to invite <displayName/> to chat"):t?Object(c.c)("Once everyone has joined, you’ll be able to chat"):Object(c.c)("This is the beginning of your direct message history with <displayName/>."))(C,e);let a;C instanceof S.b||e||C.getJoinedMemberCount()+C.getInvitedMemberCount()!==2||(a=Object(c.a)("Only the two of you are in this conversation, unless either of you invites anyone to join."));const n=null==C?void 0:C.getMember(k),s=(null==C?void 0:C.name)||(null==n?void 0:n.rawDisplayName)||k;R=i.a.createElement(i.a.Fragment,null,i.a.createElement(u.a,{room:C,width:m.a,height:m.a,onClick:()=>{h.a.dispatch({action:p.a.ViewUser,member:n||{userId:k}})}}),i.a.createElement("h2",null,C.name),i.a.createElement("p",null,Object(c.a)(t,{},{displayName:()=>i.a.createElement("b",null,s)})),a&&i.a.createElement("p",null,a))}else{var I,T,N,P,D,M,A;const t=C&&"join"===C.getMyMembership(),n=null===(I=C.currentState.getStateEvents(s.b.RoomTopic,""))||void 0===I||null===(T=I.getContent())||void 0===T?void 0:T.topic,r=t&&C.currentState.maySendStateEvent(s.b.RoomTopic,a.getSafeUserId()),o=()=>{h.a.dispatch({action:"open_room_settings",room_id:x},!0),e((()=>{var e;null===(e=window.document.getElementById("profileTopic"))||void 0===e||e.focus()}))};let l;r&&n?l=Object(c.a)("Topic: %(topic)s (<a>edit</a>)",{topic:n},{a:e=>i.a.createElement(d.a,{kind:"link_inline",onClick:o},e)}):n?l=Object(c.a)("Topic: %(topic)s ",{topic:n}):r&&(l=Object(c.a)("<a>Add a topic</a> to help people know what it is about.",{},{a:e=>i.a.createElement(d.a,{kind:"link_inline",onClick:o},e)}));const p=null===(N=C.currentState.getStateEvents(s.b.RoomCreate,""))||void 0===N?void 0:N.getSender(),b=(null==C||null===(P=C.getMember(p))||void 0===P?void 0:P.rawDisplayName)||p;let f,y,w;f=p===a.getUserId()?Object(c.a)("You created this room."):Object(c.a)("%(displayName)s created this room.",{displayName:b}),null!==(D=g.a.instance.activeSpaceRoom)&&void 0!==D&&D.canInvite(a.getUserId())&&g.a.instance.isRoomInSpace(g.a.instance.activeSpace,C.roomId)&&(y=g.a.instance.activeSpaceRoom),y&&Object(E.a)(_.a.InviteUsers)?w=i.a.createElement("div",{className:"mx_NewRoomIntro_buttons"},i.a.createElement(d.a,{className:"mx_NewRoomIntro_inviteButton",kind:"primary",onClick:()=>{Object(v.i)(y)}},Object(c.a)("Invite to %(spaceName)s",{spaceName:y.name})),C.canInvite(a.getUserId())&&i.a.createElement(d.a,{className:"mx_NewRoomIntro_inviteButton",kind:"primary_outline",onClick:()=>{h.a.dispatch({action:"view_invite",roomId:x})}},Object(c.a)("Invite to just this room"))):C.canInvite(a.getUserId())&&Object(E.a)(_.a.InviteUsers)&&(w=i.a.createElement("div",{className:"mx_NewRoomIntro_buttons"},i.a.createElement(d.a,{className:"mx_NewRoomIntro_inviteButton",kind:"primary",onClick:()=>{h.a.dispatch({action:"view_invite",roomId:x})}},Object(c.a)("Invite to this room"))));const S=null===(M=C.currentState.getStateEvents(s.b.RoomAvatar,""))||void 0===M||null===(A=M.getContent())||void 0===A?void 0:A.url;let O=i.a.createElement(u.a,{room:C,width:m.a,height:m.a,viewAvatarOnClick:!!S});S||(O=i.a.createElement(m.b,{hasAvatar:!1,noAvatarLabel:Object(c.a)("Add a photo, so people can easily spot your room."),setAvatarUrl:e=>a.sendStateEvent(x,s.b.RoomAvatar,{url:e},"")},O)),R=i.a.createElement(i.a.Fragment,null,O,i.a.createElement("h2",null,C.name),i.a.createElement("p",null,f," ",Object(c.a)("This is the start of <roomName/>.",{},{roomName:()=>i.a.createElement("b",null,C.name)})),i.a.createElement("p",null,l),w)}const L=Object(c.a)("Your private messages are normally encrypted, but this room isn't. Usually this is due to an unsupported device or method being used, like email invites.");let U;C.currentState.mayClientSendStateEvent(s.b.RoomEncryption,y.a.get())&&!j&&(U=i.a.createElement(d.a,{kind:"link_inline",onClick:function(e){e.preventDefault(),h.a.dispatch({action:"open_room_settings",initial_tab_id:f.b})}},Object(c.a)("Enable encryption in settings.")));const F=i.a.createElement("span",null," ",L," ",U," ");return i.a.createElement("li",{className:"mx_NewRoomIntro"},!function(e,t){const a=e.isRoomEncrypted(t.roomId);return"public"===t.getJoinRule()||!Object(w.a)()||a}(a,C)&&i.a.createElement(b.a,{className:"mx_cryptoEvent mx_cryptoEvent_icon_warning",title:Object(c.a)("End-to-end encryption isn't enabled"),subtitle:F}),R)}}).call(this,a(54).setImmediate)},638:function(e,t,a){"use strict";a.d(t,"a",(function(){return h}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(903),l=a(131),c=a(121),d=a(279);const m={};for(const e of o.a)m[e.iso2]=e;function u(e,t){return"+"===e[0]&&(e=e.slice(1)),0==t.name.toUpperCase().indexOf(e.toUpperCase())||(t.iso2==e.toUpperCase()||-1!==t.prefix.indexOf(e))}class h extends r.a.Component{constructor(e){super(e),i()(this,"onSearchChange",(e=>{this.setState({searchQuery:e})})),i()(this,"onOptionChange",(e=>{this.props.onOptionChange(m[e])})),i()(this,"getShortOption",(e=>{if(!this.props.isSmall)return;let t;return this.props.showPrefix&&(t="+"+m[e].prefix),r.a.createElement("span",{className:"mx_CountryDropdown_shortOption"},this.flagImgForIso2(e),t)}));let t=o.a[0];const a=l.b.get("default_country_code");if(a){const e=o.a.find((e=>e.iso2===a.toUpperCase()));e&&(t=e)}this.state={searchQuery:"",defaultCountry:t}}componentDidMount(){this.props.value||this.props.onOptionChange(this.state.defaultCountry)}flagImgForIso2(e){return r.a.createElement("div",{className:"mx_Dropdown_option_emoji"},Object(o.b)(e))}render(){let e;if(this.state.searchQuery){if(e=o.a.filter(u.bind(this,this.state.searchQuery)),2==this.state.searchQuery.length&&m[this.state.searchQuery.toUpperCase()]){const t=m[this.state.searchQuery.toUpperCase()];e=e.filter((e=>e.iso2!=t.iso2)),e.unshift(t)}}else e=o.a;const t=e.map((e=>r.a.createElement("div",{className:"mx_CountryDropdown_option",key:e.iso2},this.flagImgForIso2(e.iso2),Object(c.a)(e.name)," (+",e.prefix,")"))),a=this.props.value||this.state.defaultCountry.iso2;return r.a.createElement(d.a,{id:"mx_CountryDropdown",className:this.props.className+" mx_CountryDropdown",onOptionChange:this.onOptionChange,onSearchChange:this.onSearchChange,menuWidth:298,getShortOption:this.getShortOption,value:a,searchEnabled:!0,disabled:this.props.disabled,label:Object(c.a)("Country Dropdown")},t)}}},639:function(e,t,a){"use strict";a.d(t,"a",(function(){return c}));var n=a(120),i=a.n(n),s=a(142),r=a(205),o=a(121);const l=e=>{let{name:t,last:a}=e;const n=s.g[t],r=s.a[t];return i.a.createElement(i.a.Fragment,null,i.a.createElement("kbd",null," ",n||r&&Object(o.a)(r)||t," "),!a&&"+")},c=e=>{let{value:t,className:a="mx_KeyboardShortcut"}=e;if(!t)return null;const n=[];return t.ctrlOrCmdKey?n.push(i.a.createElement(l,{key:"ctrlOrCmdKey",name:r.a?r.b.META:r.b.CONTROL})):t.ctrlKey?n.push(i.a.createElement(l,{key:"ctrlKey",name:r.b.CONTROL})):t.metaKey&&n.push(i.a.createElement(l,{key:"metaKey",name:r.b.META})),t.altKey&&n.push(i.a.createElement(l,{key:"altKey",name:r.b.ALT})),t.shiftKey&&n.push(i.a.createElement(l,{key:"shiftKey",name:r.b.SHIFT})),i.a.createElement("div",{className:a},n,i.a.createElement(l,{name:t.key,last:!0}))}},640:function(e,t,a){"use strict";var n=a(130),i=a.n(n),s=a(132),r=a.n(s),o=a(120),l=a.n(o),c=a(149),d=a(126),m=a.n(d),u=a(343),h=a(157),p=a(123),g=a(121),v=a(148),b=a(166),f=a(189);const y=["matrixClient","loginType","fragmentAfterLogin","idp","primary","mini","action","flow"],E=e=>{let t,{matrixClient:n,loginType:s,fragmentAfterLogin:o,idp:c,primary:d,mini:E,action:_,flow:w}=e,S=r()(e,y);t=c?Object(g.a)("Continue with %(provider)s",{provider:c.name}):u.a.findIn(w)?Object(g.a)("Continue"):Object(g.a)("Sign in with single sign-on");const O=()=>{var e,t;const a=(e=>{switch(e){case u.b.Apple:return"Apple";case u.b.Facebook:return"Facebook";case u.b.Github:return"GitHub";case u.b.Gitlab:return"GitLab";case u.b.Google:return"Google";default:return"SSO"}})(null!==(e=null==c?void 0:c.brand)&&void 0!==e?e:"");f.a.instance.setAuthenticationType(a),null===(t=h.a.get())||void 0===t||t.startSingleSignOn(n,s,o,null==c?void 0:c.id,_)};let C,x;const j=null!=c&&c.brand?(e=>{switch(e){case u.b.Apple:return a(1526).default;case u.b.Facebook:return a(1527).default;case u.b.Github:return a(1528).default;case u.b.Gitlab:return a(1529).default;case u.b.Google:return a(1530).default;case u.b.Twitter:return a(1531).default;default:return null}})(c.brand):null;if(null!=c&&c.brand&&j){const e=c.brand.split(".").pop();x=`mx_SSOButton_brand_${e}`,C=l.a.createElement("img",{src:j,height:"24",width:"24",alt:e})}else if("string"==typeof(null==c?void 0:c.icon)&&c.icon.startsWith("mxc://")){var k;const e=null!==(k=Object(b.b)(c.icon,n).getSquareThumbnailHttp(24))&&void 0!==k?k:void 0;C=l.a.createElement("img",{src:e,height:"24",width:"24",alt:c.name})}const R=x?{[x]:x}:void 0,I=m()("mx_SSOButton",{mx_SSOButton_mini:E,mx_SSOButton_default:!c,mx_SSOButton_primary:d},R);return E?l.a.createElement(v.a,i()({},S,{title:t,className:I,onClick:O}),C):l.a.createElement(p.a,i()({},S,{className:I,onClick:O}),C,t)};t.a=e=>{let{matrixClient:t,flow:a,loginType:n,fragmentAfterLogin:i,primary:s,action:r}=e;const o=a.identity_providers||[];if(o.length<2)return l.a.createElement("div",{className:"mx_SSOButtons"},l.a.createElement(E,{matrixClient:t,loginType:n,fragmentAfterLogin:i,idp:o[0],primary:s,action:r,flow:a}));const d=Math.ceil(o.length/6),m=Math.ceil(o.length/d);return l.a.createElement("div",{className:"mx_SSOButtons"},Object(c.chunk)(o,m).map((e=>l.a.createElement("div",{key:e[0].id,className:"mx_SSOButtons_row"},e.map((e=>l.a.createElement(E,{key:e.id,matrixClient:t,loginType:n,fragmentAfterLogin:i,idp:e,mini:!0,primary:s,action:r,flow:a})))))))}},649:function(e,t,a){"use strict";a.d(t,"b",(function(){return he})),a.d(t,"a",(function(){return pe}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(186),l=a.n(o),c=a(126),d=a.n(c),m=a(129),u=a(143),h=a(1),p=a(151),g=a(204),v=a(16),b=a(370),f=a(165),y=a(122),E=a(125),_=a(138),w=a(194),S=a(121),O=a(346),C=a(293);class x extends r.a.Component{constructor(e){super(e),i()(this,"onMouseDown",(e=>{this.setState({location:{currentX:e.clientX,currentY:e.clientY}}),document.addEventListener("mousemove",this.state.onMouseMove),document.addEventListener("mouseup",this.state.onMouseUp)})),i()(this,"onMouseUp",(e=>{document.removeEventListener("mousemove",this.state.onMouseMove),document.removeEventListener("mouseup",this.state.onMouseUp),this.props.onMouseUp(e)})),this.state={onMouseMove:this.onMouseMove.bind(this),onMouseUp:this.onMouseUp.bind(this),location:{currentX:0,currentY:0}}}onMouseMove(e){const t=this.props.dragFunc(this.state.location,e);this.setState({location:t})}render(){return r.a.createElement("div",{className:this.props.className,onMouseDown:this.onMouseDown})}}var j=a(137);class k extends r.a.Component{constructor(e){super(e),i()(this,"dragFunc",((e,t)=>{const a=t.clientX-e.currentX,n=this.state.width+a;return n<this.props.minWidth||n>this.props.maxWidth?e:(this.setState({width:n}),this.updateCSSWidth.bind(this)(n),{currentX:t.clientX,currentY:e.currentY})})),i()(this,"onMoueUp",(()=>{this.props.roomId&&E.b.setValue("ircDisplayNameWidth",this.props.roomId,j.a.ROOM_DEVICE,this.state.width)})),this.state={width:E.b.getValue("ircDisplayNameWidth",this.props.roomId),IRCLayoutRoot:null}}componentDidMount(){this.setState({IRCLayoutRoot:document.querySelector(".mx_IRCLayout")},(()=>this.updateCSSWidth(this.state.width)))}updateCSSWidth(e){this.state.IRCLayoutRoot.style.setProperty("--name-width",e+"px")}render(){return r.a.createElement(x,{className:"mx_ProfileResizer",dragFunc:this.dragFunc,onMouseUp:this.onMoueUp})}}var R=a(164),I=a(636),T=a(179),N=a(281);var P=()=>{var e;const{room:t}=Object(s.useContext)(_.b),a=t.getLiveTimeline().getState(T.b.BACKWARDS),n=a.getStateEvents("m.room.encryption")[0],i=null===(e=a.getStateEvents("m.room.history_visibility")[0])||void 0===e?void 0:e.getContent().history_visibility;let o;return"invited"==i?o=Object(S.a)("You don't have permission to view messages from before you were invited."):"joined"==i?o=Object(S.a)("You don't have permission to view messages from before you joined."):n&&(o=Object(S.a)("Encrypted messages before this point are unavailable.")),r.a.createElement(N.a,{className:"mx_HistoryTile",title:Object(S.a)("You can't see earlier messages"),subtitle:o})},D=a(124),M=a(140),A=a(184);function L(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const a=[],n=Object.keys(e.currentState.members);for(const i of n)e.currentState.members[i].typing&&-1===t.indexOf(i)&&a.push(e.currentState.members[i]);return a}var U=a(329),F=a(172);class B extends r.a.Component{constructor(){var e;super(...arguments),i()(this,"state",{usersTyping:(e=this.props.room,L(e,[y.a.get().getUserId()])),delayedStopTypingTimers:{}}),i()(this,"isVisible",(()=>B.isVisible(this.state))),i()(this,"onRoomTimeline",((e,t)=>{if((null==t?void 0:t.roomId)===this.props.room.roomId){const t=e.getSender(),a=this.state.usersTyping.filter((e=>e.userId!==t));a.length!==this.state.usersTyping.length&&this.setState({usersTyping:a}),this.abortUserTimer(t)}})),i()(this,"onRoomMemberTyping",(()=>{const e=function(e){return L(e,[y.a.get().getUserId()].concat(y.a.get().getIgnoredUsers()))}(this.props.room);this.setState({delayedStopTypingTimers:this.updateDelayedStopTypingTimers(e),usersTyping:e})}))}componentDidMount(){y.a.get().on(A.b.Typing,this.onRoomMemberTyping),y.a.get().on(M.d.Timeline,this.onRoomTimeline)}componentDidUpdate(e,t){const a=B.isVisible(t),n=B.isVisible(this.state);this.props.onShown&&!a&&n?this.props.onShown():this.props.onHidden&&a&&!n&&this.props.onHidden()}componentWillUnmount(){const e=y.a.get();e&&(e.removeListener(A.b.Typing,this.onRoomMemberTyping),e.removeListener(M.d.Timeline,this.onRoomTimeline)),Object.values(this.state.delayedStopTypingTimers).forEach((e=>e.abort()))}static isVisible(e){return 0!==e.usersTyping.length||0!==Object.keys(e.delayedStopTypingTimers).length}updateDelayedStopTypingTimers(e){const t=this.state.usersTyping.filter((t=>!e.some((e=>t.userId===e.userId)))),a=e.filter((e=>!this.state.usersTyping.some((t=>e.userId===t.userId))));a.forEach((e=>{const t=this.state.delayedStopTypingTimers[e.userId];t&&t.abort()}));let n=Object.assign({},this.state.delayedStopTypingTimers);return n=a.reduce(((e,t)=>(delete e[t.userId],e)),n),n=t.reduce(((e,t)=>{if(!e[t.userId]){const a=new U.a(5e3);e[t.userId]=a,a.start(),a.finished().then((()=>this.removeUserTimer(t.userId)),(()=>{}))}return e}),n),n}abortUserTimer(e){const t=this.state.delayedStopTypingTimers[e];t&&(t.abort(),this.removeUserTimer(e))}removeUserTimer(e){if(this.state.delayedStopTypingTimers[e]){const t=Object.assign({},this.state.delayedStopTypingTimers);delete t[e],this.setState({delayedStopTypingTimers:t})}}renderTypingIndicatorAvatars(e,t){let a=0;e.length>t&&(a=e.length-t+1,e=e.slice(0,t-1));const n=e.map((e=>r.a.createElement(F.b,{key:e.userId,member:e,width:24,height:24,resizeMethod:"crop",viewUserOnClick:!0,"aria-live":"off"})));return a>0&&n.push(r.a.createElement("span",{className:"mx_WhoIsTypingTile_remainingAvatarPlaceholder",key:"others"},"+",a)),n}render(){let e=this.state.usersTyping;const t=Object.keys(this.state.delayedStopTypingTimers).map((e=>this.props.room.getMember(e)));e=e.concat(t),e.sort(((e,t)=>Object(v.h)(e.name,t.name)));const a=function(e,t){let a=0;if(e.length>t&&(a=e.length-t+1),0===e.length)return"";if(1===e.length)return Object(S.a)("%(displayName)s is typing …",{displayName:e[0].name});const n=e.map((e=>e.name));if(a>=1)return Object(S.a)("%(names)s and %(count)s others are typing …",{names:n.slice(0,t-1).join(", "),count:a});{const e=n.pop();return Object(S.a)("%(names)s and %(lastPerson)s are typing …",{names:n.join(", "),lastPerson:e})}}(e,this.props.whoIsTypingLimit);return a?r.a.createElement("li",{className:"mx_WhoIsTypingTile","aria-atomic":"true"},r.a.createElement("div",{className:"mx_WhoIsTypingTile_avatars"},this.renderTypingIndicatorAvatars(e,this.props.whoIsTypingLimit)),r.a.createElement("div",{className:"mx_WhoIsTypingTile_label"},a)):null}}i()(B,"defaultProps",{whoIsTypingLimit:3});var V=a(380),W=a(149),H=a(397),z=a(123);var G=e=>{let{events:t,children:a,threshold:n=3,onToggle:i,startExpanded:o=!1,summaryMembers:l=[],summaryText:c,layout:d=w.a.Group,"data-testid":m}=e;const[u,p]=Object(H.a)(o);Object(s.useEffect)((()=>{i&&i()}),[u]);const g=t.map((e=>e.getId())).join(",");if(t.length<n)return r.a.createElement("li",{className:"mx_GenericEventListSummary","data-scroll-tokens":g,"data-expanded":!0,"data-layout":d},r.a.createElement("ol",{className:"mx_GenericEventListSummary_unstyledList"},a));let v;if(u)v=r.a.createElement(r.a.Fragment,null,r.a.createElement("div",{className:"mx_GenericEventListSummary_line"}," "),r.a.createElement("ol",{className:"mx_GenericEventListSummary_unstyledList"},a));else{const e=Object(W.uniqBy)(l.filter((e=>!(null==e||!e.getMxcAvatarUrl)||(h.a.error("EventListSummary given null summaryMember, termites may be afoot eating event senders",l),!1))),(e=>e.getMxcAvatarUrl())).map((e=>r.a.createElement(F.b,{key:e.userId,member:e,width:14,height:14})));v=r.a.createElement("div",{className:"mx_EventTile_line"},r.a.createElement("div",{className:"mx_EventTile_info"},r.a.createElement("span",{className:"mx_GenericEventListSummary_avatars",onClick:p},e),r.a.createElement("span",{className:"mx_TextualEvent mx_GenericEventListSummary_summary"},c)))}return r.a.createElement("li",{className:"mx_GenericEventListSummary","data-scroll-tokens":g,"data-expanded":u+"","data-layout":d,"data-testid":m},r.a.createElement(z.a,{kind:"link_inline",className:"mx_GenericEventListSummary_toggle",onClick:p,"aria-expanded":u},u?Object(S.a)("collapse"):Object(S.a)("expand")),v)},K=a(211),q=a(232),$=a(182),Y=a(740),J=a(173);const Q=()=>{J.a.instance.setCard({phase:$.a.PinnedMessages},!1)},X=[m.b.RoomMember];var Z;!function(e){e.Joined="joined",e.Left="left",e.JoinedAndLeft="joined_and_left",e.LeftAndJoined="left_and_joined",e.InviteReject="invite_reject",e.InviteWithdrawal="invite_withdrawal",e.Invited="invited",e.Banned="banned",e.Unbanned="unbanned",e.Kicked="kicked",e.ChangedName="changed_name",e.ChangedAvatar="changed_avatar",e.NoChange="no_change",e.ServerAcl="server_acl",e.ChangedPins="pinned_messages",e.MessageRemoved="message_removed",e.HiddenEvent="hidden_event"}(Z||(Z={}));class ee extends r.a.Component{constructor(){super(...arguments),i()(this,"context",void 0)}shouldComponentUpdate(e){return e.events.length!==this.props.events.length||e.events.length<this.props.threshold||e.layout!==this.props.layout}generateSummary(e,t){const a=t.map((t=>{const a=e[t],n=this.renderNameList(a),i=t.split(","),s=ee.getCanonicalTransitions(i),r=ee.coalesceRepeatedTransitions(s).map((e=>ee.getDescriptionForTransition(e.transitionType,a.length,e.repeats))),o=Object(K.b)(r);return Object(S.a)("%(nameList)s %(transitionList)s",{nameList:n,transitionList:o})}));return a?Object(Y.a)(a,", "):null}renderNameList(e){return Object(K.b)(e,this.props.summaryLength)}static getCanonicalTransitions(e){const t={[Z.Joined]:{after:Z.Left,newTransition:Z.JoinedAndLeft},[Z.Left]:{after:Z.Joined,newTransition:Z.LeftAndJoined}},a=[];for(let n=0;n<e.length;n++){const i=e[n],s=e[n+1];let r=i;n<e.length-1&&t[i]&&t[i].after===s&&(r=t[i].newTransition,n++),a.push(r)}return a}static coalesceRepeatedTransitions(e){const t=[];for(const a of e)t.length>0&&t[t.length-1].transitionType===a?t[t.length-1].repeats+=1:t.push({transitionType:a,repeats:1});return t}static getDescriptionForTransition(e,t,a){var n;let i;switch(e){case Z.Joined:i=t>1?Object(S.a)("%(severalUsers)sjoined %(count)s times",{severalUsers:"",count:a}):Object(S.a)("%(oneUser)sjoined %(count)s times",{oneUser:"",count:a});break;case Z.Left:i=t>1?Object(S.a)("%(severalUsers)sleft %(count)s times",{severalUsers:"",count:a}):Object(S.a)("%(oneUser)sleft %(count)s times",{oneUser:"",count:a});break;case Z.JoinedAndLeft:i=t>1?Object(S.a)("%(severalUsers)sjoined and left %(count)s times",{severalUsers:"",count:a}):Object(S.a)("%(oneUser)sjoined and left %(count)s times",{oneUser:"",count:a});break;case Z.LeftAndJoined:i=t>1?Object(S.a)("%(severalUsers)sleft and rejoined %(count)s times",{severalUsers:"",count:a}):Object(S.a)("%(oneUser)sleft and rejoined %(count)s times",{oneUser:"",count:a});break;case Z.InviteReject:i=t>1?Object(S.a)("%(severalUsers)srejected their invitations %(count)s times",{severalUsers:"",count:a}):Object(S.a)("%(oneUser)srejected their invitation %(count)s times",{oneUser:"",count:a});break;case Z.InviteWithdrawal:i=t>1?Object(S.a)("%(severalUsers)shad their invitations withdrawn %(count)s times",{severalUsers:"",count:a}):Object(S.a)("%(oneUser)shad their invitation withdrawn %(count)s times",{oneUser:"",count:a});break;case Z.Invited:i=t>1?Object(S.a)("were invited %(count)s times",{count:a}):Object(S.a)("was invited %(count)s times",{count:a});break;case Z.Banned:i=t>1?Object(S.a)("were banned %(count)s times",{count:a}):Object(S.a)("was banned %(count)s times",{count:a});break;case Z.Unbanned:i=t>1?Object(S.a)("were unbanned %(count)s times",{count:a}):Object(S.a)("was unbanned %(count)s times",{count:a});break;case Z.Kicked:i=t>1?Object(S.a)("were removed %(count)s times",{count:a}):Object(S.a)("was removed %(count)s times",{count:a});break;case Z.ChangedName:i=t>1?Object(S.a)("%(severalUsers)schanged their name %(count)s times",{severalUsers:"",count:a}):Object(S.a)("%(oneUser)schanged their name %(count)s times",{oneUser:"",count:a});break;case Z.ChangedAvatar:i=t>1?Object(S.a)("%(severalUsers)schanged their avatar %(count)s times",{severalUsers:"",count:a}):Object(S.a)("%(oneUser)schanged their avatar %(count)s times",{oneUser:"",count:a});break;case Z.NoChange:i=t>1?Object(S.a)("%(severalUsers)smade no changes %(count)s times",{severalUsers:"",count:a}):Object(S.a)("%(oneUser)smade no changes %(count)s times",{oneUser:"",count:a});break;case Z.ServerAcl:i=t>1?Object(S.a)("%(severalUsers)schanged the server ACLs %(count)s times",{severalUsers:"",count:a}):Object(S.a)("%(oneUser)schanged the server ACLs %(count)s times",{oneUser:"",count:a});break;case Z.ChangedPins:i=t>1?Object(S.a)("%(severalUsers)schanged the <a>pinned messages</a> for the room %(count)s times",{severalUsers:"",count:a},{a:e=>r.a.createElement(z.a,{kind:"link_inline",onClick:Q},e)}):Object(S.a)("%(oneUser)schanged the <a>pinned messages</a> for the room %(count)s times",{oneUser:"",count:a},{a:e=>r.a.createElement(z.a,{kind:"link_inline",onClick:Q},e)});break;case Z.MessageRemoved:i=t>1?Object(S.a)("%(severalUsers)sremoved a message %(count)s times",{severalUsers:"",count:a}):Object(S.a)("%(oneUser)sremoved a message %(count)s times",{oneUser:"",count:a});break;case Z.HiddenEvent:i=t>1?Object(S.a)("%(severalUsers)ssent %(count)s hidden messages",{severalUsers:"",count:a}):Object(S.a)("%(oneUser)ssent %(count)s hidden messages",{oneUser:"",count:a})}return null!==(n=i)&&void 0!==n?n:null}static getTransitionSequence(e){return e.map(ee.getTransition)}static getTransition(e){if(e.mxEvent.isRedacted())return Z.MessageRemoved;switch(e.mxEvent.getType()){case m.b.RoomThirdPartyInvite:return Object(q.c)(e.mxEvent)?Z.Invited:Z.InviteWithdrawal;case m.b.RoomServerAcl:return Z.ServerAcl;case m.b.RoomPinnedEvents:return Z.ChangedPins;case m.b.RoomMember:switch(e.mxEvent.getContent().membership){case"invite":return Z.Invited;case"ban":return Z.Banned;case"join":return"join"===e.mxEvent.getPrevContent().membership?e.mxEvent.getContent().displayname!==e.mxEvent.getPrevContent().displayname?Z.ChangedName:e.mxEvent.getContent().avatar_url!==e.mxEvent.getPrevContent().avatar_url?Z.ChangedAvatar:Z.NoChange:Z.Joined;case"leave":if(e.mxEvent.getSender()===e.mxEvent.getStateKey())return"invite"===e.mxEvent.getPrevContent().membership?Z.InviteReject:Z.Left;switch(e.mxEvent.getPrevContent().membership){case"invite":return Z.InviteWithdrawal;case"ban":return Z.Unbanned;default:return Z.Kicked}default:return null}default:return Z.HiddenEvent}}getAggregate(e){const t={},a={};return Object.keys(e).forEach((n=>{const i=e[n][0],s=i.displayName,r=ee.getTransitionSequence(e[n]).join(",");t[r]||(t[r]=[],a[r]=-1),t[r].push(s),(-1===a[r]||i.index<a[r])&&(a[r]=i.index)})),{names:t,indices:a}}render(){const e=this.props.events,t=new Map,a={};e.forEach(((e,n)=>{const i=e.getType();let s=e.getSender();if(i===m.b.RoomThirdPartyInvite)s=e.getContent().display_name;else if(i===m.b.RoomMember)s=e.getStateKey();else if(e.isRedacted()){var r,o;s=null===(r=e.getUnsigned())||void 0===r||null===(o=r.redacted_because)||void 0===o?void 0:o.sender}a[s]||(a[s]=[]);let l=s;if(e.isRedacted()){var c,d;const e=null===(c=this.context)||void 0===c||null===(d=c.room)||void 0===d?void 0:d.getMember(s);e&&(l=e.name,t.set(s,e))}else e.target&&X.includes(i)?(l=e.target.name,t.set(s,e.target)):e.sender&&i!==m.b.RoomThirdPartyInvite&&(l=e.sender.name,t.set(s,e.sender));a[s].push({mxEvent:e,displayName:l,index:n})}));const n=this.getAggregate(a),i=Object.keys(n.names).sort(((e,t)=>n.indices[e]-n.indices[t]));return r.a.createElement(G,{"data-testid":this.props["data-testid"],events:this.props.events,threshold:this.props.threshold,onToggle:this.props.onToggle,startExpanded:this.props.startExpanded,children:this.props.children,summaryMembers:[...t.values()],layout:this.props.layout,summaryText:this.generateSummary(n.names,i)})}}i()(ee,"contextType",_.b),i()(ee,"defaultProps",{summaryLength:1,threshold:3,avatarsMaxLength:5,layout:w.a.Group});var te=a(501),ae=a(401),ne=a(134),ie=a(128),se=a(622),re=a(238),oe=a(821),le=a(180),ce=a(192);const de=3e5,me=[m.b.Sticker,m.b.RoomMessage],ue=[m.b.RoomMember,m.b.RoomThirdPartyInvite,m.b.RoomServerAcl,m.b.RoomPinnedEvents];function he(e,t,a,n){return n!==_.a.ThreadsList&&(!(null==e||!e.sender||!t.sender)&&(!(t.getTs()-e.getTs()>de)&&(t.isRedacted()===e.isRedacted()&&(!!(t.getType()===e.getType()||me.includes(t.getType())&&me.includes(e.getType()))&&(t.sender.userId===e.sender.userId&&t.sender.name===e.sender.name&&t.sender.getMxcAvatarUrl()===e.sender.getMxcAvatarUrl()&&((!Object(le.i)(t)&&!Object(le.i)(e)||n===_.a.Thread)&&!!Object(re.c)(e,a)))))))}class pe extends r.a.Component{constructor(e,t){super(e,t),i()(this,"context",void 0),i()(this,"readReceiptMap",{}),i()(this,"readReceiptsByEvent",new Map),i()(this,"readReceiptsByUserId",new Map),i()(this,"_showHiddenEvents",void 0),i()(this,"isMounted",!1),i()(this,"readMarkerNode",Object(s.createRef)()),i()(this,"whoIsTyping",Object(s.createRef)()),i()(this,"scrollPanel",Object(s.createRef)()),i()(this,"showTypingNotificationsWatcherRef",void 0),i()(this,"eventTiles",{}),i()(this,"grouperKeyMap",new WeakMap),i()(this,"calculateRoomMembersCount",(()=>{this.setState({hideSender:this.shouldHideSender()})})),i()(this,"onShowTypingNotificationsChange",(()=>{this.setState({showTypingNotifications:E.b.getValue("showTypingNotifications")})})),i()(this,"isUnmounting",(()=>!this.isMounted)),i()(this,"collectGhostReadMarker",(e=>{e&&requestAnimationFrame((()=>{e.style.width="10%",e.style.opacity="0"}))})),i()(this,"onGhostTransitionEnd",(e=>{const t=e.target.dataset.eventid;this.setState({ghostReadMarkers:this.state.ghostReadMarkers.filter((e=>e!==t))})})),i()(this,"collectEventTile",((e,t)=>{this.eventTiles[e]=t})),i()(this,"onHeightChanged",(()=>{const e=this.scrollPanel.current;e&&e.checkScroll()})),i()(this,"onTypingShown",(()=>{const e=this.scrollPanel.current;e.checkScroll(),e&&e.getScrollState().stuckAtBottom&&e.preventShrinking()})),i()(this,"onTypingHidden",(()=>{const e=this.scrollPanel.current;e&&(e.updatePreventShrinking(),e.checkScroll())})),this.state={ghostReadMarkers:[],showTypingNotifications:E.b.getValue("showTypingNotifications"),hideSender:this.shouldHideSender()},this._showHiddenEvents=E.b.getValue("showHiddenEventsInTimeline"),this.showTypingNotificationsWatcherRef=E.b.watchSetting("showTypingNotifications",null,this.onShowTypingNotificationsChange)}componentDidMount(){var e;this.calculateRoomMembersCount(),null===(e=this.props.room)||void 0===e||e.currentState.on(p.b.Update,this.calculateRoomMembersCount),this.isMounted=!0}componentWillUnmount(){var e;this.isMounted=!1,null===(e=this.props.room)||void 0===e||e.currentState.off(p.b.Update,this.calculateRoomMembersCount),E.b.unwatchSetting(this.showTypingNotificationsWatcherRef)}componentDidUpdate(e,t){if(e.layout!==this.props.layout&&this.calculateRoomMembersCount(),e.readMarkerVisible&&this.props.readMarkerEventId!==e.readMarkerEventId){const t=this.state.ghostReadMarkers;t.push(e.readMarkerEventId),this.setState({ghostReadMarkers:t})}const a=this.pendingEditItem;if(!this.props.editState&&this.props.room&&a){const e=this.props.room.findEventById(a);D.a.dispatch({action:ie.a.EditEvent,event:null!=e&&e.isRedacted()?null:e,timelineRenderingType:this.context.timelineRenderingType})}}shouldHideSender(){var e;return(null===(e=this.props.room)||void 0===e?void 0:e.getInvitedAndJoinedMemberCount())<=2&&this.props.layout===w.a.Bubble}getNodeForEventId(e){var t,a;if(this.eventTiles)return null===(t=this.eventTiles[e])||void 0===t||null===(a=t.ref)||void 0===a?void 0:a.current}getTileForEventId(e){if(this.eventTiles&&e)return this.eventTiles[e]}isAtBottom(){var e;return null===(e=this.scrollPanel.current)||void 0===e?void 0:e.isAtBottom()}getScrollState(){var e,t;return null!==(e=null===(t=this.scrollPanel.current)||void 0===t?void 0:t.getScrollState())&&void 0!==e?e:null}getReadMarkerPosition(){const e=this.readMarkerNode.current,t=this.scrollPanel.current;if(!e||!t)return null;const a=l.a.findDOMNode(t).getBoundingClientRect(),n=e.getBoundingClientRect();return n.bottom+2<a.top?-1:n.top<a.bottom?0:1}scrollToTop(){var e;null===(e=this.scrollPanel.current)||void 0===e||e.scrollToTop()}scrollToBottom(){var e;null===(e=this.scrollPanel.current)||void 0===e||e.scrollToBottom()}handleScrollKey(e){var t;null===(t=this.scrollPanel.current)||void 0===t||t.handleScrollKey(e)}scrollToEvent(e,t,a){this.scrollPanel.current&&this.scrollPanel.current.scrollToToken(e,t,a)}scrollToEventIfNeeded(e){const t=this.getNodeForEventId(e);t&&t.scrollIntoView({block:"nearest",behavior:"instant"})}get showHiddenEvents(){var e,t;return null!==(e=null===(t=this.context)||void 0===t?void 0:t.showHiddenEvents)&&void 0!==e?e:this._showHiddenEvents}shouldShowEvent(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.props.hideThreadedMessages&&this.props.room){const{shouldLiveInRoom:t}=this.props.room.eventShouldLiveIn(e,this.props.events);if(!t)return!1}return!y.a.get().isUserIgnored(e.getSender())&&(!(!this.showHiddenEvents||t)||!!Object(re.c)(e,this.showHiddenEvents)&&(this.props.highlightedEventId===e.getId()||!Object(b.a)(e,this.context)))}readMarkerForEvent(e,t){const a=!t&&this.props.readMarkerVisible;if(this.props.readMarkerEventId===e){let t;return a&&(t=r.a.createElement("hr",{className:"mx_RoomView_myReadMarker",style:{opacity:1,width:"99%"}})),r.a.createElement("li",{key:"readMarker_"+e,ref:this.readMarkerNode,className:"mx_RoomView_myReadMarker_container","data-scroll-tokens":e},t)}if(this.state.ghostReadMarkers.includes(e)){const t=r.a.createElement("hr",{className:"mx_RoomView_myReadMarker",ref:this.collectGhostReadMarker,onTransitionEnd:this.onGhostTransitionEnd,"data-eventid":e});return r.a.createElement("li",{key:"_readuptoghost_"+e,className:"mx_RoomView_myReadMarker_container"},t)}return null}getNextEventInfo(e,t){return{nextEvent:t<e.length-1?e[t+1]:null,nextTile:e.slice(t+1).find((e=>this.shouldShowEvent(e)))}}get pendingEditItem(){if(this.props.room)try{return localStorage.getItem(Object(oe.a)(this.props.room.roomId,this.context.timelineRenderingType))}catch(e){return void h.a.error(e)}}getEventTiles(){let e,t,a=-1;for(e=this.props.events.length-1;e>=0;e--){const n=this.props.events[e];if(this.shouldShowEvent(n)&&(void 0===t&&(t=n),!n.status)){a=e;break}}const n=[];let i=null;this.readReceiptsByEvent=new Map,this.props.showReadReceipts&&(this.readReceiptsByEvent=this.getReadReceiptsByShownEvent());let s=null;for(e=0;e<this.props.events.length;e++){const r=this.props.events[e],o=r.getId(),l=r===t,{nextEvent:c,nextTile:d}=this.getNextEventInfo(this.props.events,e);if(s){if(s.shouldGroup(r)){s.add(r);continue}n.push(...s.getTiles()),i=s.getNewPrevEvent(),s=null}for(const e of fe)if(e.canStartGroup(this,r)&&!this.props.disableGrouping){s=new e(this,r,i,t,c,d);break}if(!s){this.shouldShowEvent(r)&&(n.push(...this.getTilesForEvent(i,r,l,!1,c,d)),i=r);const t=this.readMarkerForEvent(o,e>=a);t&&n.push(t)}}return s&&n.push(...s.getTiles()),n}getTilesForEvent(e,t){var a;let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4?arguments[4]:void 0,o=arguments.length>5?arguments[5]:void 0;const l=[],c=(null===(a=this.props.editState)||void 0===a?void 0:a.getEvent().getId())===t.getId();let d=t.getTs(),m=t.getDate();t.status&&(m=new Date,d=m.getTime());const h=this.wantsDateSeparator(e,m);if(h&&!i&&this.props.room){const e=r.a.createElement("li",{key:d},r.a.createElement(te.a,{key:d,roomId:this.props.room.roomId,ts:d}));l.push(e)}let p=!0;if(o){const e=o;p=this.wantsDateSeparator(t,e.getDate()||new Date)||t.getSender()!==e.getSender()||Object(se.a)(e,this.showHiddenEvents).isInfoMessage||!he(t,e,this.showHiddenEvents,this.context.timelineRenderingType)}const g=!h&&he(e,t,this.showHiddenEvents,this.context.timelineRenderingType),v=t.getId(),b=v===this.props.highlightedEventId,f=this.readReceiptsByEvent.get(v);let E=!1;const _=e=>!e||e===u.a.SENT,w=_(t.getAssociatedStatus()),S=s&&this.shouldShowEvent(s);(!S&&w||S&&w&&!_(s.getAssociatedStatus()))&&(E=!0),o&&o!==s&&_(o.getAssociatedStatus())&&(E=!1),E=E&&t.getSender()===y.a.get().getUserId();const C=this.props.callEventGroupers.get(t.getContent().call_id);return l.push(r.a.createElement(O.b,{key:t.getTxnId()||v,as:"li",ref:this.collectEventTile.bind(this,v),alwaysShowTimestamps:this.props.alwaysShowTimestamps,mxEvent:t,continuation:g,isRedacted:t.isRedacted(),replacingEventId:t.replacingEventId(),editState:c&&this.props.editState,onHeightChanged:this.onHeightChanged,readReceipts:f,readReceiptMap:this.readReceiptMap,showUrlPreview:this.props.showUrlPreview,checkUnmounting:this.isUnmounting,eventSendStatus:t.getAssociatedStatus(),isTwelveHour:this.props.isTwelveHour,permalinkCreator:this.props.permalinkCreator,last:n,lastInSection:p,lastSuccessful:E,isSelectedEvent:b,getRelationsForEvent:this.props.getRelationsForEvent,showReactions:this.props.showReactions,layout:this.props.layout,showReadReceipts:this.props.showReadReceipts,callEventGrouper:C,hideSender:this.state.hideSender})),l}wantsDateSeparator(e,t){return this.context.timelineRenderingType!==_.a.ThreadsList&&(null==e?!this.props.canBackPaginate:Object(f.o)(e.getDate()||void 0,t))}getReadReceiptsForEvent(e){const t=y.a.get().credentials.userId,{room:a}=this.props;if(!a)return null;const n=this.context.threadId?a.getThread(this.context.threadId):a,i=[];return n?(n.getReceiptsForEvent(e).forEach((e=>{if(!e.userId||!Object(v.w)(e.type)||e.userId===t)return;if(y.a.get().isUserIgnored(e.userId))return;const n=a.getMember(e.userId);i.push({userId:e.userId,roomMember:n,ts:e.data?e.data.ts:0})})),i):(h.a.debug("Discarding request, could not find the receiptDestination for event: "+this.context.threadId),i)}getReadReceiptsByShownEvent(){const e=new Map,t=new Map;let a;for(const n of this.props.events){if(this.shouldShowEvent(n)&&(a=n.getId()),!a)continue;const i=e.get(a)||[],s=this.getReadReceiptsForEvent(n);e.set(a,i.concat(s));for(const e of s)t[e.userId]={lastShownEventId:a,receipt:e}}for(const a of this.readReceiptsByUserId.keys()){if(t.get(a))continue;const{lastShownEventId:n,receipt:i}=this.readReceiptsByUserId.get(a),s=e.get(n)||[];e.set(n,s.concat(i)),t.set(a,{lastShownEventId:n,receipt:i})}this.readReceiptsByUserId=t;for(const t of e.values())t.sort(((e,t)=>t.ts-e.ts));return e}updateTimelineMinHeight(){const e=this.scrollPanel.current;if(e){const t=e.isAtBottom(),a=this.whoIsTyping.current,n=a&&a.isVisible();t&&n&&e.preventShrinking()}}onTimelineReset(){const e=this.scrollPanel.current;e&&e.clearPreventShrinking()}render(){let e,t;this.props.backPaginating&&(e=r.a.createElement("li",{key:"_topSpinner"},r.a.createElement(ne.a,null))),this.props.forwardPaginating&&(t=r.a.createElement("li",{key:"_bottomSpinner"},r.a.createElement(ne.a,null)));const a=this.props.hidden?{display:"none"}:{};let n;this.props.room&&this.state.showTypingNotifications&&this.context.timelineRenderingType===_.a.Room&&(n=r.a.createElement(B,{room:this.props.room,onShown:this.onTypingShown,onHidden:this.onTypingHidden,ref:this.whoIsTyping}));let i=null;this.props.layout==w.a.IRC&&(i=r.a.createElement(k,{minWidth:20,maxWidth:600,roomId:this.props.room?this.props.room.roomId:null}));const s=d()(this.props.className,{mx_MessagePanel_narrow:this.context.narrow});return r.a.createElement(ae.a,null,r.a.createElement(V.a,{ref:this.scrollPanel,className:s,onScroll:this.props.onScroll,onFillRequest:this.props.onFillRequest,onUnfillRequest:this.props.onUnfillRequest,style:a,stickyBottom:this.props.stickyBottom,resizeNotifier:this.props.resizeNotifier,fixedChildren:i},e,this.getEventTiles(),n,t))}}i()(pe,"contextType",_.b),i()(pe,"defaultProps",{disableGrouping:!1});class ge{constructor(e,t,a,n,s,r){this.panel=e,this.event=t,this.prevEvent=a,this.lastShownEvent=n,this.nextEvent=s,this.nextEventTile=r,i()(this,"events",[]),i()(this,"ejectedEvents",[]),i()(this,"readMarker",void 0),this.readMarker=e.readMarkerForEvent(t.getId(),t===n)}}i()(ge,"canStartGroup",((e,t)=>!0));class ve extends ge{shouldGroup(e){const t=this.panel,a=this.event;if(!t.shouldShowEvent(e))return!0;if(t.wantsDateSeparator(this.event,e.getDate()))return!1;if(e.getType()===m.b.RoomMember&&(e.getStateKey()!==a.getSender()||"join"!==e.getContent().membership))return!1;const n=e.getType();return!g.b.matches(n)&&(ce.g!==n&&!(!e.isState()||e.getSender()!==a.getSender()))}add(e){const t=this.panel;this.readMarker=this.readMarker||t.readMarkerForEvent(e.getId(),e===this.lastShownEvent),t.shouldShowEvent(e)&&(e.getType()===m.b.RoomEncryption?this.ejectedEvents.push(e):this.events.push(e))}getTiles(){if(!this.events||!this.events.length)return[];const e=this.panel,t=[],a=this.event,n=this.lastShownEvent;if(e.wantsDateSeparator(this.prevEvent,a.getDate())){const e=a.getTs();t.push(r.a.createElement("li",{key:e+"~"},r.a.createElement(te.a,{roomId:a.getRoomId(),ts:e})))}e.shouldShowEvent(a)&&t.push(...e.getTilesForEvent(a,a));for(const i of this.ejectedEvents)t.push(...e.getTilesForEvent(a,i,a===n,true));const i=this.events.map((t=>e.getTilesForEvent(t,t,t===n,true))).reduce(((e,t)=>e.concat(t)),[]),s=this.events[this.events.length-1];let o;const l=s.getRoomId(),c=s.sender?s.sender.name:s.getSender();return o=R.a.shared().getUserIdForRoomId(l)?Object(S.a)("%(creator)s created this DM.",{creator:c}):Object(S.a)("%(creator)s created and configured the room.",{creator:c}),t.push(r.a.createElement(I.a,{key:"newroomintro"})),t.push(r.a.createElement(G,{key:"roomcreationsummary",events:this.events,onToggle:e.onHeightChanged,summaryMembers:[s.sender],summaryText:o,layout:this.panel.props.layout},i)),this.readMarker&&t.push(this.readMarker),t}getNewPrevEvent(){return this.event}}i()(ve,"canStartGroup",(function(e,t){return t.getType()===m.b.RoomCreate}));class be extends ge{constructor(e,t,a,n,i,s){super(e,t,a,n,i,s),this.panel=e,this.event=t,this.prevEvent=a,this.lastShownEvent=n,this.events=[t]}shouldGroup(e){return!this.panel.shouldShowEvent(e)||!this.panel.wantsDateSeparator(this.events[0],e.getDate())&&(!(!e.isState()||!ue.includes(e.getType()))||(!!e.isRedacted()||!(!this.panel.showHiddenEvents||this.panel.shouldShowEvent(e,!0))))}add(e){(e.getType()!==m.b.RoomMember||Object(C.a)(e,this.panel.showHiddenEvents))&&(this.readMarker=this.readMarker||this.panel.readMarkerForEvent(e.getId(),e===this.lastShownEvent),(this.panel.showHiddenEvents||this.panel.shouldShowEvent(e))&&this.events.push(e))}generateKey(){return"eventlistsummary-"+this.events[0].getId()}getTiles(){var e;if(null===(e=this.events)||void 0===e||!e.length)return[];const t=this.panel,a=this.lastShownEvent,n=[];if(t.wantsDateSeparator(this.prevEvent,this.events[0].getDate())){const e=this.events[0].getTs();n.push(r.a.createElement("li",{key:e+"~"},r.a.createElement(te.a,{roomId:this.events[0].getRoomId(),ts:e})))}const i=this.events.find((e=>this.panel.grouperKeyMap.get(e))),s=i?this.panel.grouperKeyMap.get(i):this.generateKey();i||this.panel.grouperKeyMap.set(this.events[0],s);let o=!1,l=this.events.map(((e,n)=>(e.getId()===t.props.highlightedEventId&&(o=!0),t.getTilesForEvent(0===n?this.prevEvent:this.events[n-1],e,e===a,true,this.nextEvent,this.nextEventTile)))).reduce(((e,t)=>e.concat(t)),[]);return 0===l.length&&(l=null),this.panel.props.canBackPaginate||this.prevEvent||n.push(r.a.createElement(P,{key:"historytile"})),n.push(r.a.createElement(ee,{key:s,"data-testid":s,events:this.events,onToggle:t.onHeightChanged,startExpanded:o,layout:this.panel.props.layout},l)),this.readMarker&&n.push(this.readMarker),n}getNewPrevEvent(){return this.events[this.events.length-1]}}i()(be,"canStartGroup",(function(e,t){return!!e.shouldShowEvent(t)&&(!(!t.isState()||!ue.includes(t.getType()))||(!!t.isRedacted()||!(!e.showHiddenEvents||e.shouldShowEvent(t,!0))))}));const fe=[ve,be]},651:function(e,t,a){"use strict";a.d(t,"b",(function(){return b})),a.d(t,"c",(function(){return f})),a.d(t,"a",(function(){return y})),a.d(t,"d",(function(){return E}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(490),l=a(905),c=a(906),d=a(1),m=a(121),u=a(127),h=a(256);function p(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function g(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?p(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):p(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}var v=a(1519);let b,f,y;!function(e){e.Show="show"}(b||(b={})),function(e){e[e.Loading=0]="Loading",e[e.ShowingQR=1]="ShowingQR",e[e.Connecting=2]="Connecting",e[e.Connected=3]="Connected",e[e.WaitingForDevice=4]="WaitingForDevice",e[e.Verifying=5]="Verifying",e[e.Error=6]="Error"}(f||(f={})),function(e){e[e.Cancel=0]="Cancel",e[e.Decline=1]="Decline",e[e.Approve=2]="Approve",e[e.TryAgain=3]="TryAgain",e[e.Back=4]="Back"}(y||(y={}));class E extends r.a.Component{constructor(e){super(e),i()(this,"approveLogin",(async()=>{if(!this.state.rendezvous)throw new Error("Rendezvous not found");this.setState({phase:f.Loading});try{d.a.info("Requesting login token");const{login_token:a}=await(e=this.props.client.requestLoginToken,t={matrixClient:this.props.client,title:Object(m.a)("Sign in new device")},async function(){for(var a=arguments.length,n=new Array(a),i=0;i<a;i++)n[i]=arguments[i];return new Promise(((a,i)=>{const s=e.bind(t.matrixClient);s(void 0,...n).then((e=>a(e))).catch((e=>{var r;if(401!==e.httpStatus||null===(r=e.data)||void 0===r||!r.flows)return i(e);u.b.createDialog(h.a,g(g({},t),{},{authData:e.data,makeRequest:e=>s(e,...n),onFinished:(e,t)=>{e?a(t):i(t)}}))}))}))})();this.setState({phase:f.WaitingForDevice});if(!await this.state.rendezvous.approveLoginOnExistingDevice(a))return;if(!this.props.client.crypto)return void this.props.onFinished(!0);this.setState({phase:f.Verifying}),await this.state.rendezvous.verifyNewDeviceOnExistingDevice(),this.props.onFinished(!0)}catch(e){d.a.error("Error whilst approving sign in",e),this.setState({phase:f.Error,failureReason:o.c.Unknown})}var e,t})),i()(this,"generateCode",(async()=>{let e;try{const t=new l.a({onFailure:this.onFailure,client:this.props.client}),a=new c.a(t,void 0,this.onFailure);e=new o.a(a,this.props.client,this.onFailure),await e.generateCode(),this.setState({phase:f.ShowingQR,rendezvous:e,failureReason:void 0})}catch(e){return d.a.error("Error whilst generating QR code",e),void this.setState({phase:f.Error,failureReason:o.c.HomeserverLacksSupport})}try{const t=await e.startAfterShowingCode();this.setState({phase:f.Connected,confirmationDigits:t})}catch(e){d.a.error("Error whilst doing QR login",e),this.state.phase!==f.Error&&this.setState({phase:f.Error,failureReason:o.c.Unknown})}})),i()(this,"onFailure",(e=>{d.a.info(`Rendezvous failed: ${e}`),this.setState({phase:f.Error,failureReason:e})})),i()(this,"onClick",(async e=>{var t,a,n;switch(e){case y.Cancel:await(null===(t=this.state.rendezvous)||void 0===t?void 0:t.cancel(o.c.UserCancelled)),this.reset(),this.props.onFinished(!1);break;case y.Approve:await this.approveLogin();break;case y.Decline:await(null===(a=this.state.rendezvous)||void 0===a?void 0:a.declineLoginOnExistingDevice()),this.reset(),this.props.onFinished(!1);break;case y.TryAgain:this.reset(),await this.updateMode(this.props.mode);break;case y.Back:await(null===(n=this.state.rendezvous)||void 0===n?void 0:n.cancel(o.c.UserCancelled)),this.props.onFinished(!1)}})),this.state={phase:f.Loading}}componentDidMount(){this.updateMode(this.props.mode).then((()=>{}))}componentDidUpdate(e){e.mode!==this.props.mode&&this.updateMode(this.props.mode).then((()=>{}))}async updateMode(e){if(this.setState({phase:f.Loading}),this.state.rendezvous){const e=this.state.rendezvous;e.onFailure=void 0,await e.cancel(o.c.UserCancelled),this.setState({rendezvous:void 0})}e===b.Show&&await this.generateCode()}componentWillUnmount(){this.state.rendezvous&&(this.state.rendezvous.onFailure=void 0,this.state.rendezvous.cancel(o.c.UserCancelled).then((()=>{})))}reset(){this.setState({rendezvous:void 0,confirmationDigits:void 0,failureReason:void 0})}render(){var e;return r.a.createElement(v.a,{onClick:this.onClick,phase:this.state.phase,code:this.state.phase===f.ShowingQR?null===(e=this.state.rendezvous)||void 0===e?void 0:e.code:void 0,confirmationDigits:this.state.phase===f.Connected?this.state.confirmationDigits:void 0,failureReason:this.state.phase===f.Error?this.state.failureReason:void 0})}}},652:function(e,t,a){"use strict";var n=a(120),i=a.n(n),s=a(239),r=a(860),o=a(13),l=a.n(o),c=a(174),d=a(419),m=a(512),u=a(1),h=a(122),p=a(449);class g extends i.a.PureComponent{render(){return i.a.createElement(p.a,{data:[{data:this.props.qrCodeData.getBuffer(),mode:"byte"}],className:"mx_VerificationQRCode",width:196})}}var v=a(121),b=a(131),f=a(266),y=a(134),E=a(123),_=a(861);class w extends i.a.PureComponent{constructor(e){super(e),l()(this,"hasVerifier",void 0),l()(this,"onReciprocateYesClick",(()=>{this.setState({reciprocateButtonClicked:!0}),this.state.reciprocateQREvent.confirm()})),l()(this,"onReciprocateNoClick",(()=>{this.setState({reciprocateButtonClicked:!0}),this.state.reciprocateQREvent.cancel()})),l()(this,"startSAS",(async()=>{this.setState({emojiButtonClicked:!0});const e=this.props.request.beginKeyVerification(c.e.SAS);try{await e.verify()}catch(e){u.a.error(e)}})),l()(this,"onSasMatchesClick",(()=>{this.state.sasEvent.confirm()})),l()(this,"onSasMismatchesClick",(()=>{this.state.sasEvent.mismatch()})),l()(this,"updateVerifierState",(()=>{const{request:e}=this.props,t=e.verifier.sasEvent,a=e.verifier.reciprocateQREvent;e.verifier.off(m.b.ShowSas,this.updateVerifierState),e.verifier.off(d.b.ShowReciprocateQr,this.updateVerifierState),this.setState({sasEvent:t,reciprocateQREvent:a})})),l()(this,"onRequestChange",(async()=>{const{request:e}=this.props,t=this.hasVerifier;if(this.hasVerifier=!!e.verifier,!t&&this.hasVerifier){e.verifier.on(m.b.ShowSas,this.updateVerifierState),e.verifier.on(d.b.ShowReciprocateQr,this.updateVerifierState);try{await e.verifier.verify()}catch(e){u.a.error("error verify",e)}}})),this.state={},this.hasVerifier=!1}renderQRPhase(){const{member:e,request:t}=this.props,a=t.otherPartySupportsMethod(c.e.SAS),n=t.otherPartySupportsMethod(d.d),s=b.b.get().brand,r=a||n?null:i.a.createElement("p",null,Object(v.a)("The device you are trying to verify doesn't support scanning a QR code or emoji verification, which is what %(brand)s supports. Try with a different client.",{brand:s}));if("dialog"===this.props.layout){let e,s;n&&(e=i.a.createElement("div",{className:"mx_VerificationPanel_QRPhase_startOption"},i.a.createElement("p",null,Object(v.a)("Scan this unique code")),i.a.createElement(g,{qrCodeData:t.qrCodeData}))),a&&(s=i.a.createElement("div",{className:"mx_VerificationPanel_QRPhase_startOption"},i.a.createElement("p",null,Object(v.a)("Compare unique emoji")),i.a.createElement("span",{className:"mx_VerificationPanel_QRPhase_helpText"},Object(v.a)("Compare a unique set of emoji if you don't have a camera on either device")),i.a.createElement(E.a,{disabled:this.state.emojiButtonClicked,onClick:this.startSAS,kind:"primary"},Object(v.a)("Start"))));const o=e&&s?i.a.createElement("div",{className:"mx_VerificationPanel_QRPhase_betweenText"},Object(v.a)("%(qrCode)s or %(emojiCompare)s",{emojiCompare:"",qrCode:""})):null;return i.a.createElement("div",null,Object(v.a)("Verify this device by completing one of the following:"),i.a.createElement("div",{className:"mx_VerificationPanel_QRPhase_startOptions"},e,o,s,r))}let o,l;if(n&&(o=i.a.createElement("div",{className:"mx_UserInfo_container"},i.a.createElement("h3",null,Object(v.a)("Verify by scanning")),i.a.createElement("p",null,Object(v.a)("Ask %(displayName)s to scan your code:",{displayName:e.displayName||e.name||e.userId})),i.a.createElement("div",{className:"mx_VerificationPanel_qrCode"},i.a.createElement(g,{qrCodeData:t.qrCodeData})))),a){const e=this.state.emojiButtonClicked,t=n?Object(v.a)("If you can't scan the code above, verify by comparing unique emoji."):Object(v.a)("Verify by comparing unique emoji.");l=i.a.createElement("div",{className:"mx_UserInfo_container"},i.a.createElement("h3",null,Object(v.a)("Verify by emoji")),i.a.createElement("p",null,t),i.a.createElement(E.a,{disabled:e,kind:"primary",className:"mx_UserInfo_wideButton mx_VerificationPanel_verifyByEmojiButton",onClick:this.startSAS},Object(v.a)("Verify by emoji")))}const m=r?i.a.createElement("div",{className:"mx_UserInfo_container"},r):null;return i.a.createElement(i.a.Fragment,null,o,l,m)}getDevice(){const e=this.props.request&&this.props.request.channel.deviceId;return h.a.get().getStoredDevice(h.a.get().getUserId(),e)}renderQRReciprocatePhase(){const{member:e,request:t}=this.props,a=t.isSelfVerification?Object(v.a)("Almost there! Is your other device showing the same shield?"):Object(v.a)("Almost there! Is %(displayName)s showing the same shield?",{displayName:e.displayName||e.name||e.userId});let n;return n=this.state.reciprocateQREvent?i.a.createElement(i.a.Fragment,null,i.a.createElement("p",null,a),i.a.createElement(f.b,{isUser:!0,status:f.a.Verified,size:128,hideTooltip:!0}),i.a.createElement("div",{className:"mx_VerificationPanel_reciprocateButtons"},i.a.createElement(E.a,{kind:"danger",disabled:this.state.reciprocateButtonClicked,onClick:this.onReciprocateNoClick},Object(v.a)("No")),i.a.createElement(E.a,{kind:"primary",disabled:this.state.reciprocateButtonClicked,onClick:this.onReciprocateYesClick},Object(v.a)("Yes")))):i.a.createElement("p",null,i.a.createElement(y.a,null)),i.a.createElement("div",{className:"mx_UserInfo_container mx_VerificationPanel_reciprocate_section"},i.a.createElement("h3",null,Object(v.a)("Verify by scanning")),n)}renderVerifiedPhase(){const{member:e,request:t}=this.props;let a,n;if(t.isSelfVerification||(a=this.props.isRoomEncrypted?Object(v.a)("Verify all users in a room to ensure it's secure."):Object(v.a)("In encrypted rooms, verify all users to ensure it's secure.")),t.isSelfVerification){const e=this.getDevice();e?n=Object(v.a)("You've successfully verified %(deviceName)s (%(deviceId)s)!",{deviceName:e?e.getDisplayName():"",deviceId:this.props.request.channel.deviceId}):(u.a.warn("Verified device we don't know about: "+this.props.request.channel.deviceId),n=Object(v.a)("You've successfully verified your device!"))}else n=Object(v.a)("You've successfully verified %(displayName)s!",{displayName:e.displayName||e.name||e.userId});return i.a.createElement("div",{className:"mx_UserInfo_container mx_VerificationPanel_verified_section"},i.a.createElement("p",null,n),i.a.createElement(f.b,{isUser:!0,status:f.a.Verified,size:128,hideTooltip:!0}),a?i.a.createElement("p",null,a):null,i.a.createElement(E.a,{kind:"primary",className:"mx_UserInfo_wideButton",onClick:this.props.onClose},Object(v.a)("Got it")))}renderCancelledPhase(){const{member:e,request:t}=this.props;let a,n;return a=t.isSelfVerification?Object(v.a)("Start verification again from the notification."):Object(v.a)("Start verification again from their profile."),"m.timeout"===t.cancellationCode?n=Object(v.a)("Verification timed out.")+` ${a}`:t.cancellingUserId===t.otherUserId?(n=t.isSelfVerification?Object(v.a)("You cancelled verification on your other device."):Object(v.a)("%(displayName)s cancelled verification.",{displayName:e.displayName||e.name||e.userId}),n=`${n} ${a}`):n=Object(v.a)("You cancelled verification.")+` ${a}`,i.a.createElement("div",{className:"mx_UserInfo_container"},i.a.createElement("h3",null,Object(v.a)("Verification cancelled")),i.a.createElement("p",null,n),i.a.createElement(E.a,{kind:"primary",className:"mx_UserInfo_wideButton",onClick:this.props.onClose},Object(v.a)("Got it")))}render(){const{member:e,phase:t,request:a}=this.props,n=e.displayName||e.name||e.userId;switch(t){case s.g.Ready:return this.renderQRPhase();case s.g.Started:switch(a.chosenMethod){case c.e.RECIPROCATE_QR_CODE:return this.renderQRReciprocatePhase();case c.e.SAS:{const e=this.state.sasEvent?i.a.createElement(_.a,{displayName:n,device:this.getDevice(),sas:this.state.sasEvent.sas,onCancel:this.onSasMismatchesClick,onDone:this.onSasMatchesClick,inDialog:this.props.inDialog,isSelf:a.isSelfVerification}):i.a.createElement(y.a,null);return i.a.createElement("div",{className:"mx_UserInfo_container"},e)}default:return null}case s.g.Done:return this.renderVerifiedPhase();case s.g.Cancelled:return this.renderCancelledPhase()}return u.a.error("VerificationPanel unhandled phase:",t),null}componentDidMount(){const{request:e}=this.props;if(e.on(s.l.Change,this.onRequestChange),e.verifier){const t=e.verifier.sasEvent,a=e.verifier.reciprocateQREvent;this.setState({sasEvent:t,reciprocateQREvent:a})}this.onRequestChange()}componentWillUnmount(){const{request:e}=this.props;e.verifier&&(e.verifier.off(m.b.ShowSas,this.updateVerifierState),e.verifier.off(d.b.ShowReciprocateQr,this.updateVerifierState)),e.off(s.l.Change,this.onRequestChange)}}var S=a(219),O=a(141),C=a(127),x=a(182),j=a(173),k=a(144);const R=["m.key_mismatch","m.user_error","m.mismatched_sas"];t.a=e=>{const{verificationRequest:t,verificationRequestPromise:o,member:l,onClose:c,layout:d,isRoomEncrypted:m}=e,[u,p]=Object(n.useState)(t),[g,b]=Object(n.useState)(!1),[f,y]=Object(n.useState)(null==u?void 0:u.phase);Object(n.useEffect)((()=>{p(t),t&&(b(!1),y(t.phase))}),[t]),Object(n.useEffect)((()=>{o&&async function(){b(!0);const e=await o;b(!1),p(e),y(e.phase)}()}),[o]);const E=Object(n.useCallback)((()=>{u&&u.cancelled&&R.includes(u.cancellationCode)?C.b.createDialog(k.a,{headerImage:a(863).default,title:Object(v.a)("Your messages are not secure"),description:i.a.createElement("div",null,Object(v.a)("One of the following may be compromised:"),i.a.createElement("ul",null,i.a.createElement("li",null,Object(v.a)("Your homeserver")),i.a.createElement("li",null,Object(v.a)("The homeserver the user you're verifying is connected to")),i.a.createElement("li",null,Object(v.a)("Yours, or the other users' internet connection")),i.a.createElement("li",null,Object(v.a)("Yours, or the other users' session")))),onFinished:c}):u&&y(u.phase)}),[c,u]);Object(O.c)(u,s.l.Change,E);const _=Object(n.useCallback)((async()=>{b(!0);const e=h.a.get();let t;try{const a=await Object(S.c)(e,l.userId);t=await e.requestVerificationDM(l.userId,a)}catch(e){return console.error("Error starting verification",e),b(!1),void C.b.createDialog(k.a,{headerImage:a(620).default,title:Object(v.a)("Error starting verification"),description:Object(v.a)("We were unable to start a chat with the other user.")})}p(t),y(t.phase),j.a.instance.currentCard.phase!=x.a.EncryptionPanel&&j.a.instance.pushCard({phase:x.a.EncryptionPanel,state:{member:l,verificationRequest:t}}),j.a.instance.isOpen||j.a.instance.togglePanel(null)}),[l]),I=!u&&g||u&&(f===s.d||f===s.f||void 0===f),T=u?u.isSelfVerification:l.userId===h.a.get().getUserId();if(!u||I){const e=!u&&g||u&&u.initiatedByMe;return i.a.createElement(r.b,{isRoomEncrypted:m,onStartVerification:_,member:l,isSelfVerification:T,waitingForOtherParty:I&&e,waitingForNetwork:I&&!e,inDialog:"dialog"===d})}return i.a.createElement(w,{isRoomEncrypted:m,layout:d,onClose:c,member:l,request:u,key:u.channel.transactionId,inDialog:"dialog"===d,phase:f})}},657:function(e,t,a){"use strict";a.d(t,"a",(function(){return g}));var n=a(13),i=a.n(n),s=a(132),r=a.n(s),o=a(120),l=a.n(o),c=a(178),d=a(121),m=a(164);const u=["room","component"];function h(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function p(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?h(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):h(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function g(e){let{room:t,component:a}=e,n=r()(e,u);const i=function(e){const t=m.a.shared().getUserIdForRoomId(e.roomId),a=e.getMembers().length>2;if(!e.isSpaceRoom()&&t&&!a)return{details:t};const[n,i,...s]=c.a.instance.getKnownParents(e.roomId);if(i&&(null==s||!s.length)){var r,o;const t=null===(r=e.client.getRoom(n))||void 0===r?void 0:r.name,a=null===(o=e.client.getRoom(i))||void 0===o?void 0:o.name;return{details:Object(d.a)("%(space1Name)s and %(space2Name)s",{space1Name:t,space2Name:a}),ariaLabel:Object(d.a)("In spaces %(space1Name)s and %(space2Name)s.",{space1Name:t,space2Name:a})}}if(n){var l;const t=null===(l=e.client.getRoom(n))||void 0===l?void 0:l.name,a=s.length;return{details:Object(d.a)("%(spaceName)s and %(count)s others",{spaceName:t,count:a}),ariaLabel:Object(d.a)("In %(spaceName)s and %(count)s other spaces.",{spaceName:t,count:a})}}return{details:e.getCanonicalAlias()}}(t);return i?l.a.createElement(null!=a?a:"div",p(p({},n),{},{"aria-label":i.ariaLabel}),[i.details]):l.a.createElement(l.a.Fragment,null)}},658:function(e,t,a){"use strict";a.d(t,"a",(function(){return N})),a.d(t,"b",(function(){return P}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(1),l=a(136),c=a(325),d=a(903),m=a(127),u=a(121),h=a(131),p=a(880),g=a(200),v=a(479),b=a(345),f=a(139),y=a(135),E=a(145);var _=e=>{let{onFinished:t}=e;const[a,n]=Object(s.useState)(""),i=Object(s.useRef)(),r=async e=>{if(e.preventDefault(),a){if(!await i.current.validate({}))return i.current.focus(),void i.current.validate({focused:!0})}t(!0,a)};return s.createElement(y.a,{title:Object(u.a)("Continuing without email"),className:"mx_RegistrationEmailPromptDialog",contentId:"mx_RegistrationEmailPromptDialog",onFinished:()=>t(!1),fixedWidth:!1},s.createElement("div",{className:"mx_Dialog_content",id:"mx_RegistrationEmailPromptDialog"},s.createElement("p",null,Object(u.a)("Just a heads up, if you don't add an email and forget your password, you could <b>permanently lose access to your account</b>.",{},{b:e=>s.createElement("b",null,e)})),s.createElement("form",{onSubmit:r},s.createElement(v.a,{fieldRef:i,autoFocus:!0,label:Object(u.c)("Email (optional)"),value:a,onChange:e=>{const t=e.target;n(t.value)}}))),s.createElement(E.a,{primaryButton:Object(u.a)("Continue"),onPrimaryButtonClick:r,hasCancel:!1}))},w=a(638),S=a(904),O=a(189);let C,x,j,k,R;var I,T;!function(e){e.Email="field_email",e.PhoneNumber="field_phone_number",e.Username="field_username",e.Password="field_password",e.PasswordConfirm="field_password_confirm"}(I||(I={})),function(e){e[e.Unknown=0]="Unknown",e[e.Available=1]="Available",e[e.Unavailable=2]="Unavailable",e[e.Error=3]="Error",e[e.Invalid=4]="Invalid"}(T||(T={}));const N=3;C=I.Email,x=I.Password,j=I.PasswordConfirm,k=I.Username,R=I.PhoneNumber;class P extends r.a.PureComponent{constructor(e){super(e),i()(this,C,void 0),i()(this,x,void 0),i()(this,j,void 0),i()(this,k,void 0),i()(this,R,void 0),i()(this,"onSubmit",(async e=>{if(e.preventDefault(),e.persist(),!this.props.canSubmit)return;if(await this.verifyFieldsBeforeSubmit())if(""===this.state.email){if(!this.showEmail())return void this.doSubmit(e);m.b.createDialog(_,{onFinished:async(t,a)=>{t&&void 0!==a&&this.setState({email:a},(()=>{this.doSubmit(e)}))}})}else this.doSubmit(e)})),i()(this,"onEmailChange",(e=>{this.setState({email:e.target.value.trim()})})),i()(this,"onEmailValidate",(e=>{this.markFieldValid(I.Email,!!e.valid)})),i()(this,"validateEmailRules",Object(g.a)({description:()=>Object(u.a)("Use an email address to recover your account"),hideDescriptionIfValid:!0,rules:[{key:"required",test(e){let{value:t,allowEmpty:a}=e;return a||!this.authStepIsRequired("m.login.email.identity")||!!t},invalid:()=>Object(u.a)("Enter email address (required on this homeserver)")},{key:"email",test:e=>{let{value:t}=e;return!t||c.a(t)},invalid:()=>Object(u.a)("Doesn't look like a valid email address")}]})),i()(this,"onPasswordChange",(e=>{this.setState({password:e.target.value})})),i()(this,"onPasswordValidate",(e=>{this.markFieldValid(I.Password,!!e.valid)})),i()(this,"onPasswordConfirmChange",(e=>{this.setState({passwordConfirm:e.target.value})})),i()(this,"onPasswordConfirmValidate",(e=>{this.markFieldValid(I.PasswordConfirm,!!e.valid)})),i()(this,"onPhoneCountryChange",(e=>{this.setState({phoneCountry:e.iso2})})),i()(this,"onPhoneNumberChange",(e=>{this.setState({phoneNumber:e.target.value})})),i()(this,"onPhoneNumberValidate",(async e=>{const t=await this.validatePhoneNumberRules(e);return this.markFieldValid(I.PhoneNumber,!!t.valid),t})),i()(this,"validatePhoneNumberRules",Object(g.a)({description:()=>Object(u.a)("Other users can invite you to rooms using your contact details"),hideDescriptionIfValid:!0,rules:[{key:"required",test(e){let{value:t,allowEmpty:a}=e;return a||!this.authStepIsRequired("m.login.msisdn")||!!t},invalid:()=>Object(u.a)("Enter phone number (required on this homeserver)")},{key:"email",test:e=>{let{value:t}=e;return!t||Object(d.c)(t)},invalid:()=>Object(u.a)("That phone number doesn't look quite right, please check and try again")}]})),i()(this,"onUsernameChange",(e=>{this.setState({username:e.target.value})})),i()(this,"onUsernameValidate",(async e=>{const t=await this.validateUsernameRules(e);return this.markFieldValid(I.Username,!!t.valid),t})),i()(this,"validateUsernameRules",Object(g.a)({description:(e,t)=>t.every((e=>{let{key:t,valid:a}=e;return"available"===t||a}))?null:Object(u.a)("Use lowercase letters, numbers, dashes and underscores only"),hideDescriptionIfValid:!0,async deriveData(e){let{value:t}=e;if(!t)return T.Unknown;try{return await this.props.matrixClient.isUsernameAvailable(t)?T.Available:T.Unavailable}catch(e){return e instanceof l.MatrixError&&"M_INVALID_USERNAME"===e.errcode?T.Invalid:T.Error}},rules:[{key:"required",test:e=>{let{value:t,allowEmpty:a}=e;return a||!!t},invalid:()=>Object(u.a)("Enter username")},{key:"safeLocalpart",test:(e,t)=>{let{value:a}=e;return(!a||p.a.test(a))&&t!==T.Invalid},invalid:()=>Object(u.a)("Some characters not allowed")},{key:"available",final:!0,test:async(e,t)=>{let{value:a}=e;return!a||t===T.Available},invalid:e=>e===T.Error?Object(u.a)("Unable to check if username has been taken. Try again later."):Object(u.a)("Someone already has that username. Try another or if it is you, sign in below.")}]})),this.state={fieldValid:{},phoneCountry:this.props.defaultPhoneCountry,username:this.props.defaultUsername||"",email:this.props.defaultEmail||"",phoneNumber:this.props.defaultPhoneNumber||"",password:this.props.defaultPassword||"",passwordConfirm:this.props.defaultPassword||""}}doSubmit(e){O.a.instance.setAuthenticationType("Password");const t=this.state.email.trim(),a=this.props.onRegisterClick({username:this.state.username.trim(),password:this.state.password.trim(),email:t,phoneCountry:this.state.phoneCountry,phoneNumber:this.state.phoneNumber});a&&(e.target.disabled=!0,a.finally((function(){e.target.disabled=!1})))}async verifyFieldsBeforeSubmit(){const e=document.activeElement;e&&e.blur();const t=[I.Username,I.Password,I.PasswordConfirm,I.Email,I.PhoneNumber];for(const e of t){const t=this[e];t&&await t.validate({allowEmpty:!1})}if(await new Promise((e=>this.setState({},e))),this.allFieldsValid())return!0;const a=this.findFirstInvalidField(t);return!a||(a.focus(),a.validate({allowEmpty:!1,focused:!0}),!1)}allFieldsValid(){return Object.values(this.state.fieldValid).every(Boolean)}findFirstInvalidField(e){for(const t of e)if(!this.state.fieldValid[t]&&this[t])return this[t];return null}markFieldValid(e,t){const{fieldValid:a}=this.state;a[e]=t,this.setState({fieldValid:a})}authStepIsRequired(e){return this.props.flows.every((t=>t.stages.includes(e)))}authStepIsUsed(e){return this.props.flows.some((t=>t.stages.includes(e)))}showEmail(){return!!this.authStepIsUsed("m.login.email.identity")}showPhoneNumber(){return!(h.b.get().disable_3pid_login||!this.authStepIsUsed("m.login.msisdn"))}renderEmail(){if(!this.showEmail())return null;const e=this.authStepIsRequired("m.login.email.identity")?Object(u.c)("Email"):Object(u.c)("Email (optional)");return r.a.createElement(v.a,{fieldRef:e=>this[I.Email]=e,label:e,value:this.state.email,validationRules:this.validateEmailRules.bind(this),onChange:this.onEmailChange,onValidate:this.onEmailValidate})}renderPassword(){return r.a.createElement(b.a,{id:"mx_RegistrationForm_password",fieldRef:e=>this[I.Password]=e,minScore:N,value:this.state.password,onChange:this.onPasswordChange,onValidate:this.onPasswordValidate})}renderPasswordConfirm(){return r.a.createElement(S.a,{id:"mx_RegistrationForm_passwordConfirm",fieldRef:e=>this[I.PasswordConfirm]=e,autoComplete:"new-password",value:this.state.passwordConfirm,password:this.state.password,onChange:this.onPasswordConfirmChange,onValidate:this.onPasswordConfirmValidate})}renderPhoneNumber(){if(!this.showPhoneNumber())return null;const e=this.authStepIsRequired("m.login.msisdn")?Object(u.a)("Phone"):Object(u.a)("Phone (optional)"),t=r.a.createElement(w.a,{value:this.state.phoneCountry,isSmall:!0,showPrefix:!0,onOptionChange:this.onPhoneCountryChange});return r.a.createElement(f.a,{ref:e=>this[I.PhoneNumber]=e,type:"text",label:e,value:this.state.phoneNumber,prefixComponent:t,onChange:this.onPhoneNumberChange,onValidate:this.onPhoneNumberValidate})}renderUsername(){return r.a.createElement(f.a,{id:"mx_RegistrationForm_username",ref:e=>this[I.Username]=e,type:"text",autoFocus:!0,label:Object(u.a)("Username"),placeholder:Object(u.a)("Username").toLocaleLowerCase(),value:this.state.username,onChange:this.onUsernameChange,onValidate:this.onUsernameValidate})}render(){const e=r.a.createElement("input",{className:"mx_Login_submit",type:"submit",value:Object(u.a)("Register"),disabled:!this.props.canSubmit});let t;return this.showEmail()&&(t=this.showPhoneNumber()?r.a.createElement("div",null,Object(u.a)("Add an email to be able to reset your password.")," ",Object(u.a)("Use email or phone to optionally be discoverable by existing contacts.")):r.a.createElement("div",null,Object(u.a)("Add an email to be able to reset your password.")," ",Object(u.a)("Use email to optionally be discoverable by existing contacts."))),r.a.createElement("div",null,r.a.createElement("form",{onSubmit:this.onSubmit},r.a.createElement("div",{className:"mx_AuthBody_fieldRow"},this.renderUsername()),r.a.createElement("div",{className:"mx_AuthBody_fieldRow"},this.renderPassword(),this.renderPasswordConfirm()),r.a.createElement("div",{className:"mx_AuthBody_fieldRow"},this.renderEmail(),this.renderPhoneNumber()),t,e))}}i()(P,"defaultProps",{onValidationChange:o.a.error,canSubmit:!0})},859:function(e,t,a){"use strict";a.d(t,"a",(function(){return v}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(1),l=a(121),c=a(122),d=a(127),m=a(472),u=a(473),h=a(652),p=a(123),g=a(134);class v extends r.a.Component{constructor(e){super(e),i()(this,"onStoreUpdate",(()=>{const e=u.b.sharedInstance();e.phase!==u.a.Finished?this.setState({phase:e.phase,verificationRequest:e.verificationRequest,backupInfo:e.backupInfo,lostKeys:e.lostKeys()}):this.props.onFinished()})),i()(this,"onUsePassphraseClick",(async()=>{u.b.sharedInstance().usePassPhrase()})),i()(this,"onVerifyClick",(()=>{const e=c.a.get(),t=e.getUserId(),a=e.requestVerification(t);this.props.onFinished(),d.b.createDialog(m.a,{verificationRequestPromise:a,member:e.getUser(t),onFinished:async()=>{(await a).cancel(),this.props.onFinished()}})})),i()(this,"onSkipConfirmClick",(()=>{u.b.sharedInstance().skipConfirm()})),i()(this,"onSkipBackClick",(()=>{u.b.sharedInstance().returnAfterSkip()})),i()(this,"onResetClick",(e=>{e.preventDefault();u.b.sharedInstance().reset()})),i()(this,"onResetConfirmClick",(()=>{this.props.onFinished();u.b.sharedInstance().resetConfirm()})),i()(this,"onResetBackClick",(()=>{u.b.sharedInstance().returnAfterReset()})),i()(this,"onDoneClick",(()=>{u.b.sharedInstance().done()})),i()(this,"onEncryptionPanelClose",(()=>{this.props.onFinished()}));const t=u.b.sharedInstance();t.on("update",this.onStoreUpdate),t.start(),this.state={phase:t.phase,verificationRequest:t.verificationRequest,backupInfo:t.backupInfo,lostKeys:t.lostKeys()}}componentWillUnmount(){const e=u.b.sharedInstance();e.off("update",this.onStoreUpdate),e.stop()}render(){const{phase:e,lostKeys:t}=this.state;if(this.state.verificationRequest)return r.a.createElement(h.a,{layout:"dialog",verificationRequest:this.state.verificationRequest,onClose:this.onEncryptionPanelClose,member:c.a.get().getUser(this.state.verificationRequest.otherUserId),isRoomEncrypted:!1});if(e===u.a.Intro){if(t)return r.a.createElement("div",null,r.a.createElement("p",null,Object(l.a)("It looks like you don't have a Security Key or any other devices you can verify against. This device will not be able to access old encrypted messages. In order to verify your identity on this device, you'll need to reset your verification keys.")),r.a.createElement("div",{className:"mx_CompleteSecurity_actionRow"},r.a.createElement(p.a,{kind:"primary",onClick:this.onResetConfirmClick},Object(l.a)("Proceed with reset"))));{const e=u.b.sharedInstance();let t,n,i;return e.keyInfo&&(a=e.keyInfo,Boolean(a.passphrase&&a.passphrase.salt&&a.passphrase.iterations))?t=Object(l.a)("Verify with Security Key or Phrase"):e.keyInfo&&(t=Object(l.a)("Verify with Security Key")),t&&(n=r.a.createElement(p.a,{kind:"primary",onClick:this.onUsePassphraseClick},t)),e.hasDevicesToVerifyAgainst&&(i=r.a.createElement(p.a,{kind:"primary",onClick:this.onVerifyClick},Object(l.a)("Verify with another device"))),r.a.createElement("div",null,r.a.createElement("p",null,Object(l.a)("Verify your identity to access encrypted messages and prove your identity to others.")),r.a.createElement("div",{className:"mx_CompleteSecurity_actionRow"},i,n),r.a.createElement("div",{className:"mx_SetupEncryptionBody_reset"},Object(l.a)("Forgotten or lost all recovery methods? <a>Reset all</a>",null,{a:e=>r.a.createElement(p.a,{kind:"link_inline",className:"mx_SetupEncryptionBody_reset_link",onClick:this.onResetClick},e)})))}}if(e===u.a.Done){let e;return e=this.state.backupInfo?r.a.createElement("p",null,Object(l.a)("Your new device is now verified. It has access to your encrypted messages, and other users will see it as trusted.")):r.a.createElement("p",null,Object(l.a)("Your new device is now verified. Other users will see it as trusted.")),r.a.createElement("div",null,r.a.createElement("div",{className:"mx_CompleteSecurity_heroIcon mx_E2EIcon_verified"}),e,r.a.createElement("div",{className:"mx_CompleteSecurity_actionRow"},r.a.createElement(p.a,{kind:"primary",onClick:this.onDoneClick},Object(l.a)("Done"))))}return e===u.a.ConfirmSkip?r.a.createElement("div",null,r.a.createElement("p",null,Object(l.a)("Without verifying, you won't have access to all your messages and may appear as untrusted to others.")),r.a.createElement("div",{className:"mx_CompleteSecurity_actionRow"},r.a.createElement(p.a,{kind:"danger_outline",onClick:this.onSkipConfirmClick},Object(l.a)("I'll verify later")),r.a.createElement(p.a,{kind:"primary",onClick:this.onSkipBackClick},Object(l.a)("Go Back")))):e===u.a.ConfirmReset?r.a.createElement("div",null,r.a.createElement("p",null,Object(l.a)("Resetting your verification keys cannot be undone. After resetting, you won't have access to old encrypted messages, and any friends who have previously verified you will see security warnings until you re-verify with them.")),r.a.createElement("p",null,Object(l.a)("Please only proceed if you're sure you've lost all of your other devices and your Security Key.")),r.a.createElement("div",{className:"mx_CompleteSecurity_actionRow"},r.a.createElement(p.a,{kind:"danger_outline",onClick:this.onResetConfirmClick},Object(l.a)("Proceed with reset")),r.a.createElement(p.a,{kind:"primary",onClick:this.onResetBackClick},Object(l.a)("Go Back")))):e===u.a.Busy||e===u.a.Loading?r.a.createElement(g.a,null):void o.a.log(`SetupEncryptionBody: Unknown phase ${e}`);var a}}},860:function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(120),i=a.n(n),s=a(121),r=a(123),o=a(134);const l=e=>{let{text:t}=e;return i.a.createElement("div",{className:"mx_EncryptionInfo_spinner"},i.a.createElement(o.a,null),t)};t.b=e=>{let t,a,{waitingForOtherParty:n,waitingForNetwork:o,member:c,onStartVerification:d,isRoomEncrypted:m,inDialog:u,isSelfVerification:h}=e;if(n&&h)t=i.a.createElement("div",null,Object(s.a)("To proceed, please accept the verification request on your other device."));else if(n||o){let e;e=n?Object(s.a)("Waiting for %(displayName)s to accept…",{displayName:c.displayName||c.name||c.userId}):Object(s.a)("Accepting…"),t=i.a.createElement(l,{text:e})}else t=i.a.createElement(r.a,{kind:"primary",className:"mx_UserInfo_wideButton mx_UserInfo_startVerification",onClick:d},Object(s.a)("Start Verification"));return a=m?i.a.createElement("div",null,i.a.createElement("p",null,Object(s.a)("Messages in this room are end-to-end encrypted.")),i.a.createElement("p",null,Object(s.a)("Your messages are secured and only you and the recipient have the unique keys to unlock them."))):i.a.createElement("div",null,i.a.createElement("p",null,Object(s.a)("Messages in this room are not end-to-end encrypted.")),i.a.createElement("p",null,Object(s.a)("In encrypted rooms, your messages are secured and only you and the recipient have the unique keys to unlock them."))),u?t:i.a.createElement(i.a.Fragment,null,i.a.createElement("div",{"data-test-id":"encryption-info-description",className:"mx_UserInfo_container"},i.a.createElement("h3",null,Object(s.a)("Encryption")),a),i.a.createElement("div",{className:"mx_UserInfo_container"},i.a.createElement("h3",null,Object(s.a)("Verify User")),i.a.createElement("div",null,i.a.createElement("p",null,Object(s.a)("For extra security, verify this user by checking a one-time code on both of your devices.")),i.a.createElement("p",null,Object(s.a)("To be secure, do this in person or use a trusted way to communicate.")),t)))}},861:function(e,t,a){"use strict";a.d(t,"a",(function(){return m}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(121),l=a(860),c=a(123),d=a(862);class m extends r.a.Component{constructor(e){super(e),i()(this,"onMatchClick",(()=>{this.setState({pending:!0}),this.props.onDone()})),i()(this,"onDontMatchClick",(()=>{this.setState({cancelling:!0}),this.props.onCancel()})),this.state={pending:!1}}componentWillMount(){Object(d.a)()}render(){let e,t,a;if(this.props.sas.emoji){const a=this.props.sas.emoji.map(((e,t)=>{return r.a.createElement("div",{className:"mx_VerificationShowSas_emojiSas_block",key:t},r.a.createElement("div",{className:"mx_VerificationShowSas_emojiSas_emoji"},e[0]),r.a.createElement("div",{className:"mx_VerificationShowSas_emojiSas_label"},Object(o.a)((a=e[1]).charAt(0).toUpperCase()+a.slice(1))));var a}));e=r.a.createElement("div",{className:"mx_VerificationShowSas_emojiSas"},a.slice(0,4),r.a.createElement("div",{className:"mx_VerificationShowSas_emojiSas_break"}),a.slice(4)),t=this.props.isSelf?Object(o.a)("Confirm the emoji below are displayed on both devices, in the same order:"):Object(o.a)("Verify this user by confirming the following emoji appear on their screen.")}else{if(!this.props.sas.decimal)return r.a.createElement("div",null,Object(o.a)("Unable to find a supported verification method."),r.a.createElement(c.a,{kind:"primary",onClick:this.props.onCancel},Object(o.a)("Cancel")));{const a=this.props.sas.decimal.map(((e,t)=>r.a.createElement("span",{key:t},e)));e=r.a.createElement("div",{className:"mx_VerificationShowSas_decimalSas"},a),t=this.props.isSelf?Object(o.a)("Verify this device by confirming the following number appears on its screen."):Object(o.a)("Verify this user by confirming the following number appears on their screen.")}}if(this.state.pending&&this.props.isSelf){let e;e=this.props.device?Object(o.a)("Waiting for you to verify on your other device, %(deviceName)s (%(deviceId)s)…",{deviceName:this.props.device?this.props.device.getDisplayName():"",deviceId:this.props.device?this.props.device.deviceId:""}):Object(o.a)("Waiting for you to verify on your other device…"),a=r.a.createElement("p",null,e)}else if(this.state.pending||this.state.cancelling){let e;if(this.state.pending){const{displayName:t}=this.props;e=Object(o.a)("Waiting for %(displayName)s to verify…",{displayName:t})}else e=Object(o.a)("Cancelling…");a=r.a.createElement(l.a,{text:e})}else a=r.a.createElement("div",{className:"mx_VerificationShowSas_buttonRow"},r.a.createElement(c.a,{onClick:this.onDontMatchClick,kind:"danger"},Object(o.a)("They don't match")),r.a.createElement(c.a,{onClick:this.onMatchClick,kind:"primary"},Object(o.a)("They match")));return r.a.createElement("div",{className:"mx_VerificationShowSas"},r.a.createElement("p",null,t),e,r.a.createElement("p",null,this.props.isSelf?"":Object(o.a)("To be secure, do this in person or use a trusted way to communicate.")),a)}}Object(o.c)("Dog"),Object(o.c)("Cat"),Object(o.c)("Lion"),Object(o.c)("Horse"),Object(o.c)("Unicorn"),Object(o.c)("Pig"),Object(o.c)("Elephant"),Object(o.c)("Rabbit"),Object(o.c)("Panda"),Object(o.c)("Rooster"),Object(o.c)("Penguin"),Object(o.c)("Turtle"),Object(o.c)("Fish"),Object(o.c)("Octopus"),Object(o.c)("Butterfly"),Object(o.c)("Flower"),Object(o.c)("Tree"),Object(o.c)("Cactus"),Object(o.c)("Mushroom"),Object(o.c)("Globe"),Object(o.c)("Moon"),Object(o.c)("Cloud"),Object(o.c)("Fire"),Object(o.c)("Banana"),Object(o.c)("Apple"),Object(o.c)("Strawberry"),Object(o.c)("Corn"),Object(o.c)("Pizza"),Object(o.c)("Cake"),Object(o.c)("Heart"),Object(o.c)("Smiley"),Object(o.c)("Robot"),Object(o.c)("Hat"),Object(o.c)("Glasses"),Object(o.c)("Spanner"),Object(o.c)("Santa"),Object(o.c)("Thumbs up"),Object(o.c)("Umbrella"),Object(o.c)("Hourglass"),Object(o.c)("Clock"),Object(o.c)("Gift"),Object(o.c)("Light bulb"),Object(o.c)("Book"),Object(o.c)("Pencil"),Object(o.c)("Paperclip"),Object(o.c)("Scissors"),Object(o.c)("Lock"),Object(o.c)("Key"),Object(o.c)("Hammer"),Object(o.c)("Telephone"),Object(o.c)("Flag"),Object(o.c)("Train"),Object(o.c)("Bicycle"),Object(o.c)("Aeroplane"),Object(o.c)("Rocket"),Object(o.c)("Trophy"),Object(o.c)("Ball"),Object(o.c)("Guitar"),Object(o.c)("Trumpet"),Object(o.c)("Bell"),Object(o.c)("Anchor"),Object(o.c)("Headphones"),Object(o.c)("Folder"),Object(o.c)("Pin")},862:function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(1);async function i(){n.a.log("Checking for COLR support");const{userAgent:e}=navigator;if(e.includes("Firefox"))return n.a.log("Browser is Firefox - assuming COLR is supported"),!0;if(!e.includes("Chrome")&&e.includes("Safari"))return function(e){n.a.log("Browser is Safari - checking version for COLR support");try{const t=e.match(/Mac OS X ([\d|_]+).*Version\/([\d|.]+).*Safari/);if(t){const e=t[1],a=t[2],i=e.split("_").map((e=>parseInt(e,10))),s=a.split(".").map((e=>parseInt(e,10))),r=i[0]>=10&&i[1]>=14&&s[0]>=12;return n.a.log(`COLR support on Safari requires macOS 10.14 and Safari 12, detected Safari ${a} on macOS ${e}, COLR supported: ${r}`),r}}catch(e){n.a.error("Error in Safari COLR version check",e)}return n.a.warn("Couldn't determine Safari version to check COLR font support, assuming no."),!1}(e);try{const e=document.createElement("canvas"),t=e.getContext("2d"),a=new Image,i=`\n <svg xmlns="http://www.w3.org/2000/svg" width="20" height="100" style="background:#fff;fill:#000;">\n <style type="text/css">\n @font-face {\n font-family: "chromacheck-colr";\n src: url(data:application/x-font-woff;base64,${"d09GRgABAAAAAAKAAAwAAAAAAowAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABDT0xSAAACVAAAABYAAAAYAAIAJUNQQUwAAAJsAAAAEgAAABLJAAAQT1MvMgAAAYAAAAA6AAAAYBfxJ0pjbWFwAAABxAAAACcAAAAsAAzpM2dseWYAAAH0AAAAGgAAABoNIh0kaGVhZAAAARwAAAAvAAAANgxLumdoaGVhAAABTAAAABUAAAAkCAEEAmhtdHgAAAG8AAAABgAAAAYEAAAAbG9jYQAAAewAAAAGAAAABgANAABtYXhwAAABZAAAABsAAAAgAg4AHW5hbWUAAAIQAAAAOAAAAD4C5wsecG9zdAAAAkgAAAAMAAAAIAADAAB4AWNgZGAAYQ5+qdB4fpuvDNIsDCBwaQGTAIi+VlscBaJZGMDiHAxMIAoAtjIF/QB4AWNgZGBgYQACOAkUQQWMAAGRABAAAAB4AWNgZGBgYGJgAdMMUJILJMQgAWICAAH3AC4AeAFjYGFhYJzAwMrAwDST6QwDA0M/hGZ8zWDMyMmAChgFkDgKQMBw4CXDSwYWEBdIYgAFBgYA/8sIdAAABAAAAAAAAAB4AWNgYGBkYAZiBgYeBhYGBSDNAoRA/kuG//8hpDgjWJ4BAFVMBiYAAAAAAAANAAAAAQAAAAAEAAQAAAMAABEhESEEAPwABAD8AAAAeAEtxgUNgAAAAMHHIQTShTlOAty9/4bf7AARCwlBNhBw4L/43qXjYGUmf19TMuLcj/BJL3XfBg54AWNgZsALAAB9AAR4AWNgYGAEYj4gFgGygGwICQACOwAoAAAAAAABAAEAAQAAAA4AAAAAyP8AAA=="}) format("woff");\n }\n </style>\n <text x="0" y="0" font-size="20">\n <tspan font-family="chromacheck-colr" x="0" dy="20"></tspan>\n </text>\n </svg>`;e.width=20,e.height=100,a.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(i),n.a.log("Waiting for COLR SVG to load"),await new Promise((e=>a.onload=e)),n.a.log("Drawing canvas to detect COLR support"),t.drawImage(a,0,0);const s=200===t.getImageData(10,10,1,1).data[0];return n.a.log("Canvas check revealed COLR is supported? "+s),s}catch(e){return n.a.error("Couldn't load COLR font",e),!1}}let s=!1;async function r(){if(!s)if(s=!0,await i()){const e=`url('${a(1427)}')`;document.fonts.add(new FontFace("Twemoji",e,{})),document.fonts.add(new FontFace("Twemoji",e,{weight:"600"})),document.fonts.add(new FontFace("Twemoji",e,{weight:"700"}))}else{const e=`url('${a(1428)}')`;document.fonts.add(new FontFace("Twemoji",e,{})),document.fonts.add(new FontFace("Twemoji",e,{weight:"600"})),document.fonts.add(new FontFace("Twemoji",e,{weight:"700"}))}}},863:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return r}));var n,i=a(120);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},s.apply(this,arguments)}function r(e){return i.createElement("svg",s({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 18 18",role:"presentation","aria-hidden":!0},e),n||(n=i.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 9.27V3.05L9 1l7 2.05v6.22C16 15.63 9 17 9 17s-7-1.37-7-7.73zM8.92 4.4c-.57.04-.99.54-.94 1.11l.32 4c.03.35.3.62.65.65h.06c.37 0 .68-.28.71-.65l.32-4v-.16a1.06 1.06 0 00-1.12-.95zm.96 7.72a.88.88 0 11-1.76 0 .88.88 0 011.76 0z",fill:"#020202"})))}t.default="img/e2e/warning-deprecated.6a3ebca.svg"},864:function(e,t,a){"use strict";a.d(t,"a",(function(){return n}));const n=(e,t)=>{try{const a=t.getStoredCrossSigningForUser(t.getSafeUserId()),n=t.getStoredDevice(t.getSafeUserId(),e.device_id);return!(!a||!n)&&a.checkDeviceTrust(a,n,!1,!0).isCrossSigningVerified()}catch(e){return console.error("Error getting device cross-signing info",e),null}}},865:function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(120),i=a.n(n),s=a(866),r=a(621),o=a(165),l=a(121);const c=5184e5,d=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(new Date).getTime();if(e+c>=t){const t=new Date(e);return Object(o.a)(t)}return Object(o.k)(new Date(e))},m=e=>{let{value:t,id:a}=e;return t?i.a.createElement("span",{"data-testid":`device-metadata-${a}`},t):null},u=e=>{let{device:t}=e;const a=(e=>{if(Object(r.c)(e)&&e.last_seen_ts)return{id:"inactive",value:i.a.createElement(i.a.Fragment,null,i.a.createElement(s.a,{className:"mx_DeviceTile_inactiveIcon"}),Object(l.a)("Inactive for %(inactiveAgeDays)s+ days",{inactiveAgeDays:r.a})+` (${d(e.last_seen_ts)})`)}})(t),o=t.last_seen_ts&&`${Object(l.a)("Last activity")} ${d(t.last_seen_ts)}`,c=t.isVerified?Object(l.a)("Verified"):Object(l.a)("Unverified"),u=a?[a,{id:"lastSeenIp",value:t.last_seen_ip}]:[{id:"isVerified",value:c},{id:"lastActivity",value:o},{id:"lastSeenIp",value:t.last_seen_ip},{id:"deviceId",value:t.device_id}];return i.a.createElement(i.a.Fragment,null,u.map(((e,t)=>{let{id:a,value:s}=e;return s?i.a.createElement(n.Fragment,{key:a},!!t&&" · ",i.a.createElement(m,{id:a,value:s})):null})))}},866:function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n,i=a(120);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},s.apply(this,arguments)}function r(e){return i.createElement("svg",s({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 8 14",role:"presentation","aria-hidden":!0},e),n||(n=i.createElement("path",{d:"M1.333.333C.6.333 0 .933 0 1.666l.007 2.12c0 .354.14.687.386.94L2.667 7 .393 9.286a1.332 1.332 0 00-.386.94L0 12.333c0 .733.6 1.333 1.333 1.333h5.334c.733 0 1.333-.6 1.333-1.333v-2.107c0-.353-.14-.693-.387-.94L5.333 7l2.274-2.267C7.86 4.48 8 4.14 8 3.786v-2.12C8 .933 7.4.333 6.667.333H1.333zm5.334 9.94v1.393c0 .367-.3.667-.667.667H2a.669.669 0 01-.667-.667v-1.393c0-.18.074-.347.194-.473L4 7.333l2.473 2.473c.12.12.194.294.194.467z",fill:"currentColor"})))}},867:function(e,t,a){"use strict";a.d(t,"c",(function(){return s})),a.d(t,"b",(function(){return r})),a.d(t,"d",(function(){return o})),a.d(t,"a",(function(){return c}));const n="io.element.matrix_client_information.",i=e=>`${n}${e}`,s=async(e,t,a)=>{const n=e.getDeviceId(),{brand:s}=t,r=await a.getAppVersion(),o=i(n),l=(()=>{if(window.electron)return;const e=new URL(window.location.href);return[e.host,e.pathname.replace(/\/$/,"")].join("")})();await e.setAccountData(o,{name:s,version:r,url:l})},r=(e,t)=>{Array.from(t.store.accountData.values()).forEach((a=>{if(!a.getType().startsWith(n))return;const[,i]=a.getType().split(n);i&&!e.includes(i)&&t.deleteAccountData(a.getType())}))},o=async e=>{const t=e.getDeviceId(),a=i(t),n=c(e,t);(n.name||n.version||n.url)&&await e.deleteAccountData(a)},l=e=>e&&"string"==typeof e?e:void 0,c=(e,t)=>{const a=e.getAccountData(i(t));if(!a)return{};const{name:n,version:s,url:r}=a.getContent();return{name:l(n),version:l(s),url:l(r)}}},868:function(e,t,a){"use strict";(function(e){a.d(t,"a",(function(){return d}));var n=a(13),i=a.n(n),s=a(17),r=a.n(s),o=a(757);function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}const c="mx_threepid_invite_";class d extends r.a{static get instance(){return d._instance||(d._instance=new d),d._instance}storeInvite(e,t){const a=function(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?l(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):l(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}({roomId:e},t),n=this.generateIdOf(a);return localStorage.setItem(`${c}${n}`,JSON.stringify(a)),this.translateInvite(a)}getWireInvites(){const e=[];for(let t=0;t<localStorage.length;t++){const a=localStorage.key(t);null!=a&&a.startsWith(c)&&e.push(JSON.parse(localStorage.getItem(a)))}return e}getInvites(){return this.getWireInvites().map((e=>this.translateInvite(e)))}pickBestInvite(){return this.getInvites()[0]}resolveInvite(e){localStorage.removeItem(`${c}${e.id}`)}generateIdOf(t){return o.base32.stringify(e.from(JSON.stringify(t)))}translateInvite(e){return{id:this.generateIdOf(e),roomId:e.roomId,toEmail:e.email,signUrl:e.signurl,roomName:e.room_name,roomAvatarUrl:e.room_avatar_url,inviterName:e.inviter_name}}translateToWireFormat(e){return{email:e.toEmail,signurl:e.signUrl,room_name:e.roomName,room_avatar_url:e.roomAvatarUrl,inviter_name:e.inviterName}}}i()(d,"_instance",void 0)}).call(this,a(53).Buffer)},869:function(e,t,a){"use strict";a.d(t,"a",(function(){return l}));var n=a(120),i=a.n(n),s=a(129),r=a(870),o=a(739);function l(e){var t;let{mxEvent:a,onClick:n,withTooltip:l}=e;const c=Object(o.a)({userId:a.getSender(),member:a.sender});return a.getContent().msgtype!==s.e.Emote?i.a.createElement(r.a,{fallbackName:null!==(t=a.getSender())&&void 0!==t?t:"",onClick:n,member:c,colored:!0,emphasizeDisplayName:!0,withTooltip:l}):null}},870:function(e,t,a){"use strict";a.d(t,"a",(function(){return d}));var n=a(120),i=a.n(n),s=a(126),r=a.n(s),o=a(121),l=a(211),c=a(260);class d extends i.a.Component{render(){const{fallbackName:e,member:t,colored:a,emphasizeDisplayName:n,withTooltip:s,onClick:d}=this.props,m=(null==t?void 0:t.rawDisplayName)||e,u=null==t?void 0:t.userId;let h,p,g;if(a&&(h=Object(l.f)(e)),u){var v,b;const e=null!==(v=null===(b=c.a.getDisplayUserIdentifier)||void 0===b?void 0:b.call(c.a,u,{withDisplayName:!0,roomId:t.roomId}))&&void 0!==v?v:u;null!=t&&t.disambiguate&&(p=i.a.createElement("span",{className:"mx_DisambiguatedProfile_mxid"},e)),g=Object(o.a)("%(displayName)s (%(matrixId)s)",{displayName:m,matrixId:e})}const f=r()(h,{mx_DisambiguatedProfile_displayName:n});return i.a.createElement("div",{className:"mx_DisambiguatedProfile",title:s?g:void 0,onClick:d},i.a.createElement("span",{className:f,dir:"auto"},m),p)}}},871:function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n,i=a(120);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},s.apply(this,arguments)}function r(e){return i.createElement("svg",s({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",role:"presentation","aria-hidden":!0},e),n||(n=i.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20 1a1 1 0 00-1 1v2h-2a1 1 0 100 2h2v2a1 1 0 102 0V6h2a1 1 0 100-2h-2V2a1 1 0 00-1-1zM7 9.5C7 8.67 7.67 8 8.5 8s1.5.67 1.5 1.5S9.33 11 8.5 11 7 10.33 7 9.5zm8.5 1.5c.83 0 1.5-.67 1.5-1.5S16.33 8 15.5 8 14 8.67 14 9.5s.67 1.5 1.5 1.5zM12 17.5c2.33 0 4.31-1.46 5.11-3.5H6.89c.8 2.04 2.78 3.5 5.11 3.5zM4 12a8 8 0 019.774-7.803 1 1 0 10.442-1.95A10.03 10.03 0 0012 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10c0-.212-.007-.423-.02-.632a1 1 0 10-1.996.125A8 8 0 114 12z",fill:"currentColor"})))}},872:function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n,i,s=a(120);function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},r.apply(this,arguments)}function o(e){return s.createElement("svg",r({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 18 18",role:"presentation","aria-hidden":!0},e),n||(n=s.createElement("path",{d:"M10.066 14.25h1.57c1.858 0 3.364-1.567 3.364-3.5s-1.506-3.5-3.364-3.5H4.534",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round"})),i||(i=s.createElement("path",{d:"M6.524 3.75L3 7.286l3.524 3.535",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})))}},873:function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var n=a(13),i=a.n(n),s=a(189);class r{constructor(e,t){this.failedEventId=e,this.errorCode=t,i()(this,"ts",void 0),this.ts=Date.now()}}class o{constructor(e,t){if(this.fn=e,this.errorCodeMapFn=t,i()(this,"failures",new Map),i()(this,"visibleEvents",new Set),i()(this,"visibleFailures",new Map),i()(this,"failureCounts",{}),i()(this,"trackedEvents",new Set),i()(this,"checkInterval",null),i()(this,"trackInterval",null),!e||"function"!=typeof e)throw new Error("DecryptionFailureTracker requires tracking function");if("function"!=typeof t)throw new Error("DecryptionFailureTracker second constructor argument should be a function")}static get instance(){return o.internalInstance}eventDecrypted(e,t){"m.megolm.v1.aes-sha2"==e.getWireContent().algorithm&&(t?this.addDecryptionFailure(new r(e.getId(),t.code)):this.removeDecryptionFailuresForEvent(e))}addVisibleEvent(e){const t=e.getId();this.trackedEvents.has(t)||(this.visibleEvents.add(t),this.failures.has(t)&&!this.visibleFailures.has(t)&&this.visibleFailures.set(t,this.failures.get(t)))}addDecryptionFailure(e){const t=e.failedEventId;this.trackedEvents.has(t)||(this.failures.set(t,e),this.visibleEvents.has(t)&&!this.visibleFailures.has(t)&&this.visibleFailures.set(t,e))}removeDecryptionFailuresForEvent(e){const t=e.getId();this.failures.delete(t),this.visibleFailures.delete(t)}start(){this.checkInterval=window.setInterval((()=>this.checkFailures(Date.now())),o.CHECK_INTERVAL_MS),this.trackInterval=window.setInterval((()=>this.trackFailures()),o.TRACK_INTERVAL_MS)}stop(){this.checkInterval&&clearInterval(this.checkInterval),this.trackInterval&&clearInterval(this.trackInterval),this.failures=new Map,this.visibleEvents=new Set,this.visibleFailures=new Map,this.failureCounts={}}checkFailures(e){const t=new Set,a=new Map;for(const[n,i]of this.visibleFailures)e>i.ts+o.GRACE_PERIOD_MS?(t.add(i),this.trackedEvents.add(n)):a.set(n,i);this.visibleFailures=a,this.aggregateFailures(t)}aggregateFailures(e){for(const t of e){const e=t.errorCode;this.failureCounts[e]=(this.failureCounts[e]||0)+1}}trackFailures(){for(const e of Object.keys(this.failureCounts))if(this.failureCounts[e]>0){const t=this.errorCodeMapFn(e);this.fn(this.failureCounts[e],t,e),this.failureCounts[e]=0}}}i()(o,"internalInstance",new o(((e,t,a)=>{for(let n=0;n<e;n++)s.a.instance.trackEvent({eventName:"Error",domain:"E2EE",name:t,context:`mxc_crypto_error_type_${a}`})}),(e=>{switch(e){case"MEGOLM_UNKNOWN_INBOUND_SESSION_ID":return"OlmKeysNotSentError";case"OLM_UNKNOWN_MESSAGE_INDEX":return"OlmIndexError";case void 0:return"OlmUnspecifiedError";default:return"UnknownError"}}))),i()(o,"TRACK_INTERVAL_MS",6e4),i()(o,"CHECK_INTERVAL_MS",5e3),i()(o,"GRACE_PERIOD_MS",4e3)},874:function(e,t,a){"use strict";a.d(t,"a",(function(){return d}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(15),l=a(121);const c=new o.c("busy","org.matrix.msc3026.busy");class d extends r.a.Component{getDuration(e){if(!e)return;const t=Math.round(e/1e3),a=t%60,n=Math.round(t/60)%60,i=Math.round(t/3600)%24,s=Math.round(t/86400);return t<60?t<0?Object(l.a)("%(duration)ss",{duration:0}):Object(l.a)("%(duration)ss",{duration:a}):t<3600?Object(l.a)("%(duration)sm",{duration:n}):t<86400?Object(l.a)("%(duration)sh",{duration:i}):Object(l.a)("%(duration)sd",{duration:s})}getPrettyPresence(e,t,a){if(c.matches(e))return Object(l.a)("Busy");if(!a&&void 0!==t&&t>0){const a=this.getDuration(t);return"online"===e?Object(l.a)("Online for %(duration)s",{duration:a}):"unavailable"===e?Object(l.a)("Idle for %(duration)s",{duration:a}):"offline"===e?Object(l.a)("Offline for %(duration)s",{duration:a}):Object(l.a)("Unknown for %(duration)s",{duration:a})}return"online"===e?Object(l.a)("Online"):"unavailable"===e?Object(l.a)("Idle"):"offline"===e?Object(l.a)("Offline"):Object(l.a)("Unknown")}render(){return r.a.createElement("div",{className:"mx_PresenceLabel"},this.getPrettyPresence(this.props.presenceState,this.props.activeAgo,this.props.currentlyActive))}}i()(d,"defaultProps",{activeAgo:-1})},875:function(e,t,a){"use strict";a.r(t),a.d(t,"Icon",(function(){return r}));var n,i=a(120);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},s.apply(this,arguments)}function r(e){return i.createElement("svg",s({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",role:"presentation","aria-hidden":!0},e),n||(n=i.createElement("g",{fill:"none",fillRule:"evenodd"},i.createElement("path",{fill:"#ECECEC",d:"M0 0h24v24H0z"}),i.createElement("path",{d:"M7.338 13.154c.504 0 .826-.378.826-.882 0-.518-.322-.882-.826-.882-.49 0-.826.364-.826.882-.014.504.336.882.826.882zm4.662 0c.504 0 .84-.378.84-.882-.014-.518-.336-.882-.826-.882-.49 0-.84.364-.84.882-.014.504.336.882.826.882zm4.662 0c.518 0 .84-.378.84-.882 0-.518-.336-.882-.826-.882-.49 0-.84.364-.84.882 0 .504.336.882.826.882z",fill:"#454545"}))))}t.default="img/ellipsis.429f53e.svg"},876:function(e,t,a){"use strict";var n=a(120),i=a.n(n),s=a(177);t.a=e=>{let{value:t,label:a,byline:n,disabled:r,onChange:o}=e;return i.a.createElement("label",{className:"mx_LabelledCheckbox"},i.a.createElement(s.b,{disabled:r,checked:t,onChange:e=>o(e.target.checked)}),i.a.createElement("div",{className:"mx_LabelledCheckbox_labels"},i.a.createElement("span",{className:"mx_LabelledCheckbox_label"},a),n?i.a.createElement("span",{className:"mx_LabelledCheckbox_byline"},n):null))}},877:function(e,t,a){"use strict";function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var i=a(253),s=function(){function e(e,t){var a=this;n(this,"_dispatcher",void 0),n(this,"_dispatchToken",void 0),this._dispatcher=function(e){e&&e.length||i(!1);var t=e[0].getDispatcher();0;return t}(e);var s=e.map((function(e){return e.getDispatchToken()}));this._dispatchToken=this._dispatcher.register((function(e){a._dispatcher.waitFor(s),t()}))}return e.prototype.release=function(){this._dispatcher.unregister(this._dispatchToken)},e}();e.exports=s},878:function(e,t,a){"use strict";function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var i=a(1446).EventEmitter,s=a(253),r=function(){function e(e){var t=this;n(this,"_dispatchToken",void 0),n(this,"__changed",void 0),n(this,"__changeEvent",void 0),n(this,"__className",void 0),n(this,"__dispatcher",void 0),n(this,"__emitter",void 0),this.__className=this.constructor.name,this.__changed=!1,this.__changeEvent="change",this.__dispatcher=e,this.__emitter=new i,this._dispatchToken=e.register((function(e){t.__invokeOnDispatch(e)}))}var t=e.prototype;return t.addListener=function(e){return this.__emitter.addListener(this.__changeEvent,e)},t.getDispatcher=function(){return this.__dispatcher},t.getDispatchToken=function(){return this._dispatchToken},t.hasChanged=function(){return this.__dispatcher.isDispatching()||s(!1),this.__changed},t.__emitChange=function(){this.__dispatcher.isDispatching()||s(!1),this.__changed=!0},t.__invokeOnDispatch=function(e){this.__changed=!1,this.__onDispatch(e),this.__changed&&this.__emitter.emit(this.__changeEvent)},t.__onDispatch=function(e){s(!1)},e}();e.exports=r},879:function(e,t,a){"use strict";var n=function(e){var t,a;function n(t,a,n){var i;return(i=e.call(this,t)||this).listener=a,i.context=n,i}return a=e,(t=n).prototype=Object.create(a.prototype),t.prototype.constructor=t,t.__proto__=a,n}(a(1448));e.exports=n},880:function(e,t,a){"use strict";a.d(t,"a",(function(){return d})),a.d(t,"b",(function(){return m}));var n=a(120),i=a.n(n),s=a(124),r=a(127),o=a(121),l=a(155),c=a(128);const d=/^[a-z0-9=_\-./]+$/;async function m(e){void 0===e&&(e={});const t=r.b.createDialog(l.a,{hasCancelButton:!0,quitOnly:!0,title:Object(o.a)("Sign In or Create Account"),description:Object(o.a)("Use your account or create a new one to continue."),button:Object(o.a)("Create Account"),extraButtons:[i.a.createElement("button",{key:"start_login",onClick:()=>{t.close(),s.a.dispatch({action:"start_login",screenAfterLogin:e.screen_after})}},Object(o.a)("Sign In"))],onFinished:t=>{t?s.a.dispatch({action:"start_registration",screenAfterLogin:e.screen_after}):e.go_home_on_cancel?s.a.dispatch({action:c.a.ViewHomePage}):e.go_welcome_on_cancel&&s.a.dispatch({action:"view_welcome_page"})}})}},881:function(e,t,a){"use strict";(function(e){a.d(t,"a",(function(){return be}));var n=a(130),i=a.n(n),s=a(126),r=a.n(s),o=a(149),l=a(136),c=a(16),d=a(120),m=a.n(d),u=a(439),h=a.n(u),p=a(142),g=a(169),v=a(166),b=a(128),f=a(124),y=a(1454),E=a(1455),_=a(1456),w=a(1457),S=a(1458),O=a(1459),C=a(152),x=a(121),j=a(122),k=a(127),R=a(189),I=a(389),T=a(232),N=a(137),P=a(125),D=a(476),M=a(220),A=a(435),L=a(154),U=a(208),F=a(178),B=a(405),V=a(164),W=a(168),H=a(694),z=a(228),G=a(191),K=a(317),q=a(844),$=a(1563),Y=a(123),J=a(876),Q=a(134),X=a(246),Z=a(135),ee=a(628),te=a(1460),ae=a(1461),ne=a(1462),ie=a(657),se=a(1463),re=a(217),oe=a(462),le=a(162),ce=a(167),de=a(146);const me=10,ue=50,he=24;function pe(e){var t,a;return!0===(null===(t=e.current)||void 0===t||null===(a=t.id)||void 0===a?void 0:a.startsWith("mx_SpotlightDialog_button_recentlyViewed_"))}function ge(e,t){const a=new Set;return e&&a.add(null),t&&a.add(l.RoomType.Space),a}var ve;let be;function fe(e){switch(e){case be.People:return Object(x.a)("People");case be.PublicRooms:return Object(x.a)("Public rooms")}}!function(e){e[e.People=0]="People",e[e.Rooms=1]="Rooms",e[e.Spaces=2]="Spaces",e[e.Suggestions=3]="Suggestions",e[e.PublicRooms=4]="PublicRooms"}(ve||(ve={})),function(e){e[e.People=0]="People",e[e.PublicRooms=1]="PublicRooms"}(be||(be={}));const ye=e=>!(null==e||!e.room),Ee=e=>!(null==e||!e.publicRoom),_e=e=>!(null==e||!e.member),we=e=>{var t,a,n,i,s;return{publicRoom:e,section:ve.PublicRooms,filter:[be.PublicRooms],query:Object(de.n)([e.room_id.toLowerCase(),null===(t=e.canonical_alias)||void 0===t?void 0:t.toLowerCase(),null===(a=e.name)||void 0===a?void 0:a.toLowerCase(),h()(null!==(n=null===(i=e.topic)||void 0===i?void 0:i.toLowerCase())&&void 0!==n?n:"",{allowedTags:[]}),...(null===(s=e.aliases)||void 0===s?void 0:s.map((e=>e.toLowerCase())))||[]])}},Se=e=>{const t=j.a.get().getUserId();if(V.a.shared().getUserIdForRoomId(e.roomId)){const a=e.getMembers().filter((e=>e.userId!==t)),n=[...a.map((e=>e.name.toLowerCase())),...a.map((e=>e.userId.toLowerCase()))].filter(Boolean);return{room:e,section:ve.People,filter:[be.People],query:n}}return e.isSpaceRoom()?{room:e,section:ve.Spaces,filter:[]}:{room:e,section:ve.Rooms,filter:[]}},Oe=e=>({member:e,section:ve.Suggestions,filter:[be.People],query:[e.userId.toLowerCase(),e.name.toLowerCase()].filter(Boolean)}),Ce=new A.a,xe=(e,t)=>e.getVisibleRooms(t).filter((e=>!Object(re.a)(e)&&("join"===e.getMyMembership()||"invite"==e.getMyMembership()))),je=function(e,t){let a=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return Object.values(xe(e,t).filter((e=>!a||!V.a.shared().getUserIdForRoomId(e.roomId))).reduce(((e,t)=>{for(const a of t.getJoinedMembers())e[a.userId]=a;return e}),{})).filter((t=>t.userId!==e.getUserId()))},ke=(e,t)=>t.hasMentions?Object(x.a)("%(count)s unread messages including mentions.",{count:t.count}):t.hasUnreadCount?Object(x.a)("%(count)s unread messages.",{count:t.count}):t.isUnread?Object(x.a)("Unread messages."):void 0,Re=t=>{var a,n;let{initialText:s="",initialFilter:u=null,onFinished:h}=t;const A=Object(d.useRef)(),re=Object(d.useRef)(),de=j.a.get(),Re=Object(d.useContext)(g.c),[Ie,Te]=Object(d.useState)(s),[Ne,Pe]=Object(E.a)(),[De,Me]=Object(d.useState)(u),Ae=Object(d.useCallback)((e=>{var t,a,n;Me(e),null===(t=A.current)||void 0===t||t.focus(),null===(a=re.current)||void 0===a||null===(n=a.scrollTo)||void 0===n||n.call(a,{top:0})}),[]),Le=Object(d.useMemo)((()=>{const e=Object(H.a)(de),t=Object(H.b)(de);return Object(H.c)(e,t)}),[de]),Ue=Object(ce.a)("feature_dynamic_room_predecessors"),Fe=Object(W.i)(de.getUserId()),[Be,Ve]=Object(d.useState)(!1),We=Object(d.useMemo)((()=>Ie.trim()),[Ie]),He=Object(ce.a)("feature_exploring_public_spaces"),{loading:ze,publicRooms:Ge,protocols:Ke,config:qe,setConfig:$e,search:Ye}=Object(w.a)(),[Je,Qe]=Object(d.useState)(!0),[Xe,Ze]=Object(d.useState)(!1),{loading:et,users:tt,search:at}=Object(O.a)(),{loading:nt,profile:it,search:st}=Object(_.a)(),rt=Object(d.useMemo)((()=>[{query:We,roomTypes:ge(Je,Xe),limit:ue}]),[We,Je,Xe]);Object(y.a)(De===be.PublicRooms,Ye,rt),Object(y.a)(De===be.People,at,rt),Object(y.a)(De===be.People,st,rt);const ot=Object(d.useMemo)((()=>{const e=[],t=xe(de,Ue).map(Se),a=t.reduce(((e,t)=>{const a=V.a.shared().getUserIdForRoomId(t.room.roomId);return a?(t.room.getJoinedMemberCount()>2||e.add(a),e):e}),new Set);for(const t of[...je(de,Ue),...tt])a.has(t.userId)||(a.add(t.userId),e.push(Oe(t)));return[...F.a.instance.enabledMetaSpaces.map((e=>({section:ve.Spaces,filter:[],avatar:m.a.createElement("div",{className:r()("mx_SpotlightDialog_metaspaceResult",`mx_SpotlightDialog_metaspaceResult_${e}`)}),name:Object(U.g)(e,F.a.instance.allRoomsInHome),onClick(){F.a.instance.setActiveSpace(e)}}))),...t,...e,...(it&&!a.has(it.user_id)?[new B.a(it)]:[]).map(Oe),...Ge.map(we)].filter((e=>null===De||e.filter.includes(De)))}),[de,tt,it,Ge,De,Ue]),lt=Object(d.useMemo)((()=>{const e={[ve.People]:[],[ve.Rooms]:[],[ve.Spaces]:[],[ve.Suggestions]:[],[ve.PublicRooms]:[]};if(We){const t=We.toLowerCase(),a=Object(c.B)(We);ot.forEach((n=>{var i,s,r;if(ye(n)){if(!(null!==(i=n.room.normalizedName)&&void 0!==i&&i.includes(a)||null!==(s=n.room.getCanonicalAlias())&&void 0!==s&&s.toLowerCase().includes(t)||null!==(r=n.query)&&void 0!==r&&r.some((e=>e.includes(t)))))return}else if(_e(n)){var o;if(null===(o=n.query)||void 0===o||!o.some((e=>e.includes(t))))return}else if(Ee(n)){var l;if(null===(l=n.query)||void 0===l||!l.some((e=>e.includes(t))))return}else{var c;if(!(n.name.toLowerCase().includes(t)||null!==(c=n.query)&&void 0!==c&&c.some((e=>e.includes(t)))))return}e[n.section].push(n)}))}else De===be.PublicRooms?ot.forEach((t=>{Ee(t)&&e[t.section].push(t)})):De===be.People&&ot.forEach((t=>{_e(t)&&e[t.section].push(t)}));const t=de.getUserId();for(const a of Object.values(e))a.sort(((e,a)=>ye(e)||ye(a)?ye(a)&&ye(e)?Ce.getLastTs(a.room,t)-Ce.getLastTs(e.room,t):-1:_e(e)||_e(a)?_e(a)&&_e(e)?Le(e.member,a.member):-1:void 0));return e}),[We,De,de,ot,Le]);((e,t,a)=>{Object(d.useEffect)((()=>{if(!t)return;const n=window.setTimeout((()=>{R.a.instance.trackEvent({eventName:"WebSearch",viaSpotlight:a,numResults:e,queryLength:t})}),1e3);return()=>{clearTimeout(n)}}),[e,t,a])})(Object(o.sum)(Object.values(lt).map((e=>e.length))),Ie.length,!0);const ct=F.a.instance.activeSpaceRoom,[dt,mt]=Object(S.a)(null!=ct?ct:void 0,Ie);Object(d.useEffect)((()=>{e((()=>{var e,t,a;let n;Re.state.refs&&(n=Re.state.refs[0]),Re.dispatch({type:g.f.SetFocus,payload:{ref:n}}),null===(e=n)||void 0===e||null===(t=e.current)||void 0===t||null===(a=t.scrollIntoView)||void 0===a||a.call(t,{block:"nearest"})}))}),[lt,De]);const ut=function(e){let t=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){const t=new Set(P.b.getValue("SpotlightSearch.recentSearches",null).reverse());t.delete(e.roomId),t.add(e.roomId),P.b.setValue("SpotlightSearch.recentSearches",null,N.a.ACCOUNT,Array.from(t).reverse().slice(0,me))}f.a.dispatch({action:b.a.ViewRoom,metricsTrigger:"WebUnifiedSearch",metricsViaKeyboard:t,room_id:e.roomId,room_alias:e.roomAlias,auto_join:e.autoJoin,should_peek:e.shouldPeek}),h()};let ht,pt;if((We||De!==be.PublicRooms)&&(ht=m.a.createElement("div",{className:"mx_SpotlightDialog_section mx_SpotlightDialog_otherSearches",role:"group","aria-labelledby":"mx_SpotlightDialog_section_otherSearches"},m.a.createElement("h4",{id:"mx_SpotlightDialog_section_otherSearches"},We?Object(x.a)('Use "%(query)s" to search',{query:Ie}):Object(x.a)("Search for")),m.a.createElement("div",null,De!==be.PublicRooms&&m.a.createElement(te.a,{id:"mx_SpotlightDialog_button_explorePublicRooms",className:"mx_SpotlightDialog_explorePublicRooms",onClick:()=>Ae(be.PublicRooms)},fe(be.PublicRooms)),De!==be.People&&m.a.createElement(te.a,{id:"mx_SpotlightDialog_button_startChat",className:"mx_SpotlightDialog_startChat",onClick:()=>Ae(be.People)},fe(be.People))))),We||null!==De){const e=e=>{if(ye(e)){const t=M.a.instance.getRoomState(e.room),a=ke(e.room,t),n={"aria-label":a?`${e.room.name} ${a}`:e.room.name,"aria-describedby":`mx_SpotlightDialog_button_result_${e.room.roomId}_details`};return m.a.createElement(te.a,i()({id:`mx_SpotlightDialog_button_result_${e.room.roomId}`,key:`${ve[e.section]}-${e.room.roomId}`,onClick:t=>{ut({roomId:e.room.roomId},!0,"click"!==(null==t?void 0:t.type))},endAdornment:m.a.createElement(ne.a,{room:e.room})},n),m.a.createElement(K.a,{room:e.room,avatarSize:he,tooltipProps:{tabIndex:-1}}),e.room.name,m.a.createElement(X.a,{notification:t}),m.a.createElement(ie.a,{id:`mx_SpotlightDialog_button_result_${e.room.roomId}_details`,className:"mx_SpotlightDialog_result_details",room:e.room}))}if(_e(e))return m.a.createElement(te.a,{id:`mx_SpotlightDialog_button_result_${e.member.userId}`,key:`${ve[e.section]}-${e.member.userId}`,onClick:()=>{Object(B.e)(de,[e.member]),h()},"aria-label":e.member instanceof l.RoomMember?e.member.rawDisplayName:e.member.name,"aria-describedby":`mx_SpotlightDialog_button_result_${e.member.userId}_details`},m.a.createElement(q.a,{user:e.member,size:he}),e.member instanceof l.RoomMember?e.member.rawDisplayName:e.member.name,m.a.createElement("div",{id:`mx_SpotlightDialog_button_result_${e.member.userId}_details`,className:"mx_SpotlightDialog_result_details"},e.member.userId));if(Ee(e)){const t=de.getRoom(e.publicRoom.room_id),a="join"===(null==t?void 0:t.getMyMembership())||e.publicRoom.world_readable||de.isGuest(),n=t=>{var a;const{publicRoom:n}=e;ut({roomAlias:n.canonical_alias||(null===(a=n.aliases)||void 0===a?void 0:a[0]),roomId:n.room_id,autoJoin:!e.publicRoom.world_readable&&!de.isGuest(),shouldPeek:e.publicRoom.world_readable||de.isGuest()},!0,"click"!==t.type)};return m.a.createElement(te.a,{id:`mx_SpotlightDialog_button_result_${e.publicRoom.room_id}`,className:"mx_SpotlightDialog_result_multiline",key:`${ve[e.section]}-${e.publicRoom.room_id}`,onClick:n,endAdornment:m.a.createElement(Y.a,{kind:a?"primary_outline":"primary",onClick:n,tabIndex:-1},a?Object(x.a)("View"):Object(x.a)("Join")),"aria-labelledby":`mx_SpotlightDialog_button_result_${e.publicRoom.room_id}_name`,"aria-describedby":`mx_SpotlightDialog_button_result_${e.publicRoom.room_id}_alias`,"aria-details":`mx_SpotlightDialog_button_result_${e.publicRoom.room_id}_details`},m.a.createElement(le.a,{className:"mx_SearchResultAvatar",oobData:{roomId:e.publicRoom.room_id,name:e.publicRoom.name,avatarUrl:e.publicRoom.avatar_url,roomType:e.publicRoom.room_type},width:he,height:he}),m.a.createElement(ae.a,{room:e.publicRoom,labelId:`mx_SpotlightDialog_button_result_${e.publicRoom.room_id}_name`,descriptionId:`mx_SpotlightDialog_button_result_${e.publicRoom.room_id}_alias`,detailsId:`mx_SpotlightDialog_button_result_${e.publicRoom.room_id}_details`}))}return m.a.createElement(te.a,{id:`mx_SpotlightDialog_button_result_${e.name}`,key:`${ve[e.section]}-${e.name}`,onClick:e.onClick},e.avatar,e.name,e.description)};let t,a,n,s,r,c,d,u,p,g;lt[ve.People].length&&(t=m.a.createElement("div",{className:"mx_SpotlightDialog_section mx_SpotlightDialog_results",role:"group","aria-labelledby":"mx_SpotlightDialog_section_people"},m.a.createElement("h4",{id:"mx_SpotlightDialog_section_people"},Object(x.a)("Recent Conversations")),m.a.createElement("div",null,lt[ve.People].slice(0,ue).map(e)))),lt[ve.Suggestions].length&&De===be.People&&(a=m.a.createElement("div",{className:"mx_SpotlightDialog_section mx_SpotlightDialog_results",role:"group","aria-labelledby":"mx_SpotlightDialog_section_suggestions"},m.a.createElement("h4",{id:"mx_SpotlightDialog_section_suggestions"},Object(x.a)("Suggestions")),m.a.createElement("div",null,lt[ve.Suggestions].slice(0,ue).map(e)))),lt[ve.Rooms].length&&(n=m.a.createElement("div",{className:"mx_SpotlightDialog_section mx_SpotlightDialog_results",role:"group","aria-labelledby":"mx_SpotlightDialog_section_rooms"},m.a.createElement("h4",{id:"mx_SpotlightDialog_section_rooms"},Object(x.a)("Rooms")),m.a.createElement("div",null,lt[ve.Rooms].slice(0,ue).map(e)))),lt[ve.Spaces].length&&(s=m.a.createElement("div",{className:"mx_SpotlightDialog_section mx_SpotlightDialog_results",role:"group","aria-labelledby":"mx_SpotlightDialog_section_spaces"},m.a.createElement("h4",{id:"mx_SpotlightDialog_section_spaces"},Object(x.a)("Spaces you're in")),m.a.createElement("div",null,lt[ve.Spaces].slice(0,ue).map(e)))),De===be.PublicRooms&&(r=m.a.createElement("div",{className:"mx_SpotlightDialog_section mx_SpotlightDialog_results",role:"group","aria-labelledby":"mx_SpotlightDialog_section_publicRooms"},m.a.createElement("div",{className:"mx_SpotlightDialog_sectionHeader"},m.a.createElement("h4",{id:"mx_SpotlightDialog_section_publicRooms"},Object(x.a)("Suggestions")),m.a.createElement("div",{className:"mx_SpotlightDialog_options"},He&&m.a.createElement(m.a.Fragment,null,m.a.createElement(J.a,{label:Object(x.a)("Show rooms"),value:Je,onChange:Qe}),m.a.createElement(J.a,{label:Object(x.a)("Show spaces"),value:Xe,onChange:Ze})),m.a.createElement($.a,{protocols:Ke,config:null!=qe?qe:null,setConfig:$e}))),m.a.createElement("div",null," ",Je||Xe?lt[ve.PublicRooms].slice(0,ue).map(e):m.a.createElement("div",{className:"mx_SpotlightDialog_otherSearches_messageSearchText"},Object(x.a)("You cannot search for rooms that are neither a room nor a space"))," "))),dt.length&&ct&&null===De&&(c=m.a.createElement("div",{className:"mx_SpotlightDialog_section mx_SpotlightDialog_results",role:"group","aria-labelledby":"mx_SpotlightDialog_section_spaceRooms"},m.a.createElement("h4",{id:"mx_SpotlightDialog_section_spaceRooms"},Object(x.a)("Other rooms in %(spaceName)s",{spaceName:ct.name})),m.a.createElement("div",null,dt.slice(0,ue).map((e=>m.a.createElement(te.a,{id:`mx_SpotlightDialog_button_result_${e.room_id}`,key:e.room_id,onClick:t=>{ut({roomId:e.room_id},!0,"click"!==(null==t?void 0:t.type))}},m.a.createElement(G.a,{name:e.name,idName:e.room_id,url:e.avatar_url?Object(v.b)(e.avatar_url).getSquareThumbnailHttp(he):null,width:he,height:he}),e.name||e.canonical_alias,e.name&&e.canonical_alias&&m.a.createElement("div",{className:"mx_SpotlightDialog_result_details"},e.canonical_alias)))),mt&&m.a.createElement(Q.a,null)))),!We.startsWith("#")||!We.includes(":")||Object(I.a)(We)&&de.getRoom(Object(I.a)(We))||(d=m.a.createElement("div",{className:"mx_SpotlightDialog_section mx_SpotlightDialog_otherSearches",role:"group"},m.a.createElement("div",null,m.a.createElement(te.a,{id:"mx_SpotlightDialog_button_joinRoomAlias",className:"mx_SpotlightDialog_joinRoomAlias",onClick:e=>{f.a.dispatch({action:b.a.ViewRoom,room_alias:We,auto_join:!0,metricsTrigger:"WebUnifiedSearch",metricsViaKeyboard:"click"!==(null==e?void 0:e.type)}),h()}},Object(x.a)("Join %(roomAddress)s",{roomAddress:We}))))),De===be.People?u=m.a.createElement("div",{className:"mx_SpotlightDialog_section mx_SpotlightDialog_hiddenResults",role:"group"},m.a.createElement("h4",null,Object(x.a)("Some results may be hidden for privacy")),m.a.createElement("div",{className:"mx_SpotlightDialog_otherSearches_messageSearchText"},Object(x.a)("If you can't see who you're looking for, send them your invite link.")),m.a.createElement(se.a,{id:"mx_SpotlightDialog_button_inviteLink",className:"mx_SpotlightDialog_inviteLink",onClick:()=>{Ve(!0),Object(z.b)(Fe)},onHideTooltip:()=>Ve(!1),title:Be?Object(x.a)("Copied!"):Object(x.a)("Copy")},m.a.createElement("span",{className:"mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_primary_outline"},Object(x.a)("Copy invite link")))):We&&De===be.PublicRooms&&(u=m.a.createElement("div",{className:"mx_SpotlightDialog_section mx_SpotlightDialog_hiddenResults",role:"group"},m.a.createElement("h4",null,Object(x.a)("Some results may be hidden")),m.a.createElement("div",{className:"mx_SpotlightDialog_otherSearches_messageSearchText"},Object(x.a)("If you can't find the room you're looking for, ask for an invite or create a new room.")),m.a.createElement(te.a,{id:"mx_SpotlightDialog_button_createNewRoom",className:"mx_SpotlightDialog_createRoom",onClick:()=>f.a.dispatch({action:"view_create_room",public:!0,defaultName:Object(o.capitalize)(We)})},m.a.createElement("span",{className:"mx_AccessibleButton mx_AccessibleButton_hasKind mx_AccessibleButton_kind_primary_outline"},Object(x.a)("Create new room"))))),De===be.People&&(p=m.a.createElement("div",{className:"mx_SpotlightDialog_section mx_SpotlightDialog_otherSearches",role:"group","aria-labelledby":"mx_SpotlightDialog_section_groupChat"},m.a.createElement("h4",{id:"mx_SpotlightDialog_section_groupChat"},Object(x.a)("Other options")),m.a.createElement(te.a,{id:"mx_SpotlightDialog_button_startGroupChat",className:"mx_SpotlightDialog_startGroupChat",onClick:()=>Object(T.f)(We)},Object(x.a)("Start a group chat")))),null===De&&(g=m.a.createElement("div",{className:"mx_SpotlightDialog_section mx_SpotlightDialog_otherSearches",role:"group","aria-labelledby":"mx_SpotlightDialog_section_messageSearch"},m.a.createElement("h4",{id:"mx_SpotlightDialog_section_messageSearch"},Object(x.a)("Other searches")),m.a.createElement("div",{className:"mx_SpotlightDialog_otherSearches_messageSearchText"},Object(x.a)("To search messages, look for this icon at the top of a room <icon/>",{},{icon:()=>m.a.createElement("div",{className:"mx_SpotlightDialog_otherSearches_messageSearchIcon"})})))),pt=m.a.createElement(m.a.Fragment,null,t,a,n,s,c,r,d,u,ht,p,g)}else{let e;Ne.length&&(e=m.a.createElement("div",{className:"mx_SpotlightDialog_section mx_SpotlightDialog_recentSearches",role:"group",tabIndex:-1,"aria-labelledby":"mx_SpotlightDialog_section_recentSearches"},m.a.createElement("h4",null,m.a.createElement("span",{id:"mx_SpotlightDialog_section_recentSearches"},Object(x.a)("Recent searches")),m.a.createElement(Y.a,{kind:"link",onClick:Pe},Object(x.a)("Clear"))),m.a.createElement("div",null,Ne.map((e=>{const t=M.a.instance.getRoomState(e),a=ke(0,t),n={"aria-label":a?`${e.name} ${a}`:e.name,"aria-describedby":`mx_SpotlightDialog_button_recentSearch_${e.roomId}_details`};return m.a.createElement(te.a,i()({id:`mx_SpotlightDialog_button_recentSearch_${e.roomId}`,key:e.roomId,onClick:t=>{ut({roomId:e.roomId},!0,"click"!==(null==t?void 0:t.type))},endAdornment:m.a.createElement(ne.a,{room:e})},n),m.a.createElement(K.a,{room:e,avatarSize:he,tooltipProps:{tabIndex:-1}}),e.name,m.a.createElement(X.a,{notification:t}),m.a.createElement(ie.a,{id:`mx_SpotlightDialog_button_recentSearch_${e.roomId}_details`,className:"mx_SpotlightDialog_result_details",room:e}))}))))),pt=m.a.createElement(m.a.Fragment,null,m.a.createElement("div",{className:"mx_SpotlightDialog_section mx_SpotlightDialog_recentlyViewed",role:"group","aria-labelledby":"mx_SpotlightDialog_section_recentlyViewed"},m.a.createElement("h4",{id:"mx_SpotlightDialog_section_recentlyViewed"},Object(x.a)("Recently viewed")),m.a.createElement("div",null,D.a.instance.rooms.filter((e=>e.roomId!==L.b.instance.roomViewStore.getRoomId())).map((e=>m.a.createElement(se.a,{id:`mx_SpotlightDialog_button_recentlyViewed_${e.roomId}`,title:e.name,key:e.roomId,onClick:t=>{ut({roomId:e.roomId},!1,"click"!==t.type)}},m.a.createElement(K.a,{room:e,avatarSize:32,tooltipProps:{tabIndex:-1}}),e.name))))),e,ht)}const gt=Object(oe.a)()?()=>{k.b.createDialog(ee.a,{feature:"spotlight"})}:null,vt=null===(a=Re.state.activeRef)||void 0===a||null===(n=a.current)||void 0===n?void 0:n.id;return m.a.createElement(m.a.Fragment,null,m.a.createElement("div",{id:"mx_SpotlightDialog_keyboardPrompt"},Object(x.a)("Use <arrows/> to scroll",{},{arrows:()=>m.a.createElement(m.a.Fragment,null,m.a.createElement("kbd",null,"↓"),m.a.createElement("kbd",null,"↑"),null!==!De&&!Ie&&m.a.createElement("kbd",null,"←"),null!==!De&&!Ie&&m.a.createElement("kbd",null,"→"))})),m.a.createElement(Z.a,{className:"mx_SpotlightDialog",onFinished:h,hasCancel:!1,onKeyDown:e=>{if(Object(C.a)().getNavigationAction(e)===p.h.FilterRooms)e.stopPropagation(),e.preventDefault(),h();let t;const a=Object(C.a)().getAccessibilityAction(e);switch(a){case p.h.Escape:e.stopPropagation(),e.preventDefault(),h();break;case p.h.ArrowUp:case p.h.ArrowDown:if(e.stopPropagation(),e.preventDefault(),Re.state.refs.length>0){let e=Re.state.refs;if(!Ie&&null!==!De){const t=pe(Re.state.activeRef)?Re.state.activeRef:e.find(pe);e=e.filter((e=>e===t||!pe(e)))}const n=e.indexOf(Re.state.activeRef);t=Object(g.h)(e,n+(a===p.h.ArrowUp?-1:1))}break;case p.h.ArrowLeft:case p.h.ArrowRight:if(!Ie&&null!==!De&&Re.state.refs.length>0&&pe(Re.state.activeRef)){e.stopPropagation(),e.preventDefault();const n=Re.state.refs.filter(pe),i=n.indexOf(Re.state.activeRef);t=Object(g.h)(n,i+(a===p.h.ArrowLeft?-1:1))}}var n;t&&(Re.dispatch({type:g.f.SetFocus,payload:{ref:t}}),null===(n=t.current)||void 0===n||n.scrollIntoView({block:"nearest"}))},screenName:"UnifiedSearch","aria-label":Object(x.a)("Search Dialog")},m.a.createElement("div",{className:"mx_SpotlightDialog_searchBox mx_textinput"},null!==De&&m.a.createElement("div",{className:r()("mx_SpotlightDialog_filter",{mx_SpotlightDialog_filterPeople:De===be.People,mx_SpotlightDialog_filterPublicRooms:De===be.PublicRooms})},m.a.createElement("span",null,fe(De)),m.a.createElement(Y.a,{tabIndex:-1,alt:Object(x.a)("Remove search filter for %(filter)s",{filter:fe(De)}),className:"mx_SpotlightDialog_filter--close",onClick:()=>Ae(null)})),m.a.createElement("input",{ref:A,autoFocus:!0,type:"text",autoComplete:"off",autoCapitalize:"off",autoCorrect:"off",spellCheck:"false",placeholder:Object(x.a)("Search"),value:Ie,onChange:e=>{const t=e.currentTarget.value;Te(t)},onKeyDown:e=>{var t,a;switch(Object(C.a)().getAccessibilityAction(e)){case p.h.Backspace:Ie||null===De||(e.stopPropagation(),e.preventDefault(),Ae(null));break;case p.h.Enter:e.stopPropagation(),e.preventDefault(),null===(t=Re.state.activeRef)||void 0===t||null===(a=t.current)||void 0===a||a.click()}},"aria-owns":"mx_SpotlightDialog_content","aria-activedescendant":vt,"aria-label":Object(x.a)("Search"),"aria-describedby":"mx_SpotlightDialog_keyboardPrompt"}),(ze||et||nt)&&m.a.createElement(Q.a,{w:24,h:24})),m.a.createElement("div",{ref:re,id:"mx_SpotlightDialog_content",role:"listbox","aria-activedescendant":vt,"aria-describedby":"mx_SpotlightDialog_keyboardPrompt"},pt),m.a.createElement("div",{className:"mx_SpotlightDialog_footer"},gt&&Object(x.a)("Results not as expected? Please <a>give feedback</a>.",{},{a:e=>m.a.createElement(Y.a,{kind:"link_inline",onClick:gt},e)}),gt&&m.a.createElement(Y.a,{kind:"primary_outline",onClick:gt},Object(x.a)("Feedback")))))};t.b=e=>m.a.createElement(g.d,null,(()=>m.a.createElement(Re,e)))}).call(this,a(54).setImmediate)},882:function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n=a(13),i=a.n(n),s=a(129);class r{constructor(e,t,a){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];this.root=e,this.pageSize=t,this.maxDepth=a,this.suggestedOnly=n,i()(this,"viaMap",new Map),i()(this,"backRefs",new Map),i()(this,"roomMap",new Map),i()(this,"loadRequest",void 0),i()(this,"nextBatch",void 0),i()(this,"_rooms",void 0),i()(this,"serverSupportError",void 0)}get noSupport(){return!!this.serverSupportError}get canLoadMore(){return!!this.serverSupportError||!!this.nextBatch||!this._rooms}get loading(){return!!this.loadRequest}get rooms(){return this._rooms}async load(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.pageSize;if(this.loadRequest)return this.loadRequest.then((e=>e.rooms));this.loadRequest=this.root.client.getRoomHierarchy(this.root.roomId,t,this.maxDepth,this.suggestedOnly,this.nextBatch);try{({rooms:e,next_batch:this.nextBatch}=await this.loadRequest)}catch(e){if("M_UNRECOGNIZED"!==e.errcode)throw e;return this.serverSupportError=e,[]}finally{this.loadRequest=void 0}return this._rooms?this._rooms=this._rooms.concat(e):this._rooms=e,e.forEach((e=>{this.roomMap.set(e.room_id,e),e.children_state.forEach((t=>{if(t.type!==s.b.SpaceChild)return;const a=t.state_key;if(this.backRefs.has(a)||this.backRefs.set(a,[]),this.backRefs.get(a).push(e.room_id),Array.isArray(t.content.via)){this.viaMap.has(a)||this.viaMap.set(a,new Set);const e=this.viaMap.get(a);t.content.via.forEach((t=>e.add(t)))}}))})),e}getRelation(e,t){var a;return null===(a=this.roomMap.get(e))||void 0===a?void 0:a.children_state.find((e=>e.state_key===t))}isSuggested(e,t){var a;return null===(a=this.getRelation(e,t))||void 0===a?void 0:a.content.suggested}removeRelation(e,t){const a=this.backRefs.get(t);1===(null==a?void 0:a.length)?this.backRefs.delete(t):null!=a&&a.length&&this.backRefs.set(t,a.filter((t=>t!==e)));const n=this.roomMap.get(e);n&&(n.children_state=n.children_state.filter((e=>e.state_key!==t)))}}},883:function(e,t,a){"use strict";a.d(t,"b",(function(){return v}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(121),l=a(125),c=a(137),d=a(177),m=a(167),u=a(208),h=a(159);function p(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function g(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?p(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):p(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}const v=(e,t)=>a=>{const n=l.b.getValue("Spaces.enabledMetaSpaces");l.b.setValue("Spaces.enabledMetaSpaces",null,c.a.ACCOUNT,g(g({},n),{},{[e]:a.target.checked})),h.b.trackInteraction(t,a,[u.a.Home,null,u.a.Favourites,u.a.People,u.a.Orphans].indexOf(e))};t.a=()=>{const{[u.a.Home]:e,[u.a.Favourites]:t,[u.a.People]:a,[u.a.Orphans]:n}=Object(m.b)("Spaces.enabledMetaSpaces"),i=Object(m.b)("Spaces.allRoomsInHome");return r.a.createElement("div",{className:"mx_SettingsTab mx_SidebarUserSettingsTab"},r.a.createElement("div",{className:"mx_SettingsTab_heading"},Object(o.a)("Sidebar")),r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("div",{className:"mx_SettingsTab_subheading"},Object(o.a)("Spaces to show")),r.a.createElement("div",{className:"mx_SettingsTab_subsectionText"},Object(o.a)("Spaces are ways to group rooms and people. Alongside the spaces you're in, you can use some pre-built ones too.")),r.a.createElement(d.b,{checked:!!e,onChange:v(u.a.Home,"WebSettingsSidebarTabSpacesCheckbox"),className:"mx_SidebarUserSettingsTab_homeCheckbox",disabled:e},Object(o.a)("Home")),r.a.createElement("div",{className:"mx_SidebarUserSettingsTab_checkboxMicrocopy"},Object(o.a)("Home is useful for getting an overview of everything.")),r.a.createElement(d.b,{checked:i,disabled:!e,onChange:e=>{l.b.setValue("Spaces.allRoomsInHome",null,c.a.ACCOUNT,e.target.checked),h.b.trackInteraction("WebSettingsSidebarTabSpacesCheckbox",e,1)},className:"mx_SidebarUserSettingsTab_homeAllRoomsCheckbox"},Object(o.a)("Show all rooms")),r.a.createElement("div",{className:"mx_SidebarUserSettingsTab_checkboxMicrocopy"},Object(o.a)("Show all your rooms in Home, even if they're in a space.")),r.a.createElement(d.b,{checked:!!t,onChange:v(u.a.Favourites,"WebSettingsSidebarTabSpacesCheckbox"),className:"mx_SidebarUserSettingsTab_favouritesCheckbox"},Object(o.a)("Favourites")),r.a.createElement("div",{className:"mx_SidebarUserSettingsTab_checkboxMicrocopy"},Object(o.a)("Group all your favourite rooms and people in one place.")),r.a.createElement(d.b,{checked:!!a,onChange:v(u.a.People,"WebSettingsSidebarTabSpacesCheckbox"),className:"mx_SidebarUserSettingsTab_peopleCheckbox"},Object(o.a)("People")),r.a.createElement("div",{className:"mx_SidebarUserSettingsTab_checkboxMicrocopy"},Object(o.a)("Group all your people in one place.")),r.a.createElement(d.b,{checked:!!n,onChange:v(u.a.Orphans,"WebSettingsSidebarTabSpacesCheckbox"),className:"mx_SidebarUserSettingsTab_orphansCheckbox"},Object(o.a)("Rooms outside of a space")),r.a.createElement("div",{className:"mx_SidebarUserSettingsTab_checkboxMicrocopy"},Object(o.a)("Group all your rooms that aren't part of a space in one place."))))}},884:function(e,t,a){"use strict";a.d(t,"a",(function(){return w}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(1),l=a(121),c=a(125),d=a(310),m=a(469),u=a(123),h=a(124),p=a(128),g=a(177),v=a(139),b=a(335),f=a(137),y=a(159);function E(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function _(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?E(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):E(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}class w extends r.a.Component{constructor(e){super(e),i()(this,"themeTimer",void 0),i()(this,"onThemeChange",(e=>{if(this.state.theme===e)return;y.b.trackInteraction("WebSettingsAppearanceTabThemeSelector");const t=c.b.getValue("theme");c.b.setValue("theme",null,f.a.DEVICE,e).catch((()=>{h.a.dispatch({action:p.a.RecheckTheme}),this.setState({theme:t})})),this.setState({theme:e}),h.a.dispatch({action:p.a.RecheckTheme,forceTheme:e})})),i()(this,"onUseSystemThemeChanged",(e=>{this.setState({useSystemTheme:e}),c.b.setValue("use_system_theme",null,f.a.DEVICE,e),h.a.dispatch({action:p.a.RecheckTheme})})),i()(this,"onAddCustomTheme",(async()=>{let e=c.b.getValue("custom_themes");e||(e=[]),e=e.map((e=>e)),this.themeTimer&&clearTimeout(this.themeTimer);try{const t=await fetch(this.state.customThemeUrl),a=await t.json();if(!a||"string"!=typeof a.name||"object"!=typeof a.colors)return void this.setState({customThemeMessage:{text:Object(l.a)("Invalid theme schema."),isError:!0}});e.push(a)}catch(e){return o.a.error(e),void this.setState({customThemeMessage:{text:Object(l.a)("Error downloading theme information."),isError:!0}})}await c.b.setValue("custom_themes",null,f.a.ACCOUNT,e),this.setState({customThemeUrl:"",customThemeMessage:{text:Object(l.a)("Theme added!"),isError:!1}}),this.themeTimer=window.setTimeout((()=>{this.setState({customThemeMessage:{text:"",isError:!1}})}),3e3)})),i()(this,"onCustomThemeChange",(e=>{this.setState({customThemeUrl:e.target.value})})),this.state=_(_({},w.calculateThemeState()),{},{customThemeUrl:"",customThemeMessage:{isError:!1,text:""}})}static calculateThemeState(){const e=c.b.getValue("theme"),t=c.b.getValueAt(f.a.DEVICE,"use_system_theme",null,!1,!0),a=c.b.getValueAt(f.a.DEVICE,"theme",null,!1,!0);return t?{theme:e,useSystemTheme:!0}:a?{theme:e,useSystemTheme:!1}:{theme:e,useSystemTheme:c.b.getValueAt(f.a.DEVICE,"use_system_theme")}}renderHighContrastCheckbox(){if(!this.state.useSystemTheme&&(Object(d.c)(this.state.theme)||Object(d.g)(this.state.theme)))return r.a.createElement("div",null,r.a.createElement(g.b,{checked:Object(d.g)(this.state.theme),onChange:e=>this.highContrastThemeChanged(e.target.checked)},Object(l.a)("Use high contrast")))}highContrastThemeChanged(e){let t;t=e?Object(d.c)(this.state.theme):Object(d.d)(this.state.theme),t&&this.onThemeChange(t)}render(){let e,t;if((new m.a).isSystemThemeSupported()&&(e=r.a.createElement("div",null,r.a.createElement(g.b,{checked:this.state.useSystemTheme,onChange:e=>this.onUseSystemThemeChanged(e.target.checked)},c.b.getDisplayName("use_system_theme")))),c.b.getValue("feature_custom_themes")){let e;this.state.customThemeMessage.text&&(e=this.state.customThemeMessage.isError?r.a.createElement("div",{className:"text-error"},this.state.customThemeMessage.text):r.a.createElement("div",{className:"text-success"},this.state.customThemeMessage.text)),t=r.a.createElement("div",{className:"mx_SettingsTab_section"},r.a.createElement("form",{onSubmit:this.onAddCustomTheme},r.a.createElement(v.a,{label:Object(l.a)("Custom theme URL"),type:"text",id:"mx_GeneralUserSettingsTab_customThemeInput",autoComplete:"off",onChange:this.onCustomThemeChange,value:this.state.customThemeUrl}),r.a.createElement(u.a,{onClick:this.onAddCustomTheme,type:"submit",kind:"primary_sm",disabled:!this.state.customThemeUrl.trim()},Object(l.a)("Add theme")),e))}const a=Object(d.f)();return r.a.createElement("div",{className:"mx_SettingsTab_section mx_ThemeChoicePanel"},r.a.createElement("span",{className:"mx_SettingsTab_subheading"},Object(l.a)("Theme")),e,r.a.createElement("div",{className:"mx_ThemeSelectors"},r.a.createElement(b.a,{name:"theme",definitions:a.map((e=>({value:e.id,label:e.name,disabled:this.state.useSystemTheme,className:"mx_ThemeSelector_"+e.id}))),onChange:this.onThemeChange,value:this.apparentSelectedThemeId(),outlined:!0})),this.renderHighContrastCheckbox(),t)}apparentSelectedThemeId(){if(this.state.useSystemTheme)return;const e=Object(d.d)(this.state.theme);return e||this.state.theme}}},885:function(e,t,a){"use strict";t.__esModule=!0,t.setBatch=t.getBatch=void 0;var n=function(e){e()};t.setBatch=function(e){return n=e};t.getBatch=function(){return n}},886:function(e,t,a){"use strict";var n=a(171).default,i=a(240).default;t.__esModule=!0,t.default=function(e,t){void 0===t&&(t={});var a=t,n=a.getDisplayName,i=void 0===n?function(e){return"ConnectAdvanced("+e+")"}:n,m=a.methodName,w=void 0===m?"connectAdvanced":m,S=a.renderCountProp,O=void 0===S?void 0:S,C=a.shouldHandleStateChanges,x=void 0===C||C,j=a.storeKey,k=void 0===j?"store":j,R=(a.withRef,a.forwardRef),I=void 0!==R&&R,T=a.context,N=void 0===T?u.ReactReduxContext:T,P=(0,r.default)(a,h);0;var D=N;return function(t){var a=t.displayName||t.name||"Component",n=i(a),m=(0,s.default)({},P,{getDisplayName:i,methodName:w,renderCountProp:O,shouldHandleStateChanges:x,storeKey:k,displayName:n,wrappedComponentName:a,WrappedComponent:t}),u=P.pure;var h=u?l.useMemo:function(e){return e()};function S(a){var n=(0,l.useMemo)((function(){var e=a.reactReduxForwardedRef,t=(0,r.default)(a,p);return[a.context,e,t]}),[a]),i=n[0],o=n[1],u=n[2],w=(0,l.useMemo)((function(){return i&&i.Consumer&&(0,c.isContextConsumer)(l.default.createElement(i.Consumer,null))?i:D}),[i,D]),S=(0,l.useContext)(w),O=Boolean(a.store)&&Boolean(a.store.getState)&&Boolean(a.store.dispatch);Boolean(S)&&Boolean(S.store);var C=O?a.store:S.store,j=(0,l.useMemo)((function(){return function(t){return e(t.dispatch,m)}(C)}),[C]),k=(0,l.useMemo)((function(){if(!x)return v;var e=(0,d.createSubscription)(C,O?null:S.subscription),t=e.notifyNestedSubs.bind(e);return[e,t]}),[C,O,S]),R=k[0],I=k[1],T=(0,l.useMemo)((function(){return O?S:(0,s.default)({},S,{subscription:R})}),[O,S,R]),N=(0,l.useReducer)(b,g,_),P=N[0][0],M=N[1];if(P&&P.error)throw P.error;var A=(0,l.useRef)(),L=(0,l.useRef)(u),U=(0,l.useRef)(),F=(0,l.useRef)(!1),B=h((function(){return U.current&&u===L.current?U.current:j(C.getState(),u)}),[C,P,u]);f(y,[L,A,F,u,B,U,I]),f(E,[x,C,R,j,L,A,F,U,I,M],[C,R,j]);var V=(0,l.useMemo)((function(){return l.default.createElement(t,(0,s.default)({},B,{ref:o}))}),[o,t,B]);return(0,l.useMemo)((function(){return x?l.default.createElement(w.Provider,{value:T},V):V}),[w,V,T])}var C=u?l.default.memo(S):S;if(C.WrappedComponent=t,C.displayName=S.displayName=n,I){var j=l.default.forwardRef((function(e,t){return l.default.createElement(C,(0,s.default)({},e,{reactReduxForwardedRef:t}))}));return j.displayName=n,j.WrappedComponent=t,(0,o.default)(j,t)}return(0,o.default)(C,t)}};var s=n(a(130)),r=n(a(408)),o=n(a(1471)),l=i(a(120)),c=a(1474),d=a(631),m=a(632),u=a(311),h=["getDisplayName","methodName","renderCountProp","shouldHandleStateChanges","storeKey","withRef","forwardRef","context"],p=["reactReduxForwardedRef"],g=[],v=[null,null];function b(e,t){var a=e[1];return[t.payload,a+1]}function f(e,t,a){(0,m.useIsomorphicLayoutEffect)((function(){return e.apply(void 0,t)}),a)}function y(e,t,a,n,i,s,r){e.current=n,t.current=i,a.current=!1,s.current&&(s.current=null,r())}function E(e,t,a,n,i,s,r,o,l,c){if(e){var d=!1,m=null,u=function(){if(!d){var e,a,u=t.getState();try{e=n(u,i.current)}catch(e){a=e,m=e}a||(m=null),e===s.current?r.current||l():(s.current=e,o.current=e,r.current=!0,c({type:"STORE_UPDATED",payload:{error:a}}))}};a.onStateChange=u,a.trySubscribe(),u();return function(){if(d=!0,a.tryUnsubscribe(),a.onStateChange=null,m)throw m}}}var _=function(){return[null,0]}},887:function(e,t,a){"use strict";function n(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}t.__esModule=!0,t.default=function(e,t){if(n(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var a=Object.keys(e),i=Object.keys(t);if(a.length!==i.length)return!1;for(var s=0;s<a.length;s++)if(!Object.prototype.hasOwnProperty.call(t,a[s])||!n(e[a[s]],t[a[s]]))return!1;return!0}},888:function(e,t,a){"use strict";var n=a(171).default;t.__esModule=!0,t.getDependsOnOwnProps=i,t.wrapMapToPropsConstant=function(e){return function(t,a){var n=e(t,a);function i(){return n}return i.dependsOnOwnProps=!1,i}},t.wrapMapToPropsFunc=function(e,t){return function(t,a){a.displayName;var n=function(e,t){return n.dependsOnOwnProps?n.mapToProps(e,t):n.mapToProps(e)};return n.dependsOnOwnProps=!0,n.mapToProps=function(t,a){n.mapToProps=e,n.dependsOnOwnProps=i(e);var s=n(t,a);return"function"==typeof s&&(n.mapToProps=s,n.dependsOnOwnProps=i(s),s=n(t,a)),s},n}};n(a(889));function i(e){return null!==e.dependsOnOwnProps&&void 0!==e.dependsOnOwnProps?Boolean(e.dependsOnOwnProps):1!==e.length}},889:function(e,t,a){"use strict";var n=a(171).default;t.__esModule=!0,t.default=function(e,t,a){(0,i.default)(e)||(0,s.default)(a+"() in "+t+" must return a plain object. Instead received "+e+".")};var i=n(a(1479)),s=n(a(890))},890:function(e,t,a){"use strict";t.__esModule=!0,t.default=function(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e);try{throw new Error(e)}catch(e){}}},891:function(e,t,a){"use strict";t.__esModule=!0,t.createStoreHook=r,t.useStore=void 0;var n=a(120),i=a(311),s=a(892);function r(e){void 0===e&&(e=i.ReactReduxContext);var t=e===i.ReactReduxContext?s.useReduxContext:function(){return(0,n.useContext)(e)};return function(){return t().store}}var o=r();t.useStore=o},892:function(e,t,a){"use strict";t.__esModule=!0,t.useReduxContext=function(){0;return(0,n.useContext)(i.ReactReduxContext)};var n=a(120),i=a(311)},893:function(e,t,a){"use strict";a.d(t,"a",(function(){return p}));var n=a(126),i=a.n(n),s=a(129),r=a(120),o=a.n(r),l=a(133),c=a(138),d=a(608),m=a(291),u=a(123),h=a(134);const p=52;t.b=e=>{var t;let{hasAvatar:a,hasAvatarLabel:n,noAvatarLabel:p,setAvatarUrl:g,isUserAvatar:v,children:b,onClick:f}=e;const y=Object(r.useContext)(l.a),[E,_]=Object(r.useState)(!1),[w,S]=Object(r.useState)(!1),[O,C]=Object(r.useState)(!1);Object(d.c)((()=>{C(!0)}),3e3),Object(d.c)((()=>{C(!1)}),13e3);const x=Object(r.useRef)(),j=a||E?n:p,{room:k}=Object(r.useContext)(c.b);if(!(v||(null==k||null===(t=k.currentState)||void 0===t?void 0:t.maySendStateEvent(s.b.RoomAvatar,y.getUserId()))))return o.a.createElement(o.a.Fragment,null,b);const R=!!j&&(w||O);return o.a.createElement(o.a.Fragment,null,o.a.createElement("input",{type:"file",ref:x,className:"mx_MiniAvatarUploader_input",onClick:e=>{Object(m.a)(e),null==f||f(e)},onChange:async e=>{var t;if(null===(t=e.target.files)||void 0===t||!t.length)return;_(!0);const a=e.target.files[0],{content_uri:n}=await y.uploadContent(a);await g(n),_(!1)},accept:"image/*"}),o.a.createElement(u.a,{className:i()("mx_MiniAvatarUploader",{mx_MiniAvatarUploader_busy:E,mx_MiniAvatarUploader_hasAvatar:a}),disabled:E,onClick:()=>{x.current.click()},onMouseOver:()=>S(!0),onMouseLeave:()=>S(!1)},b,o.a.createElement("div",{className:"mx_MiniAvatarUploader_indicator"},E?o.a.createElement(h.a,{w:20,h:20}):o.a.createElement("div",{className:"mx_MiniAvatarUploader_cameraIcon"})),o.a.createElement("div",{className:i()("mx_Tooltip",{mx_Tooltip_visible:R,mx_Tooltip_invisible:!R})},o.a.createElement("div",{className:"mx_Tooltip_chevron"}),j)))}},894:function(e,t){e.exports="img/user-onboarding/PersonalMessaging.b5ba3c4.png"},895:function(e,t,a){"use strict";a.d(t,"a",(function(){return i})),a.d(t,"b",(function(){return s})),a.d(t,"c",(function(){return r})),a.d(t,"d",(function(){return o}));var n=a(121);let i,s;!function(e){e.Html="Html",e.PlainText="PlainText",e.Json="Json"}(i||(i={})),function(e){e.Timeline="Timeline",e.Beginning="Beginning",e.LastNMessages="LastNMessages"}(s||(s={}));const r=e=>{switch(e){case i.Html:return Object(n.a)("HTML");case i.Json:return Object(n.a)("JSON");case i.PlainText:return Object(n.a)("Plain Text");default:throw new Error("Unknown format")}},o=e=>{switch(e){case s.Beginning:return Object(n.a)("From the beginning");case s.LastNMessages:return Object(n.a)("Specify a number of messages");case s.Timeline:return Object(n.a)("Current Timeline");default:throw new Error("Unknown type: "+e)}}},896:function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(164),i=a(307);const s=e=>{if(!Object(i.a)())return{shouldEncrypt:!1};if(!n.a.shared().getRoomIds().has(e.roomId))return{shouldEncrypt:!1};if(1!==e.getInvitedAndJoinedMemberCount())return{shouldEncrypt:!1};const t=e.currentState.getStateEvents("m.room.third_party_invite")||[];return 1===t.length?{shouldEncrypt:!0,inviteEvent:t[0]}:{shouldEncrypt:!1}}},899:function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));var n,i=a(120);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},s.apply(this,arguments)}function r(e){return i.createElement("svg",s({fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 18 14",role:"presentation","aria-hidden":!0},e),n||(n=i.createElement("path",{d:"M17 7H1m0 0l6 6M1 7l6-6",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})))}},900:function(e,t,a){"use strict";a.d(t,"a",(function(){return y})),a.d(t,"c",(function(){return E})),a.d(t,"b",(function(){return _}));var n=a(120),i=a.n(n),s=a(121),r=a(131),o=a(124),l=a(123),c=a(236),d=a(198),m=a(901),u=a(128),h=a(125);const p=()=>{o.a.dispatch({action:u.a.PseudonymousAnalyticsAccept})},g=()=>{o.a.dispatch({action:u.a.PseudonymousAnalyticsReject})},v=()=>{Object(m.b)({onFinished:e=>{e===m.a.Primary&&p()},primaryButton:Object(s.a)("Enable")})},b=()=>{Object(m.b)({onFinished:e=>{e===m.a.Primary?p():e===m.a.Cancel&&g()},primaryButton:Object(s.a)("That's fine"),cancelButton:Object(s.a)("Stop")})},f="analytics";function y(){return r.b.get("privacy_policy_url")}const E=()=>{var e;const t=h.b.getValue("analyticsOptIn",null,!0);let a;if(t)a={description:Object(s.a)("You previously consented to share anonymous usage data with us. We're updating how that works."),acceptLabel:Object(s.a)("That's fine"),onAccept:p,rejectLabel:Object(s.a)("Learn more"),onReject:b};else{if(null!=t)return;{const e=e=>i.a.createElement(l.a,{kind:"link_inline",onClick:v},e);a={description:Object(s.a)("Share anonymous data to help us identify issues. Nothing personal. No third parties. <LearnMoreLink>Learn More</LearnMoreLink>",{},{LearnMoreLink:e}),acceptLabel:Object(s.a)("Yes"),onAccept:p,rejectLabel:Object(s.a)("No"),onReject:g}}}const n=null!==(e=r.b.get("analytics_owner"))&&void 0!==e?e:r.b.get().brand;d.a.sharedInstance().addOrReplaceToast({key:f,title:Object(s.a)("Help improve %(analyticsOwner)s",{analyticsOwner:n}),props:a,component:c.a,className:"mx_AnalyticsToast",priority:10})},_=()=>{d.a.sharedInstance().dismissToast(f)}},901:function(e,t,a){"use strict";a.d(t,"a",(function(){return p})),a.d(t,"b",(function(){return v}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(135),l=a(121),c=a(145),d=a(127),m=a(131),u=a(900);function h(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}let p;!function(e){e[e.Primary=0]="Primary",e[e.Cancel=1]="Cancel"}(p||(p={}));const g=e=>{let{onFinished:t,analyticsOwner:a,privacyPolicyUrl:n,primaryButton:i,cancelButton:s,hasCancel:d}=e;const m=n?r.a.createElement("span",null,Object(l.a)("You can read all our terms <PrivacyPolicyUrl>here</PrivacyPolicyUrl>",{},{PrivacyPolicyUrl:e=>r.a.createElement("a",{href:n,rel:"norefferer noopener",target:"_blank"},e,r.a.createElement("span",{className:"mx_AnalyticsPolicyLink"}))})):"";return r.a.createElement(o.a,{className:"mx_AnalyticsLearnMoreDialog",contentId:"mx_AnalyticsLearnMore",title:Object(l.a)("Help improve %(analyticsOwner)s",{analyticsOwner:a}),onFinished:t},r.a.createElement("div",{className:"mx_Dialog_content"},r.a.createElement("div",{className:"mx_AnalyticsLearnMore_image_holder"}),r.a.createElement("div",{className:"mx_AnalyticsLearnMore_copy"},Object(l.a)("Help us identify issues and improve %(analyticsOwner)s by sharing anonymous usage data. To understand how people use multiple devices, we'll generate a random identifier, shared by your devices.",{analyticsOwner:a})),r.a.createElement("ul",{className:"mx_AnalyticsLearnMore_bullets"},r.a.createElement("li",null,Object(l.a)("We <Bold>don't</Bold> record or profile any account data",{},{Bold:e=>r.a.createElement("b",null,e)})),r.a.createElement("li",null,Object(l.a)("We <Bold>don't</Bold> share information with third parties",{},{Bold:e=>r.a.createElement("b",null,e)})),r.a.createElement("li",null,Object(l.a)("You can turn this off anytime in settings"))),m),r.a.createElement(c.a,{primaryButton:i,cancelButton:s,onPrimaryButtonClick:()=>null==t?void 0:t(p.Primary),onCancel:()=>null==t?void 0:t(p.Cancel),hasCancel:d}))},v=e=>{var t;const a=Object(u.a)(),n=null!==(t=m.b.get("analytics_owner"))&&void 0!==t?t:m.b.get("brand");d.b.createDialog(g,function(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?h(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):h(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}({privacyPolicyUrl:a,analyticsOwner:n},e),"mx_AnalyticsLearnMoreDialog_wrapper")}},902:function(e,t,a){"use strict";a.d(t,"a",(function(){return m}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(121),l=a(125),c=a(134),d=a(279);class m extends r.a.Component{constructor(e){super(e),i()(this,"onSearchChange",(e=>{this.setState({searchQuery:e})})),this.state={searchQuery:"",langs:null}}componentDidMount(){if(o.d().then((e=>{e.sort((function(e,t){return e.label<t.label?-1:e.label>t.label?1:0})),this.setState({langs:e})})).catch((()=>{this.setState({langs:[{value:"en",label:"English"}]})})),!this.props.value){const e=o.h();this.props.onOptionChange(e)}}render(){if(null===this.state.langs)return r.a.createElement(c.a,null);let e;e=this.state.searchQuery?this.state.langs.filter((e=>function(e,t){return!!t.label.toUpperCase().includes(e.toUpperCase())||t.value.toUpperCase()===e.toUpperCase()}(this.state.searchQuery,e))):this.state.langs;const t=e.map((e=>r.a.createElement("div",{key:e.value},e.label)));let a=l.b.getValue("language",null,!0),n=null;return a||(a=navigator.language||navigator.userLanguage),n=this.props.value||a,r.a.createElement(d.a,{id:"mx_LanguageDropdown",className:this.props.className,onOptionChange:this.props.onOptionChange,onSearchChange:this.onSearchChange,searchEnabled:!0,value:n,label:Object(o.a)("Language Dropdown"),disabled:this.props.disabled},t)}}},903:function(e,t,a){"use strict";a.d(t,"c",(function(){return s})),a.d(t,"b",(function(){return l})),a.d(t,"a",(function(){return c}));var n=a(121);const i=/^[0-9 -.]+$/;function s(e){return i.test(e)}const r=127462-"A".charCodeAt(0),o=/^[A-Z]{2}$/,l=e=>o.test(e)?String.fromCodePoint(...e.split("").map((e=>r+e.charCodeAt(0)))):"",c=[{iso2:"GB",name:Object(n.c)("United Kingdom"),prefix:"44"},{iso2:"US",name:Object(n.c)("United States"),prefix:"1"},{iso2:"AF",name:Object(n.c)("Afghanistan"),prefix:"93"},{iso2:"AX",name:Object(n.c)("Åland Islands"),prefix:"358"},{iso2:"AL",name:Object(n.c)("Albania"),prefix:"355"},{iso2:"DZ",name:Object(n.c)("Algeria"),prefix:"213"},{iso2:"AS",name:Object(n.c)("American Samoa"),prefix:"1"},{iso2:"AD",name:Object(n.c)("Andorra"),prefix:"376"},{iso2:"AO",name:Object(n.c)("Angola"),prefix:"244"},{iso2:"AI",name:Object(n.c)("Anguilla"),prefix:"1"},{iso2:"AQ",name:Object(n.c)("Antarctica"),prefix:"672"},{iso2:"AG",name:Object(n.c)("Antigua & Barbuda"),prefix:"1"},{iso2:"AR",name:Object(n.c)("Argentina"),prefix:"54"},{iso2:"AM",name:Object(n.c)("Armenia"),prefix:"374"},{iso2:"AW",name:Object(n.c)("Aruba"),prefix:"297"},{iso2:"AU",name:Object(n.c)("Australia"),prefix:"61"},{iso2:"AT",name:Object(n.c)("Austria"),prefix:"43"},{iso2:"AZ",name:Object(n.c)("Azerbaijan"),prefix:"994"},{iso2:"BS",name:Object(n.c)("Bahamas"),prefix:"1"},{iso2:"BH",name:Object(n.c)("Bahrain"),prefix:"973"},{iso2:"BD",name:Object(n.c)("Bangladesh"),prefix:"880"},{iso2:"BB",name:Object(n.c)("Barbados"),prefix:"1"},{iso2:"BY",name:Object(n.c)("Belarus"),prefix:"375"},{iso2:"BE",name:Object(n.c)("Belgium"),prefix:"32"},{iso2:"BZ",name:Object(n.c)("Belize"),prefix:"501"},{iso2:"BJ",name:Object(n.c)("Benin"),prefix:"229"},{iso2:"BM",name:Object(n.c)("Bermuda"),prefix:"1"},{iso2:"BT",name:Object(n.c)("Bhutan"),prefix:"975"},{iso2:"BO",name:Object(n.c)("Bolivia"),prefix:"591"},{iso2:"BA",name:Object(n.c)("Bosnia"),prefix:"387"},{iso2:"BW",name:Object(n.c)("Botswana"),prefix:"267"},{iso2:"BV",name:Object(n.c)("Bouvet Island"),prefix:"47"},{iso2:"BR",name:Object(n.c)("Brazil"),prefix:"55"},{iso2:"IO",name:Object(n.c)("British Indian Ocean Territory"),prefix:"246"},{iso2:"VG",name:Object(n.c)("British Virgin Islands"),prefix:"1"},{iso2:"BN",name:Object(n.c)("Brunei"),prefix:"673"},{iso2:"BG",name:Object(n.c)("Bulgaria"),prefix:"359"},{iso2:"BF",name:Object(n.c)("Burkina Faso"),prefix:"226"},{iso2:"BI",name:Object(n.c)("Burundi"),prefix:"257"},{iso2:"KH",name:Object(n.c)("Cambodia"),prefix:"855"},{iso2:"CM",name:Object(n.c)("Cameroon"),prefix:"237"},{iso2:"CA",name:Object(n.c)("Canada"),prefix:"1"},{iso2:"CV",name:Object(n.c)("Cape Verde"),prefix:"238"},{iso2:"BQ",name:Object(n.c)("Caribbean Netherlands"),prefix:"599"},{iso2:"KY",name:Object(n.c)("Cayman Islands"),prefix:"1"},{iso2:"CF",name:Object(n.c)("Central African Republic"),prefix:"236"},{iso2:"TD",name:Object(n.c)("Chad"),prefix:"235"},{iso2:"CL",name:Object(n.c)("Chile"),prefix:"56"},{iso2:"CN",name:Object(n.c)("China"),prefix:"86"},{iso2:"CX",name:Object(n.c)("Christmas Island"),prefix:"61"},{iso2:"CC",name:Object(n.c)("Cocos (Keeling) Islands"),prefix:"61"},{iso2:"CO",name:Object(n.c)("Colombia"),prefix:"57"},{iso2:"KM",name:Object(n.c)("Comoros"),prefix:"269"},{iso2:"CG",name:Object(n.c)("Congo - Brazzaville"),prefix:"242"},{iso2:"CD",name:Object(n.c)("Congo - Kinshasa"),prefix:"243"},{iso2:"CK",name:Object(n.c)("Cook Islands"),prefix:"682"},{iso2:"CR",name:Object(n.c)("Costa Rica"),prefix:"506"},{iso2:"HR",name:Object(n.c)("Croatia"),prefix:"385"},{iso2:"CU",name:Object(n.c)("Cuba"),prefix:"53"},{iso2:"CW",name:Object(n.c)("Curaçao"),prefix:"599"},{iso2:"CY",name:Object(n.c)("Cyprus"),prefix:"357"},{iso2:"CZ",name:Object(n.c)("Czech Republic"),prefix:"420"},{iso2:"CI",name:Object(n.c)("Côte d’Ivoire"),prefix:"225"},{iso2:"DK",name:Object(n.c)("Denmark"),prefix:"45"},{iso2:"DJ",name:Object(n.c)("Djibouti"),prefix:"253"},{iso2:"DM",name:Object(n.c)("Dominica"),prefix:"1"},{iso2:"DO",name:Object(n.c)("Dominican Republic"),prefix:"1"},{iso2:"EC",name:Object(n.c)("Ecuador"),prefix:"593"},{iso2:"EG",name:Object(n.c)("Egypt"),prefix:"20"},{iso2:"SV",name:Object(n.c)("El Salvador"),prefix:"503"},{iso2:"GQ",name:Object(n.c)("Equatorial Guinea"),prefix:"240"},{iso2:"ER",name:Object(n.c)("Eritrea"),prefix:"291"},{iso2:"EE",name:Object(n.c)("Estonia"),prefix:"372"},{iso2:"ET",name:Object(n.c)("Ethiopia"),prefix:"251"},{iso2:"FK",name:Object(n.c)("Falkland Islands"),prefix:"500"},{iso2:"FO",name:Object(n.c)("Faroe Islands"),prefix:"298"},{iso2:"FJ",name:Object(n.c)("Fiji"),prefix:"679"},{iso2:"FI",name:Object(n.c)("Finland"),prefix:"358"},{iso2:"FR",name:Object(n.c)("France"),prefix:"33"},{iso2:"GF",name:Object(n.c)("French Guiana"),prefix:"594"},{iso2:"PF",name:Object(n.c)("French Polynesia"),prefix:"689"},{iso2:"TF",name:Object(n.c)("French Southern Territories"),prefix:"262"},{iso2:"GA",name:Object(n.c)("Gabon"),prefix:"241"},{iso2:"GM",name:Object(n.c)("Gambia"),prefix:"220"},{iso2:"GE",name:Object(n.c)("Georgia"),prefix:"995"},{iso2:"DE",name:Object(n.c)("Germany"),prefix:"49"},{iso2:"GH",name:Object(n.c)("Ghana"),prefix:"233"},{iso2:"GI",name:Object(n.c)("Gibraltar"),prefix:"350"},{iso2:"GR",name:Object(n.c)("Greece"),prefix:"30"},{iso2:"GL",name:Object(n.c)("Greenland"),prefix:"299"},{iso2:"GD",name:Object(n.c)("Grenada"),prefix:"1"},{iso2:"GP",name:Object(n.c)("Guadeloupe"),prefix:"590"},{iso2:"GU",name:Object(n.c)("Guam"),prefix:"1"},{iso2:"GT",name:Object(n.c)("Guatemala"),prefix:"502"},{iso2:"GG",name:Object(n.c)("Guernsey"),prefix:"44"},{iso2:"GN",name:Object(n.c)("Guinea"),prefix:"224"},{iso2:"GW",name:Object(n.c)("Guinea-Bissau"),prefix:"245"},{iso2:"GY",name:Object(n.c)("Guyana"),prefix:"592"},{iso2:"HT",name:Object(n.c)("Haiti"),prefix:"509"},{iso2:"HM",name:Object(n.c)("Heard & McDonald Islands"),prefix:"672"},{iso2:"HN",name:Object(n.c)("Honduras"),prefix:"504"},{iso2:"HK",name:Object(n.c)("Hong Kong"),prefix:"852"},{iso2:"HU",name:Object(n.c)("Hungary"),prefix:"36"},{iso2:"IS",name:Object(n.c)("Iceland"),prefix:"354"},{iso2:"IN",name:Object(n.c)("India"),prefix:"91"},{iso2:"ID",name:Object(n.c)("Indonesia"),prefix:"62"},{iso2:"IR",name:Object(n.c)("Iran"),prefix:"98"},{iso2:"IQ",name:Object(n.c)("Iraq"),prefix:"964"},{iso2:"IE",name:Object(n.c)("Ireland"),prefix:"353"},{iso2:"IM",name:Object(n.c)("Isle of Man"),prefix:"44"},{iso2:"IL",name:Object(n.c)("Israel"),prefix:"972"},{iso2:"IT",name:Object(n.c)("Italy"),prefix:"39"},{iso2:"JM",name:Object(n.c)("Jamaica"),prefix:"1"},{iso2:"JP",name:Object(n.c)("Japan"),prefix:"81"},{iso2:"JE",name:Object(n.c)("Jersey"),prefix:"44"},{iso2:"JO",name:Object(n.c)("Jordan"),prefix:"962"},{iso2:"KZ",name:Object(n.c)("Kazakhstan"),prefix:"7"},{iso2:"KE",name:Object(n.c)("Kenya"),prefix:"254"},{iso2:"KI",name:Object(n.c)("Kiribati"),prefix:"686"},{iso2:"XK",name:Object(n.c)("Kosovo"),prefix:"383"},{iso2:"KW",name:Object(n.c)("Kuwait"),prefix:"965"},{iso2:"KG",name:Object(n.c)("Kyrgyzstan"),prefix:"996"},{iso2:"LA",name:Object(n.c)("Laos"),prefix:"856"},{iso2:"LV",name:Object(n.c)("Latvia"),prefix:"371"},{iso2:"LB",name:Object(n.c)("Lebanon"),prefix:"961"},{iso2:"LS",name:Object(n.c)("Lesotho"),prefix:"266"},{iso2:"LR",name:Object(n.c)("Liberia"),prefix:"231"},{iso2:"LY",name:Object(n.c)("Libya"),prefix:"218"},{iso2:"LI",name:Object(n.c)("Liechtenstein"),prefix:"423"},{iso2:"LT",name:Object(n.c)("Lithuania"),prefix:"370"},{iso2:"LU",name:Object(n.c)("Luxembourg"),prefix:"352"},{iso2:"MO",name:Object(n.c)("Macau"),prefix:"853"},{iso2:"MK",name:Object(n.c)("Macedonia"),prefix:"389"},{iso2:"MG",name:Object(n.c)("Madagascar"),prefix:"261"},{iso2:"MW",name:Object(n.c)("Malawi"),prefix:"265"},{iso2:"MY",name:Object(n.c)("Malaysia"),prefix:"60"},{iso2:"MV",name:Object(n.c)("Maldives"),prefix:"960"},{iso2:"ML",name:Object(n.c)("Mali"),prefix:"223"},{iso2:"MT",name:Object(n.c)("Malta"),prefix:"356"},{iso2:"MH",name:Object(n.c)("Marshall Islands"),prefix:"692"},{iso2:"MQ",name:Object(n.c)("Martinique"),prefix:"596"},{iso2:"MR",name:Object(n.c)("Mauritania"),prefix:"222"},{iso2:"MU",name:Object(n.c)("Mauritius"),prefix:"230"},{iso2:"YT",name:Object(n.c)("Mayotte"),prefix:"262"},{iso2:"MX",name:Object(n.c)("Mexico"),prefix:"52"},{iso2:"FM",name:Object(n.c)("Micronesia"),prefix:"691"},{iso2:"MD",name:Object(n.c)("Moldova"),prefix:"373"},{iso2:"MC",name:Object(n.c)("Monaco"),prefix:"377"},{iso2:"MN",name:Object(n.c)("Mongolia"),prefix:"976"},{iso2:"ME",name:Object(n.c)("Montenegro"),prefix:"382"},{iso2:"MS",name:Object(n.c)("Montserrat"),prefix:"1"},{iso2:"MA",name:Object(n.c)("Morocco"),prefix:"212"},{iso2:"MZ",name:Object(n.c)("Mozambique"),prefix:"258"},{iso2:"MM",name:Object(n.c)("Myanmar"),prefix:"95"},{iso2:"NA",name:Object(n.c)("Namibia"),prefix:"264"},{iso2:"NR",name:Object(n.c)("Nauru"),prefix:"674"},{iso2:"NP",name:Object(n.c)("Nepal"),prefix:"977"},{iso2:"NL",name:Object(n.c)("Netherlands"),prefix:"31"},{iso2:"NC",name:Object(n.c)("New Caledonia"),prefix:"687"},{iso2:"NZ",name:Object(n.c)("New Zealand"),prefix:"64"},{iso2:"NI",name:Object(n.c)("Nicaragua"),prefix:"505"},{iso2:"NE",name:Object(n.c)("Niger"),prefix:"227"},{iso2:"NG",name:Object(n.c)("Nigeria"),prefix:"234"},{iso2:"NU",name:Object(n.c)("Niue"),prefix:"683"},{iso2:"NF",name:Object(n.c)("Norfolk Island"),prefix:"672"},{iso2:"KP",name:Object(n.c)("North Korea"),prefix:"850"},{iso2:"MP",name:Object(n.c)("Northern Mariana Islands"),prefix:"1"},{iso2:"NO",name:Object(n.c)("Norway"),prefix:"47"},{iso2:"OM",name:Object(n.c)("Oman"),prefix:"968"},{iso2:"PK",name:Object(n.c)("Pakistan"),prefix:"92"},{iso2:"PW",name:Object(n.c)("Palau"),prefix:"680"},{iso2:"PS",name:Object(n.c)("Palestine"),prefix:"970"},{iso2:"PA",name:Object(n.c)("Panama"),prefix:"507"},{iso2:"PG",name:Object(n.c)("Papua New Guinea"),prefix:"675"},{iso2:"PY",name:Object(n.c)("Paraguay"),prefix:"595"},{iso2:"PE",name:Object(n.c)("Peru"),prefix:"51"},{iso2:"PH",name:Object(n.c)("Philippines"),prefix:"63"},{iso2:"PN",name:Object(n.c)("Pitcairn Islands"),prefix:"870"},{iso2:"PL",name:Object(n.c)("Poland"),prefix:"48"},{iso2:"PT",name:Object(n.c)("Portugal"),prefix:"351"},{iso2:"PR",name:Object(n.c)("Puerto Rico"),prefix:"1"},{iso2:"QA",name:Object(n.c)("Qatar"),prefix:"974"},{iso2:"RO",name:Object(n.c)("Romania"),prefix:"40"},{iso2:"RU",name:Object(n.c)("Russia"),prefix:"7"},{iso2:"RW",name:Object(n.c)("Rwanda"),prefix:"250"},{iso2:"RE",name:Object(n.c)("Réunion"),prefix:"262"},{iso2:"WS",name:Object(n.c)("Samoa"),prefix:"685"},{iso2:"SM",name:Object(n.c)("San Marino"),prefix:"378"},{iso2:"SA",name:Object(n.c)("Saudi Arabia"),prefix:"966"},{iso2:"SN",name:Object(n.c)("Senegal"),prefix:"221"},{iso2:"RS",name:Object(n.c)("Serbia"),prefix:"381 p"},{iso2:"SC",name:Object(n.c)("Seychelles"),prefix:"248"},{iso2:"SL",name:Object(n.c)("Sierra Leone"),prefix:"232"},{iso2:"SG",name:Object(n.c)("Singapore"),prefix:"65"},{iso2:"SX",name:Object(n.c)("Sint Maarten"),prefix:"1"},{iso2:"SK",name:Object(n.c)("Slovakia"),prefix:"421"},{iso2:"SI",name:Object(n.c)("Slovenia"),prefix:"386"},{iso2:"SB",name:Object(n.c)("Solomon Islands"),prefix:"677"},{iso2:"SO",name:Object(n.c)("Somalia"),prefix:"252"},{iso2:"ZA",name:Object(n.c)("South Africa"),prefix:"27"},{iso2:"GS",name:Object(n.c)("South Georgia & South Sandwich Islands"),prefix:"500"},{iso2:"KR",name:Object(n.c)("South Korea"),prefix:"82"},{iso2:"SS",name:Object(n.c)("South Sudan"),prefix:"211"},{iso2:"ES",name:Object(n.c)("Spain"),prefix:"34"},{iso2:"LK",name:Object(n.c)("Sri Lanka"),prefix:"94"},{iso2:"BL",name:Object(n.c)("St. Barthélemy"),prefix:"590"},{iso2:"SH",name:Object(n.c)("St. Helena"),prefix:"290 n"},{iso2:"KN",name:Object(n.c)("St. Kitts & Nevis"),prefix:"1"},{iso2:"LC",name:Object(n.c)("St. Lucia"),prefix:"1"},{iso2:"MF",name:Object(n.c)("St. Martin"),prefix:"590"},{iso2:"PM",name:Object(n.c)("St. Pierre & Miquelon"),prefix:"508"},{iso2:"VC",name:Object(n.c)("St. Vincent & Grenadines"),prefix:"1"},{iso2:"SD",name:Object(n.c)("Sudan"),prefix:"249"},{iso2:"SR",name:Object(n.c)("Suriname"),prefix:"597"},{iso2:"SJ",name:Object(n.c)("Svalbard & Jan Mayen"),prefix:"47"},{iso2:"SZ",name:Object(n.c)("Swaziland"),prefix:"268"},{iso2:"SE",name:Object(n.c)("Sweden"),prefix:"46"},{iso2:"CH",name:Object(n.c)("Switzerland"),prefix:"41"},{iso2:"SY",name:Object(n.c)("Syria"),prefix:"963"},{iso2:"ST",name:Object(n.c)("São Tomé & Príncipe"),prefix:"239"},{iso2:"TW",name:Object(n.c)("Taiwan"),prefix:"886"},{iso2:"TJ",name:Object(n.c)("Tajikistan"),prefix:"992"},{iso2:"TZ",name:Object(n.c)("Tanzania"),prefix:"255"},{iso2:"TH",name:Object(n.c)("Thailand"),prefix:"66"},{iso2:"TL",name:Object(n.c)("Timor-Leste"),prefix:"670"},{iso2:"TG",name:Object(n.c)("Togo"),prefix:"228"},{iso2:"TK",name:Object(n.c)("Tokelau"),prefix:"690"},{iso2:"TO",name:Object(n.c)("Tonga"),prefix:"676"},{iso2:"TT",name:Object(n.c)("Trinidad & Tobago"),prefix:"1"},{iso2:"TN",name:Object(n.c)("Tunisia"),prefix:"216"},{iso2:"TR",name:Object(n.c)("Turkey"),prefix:"90"},{iso2:"TM",name:Object(n.c)("Turkmenistan"),prefix:"993"},{iso2:"TC",name:Object(n.c)("Turks & Caicos Islands"),prefix:"1"},{iso2:"TV",name:Object(n.c)("Tuvalu"),prefix:"688"},{iso2:"VI",name:Object(n.c)("U.S. Virgin Islands"),prefix:"1"},{iso2:"UG",name:Object(n.c)("Uganda"),prefix:"256"},{iso2:"UA",name:Object(n.c)("Ukraine"),prefix:"380"},{iso2:"AE",name:Object(n.c)("United Arab Emirates"),prefix:"971"},{iso2:"UY",name:Object(n.c)("Uruguay"),prefix:"598"},{iso2:"UZ",name:Object(n.c)("Uzbekistan"),prefix:"998"},{iso2:"VU",name:Object(n.c)("Vanuatu"),prefix:"678"},{iso2:"VA",name:Object(n.c)("Vatican City"),prefix:"39"},{iso2:"VE",name:Object(n.c)("Venezuela"),prefix:"58"},{iso2:"VN",name:Object(n.c)("Vietnam"),prefix:"84"},{iso2:"WF",name:Object(n.c)("Wallis & Futuna"),prefix:"681"},{iso2:"EH",name:Object(n.c)("Western Sahara"),prefix:"212"},{iso2:"YE",name:Object(n.c)("Yemen"),prefix:"967"},{iso2:"ZM",name:Object(n.c)("Zambia"),prefix:"260"},{iso2:"ZW",name:Object(n.c)("Zimbabwe"),prefix:"263"}]},904:function(e,t,a){"use strict";var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(139),l=a(200),c=a(121);class d extends s.PureComponent{constructor(){super(...arguments),i()(this,"validate",Object(l.a)({rules:[{key:"required",test:e=>{let{value:t,allowEmpty:a}=e;return a||!!t},invalid:()=>Object(c.a)(this.props.labelRequired)},{key:"match",test:e=>{let{value:t}=e;return!t||t===this.props.password},invalid:()=>Object(c.a)(this.props.labelInvalid)}]})),i()(this,"onValidate",(async e=>{const t=await this.validate(e);return this.props.onValidate&&this.props.onValidate(t),t}))}render(){return r.a.createElement(o.a,{id:this.props.id,ref:this.props.fieldRef,type:"password",label:Object(c.a)(this.props.label),autoComplete:this.props.autoComplete,value:this.props.value,onChange:this.props.onChange,onValidate:this.onValidate})}}i()(d,"defaultProps",{label:Object(c.c)("Confirm password"),labelRequired:Object(c.c)("Confirm password"),labelInvalid:Object(c.c)("Passwords don't match")}),t.a=d},905:function(e,t,a){"use strict";(function(e){a.d(t,"a",(function(){return m}));var n=a(13),i=a.n(n),s=a(10),r=a(1),o=a(16),l=a(490),c=a(193);const d=new s.UnstableValue("http.v1","org.matrix.msc3886.http.v1");class m{constructor(e){let{onFailure:t,client:a,fallbackRzServer:n,fetchFn:s}=e;i()(this,"uri",void 0),i()(this,"etag",void 0),i()(this,"expiresAt",void 0),i()(this,"client",void 0),i()(this,"fallbackRzServer",void 0),i()(this,"fetchFn",void 0),i()(this,"cancelled",!1),i()(this,"_ready",!1),i()(this,"onFailure",void 0),this.fetchFn=s,this.onFailure=t,this.client=a,this.fallbackRzServer=n}get ready(){return this._ready}async details(){if(!this.uri)throw new Error("Rendezvous not set up");return{type:d.name,uri:this.uri}}fetch(t,a){return this.fetchFn?this.fetchFn(t,a):e.fetch(t,a)}async getPostEndpoint(){try{if(await this.client.doesServerSupportUnstableFeature("org.matrix.msc3886"))return`${this.client.baseUrl}${c.a.Unstable}/org.matrix.msc3886/rendezvous`}catch(e){r.a.warn("Failed to get unstable features",e)}return this.fallbackRzServer}async send(e){var t,a;if(this.cancelled)return;const n=this.uri?"PUT":"POST",i=null!==(t=this.uri)&&void 0!==t?t:await this.getPostEndpoint();if(!i)throw new Error("Invalid rendezvous URI");const s={"content-type":"application/json"};this.etag&&(s["if-match"]=this.etag);const r=await this.fetch(i,{method:n,headers:s,body:JSON.stringify(e)});if(404===r.status)return this.cancel(l.c.Unknown);if(this.etag=null!==(a=r.headers.get("etag"))&&void 0!==a?a:void 0,"POST"===n){var o;const e=r.headers.get("location");if(!e)throw new Error("No rendezvous URI given");const t=r.headers.get("expires");t&&(this.expiresAt=new Date(t));const a=null!==(o=r.url)&&void 0!==o?o:i;this.uri=new URL(e,`${a}${a.endsWith("/")?"":"/"}`).href,this._ready=!0}}async receive(){if(!this.uri)throw new Error("Rendezvous not set up");for(;;){if(this.cancelled)return;const a={};this.etag&&(a["if-none-match"]=this.etag);const n=await this.fetch(this.uri,{method:"GET",headers:a});if(404===n.status)return void this.cancel(l.c.Unknown);var e;if("application/json"!==n.headers.get("content-type"))this.etag=null!==(e=n.headers.get("etag"))&&void 0!==e?e:void 0;else if(200===n.status){var t;return this.etag=null!==(t=n.headers.get("etag"))&&void 0!==t?t:void 0,n.json()}await Object(o.N)(1e3)}}async cancel(e){var t;if(e===l.c.Unknown&&this.expiresAt&&this.expiresAt.getTime()<Date.now()&&(e=l.c.Expired),this.cancelled=!0,this._ready=!1,null===(t=this.onFailure)||void 0===t||t.call(this,e),this.uri&&e===l.c.UserDeclined)try{await this.fetch(this.uri,{method:"DELETE"})}catch(e){r.a.warn(e)}}}}).call(this,a(14))},906:function(e,t,a){"use strict";(function(e){a.d(t,"a",(function(){return d}));var n=a(13),i=a.n(n),s=a(490),r=a(199),o=a(418),l=a(670);const c=new(a(15).c)("m.rendezvous.v2.curve25519-aes-sha256","org.matrix.msc3903.rendezvous.v2.curve25519-aes-sha256");class d{constructor(t,a,n){this.transport=t,this.theirPublicKey=a,this.onFailure=n,i()(this,"olmSAS",void 0),i()(this,"ourPublicKey",void 0),i()(this,"aesKey",void 0),i()(this,"connected",!1),this.olmSAS=new e.Olm.SAS,this.ourPublicKey=Object(r.decodeBase64)(this.olmSAS.get_pubkey())}async generateCode(e){if(this.transport.ready)throw new Error("Code already generated");await this.transport.send({algorithm:c.name});return{rendezvous:{algorithm:c.name,key:Object(r.encodeUnpaddedBase64)(this.ourPublicKey),transport:await this.transport.details()},intent:e}}async connect(){if(this.connected)throw new Error("Channel already connected");if(!this.olmSAS)throw new Error("Channel closed");const e=!this.theirPublicKey;if(e){const e=await this.transport.receive();if(!e)throw new Error("No response from other device");const t=e,{key:a,algorithm:n}=t;if(!n||!c.matches(n)||!a)throw new s.b("Unsupported algorithm: "+n,s.c.UnsupportedAlgorithm);this.theirPublicKey=Object(r.decodeBase64)(a)}else await this.transport.send({algorithm:c.name,key:Object(r.encodeUnpaddedBase64)(this.ourPublicKey)});this.connected=!0,this.olmSAS.set_their_key(Object(r.encodeUnpaddedBase64)(this.theirPublicKey));const t=e?this.ourPublicKey:this.theirPublicKey,a=e?this.theirPublicKey:this.ourPublicKey;let n=c.name;n+=`|${Object(r.encodeUnpaddedBase64)(t)}`,n+=`|${Object(r.encodeUnpaddedBase64)(a)}`;const i=this.olmSAS.generate_bytes(n,32);this.aesKey=await async function(e){if(!o.c)throw new Error("Web Crypto is not available");return o.c.importKey("raw",e,{name:"AES-GCM"},!1,["encrypt","decrypt"])}(i),i.fill(0);const d=this.olmSAS.generate_bytes(n,5);return Object(l.a)(Array.from(d)).join("-")}async encrypt(e){if(!o.c)throw new Error("Web Crypto is not available");const t=new Uint8Array(32);o.b.getRandomValues(t);const a=(new o.a).encode(JSON.stringify(e)),n=await o.c.encrypt({name:"AES-GCM",iv:t,tagLength:128},this.aesKey,a);return{iv:Object(r.encodeUnpaddedBase64)(t),ciphertext:Object(r.encodeUnpaddedBase64)(n)}}async send(e){if(!this.olmSAS)throw new Error("Channel closed");if(!this.aesKey)throw new Error("Shared secret not set up");return this.transport.send(await this.encrypt(e))}async decrypt(e){let{iv:t,ciphertext:a}=e;if(!a||!t)throw new Error("Missing ciphertext and/or iv");const n=Object(r.decodeBase64)(a);if(!o.c)throw new Error("Web Crypto is not available");const i=await o.c.decrypt({name:"AES-GCM",iv:Object(r.decodeBase64)(t),tagLength:128},this.aesKey,n);return JSON.parse((new TextDecoder).decode(new Uint8Array(i)))}async receive(){if(!this.olmSAS)throw new Error("Channel closed");if(!this.aesKey)throw new Error("Shared secret not set up");const e=await this.transport.receive();if(!e)return;const t=e;if(t.ciphertext&&t.iv)return this.decrypt(t);throw new Error("Data received but no ciphertext")}async close(){this.olmSAS&&(this.olmSAS.free(),this.olmSAS=void 0)}async cancel(e){try{await this.transport.cancel(e)}finally{await this.close()}}}}).call(this,a(14))},907:function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));var n=a(120),i=a.n(n);class s extends i.a.PureComponent{render(){return i.a.createElement("div",{className:"mx_CompleteSecurityBody"},this.props.children)}}},908:function(e,t,a){"use strict";a.d(t,"a",(function(){return u}));var n=a(120),i=a.n(n),s=a(131),r=a(121),o=a(125),l=a(157),c=a(137),d=a(902);function m(e){var t;Object(r.e)()!==e&&(o.b.setValue("language",null,c.a.DEVICE,e),null===(t=l.a.get())||void 0===t||t.reload())}function u(e){let{disabled:t}=e;return s.b.get("disable_login_language_selector")?i.a.createElement("div",null):i.a.createElement(d.a,{className:"mx_AuthBody_language",onOptionChange:m,value:Object(r.e)(),disabled:t})}},931:function(e,t,a){"use strict";var n=a(120),i=a.n(n),s=a(123),r=a(121),o=a(243),l=a(131),c=a(127),d=a(13),m=a.n(d),u=a(321),h=a(1),p=a(349),g=a(135),v=a(139),b=a(258),f=a(200);class y extends i.a.PureComponent{constructor(e){super(e),m()(this,"defaultServer",void 0),m()(this,"fieldRef",Object(n.createRef)()),m()(this,"validatedConf",void 0),m()(this,"onDefaultChosen",(()=>{this.setState({defaultChosen:!0})})),m()(this,"onOtherChosen",(()=>{this.setState({defaultChosen:!1})})),m()(this,"onHomeserverChange",(e=>{this.setState({otherHomeserver:e.target.value})})),m()(this,"validate",Object(f.a)({deriveData:async e=>{let{value:t}=e,a=t.trim();if(!a.includes("://"))try{const e=await u.a.findClientConfig(a);return this.validatedConf=p.a.buildValidatedConfigFromDiscovery(a,e),{}}catch(e){h.a.error(`Attempted ${a} as a server_name but it failed`,e)}a.includes("://")||(a="https://"+a);try{return this.validatedConf=await p.a.validateServerConfigWithStaticUrls(a),{}}catch(e){h.a.error(e);if(p.a.authComponentStateForError(e).serverErrorIsFatal){let t=Object(r.a)("Unable to validate homeserver");return e.translatedMessage&&(t=e.translatedMessage),{error:t}}try{return this.validatedConf=await p.a.validateServerConfigWithStaticUrls(a,null,!0),{}}catch(e){return h.a.error(e),{error:Object(r.a)("Invalid URL")}}}},rules:[{key:"required",test:e=>{let{value:t,allowEmpty:a}=e;return a||!!t},invalid:()=>Object(r.a)("Specify a homeserver")},{key:"valid",test:async function(e,t){let{value:a}=e,{error:n}=t;return!a||!n},invalid:function(e){let{error:t}=e;return t}}]})),m()(this,"onHomeserverValidate",(e=>this.validate(e))),m()(this,"onSubmit",(async e=>{e.preventDefault();if(!await this.fieldRef.current.validate({allowEmpty:!1})&&!this.state.defaultChosen)return this.fieldRef.current.focus(),void this.fieldRef.current.validate({allowEmpty:!1,focused:!0});this.props.onFinished(this.state.defaultChosen?this.defaultServer:this.validatedConf)}));const t=l.b.get();this.defaultServer=t.validated_server_config;const{serverConfig:a}=this.props;let i="";a.isDefault||(i=a.isNameResolvable&&a.hsName?a.hsName:a.hsUrl),this.state={defaultChosen:a.isDefault,otherHomeserver:i}}render(){let e;"matrix.org"===this.defaultServer.hsName&&(e=Object(r.a)("Matrix.org is the biggest public homeserver in the world, so it's a good place for many."));let t=this.defaultServer.hsName;return this.defaultServer.hsNameIsDifferent&&(t=i.a.createElement(o.a,{class:"mx_Login_underlinedServerName",tooltip:this.defaultServer.hsUrl},this.defaultServer.hsName)),i.a.createElement(g.a,{title:this.props.title||Object(r.a)("Sign into your homeserver"),className:"mx_ServerPickerDialog",contentId:"mx_ServerPickerDialog",onFinished:this.props.onFinished,fixedWidth:!1,hasCancel:!0},i.a.createElement("form",{className:"mx_Dialog_content",id:"mx_ServerPickerDialog",onSubmit:this.onSubmit},i.a.createElement("p",null,Object(r.a)("We call the places where you can host your account 'homeservers'.")," ",e),i.a.createElement(b.a,{name:"defaultChosen",value:"true",checked:this.state.defaultChosen,onChange:this.onDefaultChosen},t),i.a.createElement(b.a,{name:"defaultChosen",value:"false",className:"mx_ServerPickerDialog_otherHomeserverRadio",checked:!this.state.defaultChosen,onChange:this.onOtherChosen,childrenInLabel:!1,"aria-label":Object(r.a)("Other homeserver")},i.a.createElement(v.a,{type:"text",className:"mx_ServerPickerDialog_otherHomeserver",label:Object(r.a)("Other homeserver"),onChange:this.onHomeserverChange,onFocus:this.onOtherChosen,ref:this.fieldRef,onValidate:this.onHomeserverValidate,value:this.state.otherHomeserver,validateOnChange:!1,validateOnFocus:!1,autoFocus:!0,id:"mx_homeserverInput"})),i.a.createElement("p",null,Object(r.a)("Use your preferred Matrix homeserver if you have one, or host your own.")),i.a.createElement(s.a,{className:"mx_ServerPickerDialog_continue",kind:"primary",onClick:this.onSubmit},Object(r.a)("Continue")),i.a.createElement("h2",null,Object(r.a)("Learn more")),i.a.createElement("a",{href:"https://matrix.org/faq/#what-is-a-homeserver%3F",target:"_blank",rel:"noreferrer noopener"},Object(r.a)("About homeservers"))))}}var E=a(213);const _=()=>{const e=l.b.get().brand;c.b.createDialog(E.a,{title:Object(r.a)("Server Options"),description:Object(r.a)("You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use %(brand)s with an existing Matrix account on a different homeserver.",{brand:e}),button:Object(r.a)("Dismiss"),hasCloseButton:!1,fixedWidth:!1},"mx_ServerPicker_helpDialog")};t.a=e=>{let{title:t,dialogTitle:a,serverConfig:n,onServerConfigChange:d}=e;const m=l.b.get("disable_custom_urls");let u;if(!m&&d){const e=()=>{((e,t,a)=>{c.b.createDialog(y,{title:e,serverConfig:t,onFinished:a})})(a,n,(e=>{e&&d(e)}))};u=i.a.createElement(s.a,{className:"mx_ServerPicker_change",kind:"link",onClick:e},Object(r.a)("Edit"))}let h,p=n.isNameResolvable?n.hsName:n.hsUrl;return n.hsNameIsDifferent&&(p=i.a.createElement(o.a,{class:"mx_Login_underlinedServerName",tooltip:n.hsUrl},n.hsName)),"matrix.org"===n.hsName&&(h=i.a.createElement("span",{className:"mx_ServerPicker_desc"},Object(r.a)("Join millions for free on the largest public server"))),i.a.createElement("div",{className:"mx_ServerPicker"},i.a.createElement("h2",null,t||Object(r.a)("Homeserver")),m?null:i.a.createElement(s.a,{className:"mx_ServerPicker_help",onClick:_,"aria-label":Object(r.a)("Help")}),i.a.createElement("span",{className:"mx_ServerPicker_server",title:"string"==typeof p?p:void 0},p),u,h)}},941:function(e,t,a){"use strict";a.d(t,"a",(function(){return x}));var n=a(13),i=a.n(n),s=a(120),r=a.n(s),o=a(126),l=a.n(o),c=a(143),d=a(129),m=a(1),u=a(121),h=a(124),p=a(128),g=a(869),v=a(659);class b extends v.a{constructor(){super(...arguments),i()(this,"onClick",(e=>{e.preventDefault()}))}wrapImage(e,t){return t}render(){if(this.state.error)return super.render();const e=this.props.mxEvent.getContent(),t=this.messageContent(this.state.contentUrl,this.state.thumbUrl,e,44);return r.a.createElement("div",{className:"mx_MImageReplyBody"},t)}}var f=a(180),y=a(622),E=a(338),_=a(172),w=a(835),S=a(238);function O(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function C(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?O(Object(a),!0).forEach((function(t){i()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):O(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}class x extends r.a.PureComponent{constructor(){super(...arguments),i()(this,"anchorElement",Object(s.createRef)()),i()(this,"onDecrypted",(()=>{this.forceUpdate(),this.props.onHeightChanged&&this.props.onHeightChanged()})),i()(this,"onEventRequiresUpdate",(()=>{this.forceUpdate()})),i()(this,"onClick",(e=>{const t=e.target;"a"===t.tagName.toLowerCase()&&null!==t.closest("a")&&t!==this.anchorElement.current||(e.preventDefault(),this.props.toggleExpandedQuote&&e.shiftKey?this.props.toggleExpandedQuote():h.a.dispatch({action:p.a.ViewRoom,event_id:this.props.mxEvent.getId(),highlighted:!0,room_id:this.props.mxEvent.getRoomId(),metricsTrigger:void 0}))}))}componentDidMount(){this.props.mxEvent.on(c.c.Decrypted,this.onDecrypted),this.props.mxEvent.on(c.c.BeforeRedaction,this.onEventRequiresUpdate),this.props.mxEvent.on(c.c.Replaced,this.onEventRequiresUpdate)}componentWillUnmount(){this.props.mxEvent.removeListener(c.c.Decrypted,this.onDecrypted),this.props.mxEvent.removeListener(c.c.BeforeRedaction,this.onEventRequiresUpdate),this.props.mxEvent.removeListener(c.c.Replaced,this.onEventRequiresUpdate)}render(){const e=this.props.mxEvent,t=e.getContent().msgtype,a=e.getType(),{hasRenderer:n,isInfoMessage:i,isSeeingThroughMessageHiddenForModeration:s}=Object(y.a)(e,!1);if(!n){const{mxEvent:e}=this.props;return m.a.warn(`Event type not supported: type:${e.getType()} isState:${e.isState()}`),r.a.createElement("div",{className:"mx_ReplyTile mx_ReplyTile_info mx_MNoticeBody"},Object(u.a)("This event could not be displayed"))}const o=l()("mx_ReplyTile",{mx_ReplyTile_inline:t===d.e.Emote,mx_ReplyTile_info:i&&!e.isRedacted(),mx_ReplyTile_audio:t===d.e.Audio,mx_ReplyTile_video:t===d.e.Video});let c,h="#";this.props.permalinkCreator&&(h=this.props.permalinkCreator.forEvent(e.getId()));i||a===d.b.RoomCreate||(c=r.a.createElement("div",{className:"mx_ReplyTile_sender"},r.a.createElement(_.b,{member:e.sender,fallbackUserId:e.getSender(),width:16,height:16}),r.a.createElement(g.a,{mxEvent:e})));const p={[d.e.Image]:b,[d.e.Audio]:Object(f.m)(e)?w.a:E.a,[d.e.Video]:E.a},v={[d.b.Sticker]:b};return r.a.createElement("div",{className:o},r.a.createElement("a",{href:h,onClick:this.onClick,ref:this.anchorElement},c,Object(S.f)(C(C({},this.props),{},{ref:void 0,showUrlPreview:!1,overrideBodyTypes:p,overrideEventTypes:v,maxImageHeight:96,isSeeingThroughMessageHiddenForModeration:s,highlights:this.props.highlights,highlightLink:this.props.highlightLink,onHeightChanged:this.props.onHeightChanged,permalinkCreator:this.props.permalinkCreator}),!1)))}}i()(x,"defaultProps",{onHeightChanged:()=>{}})}}]);
|