(window.webpackJsonp=window.webpackJsonp||[]).push([[14],{1018:function(e,t){},1030:function(e,t){},1366:function(e,t,n){var i={"./":[211,9],"./ICanvasEffect":[768,7,6],"./ICanvasEffect.ts":[768,7,6],"./confetti":[368,9,0],"./confetti/":[368,9,0],"./confetti/index":[368,9,0],"./confetti/index.ts":[368,9,0],"./effect":[769,7,7],"./effect.ts":[769,7,7],"./fireworks":[369,9,1],"./fireworks/":[369,9,1],"./fireworks/index":[369,9,1],"./fireworks/index.ts":[369,9,1],"./index":[211,9],"./index.ts":[211,9],"./snowfall":[370,9,2],"./snowfall/":[370,9,2],"./snowfall/index":[370,9,2],"./snowfall/index.ts":[370,9,2],"./spaceinvaders":[371,9,3],"./spaceinvaders/":[371,9,3],"./spaceinvaders/index":[371,9,3],"./spaceinvaders/index.ts":[371,9,3],"./utils":[306,9],"./utils.ts":[306,9]};function s(e){if(!n.o(i,e))return Promise.resolve().then((function(){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=i[e],s=t[0];return Promise.all(t.slice(2).map(n.e)).then((function(){return n.t(s,t[1])}))}s.keys=function(){return Object.keys(i)},s.id=1366,e.exports=s},1397:function(e,t,n){"use strict";t.a=n.p+"i18n/languages.7742306.json"},1398:function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return c}));var i=n(18),s=n.n(i);function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function a(e){for(var t=1;t{}),this.params=a(a({},r),e),this.icons=c.getIcons(),this.canvas=document.createElement("canvas"),this.baseImage=document.createElement("img");const t=this.icons[this.icons.length-1];t.hasAttribute("href")?(this.baseImage.setAttribute("crossOrigin","anonymous"),this.baseImage.onload=()=>{this.canvas.height=this.baseImage.height>0?this.baseImage.height:32,this.canvas.width=this.baseImage.width>0?this.baseImage.width:32,this.context=this.canvas.getContext("2d"),this.ready()},this.baseImage.setAttribute("src",t.getAttribute("href"))):(this.canvas.height=this.baseImage.height=32,this.canvas.width=this.baseImage.width=32,this.context=this.canvas.getContext("2d"),this.ready())}reset(){this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.context.drawImage(this.baseImage,0,0,this.canvas.width,this.canvas.height)}options(e,t){const n={n:"number"==typeof e?Math.abs(e):e,len:(""+e).length,x:.4,y:.4,w:.6,h:.6};return t.isUp&&(n.y<.6?n.y=n.y-.4:n.y=n.y-2*n.y+(1-n.w)),t.isLeft&&(n.x<.6?n.x=n.x-.4:n.x=n.x-2*n.x+(1-n.h)),n.x=this.canvas.width*n.x,n.y=this.canvas.height*n.y,n.w=this.canvas.width*n.w,n.h=this.canvas.height*n.h,n}circle(e,t){const n=a(a({},this.params),t),i=this.options(e,n);let s=!1;2===i.len?(i.x=i.x-.4*i.w,i.w=1.4*i.w,s=!0):i.len>=3&&(i.x=i.x-.65*i.w,i.w=1.65*i.w,s=!0),this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.context.drawImage(this.baseImage,0,0,this.canvas.width,this.canvas.height),this.context.beginPath();const o=Math.floor(i.h*(i.n>99?.85:1))+"px";if(this.context.font=`${n.fontWeight} ${o} ${n.fontFamily}`,this.context.textAlign="center",s?(this.context.moveTo(i.x+i.w/2,i.y),this.context.lineTo(i.x+i.w-i.h/2,i.y),this.context.quadraticCurveTo(i.x+i.w,i.y,i.x+i.w,i.y+i.h/2),this.context.lineTo(i.x+i.w,i.y+i.h-i.h/2),this.context.quadraticCurveTo(i.x+i.w,i.y+i.h,i.x+i.w-i.h/2,i.y+i.h),this.context.lineTo(i.x+i.h/2,i.y+i.h),this.context.quadraticCurveTo(i.x,i.y+i.h,i.x,i.y+i.h-i.h/2),this.context.lineTo(i.x,i.y+i.h/2),this.context.quadraticCurveTo(i.x,i.y,i.x+i.h/2,i.y)):this.context.arc(i.x+i.w/2,i.y+i.h/2,i.h/2,0,2*Math.PI),this.context.fillStyle=n.bgColor,this.context.fill(),this.context.closePath(),this.context.beginPath(),this.context.stroke(),this.context.fillStyle=n.textColor,"number"==typeof i.n&&i.n>999){const e=(i.n>9999?9:Math.floor(i.n/1e3))+"k+";this.context.fillText(e,Math.floor(i.x+i.w/2),Math.floor(i.y+i.h-.2*i.h))}else this.context.fillText(""+i.n,Math.floor(i.x+i.w/2),Math.floor(i.y+i.h-.15*i.h));this.context.closePath()}ready(){this.isReady||(this.isReady=!0,this.readyCb())}setIcon(t){e(()=>{this.setIconSrc(t.toDataURL("image/png"))})}setIconSrc(e){if(this.browser.ff||this.browser.opera){const t=this.icons[this.icons.length-1],n=window.document.createElement("link");this.icons=[n],n.setAttribute("rel","icon"),n.setAttribute("type","image/png"),window.document.getElementsByTagName("head")[0].appendChild(n),n.setAttribute("href",e),t.parentNode&&t.parentNode.removeChild(t)}else this.icons.forEach(t=>{t.setAttribute("href",e)})}badge(e,t){this.isReady?("string"==typeof e||e>0?this.circle(e,t):this.reset(),this.setIcon(this.canvas)):this.readyCb=()=>{this.badge(e,t)}}static getLinks(){const e=[],t=window.document.getElementsByTagName("head")[0].getElementsByTagName("link");for(let n=0;n{e.setAttribute("type","image/png")}),e}}}).call(this,n(165).setImmediate)},31:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var i=n(19),s=n.n(i);async function o(e=""){""===e||e.endsWith("/")||(e+="/");const t=a(`${e}config.${document.domain}.json`),n=a(e+"config.json");try{const e=await t;if(0===Object.keys(e).length)throw new Error;return e}catch(e){return await n}}function a(e){return new Promise((function(t,n){s()({method:"GET",url:e,qs:{cachebuster:Date.now()}},(e,i,s)=>{try{if(e||i.status<200||i.status>=300)return i&&(404==i.status||0==i.status&&""==s)&&t({}),void n({err:e,response:i});t(JSON.parse(s))}catch(e){n({err:e})}})}))}},612:function(e,t){},86:function(e,t,n){"use strict";n.r(t),n.d(t,"rageshakePromise",(function(){return $})),n.d(t,"preparePlatform",(function(){return z})),n.d(t,"setupLogStorage",(function(){return Q})),n.d(t,"loadConfig",(function(){return J})),n.d(t,"loadOlm",(function(){return Y})),n.d(t,"loadLanguage",(function(){return X})),n.d(t,"loadSkin",(function(){return Z})),n.d(t,"loadTheme",(function(){return ee})),n.d(t,"loadApp",(function(){return te})),n.d(t,"showError",(function(){return ne})),n.d(t,"showIncompatibleBrowser",(function(){return ie})),n.d(t,"_t",(function(){return se}));var i=n(780),s=n(781),o=n.n(s),a=n(151),r=n(87),c=n.n(r),l=n(88),d=n(94),u=n(18),h=n.n(u),p=n(272),g=n(31),f=n(1398);class w extends p.e{constructor(...e){super(...e),h()(this,"_favicon",void 0)}async getConfig(){return Object(g.a)()}getHumanReadableName(){return"Vector Base Platform"}get favicon(){return this._favicon?this._favicon:this._favicon=new f.a}_updateFavicon(){let e="#d00",t=this.notificationCount;this.errorDidOccur&&(t=t||"×",e="#f00"),this.favicon.badge(t,{bgColor:e})}setNotificationCount(e){this.notificationCount!==e&&(super.setNotificationCount(e),this._updateFavicon())}setErrorStatus(e){this.errorDidOccur!==e&&(super.setErrorStatus(e),this._updateFavicon())}startUpdater(){}getDefaultDeviceDisplayName(){return Object(l.a)("Unknown device")}}var y=n(1399),m=n(93),b=n(98),v=n(477),C=n(95),x=n(232),O=n(125),E=n(488),I=n(106),_=n(174),k=n(100),A=n(486),S=n(143),j=n(761);function P(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}const T=window.electron,N=navigator.platform.toUpperCase().includes("MAC");function D(e){["call_state"].includes(e.action)&&T.send("app_onAction",e)}class U extends y.a{constructor(){super(),h()(this,"pendingIpcCalls",{}),h()(this,"nextIpcCallId",0),h()(this,"_onIpcReply",(e,t)=>{if(void 0===t.id)return void console.warn("Ignoring IPC reply with no ID");if(void 0===this.pendingIpcCalls[t.id])return void console.warn("Unknown IPC payload ID: "+t.id);const n=this.pendingIpcCalls[t.id];delete this.pendingIpcCalls[t.id],t.error?n.reject(t.error):n.resolve(t.reply)}),T.on("seshatReply",this._onIpcReply)}async _ipcCall(e,...t){const n=++this.nextIpcCallId;return new Promise((i,s)=>{this.pendingIpcCalls[n]={resolve:i,reject:s},window.electron.send("seshat",{id:n,name:e,args:t})})}async supportsEventIndexing(){return this._ipcCall("supportsEventIndexing")}async initEventIndex(e,t){return this._ipcCall("initEventIndex",e,t)}async addEventToIndex(e,t){return this._ipcCall("addEventToIndex",e,t)}async deleteEvent(e){return this._ipcCall("deleteEvent",e)}async isEventIndexEmpty(){return this._ipcCall("isEventIndexEmpty")}async isRoomIndexed(e){return this._ipcCall("isRoomIndexed",e)}async commitLiveEvents(){return this._ipcCall("commitLiveEvents")}async searchEventIndex(e){return this._ipcCall("searchEventIndex",e)}async addHistoricEvents(e,t,n){return this._ipcCall("addHistoricEvents",e,t,n)}async addCrawlerCheckpoint(e){return this._ipcCall("addCrawlerCheckpoint",e)}async removeCrawlerCheckpoint(e){return this._ipcCall("removeCrawlerCheckpoint",e)}async loadFileEvents(e){return this._ipcCall("loadFileEvents",e)}async loadCheckpoints(){return this._ipcCall("loadCheckpoints")}async closeEventIndex(){return this._ipcCall("closeEventIndex")}async getStats(){return this._ipcCall("getStats")}async getUserVersion(){return this._ipcCall("getUserVersion")}async setUserVersion(e){return this._ipcCall("setUserVersion",e)}async deleteEventIndex(){return this._ipcCall("deleteEventIndex")}}class R extends w{constructor(){super(),h()(this,"eventIndexManager",new U),h()(this,"pendingIpcCalls",{}),h()(this,"nextIpcCallId",0),h()(this,"ssoID",Object(_.b)(32)),h()(this,"onUpdateDownloaded",async(e,{releaseNotes:t,releaseName:n})=>{m.a.dispatch({action:k.a.CheckUpdates,status:p.d.Ready}),this.shouldShowUpdate(n)&&Object(A.b)(await this.getAppVersion(),n,t)}),h()(this,"_onIpcReply",(e,t)=>{if(void 0===t.id)return void console.warn("Ignoring IPC reply with no ID");if(void 0===this.pendingIpcCalls[t.id])return void console.warn("Unknown IPC payload ID: "+t.id);const n=this.pendingIpcCalls[t.id];delete this.pendingIpcCalls[t.id],t.error?n.reject(t.error):n.resolve(t.reply)}),m.a.register(D),T.on("check_updates",(e,t)=>{m.a.dispatch(function(e){for(var t=1;t{m.a.fire(k.a.ViewUserSettings)}),T.on("userDownloadCompleted",(e,{path:t,name:n})=>{S.a.sharedInstance().addOrReplaceToast({key:"DOWNLOAD_TOAST_"+t,title:Object(l.a)("Download Completed"),props:{description:n,acceptLabel:Object(l.a)("Open"),onAccept:()=>{T.send("userDownloadOpen",{path:t})},dismissLabel:Object(l.a)("Dismiss"),numSeconds:10},component:j.a,priority:99})}),N?(Object(E.c)(E.a.NAVIGATION,{keybinds:[{modifiers:[E.b.COMMAND],key:I.a.COMMA}],description:Object(l.b)("Open user settings")}),Object(E.c)(E.a.NAVIGATION,{keybinds:[{modifiers:[E.b.COMMAND],key:I.a.SQUARE_BRACKET_LEFT},{modifiers:[E.b.COMMAND],key:I.a.SQUARE_BRACKET_RIGHT}],description:Object(l.b)("Previous/next recently visited room or community")})):Object(E.c)(E.a.NAVIGATION,{keybinds:[{modifiers:[E.b.ALT],key:I.a.ARROW_LEFT},{modifiers:[E.b.ALT],key:I.a.ARROW_RIGHT}],description:Object(l.b)("Previous/next recently visited room or community")}),this._ipcCall("startSSOFlow",this.ssoID)}async getConfig(){return this._ipcCall("getConfig")}getHumanReadableName(){return"Electron Platform"}supportsMultiLanguageSpellCheck(){return!N}setNotificationCount(e){this.notificationCount!==e&&(super.setNotificationCount(e),T.send("setBadgeCount",e))}supportsNotifications(){return!0}maySendNotifications(){return!0}displayNotification(e,t,n,i){navigator.userAgent.includes("Linux")&&(t=t.replace(//g,">"));const s={body:t,silent:!0};n&&(s.icon=n);const o=new window.Notification(e,s);return o.onclick=()=>{m.a.dispatch({action:"view_room",room_id:i.roomId}),window.focus(),this._ipcCall("focusWindow")},o}loudNotification(e,t){T.send("loudNotification")}async getAppVersion(){return this._ipcCall("getAppVersion")}supportsAutoLaunch(){return!0}async getAutoLaunchEnabled(){return this._ipcCall("getAutoLaunchEnabled")}async setAutoLaunchEnabled(e){return this._ipcCall("setAutoLaunchEnabled",e)}supportsWarnBeforeExit(){return!0}async shouldWarnBeforeExit(){return this._ipcCall("shouldWarnBeforeExit")}async setWarnBeforeExit(e){return this._ipcCall("setWarnBeforeExit",e)}supportsAutoHideMenuBar(){return!N}async getAutoHideMenuBarEnabled(){return this._ipcCall("getAutoHideMenuBarEnabled")}async setAutoHideMenuBarEnabled(e){return this._ipcCall("setAutoHideMenuBarEnabled",e)}supportsMinimizeToTray(){return!N}async getMinimizeToTrayEnabled(){return this._ipcCall("getMinimizeToTrayEnabled")}async setMinimizeToTrayEnabled(e){return this._ipcCall("setMinimizeToTrayEnabled",e)}async canSelfUpdate(){const e=await this._ipcCall("getUpdateFeedUrl");return Boolean(e)}startUpdateCheck(){super.startUpdateCheck(),T.send("check_updates")}installUpdate(){T.send("install_update")}getDefaultDeviceDisplayName(){const e=b.a.get().brand;return Object(l.a)("%(brand)s Desktop (%(platformName)s)",{brand:e,platformName:navigator.userAgent.includes("Macintosh")?"macOS":navigator.userAgent.includes("FreeBSD")?"FreeBSD":navigator.userAgent.includes("OpenBSD")?"OpenBSD":navigator.userAgent.includes("SunOS")?"SunOS":navigator.userAgent.includes("Windows")?"Windows":navigator.userAgent.includes("Linux")?"Linux":"Unknown"})}screenCaptureErrorString(){return null}requestNotificationPermission(){return Promise.resolve("granted")}reload(){window.location.reload(!1)}async _ipcCall(e,...t){const n=++this.nextIpcCallId;return new Promise((i,s)=>{this.pendingIpcCalls[n]={resolve:i,reject:s},window.electron.send("ipcCall",{id:n,name:e,args:t})})}getEventIndexingManager(){return this.eventIndexManager}async setLanguage(e){return this._ipcCall("setLanguage",e)}setSpellCheckLanguages(e){this._ipcCall("setSpellCheckLanguages",e).catch(e=>{console.log("Failed to send setSpellCheckLanguages IPC to Electron"),console.error(e)})}async getSpellCheckLanguages(){return this._ipcCall("getSpellCheckLanguages")}async getAvailableSpellCheckLanguages(){return this._ipcCall("getAvailableSpellCheckLanguages")}getSSOCallbackUrl(e){const t=super.getSSOCallbackUrl(e);return t.protocol="element",t.searchParams.set("element-desktop-ssoid",this.ssoID),t}startSingleSignOn(e,t,n,i){super.startSingleSignOn(e,t,n,i),C.a.createTrackedDialog("Electron","SSO",x.a,{title:Object(l.a)("Go to your browser to complete Sign In"),description:c.a.createElement(O.a,null)})}_navigateForwardBack(e){this._ipcCall(e?"navigateBack":"navigateForward")}onKeyDown(e){let t=!1;switch(e.key){case I.a.SQUARE_BRACKET_LEFT:case I.a.SQUARE_BRACKET_RIGHT:!N||!e.metaKey||e.altKey||e.ctrlKey||e.shiftKey||(this._navigateForwardBack(e.key===I.a.SQUARE_BRACKET_LEFT),t=!0);break;case I.a.ARROW_LEFT:case I.a.ARROW_RIGHT:N||!e.altKey||e.metaKey||e.ctrlKey||e.shiftKey||(this._navigateForwardBack(e.key===I.a.ARROW_LEFT),t=!0)}return t}async getPickleKey(e,t){try{return await this._ipcCall("getPickleKey",e,t)}catch(e){return null}}async createPickleKey(e,t){try{return await this._ipcCall("createPickleKey",e,t)}catch(e){return null}}async destroyPickleKey(e,t){try{await this._ipcCall("destroyPickleKey",e,t)}catch(e){}}}var L=n(19),B=n.n(L),M=n(1400),F=n.n(M);function W(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}class V extends w{constructor(){super(),h()(this,"runningVersion",null),h()(this,"pollForUpdate",()=>this._getVersion().then(e=>{if(null===this.runningVersion)this.runningVersion=e;else{if(this.runningVersion!==e)return this.shouldShowUpdate(e)&&Object(A.b)(this.runningVersion,e),{status:p.d.Ready};Object(A.a)()}return{status:p.d.NotAvailable}},e=>(console.error("Failed to poll for update",e),{status:p.d.Error,detail:e.message||e.status?e.status.toString():"Unknown Error"}))),"serviceWorker"in navigator&&navigator.serviceWorker.register("sw.js")}getHumanReadableName(){return"Web Platform"}supportsNotifications(){return Boolean(window.Notification)}maySendNotifications(){return"granted"===window.Notification.permission}requestNotificationPermission(){return new Promise((function(e,t){window.Notification.requestPermission(t=>{e(t)})}))}displayNotification(e,t,n,i){const s={body:t,tag:"vector",silent:!0};n&&(s.icon=n);const o=new window.Notification(e,s);return o.onclick=function(){m.a.dispatch({action:"view_room",room_id:i.roomId}),window.focus(),o.close()},o}_getVersion(){return new Promise((function(e,t){B()({method:"GET",url:"version",qs:{cachebuster:Date.now()}},(n,i,s)=>{if(n||i.status<200||i.status>=300)return null===n&&(n={status:i.status}),void t(n);const o=s.trim();e(o)})}))}getAppVersion(){return null!==this.runningVersion?Promise.resolve(this.runningVersion):this._getVersion()}startUpdater(){this.pollForUpdate(),setInterval(this.pollForUpdate,6e5)}async canSelfUpdate(){return!0}startUpdateCheck(){super.startUpdateCheck(),this.pollForUpdate().then(e=>{m.a.dispatch(function(e){for(var t=1;t{console.error("Failed to update PWA app badge",e)}))}}var H=n(113),q=n(264),G=n(475);window.mxSendRageshake=function(e,t){const n=b.a.get().bug_report_endpoint_url;n?(void 0===t&&(t=!0),e&&e.trim()?Object(G.a)(n,{userText:e,sendLogs:t,progressCallback:console.log.bind(console)}).then(()=>{console.log("Bug report sent!")},e=>{console.error(e)}):console.error("Cannot send a rageshake without a message - please tell us what went wrong")):console.error("Cannot send a rageshake - no bug_report_endpoint_url configured")};const $=function(){const e=v.d(!1);return e.then(()=>{console.log("Initialised rageshake."),console.log("To fix line numbers in Chrome: Meatball menu → Settings → Ignore list → Add /rageshake\\.js$"),window.addEventListener("beforeunload",e=>{console.log("element-web closing"),v.b()}),v.a()},e=>{console.error("Failed to initialise rageshake: "+e)}),e}();function z(){window.electron?(console.log("Using Electron platform"),H.a.set(new R)):window.matchMedia("(display-mode: standalone)").matches?(console.log("Using PWA platform"),H.a.set(new K)):(console.log("Using Web platform"),H.a.set(new V))}function Q(){return b.a.get().bug_report_endpoint_url?v.e():(console.warn("No bug report endpoint set - logs will not be persisted"),Promise.resolve())}async function J(){b.a.put(await H.a.get().getConfig()||{})}function Y(){return o.a.init({locateFile:()=>i.a}).then(()=>{console.log("Using WebAssembly Olm")}).catch(e=>(console.log("Failed to load Olm: trying legacy version",e),new Promise((e,t)=>{const n=document.createElement("script");n.src="olm_legacy.js",n.onload=e,n.onerror=t,document.body.appendChild(n)}).then(()=>window.Olm.init()).then(()=>{console.log("Using legacy Olm")}).catch(e=>{console.log("Both WebAssembly and asm.js Olm failed!",e)})))}async function X(){const e=d.b.getValue("language",null,!0);let t=[];e?t=[e]:l.e().forEach(e=>{t.push(...l.f(e))});try{await l.j(t),document.documentElement.setAttribute("lang",l.d())}catch(e){console.error("Unable to set language",e)}}async function Z(){console.log("Loading skin...");const[e,t]=await Promise.all([Promise.resolve().then(n.bind(null,90)),n.e(11).then(n.bind(null,1423))]);e.loadSkin(t),console.log("Skin loaded!")}async function ee(){Object(q.d)()}async function te(e){const t=await n.e(10).then(n.bind(null,1417));window.matrixChat=a.render(await t.loadApp(e),document.getElementById("matrixchat"))}async function ne(e,t){const i=(await n.e(12).then(n.bind(null,1418))).default;window.matrixChat=a.render(r.createElement(i,{title:e,messages:t}),document.getElementById("matrixchat"))}async function ie(e){const t=(await n.e(9).then(n.bind(null,1419))).default;window.matrixChat=a.render(r.createElement(t,{onAccept:e}),document.getElementById("matrixchat"))}const se=l.a}}]); //# sourceMappingURL=init.js.map