diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000000..6caffdb01b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,55 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + + + + + +### Description + +Describe here the problem that you are experiencing, or the feature you are requesting. + +### Steps to reproduce + +- For bugs, list the steps +- that reproduce the bug +- using hyphens as bullet points + +Describe how what happens differs from what you expected. + +Log: sent/not sent? + + + +### Version information + + + +- **Platform**: web (in-browser) or desktop? + +For the web app: + +- **Browser**: Chrome, Safari, Firefox? which version? +- **OS**: Windows, macOS, Ubuntu, Arch Linux, etc? +- **URL**: riot.im/develop / riot.im/app / somewhere else? If a private server, what version of riot-web? + +For the desktop app: + +- **OS**: Windows, macOS, Ubuntu, Arch Linux, etc? +- **Version**: 0.x.y diff --git a/.github/ISSUE_TEMPLATE/redesign_issue.md b/.github/ISSUE_TEMPLATE/redesign_issue.md new file mode 100644 index 0000000000..162d0a1285 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/redesign_issue.md @@ -0,0 +1,32 @@ +--- +name: Redesign Issue +about: Bugs, feedback or feature requests specifically associated with the Redesign + project (https://riot.im/experimental) +title: '' +labels: redesign +assignees: '' + +--- + + + +- **Browser**: Chrome, Safari, Firefox? which version? +- **OS**: Windows, macOS, Ubuntu, Arch Linux, etc? + +### Description + +Describe here the problem that you are experiencing, or the feature you are requesting. +Include screenshots if possible: you can drag and drop images below. + +### Steps to reproduce + +- For bugs, list the steps +- that reproduce the bug +- using hyphens as bullet points + +Describe how what happens differs from what you expected. + +Log: sent/not sent? diff --git a/.travis.yml b/.travis.yml index bc3fce38df..3b201c1e95 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,25 +11,18 @@ sudo: required language: node_js node_js: # make sure we work with a range of node versions. - # As of the time of writing: - # - 4.x is still in LTS (until April 2018), but some of our deps (notably - # extract-zip) don't work with it - # - 5.x has been EOLed for nearly a year. - # - 6.x is the active 'LTS' version - # - 7.x is no longer supported - # - 8.x is the current 'current' version (until October 2017) # - # see: https://github.com/nodejs/LTS/ - # - # anything before 6.3 ships with npm 3.9 or earlier, which had problems - # with symlinks in node_modules (see - # https://github.com/npm/npm/releases/tag/v3.10.0 'FIXES AND REFACTORING'). - - 6.3 - - 6 - - 7 + # Current status of node versions: https://github.com/nodejs/LTS/ + # We don't work with node 6 because it doesn't support package-lock + # files which we need to avoid the broken version of base-x + - 8 + - 10 addons: chrome: stable install: # clone the deps with depth 1: we know we will only ever need that one # commit. - - scripts/fetch-develop.deps.sh --depth 1 && npm install + - npm install && scripts/fetch-develop.deps.sh --depth 1 +script: + - npm run test + - npm run lint diff --git a/CHANGELOG.md b/CHANGELOG.md index a1688ff96d..ba5de17582 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,95 @@ +Changes in [0.17.9](https://github.com/vector-im/riot-web/releases/tag/v0.17.9) (2019-01-22) +============================================================================================ +[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.17.9-rc.1...v0.17.9) + + * Bugfix in react-sdk for setting DM rooms + +Changes in [0.17.9-rc.1](https://github.com/vector-im/riot-web/releases/tag/v0.17.9-rc.1) (2019-01-17) +====================================================================================================== +[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.17.8...v0.17.9-rc.1) + + * Merge develop into experimental + [\#8003](https://github.com/vector-im/riot-web/pull/8003) + * Electron: Load app from custom protocol + [\#7943](https://github.com/vector-im/riot-web/pull/7943) + * Fix the IndexedDB worker + [\#7920](https://github.com/vector-im/riot-web/pull/7920) + * Make clear that the Debian package is for desktop + [\#7919](https://github.com/vector-im/riot-web/pull/7919) + * Run the Desktop app in a sandbox + [\#7907](https://github.com/vector-im/riot-web/pull/7907) + * Update to new electron single instance API + [\#7908](https://github.com/vector-im/riot-web/pull/7908) + * Update the tests to match https://github.com/matrix-org/matrix-react- + sdk/pull/2340 + [\#7834](https://github.com/vector-im/riot-web/pull/7834) + +Changes in [0.17.8](https://github.com/vector-im/riot-web/releases/tag/v0.17.8) (2018-12-10) +============================================================================================ +[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.17.8-rc.1...v0.17.8) + + * No changes since rc.1 + +Changes in [0.17.8-rc.1](https://github.com/vector-im/riot-web/releases/tag/v0.17.8-rc.1) (2018-12-06) +====================================================================================================== +[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.17.7...v0.17.8-rc.1) + + * Update from Weblate. + [\#7784](https://github.com/vector-im/riot-web/pull/7784) + * Add a function to send a rageshake from the console + [\#7755](https://github.com/vector-im/riot-web/pull/7755) + * Re-apply "Run lint on travis builds and use modern node versions" + [\#7738](https://github.com/vector-im/riot-web/pull/7738) + * Revert "Run lint on travis builds and use modern node versions" + [\#7737](https://github.com/vector-im/riot-web/pull/7737) + * Run lint on travis builds and use modern node versions + [\#7490](https://github.com/vector-im/riot-web/pull/7490) + * Fix missing js-sdk logging + [\#7736](https://github.com/vector-im/riot-web/pull/7736) + * Add $accent-color-50pct as a CSS variable to the Status theme + [\#7710](https://github.com/vector-im/riot-web/pull/7710) + +Changes in [0.17.7](https://github.com/vector-im/riot-web/releases/tag/v0.17.7) (2018-11-22) +============================================================================================ +[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.17.6...v0.17.7) + + * Warning when crypto DB is too new to use. + * Fix missing entries from js-sdk in rageshake logs + +Changes in [0.17.6](https://github.com/vector-im/riot-web/releases/tag/v0.17.6) (2018-11-19) +============================================================================================ +[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.17.6-rc.2...v0.17.6) + + * No changes since rc.2 + +Changes in [0.17.6-rc.2](https://github.com/vector-im/riot-web/releases/tag/v0.17.6-rc.2) (2018-11-15) +====================================================================================================== +[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.17.6-rc.1...v0.17.6-rc.2) + + * Update to js-sdk 0.14 and react-sdk rc.2. rc.1 was broken as it was built against + js-sdk 0.13 which does not use the new Olm 3.0 API. + +Changes in [0.17.6-rc.1](https://github.com/vector-im/riot-web/releases/tag/v0.17.6-rc.1) (2018-11-15) +====================================================================================================== +[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.17.5...v0.17.6-rc.1) + + * Update from Weblate. + [\#7708](https://github.com/vector-im/riot-web/pull/7708) + * Add Japanese (#7599) + [\#7673](https://github.com/vector-im/riot-web/pull/7673) + * Allow Webpack dev server to listen to all interfaces + [\#7674](https://github.com/vector-im/riot-web/pull/7674) + * Remove the request-only stuff we don't need anymore + [\#7637](https://github.com/vector-im/riot-web/pull/7637) + * Correct the author of the electron app + [\#7615](https://github.com/vector-im/riot-web/pull/7615) + * Mock fs, tls, and net to support request in the browser + [\#7552](https://github.com/vector-im/riot-web/pull/7552) + * Update chokidar to transitively get newer fsevents + [\#7598](https://github.com/vector-im/riot-web/pull/7598) + * Support WebAssembly version of Olm + [\#7385](https://github.com/vector-im/riot-web/pull/7385) + Changes in [0.17.5](https://github.com/vector-im/riot-web/releases/tag/v0.17.5) (2018-11-13) ============================================================================================ [Full Changelog](https://github.com/vector-im/riot-web/compare/v0.17.4...v0.17.5) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 2a9bab5759..f084b474bd 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -1,4 +1,4 @@ Contributing code to Riot ========================= -Riot follows the same pattern as https://github.com/matrix-org/synapse/blob/master/CONTRIBUTING.rst. +Riot follows the same pattern as https://github.com/matrix-org/matrix-js-sdk/blob/master/CONTRIBUTING.rst. diff --git a/README.md b/README.md index 72def22803..6ef79cd434 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,8 @@ Note that Chrome does not allow microphone or webcam access for sites served over http (except localhost), so for working VoIP you will need to serve Riot over https. -### Installation Steps for Debian Stretch +### Desktop Installation for Debian Stretch + 1. Add the repository to your sources.list using either of the following two options: - Directly to sources.list: `echo "deb https://riot.im/packages/debian/ stretch main" | sudo tee -a /etc/apt/sources.list` - As a separate entry in sources.list.d: `echo "deb https://riot.im/packages/debian/ stretch main" | sudo tee /etc/apt/sources.list.d/riot.list` @@ -129,7 +130,7 @@ For a good example, see https://riot.im/develop/config.json 1. `brand`: String to pass to your homeserver when configuring email notifications, to let the homeserver know what email template to use when talking to you. 1. `integrations_ui_url`: URL to the web interface for the integrations server. The integrations - server is not Riot and normally not your Home Server either. The integration server settings + server is not Riot and normally not your homeserver either. The integration server settings may be left blank to disable integrations. 1. `integrations_rest_url`: URL to the REST interface for the integrations server. 1. `integrations_widgets_urls`: list of URLs to the REST interface for the widget integrations server. @@ -156,8 +157,6 @@ For a good example, see https://riot.im/develop/config.json 1. `whitelistedHSUrls`: a list of HS URLs to not redact from the analytics 1. `whitelistedISUrls`: a list of IS URLs to not redact from the analytics 1. `siteId`: The Piwik Site ID to use when sending analytics to the Piwik server configured above -1. `teamServerConfig`, `teamTokenMap`, `referralBaseUrl`: an obsolete precursor to communities - with referral tracking; please ignore it. 1. `welcomeUserId`: the user ID of a bot to invite whenever users register that can give them a tour diff --git a/docs/shortcuts.md b/docs/shortcuts.md new file mode 100644 index 0000000000..f29fc2bed5 --- /dev/null +++ b/docs/shortcuts.md @@ -0,0 +1,11 @@ +# Keyboard Shortcuts + +The modifier is Ctrl on Windows & Linux and on Mac. + +- Ctrl/+m - toggle markdown +- Ctrl/+d - toggle mic mute +- Ctrl/+e - toggle video on/off +- Ctrl/+k - jump to named room +- / - navigate within room list +- PageUp/PageDown - scroll timeline up/down +- Ctrl/+Home/End - jump to timeline start/end diff --git a/electron_app/package.json b/electron_app/package.json index f9076db096..4259efee99 100644 --- a/electron_app/package.json +++ b/electron_app/package.json @@ -2,7 +2,7 @@ "name": "riot-web", "productName": "Riot", "main": "src/electron-main.js", - "version": "0.17.5", + "version": "0.17.9", "description": "A feature-rich client for Matrix.org", "author": "New Vector Ltd.", "dependencies": { diff --git a/electron_app/src/electron-main.js b/electron_app/src/electron-main.js index 02fe98b4aa..04544693e6 100644 --- a/electron_app/src/electron-main.js +++ b/electron_app/src/electron-main.js @@ -2,6 +2,7 @@ Copyright 2016 Aviral Dasgupta Copyright 2016 OpenMarket Ltd Copyright 2017 Michael Telatynski <7t3chguy@gmail.com> +Copyright 2018 New Vector Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -23,17 +24,24 @@ const checkSquirrelHooks = require('./squirrelhooks'); if (checkSquirrelHooks()) return; const argv = require('minimist')(process.argv); -const {app, ipcMain, powerSaveBlocker, BrowserWindow, Menu} = require('electron'); +const {app, ipcMain, powerSaveBlocker, BrowserWindow, Menu, autoUpdater, protocol} = require('electron'); const AutoLaunch = require('auto-launch'); const ioHook = require('iohook'); +const path = require('path'); const tray = require('./tray'); const vectorMenu = require('./vectormenu'); const webContentsHandler = require('./webcontents-handler'); const updater = require('./updater'); +const { migrateFromOldOrigin } = require('./originMigrator'); const windowStateKeeper = require('electron-window-state'); +// boolean flag set whilst we are doing one-time origin migration +// We only serve the origin migration script while we're actually +// migrating to mitigate any risk of it being used maliciously. +let migratingOrigin = false; + if (argv['profile']) { app.setPath('userData', `${app.getPath('userData')}-${argv['profile']}`); } @@ -98,27 +106,75 @@ ipcMain.on('app_onAction', function(ev, payload) { } }); +autoUpdater.on('update-downloaded', (ev, releaseNotes, releaseName, releaseDate, updateURL) => { + if (!mainWindow) return; + // forward to renderer + mainWindow.webContents.send('update-downloaded', { + releaseNotes, + releaseName, + releaseDate, + updateURL, + }); +}); + +ipcMain.on('ipcCall', async function(ev, payload) { + if (!mainWindow) return; + + const args = payload.args || []; + let ret; + + switch (payload.name) { + case 'getUpdateFeedUrl': + ret = autoUpdater.getFeedURL(); + break; + case 'getAutoLaunchEnabled': + ret = launcher.isEnabled; + break; + case 'setAutoLaunchEnabled': + if (args[0]) { + launcher.enable(); + } else { + launcher.disable(); + } + break; + case 'getAppVersion': + ret = app.getVersion(); + break; + case 'focusWindow': + if (mainWindow.isMinimized()) { + mainWindow.restore(); + } else if (!mainWindow.isVisible()) { + mainWindow.show(); + } else { + mainWindow.focus(); + } + case 'origin_migrate': + migratingOrigin = true; + await migrateFromOldOrigin(); + migratingOrigin = false; + break; + default: + mainWindow.webContents.send('ipcReply', { + id: payload.id, + error: "Unknown IPC Call: " + payload.name, + }); + return; + } + + mainWindow.webContents.send('ipcReply', { + id: payload.id, + reply: ret, + }); +}); app.commandLine.appendSwitch('--enable-usermedia-screen-capturing'); -const shouldQuit = app.makeSingleInstance((commandLine, workingDirectory) => { - // If other instance launched with --hidden then skip showing window - if (commandLine.includes('--hidden')) return; - - // Someone tried to run a second instance, we should focus our window. - if (mainWindow) { - if (!mainWindow.isVisible()) mainWindow.show(); - if (mainWindow.isMinimized()) mainWindow.restore(); - mainWindow.focus(); - } -}); - -if (shouldQuit) { +const gotLock = app.requestSingleInstanceLock(); +if (!gotLock) { console.log('Other instance detected: exiting'); app.exit(); } - const launcher = new AutoLaunch({ name: vectorConfig.brand || 'Riot', isHidden: true, @@ -127,39 +183,12 @@ const launcher = new AutoLaunch({ }, }); -const settings = { - 'auto-launch': { - get: launcher.isEnabled, - set: function(bool) { - if (bool) { - return launcher.enable(); - } else { - return launcher.disable(); - } - }, - }, -}; - -ipcMain.on('settings_get', async function(ev) { - const data = {}; - - try { - await Promise.all(Object.keys(settings).map(async function (setting) { - data[setting] = await settings[setting].get(); - })); - - ev.sender.send('settings', data); - } catch (e) { - console.error(e); - } -}); - -ipcMain.on('settings_set', function(ev, key, value) { - console.log(key, value); - if (settings[key] && settings[key].set) { - settings[key].set(value); - } -}); +// Register the scheme the app is served from as 'standard' +// which allows things like relative URLs and IndexedDB to +// work. +// Also mark it as secure (ie. accessing resources from this +// protocol and HTTPS won't trigger mixed content warnings). +protocol.registerStandardSchemes(['vector'], {secure: true}); app.on('ready', () => { if (argv['devtools']) { @@ -176,6 +205,66 @@ app.on('ready', () => { } } + protocol.registerFileProtocol('vector', (request, callback) => { + if (request.method !== 'GET') { + callback({error: -322}); // METHOD_NOT_SUPPORTED from chromium/src/net/base/net_error_list.h + return null; + } + + const parsedUrl = new URL(request.url); + if (parsedUrl.protocol !== 'vector:') { + callback({error: -302}); // UNKNOWN_URL_SCHEME + return; + } + if (parsedUrl.host !== 'vector') { + callback({error: -105}); // NAME_NOT_RESOLVED + return; + } + + const target = parsedUrl.pathname.split('/'); + + // path starts with a '/' + if (target[0] !== '') { + callback({error: -6}); // FILE_NOT_FOUND + return; + } + + if (target[target.length - 1] == '') { + target[target.length - 1] = 'index.html'; + } + + let baseDir; + // first part of the path determines where we serve from + if (migratingOrigin && target[1] === 'origin_migrator_dest') { + // the origin migrator destination page + // (only the destination script needs to come from the + // custom protocol: the source part is loaded from a + // file:// as that's the origin we're migrating from). + baseDir = __dirname + "/../../origin_migrator/dest"; + } else if (target[1] === 'webapp') { + baseDir = __dirname + "/../../webapp"; + } else { + callback({error: -6}); // FILE_NOT_FOUND + return; + } + + // Normalise the base dir and the target path separately, then make sure + // the target path isn't trying to back out beyond its root + baseDir = path.normalize(baseDir); + + const relTarget = path.normalize(path.join(...target.slice(2))); + if (relTarget.startsWith('..')) { + callback({error: -6}); // FILE_NOT_FOUND + return; + } + const absTarget = path.join(baseDir, relTarget); + + callback({ + path: absTarget, + }); + }, (error) => { + if (error) console.error('Failed to register protocol') + }); if (vectorConfig['update_base_url']) { console.log(`Starting auto update with base URL: ${vectorConfig['update_base_url']}`); @@ -192,6 +281,7 @@ app.on('ready', () => { defaultHeight: 768, }); + const preloadScript = path.normalize(`${__dirname}/preload.js`); mainWindow = global.mainWindow = new BrowserWindow({ icon: iconPath, show: false, @@ -201,8 +291,20 @@ app.on('ready', () => { y: mainWindowState.y, width: mainWindowState.width, height: mainWindowState.height, + webPreferences: { + preload: preloadScript, + nodeIntegration: false, + sandbox: true, + enableRemoteModule: false, + // We don't use this: it's useful for the preload script to + // share a context with the main page so we can give select + // objects to the main page. The sandbox option isolates the + // main page from the background script. + contextIsolation: false, + webgl: false, + }, }); - mainWindow.loadURL(`file://${__dirname}/../../webapp/index.html`); + mainWindow.loadURL('vector://vector/webapp/'); Menu.setApplicationMenu(vectorMenu); // explicitly hide because setApplicationMenu on Linux otherwise shows... @@ -362,6 +464,18 @@ ipcMain.on('stop-listening-keys', () => { stopListeningKeys(); }); +app.on('second-instance', (ev, commandLine, workingDirectory) => { + // If other instance launched with --hidden then skip showing window + if (commandLine.includes('--hidden')) return; + + // Someone tried to run a second instance, we should focus our window. + if (mainWindow) { + if (!mainWindow.isVisible()) mainWindow.show(); + if (mainWindow.isMinimized()) mainWindow.restore(); + mainWindow.focus(); + } +}); + // Set the App User Model ID to match what the squirrel // installer uses for the shortcut icon. // This makes notifications work on windows 8.1 (and is diff --git a/electron_app/src/originMigrator.js b/electron_app/src/originMigrator.js new file mode 100644 index 0000000000..58bb0feb99 --- /dev/null +++ b/electron_app/src/originMigrator.js @@ -0,0 +1,62 @@ +/* +Copyright 2018 New Vector Ltd + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +const { BrowserWindow, ipcMain } = require('electron'); +const path = require('path'); + +async function migrateFromOldOrigin() { + console.log("Attempting to migrate data between origins"); + + // We can use the same preload script: we just need ipcRenderer exposed + const preloadScript = path.normalize(`${__dirname}/preload.js`); + await new Promise(resolve => { + const migrateWindow = new BrowserWindow({ + show: false, + webPreferences: { + preload: preloadScript, + nodeIntegration: false, + sandbox: true, + enableRemoteModule: false, + webgl: false, + }, + }); + ipcMain.on('origin_migration_complete', (e, success, sentSummary, storedSummary) => { + if (success) { + console.log("Origin migration completed successfully!"); + } else { + console.error("Origin migration failed!"); + } + console.error("Data sent", sentSummary); + console.error("Data stored", storedSummary); + migrateWindow.close(); + resolve(); + }); + ipcMain.on('origin_migration_nodata', (e) => { + console.log("No session to migrate from old origin"); + migrateWindow.close(); + resolve(); + }); + // Normalise the path because in the distribution, __dirname will be inside the + // electron asar. + const sourcePagePath = path.normalize(__dirname + '/../../origin_migrator/source.html'); + console.log("Loading path: " + sourcePagePath); + migrateWindow.loadURL('file://' + sourcePagePath); + }); +} + +module.exports = { + migrateFromOldOrigin, +}; diff --git a/src/vector/platform/index.js b/electron_app/src/preload.js similarity index 54% rename from src/vector/platform/index.js rename to electron_app/src/preload.js index 9071420015..3a4f7c9a4b 100644 --- a/src/vector/platform/index.js +++ b/electron_app/src/preload.js @@ -1,8 +1,5 @@ -// @flow - /* -Copyright 2016 Aviral Dasgupta -Copyright 2016 OpenMarket Ltd +Copyright 2018 New Vector Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,13 +14,16 @@ See the License for the specific language governing permissions and limitations under the License. */ -let Platform = null; +const { ipcRenderer, webFrame } = require('electron'); -if (window && window.process && window.process && window.process.type === 'renderer') { - // we're running inside electron - Platform = require('./ElectronPlatform'); -} else { - Platform = require('./WebPlatform'); -} +// expose ipcRenderer to the renderer process +window.ipcRenderer = ipcRenderer; -export default Platform; +// Allow the fetch API to load resources from this +// protocol: this is necessary to load olm.wasm. +// (Also mark it a secure although we've already +// done this in the main process). +webFrame.registerURLSchemeAsPrivileged('vector', { + secure: true, + supportFetchAPI: true, +}); diff --git a/electron_app/src/webcontents-handler.js b/electron_app/src/webcontents-handler.js index d566de515a..152361696e 100644 --- a/electron_app/src/webcontents-handler.js +++ b/electron_app/src/webcontents-handler.js @@ -1,10 +1,12 @@ const {clipboard, nativeImage, Menu, MenuItem, shell} = require('electron'); const url = require('url'); +const MAILTO_PREFIX = "mailto:"; + const PERMITTED_URL_SCHEMES = [ 'http:', 'https:', - 'mailto:', + MAILTO_PREFIX, ]; function safeOpenURL(target) { @@ -47,7 +49,7 @@ function onLinkContextMenu(ev, params) { if (params.mediaType && params.mediaType === 'image' && !url.startsWith('file://')) { popupMenu.append(new MenuItem({ - label: 'Copy Image', + label: 'Copy image', click() { if (url.startsWith('data:')) { clipboard.writeImage(nativeImage.createFromDataURL(url)); @@ -58,14 +60,24 @@ function onLinkContextMenu(ev, params) { })); } - // No point offerring to copy a blob: URL either + // No point offering to copy a blob: URL either if (!url.startsWith('blob:')) { - popupMenu.append(new MenuItem({ - label: 'Copy Link Address', - click() { - clipboard.writeText(url); - }, - })); + // Special-case e-mail URLs to strip the `mailto:` like modern browsers do + if (url.startsWith(MAILTO_PREFIX)) { + popupMenu.append(new MenuItem({ + label: 'Copy email address', + click() { + clipboard.writeText(url.substr(MAILTO_PREFIX.length)); + }, + })); + } else { + popupMenu.append(new MenuItem({ + label: 'Copy link address', + click() { + clipboard.writeText(url); + }, + })); + } } // popup() requires an options object even for no options popupMenu.popup({}); @@ -117,6 +129,18 @@ function onEditableContextMenu(ev, params) { module.exports = (webContents) => { webContents.on('new-window', onWindowOrNavigate); + // XXX: The below now does absolutely nothing because of + // https://github.com/electron/electron/issues/8841 + // Whilst this isn't a security issue since without + // node integration and with the sandbox, it should be + // no worse than opening the site in Chrome, it obviously + // means the user has to restart Riot to make it usable + // again (often unintuitive because it minimises to the + // system tray). We therefore need to be vigilant about + // putting target="_blank" on links in Riot (although + // we should generally be doing this anyway since links + // navigating you away from Riot in the browser is + // also annoying). webContents.on('will-navigate', onWindowOrNavigate); webContents.on('context-menu', function(ev, params) { diff --git a/origin_migrator/dest/browser-matrix.min.js b/origin_migrator/dest/browser-matrix.min.js new file mode 100644 index 0000000000..131dc4afcb --- /dev/null +++ b/origin_migrator/dest/browser-matrix.min.js @@ -0,0 +1,19 @@ +!function(){function e(t,r,n){function o(s,a){if(!r[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(i)return i(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=r[s]={exports:{}};t[s][0].call(l.exports,function(e){return o(t[s][1][e]||e)},l,l.exports,e,t,r,n)}return r[s].exports}for(var i="function"==typeof require&&require,s=0;s1?r-1:0),o=1;o0&&void 0!==arguments[0]&&arguments[0]&&(this.idBaseUrl.startsWith("http://")||this.idBaseUrl.startsWith("https://"))?this.idBaseUrl.split("://")[1]:this.idBaseUrl},o.prototype.getAccessToken=function(){return this._http.opts.accessToken||null},o.prototype.isLoggedIn=function(){return void 0!==this._http.opts.accessToken},o.prototype.makeTxnId=function(){return"m"+(new Date).getTime()+"."+this._txnCtr++},o.prototype.isUsernameAvailable=function(e){return this._http.authedRequest(void 0,"GET","/register/available",{username:e}).then(function(e){return e.available})},o.prototype.register=function(e,t,r,n,o,i,s){!0===o?o={email:!0}:null!==o&&void 0!==o||(o={}),void 0!==n&&null!==n||(n={}),r&&(n.session=r);var a={auth:n};return void 0!==e&&null!==e&&(a.username=e),void 0!==t&&null!==t&&(a.password=t),o.email&&(a.bind_email=!0),o.msisdn&&(a.bind_msisdn=!0),void 0!==i&&null!==i&&(a.guest_access_token=i),void 0!==t&&null!==t&&(a.x_show_msisdn=!0),this.registerRequest(a,void 0,s)},o.prototype.registerGuest=function(e,t){return e=e||{},e.body=e.body||{},this.registerRequest(e.body,"guest",t)},o.prototype.registerRequest=function(e,t,r){var n={};return t&&(n.kind=t),this._http.request(r,"POST","/register",n,e)},o.prototype.loginFlows=function(e){return this._http.request(e,"GET","/login")},o.prototype.login=function(e,t,r){var n=this,o={type:e};return l.extend(o,t),this._http.authedRequest(function(t,o){"m.login.password"===e&&o&&o.access_token&&o.user_id&&(n._http.opts.accessToken=o.access_token,n.credentials={userId:o.user_id}),r&&r(t,o)},"POST","/login",void 0,o)},o.prototype.loginWithPassword=function(e,t,r){return this.login("m.login.password",{user:e,password:t},r)},o.prototype.loginWithSAML2=function(e,t){return this.login("m.login.saml2",{relay_state:e},t)},o.prototype.getCasLoginUrl=function(e){return this.getSsoLoginUrl(e,"cas")},o.prototype.getSsoLoginUrl=function(e,t){return void 0===t&&(t="sso"),this._http.getUrl("/login/"+t+"/redirect",{redirectUrl:e},c.PREFIX_R0)},o.prototype.loginWithToken=function(e,t){return this.login("m.login.token",{token:e},t)},o.prototype.logout=function(e){return this._http.authedRequest(e,"POST","/logout")},o.prototype.deactivateAccount=function(e,t){if("function"==typeof t)throw new Error("deactivateAccount no longer accepts a callback parameter");var r={};return e&&(r.auth=e),void 0!==t&&(r.erase=t),this._http.authedRequestWithPrefix(void 0,"POST","/account/deactivate",void 0,r,c.PREFIX_R0)},o.prototype.getFallbackAuthUrl=function(e,t){var r=l.encodeUri("/auth/$loginType/fallback/web",{$loginType:e});return this._http.getUrl(r,{session:t},c.PREFIX_R0)},o.prototype.createRoom=function(e,t){return this._http.authedRequest(t,"POST","/createRoom",void 0,e)},o.prototype.roomState=function(e,t){var r=l.encodeUri("/rooms/$roomId/state",{$roomId:e});return this._http.authedRequest(t,"GET",r)},o.prototype.fetchRoomEvent=function(e,t,r){var n=l.encodeUri("/rooms/$roomId/event/$eventId",{$roomId:e,$eventId:t});return this._http.authedRequest(r,"GET",n)},o.prototype.members=function(e,t,r,n,o){var i={};t&&(i.membership=t),r&&(i.not_membership=r),n&&(i.at=n);var s=l.encodeParams(i),a=l.encodeUri("/rooms/$roomId/members?"+s,{$roomId:e});return this._http.authedRequest(o,"GET",a)},o.prototype.upgradeRoom=function(e,t){var r=l.encodeUri("/rooms/$roomId/upgrade",{$roomId:e});return this._http.authedRequest(void 0,"POST",r,void 0,{new_version:t})},o.prototype.getGroupSummary=function(e){var t=l.encodeUri("/groups/$groupId/summary",{$groupId:e});return this._http.authedRequest(void 0,"GET",t)},o.prototype.getGroupProfile=function(e){var t=l.encodeUri("/groups/$groupId/profile",{$groupId:e});return this._http.authedRequest(void 0,"GET",t)},o.prototype.setGroupProfile=function(e,t){var r=l.encodeUri("/groups/$groupId/profile",{$groupId:e});return this._http.authedRequest(void 0,"POST",r,void 0,t)},o.prototype.setGroupJoinPolicy=function(e,t){var r=l.encodeUri("/groups/$groupId/settings/m.join_policy",{$groupId:e});return this._http.authedRequest(void 0,"PUT",r,void 0,{"m.join_policy":t})},o.prototype.getGroupUsers=function(e){var t=l.encodeUri("/groups/$groupId/users",{$groupId:e});return this._http.authedRequest(void 0,"GET",t)},o.prototype.getGroupInvitedUsers=function(e){var t=l.encodeUri("/groups/$groupId/invited_users",{$groupId:e});return this._http.authedRequest(void 0,"GET",t)},o.prototype.getGroupRooms=function(e){var t=l.encodeUri("/groups/$groupId/rooms",{$groupId:e});return this._http.authedRequest(void 0,"GET",t)},o.prototype.inviteUserToGroup=function(e,t){var r=l.encodeUri("/groups/$groupId/admin/users/invite/$userId",{$groupId:e,$userId:t});return this._http.authedRequest(void 0,"PUT",r,void 0,{})},o.prototype.removeUserFromGroup=function(e,t){var r=l.encodeUri("/groups/$groupId/admin/users/remove/$userId",{$groupId:e,$userId:t});return this._http.authedRequest(void 0,"PUT",r,void 0,{})},o.prototype.addUserToGroupSummary=function(e,t,r){var n=l.encodeUri(r?"/groups/$groupId/summary/$roleId/users/$userId":"/groups/$groupId/summary/users/$userId",{$groupId:e,$roleId:r,$userId:t});return this._http.authedRequest(void 0,"PUT",n,void 0,{})},o.prototype.removeUserFromGroupSummary=function(e,t){var r=l.encodeUri("/groups/$groupId/summary/users/$userId",{$groupId:e,$userId:t});return this._http.authedRequest(void 0,"DELETE",r,void 0,{})},o.prototype.addRoomToGroupSummary=function(e,t,r){var n=l.encodeUri(r?"/groups/$groupId/summary/$categoryId/rooms/$roomId":"/groups/$groupId/summary/rooms/$roomId",{$groupId:e,$categoryId:r,$roomId:t});return this._http.authedRequest(void 0,"PUT",n,void 0,{})},o.prototype.removeRoomFromGroupSummary=function(e,t){var r=l.encodeUri("/groups/$groupId/summary/rooms/$roomId",{$groupId:e,$roomId:t});return this._http.authedRequest(void 0,"DELETE",r,void 0,{})},o.prototype.addRoomToGroup=function(e,t,r){void 0===r&&(r=!0);var n=l.encodeUri("/groups/$groupId/admin/rooms/$roomId",{$groupId:e,$roomId:t});return this._http.authedRequest(void 0,"PUT",n,void 0,{"m.visibility":{type:r?"public":"private"}})},o.prototype.updateGroupRoomVisibility=function(e,t,r){var n=l.encodeUri("/groups/$groupId/admin/rooms/$roomId/config/m.visibility",{$groupId:e,$roomId:t});return this._http.authedRequest(void 0,"PUT",n,void 0,{type:r?"public":"private"})},o.prototype.removeRoomFromGroup=function(e,t){var r=l.encodeUri("/groups/$groupId/admin/rooms/$roomId",{$groupId:e,$roomId:t});return this._http.authedRequest(void 0,"DELETE",r,void 0,{})},o.prototype.acceptGroupInvite=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=l.encodeUri("/groups/$groupId/self/accept_invite",{$groupId:e});return this._http.authedRequest(void 0,"PUT",r,void 0,t||{})},o.prototype.joinGroup=function(e){var t=l.encodeUri("/groups/$groupId/self/join",{$groupId:e});return this._http.authedRequest(void 0,"PUT",t,void 0,{})},o.prototype.leaveGroup=function(e){var t=l.encodeUri("/groups/$groupId/self/leave",{$groupId:e});return this._http.authedRequest(void 0,"PUT",t,void 0,{})},o.prototype.getJoinedGroups=function(){var e=l.encodeUri("/joined_groups");return this._http.authedRequest(void 0,"GET",e)},o.prototype.createGroup=function(e){var t=l.encodeUri("/create_group");return this._http.authedRequest(void 0,"POST",t,void 0,e)},o.prototype.getPublicisedGroups=function(e){var t=l.encodeUri("/publicised_groups");return this._http.authedRequest(void 0,"POST",t,void 0,{user_ids:e})},o.prototype.setGroupPublicity=function(e,t){var r=l.encodeUri("/groups/$groupId/self/update_publicity",{$groupId:e});return this._http.authedRequest(void 0,"PUT",r,void 0,{publicise:t})},o.prototype.getStateEvent=function(e,t,r,n){var o={$roomId:e,$eventType:t,$stateKey:r},i=l.encodeUri("/rooms/$roomId/state/$eventType",o);return void 0!==r&&(i=l.encodeUri(i+"/$stateKey",o)),this._http.authedRequest(n,"GET",i)},o.prototype.sendStateEvent=function(e,t,r,n,o){var i={$roomId:e,$eventType:t,$stateKey:n},s=l.encodeUri("/rooms/$roomId/state/$eventType",i);return void 0!==n&&(s=l.encodeUri(s+"/$stateKey",i)),this._http.authedRequest(o,"PUT",s,void 0,r)},o.prototype.redactEvent=function(e,t,r){var n=l.encodeUri("/rooms/$roomId/redact/$eventId",{$roomId:e,$eventId:t});return this._http.authedRequest(r,"POST",n,void 0,{})},o.prototype.roomInitialSync=function(e,t,r){l.isFunction(t)&&(r=t,t=void 0);var n=l.encodeUri("/rooms/$roomId/initialSync",{$roomId:e});return t||(t=30),this._http.authedRequest(r,"GET",n,{limit:t})},o.prototype.setRoomReadMarkersHttpRequest=function(e,t,r){var n=l.encodeUri("/rooms/$roomId/read_markers",{$roomId:e}),o={"m.fully_read":t,"m.read":r};return this._http.authedRequest(void 0,"POST",n,void 0,o)},o.prototype.getJoinedRooms=function(){var e=l.encodeUri("/joined_rooms");return this._http.authedRequest(void 0,"GET",e)},o.prototype.getJoinedRoomMembers=function(e){var t=l.encodeUri("/rooms/$roomId/joined_members",{$roomId:e});return this._http.authedRequest(void 0,"GET",t)},o.prototype.publicRooms=function(e,t){"function"==typeof e&&(t=e,e={}),void 0===e&&(e={});var r={};return e.server&&(r.server=e.server,delete e.server),0===(0,u.default)(e).length&&0===(0,u.default)(r).length?this._http.authedRequest(t,"GET","/publicRooms"):this._http.authedRequest(t,"POST","/publicRooms",r,e)},o.prototype.createAlias=function(e,t,r){var n=l.encodeUri("/directory/room/$alias",{$alias:e}),o={room_id:t};return this._http.authedRequest(r,"PUT",n,void 0,o)},o.prototype.deleteAlias=function(e,t){var r=l.encodeUri("/directory/room/$alias",{$alias:e});return this._http.authedRequest(t,"DELETE",r,void 0,void 0)},o.prototype.getRoomIdForAlias=function(e,t){var r=l.encodeUri("/directory/room/$alias",{$alias:e});return this._http.authedRequest(t,"GET",r)},o.prototype.resolveRoomAlias=function(e,t){var r=l.encodeUri("/directory/room/$alias",{$alias:e});return this._http.request(t,"GET",r)},o.prototype.getRoomDirectoryVisibility=function(e,t){var r=l.encodeUri("/directory/list/room/$roomId",{$roomId:e});return this._http.authedRequest(t,"GET",r)},o.prototype.setRoomDirectoryVisibility=function(e,t,r){var n=l.encodeUri("/directory/list/room/$roomId",{$roomId:e});return this._http.authedRequest(r,"PUT",n,void 0,{visibility:t})},o.prototype.setRoomDirectoryVisibilityAppService=function(e,t,r,n){var o=l.encodeUri("/directory/list/appservice/$networkId/$roomId",{$networkId:e,$roomId:t});return this._http.authedRequest(n,"PUT",o,void 0,{visibility:r})},o.prototype.searchUserDirectory=function(e){var t={search_term:e.term};return void 0!==e.limit&&(t.limit=e.limit),this._http.authedRequest(void 0,"POST","/user_directory/search",void 0,t)},o.prototype.uploadContent=function(e,t){return this._http.uploadContent(e,t)},o.prototype.cancelUpload=function(e){return this._http.cancelUpload(e)},o.prototype.getCurrentUploads=function(){return this._http.getCurrentUploads()},o.prototype.getProfileInfo=function(e,t,r){l.isFunction(t)&&(r=t,t=void 0);var n=t?l.encodeUri("/profile/$userId/$info",{$userId:e,$info:t}):l.encodeUri("/profile/$userId",{$userId:e});return this._http.authedRequest(r,"GET",n)},o.prototype.getThreePids=function(e){return this._http.authedRequest(e,"GET","/account/3pid",void 0,void 0)},o.prototype.addThreePid=function(e,t,r){var n={threePidCreds:e,bind:t};return this._http.authedRequest(r,"POST","/account/3pid",null,n)},o.prototype.deleteThreePid=function(e,t){var r={medium:e,address:t};return this._http.authedRequestWithPrefix(void 0,"POST","/account/3pid/delete",null,r,c.PREFIX_UNSTABLE)},o.prototype.setPassword=function(e,t,r){var n={auth:e,new_password:t};return this._http.authedRequest(r,"POST","/account/password",null,n)},o.prototype.getDevices=function(){return this._http.authedRequestWithPrefix(void 0,"GET","/devices",void 0,void 0,c.PREFIX_UNSTABLE)},o.prototype.setDeviceDetails=function(e,t){var r=l.encodeUri("/devices/$device_id",{$device_id:e});return this._http.authedRequestWithPrefix(void 0,"PUT",r,void 0,t,c.PREFIX_UNSTABLE)},o.prototype.deleteDevice=function(e,t){var r=l.encodeUri("/devices/$device_id",{$device_id:e}),n={};return t&&(n.auth=t),this._http.authedRequestWithPrefix(void 0,"DELETE",r,void 0,n,c.PREFIX_UNSTABLE)},o.prototype.deleteMultipleDevices=function(e,t){var r={devices:e};return t&&(r.auth=t),this._http.authedRequestWithPrefix(void 0,"POST","/delete_devices",void 0,r,c.PREFIX_UNSTABLE)},o.prototype.getPushers=function(e){return this._http.authedRequest(e,"GET","/pushers",void 0,void 0)},o.prototype.setPusher=function(e,t){return this._http.authedRequest(t,"POST","/pushers/set",null,e)},o.prototype.getPushRules=function(e){return this._http.authedRequest(e,"GET","/pushrules/")},o.prototype.addPushRule=function(e,t,r,n,o){var i=l.encodeUri("/pushrules/"+e+"/$kind/$ruleId",{$kind:t,$ruleId:r});return this._http.authedRequest(o,"PUT",i,void 0,n)},o.prototype.deletePushRule=function(e,t,r,n){var o=l.encodeUri("/pushrules/"+e+"/$kind/$ruleId",{$kind:t,$ruleId:r});return this._http.authedRequest(n,"DELETE",o)},o.prototype.setPushRuleEnabled=function(e,t,r,n,o){var i=l.encodeUri("/pushrules/"+e+"/$kind/$ruleId/enabled",{$kind:t,$ruleId:r});return this._http.authedRequest(o,"PUT",i,void 0,{enabled:n})},o.prototype.setPushRuleActions=function(e,t,r,n,o){var i=l.encodeUri("/pushrules/"+e+"/$kind/$ruleId/actions",{$kind:t,$ruleId:r});return this._http.authedRequest(o,"PUT",i,void 0,{actions:n})},o.prototype.search=function(e,t){var r={};return e.next_batch&&(r.next_batch=e.next_batch),this._http.authedRequest(t,"POST","/search",r,e.body)},o.prototype.uploadKeysRequest=function(e,t,r){t=t||{};var n=t.device_id,o=void 0;return o=n?l.encodeUri("/keys/upload/$deviceId",{$deviceId:n}):"/keys/upload",this._http.authedRequestWithPrefix(r,"POST",o,void 0,e,c.PREFIX_UNSTABLE)},o.prototype.downloadKeysForUsers=function(e,t){if(l.isFunction(t))throw new Error("downloadKeysForUsers no longer accepts a callback parameter");t=t||{};var r={device_keys:{}};return"token"in t&&(r.token=t.token),e.forEach(function(e){r.device_keys[e]={}}),this._http.authedRequestWithPrefix(void 0,"POST","/keys/query",void 0,r,c.PREFIX_UNSTABLE)},o.prototype.claimOneTimeKeys=function(e,t){var r={};void 0===t&&(t="signed_curve25519");for(var n=0;n1&&c(t,r,ee.QUEUED),n||(n=l(e,r)),n}).then(function(e){return t&&t.updatePendingEvent(r,ee.SENT,e.event_id),n&&n(null,e),e},function(e){console.error("Error sending event",e.stack||e);try{r.error=e,c(t,r,ee.NOT_SENT),e.event=r,n&&n(e)}catch(t){console.error("Exception in error handler!",t.stack||e)}throw e})}function u(e,t,r){if(t.isEncrypted())return null;if(!e.isRoomEncrypted(t.getRoomId()))return null;if(!e._crypto)throw new Error("This room is configured to use encryption, but your client does not support encryption.");return e._crypto.encryptEvent(t,r)}function c(e,t,r){e?e.updatePendingEvent(t,r):t.status=r}function l(e,t){var r=t._txnId?t._txnId:e.makeTxnId(),n={$roomId:t.getRoomId(),$eventType:t.getWireType(),$stateKey:t.getStateKey(),$txnId:r},o=void 0;if(t.isState()){var i="/rooms/$roomId/state/$eventType";t.getStateKey()&&t.getStateKey().length>0&&(i="/rooms/$roomId/state/$eventType/$stateKey"),o=ie.encodeUri(i,n)}else o=ie.encodeUri("/rooms/$roomId/send/$eventType/$txnId",n);return e._http.authedRequest(void 0,"PUT",o,void 0,t.getWireContent()).then(function(e){return console.log("Event sent to "+t.getRoomId()+" with event id "+e.event_id),e})}function d(e,t,r,n,o,i){ie.isFunction(o)&&(i=o,o=void 0);var s=ie.encodeUri("/rooms/$roomId/state/m.room.member/$userId",{$roomId:t,$userId:r});return e._http.authedRequest(i,"PUT",s,void 0,{membership:n,reason:o})}function f(e,t,r,n,o,i){ie.isFunction(o)&&(i=o,o=void 0);var s=ie.encodeUri("/rooms/$room_id/$membership",{$room_id:t,$membership:n});return e._http.authedRequest(i,"POST",s,void 0,{user_id:r,reason:o})}function p(e,t,r,n){var o=ie.encodeUri("/presence/list/$userId",{$userId:t.credentials.userId});return t._http.authedRequest(e,n,o,void 0,r)}function h(e){function t(e){return 0!==e.getType().indexOf("m.call.")?void((e.isBeingDecrypted()||e.isDecryptionFailure())&&e.once("Event.decrypted",t)):i?void r(e):void o.push(e)}function r(t){var r=t.getContent(),o=r.call_id?e.callList[r.call_id]:void 0,i=void 0;if("m.call.invite"===t.getType()){if(t.getSender()===e.credentials.userId)return;if(t.getAge()>r.lifetime)return;if(o&&"ended"===o.state)return;if(o&&console.log("WARN: Already have a MatrixCall with id %s but got an invite. Clobbering.",r.call_id),!(o=oe.createNewMatrixCall(e,t.getRoomId(),{forceTURN:e._forceTURN})))return void console.log("Incoming call ID "+r.call_id+" but this client doesn't support WebRTC");if(o.callId=r.call_id,o._initWithInvite(t),e.callList[o.callId]=o,n[o.callId])for(i=0;io.callId?(console.log("Glare detected: answering incoming call "+o.callId+" and canceling outgoing call "+s.callId),s._replacedBy(o),o.answer()):(console.log("Glare detected: rejecting incoming call "+o.callId+" and keeping outgoing call "+s.callId),o.hangup()):e.emit("Call.incoming",o)}else if("m.call.answer"===t.getType()){if(!o)return;t.getSender()===e.credentials.userId?"ringing"===o.state&&o._onAnsweredElsewhere(r):o._receivedAnswer(r)}else if("m.call.candidates"===t.getType()){if(t.getSender()===e.credentials.userId)return;if(o)for(i=0;i=0;n--){var s=o[n];"m.call.answer"!==s.getType()&&"m.call.hangup"!==s.getType()||(t[s.getContent().call_id]="yep")}o.forEach(function(e){t[e.getContent().call_id]||r(e)}),o=[]}}),e.on("event",t)}function v(e){e._supportsVoip&&(e.isGuest()||e.turnServer().done(function(t){if(t.uris){console.log("Got TURN URIs: "+t.uris+" refresh in "+t.ttl+" secs");var r={urls:t.uris,username:t.username,credential:t.password};e._turnServers=[r],e._checkTurnServersTimeoutID=setTimeout(function(){v(e)},1e3*(t.ttl||3600)*.9)}},function(t){console.error("Failed to get TURN URIs"),e._checkTurnServersTimeoutID=setTimeout(function(){v(e)},6e4)}))}function m(e,t,r){e&&e(r),t.reject(r)}function y(e,t,r){e&&e(null,r),t.resolve(r)}function _(e){function t(t){var r=new Z(t);return r.isEncrypted()&&(e.reEmitter.reEmit(r,["Event.decrypted"]),r.attemptDecryption(e._crypto)),r}return t}var g=e("babel-runtime/core-js/object/assign"),b=n(g),E=e("babel-runtime/core-js/json/stringify"),w=n(E),S=e("babel-runtime/core-js/set"),k=n(S),T=e("babel-runtime/core-js/object/keys"),x=n(T),R=e("babel-runtime/helpers/typeof"),I=n(R),C=e("bluebird"),j=n(C),O=e("babel-runtime/regenerator"),A=n(O),D=e("babel-runtime/helpers/slicedToArray"),M=n(D),P=e("babel-runtime/core-js/object/entries"),L=n(P),U=e("babel-runtime/core-js/get-iterator"),N=n(U),F=function(){var e=(0,C.coroutine)(A.default.mark(function e(t,r,n,o,i,s){var a;return A.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t._crypto){e.next=2;break}throw new Error("End-to-End encryption disabled");case 2:return e.next=4,(0,C.resolve)(t._crypto.setDeviceVerification(r,n,o,i,s));case 4:a=e.sent,t.emit("deviceVerificationChanged",r,n,a);case 6:case"end":return e.stop()}},e,this)}));return function(t,r,n,o,i,s){return e.apply(this,arguments)}}(),q=e("./ReEmitter"),B=n(q),K=e("./crypto/RoomList"),G=n(K),$=e("./crypto"),V=n($),W=e("./crypto/recoverykey"),H=e("./crypto/backup_password"),z=e("./randomstring"),Q=e("./pushprocessor"),J=e("events").EventEmitter,Y=e("url"),X=e("./http-api"),Z=e("./models/event").MatrixEvent,ee=e("./models/event").EventStatus,te=e("./models/event-timeline"),re=e("./models/search-result"),ne=e("./store/stub"),oe=e("./webrtc/call"),ie=e("./utils"),se=e("./content-repo"),ae=e("./filter"),ue=e("./sync"),ce=e("./base-apis"),le=X.MatrixError,de=e("./content-helpers"),fe=e("./crypto/olmlib");j.default.config({warnings:!1});var pe=(0,$.isCryptoAvailable)();ie.inherits(s,J),ie.extend(s.prototype,ce.prototype),s.prototype.clearStores=function(){if(this._clientRunning)throw new Error("Cannot clear stores while client is running");var e=[];return e.push(this.store.deleteAllData()),this._cryptoStore&&e.push(this._cryptoStore.deleteAllData()),j.default.all(e)},s.prototype.getUserId=function(){return this.credentials&&this.credentials.userId?this.credentials.userId:null},s.prototype.getDomain=function(){return this.credentials&&this.credentials.userId?this.credentials.userId.replace(/^.*?:/,""):null},s.prototype.getUserIdLocalpart=function(){return this.credentials&&this.credentials.userId?this.credentials.userId.split(":")[0].substring(1):null},s.prototype.getDeviceId=function(){return this.deviceId},s.prototype.supportsVoip=function(){return this._supportsVoip},s.prototype.setForceTURN=function(e){this._forceTURN=e},s.prototype.getSyncState=function(){return this._syncApi?this._syncApi.getSyncState():null},s.prototype.getSyncStateData=function(){return this._syncApi?this._syncApi.getSyncStateData():null},s.prototype.isGuest=function(){return this._isGuest},s.prototype.getScheduler=function(){return this.scheduler},s.prototype.setGuest=function(e){this._isGuest=e},s.prototype.retryImmediately=function(){return this._syncApi.retryImmediately()},s.prototype.getNotifTimelineSet=function(){return this._notifTimelineSet},s.prototype.setNotifTimelineSet=function(e){this._notifTimelineSet=e},s.prototype.initCrypto=(0,C.coroutine)(A.default.mark(function e(){var t,r;return A.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if((0,$.isCryptoAvailable)()){e.next=2;break}throw new Error("End-to-end encryption not supported in this js-sdk build: did you remember to load the olm library?");case 2:if(!this._crypto){e.next=5;break}return console.warn("Attempt to re-initialise e2e encryption on MatrixClient"),e.abrupt("return");case 5:if(this._sessionStore){e.next=7;break}throw new Error("Cannot enable encryption: no sessionStore provided");case 7:if(this._cryptoStore){e.next=9;break}throw new Error("Cannot enable encryption: no cryptoStore provided");case 9:return e.next=11,(0,C.resolve)(this._roomList.init());case 11:if(null!==(t=this.getUserId())){e.next=14;break}throw new Error("Cannot enable encryption on MatrixClient with unknown userId: ensure userId is passed in createClient().");case 14:if(null!==this.deviceId){e.next=16;break}throw new Error("Cannot enable encryption on MatrixClient with unknown deviceId: ensure deviceId is passed in createClient().");case 16:return r=new V.default(this,this._sessionStore,t,this.deviceId,this.store,this._cryptoStore,this._roomList),this.reEmitter.reEmit(r,["crypto.roomKeyRequest","crypto.roomKeyRequestCancellation","crypto.warning"]),e.next=20,(0,C.resolve)(r.init());case 20:this.olmVersion=V.default.getOlmVersion(),r.registerEventHandlers(this),this._crypto=r;case 23:case"end":return e.stop()}},e,this)})),s.prototype.isCryptoEnabled=function(){return null!==this._crypto},s.prototype.getDeviceEd25519Key=function(){return this._crypto?this._crypto.getDeviceEd25519Key():null},s.prototype.uploadKeys=function(){if(null===this._crypto)throw new Error("End-to-end encryption disabled");return this._crypto.uploadDeviceKeys()},s.prototype.downloadKeys=function(e,t){return null===this._crypto?j.default.reject(new Error("End-to-end encryption disabled")):this._crypto.downloadKeys(e,t)},s.prototype.getStoredDevicesForUser=function(){var e=(0,C.method)(function(e){if(null===this._crypto)throw new Error("End-to-end encryption disabled");return this._crypto.getStoredDevicesForUser(e)||[]});return function(t){return e.apply(this,arguments)}}(),s.prototype.getStoredDevice=function(){var e=(0,C.method)(function(e,t){if(null===this._crypto)throw new Error("End-to-end encryption disabled");return this._crypto.getStoredDevice(e,t)||null});return function(t,r){return e.apply(this,arguments)}}(),s.prototype.setDeviceVerified=function(e,t,r){void 0===r&&(r=!0);var n=F(this,e,t,r,null);return e==this.credentials.userId&&this._crypto.checkKeyBackup(),n},s.prototype.setDeviceBlocked=function(e,t,r){return void 0===r&&(r=!0),F(this,e,t,null,r)},s.prototype.setDeviceKnown=function(e,t,r){return void 0===r&&(r=!0),F(this,e,t,null,null,r)},s.prototype.setGlobalBlacklistUnverifiedDevices=function(e){if(null===this._crypto)throw new Error("End-to-end encryption disabled");this._crypto.setGlobalBlacklistUnverifiedDevices(e)},s.prototype.getGlobalBlacklistUnverifiedDevices=function(){if(null===this._crypto)throw new Error("End-to-end encryption disabled");return this._crypto.getGlobalBlacklistUnverifiedDevices()},s.prototype.getEventSenderDeviceInfo=function(){var e=(0,C.method)(function(e){return this._crypto?this._crypto.getEventSenderDeviceInfo(e):null});return function(t){return e.apply(this,arguments)}}(),s.prototype.isEventSenderVerified=function(){var e=(0,C.coroutine)(A.default.mark(function e(t){var r;return A.default.wrap(function(e){ +for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,C.resolve)(this.getEventSenderDeviceInfo(t));case 2:if(r=e.sent){e.next=5;break}return e.abrupt("return",!1);case 5:return e.abrupt("return",r.isVerified());case 6:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}(),s.prototype.cancelAndResendEventRoomKeyRequest=function(e){e.cancelAndResendKeyRequest(this._crypto)},s.prototype.setRoomEncryption=function(e,t){if(!this._crypto)throw new Error("End-to-End encryption disabled");return this._crypto.setRoomEncryption(e,t)},s.prototype.isRoomEncrypted=function(e){var t=this.getRoom(e);return!!t&&(!!t.currentState.getStateEvents("m.room.encryption","")||this._roomList.isRoomEncrypted(e))},s.prototype.forceDiscardSession=function(e){if(!this._crypto)throw new Error("End-to-End encryption disabled");this._crypto.forceDiscardSession(e)},s.prototype.exportRoomKeys=function(){return this._crypto?this._crypto.exportRoomKeys():j.default.reject(new Error("End-to-end encryption disabled"))},s.prototype.importRoomKeys=function(e){if(!this._crypto)throw new Error("End-to-end encryption disabled");return this._crypto.importRoomKeys(e)},s.prototype.getKeyBackupVersion=function(){return this._http.authedRequest(void 0,"GET","/room_keys/version").then(function(e){if(e.algorithm!==fe.MEGOLM_BACKUP_ALGORITHM){var t="Unknown backup algorithm: "+e.algorithm;return j.default.reject(t)}if("object"===(0,I.default)(e.auth_data)&&e.auth_data.public_key)return e;return j.default.reject("Invalid backup data returned")}).catch(function(e){if("M_NOT_FOUND"===e.errcode)return null;throw e})},s.prototype.isKeyBackupTrusted=function(e){return this._crypto.isKeyBackupTrusted(e)},s.prototype.getKeyBackupEnabled=function(){if(null===this._crypto)throw new Error("End-to-end encryption disabled");return Boolean(this._crypto.backupKey)},s.prototype.enableKeyBackup=function(e){if(null===this._crypto)throw new Error("End-to-end encryption disabled");this._crypto.backupInfo=e,this._crypto.backupKey&&this._crypto.backupKey.free(),this._crypto.backupKey=new r.Olm.PkEncryption,this._crypto.backupKey.set_recipient_key(e.auth_data.public_key),this.emit("crypto.keyBackupStatus",!0)},s.prototype.disableKeyBackup=function(){if(null===this._crypto)throw new Error("End-to-end encryption disabled");this._crypto.backupInfo=null,this._crypto.backupKey&&this._crypto.backupKey.free(),this._crypto.backupKey=null,this.emit("crypto.keyBackupStatus",!1)},s.prototype.prepareKeyBackupVersion=function(){var e=(0,C.coroutine)(A.default.mark(function e(t){var n,o,i,s;return A.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null!==this._crypto){e.next=2;break}throw new Error("End-to-end encryption disabled");case 2:if(n=new r.Olm.PkDecryption,e.prev=3,o=void 0,i={},!t){e.next=15;break}return e.next=9,(0,C.resolve)((0,H.keyForNewBackup)(t));case 9:s=e.sent,o=n.init_with_private_key(s.key),i.private_key_salt=s.salt,i.private_key_iterations=s.iterations,e.next=16;break;case 15:o=n.generate_key();case 16:return i.public_key=o,e.abrupt("return",{algorithm:fe.MEGOLM_BACKUP_ALGORITHM,auth_data:i,recovery_key:(0,W.encodeRecoveryKey)(n.get_private_key())});case 18:return e.prev=18,n.free(),e.finish(18);case 21:case"end":return e.stop()}},e,this,[[3,,18,21]])}));return function(t){return e.apply(this,arguments)}}(),s.prototype.createKeyBackupVersion=function(e){var t=this;if(null===this._crypto)throw new Error("End-to-end encryption disabled");var r={algorithm:e.algorithm,auth_data:e.auth_data};return this._crypto._signObject(r.auth_data).then(function(){return t._http.authedRequest(void 0,"POST","/room_keys/version",void 0,r)}).then(function(r){return t.enableKeyBackup({algorithm:e.algorithm,auth_data:e.auth_data,version:r.version}),r})},s.prototype.deleteKeyBackupVersion=function(e){if(null===this._crypto)throw new Error("End-to-end encryption disabled");this._crypto.backupInfo&&this._crypto.backupInfo.version===e&&this.disableKeyBackup();var t=ie.encodeUri("/room_keys/version/$version",{$version:e});return this._http.authedRequest(void 0,"DELETE",t,void 0,void 0)},s.prototype._makeKeyBackupPath=function(e,t,r){var n=void 0;return n=void 0!==t?ie.encodeUri("/room_keys/keys/$roomId/$sessionId",{$roomId:e,$sessionId:t}):void 0!==e?ie.encodeUri("/room_keys/keys/$roomId",{$roomId:e}):"/room_keys/keys",{path:n,queryData:void 0===r?void 0:{version:r}}},s.prototype.sendKeyBackup=function(e,t,r,n){if(null===this._crypto)throw new Error("End-to-end encryption disabled");var o=this._makeKeyBackupPath(e,t,r);return this._http.authedRequest(void 0,"PUT",o.path,o.queryData,n)},s.prototype.backupAllGroupSessions=function(e){if(null===this._crypto)throw new Error("End-to-end encryption disabled");return this._crypto.backupAllGroupSessions(e)},s.prototype.isValidRecoveryKey=function(e){try{return(0,W.decodeRecoveryKey)(e),!0}catch(e){return!1}},s.prototype.restoreKeyBackupWithPassword=function(){var e=(0,C.coroutine)(A.default.mark(function e(t,r,n,o){var i,s;return A.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,C.resolve)(this.getKeyBackupVersion());case 2:return i=e.sent,e.next=5,(0,C.resolve)((0,H.keyForExistingBackup)(i,t));case 5:return s=e.sent,e.abrupt("return",this._restoreKeyBackup(s,r,n,o));case 7:case"end":return e.stop()}},e,this)}));return function(t,r,n,o){return e.apply(this,arguments)}}(),s.prototype.restoreKeyBackupWithRecoveryKey=function(e,t,r,n){var o=(0,W.decodeRecoveryKey)(e);return this._restoreKeyBackup(o,t,r,n)},s.prototype._restoreKeyBackup=function(e,t,n,s){var a=this;if(null===this._crypto)throw new Error("End-to-end encryption disabled");var u=0,c=[],l=this._makeKeyBackupPath(t,n,s),d=new r.Olm.PkDecryption;try{d.init_with_private_key(e)}catch(e){throw d.free(),e}return this._http.authedRequest(void 0,"GET",l.path,l.queryData).then(function(e){if(e.rooms){var r=!0,s=!1,l=void 0;try{for(var f,p=(0,N.default)((0,L.default)(e.rooms));!(r=(f=p.next()).done);r=!0){var h=(0,M.default)(f.value,2),v=h[0],m=h[1];if(m.sessions){u+=(0,x.default)(m.sessions).length;var y=o(m.sessions,d,v),_=!0,g=!1,b=void 0;try{for(var E,w=(0,N.default)(y);!(_=(E=w.next()).done);_=!0){var S=E.value;S.room_id=v,c.push(S)}}catch(e){g=!0,b=e}finally{try{!_&&w.return&&w.return()}finally{if(g)throw b}}}}}catch(e){s=!0,l=e}finally{try{!r&&p.return&&p.return()}finally{if(s)throw l}}}else if(e.sessions)u=(0,x.default)(e.sessions).length,c=o(e.sessions,d,t);else{u=1;try{var k=i(e,d);k.room_id=t,k.session_id=n,c.push(k)}catch(e){console.log("Failed to decrypt session from backup")}}return a.importRoomKeys(c)}).then(function(){return{total:u,imported:c.length}}).finally(function(){d.free()})},s.prototype.deleteKeysFromBackup=function(e,t,r){if(null===this._crypto)throw new Error("End-to-end encryption disabled");var n=this._makeKeyBackupPath(e,t,r);return this._http.authedRequest(void 0,"DELETE",n.path,n.queryData)},s.prototype.getGroup=function(e){return this.store.getGroup(e)},s.prototype.getGroups=function(){return this.store.getGroups()},s.prototype.getMediaConfig=function(e){return this._http.authedRequestWithPrefix(e,"GET","/config",void 0,void 0,X.PREFIX_MEDIA_R0)},s.prototype.getRoom=function(e){return this.store.getRoom(e)},s.prototype.getRooms=function(){return this.store.getRooms()},s.prototype.getVisibleRooms=function(){var e=this.store.getRooms(),t=new k.default,r=!0,n=!1,o=void 0;try{for(var i,s=(0,N.default)(e);!(r=(i=s.next()).done);r=!0){var a=i.value,u=a.currentState.getStateEvents("m.room.create","");if(u){var c=u.getContent().predecessor;c&&c.room_id&&t.add(c.room_id)}}}catch(e){n=!0,o=e}finally{try{!r&&s.return&&s.return()}finally{if(n)throw o}}return e.filter(function(e){return!e.currentState.getStateEvents("m.room.tombstone","")||!t.has(e.roomId)})},s.prototype.getUser=function(e){return this.store.getUser(e)},s.prototype.getUsers=function(){return this.store.getUsers()},s.prototype.setAccountData=function(e,t,r){var n=ie.encodeUri("/user/$userId/account_data/$type",{$userId:this.credentials.userId,$type:e});return this._http.authedRequest(r,"PUT",n,void 0,t)},s.prototype.getAccountData=function(e){return this.store.getAccountData(e)},s.prototype.getIgnoredUsers=function(){var e=this.getAccountData("m.ignored_user_list");return e&&e.getContent()&&e.getContent().ignored_users?(0,x.default)(e.getContent().ignored_users):[]},s.prototype.setIgnoredUsers=function(e,t){var r={ignored_users:{}};return e.map(function(e){return r.ignored_users[e]={}}),this.setAccountData("m.ignored_user_list",r,t)},s.prototype.isUserIgnored=function(e){return-1!==this.getIgnoredUsers().indexOf(e)},s.prototype.joinRoom=function(e,t,r){if(ie.isFunction(t))throw new Error("Expected 'opts' object, got function.");t=t||{},void 0===t.syncRoom&&(t.syncRoom=!0);var n=this.getRoom(e);if(n&&n.hasMembershipState(this.credentials.userId,"join"))return j.default.resolve(n);var o=j.default.resolve();t.inviteSignUrl&&(o=this._http.requestOtherUrl(void 0,"POST",t.inviteSignUrl,{mxid:this.credentials.userId}));var i={};t.viaServers&&(i.server_name=t.viaServers);var s={qsStringifyOptions:{arrayFormat:"repeat"}},a=j.default.defer(),u=this;return o.then(function(t){var r={};t&&(r.third_party_signed=t);var n=ie.encodeUri("/join/$roomid",{$roomid:e});return u._http.authedRequest(void 0,"POST",n,i,r,s)}).then(function(e){var r=e.room_id,n=new ue(u,u._clientOpts),o=n.createRoom(r);return t.syncRoom,j.default.resolve(o)}).done(function(e){y(r,a,e)},function(e){m(r,a,e)}),a.promise},s.prototype.resendEvent=function(e,t){return c(t,e,ee.SENDING),a(this,t,e)},s.prototype.cancelPendingEvent=function(e){if([ee.QUEUED,ee.NOT_SENT].indexOf(e.status)<0)throw new Error("cannot cancel an event with status "+e.status);this.scheduler&&this.scheduler.removeEventFromQueue(e),c(this.getRoom(e.getRoomId()),e,ee.CANCELLED)},s.prototype.setRoomName=function(e,t,r){return this.sendStateEvent(e,"m.room.name",{name:t},void 0,r)},s.prototype.setRoomTopic=function(e,t,r){return this.sendStateEvent(e,"m.room.topic",{topic:t},void 0,r)},s.prototype.getRoomTags=function(e,t){var r=ie.encodeUri("/user/$userId/rooms/$roomId/tags/",{$userId:this.credentials.userId,$roomId:e});return this._http.authedRequest(t,"GET",r,void 0)},s.prototype.setRoomTag=function(e,t,r,n){var o=ie.encodeUri("/user/$userId/rooms/$roomId/tags/$tag",{$userId:this.credentials.userId,$roomId:e,$tag:t});return this._http.authedRequest(n,"PUT",o,void 0,r)},s.prototype.deleteRoomTag=function(e,t,r){var n=ie.encodeUri("/user/$userId/rooms/$roomId/tags/$tag",{$userId:this.credentials.userId,$roomId:e,$tag:t});return this._http.authedRequest(r,"DELETE",n,void 0,void 0)},s.prototype.setRoomAccountData=function(e,t,r,n){var o=ie.encodeUri("/user/$userId/rooms/$roomId/account_data/$type",{$userId:this.credentials.userId,$roomId:e,$type:t});return this._http.authedRequest(n,"PUT",o,void 0,r)},s.prototype.setPowerLevel=function(e,t,r,n,o){var i={users:{}};n&&"m.room.power_levels"===n.getType()&&(i=ie.deepCopy(n.getContent())),i.users[t]=r;var s=ie.encodeUri("/rooms/$roomId/state/m.room.power_levels",{$roomId:e});return this._http.authedRequest(o,"PUT",s,void 0,i)},s.prototype.sendEvent=function(e,t,r,n,o){ie.isFunction(n)&&(o=n,n=void 0),n||(n=this.makeTxnId()),console.log("sendEvent of type "+t+" in "+e+" with txnId "+n);var i=this.getRoom(e),s=new Z({event_id:"~"+e+":"+n,user_id:this.credentials.userId,room_id:e,type:t,origin_server_ts:(new Date).getTime(),content:r});return s._txnId=n,s.status=ee.SENDING,i&&i.addPendingEvent(s,n),s.status===ee.NOT_SENT?j.default.reject(new Error("Event blocked by other events not yet sent")):a(this,i,s,o)},s.prototype.sendMessage=function(e,t,r,n){return ie.isFunction(r)&&(n=r,r=void 0),this.sendEvent(e,"m.room.message",t,r,n)},s.prototype.sendTextMessage=function(e,t,r,n){var o=de.makeTextMessage(t);return this.sendMessage(e,o,r,n)},s.prototype.sendNotice=function(e,t,r,n){var o=de.makeNotice(t);return this.sendMessage(e,o,r,n)},s.prototype.sendEmoteMessage=function(e,t,r,n){var o=de.makeEmoteMessage(t);return this.sendMessage(e,o,r,n)},s.prototype.sendImageMessage=function(e,t,r,n,o){ie.isFunction(n)&&(o=n,n=void 0),n||(n="Image");var i={msgtype:"m.image",url:t,info:r,body:n};return this.sendMessage(e,i,o)},s.prototype.sendStickerMessage=function(e,t,r,n,o){ie.isFunction(n)&&(o=n,n=void 0),n||(n="Sticker");var i={url:t,info:r,body:n};return this.sendEvent(e,"m.sticker",i,o,void 0)},s.prototype.sendHtmlMessage=function(e,t,r,n){var o=de.makeHtmlMessage(t,r);return this.sendMessage(e,o,n)},s.prototype.sendHtmlNotice=function(e,t,r,n){var o=de.makeHtmlNotice(t,r);return this.sendMessage(e,o,n)},s.prototype.sendHtmlEmote=function(e,t,r,n){var o=de.makeHtmlEmote(t,r);return this.sendMessage(e,o,n)},s.prototype.sendReceipt=function(e,t,r){if(this.isGuest())return j.default.resolve({});var n=ie.encodeUri("/rooms/$roomId/receipt/$receiptType/$eventId",{$roomId:e.getRoomId(),$receiptType:t,$eventId:e.getId()}),o=this._http.authedRequest(r,"POST",n,void 0,{}),i=this.getRoom(e.getRoomId());return i&&i._addLocalEchoReceipt(this.credentials.userId,e,t),o},s.prototype.sendReadReceipt=function(e,t){return this.sendReceipt(e,"m.read",t)},s.prototype.setRoomReadMarkers=function(e,t,r){var n=t,o=void 0;if(r){o=r.getId();var i=this.getRoom(e);i&&i._addLocalEchoReceipt(this.credentials.userId,r,"m.read")}return this.setRoomReadMarkersHttpRequest(e,n,o)},s.prototype.getUrlPreview=function(e,t,r){var n=t+"_"+e,o=this.urlPreviewCache[n];if(o)return j.default.resolve(o);var i=this;return this._http.authedRequestWithPrefix(r,"GET","/preview_url",{url:e,ts:t},void 0,X.PREFIX_MEDIA_R0).then(function(e){return i.urlPreviewCache[n]=e,e})},s.prototype.sendTyping=function(e,t,r,n){if(this.isGuest())return j.default.resolve({});var o=ie.encodeUri("/rooms/$roomId/typing/$userId",{$roomId:e,$userId:this.credentials.userId}),i={typing:t};return t&&(i.timeout=r||2e4),this._http.authedRequest(n,"PUT",o,void 0,i)},s.prototype.invite=function(e,t,r){return f(this,e,t,"invite",void 0,r)},s.prototype.inviteByEmail=function(e,t,r){return this.inviteByThreePid(e,"email",t,r)},s.prototype.inviteByThreePid=function(e,t,r,n){var o=ie.encodeUri("/rooms/$roomId/invite",{$roomId:e}),i=this.getIdentityServerUrl(!0);return i?this._http.authedRequest(n,"POST",o,void 0,{id_server:i,medium:t,address:r}):j.default.reject(new le({error:"No supplied identity server URL",errcode:"ORG.MATRIX.JSSDK_MISSING_PARAM"}))},s.prototype.leave=function(e,t){return f(this,e,void 0,"leave",void 0,t)},s.prototype.ban=function(e,t,r,n){return f(this,e,t,"ban",r,n)},s.prototype.forget=function(e,t,r){void 0===t&&(t=!0);var n=f(this,e,void 0,"forget",void 0,r);if(!t)return n;var o=this;return n.then(function(t){return o.store.removeRoom(e),o.emit("deleteRoom",e),t})},s.prototype.unban=function(e,t,r){var n=ie.encodeUri("/rooms/$roomId/unban",{$roomId:e}),o={user_id:t};return this._http.authedRequest(r,"POST",n,void 0,o)},s.prototype.kick=function(e,t,r,n){return d(this,e,t,"leave",r,n)},s.prototype.getPushActionsForEvent=function(e){return e.getPushActions()||e.setPushActions(this._pushProcessor.actionsForEvent(e)),e.getPushActions()},s.prototype.setProfileInfo=function(e,t,r){var n=ie.encodeUri("/profile/$userId/$info",{$userId:this.credentials.userId,$info:e});return this._http.authedRequest(r,"PUT",n,void 0,t)},s.prototype.setDisplayName=function(e,t){return this.setProfileInfo("displayname",{displayname:e},t)},s.prototype.setAvatarUrl=function(e,t){return this.setProfileInfo("avatar_url",{avatar_url:e},t)},s.prototype.mxcUrlToHttp=function(e,t,r,n,o){return se.getHttpUriForMxc(this.baseUrl,e,t,r,n,o)},s.prototype.setPresence=function(e,t){var r=ie.encodeUri("/presence/$userId/status",{$userId:this.credentials.userId});if("string"==typeof e&&(e={presence:e}),-1==["offline","online","unavailable"].indexOf(e.presence))throw new Error("Bad presence value: "+e.presence);return this._http.authedRequest(t,"PUT",r,void 0,e)},s.prototype.getPresenceList=function(e){return p(e,this,void 0,"GET")},s.prototype.inviteToPresenceList=function(e,t){return p(e,this,{invite:t},"POST")},s.prototype.dropFromPresenceList=function(e,t){return p(e,this,{drop:t},"POST")},s.prototype.scrollback=function(e,t,r){ie.isFunction(t)&&(r=t,t=void 0),t=t||30;var n=0,o=this._ongoingScrollbacks[e.roomId]||{};if(o.promise)return o.promise;if(o.errorTs){var i=Date.now()-o.errorTs;n=Math.max(3e3-i,0)}if(null===e.oldState.paginationToken)return j.default.resolve(e);var s=this.store.scrollback(e,t).length;if(s===t)return j.default.resolve(e);t-=s;var a=j.default.defer();o={promise:a.promise,errorTs:null};var u=this;return j.default.delay(n).then(function(){return u._createMessagesRequest(e.roomId,e.oldState.paginationToken,t,"b")}).done(function(t){var n=ie.map(t.chunk,_(u));if(t.state){var o=ie.map(t.state,_(u));e.currentState.setUnknownStateEvents(o)}e.addEventsToTimeline(n,!0,e.getLiveTimeline()),e.oldState.paginationToken=t.end,0===t.chunk.length&&(e.oldState.paginationToken=null),u.store.storeEvents(e,n,t.end,!0),u._ongoingScrollbacks[e.roomId]=null,y(r,a,e)},function(t){u._ongoingScrollbacks[e.roomId]={errorTs:Date.now()},m(r,a,t)}),this._ongoingScrollbacks[e.roomId]=o,a.promise},s.prototype.getEventTimeline=function(e,t){if(!this.timelineSupport)throw new Error("timeline support is disabled. Set the 'timelineSupport' parameter to true when creating MatrixClient to enable it.");if(e.getTimelineForEvent(t))return j.default.resolve(e.getTimelineForEvent(t));var r=ie.encodeUri("/rooms/$roomId/context/$eventId",{$roomId:e.room.roomId,$eventId:t}),n=void 0;this._clientOpts.lazyLoadMembers&&(n={filter:(0,w.default)(ae.LAZY_LOADING_MESSAGES_FILTER)});var o=this;return o._http.authedRequest(void 0,"GET",r,n).then(function(r){if(!r.event)throw new Error("'event' not in '/context' result - homeserver too old?");if(e.getTimelineForEvent(t))return e.getTimelineForEvent(t);r.events_after.reverse();var n=r.events_after.concat([r.event]).concat(r.events_before),i=ie.map(n,o.getEventMapper()),s=e.getTimelineForEvent(i[0].getId());if(s){var a=ie.map(r.state,o.getEventMapper());s.getState(te.BACKWARDS).setUnknownStateEvents(a)}else s=e.addTimeline(),s.initialiseState(ie.map(r.state,o.getEventMapper())),s.getState(te.FORWARDS).paginationToken=r.end;return e.addEventsToTimeline(i,!0,s,r.start),e.getTimelineForEvent(t)||s})},s.prototype._createMessagesRequest=function(e,t,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0,i=ie.encodeUri("/rooms/$roomId/messages",{$roomId:e});void 0===r&&(r=30);var s={from:t,limit:r,dir:n},a=null;return this._clientOpts.lazyLoadMembers&&(a=(0,b.default)({},ae.LAZY_LOADING_MESSAGES_FILTER)),o&&(a=a||{},(0,b.default)(a,o.getRoomTimelineFilterComponent())),a&&(s.filter=(0,w.default)(a)),this._http.authedRequest(void 0,"GET",i,s)},s.prototype.paginateEventTimeline=function(e,t){var r=e.getTimelineSet()===this._notifTimelineSet;t=t||{};var n=t.backwards||!1;if(r&&!n)throw new Error("paginateNotifTimeline can only paginate backwards");var o=n?te.BACKWARDS:te.FORWARDS,i=e.getPaginationToken(o);if(!i)return j.default.resolve(!1);var s=e._paginationRequests[o];if(s)return s;var a=void 0,u=void 0,c=void 0,l=this;if(r)a="/notifications",u={limit:"limit"in t?t.limit:30,only:"highlight"},i&&"end"!==i&&(u.from=i),c=this._http.authedRequestWithPrefix(void 0,"GET",a,u,void 0,X.PREFIX_UNSTABLE).then(function(t){for(var r=t.next_token,i=[],s=0;s0&&(u="/_matrix/media/v1/thumbnail/");var l=a.indexOf("#"),d="";return l>=0&&(d=a.substr(l),a=a.substr(0,l)),e+u+a+(0===n.keys(c).length?"":"?"+n.encodeParams(c))+d},getIdenticonUri:function(e,t,r,o){if(!t)return null;r||(r=96),o||(o=96);var i={width:r,height:o};return e+n.encodeUri("/_matrix/media/v1/identicon/$ident",{$ident:t})+(0===n.keys(i).length?"":"?"+n.encodeParams(i))}}},{"./utils":55}],7:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var o=e("babel-runtime/helpers/slicedToArray"),i=n(o),s=e("babel-runtime/core-js/object/entries"),a=n(s),u=e("bluebird"),c=n(u),l=e("babel-runtime/regenerator"),d=n(l),f=e("babel-runtime/core-js/object/keys"),p=n(f),h=e("babel-runtime/core-js/get-iterator"),v=n(h),m=e("babel-runtime/helpers/classCallCheck"),y=n(m),_=e("babel-runtime/helpers/createClass"),g=n(_),b=function(){var e=(0,u.coroutine)(d.default.mark(function e(t,r,n,o){var i,s,a,c;return d.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:i=!1,e.t0=d.default.keys(n);case 2:if((e.t1=e.t0()).done){e.next=9;break}if(s=e.t1.value,n.hasOwnProperty(s)){e.next=6;break}return e.abrupt("continue",2);case 6: +s in o||(S.default.log("Device "+r+":"+s+" has been removed"),delete n[s],i=!0),e.next=2;break;case 9:e.t2=d.default.keys(o);case 10:if((e.t3=e.t2()).done){e.next=27;break}if(a=e.t3.value,o.hasOwnProperty(a)){e.next=14;break}return e.abrupt("continue",10);case 14:if(c=o[a],c.user_id===r){e.next=18;break}return S.default.warn("Mismatched user_id "+c.user_id+" in keys from "+r+":"+a),e.abrupt("continue",10);case 18:if(c.device_id===a){e.next=21;break}return S.default.warn("Mismatched device_id "+c.device_id+" in keys from "+r+":"+a),e.abrupt("continue",10);case 21:return e.next=23,(0,u.resolve)(E(t,n,c));case 23:if(!e.sent){e.next=25;break}i=!0;case 25:e.next=10;break;case 27:return e.abrupt("return",i);case 28:case"end":return e.stop()}},e,this)}));return function(t,r,n,o){return e.apply(this,arguments)}}(),E=function(){var e=(0,u.coroutine)(d.default.mark(function e(t,r,n){var o,i,s,a,c,l;return d.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n.keys){e.next=2;break}return e.abrupt("return",!1);case 2:if(o=n.device_id,i=n.user_id,s="ed25519:"+o,a=n.keys[s]){e.next=9;break}return S.default.warn("Device "+i+":"+o+" has no ed25519 key"),e.abrupt("return",!1);case 9:return c=n.unsigned||{},e.prev=10,e.next=13,(0,u.resolve)(R.default.verifySignature(t,n,i,o,a));case 13:e.next=19;break;case 15:return e.prev=15,e.t0=e.catch(10),S.default.warn("Unable to verify signature on device "+i+":"+o+":"+e.t0),e.abrupt("return",!1);case 19:if(l=void 0,!(o in r)){e.next=27;break}if(l=r[o],l.getFingerprint()==a){e.next=25;break}return S.default.warn("Ed25519 key for device "+i+":"+o+" has changed"),e.abrupt("return",!1);case 25:e.next=28;break;case 27:r[o]=l=new T.default(o);case 28:return l.keys=n.keys||{},l.algorithms=n.algorithms||[],l.unsigned=c,e.abrupt("return",!0);case 32:case"end":return e.stop()}},e,this,[[10,15]])}));return function(t,r,n){return e.apply(this,arguments)}}(),w=e("../logger"),S=n(w),k=e("./deviceinfo"),T=n(k),x=e("./olmlib"),R=n(x),I=e("./store/indexeddb-crypto-store"),C=n(I),j=function(){function e(t,r,n,o){(0,y.default)(this,e),this._cryptoStore=r,this._sessionStore=n,this._devices={},this._userByIdentityKey={},this._deviceTrackingStatus={},this._syncToken=null,this._serialiser=new O(t,o,this),this._keyDownloadsInProgressByUser={},this._dirty=!1,this._savePromise=null,this._resolveSavePromise=null,this._savePromiseTime=null,this._saveTimer=null}return(0,g.default)(e,[{key:"load",value:function(){function e(){return t.apply(this,arguments)}var t=(0,u.coroutine)(d.default.mark(function e(){var t,r,n,o,i,s,a,c=this;return d.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=!1,e.next=3,(0,u.resolve)(this._cryptoStore.doTxn("readwrite",[C.default.STORE_DEVICE_DATA],function(e){c._cryptoStore.getEndToEndDeviceData(e,function(r){null===r?(S.default.log("Migrating e2e device data..."),c._devices=c._sessionStore.getAllEndToEndDevices()||{},c._deviceTrackingStatus=c._sessionStore.getEndToEndDeviceTrackingStatus()||{},c._syncToken=c._sessionStore.getEndToEndDeviceSyncToken(),c._cryptoStore.storeEndToEndDeviceData({devices:c._devices,trackingStatus:c._deviceTrackingStatus,syncToken:c._syncToken},e),t=!0):(c._devices=r?r.devices:{},c._deviceTrackingStatus=r?r.trackingStatus:{},c._syncToken=r?r.syncToken:null),c._userByIdentityKey={};var n=!0,o=!1,i=void 0;try{for(var s,a=(0,v.default)((0,p.default)(c._devices));!(n=(s=a.next()).done);n=!0){var u=s.value,l=c._devices[u],d=!0,f=!1,h=void 0;try{for(var m,y=(0,v.default)((0,p.default)(l));!(d=(m=y.next()).done);d=!0){var _=m.value,g=l[_].keys["curve25519:"+_];void 0!==g&&(c._userByIdentityKey[g]=u)}}catch(e){f=!0,h=e}finally{try{!d&&y.return&&y.return()}finally{if(f)throw h}}}}catch(e){o=!0,i=e}finally{try{!n&&a.return&&a.return()}finally{if(o)throw i}}})}));case 3:for(t&&this._sessionStore.removeEndToEndDeviceData(),r=!0,n=!1,o=void 0,e.prev=7,i=(0,v.default)((0,p.default)(this._deviceTrackingStatus));!(r=(s=i.next()).done);r=!0)a=s.value,2==this._deviceTrackingStatus[a]&&(this._deviceTrackingStatus[a]=1);e.next=15;break;case 11:e.prev=11,e.t0=e.catch(7),n=!0,o=e.t0;case 15:e.prev=15,e.prev=16,!r&&i.return&&i.return();case 18:if(e.prev=18,!n){e.next=21;break}throw o;case 21:return e.finish(18);case 22:return e.finish(15);case 23:case"end":return e.stop()}},e,this,[[7,11,15,23],[16,,18,22]])}));return e}()},{key:"stop",value:function(){null!==this._saveTimer&&clearTimeout(this._saveTimer)}},{key:"saveIfDirty",value:function(){function e(e){return t.apply(this,arguments)}var t=(0,u.method)(function(e){var t=this;if(!this._dirty)return c.default.resolve(!1);void 0===e&&(e=500);var r=Date.now+e;this._savePromiseTime&&rb)throw new Error("Message too long ("+e.length+" bytes). The maximum for an encrypted message is "+b+" bytes.")}function i(e,t){this._sessionStore=e,this._cryptoStore=t,this._pickleKey="DEFAULT_KEY",this.deviceCurve25519Key=null,this.deviceEd25519Key=null,this._maxOneTimeKeys=null,this._outboundGroupSessionStore={},this._inboundGroupSessionMessageIndexes={}}var s=e("babel-runtime/core-js/object/assign"),a=n(s),u=e("babel-runtime/core-js/get-iterator"),c=n(u),l=e("babel-runtime/core-js/object/keys"),d=n(l),f=e("babel-runtime/regenerator"),p=n(f),h=e("bluebird"),v=function(){var e=(0,h.coroutine)(p.default.mark(function e(t,r,n,o){return p.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,h.resolve)(r.doTxn("readwrite",[g.default.STORE_ACCOUNT],function(e){r.getAccount(e,function(t){null!==t?o.unpickle(n,t):(o.create(),t=o.pickle(n),r.storeAccount(e,t))})}));case 2:case"end":return e.stop()}},e,this)}));return function(t,r,n,o){return e.apply(this,arguments)}}(),m=e("../logger"),y=n(m),_=e("./store/indexeddb-crypto-store"),g=n(_),b=49152;i.prototype.init=(0,h.coroutine)(p.default.mark(function e(){var t,n;return p.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,h.resolve)(this._migrateFromSessionStore());case 2:return t=void 0,n=new r.Olm.Account,e.prev=4,e.next=7,(0,h.resolve)(v(this._sessionStore,this._cryptoStore,this._pickleKey,n));case 7:t=JSON.parse(n.identity_keys()),this._maxOneTimeKeys=n.max_number_of_one_time_keys();case 9:return e.prev=9,n.free(),e.finish(9);case 12:this.deviceCurve25519Key=t.curve25519,this.deviceEd25519Key=t.ed25519;case 14:case"end":return e.stop()}},e,this,[[4,,9,12]])})),i.getOlmVersion=function(){return r.Olm.get_library_version()},i.prototype._migrateFromSessionStore=(0,h.coroutine)(p.default.mark(function e(){var t,r,n,o=this;return p.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,h.resolve)(this._cryptoStore.doTxn("readwrite",[g.default.STORE_ACCOUNT],function(e){o._cryptoStore.getAccount(e,function(t){null===t&&null!==(t=o._sessionStore.getEndToEndAccount())&&(y.default.log("Migrating account from session store"),o._cryptoStore.storeAccount(e,t))})}));case 2:if(this._sessionStore.removeEndToEndAccount(),t=this._sessionStore.getAllEndToEndSessions(),!((0,d.default)(t).length>0)){e.next=8;break}return e.next=7,(0,h.resolve)(this._cryptoStore.doTxn("readwrite",[g.default.STORE_SESSIONS],function(e){o._cryptoStore.countEndToEndSessions(e,function(r){if(r)return void y.default.log("Crypto store already has sessions: not migrating");var n=0,i=!0,s=!1,a=void 0;try{for(var u,l=(0,c.default)((0,d.default)(t));!(i=(u=l.next()).done);i=!0){var f=u.value,p=!0,h=!1,v=void 0;try{for(var m,_=(0,c.default)((0,d.default)(t[f]));!(p=(m=_.next()).done);p=!0){var g=m.value;n++,o._cryptoStore.storeEndToEndSession(f,g,t[f][g],e)}}catch(e){h=!0,v=e}finally{try{!p&&_.return&&_.return()}finally{if(h)throw v}}}}catch(e){s=!0,a=e}finally{try{!i&&l.return&&l.return()}finally{if(s)throw a}}y.default.log("Migrating "+n+" sessions from session store")})}));case 7:this._sessionStore.removeAllEndToEndSessions();case 8:if(r=this._sessionStore.getAllEndToEndInboundGroupSessionKeys(),!((0,d.default)(r).length>0)){e.next=14;break}return n=0,e.next=13,(0,h.resolve)(this._cryptoStore.doTxn("readwrite",[g.default.STORE_INBOUND_GROUP_SESSIONS],function(e){var t=!0,i=!1,s=void 0;try{for(var a,u=(0,c.default)(r);!(t=(a=u.next()).done);t=!0){var l=a.value;try{o._cryptoStore.addEndToEndInboundGroupSession(l.senderKey,l.sessionId,JSON.parse(o._sessionStore.getEndToEndInboundGroupSession(l.senderKey,l.sessionId)),e)}catch(e){y.default.warn("Failed to migrate session "+l.senderKey+"/"+l.sessionId+": "+e.stack||e)}++n}}catch(e){i=!0,s=e}finally{try{!t&&u.return&&u.return()}finally{if(i)throw s}}y.default.log("Migrated "+n+" inbound group sessions from session store")}));case 13:this._sessionStore.removeAllEndToEndInboundGroupSessions();case 14:case"end":return e.stop()}},e,this)})),i.prototype._getAccount=function(e,t){var n=this;this._cryptoStore.getAccount(e,function(e){var o=new r.Olm.Account;try{o.unpickle(n._pickleKey,e),t(o)}finally{o.free()}})},i.prototype._storeAccount=function(e,t){this._cryptoStore.storeAccount(e,t.pickle(this._pickleKey))},i.prototype._getSession=function(e,t,r,n){var o=this;this._cryptoStore.getEndToEndSession(e,t,r,function(e){o._unpickleSession(e,n)})},i.prototype._unpickleSession=function(e,t){var n=new r.Olm.Session;try{n.unpickle(this._pickleKey,e.session);t((0,a.default)({},e,{session:n}))}finally{n.free()}},i.prototype._saveSession=function(e,t,r){var n=t.session.session_id(),o=(0,a.default)(t,{session:t.session.pickle(this._pickleKey)});this._cryptoStore.storeEndToEndSession(e,n,o,r)},i.prototype._getUtility=function(e){var t=new r.Olm.Utility;try{return e(t)}finally{t.free()}},i.prototype.sign=function(){var e=(0,h.coroutine)(p.default.mark(function e(t){var r,n=this;return p.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=void 0,e.next=3,(0,h.resolve)(this._cryptoStore.doTxn("readonly",[g.default.STORE_ACCOUNT],function(e){n._getAccount(e,function(e){r=e.sign(t)})}));case 3:return e.abrupt("return",r);case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}(),i.prototype.getOneTimeKeys=(0,h.coroutine)(p.default.mark(function e(){var t,r=this;return p.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=void 0,e.next=3,(0,h.resolve)(this._cryptoStore.doTxn("readonly",[g.default.STORE_ACCOUNT],function(e){r._getAccount(e,function(e){t=JSON.parse(e.one_time_keys())})}));case 3:return e.abrupt("return",t);case 4:case"end":return e.stop()}},e,this)})),i.prototype.maxNumberOfOneTimeKeys=function(){return this._maxOneTimeKeys},i.prototype.markKeysAsPublished=(0,h.coroutine)(p.default.mark(function e(){var t=this;return p.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,h.resolve)(this._cryptoStore.doTxn("readwrite",[g.default.STORE_ACCOUNT],function(e){t._getAccount(e,function(r){r.mark_keys_as_published(),t._storeAccount(e,r)})}));case 2:case"end":return e.stop()}},e,this)})),i.prototype.generateOneTimeKeys=function(e){var t=this;return this._cryptoStore.doTxn("readwrite",[g.default.STORE_ACCOUNT],function(r){t._getAccount(r,function(n){n.generate_one_time_keys(e),t._storeAccount(r,n)})})},i.prototype.createOutboundSession=function(){var e=(0,h.coroutine)(p.default.mark(function e(t,n){var o,i=this;return p.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return o=void 0,e.next=3,(0,h.resolve)(this._cryptoStore.doTxn("readwrite",[g.default.STORE_ACCOUNT,g.default.STORE_SESSIONS],function(e){i._getAccount(e,function(s){var a=new r.Olm.Session;try{a.create_outbound(s,t,n),o=a.session_id(),i._storeAccount(e,s);var u={session:a,lastReceivedMessageTs:Date.now()};i._saveSession(t,u,e)}finally{a.free()}})}));case 3:return e.abrupt("return",o);case 4:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}(),i.prototype.createInboundSession=function(){var e=(0,h.coroutine)(p.default.mark(function e(t,n,o){var i,s=this;return p.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(0===n){e.next=2;break}throw new Error("Need messageType == 0 to create inbound session");case 2:return i=void 0,e.next=5,(0,h.resolve)(this._cryptoStore.doTxn("readwrite",[g.default.STORE_ACCOUNT,g.default.STORE_SESSIONS],function(e){s._getAccount(e,function(a){var u=new r.Olm.Session;try{u.create_inbound_from(a,t,o),a.remove_one_time_keys(u),s._storeAccount(e,a);var c=u.decrypt(n,o),l={session:u,lastReceivedMessageTs:Date.now()};s._saveSession(t,l,e),i={payload:c,session_id:u.session_id()}}finally{u.free()}})}));case 5:return e.abrupt("return",i);case 6:case"end":return e.stop()}},e,this)}));return function(t,r,n){return e.apply(this,arguments)}}(),i.prototype.getSessionIdsForDevice=function(){var e=(0,h.coroutine)(p.default.mark(function e(t){var r,n=this;return p.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=void 0,e.next=3,(0,h.resolve)(this._cryptoStore.doTxn("readonly",[g.default.STORE_SESSIONS],function(e){n._cryptoStore.getEndToEndSessions(t,e,function(e){r=(0,d.default)(e)})}));case 3:return e.abrupt("return",r);case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}(),i.prototype.getSessionIdForDevice=function(){var e=(0,h.coroutine)(p.default.mark(function e(t){var r,n,o,i,s,a,u;return p.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,h.resolve)(this.getSessionInfoForDevice(t));case 2:if(r=e.sent,0!==r.length){e.next=5;break}return e.abrupt("return",null);case 5:for(n=0,o=1;ou||s===u&&i.sessionId1&&void 0!==arguments[1]&&arguments[1];return this._cryptoStore.getOutgoingRoomKeyRequest(e).then(function(n){if(n)switch(n.state){case _.CANCELLATION_PENDING:case _.CANCELLATION_PENDING_AND_WILL_RESEND:return;case _.UNSENT:return v.default.log("deleting unnecessary room key request for "+o(e)),t._cryptoStore.deleteOutgoingRoomKeyRequest(n.requestId,_.UNSENT);case _.SENT:var i=r?_.CANCELLATION_PENDING_AND_WILL_RESEND:_.CANCELLATION_PENDING;return t._cryptoStore.updateOutgoingRoomKeyRequest(n.requestId,_.SENT,{state:i,cancellationTxnId:t._baseApis.makeTxnId()}).then(function(n){if(!n)return void v.default.log("Tried to cancel room key request for "+o(e)+" but it was already cancelled in another tab");t._sendOutgoingRoomKeyRequestCancellation(n,r).catch(function(e){v.default.error("Error sending room key request cancellation; will retry later.",e),t._startTimer()}).then(function(){r&&t._startTimer()})});default:throw new Error("unhandled state: "+n.state)}})}},{key:"getOutgoingSentRoomKeyRequest",value:function(e,t){return this._cryptoStore.getOutgoingRoomKeyRequestsByTarget(e,t,[_.SENT])}},{key:"_startTimer",value:function(){var e=this;if(!this._sendOutgoingRoomKeyRequestsTimer){var r=function(){if(e._sendOutgoingRoomKeyRequestsRunning)throw new Error("RoomKeyRequestSend already in progress!");e._sendOutgoingRoomKeyRequestsRunning=!0,e._sendOutgoingRoomKeyRequests().finally(function(){e._sendOutgoingRoomKeyRequestsRunning=!1}).catch(function(e){v.default.warn("error in OutgoingRoomKeyRequestManager: "+e)}).done()};this._sendOutgoingRoomKeyRequestsTimer=t.setTimeout(r,500)}}},{key:"_sendOutgoingRoomKeyRequests",value:function(){var e=this;return this._clientRunning?(v.default.log("Looking for queued outgoing room key requests"),this._cryptoStore.getOutgoingRoomKeyRequestByState([_.CANCELLATION_PENDING,_.CANCELLATION_PENDING_AND_WILL_RESEND,_.UNSENT]).then(function(t){if(!t)return v.default.log("No more outgoing room key requests"),void(e._sendOutgoingRoomKeyRequestsTimer=null);var r=void 0;switch(t.state){case _.UNSENT:r=e._sendOutgoingRoomKeyRequest(t);break;case _.CANCELLATION_PENDING:r=e._sendOutgoingRoomKeyRequestCancellation(t);break;case _.CANCELLATION_PENDING_AND_WILL_RESEND:r=e._sendOutgoingRoomKeyRequestCancellation(t,!0)}return r.then(function(){return e._sendOutgoingRoomKeyRequests()}).catch(function(t){v.default.error("Error sending room key request; will retry later.",t),e._sendOutgoingRoomKeyRequestsTimer=null,e._startTimer()}).done()})):(this._sendOutgoingRoomKeyRequestsTimer=null,p.default.resolve())}},{key:"_sendOutgoingRoomKeyRequest",value:function(e){var t=this;v.default.log("Requesting keys for "+o(e.requestBody)+" from "+i(e.recipients)+"(id "+e.requestId+")");var r={action:"request",requesting_device_id:this._deviceId,request_id:e.requestId,body:e.requestBody};return this._sendMessageToDevices(r,e.recipients,e.requestId).then(function(){return t._cryptoStore.updateOutgoingRoomKeyRequest(e.requestId,_.UNSENT,{state:_.SENT})})}},{key:"_sendOutgoingRoomKeyRequestCancellation",value:function(e,t){var r=this;v.default.log("Sending cancellation for key request for "+o(e.requestBody)+" to "+i(e.recipients)+" (cancellation id "+e.cancellationTxnId+")");var n={action:"request_cancellation",requesting_device_id:this._deviceId,request_id:e.requestId};return this._sendMessageToDevices(n,e.recipients,e.cancellationTxnId).then(function(){return t?r._cryptoStore.updateOutgoingRoomKeyRequest(e.requestId,_.CANCELLATION_PENDING_AND_WILL_RESEND,{state:_.UNSENT}):r._cryptoStore.deleteOutgoingRoomKeyRequest(e.requestId,_.CANCELLATION_PENDING)})}},{key:"_sendMessageToDevices",value:function(e,t,r){var n={},o=!0,i=!1,s=void 0;try{for(var u,c=(0,a.default)(t);!(o=(u=c.next()).done);o=!0){var l=u.value;n[l.userId]||(n[l.userId]={}),n[l.userId][l.deviceId]=e}}catch(e){i=!0,s=e}finally{try{!o&&c.return&&c.return()}finally{if(i)throw s}}return this._baseApis.sendToDevice("m.room_key_request",n,r)}}]),e}();r.default=g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../logger":29,"../utils":55,"babel-runtime/core-js/get-iterator":58,"babel-runtime/helpers/classCallCheck":79,"babel-runtime/helpers/createClass":80,bluebird:89}],10:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var o=e("babel-runtime/regenerator"),i=n(o),s=e("babel-runtime/core-js/get-iterator"),a=n(s),u=e("babel-runtime/core-js/object/keys"),c=n(u),l=e("bluebird"),d=e("babel-runtime/helpers/classCallCheck"),f=n(d),p=e("babel-runtime/helpers/createClass"),h=n(p),v=e("./store/indexeddb-crypto-store"),m=n(v),y=function(){function e(t,r){(0,f.default)(this,e),this._cryptoStore=t,this._sessionStore=r,this._roomEncryption={}}return(0,h.default)(e,[{key:"init",value:function(){function e(){return t.apply(this,arguments)}var t=(0,l.coroutine)(i.default.mark(function e(){var t,r=this;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=!1,e.next=3,(0,l.resolve)(this._cryptoStore.doTxn("readwrite",[m.default.STORE_ROOMS],function(e){r._cryptoStore.getEndToEndRooms(e,function(n){if(null===n||0===(0,c.default)(n).length){var o=r._sessionStore.getAllEndToEndRooms();if(null!==o){var i=!0,s=!1,u=void 0;try{for(var l,d=(0,a.default)((0,c.default)(o));!(i=(l=d.next()).done);i=!0){var f=l.value;r._cryptoStore.storeEndToEndRoom(f,o[f],e)}}catch(e){s=!0,u=e}finally{try{!i&&d.return&&d.return()}finally{if(s)throw u}}}r._roomEncryption=o,t=!0}else r._roomEncryption=n})}));case 3:t&&this._sessionStore.removeAllEndToEndRooms();case 4:case"end":return e.stop()}},e,this)}));return e}()},{key:"getRoomEncryption",value:function(e){return this._roomEncryption[e]||null}},{key:"isRoomEncrypted",value:function(e){return Boolean(this.getRoomEncryption(e))}},{key:"setRoomEncryption",value:function(){function e(e,r){return t.apply(this,arguments)}var t=(0,l.coroutine)(i.default.mark(function e(t,r){var n=this;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this._roomEncryption[t]=r,e.next=3,(0,l.resolve)(this._cryptoStore.doTxn("readwrite",[m.default.STORE_ROOMS],function(e){n._cryptoStore.storeEndToEndRoom(t,r,e)}));case 3:case"end":return e.stop()}},e,this)}));return e}()}]),e}();r.default=y},{"./store/indexeddb-crypto-store":21,"babel-runtime/core-js/get-iterator":58,"babel-runtime/core-js/object/keys":69,"babel-runtime/helpers/classCallCheck":79,"babel-runtime/helpers/createClass":80,"babel-runtime/regenerator":86,bluebird:89}],11:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var r=e.name+"[msg: "+e.message;return t&&(r+=", "+(0,a.default)(t).map(function(e){return e+": "+t[e]}).join(", ")),r+="]"}function i(e,t,r){b[e]=t,E[e]=r}Object.defineProperty(r,"__esModule",{value:!0}),r.UnknownDeviceError=r.DecryptionError=r.DecryptionAlgorithm=r.EncryptionAlgorithm=r.DECRYPTION_CLASSES=r.ENCRYPTION_CLASSES=void 0;var s=e("babel-runtime/core-js/object/keys"),a=n(s),u=e("babel-runtime/core-js/object/get-prototype-of"),c=n(u),l=e("babel-runtime/helpers/possibleConstructorReturn"),d=n(l),f=e("babel-runtime/helpers/inherits"),p=n(f),h=e("babel-runtime/helpers/classCallCheck"),v=n(h),m=e("babel-runtime/helpers/createClass"),y=n(m);r.registerAlgorithm=i;var _=e("bluebird"),g=n(_),b=r.ENCRYPTION_CLASSES={},E=r.DECRYPTION_CLASSES={},w=function(){function e(t){(0,v.default)(this,e),this._userId=t.userId,this._deviceId=t.deviceId,this._crypto=t.crypto,this._olmDevice=t.olmDevice,this._baseApis=t.baseApis,this._roomId=t.roomId}return(0,y.default)(e,[{key:"onRoomMembership",value:function(e,t,r){}}]),e}();r.EncryptionAlgorithm=w;var S=function(){function e(t){(0,v.default)(this,e),this._userId=t.userId,this._crypto=t.crypto,this._olmDevice=t.olmDevice,this._baseApis=t.baseApis,this._roomId=t.roomId}return(0,y.default)(e,[{key:"onRoomKeyEvent",value:function(e){}},{key:"importRoomKey",value:function(e){}},{key:"hasKeysForKeyRequest",value:function(e){return g.default.resolve(!1)}},{key:"shareKeysWithDevice",value:function(e){throw new Error("shareKeysWithDevice not supported for this DecryptionAlgorithm")}}]),e}();r.DecryptionAlgorithm=S;var k=function(e){function t(e,r,n){(0,v.default)(this,t);var i=(0,d.default)(this,(t.__proto__||(0,c.default)(t)).call(this,r));return i.code=e,i.name="DecryptionError",i.detailedString=o(i,n),i}return(0,p.default)(t,e),t}(Error);r.DecryptionError=k;r.UnknownDeviceError=function(e){function t(e,r){(0,v.default)(this,t);var n=(0,d.default)(this,(t.__proto__||(0,c.default)(t)).call(this,e));return n.name="UnknownDeviceError",n.devices=r,n}return(0,p.default)(t,e),t}(Error)},{"babel-runtime/core-js/object/get-prototype-of":68,"babel-runtime/core-js/object/keys":69,"babel-runtime/helpers/classCallCheck":79,"babel-runtime/helpers/createClass":80,"babel-runtime/helpers/inherits":82,"babel-runtime/helpers/possibleConstructorReturn":83,bluebird:89}],12:[function(e,t,r){"use strict";var n=e("./base");e("./olm"),e("./megolm"),t.exports.ENCRYPTION_CLASSES=n.ENCRYPTION_CLASSES,t.exports.DECRYPTION_CLASSES=n.DECRYPTION_CLASSES,t.exports.DecryptionError=n.DecryptionError},{"./base":11,"./megolm":13,"./olm":14}],13:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){this.sessionId=e,this.useCount=0,this.creationTime=(new Date).getTime(),this.sharedWithDevices={}}function i(e){k.EncryptionAlgorithm.call(this,e),this._setupPromise=b.default.resolve(),this._outboundSessions={},this._sessionRotationPeriodMsgs=100,this._sessionRotationPeriodMs=6048e5,void 0!==e.config.rotation_period_ms&&(this._sessionRotationPeriodMs=e.config.rotation_period_ms),void 0!==e.config.rotation_period_msgs&&(this._sessionRotationPeriodMsgs=e.config.rotation_period_msgs)}function s(e){k.DecryptionAlgorithm.call(this,e),this._pendingEvents={},this.olmlib=S}var a=e("babel-runtime/core-js/set"),u=n(a),c=e("babel-runtime/core-js/json/stringify"),l=n(c),d=e("babel-runtime/helpers/defineProperty"),f=n(d),p=e("babel-runtime/core-js/object/keys"),h=n(p),v=e("babel-runtime/core-js/get-iterator"),m=n(v),y=e("babel-runtime/regenerator"),_=n(y),g=e("bluebird"),b=n(g),E=e("../../logger"),w=e("../../utils"),S=e("../olmlib"),k=e("./base");o.prototype.needsRotation=function(e,t){var r=(new Date).getTime()-this.creationTime;return(this.useCount>=e||r>=t)&&(E.log("Rotating megolm session after "+this.useCount+" messages, "+r+"ms"),!0)},o.prototype.markSharedWithDevice=function(e,t,r){this.sharedWithDevices[e]||(this.sharedWithDevices[e]={}),this.sharedWithDevices[e][t]=r},o.prototype.sharedWithTooManyDevices=function(e){for(var t in this.sharedWithDevices)if(this.sharedWithDevices.hasOwnProperty(t)){if(!e.hasOwnProperty(t))return E.log("Starting new session because we shared with "+t),!0;for(var r in this.sharedWithDevices[t])if(this.sharedWithDevices[t].hasOwnProperty(r)&&!e[t].hasOwnProperty(r))return E.log("Starting new session because we shared with "+t+":"+r),!0}},w.inherits(i,k.EncryptionAlgorithm),i.prototype._ensureOutboundSession=function(e){function t(){return o}var r=function(){var t=(0,g.coroutine)(_.default.mark(function t(r){var i,s,a,u,c,l;return _.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(o=r,o&&o.needsRotation(n._sessionRotationPeriodMsgs,n._sessionRotationPeriodMs)&&(E.log("Starting new megolm session because we need to rotate."),o=null),o&&o.sharedWithTooManyDevices(e)&&(o=null),o){t.next=9;break}return E.log("Starting new megolm session for room "+n._roomId),t.next=7,(0,g.resolve)(n._prepareNewSession());case 7:o=t.sent,n._outboundSessions[o.sessionId]=o;case 9:i={},t.t0=_.default.keys(e);case 11:if((t.t1=t.t0()).done){t.next=30;break}if(s=t.t1.value,e.hasOwnProperty(s)){t.next=15;break}return t.abrupt("continue",11);case 15:a=e[s],t.t2=_.default.keys(a);case 17:if((t.t3=t.t2()).done){t.next=28;break}if(u=t.t3.value,a.hasOwnProperty(u)){t.next=21;break}return t.abrupt("continue",17);case 21:if(c=a[u],(l=c.getIdentityKey())!=n._olmDevice.deviceCurve25519Key){t.next=25;break}return t.abrupt("continue",17);case 25:o.sharedWithDevices[s]&&void 0!==o.sharedWithDevices[s][u]||(i[s]=i[s]||[],i[s].push(c)),t.next=17;break;case 28:t.next=11;break;case 30:return t.abrupt("return",n._shareKeyWithDevices(o,i));case 31:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}(),n=this,o=void 0,i=this._setupPromise.then(r);return this._setupPromise=i.then(t,t),i.then(t)},i.prototype._prepareNewSession=(0,g.coroutine)(_.default.mark(function e(){var t,r;return _.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._olmDevice.createOutboundGroupSession(),r=this._olmDevice.getOutboundGroupSessionKey(t),e.next=4,(0,g.resolve)(this._olmDevice.addInboundGroupSession(this._roomId,this._olmDevice.deviceCurve25519Key,[],t,r.key,{ed25519:this._olmDevice.deviceEd25519Key}));case 4:return this._crypto.backupInfo&&this._crypto.backupGroupSession(this._roomId,this._olmDevice.deviceCurve25519Key,[],t,r.key).catch(function(e){console.log("Failed to back up group session",e)}),e.abrupt("return",new o(t));case 6:case"end":return e.stop()}},e,this)})),i.prototype._splitUserDeviceMap=function(e,t,r,n){var o=[],i=0,s=0,a=!0,u=!1,c=void 0;try{for(var l,d=(0,m.default)((0,h.default)(n));!(a=(l=d.next()).done);a=!0)for(var f=l.value,p=n[f],v=r[f],y=0;y20&&(s=0,i++),o[i]||(o[i]=[]),o[i].push({userId:f,deviceInfo:_}),s++):e.markSharedWithDevice(f,g,t)}}catch(e){u=!0,c=e}finally{try{!a&&d.return&&d.return()}finally{if(u)throw c}}return o},i.prototype._encryptAndSendKeysToDevices=function(e,t,r,n){for(var o=this,i={algorithm:S.OLM_ALGORITHM,sender_key:this._olmDevice.deviceCurve25519Key,ciphertext:{}},s={},a=[],u=0;u0)return null;var n=this._deviceList.getDeviceByIdentityKey(r,t);if(null===n)return null;var o=e.getClaimedEd25519Key();return o?o!==n.getFingerprint()?(M.warn("Event "+e.getId()+" claims ed25519 key "+o+"but sender device has key "+n.getFingerprint()),null):n:(M.warn("Event "+e.getId()+" claims no ed25519 key: cannot verify sending device"),null)},i.prototype.forceDiscardSession=function(e){var t=this._roomEncryptors[e];if(void 0===t)throw new Error("Room not encrypted");if(void 0===t.forceDiscardSession)throw new Error("Room encryption algorithm doesn't support session discarding");t.forceDiscardSession()},i.prototype.setRoomEncryption=function(){var e=(0,g.coroutine)(x.default.mark(function e(t,r,n){var o,i,s,a,u;return x.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(o=this._roomList.getRoomEncryption(t))){e.next=5;break}if((0,_.default)(o)==(0,_.default)(r)){e.next=5;break}return M.error("Ignoring m.room.encryption event which requests a change of config in "+t),e.abrupt("return");case 5:if(!(i=this._roomEncryptors[t])){e.next=8;break}return e.abrupt("return");case 8:if(s=null,o||(s=this._roomList.setRoomEncryption(t,r)),a=N.ENCRYPTION_CLASSES[r.algorithm]){e.next=13;break}throw new Error("Unable to encrypt with "+r.algorithm);case 13:if(u=new a({userId:this._userId,deviceId:this._deviceId,crypto:this,olmDevice:this._olmDevice,baseApis:this._baseApis,roomId:t,config:r}),this._roomEncryptors[t]=u,!s){e.next=18;break}return e.next=18,(0,g.resolve)(s);case 18:if(this._lazyLoadMembers){e.next=25;break}return M.log("Enabling encryption in "+t+"; starting to track device lists for all users therein"),e.next=22,(0,g.resolve)(this.trackRoomDevices(t));case 22:this.inhibitDeviceQuery||this._deviceList.refreshOutdatedDeviceLists(),e.next=26;break;case 25:M.log("Enabling encryption in "+t);case 26:case"end":return e.stop()}},e,this)}));return function(t,r,n){return e.apply(this,arguments)}}(),i.prototype.trackRoomDevices=function(e){var t=this,r=function(){var r=(0,g.coroutine)(x.default.mark(function r(){var n,o;return x.default.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(t._roomEncryptors[e]){r.next=2;break}return r.abrupt("return");case 2:if(n=t._clientStore.getRoom(e)){r.next=5;break}throw new Error("Unable to start tracking devices in unknown room "+e);case 5:return M.log("Starting to track devices for room "+e+" ..."),r.next=8,(0,g.resolve)(n.getEncryptionTargetMembers());case 8:o=r.sent,o.forEach(function(e){t._deviceList.startTrackingDeviceList(e.userId)});case 10:case"end":return r.stop()}},r,t)}));return function(){return r.apply(this,arguments)}}(),n=this._roomDeviceTrackingState[e];return n||(n=r(),this._roomDeviceTrackingState[e]=n),n},i.prototype.ensureOlmSessionsForUsers=function(e){for(var t={},r=0;rDate.now())){e.next=11;break}return M.debug("New session already forced with device "+n+":"+i+" at "+s+": not forcing another"),e.abrupt("return");case 11:if(a=this._deviceList.getDeviceByIdentityKey(o,i)){e.next=15;break}return M.info("Couldn't find device for identity key "+i+": not re-establishing session"),e.abrupt("return");case 15:return u={},u[n]=[a],e.next=19,(0,g.resolve)(U.ensureOlmSessionsForDevices(this._olmDevice,this._baseApis,u,!0));case 19:return this._lastNewSessionForced[n][i]=Date.now(),c={algorithm:U.OLM_ALGORITHM,sender_key:this._olmDevice.deviceCurve25519Key,ciphertext:{}},e.next=23,(0,g.resolve)(U.encryptMessageForDevice(c.ciphertext,this._userId,this._deviceId,this._olmDevice,n,a,{type:"m.dummy"}));case 23:return e.next=25,(0,g.resolve)(this._baseApis.sendToDevice("m.room.encrypted",(0,l.default)({},n,(0,l.default)({},a.deviceId,c))));case 25:return e.next=27,(0,g.resolve)(this._outgoingRoomKeyRequestManager.getOutgoingSentRoomKeyRequest(n,a.deviceId));case 27:for(d=e.sent,f=!0,p=!1,h=void 0,e.prev=31,v=(0,k.default)(d);!(f=(m=v.next()).done);f=!0)y=m.value,this.cancelRoomKeyRequest(y.requestBody,!0);e.next=39;break;case 35:e.prev=35,e.t0=e.catch(31),p=!0,h=e.t0;case 39:e.prev=39,e.prev=40,!f&&v.return&&v.return();case 42:if(e.prev=42,!p){e.next=45;break}throw h;case 45:return e.finish(42);case 46:return e.finish(39);case 47:case"end":return e.stop()}},e,this,[[31,35,39,47],[40,,42,46]])}));return function(t){return e.apply(this,arguments)}}(),i.prototype._onRoomMembership=function(e,t,r){var n=t.roomId,o=this._roomEncryptors[n];o&&(this._roomDeviceTrackingState[n]&&("join"==t.membership?(M.log("Join event for "+t.userId+" in "+n),this._deviceList.startTrackingDeviceList(t.userId)):"invite"==t.membership&&this._clientStore.getRoom(n).shouldEncryptForInvitedMembers()&&(M.log("Invite event for "+t.userId+" in "+n),this._deviceList.startTrackingDeviceList(t.userId))),o.onRoomMembership(e,t,r))},i.prototype._onRoomKeyRequestEvent=function(e){var t=e.getContent();if("request"===t.action){var r=new K(e);this._receivedRoomKeyRequests.push(r)}else if("request_cancellation"===t.action){var n=new G(e);this._receivedRoomKeyRequestCancellations.push(n)}},i.prototype._processReceivedRoomKeyRequests=(0,g.coroutine)(x.default.mark(function e(){var t,r,n=this;return x.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._processingRoomKeyRequests){e.next=2;break}return e.abrupt("return");case 2:return this._processingRoomKeyRequests=!0,e.prev=3,t=this._receivedRoomKeyRequests,this._receivedRoomKeyRequests=[],r=this._receivedRoomKeyRequestCancellations,this._receivedRoomKeyRequestCancellations=[],e.next=10,(0,g.resolve)(b.default.map(t,function(e){return n._processReceivedRoomKeyRequest(e)}));case 10:return e.next=12,(0,g.resolve)(b.default.map(r,function(e){return n._processReceivedRoomKeyRequestCancellation(e)}));case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(3),M.error("Error processing room key requsts: "+e.t0);case 17:return e.prev=17,this._processingRoomKeyRequests=!1,e.finish(17);case 20:case"end":return e.stop()}},e,this,[[3,14,17,20]])})),i.prototype._processReceivedRoomKeyRequest=function(){var e=(0,g.coroutine)(x.default.mark(function e(t){var r,n,o,i,s,a,u,c,l;return x.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.userId,n=t.deviceId,o=t.requestBody,i=o.room_id,s=o.algorithm,M.log("m.room_key_request from "+r+":"+n+" for "+i+" / "+o.session_id+" (id "+t.requestId+")"),r===this._userId){e.next=24;break}if(this._roomEncryptors[i]){e.next=10;break}return M.debug("room key request for unencrypted room "+i),e.abrupt("return");case 10:if(a=this._roomEncryptors[i],u=this._deviceList.getStoredDevice(r,n)){e.next=15;break}return M.debug("Ignoring keyshare for unknown device "+r+":"+n),e.abrupt("return");case 15:return e.prev=15,e.next=18,(0,g.resolve)(a.reshareKeyWithDevice(o.sender_key,o.session_id,r,u));case 18:e.next=23;break;case 20:e.prev=20, +e.t0=e.catch(15),M.warn("Failed to re-share keys for session "+o.session_id+" with device "+r+":"+u.deviceId,e.t0);case 23:return e.abrupt("return");case 24:if(this._roomDecryptors[i]){e.next=27;break}return M.log("room key request for unencrypted room "+i),e.abrupt("return");case 27:if(c=this._roomDecryptors[i][s]){e.next=31;break}return M.log("room key request for unknown alg "+s+" in room "+i),e.abrupt("return");case 31:return e.next=33,(0,g.resolve)(c.hasKeysForKeyRequest(t));case 33:if(e.sent){e.next=36;break}return M.log("room key request for unknown session "+i+" / "+o.session_id),e.abrupt("return");case 36:if(t.share=function(){c.shareKeysWithDevice(t)},!(l=this._deviceList.getStoredDevice(r,n))||!l.isVerified()){e.next=42;break}return M.log("device is already verified: sharing keys"),t.share(),e.abrupt("return");case 42:this.emit("crypto.roomKeyRequest",t);case 43:case"end":return e.stop()}},e,this,[[15,20]])}));return function(t){return e.apply(this,arguments)}}(),i.prototype._processReceivedRoomKeyRequestCancellation=function(){var e=(0,g.method)(function(e){M.log("m.room_key_request cancellation for "+e.userId+":"+e.deviceId+" (id "+e.requestId+")"),this.emit("crypto.roomKeyRequestCancellation",e)});return function(t){return e.apply(this,arguments)}}(),i.prototype._getRoomDecryptor=function(e,t){var r=void 0,n=void 0;if((e=e||null)&&(r=this._roomDecryptors[e],r||(this._roomDecryptors[e]=r={}),n=r[t]))return n;var o=N.DECRYPTION_CLASSES[t];if(!o)throw new N.DecryptionError("UNKNOWN_ENCRYPTION_ALGORITHM",'Unknown encryption algorithm "'+t+'".');return n=new o({userId:this._userId,crypto:this,olmDevice:this._olmDevice,baseApis:this._baseApis,roomId:e}),r&&(r[t]=n),n},i.prototype._signObject=function(){var e=(0,g.coroutine)(x.default.mark(function e(t){var r;return x.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r={},r[this._userId]={},e.next=4,(0,g.resolve)(this._olmDevice.sign(D.stringify(t)));case 4:r[this._userId]["ed25519:"+this._deviceId]=e.sent,t.signatures=r;case 6:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}();var K=function e(t){(0,u.default)(this,e);var r=t.getContent();this.userId=t.getSender(),this.deviceId=r.requesting_device_id,this.requestId=r.request_id,this.requestBody=r.body||{},this.share=function(){throw new Error("don't know how to share keys for this request yet")}},G=function e(t){(0,u.default)(this,e);var r=t.getContent();this.userId=t.getSender(),this.deviceId=r.requesting_device_id,this.requestId=r.request_id}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../logger":29,"../utils":55,"./DeviceList":7,"./OlmDevice":8,"./OutgoingRoomKeyRequestManager":9,"./algorithms":12,"./deviceinfo":16,"./olmlib":18,"./store/indexeddb-crypto-store":21,"another-json":57,"babel-runtime/core-js/get-iterator":58,"babel-runtime/core-js/json/stringify":60,"babel-runtime/core-js/object/assign":63,"babel-runtime/core-js/object/keys":69,"babel-runtime/core-js/set":76,"babel-runtime/helpers/classCallCheck":79,"babel-runtime/helpers/defineProperty":81,"babel-runtime/helpers/typeof":85,"babel-runtime/regenerator":86,bluebird:89,events:234}],18:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}var o=e("bluebird"),i=n(o),s=e("babel-runtime/regenerator"),a=n(s),u=e("babel-runtime/core-js/json/stringify"),c=n(u),l=function(){var e=(0,o.coroutine)(a.default.mark(function e(t,r,n,i){var s,u;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return s=i.deviceId,e.prev=1,e.next=4,(0,o.resolve)(h(t,r,n,s,i.getFingerprint()));case 4:e.next=10;break;case 6:return e.prev=6,e.t0=e.catch(1),f.error("Unable to verify signature on one-time key for device "+n+":"+s+":",e.t0),e.abrupt("return",null);case 10:return u=void 0,e.prev=11,e.next=14,(0,o.resolve)(t.createOutboundSession(i.getIdentityKey(),r.key));case 14:u=e.sent,e.next=21;break;case 17:return e.prev=17,e.t1=e.catch(11),f.error("Error starting session with device "+n+":"+s+": "+e.t1),e.abrupt("return",null);case 21:return f.log("Started new sessionid "+u+" for device "+n+":"+s),e.abrupt("return",u);case 23:case"end":return e.stop()}},e,this,[[1,6],[11,17]])}));return function(t,r,n,o){return e.apply(this,arguments)}}(),d=e("another-json"),f=e("../logger"),p=e("../utils");t.exports.OLM_ALGORITHM="m.olm.v1.curve25519-aes-sha2",t.exports.MEGOLM_ALGORITHM="m.megolm.v1.aes-sha2",t.exports.MEGOLM_BACKUP_ALGORITHM="m.megolm_backup.v1.curve25519-aes-sha2",t.exports.encryptMessageForDevice=function(){var e=(0,o.coroutine)(a.default.mark(function e(t,r,n,i,s,u,l){var d,h,v;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return d=u.getIdentityKey(),e.next=3,(0,o.resolve)(i.getSessionIdForDevice(d));case 3:if(null!==(h=e.sent)){e.next=6;break}return e.abrupt("return");case 6:return f.log("Using sessionid "+h+" for device "+s+":"+u.deviceId),v={sender:r,sender_device:n,keys:{ed25519:i.deviceEd25519Key},recipient:s,recipient_keys:{ed25519:u.getFingerprint()}},p.extend(v,l),e.next=11,(0,o.resolve)(i.encryptMessage(d,h,(0,c.default)(v)));case 11:t[d]=e.sent;case 12:case"end":return e.stop()}},e,this)}));return function(t,r,n,o,i,s,a){return e.apply(this,arguments)}}(),t.exports.ensureOlmSessionsForDevices=function(){var e=(0,o.coroutine)(a.default.mark(function e(t,r,n,s){var u,c,d,p,h,v,m,y,_,g,b,E,w,S,k,T;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:u=[],c={},e.t0=a.default.keys(n);case 3:if((e.t1=e.t0()).done){e.next=24;break}if(d=e.t1.value,n.hasOwnProperty(d)){e.next=7;break}return e.abrupt("continue",3);case 7:c[d]={},p=n[d],h=0;case 10:if(!(h=e.length)){var s=e[r];o.target.source.openCursor(s).onsuccess=t}}if(0===e.length)return v.default.resolve(null);var r=0,n=void 0,o=this._db.transaction("outgoingRoomKeyRequests","readonly"),i=o.objectStore("outgoingRoomKeyRequests"),s=e[r];return i.index("state").openCursor(s).onsuccess=t,a(o).then(function(){return n})}},{key:"getOutgoingRoomKeyRequestsByTarget",value:function(e,t,r){function n(s){var a=s.target.result;if(a){var u=a.value;u.recipients.includes({userId:e,deviceId:t})&&i.push(u),a.continue()}else{if(++o>=r.length)return;var c=r[o];s.target.source.openCursor(c).onsuccess=n}}var o=0,i=[],s=this._db.transaction("outgoingRoomKeyRequests","readonly"),u=s.objectStore("outgoingRoomKeyRequests"),c=r[o];return u.index("state").openCursor(c).onsuccess=n,a(s).then(function(){return i})}},{key:"updateOutgoingRoomKeyRequest",value:function(e,t,r){function n(e){var n=e.target.result;if(n){var i=n.value;if(i.state!=t)return void y.default.warn("Cannot update room key request from "+t+" as it was already updated to "+i.state);(0,c.default)(i,r),n.update(i),o=i}}var o=null,i=this._db.transaction("outgoingRoomKeyRequests","readwrite");return i.objectStore("outgoingRoomKeyRequests").openCursor(e).onsuccess=n,a(i).then(function(){return o})}},{key:"deleteOutgoingRoomKeyRequest",value:function(e,t){var r=this._db.transaction("outgoingRoomKeyRequests","readwrite");return r.objectStore("outgoingRoomKeyRequests").openCursor(e).onsuccess=function(e){var r=e.target.result;if(r){var n=r.value;if(n.state!=t)return void y.default.warn("Cannot delete room key request in state "+n.state+" (expected "+t+")");r.delete()}},a(r)}},{key:"getAccount",value:function(e,t){var r=e.objectStore("account"),n=r.get("-");n.onsuccess=function(){try{t(n.result||null)}catch(t){s(e,t)}}}},{key:"storeAccount",value:function(e,t){e.objectStore("account").put(t,"-")}},{key:"countEndToEndSessions",value:function(e,t){var r=e.objectStore("sessions"),n=r.count();n.onsuccess=function(){t(n.result)}}},{key:"getEndToEndSessions",value:function(e,t,r){var n=t.objectStore("sessions"),o=n.index("deviceKey"),i=o.openCursor(e),a={};i.onsuccess=function(){var e=i.result;if(e)a[e.value.sessionId]={session:e.value.session,lastReceivedMessageTs:e.value.lastReceivedMessageTs},e.continue();else try{r(a)}catch(e){s(t,e)}}}},{key:"getEndToEndSession",value:function(e,t,r,n){var o=r.objectStore("sessions"),i=o.get([e,t]);i.onsuccess=function(){try{n(i.result?{session:i.result.session,lastReceivedMessageTs:i.result.lastReceivedMessageTs}:null)}catch(e){s(r,e)}}}},{key:"getAllEndToEndSessions",value:function(e,t){var r=e.objectStore("sessions"),n=r.openCursor();n.onsuccess=function(){var r=n.result;if(r)t(r.value),r.continue();else try{t(null)}catch(t){s(e,t)}}}},{key:"storeEndToEndSession",value:function(e,t,r,n){n.objectStore("sessions").put({deviceKey:e,sessionId:t,session:r.session,lastReceivedMessageTs:r.lastReceivedMessageTs})}},{key:"getEndToEndInboundGroupSession",value:function(e,t,r,n){var o=r.objectStore("inbound_group_sessions"),i=o.get([e,t]);i.onsuccess=function(){try{n(i.result?i.result.session:null)}catch(e){s(r,e)}}}},{key:"getAllEndToEndInboundGroupSessions",value:function(e,t){var r=e.objectStore("inbound_group_sessions"),n=r.openCursor();n.onsuccess=function(){var r=n.result;if(r){try{t({senderKey:r.value.senderCurve25519Key,sessionId:r.value.sessionId,sessionData:r.value.session})}catch(t){s(e,t)}r.continue()}else try{t(null)}catch(t){s(e,t)}}}},{key:"addEndToEndInboundGroupSession",value:function(e,t,r,n){var o=n.objectStore("inbound_group_sessions"),i=o.add({senderCurve25519Key:e,sessionId:t,session:r});i.onerror=function(r){"ConstraintError"===i.error.name?(r.stopPropagation(),r.preventDefault(),y.default.log("Ignoring duplicate inbound group session: "+e+" / "+t)):s(n,new Error("Failed to add inbound group session: "+i.error))}}},{key:"storeEndToEndInboundGroupSession",value:function(e,t,r,n){n.objectStore("inbound_group_sessions").put({senderCurve25519Key:e,sessionId:t,session:r})}},{key:"getEndToEndDeviceData",value:function(e,t){var r=e.objectStore("device_data"),n=r.get("-");n.onsuccess=function(){try{t(n.result||null)}catch(t){s(e,t)}}}},{key:"storeEndToEndDeviceData",value:function(e,t){t.objectStore("device_data").put(e,"-")}},{key:"storeEndToEndRoom",value:function(e,t,r){r.objectStore("rooms").put(t,e)}},{key:"getEndToEndRooms",value:function(e,t){var r={},n=e.objectStore("rooms"),o=n.openCursor();o.onsuccess=function(){var n=o.result;if(n)r[n.key]=n.value,n.continue();else try{t(r)}catch(t){s(e,t)}}}},{key:"getSessionsNeedingBackup",value:function(e){var t=this;return new v.default(function(r,n){var o=[],i=t._db.transaction(["sessions_needing_backup","inbound_group_sessions"],"readonly");i.onerror=n,i.oncomplete=function(){r(o)};var s=i.objectStore("sessions_needing_backup"),a=i.objectStore("inbound_group_sessions"),u=s.openCursor();u.onsuccess=function(){var t=u.result;if(t){var r=a.get(t.key);r.onsuccess=function(){o.push({senderKey:r.result.senderCurve25519Key,sessionId:r.result.sessionId,sessionData:r.result.session})},(!e||o.length=e)return"break"}();if("break"===i)break}return I.default.resolve(n)}},{key:"unmarkSessionsNeedingBackup",value:function(e){var t=a(this.store,N)||{},r=!0,n=!1,o=void 0;try{for(var i,s=(0,m.default)(e);!(r=(i=s.next()).done);r=!0){var c=i.value;delete t[c.senderKey+"/"+c.sessionId]}}catch(e){n=!0,o=e}finally{try{!r&&s.return&&s.return()}finally{if(n)throw o}}return u(this.store,N,t),I.default.resolve()}},{key:"markSessionsNeedingBackup",value:function(e){var t=a(this.store,N)||{},r=!0,n=!1,o=void 0;try{for(var i,s=(0,m.default)(e);!(r=(i=s.next()).done);r=!0){var c=i.value;t[c.senderKey+"/"+c.sessionId]=!0}}catch(e){n=!0,o=e}finally{try{!r&&s.return&&s.return()}finally{if(n)throw o}}return u(this.store,N,t),I.default.resolve()}},{key:"deleteAllData",value:function(){return this.store.removeItem(M),I.default.resolve()}},{key:"getAccount",value:function(e,t){t(a(this.store,M))}},{key:"storeAccount",value:function(e,t){u(this.store,M,t)}},{key:"doTxn",value:function(e,t,r){return I.default.resolve(r(null))}}]),t}(A.default);r.default=F},{"../../logger":29,"./memory-crypto-store.js":23,"babel-runtime/core-js/get-iterator":58,"babel-runtime/core-js/json/stringify":60,"babel-runtime/core-js/object/entries":66,"babel-runtime/core-js/object/get-prototype-of":68,"babel-runtime/helpers/classCallCheck":79,"babel-runtime/helpers/createClass":80,"babel-runtime/helpers/inherits":82,"babel-runtime/helpers/possibleConstructorReturn":83,"babel-runtime/helpers/slicedToArray":84,bluebird:89}],23:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var o=e("babel-runtime/core-js/object/keys"),i=n(o),s=e("babel-runtime/core-js/object/assign"),a=n(s),u=e("babel-runtime/core-js/get-iterator"),c=n(u),l=e("babel-runtime/helpers/classCallCheck"),d=n(l),f=e("babel-runtime/helpers/createClass"),p=n(f),h=e("bluebird"),v=n(h),m=e("../../logger"),y=n(m),_=e("../../utils"),g=n(_),b=function(){function e(){(0,d.default)(this,e),this._outgoingRoomKeyRequests=[],this._account=null,this._sessions={},this._inboundGroupSessions={},this._deviceData=null,this._rooms={},this._sessionsNeedingBackup={}}return(0,p.default)(e,[{key:"deleteAllData",value:function(){return v.default.resolve()}},{key:"getOrAddOutgoingRoomKeyRequest",value:function(e){var t=this,r=e.requestBody;return v.default.try(function(){var n=t._getOutgoingRoomKeyRequest(r);return n?(y.default.log("already have key request outstanding for "+r.room_id+" / "+r.session_id+": not sending another"),n):(y.default.log("enqueueing key request for "+r.room_id+" / "+r.session_id),t._outgoingRoomKeyRequests.push(e),e)})}},{key:"getOutgoingRoomKeyRequest",value:function(e){return v.default.resolve(this._getOutgoingRoomKeyRequest(e))}},{key:"_getOutgoingRoomKeyRequest",value:function(e){var t=!0,r=!1,n=void 0;try{for(var o,i=(0,c.default)(this._outgoingRoomKeyRequests);!(t=(o=i.next()).done);t=!0){var s=o.value;if(g.default.deepCompare(s.requestBody,e))return s}}catch(e){r=!0,n=e}finally{try{!t&&i.return&&i.return()}finally{if(r)throw n}}return null}},{key:"getOutgoingRoomKeyRequestByState",value:function(e){var t=!0,r=!1,n=void 0;try{for(var o,i=(0,c.default)(this._outgoingRoomKeyRequests);!(t=(o=i.next()).done);t=!0){var s=o.value,a=!0,u=!1,l=void 0;try{for(var d,f=(0,c.default)(e);!(a=(d=f.next()).done);a=!0){var p=d.value;if(s.state===p)return v.default.resolve(s)}}catch(e){u=!0,l=e}finally{try{!a&&f.return&&f.return()}finally{if(u)throw l}}}}catch(e){r=!0,n=e}finally{try{!t&&i.return&&i.return()}finally{if(r)throw n}}return v.default.resolve(null)}},{key:"getOutgoingRoomKeyRequestsByTarget",value:function(e,t,r){var n=[],o=!0,i=!1,s=void 0;try{for(var a,u=(0,c.default)(this._outgoingRoomKeyRequests);!(o=(a=u.next()).done);o=!0){var l=a.value,d=!0,f=!1,p=void 0;try{for(var h,m=(0,c.default)(r);!(d=(h=m.next()).done);d=!0){var y=h.value;l.state===y&&l.recipients.includes({userId:e,deviceId:t})&&n.push(l)}}catch(e){f=!0,p=e}finally{try{!d&&m.return&&m.return()}finally{if(f)throw p}}}}catch(e){i=!0,s=e}finally{try{!o&&u.return&&u.return()}finally{if(i)throw s}}return v.default.resolve(n)}},{key:"updateOutgoingRoomKeyRequest",value:function(e,t,r){var n=!0,o=!1,i=void 0;try{for(var s,u=(0,c.default)(this._outgoingRoomKeyRequests);!(n=(s=u.next()).done);n=!0){var l=s.value;if(l.requestId===e)return l.state!=t?(y.default.warn("Cannot update room key request from "+t+" as it was already updated to "+l.state),v.default.resolve(null)):((0,a.default)(l,r),v.default.resolve(l))}}catch(e){o=!0,i=e}finally{try{!n&&u.return&&u.return()}finally{if(o)throw i}}return v.default.resolve(null)}},{key:"deleteOutgoingRoomKeyRequest",value:function(e,t){for(var r=0;r=e))break;return v.default.resolve(t)}},{key:"unmarkSessionsNeedingBackup",value:function(e){var t=!0,r=!1,n=void 0;try{for(var o,i=(0,c.default)(e);!(t=(o=i.next()).done);t=!0){var s=o.value,a=s.senderKey+"/"+s.sessionId;delete this._sessionsNeedingBackup[a]}}catch(e){r=!0,n=e}finally{try{!t&&i.return&&i.return()}finally{if(r)throw n}}return v.default.resolve()}},{key:"markSessionsNeedingBackup",value:function(e){var t=!0,r=!1,n=void 0;try{for(var o,i=(0,c.default)(e);!(t=(o=i.next()).done);t=!0){var s=o.value,a=s.senderKey+"/"+s.sessionId;this._sessionsNeedingBackup[a]=!0}}catch(e){r=!0,n=e}finally{try{!t&&i.return&&i.return()}finally{if(r)throw n}}return v.default.resolve()}},{key:"doTxn",value:function(e,t,r){return v.default.resolve(r(null))}}]),e}();r.default=b},{"../../logger":29,"../../utils":55,"babel-runtime/core-js/get-iterator":58,"babel-runtime/core-js/object/assign":63,"babel-runtime/core-js/object/keys":69,"babel-runtime/helpers/classCallCheck":79,"babel-runtime/helpers/createClass":80,bluebird:89}],24:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var r="Store is invalid because "+e+", please stop the client, delete all data and start the client again",n=(0,p.default)(Error,[r]);return(0,d.default)(n,(0,c.default)(this)),n.reason=e,n.value=t,n}function i(e){var t="Crypto store is invalid because "+e+", please stop the client, delete all data and start the client again",r=(0,p.default)(Error,[t]);return(0,d.default)(r,(0,c.default)(this)),r.reason=e,r.name="InvalidCryptoStoreError",r}Object.defineProperty(r,"__esModule",{value:!0});var s=e("babel-runtime/core-js/object/create"),a=n(s),u=e("babel-runtime/core-js/reflect/get-prototype-of"),c=n(u),l=e("babel-runtime/core-js/reflect/set-prototype-of"),d=n(l),f=e("babel-runtime/core-js/reflect/construct"),p=n(f);r.InvalidStoreError=o,r.InvalidCryptoStoreError=i,o.TOGGLED_LAZY_LOADING="TOGGLED_LAZY_LOADING",o.prototype=(0,a.default)(Error.prototype,{constructor:{value:Error,enumerable:!1,writable:!0,configurable:!0}}),(0,d.default)(o,Error),i.TOO_NEW="TOO_NEW",i.prototype=(0,a.default)(Error.prototype,{constructor:{value:Error,enumerable:!1,writable:!0,configurable:!0}}),(0,d.default)(i,Error)},{"babel-runtime/core-js/object/create":64,"babel-runtime/core-js/reflect/construct":73,"babel-runtime/core-js/reflect/get-prototype-of":74,"babel-runtime/core-js/reflect/set-prototype-of":75}],25:[function(e,t,r){"use strict";function n(e,t){if(t.endsWith("*")){var r=t.slice(0,-1);return e.substr(0,r.length)===r}return e===t}function o(e){this.filter_json=e,this.types=e.types||null,this.not_types=e.not_types||[],this.rooms=e.rooms||null,this.not_rooms=e.not_rooms||[],this.senders=e.senders||null,this.not_senders=e.not_senders||[],this.contains_url=e.contains_url||null}var i=e("babel-runtime/core-js/object/keys"),s=function(e){return e&&e.__esModule?e:{default:e}}(i);o.prototype.check=function(e){return this._checkFields(e.getRoomId(),e.getSender(),e.getType(),!!e.getContent()&&void 0!==e.getContent().url)},o.prototype._checkFields=function(e,t,r,o){for(var i={rooms:function(t){return e===t},senders:function(e){return t===e},types:function(e){return n(r,e)}},a=this,u=0;u<(0,s.default)(i).length;u++){var c=(0,s.default)(i)[u],l=i[c];if(a["not_"+c].filter(l).length>0)return!1;var d=a[c];if(d&&!d.map(l))return!1}var f=this.filter_json.contains_url;return void 0===f||f===o},o.prototype.filter=function(e){return e.filter(this.check,this)},o.prototype.limit=function(){return void 0!==this.filter_json.limit?this.filter_json.limit:10},t.exports=o},{"babel-runtime/core-js/object/keys":69}],26:[function(e,t,r){"use strict";function n(e,t,r){for(var n=t.split("."),o=e,i=0;i0&&(b+="?"+E.join("&")),h.open("POST",b),this.useAuthorizationHeader&&h.setRequestHeader("Authorization","Bearer "+this.opts.accessToken),h.setRequestHeader("Content-Type",o),h.send(s),l=f.promise,l.abort=h.abort.bind(h)}else{var w={};n&&i&&(w.filename=i),l=this.authedRequest(t.callback,"POST","/upload",w,s,{prefix:"/_matrix/media/v1",headers:{"Content-Type":o},json:!1,bodyParser:d})}var S=this,k=l.finally(function(){for(var e=0;e=400?i=o(s,a):n&&(a=n(a))}catch(e){i=new Error("Error parsing server response: "+e)}if(i)e.reject(i),t(i);else{var u={code:s.statusCode,headers:s.headers,data:a};e.resolve(r?a:u),t(null,r?a:u)}}};t.exports.MatrixError=function(e){e=e||{},this.errcode=e.errcode,this.name=e.errcode||"Unknown error code",this.message=e.error||"Unknown message",this.data=e},t.exports.MatrixError.prototype=(0,a.default)(Error.prototype),t.exports.MatrixError.prototype.constructor=t.exports.MatrixError}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./realtime-callbacks":44,"./utils":55,"babel-runtime/core-js/json/stringify":60,"babel-runtime/core-js/object/create":64,"babel-runtime/helpers/typeof":85,bluebird:89,"content-type":94}],28:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){this._matrixClient=e.matrixClient,this._data=e.authData||{},this._requestCallback=e.doRequest,this._stateUpdatedCallback=e.stateUpdated||e.startAuthStage,this._completionDeferred=null,this._inputs=e.inputs||{},e.sessionId&&(this._data.session=e.sessionId),this._clientSecret=e.clientSecret||this._matrixClient.generateClientSecret(),this._emailSid=e.emailSid,void 0===this._emailSid&&(this._emailSid=null),this._currentStage=null}var i=e("babel-runtime/core-js/get-iterator"),s=n(i),a=e("babel-runtime/core-js/json/stringify"),u=n(a),c=e("bluebird"),l=n(c),d=e("url"),f=e("./utils");o.prototype={attemptAuth:function(){var e=this;return this._completionDeferred=l.default.defer(),l.default.resolve().then(function(){return e._data.flows?e._startNextAuthStage():e._doRequest(e._data),e._completionDeferred.promise})},poll:function(){if(this._data.session){var e={};if("m.login.email.identity"==this._currentStage&&this._emailSid){var t=d.parse(this._matrixClient.getIdentityServerUrl());e={type:"m.login.email.identity",threepid_creds:{sid:this._emailSid,client_secret:this._clientSecret,id_server:t.host}}}this.submitAuthDict(e,!0)}},getSessionId:function(){return this._data?this._data.session:void 0},getClientSecret:function(){return this._clientSecret},getStageParams:function(e){var t={};return this._data&&this._data.params&&(t=this._data.params),t[e]},submitAuthDict:function(e,t){if(!this._completionDeferred)throw new Error("submitAuthDict() called before attemptAuth()");var r={session:this._data.session};f.extend(r,e),this._doRequest(r,t)},getEmailSid:function(){return this._emailSid},setEmailSid:function(e){this._emailSid=e},_doRequest:function(e,t){var r=this,n=this,o=void 0;try{o=this._requestCallback(e,t)}catch(e){o=l.default.reject(e)}o=o.then(function(e){console.log("result from request: ",e),n._completionDeferred.resolve(e)},function(e){var t=e.data?e.data.flows:null,r=Boolean(n._data.flows)||Boolean(t);if(401!==e.httpStatus||!e.data||!r)throw e;e.data.flows||e.data.completed||e.data.session||(e.data.flows=n._data.flows,e.data.completed=n._data.completed,e.data.session=n._data.session),n._data=e.data,n._startNextAuthStage()}),o=t?o.catch(function(e){console.log("Ignoring error from UI auth: "+e)}):o.catch(function(e){r._completionDeferred.reject(e)}),o.done()},_startNextAuthStage:function(){var e=this._chooseStage();if(!e)throw new Error("No incomplete flows from the server");if(this._currentStage=e,"m.login.dummy"==e)return void this.submitAuthDict({type:"m.login.dummy"});if(this._data.errcode||this._data.error)return void this._stateUpdatedCallback(e,{errcode:this._data.errcode||"",error:this._data.error||""});var t={};"m.login.email.identity"==e&&(t.emailSid=this._emailSid),this._stateUpdatedCallback(e,t)},_chooseStage:function(){var e=this._chooseFlow();console.log("Active flow => %s",(0,u.default)(e));var t=this._firstUncompletedStage(e);return console.log("Next stage: %s",t),t},_chooseFlow:function(){var e=this._data.flows||[],t=Boolean(this._inputs.emailAddress)||Boolean(this._emailSid),r=Boolean(this._inputs.phoneCountry)&&Boolean(this._inputs.phoneNumber),n=!0,o=!1,i=void 0;try{for(var a,u=(0,s.default)(e);!(n=(a=u.next()).done);n=!0){var c=a.value,l=!1,d=!1,f=!0,p=!1,h=void 0;try{for(var v,m=(0,s.default)(c.stages);!(f=(v=m.next()).done);f=!0){var y=v.value;"m.login.email.identity"===y?l=!0:"m.login.msisdn"==y&&(d=!0)}}catch(_){p=!0,h=_}finally{try{!f&&m.return&&m.return()}finally{if(p)throw h}}if(l==t&&d==r)return c}}catch(_){o=!0,i=_}finally{try{!n&&u.return&&u.return()}finally{if(o)throw i}}var _=new Error("No appropriate authentication flow found");throw _.name="NoAuthFlowFoundError",_.required_stages=[],t&&_.required_stages.push("m.login.email.identity"),r&&_.required_stages.push("m.login.msisdn"),_.available_flows=e,_},_firstUncompletedStage:function(e){for(var t=(this._data||{}).completed||[],r=0;r0)throw new Error("Cannot initialise state after events are added");var t=!0,r=!1,n=void 0;try{for(var o,i=(0,u.default)(e);!(t=(o=i.next()).done);t=!0){var a=o.value;(0,s.default)(a)}}catch(e){r=!0,n=e}finally{try{!t&&i.return&&i.return()}finally{if(r)throw n}}this._startState.setStateEvents(e),this._endState.setStateEvents(e)},o.prototype.forkLive=function(e){var t=this.getState(e),r=new o(this._eventTimelineSet);return r._startState=t.clone(),r._endState=t,this._endState=t.clone(),r},o.prototype.fork=function(e){var t=this.getState(e),r=new o(this._eventTimelineSet);return r._startState=t.clone(),r._endState=t.clone(),r},o.prototype.getRoomId=function(){return this._roomId},o.prototype.getFilter=function(){return this._eventTimelineSet.getFilter()},o.prototype.getTimelineSet=function(){return this._eventTimelineSet},o.prototype.getBaseIndex=function(){return this._baseIndex},o.prototype.getEvents=function(){return this._events},o.prototype.getState=function(e){if(e==o.BACKWARDS)return this._startState;if(e==o.FORWARDS)return this._endState;throw new Error("Invalid direction '"+e+"'")},o.prototype.getPaginationToken=function(e){return this.getState(e).paginationToken},o.prototype.setPaginationToken=function(e,t){this.getState(t).paginationToken=e},o.prototype.getNeighbouringTimeline=function(e){if(e==o.BACKWARDS)return this._prevTimeline;if(e==o.FORWARDS)return this._nextTimeline;throw new Error("Invalid direction '"+e+"'")},o.prototype.setNeighbouringTimeline=function(e,t){if(this.getNeighbouringTimeline(t))throw new Error("timeline already has a neighbouring timeline - cannot reset neighbour");if(t==o.BACKWARDS)this._prevTimeline=e;else{if(t!=o.FORWARDS)throw new Error("Invalid direction '"+t+"'");this._nextTimeline=e}this.setPaginationToken(null,t)},o.prototype.addEvent=function(e,t){var r=t?this._startState:this._endState,n=this.getTimelineSet();n.room&&n.room.getUnfilteredTimelineSet()===n&&(o.setEventMetadata(e,r,t),e.isState()&&(r.setStateEvents([e]),e.sender&&("m.room.member"!==e.getType()||t)||o.setEventMetadata(e,r,t)));var i=void 0;i=t?0:this._events.length,this._events.splice(i,0,e),t&&this._baseIndex++},o.setEventMetadata=function(e,t,r){e.sender=t.getSentinelMember(e.getSender()),"m.room.member"===e.getType()&&(e.target=t.getSentinelMember(e.getStateKey())),e.isState()&&r&&(e.forwardLooking=!1)},o.prototype.removeEvent=function(e){for(var t=this._events.length-1;t>=0;t--){var r=this._events[t];if(r.getId()==e)return this._events.splice(t,1),t0&&(this.powerLevelNorm=100*this.powerLevel/r),n===this.powerLevel&&o===this.powerLevelNorm||(this._updateModifiedTime(),this.emit("RoomMember.powerLevel",e,this))}},n.prototype.setTypingEvent=function(e){if("m.typing"===e.getType()){var t=this.typing;this.typing=!1;var r=e.getContent().user_ids;a.isArray(r)&&(-1!==r.indexOf(this.userId)&&(this.typing=!0),t!==this.typing&&(this._updateModifiedTime(),this.emit("RoomMember.typing",e,this)))}},n.prototype._updateModifiedTime=function(){this._modified=Date.now()},n.prototype.getLastModifiedTime=function(){return this._modified},n.prototype.isKicked=function(){return"leave"===this.membership&&this.events.member.getSender()!==this.events.member.getStateKey()},n.prototype.getDMInviter=function(){if(this.events.member){var e=this.events.member,t=e.getContent(),r=e.getSender();if("join"===t.membership&&(t=e.getPrevContent(),r=e.getUnsigned().prev_sender),"invite"===t.membership&&t.is_direct)return r}},n.prototype.getAvatarUrl=function(e,t,r,n,o,i){void 0===o&&(o=!0);var a=this.getMxcAvatarUrl();if(!a&&!o)return null;var u=s.getHttpUriForMxc(e,a,t,r,n,i);return u||(o?s.getIdenticonUri(e,this.userId,t,r):null)},n.prototype.getMxcAvatarUrl=function(){return this.events.member?this.events.member.getDirectionalContent().avatar_url:this.user?this.user.avatarUrl:null},t.exports=n},{"../content-repo":6,"../utils":55,events:234}],37:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;this.roomId=e,this.members={},this.events={},this.paginationToken=null,this._sentinels={},this._updateModifiedTime(),this._displayNameToUserIds={},this._userIdsToDisplayNames={},this._tokenToInvite={},this._joinedMemberCount=null,this._summaryJoinedMemberCount=null,this._invitedMemberCount=null,this._summaryInvitedMemberCount=null,t||(t={status:m}),this._oobMemberFlags=t}function i(e,t){if(t.getContent().third_party_invite){var r=(t.getContent().third_party_invite.signed||{}).token;if(r){e.getStateEvents("m.room.third_party_invite",r)&&(e._tokenToInvite[r]=t)}}}function s(e,t,r){var n=e._userIdsToDisplayNames[t];if(delete e._userIdsToDisplayNames[t],n){var o=h.removeHiddenChars(n),i=e._displayNameToUserIds[o];if(i){var s=i.filter(function(e){return e!==t});e._displayNameToUserIds[o]=s}}e._userIdsToDisplayNames[t]=r;var a=r&&h.removeHiddenChars(r);a&&(e._displayNameToUserIds[a]||(e._displayNameToUserIds[a]=[]),e._displayNameToUserIds[a].push(t))}var a=e("babel-runtime/core-js/number/is-finite"),u=n(a),c=e("babel-runtime/core-js/object/keys"),l=n(c),d=e("babel-runtime/core-js/object/values"),f=n(d),p=e("events").EventEmitter,h=e("../utils"),v=e("./room-member"),m=1;h.inherits(o,p),o.prototype.getJoinedMemberCount=function(){return null!==this._summaryJoinedMemberCount?this._summaryJoinedMemberCount:(null===this._joinedMemberCount&&(this._joinedMemberCount=this.getMembers().reduce(function(e,t){return"join"===t.membership?e+1:e},0)),this._joinedMemberCount)},o.prototype.setJoinedMemberCount=function(e){this._summaryJoinedMemberCount=e},o.prototype.getInvitedMemberCount=function(){return null!==this._summaryInvitedMemberCount?this._summaryInvitedMemberCount:(null===this._invitedMemberCount&&(this._invitedMemberCount=this.getMembers().reduce(function(e,t){return"invite"===t.membership?e+1:e},0)),this._invitedMemberCount)},o.prototype.setInvitedMemberCount=function(e){this._summaryInvitedMemberCount=e},o.prototype.getMembers=function(){return h.values(this.members)},o.prototype.getMember=function(e){return this.members[e]||null},o.prototype.getSentinelMember=function(e){if(!e)return null;var t=this._sentinels[e];if(void 0===t){t=new v(this.roomId,e);var r=this.members[e];r&&t.setMembershipEvent(r.events.member,this),this._sentinels[e]=t}return t},o.prototype.getStateEvents=function(e,t){if(!this.events[e])return void 0===t?[]:null;if(void 0===t)return h.values(this.events[e]);var r=this.events[e][t];return r||null},o.prototype.clone=function(){var e=new o(this.roomId,this._oobMemberFlags),t=this._oobMemberFlags.status;return this._oobMemberFlags.status=m,(0,f.default)(this.events).forEach(function(t){var r=(0,f.default)(t);e.setStateEvents(r)}),this._oobMemberFlags.status=t,null!==this._summaryInvitedMemberCount&&e.setInvitedMemberCount(this.getInvitedMemberCount()),null!==this._summaryJoinedMemberCount&&e.setJoinedMemberCount(this.getJoinedMemberCount()),3==this._oobMemberFlags.status&&this.getMembers().forEach(function(t){if(t.isOutOfBand()){e.getMember(t.userId).markOutOfBand()}}),e},o.prototype.setUnknownStateEvents=function(e){var t=this,r=e.filter(function(e){return void 0===t.events[e.getType()]||void 0===t.events[e.getType()][e.getStateKey()]});this.setStateEvents(r)},o.prototype.setStateEvents=function(e){var t=this;this._updateModifiedTime(),h.forEach(e,function(e){e.getRoomId()===t.roomId&&e.isState()&&(t._setStateEvent(e),"m.room.member"===e.getType()&&(s(t,e.getStateKey(),e.getContent().displayname),i(t,e)),t.emit("RoomState.events",e,t))}),h.forEach(e,function(e){if(e.getRoomId()===t.roomId&&e.isState())if("m.room.member"===e.getType()){var r=e.getStateKey();"leave"!==e.getContent().membership&&"ban"!==e.getContent().membership||(e.getContent().avatar_url=e.getContent().avatar_url||e.getPrevContent().avatar_url,e.getContent().displayname=e.getContent().displayname||e.getPrevContent().displayname);var n=t._getOrCreateMember(r,e);n.setMembershipEvent(e,t),t._updateMember(n),t.emit("RoomState.members",e,t,n)}else if("m.room.power_levels"===e.getType()){var o=h.values(t.members);h.forEach(o,function(r){r.setPowerLevelEvent(e),t.emit("RoomState.members",e,t,r)}),t._sentinels={}}})},o.prototype._getOrCreateMember=function(e,t){var r=this.members[e];return r||(r=new v(this.roomId,e),this.members[e]=r,this.emit("RoomState.newMember",t,this,r)),r},o.prototype._setStateEvent=function(e){void 0===this.events[e.getType()]&&(this.events[e.getType()]={}),this.events[e.getType()][e.getStateKey()]=e},o.prototype._updateMember=function(e){var t=this.getStateEvents("m.room.power_levels","");t&&e.setPowerLevelEvent(t),delete this._sentinels[e.userId],this.members[e.userId]=e,this._joinedMemberCount=null,this._invitedMemberCount=null},o.prototype.needsOutOfBandMembers=function(){return this._oobMemberFlags.status===m},o.prototype.markOutOfBandMembersStarted=function(){this._oobMemberFlags.status===m&&(this._oobMemberFlags.status=2)},o.prototype.markOutOfBandMembersFailed=function(){2===this._oobMemberFlags.status&&(this._oobMemberFlags.status=m)},o.prototype.clearOutOfBandMembers=function(){var e=this,t=0;(0,l.default)(this.members).forEach(function(r){e.members[r].isOutOfBand()&&(++t,delete e.members[r])}),console.log("LL: RoomState removed "+t+" members..."),this._oobMemberFlags.status=m},o.prototype.setOutOfBandMembers=function(e){var t=this;console.log("LL: RoomState about to set "+e.length+" OOB members ..."),2===this._oobMemberFlags.status&&(console.log("LL: RoomState put in OOB_STATUS_FINISHED state ..."),this._oobMemberFlags.status=3,e.forEach(function(e){return t._setOutOfBandMember(e)}))},o.prototype._setOutOfBandMember=function(e){if("m.room.member"===e.getType()){var t=e.getStateKey(),r=this.getMember(t);if(!r||r.isOutOfBand()){var n=this._getOrCreateMember(t,e);n.setMembershipEvent(e,this),n.markOutOfBand(),s(this,n.userId,n.name),this._setStateEvent(e),this._updateMember(n),this.emit("RoomState.members",e,this,n)}}},o.prototype.setTypingEvent=function(e){h.forEach(h.values(this.members),function(t){t.setTypingEvent(e)})},o.prototype.getInviteForThreePidToken=function(e){return this._tokenToInvite[e]||null},o.prototype._updateModifiedTime=function(){this._modified=Date.now()},o.prototype.getLastModifiedTime=function(){return this._modified},o.prototype.getUserIdsWithDisplayName=function(e){return this._displayNameToUserIds[e]||[]},o.prototype.maySendRedactionForEvent=function(e,t){var r=this.getMember(t);if(!r||"leave"===r.membership)return!1;if(e.status||e.isRedacted())return!1;var n=this.maySendEvent("m.room.redaction",t);return e.getSender()===t?n:this._hasSufficientPowerLevelFor("redact",r.powerLevel)},o.prototype._hasSufficientPowerLevelFor=function(e,t){var r=this.getStateEvents("m.room.power_levels",""),n={};r&&(n=r.getContent());var o=50;return h.isNumber(n[e])&&(o=n[e]),t>=o},o.prototype.maySendMessage=function(e){return this._maySendEventOfType("m.room.message",e,!1)},o.prototype.maySendEvent=function(e,t){return this._maySendEventOfType(e,t,!1)},o.prototype.mayClientSendStateEvent=function(e,t){return!t.isGuest()&&this.maySendStateEvent(e,t.credentials.userId)},o.prototype.maySendStateEvent=function(e,t){return this._maySendEventOfType(e,t,!0)},o.prototype._maySendEventOfType=function(e,t,r){var n=this.getStateEvents("m.room.power_levels",""),o=void 0,i={},s=0,a=0,c=0;if(n){o=n.getContent(),i=o.events||{},s=(0,u.default)(o.state_default)?o.state_default:50;var l=o.users&&o.users[t];(0,u.default)(l)?c=l:(0,u.default)(o.users_default)&&(c=o.users_default),(0,u.default)(o.events_default)&&(a=o.events_default)}var d=r?s:a;return(0,u.default)(i[e])&&(d=i[e]),c>=d},o.prototype.mayTriggerNotifOfType=function(e,t){var r=this.getMember(t);if(!r)return!1;var n=this.getStateEvents("m.room.power_levels",""),o=50;return n&&n.getContent()&&n.getContent().notifications&&h.isNumber(n.getContent().notifications[e])&&(o=n.getContent().notifications[e]),r.powerLevel>=o},t.exports=o},{"../utils":55,"./room-member":36,"babel-runtime/core-js/number/is-finite":61,"babel-runtime/core-js/object/keys":69,"babel-runtime/core-js/object/values":71,events:234}],38:[function(e,t,r){"use strict";function n(e,t){this.roomId=e,this.info=t}t.exports=n},{}],39:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t,r){var n={content:{},type:"m.receipt",room_id:t.getRoomId()};return n.content[t.getId()]={},n.content[t.getId()][r]={},n.content[t.getId()][r][e]={ts:t.getTs()},new S(n)}function i(e,t,r,n){if(n=n||{},n.pendingEventOrdering=n.pendingEventOrdering||"chronological",this.reEmitter=new _.default(this),-1===["chronological","detached"].indexOf(n.pendingEventOrdering))throw new Error("opts.pendingEventOrdering MUST be either 'chronological' or 'detached'. Got: '"+n.pendingEventOrdering+"'");this.myUserId=r,this.roomId=e,this.name=e,this.tags={},this.accountData={},this.summary=null,this.storageToken=n.storageToken,this._opts=n,this._txnToEvent={},this._receipts={},this._receiptCacheByEventId={},this._realReceipts={},this._notificationCounts={},this._timelineSets=[new R(this,n)],this.reEmitter.reEmit(this.getUnfilteredTimelineSet(),["Room.timeline","Room.timelineReset"]),this._fixUpLegacyTimelineFields(),this._filteredTimelineSets={},"detached"==this._opts.pendingEventOrdering&&(this._pendingEventList=[]),this._blacklistUnverifiedDevices=null,this._selfMembership=null,this._summaryHeroes=null,this._client=t,this._opts.lazyLoadMembers?this._membersPromise=null:this._membersPromise=m.default.resolve()}function s(e,t,r){if(!r){var n=e.currentState.getStateEvents("m.room.name","");if(n&&n.getContent()&&n.getContent().name)return n.getContent().name}var o=e.getCanonicalAlias();if(!o){var i=e.getAliases();i.length&&(o=i[0])}if(o)return o;var s=e.currentState.getJoinedMemberCount(),u=e.currentState.getInvitedMemberCount(),c=s+u-1,l=null;if(e._summaryHeroes)l=e._summaryHeroes.map(function(t){var r=e.getMember(t);return r?r.name:t});else{var d=e.currentState.getMembers().filter(function(e){return e.userId!==t&&("invite"===e.membership||"join"===e.membership)});d.sort(function(e,t){return e.userId.localeCompare(t.userId)}),d=d.slice(0,5),l=d.map(function(e){return e.name})}if(c)return a(l,c);if("join"==e.getMyMembership()){var f=e.currentState.getStateEvents("m.room.third_party_invite");if(f&&f.length)return"Inviting "+a(f.map(function(e){return e.getContent().display_name}))}var p=l;return p.length||(p=e.currentState.getMembers().filter(function(e){return e.userId!==t&&"invite"!==e.membership&&"join"!==e.membership}).map(function(e){return e.name})),p.length?"Empty room (was "+a(p)+")":"Empty room"}function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.length+1,r=t-1;if(e.length){if(1===e.length&&r<=1)return e[0];if(2===e.length&&r<=2)return e[0]+" and "+e[1];return r>1?e[0]+" and "+r+" others":e[0]+" and 1 other"}return"Empty room"}var u=e("babel-runtime/core-js/object/assign"),c=n(u),l=e("babel-runtime/core-js/number/is-integer"),d=n(l),f=e("babel-runtime/regenerator"),p=n(f),h=e("bluebird"),v=e("babel-runtime/core-js/promise"),m=n(v),y=e("../ReEmitter"),_=n(y),g=e("events").EventEmitter,b=e("./event").EventStatus,E=e("./room-summary"),w=e("./room-member"),S=e("./event").MatrixEvent,k=e("../utils"),T=e("../content-repo"),x=e("./event-timeline"),R=e("./event-timeline-set");k.inherits(i,g),i.prototype.getVersion=function(){var e=this.currentState.getStateEvents("m.room.create","");if(!e)return console.warn("Room "+this.room_id+" does not have an m.room.create event"),"1";var t=e.getContent().room_version;return void 0===t?"1":t},i.prototype.shouldUpgradeToVersion=function(){return"1"===this.getVersion()?null:"1"},i.prototype.userMayUpgradeRoom=function(e){return this.currentState.maySendStateEvent("m.room.tombstone",e)},i.prototype.getPendingEvents=function(){if("detached"!==this._opts.pendingEventOrdering)throw new Error("Cannot call getPendingEventList with pendingEventOrdering == "+this._opts.pendingEventOrdering);return this._pendingEventList},i.prototype.getLiveTimeline=function(){return this.getUnfilteredTimelineSet().getLiveTimeline()},i.prototype.getMyMembership=function(){return this._selfMembership},i.prototype.getDMInviter=function(){if(this.myUserId){var e=this.getMember(this.myUserId);if(e)return e.getDMInviter()}if("invite"===this._selfMembership){if(2==this.getInvitedAndJoinedMemberCount()&&this._summaryHeroes.length)return this._summaryHeroes[0]}},i.prototype.guessDMUserId=function(){var e=this,t=this.getMember(this.myUserId);if(t){var r=t.getDMInviter();if(r)return r}if(Array.isArray(this._summaryHeroes)&&this._summaryHeroes.length)return this._summaryHeroes[0];var n=this.currentState.getMembers(),o=n.find(function(t){return t.userId!==e.myUserId});return o?o.userId:this.myUserId},i.prototype.getAvatarFallbackMember=function(){var e=this;if(!(this.getInvitedAndJoinedMemberCount()>2)){var t=Array.isArray(this._summaryHeroes)&&this._summaryHeroes.length;if(t){var r=this._summaryHeroes.map(function(t){return e.getMember(t)}).find(function(e){return!!e});if(r)return r}var n=this.currentState.getMembers();if(n.length<=2){var o=n.find(function(t){return t.userId!==e.myUserId});if(o)return o}if(t){var i=this._summaryHeroes.map(function(t){return e._client.getUser(t)}).find(function(e){return!!e});if(i){var s=new w(this.roomId,i.userId);return s.user=i,s}}}},i.prototype.updateMyMembership=function(e){var t=this._selfMembership;this._selfMembership=e,t!==e&&("leave"===e&&this._cleanupAfterLeaving(),this.emit("Room.myMembership",this,e,t))},i.prototype._loadMembersFromServer=(0,h.coroutine)(p.default.mark(function e(){var t,r,n,o,i;return p.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._client.store.getSyncToken(),r=k.encodeParams({not_membership:"leave",at:t}),n=k.encodeUri("/rooms/$roomId/members?"+r,{$roomId:this.roomId}),o=this._client._http,e.next=6,(0,h.resolve)(o.authedRequest(void 0,"GET",n));case 6:return i=e.sent,e.abrupt("return",i.chunk);case 8:case"end":return e.stop()}},e,this)})),i.prototype._loadMembers=(0,h.coroutine)(p.default.mark(function e(){var t,r,n;return p.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=!1,e.next=3,(0,h.resolve)(this._client.store.getOutOfBandMembers(this.roomId));case 3:if(null!==(r=e.sent)){e.next=10;break}return t=!0,e.next=8,(0,h.resolve)(this._loadMembersFromServer());case 8:r=e.sent,console.log("LL: got "+r.length+" members from server for room "+this.roomId);case 10:return n=r.map(this._client.getEventMapper()),e.abrupt("return",{memberEvents:n,fromServer:t});case 12:case"end":return e.stop()}},e,this)})),i.prototype.loadMembersIfNeeded=function(){var e=this;if(this._membersPromise)return this._membersPromise;this.currentState.markOutOfBandMembersStarted();var t=this._loadMembers().then(function(t){return e.currentState.setOutOfBandMembers(t.memberEvents),e._client.isRoomEncrypted(e.roomId)&&e._client._crypto.trackRoomDevices(e.roomId),t.fromServer}).catch(function(t){throw e._membersPromise=null,e.currentState.markOutOfBandMembersFailed(),t});return t.then(function(t){if(t){var r=e.currentState.getMembers().filter(function(e){return e.isOutOfBand()}).map(function(e){return e.events.member.event});console.log("LL: telling store to write "+r.length+" members for room "+e.roomId);return e._client.store.setOutOfBandMembers(e.roomId,r).catch(function(e){console.log("LL: storing OOB room members failed, oh well",e)})}}).catch(function(e){console.error(e)}),this._membersPromise=t,this._membersPromise},i.prototype.clearLoadedMembersIfNeeded=(0,h.coroutine)(p.default.mark(function e(){return p.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._opts.lazyLoadMembers||!this._membersPromise){e.next=7;break}return e.next=3,(0,h.resolve)(this.loadMembersIfNeeded());case 3:return e.next=5,(0,h.resolve)(this._client.store.clearOutOfBandMembers(this.roomId));case 5:this.currentState.clearOutOfBandMembers(),this._membersPromise=null;case 7:case"end":return e.stop()}},e,this)})),i.prototype._cleanupAfterLeaving=function(){var e=this;this.clearLoadedMembersIfNeeded().catch(function(t){console.error("error after clearing loaded members from room "+e.roomId+" after leaving"),console.dir(t)})},i.prototype.resetLiveTimeline=function(e,t){for(var r=0;r-1&&this._timelineSets.splice(r,1)},i.prototype._addLiveEvent=function(e,t){var r=void 0;if("m.room.redaction"===e.getType()){var n=e.event.redacts,i=this.getUnfilteredTimelineSet().findEventById(n);i&&(i.makeRedacted(e),this.emit("Room.redaction",e,this))}if(e.getUnsigned().transaction_id){var s=this._txnToEvent[e.getUnsigned().transaction_id];if(s)return void this._handleRemoteEcho(e,s)}for(r=0;r"+t);if(e.status=t,t==b.SENT){e.event.event_id=r +;for(var s=0;s=0)return}else t[o][i]={};t[o][i]={eventId:n,data:s}})})})},i.prototype._buildReceiptCache=function(e){var t={};return k.keys(e).forEach(function(r){k.keys(e[r]).forEach(function(n){var o=e[r][n];t[o.eventId]||(t[o.eventId]=[]),t[o.eventId].push({userId:n,type:r,data:o.data})})}),t},i.prototype._addLocalEchoReceipt=function(e,t,r){this.addReceipt(o(e,t,r),!0)},i.prototype.addTags=function(e){this.tags=e.getContent().tags||{},this.emit("Room.tags",e,this)},i.prototype.addAccountData=function(e){for(var t=0;t]*)([0-9]*)$/);if(!i)return!1;var s=i[1],a=parseInt(i[2]);if(isNaN(a))return!1;switch(s){case"":case"==":return o==a;case"<":return o":return o>a;case"<=":return o<=a;case">=":return o>=a;default:return!1}},p=function(t,r){var n=r.getContent();if(!n||!n.body||"string"!=typeof n.body)return!1;var o=e.getRoom(r.getRoomId());if(!(o&&o.currentState&&o.currentState.members&&o.currentState.getMember(e.credentials.userId)))return!1;var i=o.currentState.getMember(e.credentials.userId).name,s=new RegExp("(^|\\W)"+(0,d.escapeRegExp)(i)+"(\\W|$)","i");return n.body.search(s)>-1},h=function(e,t){return!1},v=function(e,t){if(!e.key)return!1;var r=y(e.key,t);if(!r||"string"!=typeof r)return!1;if(e.value)return e.value===r;var n=void 0;return n="content.body"==e.key?m("(^|\\W)",e.pattern,"(\\W|$)"):m("^",e.pattern,"$"),!!r.match(n)},m=function(e,t,n){return r[t]?r[t]:(r[t]=new RegExp(e+(0,d.globToRegexp)(t)+n,"i"),r[t])},y=function(e,t){var r=e.split("."),n=void 0,o=r[0];for("content"==o?(n=t.getContent(),r.shift()):"type"==o?(n=t.getType(),r.shift()):n=t.event;r.length>0;){var i=r.shift();if(!n[i])return null;n=n[i]}return n},_=function(t,r){if(!r||!r.device)return null;if(t.getSender()==e.credentials.userId)return null;for(var o=(0,l.default)(r.device),i=0;in)break;t=u.shift(),c("_runCallbacks: popping",t.key),o.push(t)}r();for(var s=0;s>1;t(e[o])>0?n=o:r=o+1}return r}var i=1e3,s=0,a=void 0,u=[],c=function(){};t.exports.setNow=function(e){l=e||Date.now};var l=Date.now;t.exports.setTimeout=function(e,t){(t=t||0)<0&&(t=0);var n=Array.prototype.slice.call(arguments,2),i=l()+t,a=s++;c("setTimeout: scheduling cb",a,"at",i,"(delay",t,")");var d={runAt:i,func:e,params:n,key:a},f=o(u,function(e){return e.runAt-i});return u.splice(f,0,d),r(),a},t.exports.clearTimeout=function(e){if(0!==u.length){var t=void 0;for(t=0;t0}),function(t){e._activeQueues.push(t),u("Spinning up queue: '%s'",t),i(e,t)})}function i(e,t){var r=s(e,t);if(!r){var n=e._activeQueues.indexOf(t);return n>=0&&e._activeQueues.splice(n,1),void u("Stopping queue '%s' as it is now empty",t)}u("Queue '%s' has %s pending events",t,e._queues[t].length),e._procFn(r.event).done(function(n){a(e,t),u("Queue '%s' sent event %s",t,r.event.getId()),r.defer.resolve(n),i(e,t)},function(n){r.attempts+=1;var o=e.retryAlgorithm(r.event,r.attempts,n);u("retry(%s) err=%s event_id=%s waitTime=%s",r.attempts,n,r.event.getId(),o),-1===o?(u("Queue '%s' giving up on event %s",t,r.event.getId()),a(e,t),r.defer.reject(n),i(e,t)):setTimeout(function(){i(e,t)},o)})}function s(e,t){var r=e._queues[t];return d.isArray(r)?r[0]:null}function a(e,t){var r=e._queues[t];return d.isArray(r)?r.shift():null}function u(){if(f){var e;(e=console).log.apply(e,arguments)}}var c=e("bluebird"),l=function(e){return e&&e.__esModule?e:{default:e}}(c),d=e("./utils"),f=!1;n.prototype.getQueueForEvent=function(e){var t=this.queueAlgorithm(e);return t&&this._queues[t]?d.map(this._queues[t],function(e){return e.event}):null},n.prototype.removeEventFromQueue=function(e){var t=this.queueAlgorithm(e);if(!t||!this._queues[t])return!1;var r=!1;return d.removeElement(this._queues[t],function(t){if(t.event.getId()===e.getId())return r=!0,!0}),r},n.prototype.setProcessFunction=function(e){this._procFn=e,o(this)},n.prototype.queueEvent=function(e){var t=this.queueAlgorithm(e);if(!t)return null;this._queues[t]||(this._queues[t]=[]);var r=l.default.defer();return this._queues[t].push({event:e,defer:r,attempts:0}),u("Queue algorithm dumped event %s into queue '%s'",e.getId(),t),o(this),r.promise},n.RETRY_BACKOFF_RATELIMIT=function(e,t,r){if(400===r.httpStatus||403===r.httpStatus||401===r.httpStatus)return-1;if("rejected"===r.cors)return-1;if("M_LIMIT_EXCEEDED"===r.name){var n=r.data.retry_after_ms;if(n)return n}return t>4?-1:1e3*Math.pow(2,t)},n.QUEUE_MESSAGES=function(e){return"m.room.message"===e.getType()?"message":null},t.exports=n},{"./utils":55,bluebird:89}],46:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){e.createObjectStore("users",{keyPath:["userId"]}),e.createObjectStore("accountData",{keyPath:["type"]}),e.createObjectStore("sync",{keyPath:["clobber"]})}function i(e){e.createObjectStore("oob_membership_events",{keyPath:["room_id","state_key"]}).createIndex("room","room_id")}function s(e){e.createObjectStore("client_options",{keyPath:["clobber"]})}function a(e,t,r){var n=e.openCursor(t);return new y.default(function(e,t){var o=[];n.onerror=function(e){t(new Error("Query failed: "+e.target.errorCode))},n.onsuccess=function(t){var n=t.target.result;if(!n)return void e(o);o.push(r(n)),n.continue()}})}function u(e){return new y.default(function(t,r){e.oncomplete=function(e){t(e)},e.onerror=function(e){r(e.target.error)}})}function c(e){return new y.default(function(t,r){e.onsuccess=function(e){t(e)},e.onerror=function(e){r(e.target.error)}})}function l(e){return new y.default(function(t,r){e.onsuccess=function(){return t(e)},e.onerror=function(e){return r(e)}})}function d(e){return c(e).then(function(e){return e.target.result})}Object.defineProperty(r,"__esModule",{value:!0});var f=e("babel-runtime/core-js/get-iterator"),p=n(f),h=e("babel-runtime/regenerator"),v=n(h),m=e("bluebird"),y=n(m),_=e("babel-runtime/helpers/slicedToArray"),g=n(_),b=e("../sync-accumulator"),E=n(b),w=e("../utils"),S=n(w),k=function(e,t){this.indexedDB=e,this._dbName="matrix-js-sdk:"+(t||"default"),this.db=null,this._disconnected=!0,this._syncAccumulator=new E.default,this._isNewlyCreated=!1};k.prototype={connect:function(){var e=this;if(!this._disconnected)return console.log("LocalIndexedDBStoreBackend.connect: already connected or connecting"),y.default.resolve();this._disconnected=!1,console.log("LocalIndexedDBStoreBackend.connect: connecting...");var t=this.indexedDB.open(this._dbName,3);return t.onupgradeneeded=function(t){var r=t.target.result,n=t.oldVersion;console.log("LocalIndexedDBStoreBackend.connect: upgrading from "+n),n<1&&(e._isNewlyCreated=!0,o(r)),n<2&&i(r),n<3&&s(r)},t.onblocked=function(){console.log("can't yet open LocalIndexedDBStoreBackend because it is open elsewhere")},console.log("LocalIndexedDBStoreBackend.connect: awaiting connection..."),c(t).then(function(t){return console.log("LocalIndexedDBStoreBackend.connect: connected"),e.db=t.target.result,e.db.onversionchange=function(){e.db.close()},e._init()})},isNewlyCreated:function(){return y.default.resolve(this._isNewlyCreated)},_init:function(){var e=this;return y.default.all([this._loadAccountData(),this._loadSyncData()]).then(function(t){var r=(0,g.default)(t,2),n=r[0],o=r[1];console.log("LocalIndexedDBStoreBackend: loaded initial data"),e._syncAccumulator.accumulate({next_batch:o.nextBatch,rooms:o.roomsData,groups:o.groupsData,account_data:{events:n}})})},getOutOfBandMembers:function(e){var t=this;return new y.default(function(r,n){var o=t.db.transaction(["oob_membership_events"],"readonly"),i=o.objectStore("oob_membership_events"),s=i.index("room"),a=IDBKeyRange.only(e),u=s.openCursor(a),c=[],l=!1;u.onsuccess=function(e){var t=e.target.result;if(!t)return r(c.length||l?c:null);var n=t.value;n.oob_written?l=!0:c.push(n),t.continue()},u.onerror=function(e){n(e)}}).then(function(t){return console.log("LL: got "+(t&&t.length)+" membershipEvents from storage for room "+e+" ..."),t})},setOutOfBandMembers:function(){function e(e,r){return t.apply(this,arguments)}var t=(0,m.coroutine)(v.default.mark(function e(t,r){var n,o,i;return v.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("LL: backend about to store "+r.length+" members for "+t),n=this.db.transaction(["oob_membership_events"],"readwrite"),o=n.objectStore("oob_membership_events"),r.forEach(function(e){o.put(e)}),i={room_id:t,oob_written:!0,state_key:0},o.put(i),e.next=8,(0,m.resolve)(u(n));case 8:console.log("LL: backend done storing for "+t+"!");case 9:case"end":return e.stop()}},e,this)}));return e}(),clearOutOfBandMembers:function(){function e(e){return t.apply(this,arguments)}var t=(0,m.coroutine)(v.default.mark(function e(t){var r,n,o,i,s,a,u,c,f,p,h,_,b;return v.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=this.db.transaction(["oob_membership_events"],"readonly"),n=r.objectStore("oob_membership_events"),o=n.index("room"),i=IDBKeyRange.only(t),s=d(o.openKeyCursor(i,"next")).then(function(e){return e&&e.primaryKey[1]}),a=d(o.openKeyCursor(i,"prev")).then(function(e){return e&&e.primaryKey[1]}),e.next=8,(0,m.resolve)(y.default.all([s,a]));case 8:return u=e.sent,c=(0,g.default)(u,2),f=c[0],p=c[1],h=this.db.transaction(["oob_membership_events"],"readwrite"),_=h.objectStore("oob_membership_events"),b=IDBKeyRange.bound([t,f],[t,p]),console.log("LL: Deleting all users + marker in storage for room "+t+", with key range:",[t,f],[t,p]),e.next=18,(0,m.resolve)(l(_.delete(b)));case 18:case"end":return e.stop()}},e,this)}));return e}(),clearDatabase:function(){var e=this;return new y.default(function(t,r){console.log("Removing indexeddb instance: "+e._dbName);var n=e.indexedDB.deleteDatabase(e._dbName);n.onblocked=function(){console.log("can't yet delete indexeddb "+e._dbName+" because it is open elsewhere")},n.onerror=function(e){console.warn("unable to delete js-sdk store indexeddb: "+e.target.error),t()},n.onsuccess=function(){console.log("Removed indexeddb instance: "+e._dbName),t()}})},getSavedSync:function(e){void 0===e&&(e=!0);var t=this._syncAccumulator.getJSON();return t.nextBatch?e?y.default.resolve(S.default.deepCopy(t)):y.default.resolve(t):y.default.resolve(null)},getNextBatchToken:function(){return y.default.resolve(this._syncAccumulator.getNextBatchToken())},setSyncData:function(e){var t=this;return y.default.resolve().then(function(){t._syncAccumulator.accumulate(e)})},syncToDatabase:function(e){var t=this._syncAccumulator.getJSON();return y.default.all([this._persistUserPresenceEvents(e),this._persistAccountData(t.accountData),this._persistSyncData(t.nextBatch,t.roomsData,t.groupsData)])},_persistSyncData:function(e,t,r){var n=this;return console.log("Persisting sync data up to ",e),y.default.try(function(){var o=n.db.transaction(["sync"],"readwrite");return o.objectStore("sync").put({clobber:"-",nextBatch:e,roomsData:t,groupsData:r}),u(o)})},_persistAccountData:function(e){var t=this;return y.default.try(function(){for(var r=t.db.transaction(["accountData"],"readwrite"),n=r.objectStore("accountData"),o=0;o1&&console.warn("loadSyncData: More than 1 sync row found."),e.length>0?e[0]:{}})})},getClientOptions:function(){var e=this;return y.default.resolve().then(function(){return a(e.db.transaction(["client_options"],"readonly").objectStore("client_options"),void 0,function(e){if(e.value&&e.value&&e.value.options)return e.value.options}).then(function(e){return e[0]})})},storeClientOptions:function(){function e(e){return t.apply(this,arguments)}var t=(0,m.coroutine)(v.default.mark(function e(t){var r,n;return v.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=this.db.transaction(["client_options"],"readwrite"),n=r.objectStore("client_options"),n.put({clobber:"-",options:t}),e.next=5,(0,m.resolve)(u(r));case 5:case"end":return e.stop()}},e,this)}));return e}()},r.default=k},{"../sync-accumulator":52,"../utils":55,"babel-runtime/core-js/get-iterator":58,"babel-runtime/helpers/slicedToArray":84,"babel-runtime/regenerator":86,bluebird:89}],47:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("bluebird"),o=function(e){return e&&e.__esModule?e:{default:e}}(n),i=function(e,t,r){this._workerScript=e,this._dbName=t,this._workerApi=r,this._worker=null,this._nextSeq=0,this._inFlight={},this._startPromise=null};i.prototype={connect:function(){var e=this;return this._ensureStarted().then(function(){return e._doCmd("connect")})},clearDatabase:function(){var e=this;return this._ensureStarted().then(function(){return e._doCmd("clearDatabase")})},isNewlyCreated:function(){return this._doCmd("isNewlyCreated")},getSavedSync:function(){return this._doCmd("getSavedSync")},getNextBatchToken:function(){return this._doCmd("getNextBatchToken")},setSyncData:function(e){return this._doCmd("setSyncData",[e])},syncToDatabase:function(e){return this._doCmd("syncToDatabase",[e])},getOutOfBandMembers:function(e){return this._doCmd("getOutOfBandMembers",[e])},setOutOfBandMembers:function(e,t){return this._doCmd("setOutOfBandMembers",[e,t])},clearOutOfBandMembers:function(e){return this._doCmd("clearOutOfBandMembers",[e])},getClientOptions:function(){return this._doCmd("getClientOptions")},storeClientOptions:function(e){return this._doCmd("storeClientOptions",[e])},getUserPresenceEvents:function(){return this._doCmd("getUserPresenceEvents")},_ensureStarted:function(){return null===this._startPromise&&(this._worker=new this._workerApi(this._workerScript),this._worker.onmessage=this._onWorkerMessage.bind(this),this._startPromise=this._doCmd("_setupWorker",[this._dbName]).then(function(){console.log("IndexedDB worker is ready")})),this._startPromise},_doCmd:function(e,t){var r=this;return o.default.resolve().then(function(){var n=r._nextSeq++,i=o.default.defer();return r._inFlight[n]=i,r._worker.postMessage({command:e,seq:n,args:t}),i.promise})},_onWorkerMessage:function(e){var t=e.data;if("cmd_success"==t.command||"cmd_fail"==t.command){if(void 0===t.seq)return void console.error("Got reply from worker with no seq");var r=this._inFlight[t.seq];if(void 0===r)return void console.error("Got reply for unknown seq "+t.seq);if(delete this._inFlight[t.seq],"cmd_success"==t.command)r.resolve(t.result);else{var n=new Error(t.error.message);n.name=t.error.name,r.reject(n)}}else console.warn("Unrecognised message from worker: "+t)}},r.default=i},{bluebird:89}],48:[function(e,t,r){(function(r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}var o=e("babel-runtime/core-js/get-iterator"),i=n(o),s=e("babel-runtime/helpers/slicedToArray"),a=n(s),u=e("bluebird"),c=n(u),l=e("./memory"),d=e("../utils"),f=n(d),p=e("./indexeddb-local-backend.js"),h=n(p),v=e("./indexeddb-remote-backend.js"),m=n(v),y=e("../models/user"),_=n(y),g=e("../models/event"),b=function(e){if(l.MatrixInMemoryStore.call(this,e),!e.indexedDB)throw new Error("Missing required option: indexedDB");if(e.workerScript){var t=e.workerApi;t||(t=r.Worker),this.backend=new m.default(e.workerScript,e.dbName,t)}else this.backend=new h.default(e.indexedDB,e.dbName);this.startedUp=!1,this._syncTs=0,this._userModifiedMap={}};f.default.inherits(b,l.MatrixInMemoryStore),b.prototype.startup=function(){var e=this;return this.startedUp?(console.log("IndexedDBStore.startup: already started"),c.default.resolve()):(console.log("IndexedDBStore.startup: connecting to backend"),this.backend.connect().then(function(){return console.log("IndexedDBStore.startup: loading presence events"),e.backend.getUserPresenceEvents()}).then(function(t){console.log("IndexedDBStore.startup: processing presence events"),t.forEach(function(t){var r=(0,a.default)(t,2),n=r[0],o=r[1],i=new _.default(n);o&&i.setPresenceEvent(new g.MatrixEvent(o)),e._userModifiedMap[i.userId]=i.getLastModifiedTime(),e.storeUser(i)})}))},b.prototype.getSavedSync=function(){return this.backend.getSavedSync()},b.prototype.isNewlyCreated=function(){return this.backend.isNewlyCreated()},b.prototype.getSavedSyncToken=function(){return this.backend.getNextBatchToken()},b.prototype.deleteAllData=function(){return l.MatrixInMemoryStore.prototype.deleteAllData.call(this),this.backend.clearDatabase().then(function(){console.log("Deleted indexeddb data.")},function(e){throw console.error("Failed to delete indexeddb data: "+e),e})},b.prototype.wantsSave=function(){return Date.now()-this._syncTs>3e5},b.prototype.save=function(){return this.wantsSave()?this._reallySave():c.default.resolve()},b.prototype._reallySave=function(){this._syncTs=Date.now();var e=[],t=!0,r=!1,n=void 0;try{for(var o,s=(0,i.default)(this.getUsers());!(t=(o=s.next()).done);t=!0){var a=o.value;this._userModifiedMap[a.userId]!==a.getLastModifiedTime()&&(a.events.presence&&(e.push([a.userId,a.events.presence.event]),this._userModifiedMap[a.userId]=a.getLastModifiedTime()))}}catch(e){r=!0,n=e}finally{try{!t&&s.return&&s.return()}finally{if(r)throw n}}return this.backend.syncToDatabase(e).catch(function(e){console.error("sync fail:",e)})},b.prototype.setSyncData=function(e){return this.backend.setSyncData(e)},b.prototype.getOutOfBandMembers=function(e){return this.backend.getOutOfBandMembers(e)},b.prototype.setOutOfBandMembers=function(e,t){return this.backend.setOutOfBandMembers(e,t)},b.prototype.clearOutOfBandMembers=function(e){return this.backend.clearOutOfBandMembers(e)},b.prototype.getClientOptions=function(){return this.backend.getClientOptions()},b.prototype.storeClientOptions=function(e){return this.backend.storeClientOptions(e)},t.exports.IndexedDBStore=b}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../models/event":34,"../models/user":41,"../utils":55,"./indexeddb-local-backend.js":46,"./indexeddb-remote-backend.js":47,"./memory":49,"babel-runtime/core-js/get-iterator":58,"babel-runtime/helpers/slicedToArray":84,bluebird:89}],49:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}var o=e("babel-runtime/core-js/object/assign"),i=n(o),s=e("bluebird"),a=n(s),u=e("../utils"),c=e("../models/user");t.exports.MatrixInMemoryStore=function(e){e=e||{},this.rooms={},this.groups={},this.users={},this.syncToken=null,this.filters={},this.accountData={},this.localStorage=e.localStorage,this._oobMembers={},this._clientOptions={}},t.exports.MatrixInMemoryStore.prototype={getSyncToken:function(){return this.syncToken},isNewlyCreated:function(){return a.default.resolve(!0)},setSyncToken:function(e){this.syncToken=e},storeGroup:function(e){this.groups[e.groupId]=e},getGroup:function(e){return this.groups[e]||null},getGroups:function(){return u.values(this.groups)},storeRoom:function(e){this.rooms[e.roomId]=e,e.currentState.on("RoomState.members",this._onRoomMember.bind(this));var t=this;e.currentState.getMembers().forEach(function(r){t._onRoomMember(null,e.currentState,r)})},_onRoomMember:function(e,t,r){if("invite"!==r.membership){var n=this.users[r.userId]||new c(r.userId);r.name&&(n.setDisplayName(r.name),r.events.member&&n.setRawDisplayName(r.events.member.getDirectionalContent().displayname)),r.events.member&&r.events.member.getContent().avatar_url&&n.setAvatarUrl(r.events.member.getContent().avatar_url),this.users[n.userId]=n}},getRoom:function(e){return this.rooms[e]||null},getRooms:function(){return u.values(this.rooms)},removeRoom:function(e){this.rooms[e]&&this.rooms[e].removeListener("RoomState.members",this._onRoomMember),delete this.rooms[e]},getRoomSummaries:function(){return u.map(u.values(this.rooms),function(e){return e.summary})},storeUser:function(e){this.users[e.userId]=e},getUser:function(e){return this.users[e]||null},getUsers:function(){return u.values(this.users)},scrollback:function(e,t){return[]},storeEvents:function(e,t,r,n){},storeFilter:function(e){e&&(this.filters[e.userId]||(this.filters[e.userId]={}),this.filters[e.userId][e.filterId]=e)},getFilter:function(e,t){return this.filters[e]&&this.filters[e][t]?this.filters[e][t]:null},getFilterIdByName:function(e){if(!this.localStorage)return null;try{return this.localStorage.getItem("mxjssdk_memory_filter_"+e)}catch(e){}return null},setFilterIdByName:function(e,t){if(this.localStorage)try{this.localStorage.setItem("mxjssdk_memory_filter_"+e,t)}catch(e){}},storeAccountDataEvents:function(e){var t=this;e.forEach(function(e){t.accountData[e.getType()]=e})},getAccountData:function(e){return this.accountData[e]},setSyncData:function(e){return a.default.resolve()},wantsSave:function(){return!1},save:function(){},startup:function(){return a.default.resolve()},getSavedSync:function(){return a.default.resolve(null)},getSavedSyncToken:function(){ +return a.default.resolve(null)},deleteAllData:function(){return this.rooms={},this.users={},this.syncToken=null,this.filters={},this.accountData={},a.default.resolve()},getOutOfBandMembers:function(e){return a.default.resolve(this._oobMembers[e]||null)},setOutOfBandMembers:function(e,t){return this._oobMembers[e]=t,a.default.resolve()},getClientOptions:function(){return a.default.resolve(this._clientOptions)},storeClientOptions:function(e){return this._clientOptions=(0,i.default)({},e),a.default.resolve()}}},{"../models/user":41,"../utils":55,"babel-runtime/core-js/object/assign":63,bluebird:89}],50:[function(e,t,r){"use strict";function n(e){if(this.store=e,!(h.isFunction(e.getItem)&&h.isFunction(e.setItem)&&h.isFunction(e.removeItem)&&h.isFunction(e.key)&&"number"==typeof e.length))throw new Error("Supplied webStore does not meet the WebStorage API interface")}function o(e){return m+"devices/"+e}function i(e){return m+"sessions/"+e}function s(e,t){return m+"inboundgroupsessions/"+e+"/"+t}function a(e){return m+"rooms/"+e}function u(e,t){try{return JSON.parse(e.getItem(t))}catch(e){d("Failed to get key %s: %s",t,e),d(e.stack)}return null}function c(e,t){for(var r=[],n=0;nthis.opts.maxTimelineEntries)for(var a=r._timeline.length-this.opts.maxTimelineEntries,c=a;c0&&i.ephemeral.events.push(a),n._timeline.forEach(function(e){if(!i.timeline.prev_batch){if(!e.token)return;i.timeline.prev_batch=e.token}i.timeline.events.push(e.event)});for(var c=(0,s.default)(null),l=i.timeline.events.length-1;l>=0;l--){var d=i.timeline.events[l];if(null!==d.state_key&&void 0!==d.state_key){var f=h.default.deepCopy(d);f.unsigned&&(f.unsigned.prev_content&&(f.content=f.unsigned.prev_content),f.unsigned.prev_sender&&(f.sender=f.unsigned.prev_sender)),o(c,f)}}(0,u.default)(n._currentState).forEach(function(e){(0,u.default)(n._currentState[e]).forEach(function(t){var r=n._currentState[e][t];c[e]&&c[e][t]&&(r=c[e][t]),i.state.events.push(r)})}),t.join[r]=i});var r=[];return(0,u.default)(this.accountData).forEach(function(t){r.push(e.accountData[t])}),{nextBatch:this.nextBatch,roomsData:t,groupsData:this.groups,accountData:r}}},{key:"getNextBatchToken",value:function(){return this.nextBatch}}]),e}();t.exports=v},{"./utils":55,"babel-runtime/core-js/object/create":64,"babel-runtime/core-js/object/keys":69,"babel-runtime/helpers/classCallCheck":79,"babel-runtime/helpers/createClass":80}],53:[function(e,t,r){(function(r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){return"FILTER_SYNC_"+e+(t?"_"+t:"")}function i(){var e;T&&(e=console).log.apply(e,arguments)}function s(e,t){this.client=e,t=t||{},t.initialSyncLimit=void 0===t.initialSyncLimit?8:t.initialSyncLimit,t.resolveInvitesToProfiles=t.resolveInvitesToProfiles||!1,t.pollTimeout=t.pollTimeout||3e4,t.pendingEventOrdering=t.pendingEventOrdering||"chronological",t.canResetEntireTimeline||(t.canResetEntireTimeline=function(e){return!1}),this.opts=t,this._peekRoomId=null,this._currentSyncRequest=null,this._syncState=null,this._syncStateData=null,this._catchingUp=!1,this._running=!1,this._keepAliveTimer=null,this._connectionReturnedDefer=null,this._notifEvents=[],this._failedSyncCount=0,this._storeIsInvalid=!1,e.getNotifTimelineSet()&&e.reEmitter.reEmit(e.getNotifTimelineSet(),["Room.timeline","Room.timelineReset"])}function a(e,t){var r=new g(t);return e.reEmitter.reEmit(r,["User.avatarUrl","User.displayName","User.presence","User.currentlyActive","User.lastPresenceTs"]),r}var u=e("babel-runtime/core-js/json/stringify"),c=n(u),l=e("babel-runtime/core-js/object/keys"),d=n(l),f=e("babel-runtime/core-js/get-iterator"),p=n(f),h=e("babel-runtime/regenerator"),v=n(h),m=e("bluebird"),y=n(m),_=e("./errors"),g=e("./models/user"),b=e("./models/room"),E=e("./models/group"),w=e("./utils"),S=e("./filter"),k=e("./models/event-timeline"),T=!0;s.prototype.createRoom=function(e){var t=this.client,r=new b(e,t,t.getUserId(),{lazyLoadMembers:this.opts.lazyLoadMembers,pendingEventOrdering:this.opts.pendingEventOrdering,timelineSupport:t.timelineSupport});return t.reEmitter.reEmit(r,["Room.name","Room.timeline","Room.redaction","Room.receipt","Room.tags","Room.timelineReset","Room.localEchoUpdated","Room.accountData","Room.myMembership"]),this._registerStateListeners(r),r},s.prototype.createGroup=function(e){var t=this.client,r=new E(e);return t.reEmitter.reEmit(r,["Group.profile","Group.myMembership"]),t.store.storeGroup(r),r},s.prototype._registerStateListeners=function(e){var t=this.client;t.reEmitter.reEmit(e.currentState,["RoomState.events","RoomState.members","RoomState.newMember"]),e.currentState.on("RoomState.newMember",function(e,r,n){n.user=t.getUser(n.userId),t.reEmitter.reEmit(n,["RoomMember.name","RoomMember.typing","RoomMember.powerLevel","RoomMember.membership"])})},s.prototype._deregisterStateListeners=function(e){e.currentState.removeAllListeners("RoomState.events"),e.currentState.removeAllListeners("RoomState.members"),e.currentState.removeAllListeners("RoomState.newMember")},s.prototype.syncLeftRooms=function(){var e=this.client,t=this,r=new S(this.client.credentials.userId);r.setTimelineLimit(1),r.setIncludeLeaveRooms(!0);var n=this.opts.pollTimeout+8e4,i={timeout:0};return e.getOrCreateFilter(o(e.credentials.userId,"LEFT_ROOMS"),r).then(function(t){return i.filter=t,e._http.authedRequest(void 0,"GET","/sync",i,void 0,n)}).then(function(r){var n=[];r.rooms&&r.rooms.leave&&(n=t._mapSyncResponseToRoomArray(r.rooms.leave));var o=[];return n.forEach(function(r){var n=r.room;if(o.push(n),r.isBrandNewRoom){r.timeline=r.timeline||{};var i=t._mapSyncEventsFormat(r.timeline,n),s=t._mapSyncEventsFormat(r.state,n);n.getLiveTimeline().setPaginationToken(r.timeline.prev_batch,k.BACKWARDS),t._processRoomEvents(n,s,i),n.recalculate(),e.store.storeRoom(n),e.emit("Room",n),t._processEventsForNotifs(n,i)}}),o})},s.prototype.peek=function(e){var t=this,r=this.client;return this._peekRoomId=e,this.client.roomInitialSync(e,20).then(function(n){n.messages=n.messages||{},n.messages.chunk=n.messages.chunk||[],n.state=n.state||[];var o=t.createRoom(e),i=w.map(w.deepCopy(n.state),r.getEventMapper()),s=w.map(n.state,r.getEventMapper()),u=w.map(n.messages.chunk,r.getEventMapper());return n.presence&&w.isArray(n.presence)&&n.presence.map(r.getEventMapper()).forEach(function(e){var t=r.store.getUser(e.getContent().user_id);t?t.setPresenceEvent(e):(t=a(r,e.getContent().user_id),t.setPresenceEvent(e),r.store.storeUser(t)),r.emit("event",e)}),n.messages.start&&(o.oldState.paginationToken=n.messages.start),o.oldState.setStateEvents(i),o.currentState.setStateEvents(s),t._resolveInvites(o),o.recalculate(),o.addEventsToTimeline(u.reverse(),!0,o.getLiveTimeline(),n.messages.start),r.store.storeRoom(o),r.emit("Room",o),t._peekPoll(o),o})},s.prototype.stopPeeking=function(){this._peekRoomId=null},s.prototype._peekPoll=function(e,t){if(this._peekRoomId!==e.roomId)return void i("Stopped peeking in room %s",e.roomId);var r=this;this.client._http.authedRequest(void 0,"GET","/events",{room_id:e.roomId,timeout:3e4,from:t},void 0,5e4).done(function(t){if(r._peekRoomId!==e.roomId)return void i("Stopped peeking in room %s",e.roomId);t.chunk.filter(function(e){return"m.presence"===e.type}).map(r.client.getEventMapper()).forEach(function(e){var t=r.client.store.getUser(e.getContent().user_id);t?t.setPresenceEvent(e):(t=a(r.client,e.getContent().user_id),t.setPresenceEvent(e),r.client.store.storeUser(t)),r.client.emit("event",e)});var n=t.chunk.filter(function(t){return t.room_id===e.roomId}).map(r.client.getEventMapper());e.addLiveEvents(n),r._peekPoll(e,t.end)},function(n){console.error("[%s] Peek poll failed: %s",e.roomId,n),setTimeout(function(){r._peekPoll(e,t)},3e4)})},s.prototype.getSyncState=function(){return this._syncState},s.prototype.getSyncStateData=function(){return this._syncStateData},s.prototype.recoverFromSyncStartupError=function(){var e=(0,m.coroutine)(v.default.mark(function e(t,r){var n;return v.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,m.resolve)(t);case 2:return n=this._startKeepAlives(),this._updateSyncState("ERROR",{error:r}),e.next=6,(0,m.resolve)(n);case 6:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}(),s.prototype._wasLazyLoadingToggled=function(){var e=(0,m.coroutine)(v.default.mark(function e(t){var r,n,o;return v.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=!!t,r=!1,e.next=4,(0,m.resolve)(this.client.store.isNewlyCreated());case 4:if(n=e.sent){e.next=11;break}return e.next=8,(0,m.resolve)(this.client.store.getClientOptions());case 8:return o=e.sent,o&&(r=!!o.lazyLoadMembers),e.abrupt("return",r!==t);case 11:return e.abrupt("return",!1);case 12:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}(),s.prototype.sync=function(){var e=this,t=function(){var e=(0,m.coroutine)(v.default.mark(function e(){var r;return v.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,m.resolve)(s.getPushRules());case 3:r=e.sent,i("Got push rules"),s.pushRules=r,e.next=14;break;case 8:return e.prev=8,e.t0=e.catch(0),e.next=12,(0,m.resolve)(a.recoverFromSyncStartupError(u,e.t0));case 12:return t(),e.abrupt("return");case 14:l();case 15:case"end":return e.stop()}},e,this,[[0,8]])}));return function(){return e.apply(this,arguments)}}(),n=function(){var e=(0,m.coroutine)(v.default.mark(function e(){var t,r;return v.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=void 0,a.opts.filter?t=a.opts.filter:(t=new S(s.credentials.userId),t.setTimelineLimit(a.opts.initialSyncLimit)),r=void 0,e.prev=3,e.next=6,(0,m.resolve)(s.getOrCreateFilter(o(s.credentials.userId),t));case 6:r=e.sent,e.next=15;break;case 9:return e.prev=9,e.t0=e.catch(3),e.next=13,(0,m.resolve)(a.recoverFromSyncStartupError(u,e.t0));case 13:return n(),e.abrupt("return");case 15:return s.resetNotifTimelineSet(),null===a._currentSyncRequest&&(console.log("Sending first sync request..."),a._currentSyncRequest=a._doSyncRequest({filterId:r},c)),e.next=19,(0,m.resolve)(u);case 19:a._sync({filterId:r});case 20:case"end":return e.stop()}},e,this,[[3,9]])}));return function(){return e.apply(this,arguments)}}(),s=this.client,a=this;this._running=!0,r.document&&(this._onOnlineBound=this._onOnline.bind(this),r.document.addEventListener("online",this._onOnlineBound,!1));var u=y.default.resolve(),c=null,l=function(){var t=(0,m.coroutine)(v.default.mark(function t(){var r,o,i,a;return v.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(e.opts.lazyLoadMembers&&s.isGuest()&&(e.opts.lazyLoadMembers=!1),!e.opts.lazyLoadMembers){t.next=13;break}return t.next=4,(0,m.resolve)(s.doesServerSupportLazyLoading());case 4:if(!(r=t.sent)){t.next=11;break}return t.next=8,(0,m.resolve)(s.createFilter(S.LAZY_LOADING_SYNC_FILTER));case 8:e.opts.filter=t.sent,t.next=13;break;case 11:console.log("LL: lazy loading requested but not supported by server, so disabling"),e.opts.lazyLoadMembers=!1;case 13:return t.next=15,(0,m.resolve)(e._wasLazyLoadingToggled(e.opts.lazyLoadMembers));case 15:if(!(o=t.sent)){t.next=23;break}return e._storeIsInvalid=!0,i=_.InvalidStoreError.TOGGLED_LAZY_LOADING,a=new _.InvalidStoreError(i,!!e.opts.lazyLoadMembers),e._updateSyncState("ERROR",{error:a}),console.warn("InvalidStoreError: store is not usable: stopping sync."),t.abrupt("return");case 23:return e.opts.lazyLoadMembers&&e.opts.crypto&&e.opts.crypto.enableLazyLoading(),t.next=26,(0,m.resolve)(e.client._storeClientOptions());case 26:n();case 27:case"end":return t.stop()}},t,e)}));return function(){return t.apply(this,arguments)}}();s.isGuest()?a._sync({}):(u=s.store.getSavedSyncToken().then(function(e){return c=e,s.store.getSavedSync()}).then(function(e){if(e)return a._syncFromCache(e)}),t())},s.prototype.stop=function(){i("SyncApi.stop"),r.document&&(r.document.removeEventListener("online",this._onOnlineBound,!1),this._onOnlineBound=void 0),this._running=!1,this._currentSyncRequest&&this._currentSyncRequest.abort(),this._keepAliveTimer&&(clearTimeout(this._keepAliveTimer),this._keepAliveTimer=null)},s.prototype.retryImmediately=function(){return!!this._connectionReturnedDefer&&(this._startKeepAlives(0),!0)},s.prototype._syncFromCache=function(){var e=(0,m.coroutine)(v.default.mark(function e(t){var r,n,o;return v.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i("sync(): not doing HTTP hit, instead returning stored /sync data"),r=t.nextBatch,this.client.store.setSyncToken(r),n={oldSyncToken:null,nextSyncToken:r,catchingUp:!1},o={next_batch:r,rooms:t.roomsData,groups:t.groupsData,account_data:{events:t.accountData}},e.prev=5,e.next=8,(0,m.resolve)(this._processSyncResponse(n,o));case 8:e.next=13;break;case 10:e.prev=10,e.t0=e.catch(5),console.error("Error processing cached sync",e.t0.stack||e.t0);case 13:this._storeIsInvalid||this._updateSyncState("PREPARED",n);case 14:case"end":return e.stop()}},e,this,[[5,10]])}));return function(t){return e.apply(this,arguments)}}(),s.prototype._sync=function(){var e=(0,m.coroutine)(v.default.mark(function e(t){var r,n,o,s;return v.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this.client,this._running){e.next=6;break}return i("Sync no longer running: exiting."),this._connectionReturnedDefer&&(this._connectionReturnedDefer.reject(),this._connectionReturnedDefer=null),this._updateSyncState("STOPPED"),e.abrupt("return");case 6:return n=r.store.getSyncToken(),o=void 0,e.prev=8,null===this._currentSyncRequest&&(this._currentSyncRequest=this._doSyncRequest(t,n)),e.next=12,(0,m.resolve)(this._currentSyncRequest);case 12:o=e.sent,e.next=19;break;case 15:return e.prev=15,e.t0=e.catch(8),this._onSyncError(e.t0,t),e.abrupt("return");case 19:return e.prev=19,this._currentSyncRequest=null,e.finish(19);case 22:return r.store.setSyncToken(o.next_batch),this._failedSyncCount=0,e.next=26,(0,m.resolve)(r.store.setSyncData(o));case 26:if(s={oldSyncToken:n,nextSyncToken:o.next_batch,catchingUp:this._catchingUp},!this.opts.crypto){e.next=30;break}return e.next=30,(0,m.resolve)(this.opts.crypto.onSyncWillProcess(s));case 30:return e.prev=30,e.next=33,(0,m.resolve)(this._processSyncResponse(s,o));case 33:e.next=38;break;case 35:e.prev=35,e.t1=e.catch(30),console.error("Caught /sync error",e.t1.stack||e.t1);case 38:if(s.catchingUp=this._catchingUp,t.hasSyncedBefore||(this._updateSyncState("PREPARED",s),t.hasSyncedBefore=!0),!this.opts.crypto){e.next=43;break}return e.next=43,(0,m.resolve)(this.opts.crypto.onSyncCompleted(s));case 43:if(this._updateSyncState("SYNCING",s),!r.store.wantsSave()){e.next=49;break}if(!this.opts.crypto){e.next=48;break}return e.next=48,(0,m.resolve)(this.opts.crypto.saveDeviceList(0));case 48:r.store.save();case 49:this._sync(t);case 50:case"end":return e.stop()}},e,this,[[8,15,19,22],[30,35]])}));return function(t){return e.apply(this,arguments)}}(),s.prototype._doSyncRequest=function(e,t){var r=this._getSyncParams(e,t);return this.client._http.authedRequest(void 0,"GET","/sync",r,void 0,r.timeout+8e4)},s.prototype._getSyncParams=function(e,t){var r=this.opts.pollTimeout;("SYNCING"!==this.getSyncState()||this._catchingUp)&&(this._catchingUp=!0,r=0);var n=e.filterId;this.client.isGuest()&&!n&&(n=this._getGuestFilter());var o={filter:n,timeout:r};return this.opts.disablePresence&&(o.set_presence="offline"),t?o.since=t:o._cacheBuster=Date.now(),"ERROR"!=this.getSyncState()&&"RECONNECTING"!=this.getSyncState()||(o.timeout=0),o},s.prototype._onSyncError=function(e,t){var r=this;if(!this._running)return i("Sync no longer running: exiting"),this._connectionReturnedDefer&&(this._connectionReturnedDefer.reject(),this._connectionReturnedDefer=null),void this._updateSyncState("STOPPED");console.error("/sync error %s",e),console.error(e),this._failedSyncCount++,console.log("Number of consecutive failed sync requests:",this._failedSyncCount),i("Starting keep-alive"),this._startKeepAlives().then(function(e){e&&"ERROR"===r.getSyncState()&&r._updateSyncState("CATCHUP",{oldSyncToken:null,nextSyncToken:null,catchingUp:!0}),r._sync(t)}),this._currentSyncRequest=null,this._updateSyncState(this._failedSyncCount>=3?"ERROR":"RECONNECTING",{error:e})},s.prototype._processSyncResponse=function(){var e=(0,m.coroutine)(v.default.mark(function e(t,r){var n,o,s,u,c,l,d;return v.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=this.client,o=this,r.presence&&w.isArray(r.presence.events)&&r.presence.events.map(n.getEventMapper()).forEach(function(e){var t=n.store.getUser(e.getSender());t?t.setPresenceEvent(e):(t=a(n,e.getSender()),t.setPresenceEvent(e),n.store.storeUser(t)),n.emit("event",e)}),r.account_data&&w.isArray(r.account_data.events)&&(s=r.account_data.events.map(n.getEventMapper()),n.store.storeAccountDataEvents(s),s.forEach(function(e){return"m.push_rules"==e.getType()&&(n.pushRules=e.getContent()),n.emit("accountData",e),e})),r.to_device&&w.isArray(r.to_device.events)&&r.to_device.events.length>0?r.to_device.events.map(n.getEventMapper()).forEach(function(e){var t=e.getContent();if("m.room.message"==e.getType()&&"m.bad.encrypted"==t.msgtype)return void console.log("Ignoring undecryptable to-device event from "+e.getSender());n.emit("toDeviceEvent",e)}):this._catchingUp=!1,r.groups&&(r.groups.invite&&this._processGroupSyncEntry(r.groups.invite,"invite"),r.groups.join&&this._processGroupSyncEntry(r.groups.join,"join"),r.groups.leave&&this._processGroupSyncEntry(r.groups.leave,"leave")),u=[],c=[],l=[],r.rooms&&(r.rooms.invite&&(u=this._mapSyncResponseToRoomArray(r.rooms.invite)),r.rooms.join&&(c=this._mapSyncResponseToRoomArray(r.rooms.join)),r.rooms.leave&&(l=this._mapSyncResponseToRoomArray(r.rooms.leave))),this._notifEvents=[],u.forEach(function(e){var t=e.room,r=o._mapSyncEventsFormat(e.invite_state,t);t.updateMyMembership("invite"),o._processRoomEvents(t,r),e.isBrandNewRoom&&(t.recalculate(),n.store.storeRoom(t),n.emit("Room",t)),r.forEach(function(e){n.emit("event",e)})}),e.next=14,(0,m.resolve)(y.default.mapSeries(c,function(){var e=(0,m.coroutine)(v.default.mark(function e(r){var s,a,u,c,l,d,f,p,h=function(){var e=(0,m.coroutine)(v.default.mark(function e(t){return v.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n.emit("event",t),!t.isState()||"m.room.encryption"!=t.getType()||!o.opts.crypto){e.next=4;break}return e.next=4,(0,m.resolve)(o.opts.crypto.onCryptoEvent(t));case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}();return v.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(s=r.room,a=o._mapSyncEventsFormat(r.state,s),u=o._mapSyncEventsFormat(r.timeline,s),c=o._mapSyncEventsFormat(r.ephemeral),l=o._mapSyncEventsFormat(r.account_data),r.unread_notifications&&(s.setUnreadNotificationCount("total",r.unread_notifications.notification_count),s.setUnreadNotificationCount("highlight",r.unread_notifications.highlight_count)),s.updateMyMembership("join"),r.timeline=r.timeline||{},!r.isBrandNewRoom){e.next=12;break}s.getLiveTimeline().setPaginationToken(r.timeline.prev_batch,k.BACKWARDS),e.next=26;break;case 12:if(!r.timeline.limited){e.next=26;break}d=!0,f=u.length-1;case 15:if(!(f>=0)){e.next=25;break}if(p=u[f].getId(),!s.getTimelineForEvent(p)){e.next=22;break}return i("Already have event "+p+" in limited sync - not resetting"),d=!1,u.splice(0,f),e.abrupt("break",25);case 22:f--,e.next=15;break;case 25:d&&(o._deregisterStateListeners(s),s.resetLiveTimeline(r.timeline.prev_batch,o.opts.canResetEntireTimeline(s.roomId)?null:t.oldSyncToken),n.resetNotifTimelineSet(),o._registerStateListeners(s));case 26:return o._processRoomEvents(s,a,u),r.summary&&s.setSummary(r.summary),s.addLiveEvents(c),s.addAccountData(l),s.recalculate(),r.isBrandNewRoom&&(n.store.storeRoom(s),n.emit("Room",s)),o._processEventsForNotifs(s,u),e.next=35,(0,m.resolve)(y.default.mapSeries(a,h));case 35:return e.next=37,(0,m.resolve)(y.default.mapSeries(u,h));case 37:c.forEach(function(e){n.emit("event",e)}),l.forEach(function(e){n.emit("event",e)});case 39:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()));case 14:if(l.forEach(function(e){var t=e.room,r=o._mapSyncEventsFormat(e.state,t),i=o._mapSyncEventsFormat(e.timeline,t),s=o._mapSyncEventsFormat(e.account_data);t.updateMyMembership("leave"),o._processRoomEvents(t,r,i),t.addAccountData(s),t.recalculate(),e.isBrandNewRoom&&(n.store.storeRoom(t),n.emit("Room",t)),o._processEventsForNotifs(t,i),r.forEach(function(e){n.emit("event",e)}),i.forEach(function(e){n.emit("event",e)}),s.forEach(function(e){n.emit("event",e)})}),t.oldSyncToken&&this._notifEvents.length&&(this._notifEvents.sort(function(e,t){return e.getTs()-t.getTs()}),this._notifEvents.forEach(function(e){n.getNotifTimelineSet().addLiveEvent(e)})),!r.device_lists){e.next=22;break}if(!this.opts.crypto){e.next=22;break}return e.next=20,(0,m.resolve)(this.opts.crypto.handleDeviceListChanges(t,r.device_lists));case 20:e.next=22;break;case 22:this.opts.crypto&&r.device_one_time_keys_count&&(d=r.device_one_time_keys_count.signed_curve25519||0,this.opts.crypto.updateOneTimeKeyCount(d));case 23:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}(),s.prototype._startKeepAlives=function(e){void 0===e&&(e=2e3+Math.floor(5e3*Math.random())),null!==this._keepAliveTimer&&clearTimeout(this._keepAliveTimer);var t=this;return e>0?t._keepAliveTimer=setTimeout(t._pokeKeepAlive.bind(t),e):t._pokeKeepAlive(),this._connectionReturnedDefer||(this._connectionReturnedDefer=y.default.defer()),this._connectionReturnedDefer.promise},s.prototype._pokeKeepAlive=function(e){function t(){clearTimeout(r._keepAliveTimer),r._connectionReturnedDefer&&(r._connectionReturnedDefer.resolve(e),r._connectionReturnedDefer=null)}void 0===e&&(e=!1);var r=this;this.client._http.request(void 0,"GET","/_matrix/client/versions",void 0,void 0,{prefix:"",localTimeoutMs:15e3}).done(function(){t()},function(n){400==n.httpStatus||404==n.httpStatus?r._keepAliveTimer=setTimeout(t,2e3):(e=!0,r._keepAliveTimer=setTimeout(r._pokeKeepAlive.bind(r,e),5e3+Math.floor(5e3*Math.random())),r._updateSyncState("ERROR",{error:n}))})},s.prototype._processGroupSyncEntry=function(e,t){var r=!0,n=!1,o=void 0;try{for(var i,s=(0,p.default)((0,d.default)(e));!(r=(i=s.next()).done);r=!0){var a=i.value,u=e[a],c=this.client.store.getGroup(a),l=null===c;null===c&&(c=this.createGroup(a)),u.profile&&c.setProfile(u.profile.name,u.profile.avatar_url),u.inviter&&c.setInviter({userId:u.inviter}),c.setMyMembership(t),l&&this.client.emit("Group",c)}}catch(e){n=!0,o=e}finally{try{!r&&s.return&&s.return()}finally{if(n)throw o}}},s.prototype._mapSyncResponseToRoomArray=function(e){var t=this.client,r=this;return w.keys(e).map(function(n){var o=e[n],i=t.store.getRoom(n),s=!1;return i||(i=r.createRoom(n),s=!0),o.room=i,o.isBrandNewRoom=s,o})},s.prototype._mapSyncEventsFormat=function(e,t){if(!e||!w.isArray(e.events))return[];var r=this.client.getEventMapper();return e.events.map(function(e){return t&&(e.room_id=t.roomId),r(e) +})},s.prototype._resolveInvites=function(e){if(e&&this.opts.resolveInvitesToProfiles){var t=this.client;e.getMembersWithMembership("invite").forEach(function(r){if(!r._requestedProfileInfo){r._requestedProfileInfo=!0;var n=t.getUser(r.userId),o=void 0;o=n?y.default.resolve({avatar_url:n.avatarUrl,displayname:n.displayName}):t.getProfileInfo(r.userId),o.done(function(t){var n=r.events.member;"invite"===n.getContent().membership&&(n.getContent().avatar_url=t.avatar_url,n.getContent().displayname=t.displayname,r.setMembershipEvent(n,e.currentState))},function(e){})}})}},s.prototype._processRoomEvents=function(e,t,r){var n=e.getLiveTimeline(),o=0==n.getEvents().length;if(o){var i=!0,s=!1,a=void 0;try{for(var u,c=(0,p.default)(t);!(i=(u=c.next()).done);i=!0){var l=u.value;this.client.getPushActionsForEvent(l)}}catch(e){s=!0,a=e}finally{try{!i&&c.return&&c.return()}finally{if(s)throw a}}n.initialiseState(t)}this._resolveInvites(e),e.recalculate(),o||(e.oldState.setStateEvents(t||[]),e.currentState.setStateEvents(t||[])),e.addLiveEvents(r||[])},s.prototype._processEventsForNotifs=function(e,t){if(this.client.getNotifTimelineSet())for(var r=0;rt.minIndex())return!0}else if(t.index0&&this.unpaginate(c,e!=a.BACKWARDS),s.default.resolve(!0)}if(!r||0===n)return s.default.resolve(!1);if(!o.timeline.getPaginationToken(e))return u("TimelineWindow: no token"),s.default.resolve(!1);u("TimelineWindow: starting request");var l=this,d=this._client.paginateEventTimeline(o.timeline,{backwards:e==a.BACKWARDS,limit:t}).finally(function(){o.pendingPaginate=null}).then(function(r){return u("TimelineWindow: request completed with result "+r),!!r&&l.paginate(e,t,!0,n-1)});return o.pendingPaginate=d,d},n.prototype.unpaginate=function(e,t){var r=t?this._start:this._end;if(e>this._eventCount||e<0)throw new Error("Attemting to unpaginate "+e+" events, but only have "+this._eventCount+" in the timeline");for(;e>0;){var n=t?r.advance(e):r.retreat(e);if(n<=0)throw new Error("Unable to unpaginate any further, but still have "+this._eventCount+" events");e-=n,this._eventCount-=n,u("TimelineWindow.unpaginate: dropped "+n+" (now "+this._eventCount+")")}},n.prototype.getEvents=function(){if(!this._start)return[];for(var e=[],t=this._start.timeline;;){var r=t.getEvents(),n=0,o=r.length;t===this._start.timeline&&(n=this._start.index+t.getBaseIndex()),t===this._end.timeline&&(o=this._end.index+t.getBaseIndex());for(var i=n;i0)return this.index+=t,t;var r=this.timeline.getNeighbouringTimeline(e<0?a.BACKWARDS:a.FORWARDS);return r?(this.timeline=r,this.index=e<0?this.maxIndex():this.minIndex(),u("paginate: switched to new neighbour"),this.advance(e)):0},o.prototype.retreat=function(e){return-1*this.advance(-1*e)},t.exports.TimelineWindow=n,t.exports.TimelineIndex=o},{"./models/event-timeline":33,bluebird:89}],55:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var i=e("babel-runtime/core-js/object/create"),s=n(i),a=e("babel-runtime/helpers/typeof"),u=n(a),c=e("babel-runtime/core-js/json/stringify"),l=n(c);t.exports.encodeParams=function(e){var t="";for(var r in e)e.hasOwnProperty(r)&&(t+="&"+encodeURIComponent(r)+"="+encodeURIComponent(e[r]));return t.substring(1)},t.exports.encodeUri=function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e=e.replace(r,encodeURIComponent(t[r])));return e},t.exports.map=function(e,t){for(var r=new Array(e.length),n=0;n=0;n--)if(t(e[n],n,e))return e[n]}else for(n=0;n=0;n--)if(t(e[n],n,e))return o=e[n],e.splice(n,1),o}else for(n=0;n>>0;if("function"!=typeof e)throw new TypeError;for(var n=[],o=arguments.length>=2?arguments[1]:void 0,i=0;i>>0;if("function"!=typeof e)throw new TypeError(e+" is not a function");arguments.length>1&&(r=t);var s=new Array(i);for(n=0;n>>0;if("function"!=typeof e)throw new TypeError(e+" is not a function");for(arguments.length>1&&(r=t),n=0;n1){var o=Object(arguments[1]);for(var i in o)t.call(o,i)&&(n[i]=o[i])}return n}}()),e.super_=t,e.prototype=(0,s.default)(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},t.exports.isNumber=function(e){return"number"==typeof e&&isFinite(e)},t.exports.removeHiddenChars=function(e){return e.normalize("NFD").replace(f,"")};var f=/[\u200B-\u200D\u0300-\u036f\uFEFF\s]/g;t.exports.escapeRegExp=o,t.exports.globToRegexp=function(e,t){t="boolean"!=typeof t||t;var r=o(e);return r=r.replace(/\\\*/g,".*"),r=r.replace(/\?/g,"."),t&&(r=r.replace(/\\\[(!|)(.*)\\]/g,function(e,t,r,n,o){return"["+(t&&"^"||"")+r.replace(/\\\-/,"-")+"]"})),r}},{"babel-runtime/core-js/json/stringify":60,"babel-runtime/core-js/object/create":64,"babel-runtime/helpers/typeof":85}],56:[function(e,t,r){(function(r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){this.roomId=e.roomId,this.client=e.client,this.webRtc=e.webRtc,this.forceTURN=e.forceTURN,this.URL=e.URL,this.turnServers=e.turnServers||[],0===this.turnServers.length&&this.turnServers.push({urls:[o.FALLBACK_STUN_SERVER]}),l.forEach(this.turnServers,function(e){l.checkObjectHasKeys(e,["urls"])}),this.callId="c"+(new Date).getTime()+Math.random(),this.state="fledgling",this.didConnect=!1,this.candidateSendQueue=[],this.candidateSendTries=0,this.mediaPromises=(0,c.default)(null),this.screenSharingStream=null,this._answerContent=null}var i=e("babel-runtime/regenerator"),s=n(i),a=e("bluebird"),u=e("babel-runtime/core-js/object/create"),c=n(u),l=e("../utils"),d=e("events").EventEmitter;o.CALL_TIMEOUT_MS=6e4,o.FALLBACK_STUN_SERVER="stun:stun.l.google.com:19302",o.ERR_LOCAL_OFFER_FAILED="local_offer_failed",o.ERR_NO_USER_MEDIA="no_user_media",o.ERR_UNKNOWN_DEVICES="unknown_devices",o.ERR_SEND_INVITE="send_invite",o.ERR_SEND_ANSWER="send_answer",l.inherits(o,d),o.prototype.placeVoiceCall=function(){S("placeVoiceCall"),E(this),T(this,I("voice")),this.type="voice"},o.prototype.placeVideoCall=function(e,t){S("placeVideoCall"),E(this),this.localVideoElement=t,this.remoteVideoElement=e,T(this,I("video")),this.type="video",g(this)},o.prototype.placeScreenSharingCall=function(e,t){S("placeScreenSharingCall"),E(this);var r=R(this);if(r){this.localVideoElement=t,this.remoteVideoElement=e;var n=this;this.webRtc.getUserMedia(r,function(e){n.screenSharingStream=e,S("Got screen stream, requesting audio stream...");var t=I("voice");T(n,t)},function(e){n.emit("error",w(o.ERR_NO_USER_MEDIA,"Failed to get screen-sharing stream: "+e))}),this.type="video",g(this)}},o.prototype.playElement=function(e,t){console.log("queuing play on "+t+" and element "+e),this.mediaPromises[t]?this.mediaPromises[t]=this.mediaPromises[t].then(function(){return console.log("previous promise completed for "+t),e.play()},function(){return console.log("previous promise failed for "+t),e.play()}):this.mediaPromises[t]=e.play()},o.prototype.pauseElement=function(e,t){console.log("queuing pause on "+t+" and element "+e),this.mediaPromises[t]?this.mediaPromises[t]=this.mediaPromises[t].then(function(){return console.log("previous promise completed for "+t),e.pause()},function(){return console.log("previous promise failed for "+t),e.pause()}):this.mediaPromises[t]=e.pause()},o.prototype.assignElement=function(e,t,r){console.log("queuing assign on "+r+" element "+e+" for "+t),this.mediaPromises[r]?this.mediaPromises[r]=this.mediaPromises[r].then(function(){console.log("previous promise completed for "+r),e.srcObject=t},function(){console.log("previous promise failed for "+r),e.srcObject=t}):e.srcObject=t},o.prototype.getLocalVideoElement=function(){return this.localVideoElement},o.prototype.getRemoteVideoElement=function(){return this.remoteVideoElement},o.prototype.getRemoteAudioElement=function(){return this.remoteAudioElement},o.prototype.setLocalVideoElement=function(e){if(this.localVideoElement=e,e&&this.localAVStream&&"video"===this.type){e.autoplay=!0,this.assignElement(e,this.localAVStream,"localVideo"),e.muted=!0;var t=this;setTimeout(function(){var e=t.getLocalVideoElement();e.play&&t.playElement(e,"localVideo")},0)}},o.prototype.setRemoteVideoElement=function(e){this.remoteVideoElement=e,g(this)},o.prototype.setRemoteAudioElement=function(e){this.remoteVideoElement.muted=!0,this.remoteAudioElement=e,this.remoteAudioElement.muted=!1,b(this)},o.prototype._initWithInvite=function(e){this.msg=e.getContent(),this.peerConn=x(this);var t=this;this.peerConn&&this.peerConn.setRemoteDescription(new this.webRtc.RtcSessionDescription(this.msg.offer),C(t,t._onSetRemoteDescriptionSuccess),C(t,t._onSetRemoteDescriptionError)),h(this,"ringing"),this.direction="inbound",this.msg.offer&&this.msg.offer.sdp&&this.msg.offer.sdp.indexOf("m=video")>-1?this.type="video":this.type="voice",e.getAge()&&setTimeout(function(){"ringing"==t.state&&(S("Call invite has expired. Hanging up."),t.hangupParty="remote",h(t,"ended"),_(t),"closed"!=t.peerConn.signalingState&&t.peerConn.close(),t.emit("hangup",t))},this.msg.lifetime-e.getAge())},o.prototype._initWithHangup=function(e){this.msg=e.getContent(),h(this,"ended")},o.prototype.answer=function(){S("Answering call %s of type %s",this.callId,this.type);var e=this;if(e._answerContent)return void e._sendAnswer();this.localAVStream||this.waitForLocalAVStream?this.localAVStream?this._maybeGotUserMediaForAnswer(this.localAVStream):this.waitForLocalAVStream&&h(this,"wait_local_media"):(this.webRtc.getUserMedia(I(this.type),C(e,e._maybeGotUserMediaForAnswer),C(e,e._maybeGotUserMediaForAnswer)),h(this,"wait_local_media"))},o.prototype._replacedBy=function(e){S(this.callId+" being replaced by "+e.callId),"wait_local_media"==this.state?(S("Telling new call to wait for local media"),e.waitForLocalAVStream=!0):"create_offer"==this.state?(S("Handing local stream to new call"),e._maybeGotUserMediaForAnswer(this.localAVStream),delete this.localAVStream):"invite_sent"==this.state&&(S("Handing local stream to new call"),e._maybeGotUserMediaForAnswer(this.localAVStream),delete this.localAVStream),e.localVideoElement=this.localVideoElement,e.remoteVideoElement=this.remoteVideoElement,e.remoteAudioElement=this.remoteAudioElement,this.successor=e,this.emit("replaced",e),this.hangup(!0)},o.prototype.hangup=function(e,t){if("ended"!=this.state){S("Ending call "+this.callId),y(this,"local",e,!t);var r={version:0,call_id:this.callId,reason:e};v(this,"m.call.hangup",r)}},o.prototype.setLocalVideoMuted=function(e){this.localAVStream&&f(this.localAVStream.getVideoTracks(),!e)},o.prototype.isLocalVideoMuted=function(){return!!this.localAVStream&&!p(this.localAVStream.getVideoTracks())},o.prototype.setMicrophoneMuted=function(e){this.localAVStream&&f(this.localAVStream.getAudioTracks(),!e)},o.prototype.isMicrophoneMuted=function(){return!!this.localAVStream&&!p(this.localAVStream.getAudioTracks())},o.prototype._maybeGotUserMediaForInvite=function(e){if(this.successor)return void this.successor._maybeGotUserMediaForAnswer(e);if("ended"!=this.state){S("_maybeGotUserMediaForInvite -> "+this.type);var t=this,r=e,n={mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:"video"===t.type}};if(e instanceof MediaStream){var o=this.getLocalVideoElement();o&&"video"==this.type&&(o.autoplay=!0,this.screenSharingStream?(S("Setting screen sharing stream to the local video element"),this.assignElement(o,this.screenSharingStream,"localVideo")):this.assignElement(o,e,"localVideo"),o.muted=!0,setTimeout(function(){var e=t.getLocalVideoElement();e.play&&t.playElement(e,"localVideo")},0)),this.screenSharingStream&&(this.screenSharingStream.addTrack(e.getAudioTracks()[0]),e=this.screenSharingStream),this.localAVStream=e,f(e.getAudioTracks(),!0),this.peerConn=x(this),this.peerConn.addStream(e)}else{if("PermissionDeniedError"!==r.name)return S("Failed to getUserMedia."),void this._getUserMediaFailed(r);S("User denied access to camera/microphone. Or possibly you are using an insecure domain. Receiving only."),this.peerConn=x(this)}this.peerConn.createOffer(C(t,t._gotLocalOffer),C(t,t._getLocalOfferFailed),n),h(t,"create_offer")}},o.prototype._sendAnswer=function(e){var t=this;v(this,"m.call.answer",this._answerContent).then(function(){h(t,"connecting"),k(t)}).catch(function(e){h(t,"ringing"),t.client.cancelPendingEvent(e.event);var r=o.ERR_SEND_ANSWER,n="Failed to send answer";throw"UnknownDeviceError"==e.name&&(r=o.ERR_UNKNOWN_DEVICES,n="Unknown devices present in the room"),t.emit("error",w(r,n)),e})},o.prototype._maybeGotUserMediaForAnswer=function(e){var t=this;if("ended"!=t.state){var r=e;if(e instanceof MediaStream){var n=t.getLocalVideoElement();n&&"video"==t.type&&(n.autoplay=!0,this.assignElement(n,e,"localVideo"),n.muted=!0,setTimeout(function(){var e=t.getLocalVideoElement();e.play&&t.playElement(e,"localVideo")},0)),t.localAVStream=e,f(e.getAudioTracks(),!0),t.peerConn.addStream(e)}else{if("PermissionDeniedError"!==r.name)return S("Failed to getUserMedia."),void this._getUserMediaFailed(r);S("User denied access to camera/microphone. Or possibly you are using an insecure domain. Receiving only.")}var o={mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:"video"===t.type}};t.peerConn.createAnswer(function(e){S("Created answer: "+e),t.peerConn.setLocalDescription(e,function(){t._answerContent={version:0,call_id:t.callId,answer:{sdp:t.peerConn.localDescription.sdp,type:t.peerConn.localDescription.type}},t._sendAnswer()},function(){S("Error setting local description!")},o)},function(e){S("Failed to create answer: "+e)}),h(t,"create_answer")}},o.prototype._gotLocalIceCandidate=function(e){if(e.candidate){if(S("Got local ICE "+e.candidate.sdpMid+" candidate: "+e.candidate.candidate),"ended"==this.state)return;var t={candidate:e.candidate.candidate,sdpMid:e.candidate.sdpMid,sdpMLineIndex:e.candidate.sdpMLineIndex};m(this,t)}},o.prototype._gotRemoteIceCandidate=function(e){"ended"!=this.state&&(S("Got remote ICE "+e.sdpMid+" candidate: "+e.candidate),this.peerConn.addIceCandidate(new this.webRtc.RtcIceCandidate(e),function(){},function(e){}))},o.prototype._receivedAnswer=function(e){if("ended"!=this.state){var t=this;this.peerConn.setRemoteDescription(new this.webRtc.RtcSessionDescription(e.answer),C(t,t._onSetRemoteDescriptionSuccess),C(t,t._onSetRemoteDescriptionError)),h(t,"connecting")}},o.prototype._gotLocalOffer=function(e){var t=this;if(S("Created offer: "+e),"ended"==t.state)return void S("Ignoring newly created offer on call ID "+t.callId+" because the call has ended");t.peerConn.setLocalDescription(e,function(){var e={version:0,call_id:t.callId,offer:{sdp:t.peerConn.localDescription.sdp,type:t.peerConn.localDescription.type},lifetime:o.CALL_TIMEOUT_MS};v(t,"m.call.invite",e).then(function(){h(t,"invite_sent"),setTimeout(function(){"invite_sent"==t.state&&t.hangup("invite_timeout")},o.CALL_TIMEOUT_MS)}).catch(function(e){var r=o.ERR_SEND_INVITE,n="Failed to send invite";throw"UnknownDeviceError"==e.name&&(r=o.ERR_UNKNOWN_DEVICES,n="Unknown devices present in the room"),t.client.cancelPendingEvent(e.event),y(t,"local",r,!1),t.emit("error",w(r,n)),e})},function(){S("Error setting local description!")})},o.prototype._getLocalOfferFailed=function(e){this.emit("error",w(o.ERR_LOCAL_OFFER_FAILED,"Failed to start audio for call!"))},o.prototype._getUserMediaFailed=function(e){y(this,"local","user_media_failed",!1),this.emit("error",w(o.ERR_NO_USER_MEDIA,"Couldn't start capturing media! Is your microphone set up and does this app have permission?"))},o.prototype._onIceConnectionStateChanged=function(){"ended"!=this.state&&(S("Ice connection state changed to: "+this.peerConn.iceConnectionState),"completed"==this.peerConn.iceConnectionState||"connected"==this.peerConn.iceConnectionState?(h(this,"connected"),this.didConnect=!0):"failed"==this.peerConn.iceConnectionState&&this.hangup("ice_failed"))},o.prototype._onSignallingStateChanged=function(){S("call "+this.callId+": Signalling state changed to: "+this.peerConn.signalingState)},o.prototype._onSetRemoteDescriptionSuccess=function(){S("Set remote description")},o.prototype._onSetRemoteDescriptionError=function(e){S("Failed to set remote description"+e)},o.prototype._onAddStream=function(e){S("Stream id "+e.stream.id+" added");var t=e.stream;t.getVideoTracks().length>0?(this.type="video",this.remoteAVStream=t,this.remoteAStream=t):(this.type="voice",this.remoteAStream=t);var r=this;A(t,function(e){S("Track id "+e.id+" added"),e.onstarted=C(r,r._onRemoteStreamTrackStarted)}),void 0!==e.stream.oninactive?e.stream.oninactive=C(r,r._onRemoteStreamEnded):e.stream.onended=C(r,r._onRemoteStreamEnded),e.stream.onstarted=C(r,r._onRemoteStreamStarted),"video"===this.type?(g(this),b(this)):b(this)},o.prototype._onRemoteStreamStarted=function(e){h(this,"connected")},o.prototype._onRemoteStreamEnded=function(e){S("Remote stream ended"),this.hangupParty="remote",h(this,"ended"),_(this),"closed"!=this.peerConn.signalingState&&this.peerConn.close(),this.emit("hangup",this)},o.prototype._onRemoteStreamTrackStarted=function(e){h(this,"connected")},o.prototype._onHangupReceived=function(e){S("Hangup received"),y(this,"remote",e.reason,!0)},o.prototype._onAnsweredElsewhere=function(e){S("Answered elsewhere"),y(this,"remote","answered_elsewhere",!0)};var f=function(e,t){for(var r=0;r5)return S("Failed to send candidates on attempt %s. Giving up for now.",t.candidateSendTries),void(t.candidateSendTries=0);var i=500*Math.pow(2,t.candidateSendTries);++t.candidateSendTries,S("Failed to send candidates. Retrying in "+i+"ms"),setTimeout(function(){e(t)},i)})}},T=function(e,t){e.client.callList[e.callId]=e,e.webRtc.getUserMedia(t,C(e,e._maybeGotUserMediaForInvite),C(e,e._maybeGotUserMediaForInvite)),h(e,"wait_local_media"),e.direction="outbound",e.config=t},x=function(e){var t=e.turnServers;if("mozilla"===e.webRtc.vendor){t=[];for(var r=0;r-1)return!0;return!1};var u=i.navigator.getUserMedia||i.navigator.webkitGetUserMedia||i.navigator.mozGetUserMedia;if(u&&(a.getUserMedia=function(){return u.apply(i.navigator,arguments)}),a.RtcPeerConnection=i.RTCPeerConnection||i.webkitRTCPeerConnection||i.mozRTCPeerConnection,a.RtcSessionDescription=i.RTCSessionDescription||i.webkitRTCSessionDescription||i.mozRTCSessionDescription,a.RtcIceCandidate=i.RTCIceCandidate||i.webkitRTCIceCandidate||i.mozRTCIceCandidate,a.vendor=null,i.mozRTCPeerConnection?a.vendor="mozilla":i.webkitRTCPeerConnection?a.vendor="webkit":i.RTCPeerConnection&&(a.vendor="generic"),!(a.RtcIceCandidate&&a.RtcSessionDescription&&a.RtcPeerConnection&&a.getUserMedia))return null;var c=!!n&&n.forceTURN;return new o({webRtc:a,client:e,URL:i.URL,roomId:t,turnServers:e.getTurnServers(),forceTURN:e._forceTURN||c})}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils":55,"babel-runtime/core-js/object/create":64,"babel-runtime/regenerator":86,bluebird:89,events:234}],57:[function(e,t,r){"use strict";function n(e){return a.lastIndex=0,e.replace(a,function(e){return u[e]})}function o(e){switch(typeof e){case"string":return'"'+n(e)+'"';case"number":return isFinite(e)?e:"null";case"boolean":return e;case"object":return null===e?"null":Array.isArray(e)?i(e):s(e);default:throw new Error("Cannot stringify: "+typeof e)}}function i(e){for(var t="[",r="",n=0;n0;)r.push(i%s),i=i/s|0}for(var u="",c=0;0===t[c]&&c=0;--l)u+=e[r[l]];return u}function r(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return n.allocUnsafe(0);for(var t=[0],r=0;r>=8;for(;c>0;)t.push(255&c),c>>=8}for(var l=0;e[l]===a&&l0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function o(e){var t=n(e),r=t[0],o=t[1];return 3*(r+o)/4-o}function i(e,t,r){return 3*(t+r)/4-r}function s(e){for(var t,r=n(e),o=r[0],s=r[1],a=new f(i(e,o,s)),u=0,c=s>0?o-4:o,l=0;l>16&255,a[u++]=t>>8&255,a[u++]=255&t;return 2===s&&(t=d[e.charCodeAt(l)]<<2|d[e.charCodeAt(l+1)]>>4,a[u++]=255&t),1===s&&(t=d[e.charCodeAt(l)]<<10|d[e.charCodeAt(l+1)]<<4|d[e.charCodeAt(l+2)]>>2,a[u++]=t>>8&255,a[u++]=255&t),a}function a(e){return l[e>>18&63]+l[e>>12&63]+l[e>>6&63]+l[63&e]}function u(e,t,r){for(var n,o=[],i=t;is?s:i+16383));return 1===n?(t=e[r-1],o.push(l[t>>2]+l[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],o.push(l[t>>10]+l[t>>4&63]+l[t<<2&63]+"=")),o.join("")}r.byteLength=o,r.toByteArray=s,r.fromByteArray=c;for(var l=[],d=[],f="undefined"!=typeof Uint8Array?Uint8Array:Array,p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,v=p.length;h0;)c(e)}function c(e){var t=e.shift();if("function"!=typeof t)t._settlePromises();else{var r=e.shift(),n=e.shift();t.call(r,n)}}var l;try{throw new Error}catch(e){l=e}var d=t("./schedule"),f=t("./queue"),p=t("./util");o.prototype.setScheduler=function(e){var t=this._schedule;return this._schedule=e,this._customScheduler=!0,t},o.prototype.hasCustomScheduler=function(){return this._customScheduler},o.prototype.enableTrampoline=function(){this._trampolineEnabled=!0},o.prototype.disableTrampolineIfNecessary=function(){p.hasDevTools&&(this._trampolineEnabled=!1)},o.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues},o.prototype.fatalError=function(t,r){r?(e.stderr.write("Fatal "+(t instanceof Error?t.stack:t)+"\n"),e.exit(2)):this.throwLater(t)},o.prototype.throwLater=function(e,t){if(1===arguments.length&&(t=e,e=function(){throw t}),"undefined"!=typeof setTimeout)setTimeout(function(){e(t)},0);else try{this._schedule(function(){e(t)})}catch(e){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")}},p.hasDevTools?(o.prototype.invokeLater=function(e,t,r){this._trampolineEnabled?i.call(this,e,t,r):this._schedule(function(){setTimeout(function(){e.call(t,r)},100)})},o.prototype.invoke=function(e,t,r){this._trampolineEnabled?s.call(this,e,t,r):this._schedule(function(){e.call(t,r)})},o.prototype.settlePromises=function(e){this._trampolineEnabled?a.call(this,e):this._schedule(function(){e._settlePromises()})}):(o.prototype.invokeLater=i,o.prototype.invoke=s,o.prototype.settlePromises=a),o.prototype._drainQueues=function(){u(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,u(this._lateQueue)},o.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},o.prototype._reset=function(){this._isTickUsed=!1},r.exports=o,r.exports.firstLineError=l},{"./queue":26,"./schedule":29,"./util":36}],3:[function(e,t,r){"use strict";t.exports=function(e,t,r,n){var o=!1,i=function(e,t){this._reject(t)},s=function(e,t){t.promiseRejectionQueued=!0,t.bindingPromise._then(i,i,null,this,e)},a=function(e,t){0==(50397184&this._bitField)&&this._resolveCallback(t.target)},u=function(e,t){t.promiseRejectionQueued||this._reject(e)};e.prototype.bind=function(i){o||(o=!0,e.prototype._propagateFrom=n.propagateFromFunction(),e.prototype._boundValue=n.boundValueFunction());var c=r(i),l=new e(t);l._propagateFrom(this,1);var d=this._target();if(l._setBoundTo(c),c instanceof e){var f={promiseRejectionQueued:!1,promise:l,target:d,bindingPromise:c};d._then(t,s,void 0,l,f),c._then(a,u,void 0,l,f),l._setOnCancel(c)}else l._resolveCallback(d);return l},e.prototype._setBoundTo=function(e){void 0!==e?(this._bitField=2097152|this._bitField,this._boundTo=e):this._bitField=-2097153&this._bitField},e.prototype._isBound=function(){return 2097152==(2097152&this._bitField)},e.bind=function(t,r){return e.resolve(r).bind(t)}}},{}],4:[function(e,t,r){"use strict";function n(){try{Promise===i&&(Promise=o)}catch(e){}return i}var o;"undefined"!=typeof Promise&&(o=Promise);var i=e("./promise")();i.noConflict=n,t.exports=i},{"./promise":22}],5:[function(e,t,r){"use strict";var n=Object.create;if(n){var o=n(null),i=n(null);o[" size"]=i[" size"]=0}t.exports=function(t){function r(e,r){var n;if(null!=e&&(n=e[r]),"function"!=typeof n){var o="Object "+a.classString(e)+" has no method '"+a.toString(r)+"'";throw new t.TypeError(o)}return n}function n(e){return r(e,this.pop()).apply(e,this)}function o(e){return e[this]}function i(e){var t=+this;return t<0&&(t=Math.max(0,t+e.length)),e[t]}var s,a=e("./util"),u=a.canEvaluate;a.isIdentifier;t.prototype.call=function(e){var t=[].slice.call(arguments,1);return t.push(e),this._then(n,void 0,void 0,t,void 0)},t.prototype.get=function(e){var t,r="number"==typeof e;if(r)t=i;else if(u){var n=s(e);t=null!==n?n:o}else t=o;return this._then(t,void 0,void 0,e,void 0)}}},{"./util":36}],6:[function(e,t,r){"use strict";t.exports=function(t,r,n,o){var i=e("./util"),s=i.tryCatch,a=i.errorObj,u=t._async;t.prototype.break=t.prototype.cancel=function(){if(!o.cancellation())return this._warn("cancellation is disabled");for(var e=this,t=e;e._isCancellable();){if(!e._cancelBy(t)){t._isFollowing()?t._followee().cancel():t._cancelBranched();break}var r=e._cancellationParent;if(null==r||!r._isCancellable()){e._isFollowing()?e._followee().cancel():e._cancelBranched();break}e._isFollowing()&&e._followee().cancel(),e._setWillBeCancelled(),t=e,e=r}},t.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},t.prototype._enoughBranchesHaveCancelled=function(){return void 0===this._branchesRemainingToCancel||this._branchesRemainingToCancel<=0},t.prototype._cancelBy=function(e){return e===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),!!this._enoughBranchesHaveCancelled()&&(this._invokeOnCancel(),!0))},t.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},t.prototype._cancel=function(){this._isCancellable()&&(this._setCancelled(),u.invoke(this._cancelPromises,this,void 0))},t.prototype._cancelPromises=function(){this._length()>0&&this._settlePromises()},t.prototype._unsetOnCancel=function(){this._onCancelField=void 0},t.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled()},t.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()},t.prototype._doInvokeOnCancel=function(e,t){if(i.isArray(e))for(var r=0;r=0)return i[e]}var o=!1,i=[];return e.prototype._promiseCreated=function(){},e.prototype._pushContext=function(){},e.prototype._popContext=function(){return null},e._peekContext=e.prototype._peekContext=function(){},t.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promiseCreated=null,i.push(this._trace))},t.prototype._popContext=function(){if(void 0!==this._trace){var e=i.pop(),t=e._promiseCreated;return e._promiseCreated=null,t}return null},t.CapturedTrace=null,t.create=r,t.deactivateLongStackTraces=function(){},t.activateLongStackTraces=function(){var r=e.prototype._pushContext,i=e.prototype._popContext,s=e._peekContext,a=e.prototype._peekContext,u=e.prototype._promiseCreated;t.deactivateLongStackTraces=function(){e.prototype._pushContext=r,e.prototype._popContext=i,e._peekContext=s,e.prototype._peekContext=a,e.prototype._promiseCreated=u,o=!1},o=!0,e.prototype._pushContext=t.prototype._pushContext,e.prototype._popContext=t.prototype._popContext,e._peekContext=e.prototype._peekContext=n,e.prototype._promiseCreated=function(){var e=this._peekContext();e&&null==e._promiseCreated&&(e._promiseCreated=this)}},t}},{}],9:[function(t,r,n){"use strict";r.exports=function(r,n){function o(e,t){return{promise:t}}function i(){return!1}function s(e,t,r){var n=this;try{e(t,r,function(e){if("function"!=typeof e)throw new TypeError("onCancel must be a function, got: "+q.toString(e));n._attachCancellationCallback(e)})}catch(e){return e}}function a(e){if(!this._isCancellable())return this;var t=this._onCancel();void 0!==t?q.isArray(t)?t.push(e):this._setOnCancel([t,e]):this._setOnCancel(e)}function u(){return this._onCancelField}function c(e){this._onCancelField=e}function l(){this._cancellationParent=void 0,this._onCancelField=void 0}function d(e,t){if(0!=(1&t)){this._cancellationParent=e;var r=e._branchesRemainingToCancel;void 0===r&&(r=0),e._branchesRemainingToCancel=r+1}0!=(2&t)&&e._isBound()&&this._setBoundTo(e._boundTo)}function f(e,t){0!=(2&t)&&e._isBound()&&this._setBoundTo(e._boundTo)}function p(){var e=this._boundTo;return void 0!==e&&e instanceof r?e.isFulfilled()?e.value():void 0:e}function h(){this._trace=new D(this._peekContext())}function v(e,t){if(K(e)){var r=this._trace;if(void 0!==r&&t&&(r=r._parent),void 0!==r)r.attachExtraTrace(e);else if(!e.__stackCleaned__){var n=T(e);q.notEnumerableProp(e,"stack",n.message+"\n"+n.stack.join("\n")),q.notEnumerableProp(e,"__stackCleaned__",!0)}}}function m(){this._trace=void 0}function y(e,t,r,n,o){if(void 0===e&&null!==t&&X){if(void 0!==o&&o._returnedNonUndefined())return;if(0==(65535&n._bitField))return;r&&(r+=" ");var i="",s="";if(t._trace){for(var a=t._trace.stack.split("\n"),u=S(a),c=u.length-1;c>=0;--c){var l=u[c];if(!$.test(l)){var d=l.match(V);d&&(i="at "+d[1]+":"+d[2]+":"+d[3]+" ");break}}if(u.length>0)for(var f=u[0],c=0;c0&&(s="\n"+a[c-1]);break}}var p="a promise was created in a "+r+"handler "+i+"but was not returned from it, see http://goo.gl/rRqMUw"+s;n._warn(p,!0,t)}}function _(e,t){var r=e+" is deprecated and will be removed in a future version.";return t&&(r+=" Use "+t+" instead."),g(r)}function g(e,t,n){if(ue.warnings){var o,i=new F(e);if(t)n._attachExtraTrace(i);else if(ue.longStackTraces&&(o=r._peekContext()))o.attachExtraTrace(i);else{var s=T(i);i.stack=s.message+"\n"+s.stack.join("\n")}ne("warning",i)||x(i,"",!0)}}function b(e,t){for(var r=0;r=0;--a)if(n[a]===i){s=a;break}for(var a=s;a>=0;--a){var u=n[a];if(t[o]!==u)break;t.pop(),o--}t=n}}function S(e){for(var t=[],r=0;r0&&"SyntaxError"!=e.name&&(t=t.slice(r)),t}function T(e){var t=e.stack,r=e.toString();return t="string"==typeof t&&t.length>0?k(e):[" (No stack trace)"],{message:r,stack:"SyntaxError"==e.name?t:S(t)}}function x(e,t,r){if("undefined"!=typeof console){var n;if(q.isObject(e)){var o=e.stack;n=t+H(o,e)}else n=t+String(e);"function"==typeof L?L(n,r):"function"!=typeof console.log&&"object"!=typeof console.log||console.log(n)}}function R(e,t,r,n){var o=!1;try{"function"==typeof t&&(o=!0,"rejectionHandled"===e?t(n):t(r,n))}catch(e){N.throwLater(e)}"unhandledRejection"===e?ne(e,r,n)||o||x(r,"Unhandled rejection "):ne(e,n)}function I(e){var t;if("function"==typeof e)t="[function "+(e.name||"anonymous")+"]";else{t=e&&"function"==typeof e.toString?e.toString():q.toString(e);if(/\[object [a-zA-Z0-9$_]+\]/.test(t))try{t=JSON.stringify(e)}catch(e){}0===t.length&&(t="(empty array)")}return"(<"+C(t)+">, no stack trace)"}function C(e){return e.length<41?e:e.substr(0,38)+"..."}function j(){return"function"==typeof ae}function O(e){var t=e.match(se);if(t)return{fileName:t[1],line:parseInt(t[2],10)}}function A(e,t){if(j()){for(var r,n,o=e.stack.split("\n"),i=t.stack.split("\n"),s=-1,a=-1,u=0;u=a||(ie=function(e){if(G.test(e))return!0;var t=O(e);return!!(t&&t.fileName===r&&s<=t.line&&t.line<=a)})}}function D(e){this._parent=e,this._promisesCreated=0;var t=this._length=1+(void 0===e?0:e._length);ae(this,D),t>32&&this.uncycle()}var M,P,L,U=r._getDomain,N=r._async,F=t("./errors").Warning,q=t("./util"),B=t("./es5"),K=q.canAttachTrace,G=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,$=/\((?:timers\.js):\d+:\d+\)/,V=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,W=null,H=null,z=!1,Q=!(0==q.env("BLUEBIRD_DEBUG")),J=!(0==q.env("BLUEBIRD_WARNINGS")||!Q&&!q.env("BLUEBIRD_WARNINGS")),Y=!(0==q.env("BLUEBIRD_LONG_STACK_TRACES")||!Q&&!q.env("BLUEBIRD_LONG_STACK_TRACES")),X=0!=q.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&(J||!!q.env("BLUEBIRD_W_FORGOTTEN_RETURN"));r.prototype.suppressUnhandledRejections=function(){var e=this._target();e._bitField=-1048577&e._bitField|524288},r.prototype._ensurePossibleRejectionHandled=function(){if(0==(524288&this._bitField)){this._setRejectionIsUnhandled();var e=this;setTimeout(function(){e._notifyUnhandledRejection()},1)}},r.prototype._notifyUnhandledRejectionIsHandled=function(){R("rejectionHandled",M,void 0,this)},r.prototype._setReturnedNonUndefined=function(){this._bitField=268435456|this._bitField},r.prototype._returnedNonUndefined=function(){return 0!=(268435456&this._bitField)},r.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var e=this._settledValue();this._setUnhandledRejectionIsNotified(),R("unhandledRejection",P,e,this)}},r.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=262144|this._bitField},r.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=-262145&this._bitField},r.prototype._isUnhandledRejectionNotified=function(){return(262144&this._bitField)>0},r.prototype._setRejectionIsUnhandled=function(){this._bitField=1048576|this._bitField},r.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-1048577&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},r.prototype._isRejectionUnhandled=function(){return(1048576&this._bitField)>0},r.prototype._warn=function(e,t,r){return g(e,t,r||this)},r.onPossiblyUnhandledRejection=function(e){var t=U();P="function"==typeof e?null===t?e:q.domainBind(t,e):void 0},r.onUnhandledRejectionHandled=function(e){var t=U();M="function"==typeof e?null===t?e:q.domainBind(t,e):void 0};var Z=function(){};r.longStackTraces=function(){if(N.haveItemsQueued()&&!ue.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");if(!ue.longStackTraces&&j()){var e=r.prototype._captureStackTrace,t=r.prototype._attachExtraTrace,o=r.prototype._dereferenceTrace;ue.longStackTraces=!0,Z=function(){if(N.haveItemsQueued()&&!ue.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");r.prototype._captureStackTrace=e,r.prototype._attachExtraTrace=t,r.prototype._dereferenceTrace=o,n.deactivateLongStackTraces(),N.enableTrampoline(),ue.longStackTraces=!1},r.prototype._captureStackTrace=h,r.prototype._attachExtraTrace=v,r.prototype._dereferenceTrace=m,n.activateLongStackTraces(),N.disableTrampolineIfNecessary()}},r.hasLongStackTraces=function(){return ue.longStackTraces&&j()};var ee=function(){try{if("function"==typeof CustomEvent){var e=new CustomEvent("CustomEvent");return q.global.dispatchEvent(e),function(e,t){var r={detail:t,cancelable:!0};B.defineProperty(r,"promise",{value:t.promise}),B.defineProperty(r,"reason",{value:t.reason});var n=new CustomEvent(e.toLowerCase(),r);return!q.global.dispatchEvent(n)}}if("function"==typeof Event){var e=new Event("CustomEvent");return q.global.dispatchEvent(e),function(e,t){var r=new Event(e.toLowerCase(),{cancelable:!0});return r.detail=t,B.defineProperty(r,"promise",{value:t.promise}),B.defineProperty(r,"reason",{value:t.reason}),!q.global.dispatchEvent(r)}}var e=document.createEvent("CustomEvent");return e.initCustomEvent("testingtheevent",!1,!0,{}),q.global.dispatchEvent(e),function(e,t){var r=document.createEvent("CustomEvent");return r.initCustomEvent(e.toLowerCase(),!1,!0,t),!q.global.dispatchEvent(r)}}catch(e){}return function(){return!1}}(),te=function(){return q.isNode?function(){return e.emit.apply(e,arguments)}:q.global?function(e){var t="on"+e.toLowerCase(),r=q.global[t];return!!r&&(r.apply(q.global,[].slice.call(arguments,1)),!0)}:function(){return!1}}(),re={promiseCreated:o,promiseFulfilled:o,promiseRejected:o,promiseResolved:o,promiseCancelled:o,promiseChained:function(e,t,r){return{promise:t,child:r}},warning:function(e,t){return{warning:t}},unhandledRejection:function(e,t,r){return{reason:t,promise:r}},rejectionHandled:o},ne=function(e){var t=!1;try{t=te.apply(null,arguments)}catch(e){N.throwLater(e),t=!0}var r=!1;try{r=ee(e,re[e].apply(null,arguments))}catch(e){N.throwLater(e),r=!0}return r||t};r.config=function(e){if(e=Object(e),"longStackTraces"in e&&(e.longStackTraces?r.longStackTraces():!e.longStackTraces&&r.hasLongStackTraces()&&Z()),"warnings"in e){var t=e.warnings;ue.warnings=!!t,X=ue.warnings,q.isObject(t)&&"wForgottenReturn"in t&&(X=!!t.wForgottenReturn)}if("cancellation"in e&&e.cancellation&&!ue.cancellation){if(N.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");r.prototype._clearCancellationData=l,r.prototype._propagateFrom=d,r.prototype._onCancel=u,r.prototype._setOnCancel=c,r.prototype._attachCancellationCallback=a,r.prototype._execute=s,oe=d,ue.cancellation=!0}return"monitoring"in e&&(e.monitoring&&!ue.monitoring?(ue.monitoring=!0,r.prototype._fireEvent=ne):!e.monitoring&&ue.monitoring&&(ue.monitoring=!1,r.prototype._fireEvent=i)),r},r.prototype._fireEvent=i,r.prototype._execute=function(e,t,r){try{e(t,r)}catch(e){return e}},r.prototype._onCancel=function(){},r.prototype._setOnCancel=function(e){},r.prototype._attachCancellationCallback=function(e){},r.prototype._captureStackTrace=function(){},r.prototype._attachExtraTrace=function(){},r.prototype._dereferenceTrace=function(){},r.prototype._clearCancellationData=function(){},r.prototype._propagateFrom=function(e,t){};var oe=f,ie=function(){return!1},se=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;q.inherits(D,Error),n.CapturedTrace=D,D.prototype.uncycle=function(){var e=this._length;if(!(e<2)){for(var t=[],r={},n=0,o=this;void 0!==o;++n)t.push(o),o=o._parent;e=this._length=n;for(var n=e-1;n>=0;--n){var i=t[n].stack;void 0===r[i]&&(r[i]=n)}for(var n=0;n0&&(t[a-1]._parent=void 0,t[a-1]._length=1),t[n]._parent=void 0,t[n]._length=1;var u=n>0?t[n-1]:this;a=0;--l)t[l]._length=c,c++;return}}}},D.prototype.attachExtraTrace=function(e){if(!e.__stackCleaned__){this.uncycle();for(var t=T(e),r=t.message,n=[t.stack],o=this;void 0!==o;)n.push(S(o.stack.split("\n"))),o=o._parent;w(n),E(n),q.notEnumerableProp(e,"stack",b(r,n)),q.notEnumerableProp(e,"__stackCleaned__",!0)}};var ae=function(){var e=/^\s*at\s*/,t=function(e,t){return"string"==typeof e?e:void 0!==t.name&&void 0!==t.message?t.toString():I(t)};if("number"==typeof Error.stackTraceLimit&&"function"==typeof Error.captureStackTrace){Error.stackTraceLimit+=6,W=e,H=t;var r=Error.captureStackTrace;return ie=function(e){return G.test(e)},function(e,t){Error.stackTraceLimit+=6,r(e,t),Error.stackTraceLimit-=6}}var n=new Error;if("string"==typeof n.stack&&n.stack.split("\n")[0].indexOf("stackDetection@")>=0)return W=/@/,H=t,z=!0,function(e){e.stack=(new Error).stack};var o;try{throw new Error}catch(e){o="stack"in e}return"stack"in n||!o||"number"!=typeof Error.stackTraceLimit?(H=function(e,t){return"string"==typeof e?e:"object"!=typeof t&&"function"!=typeof t||void 0===t.name||void 0===t.message?I(t):t.toString()},null):(W=e,H=t,function(e){Error.stackTraceLimit+=6;try{throw new Error}catch(t){e.stack=t.stack}Error.stackTraceLimit-=6})}();"undefined"!=typeof console&&void 0!==console.warn&&(L=function(e){console.warn(e)},q.isNode&&e.stderr.isTTY?L=function(e,t){var r=t?"":"";console.warn(r+e+"\n")}:q.isNode||"string"!=typeof(new Error).stack||(L=function(e,t){console.warn("%c"+e,t?"color: darkorange":"color: red")}));var ue={warnings:J,longStackTraces:!1,cancellation:!1,monitoring:!1};return Y&&r.longStackTraces(),{longStackTraces:function(){return ue.longStackTraces},warnings:function(){return ue.warnings},cancellation:function(){return ue.cancellation},monitoring:function(){return ue.monitoring},propagateFromFunction:function(){return oe},boundValueFunction:function(){return p},checkForgottenReturns:y,setBounds:A,warn:g,deprecated:_,CapturedTrace:D,fireDomEvent:ee,fireGlobalEvent:te}}},{"./errors":12,"./es5":13,"./util":36}],10:[function(e,t,r){"use strict";t.exports=function(e){function t(){return this.value}function r(){throw this.reason}e.prototype.return=e.prototype.thenReturn=function(r){return r instanceof e&&r.suppressUnhandledRejections(),this._then(t,void 0,void 0,{value:r},void 0)},e.prototype.throw=e.prototype.thenThrow=function(e){return this._then(r,void 0,void 0,{reason:e},void 0)},e.prototype.catchThrow=function(e){if(arguments.length<=1)return this._then(void 0,r,void 0,{reason:e},void 0);var t=arguments[1],n=function(){throw t};return this.caught(e,n)},e.prototype.catchReturn=function(r){if(arguments.length<=1)return r instanceof e&&r.suppressUnhandledRejections(),this._then(void 0,t,void 0,{value:r},void 0);var n=arguments[1];n instanceof e&&n.suppressUnhandledRejections();var o=function(){return n};return this.caught(r,o)}}},{}],11:[function(e,t,r){"use strict";t.exports=function(e,t){function r(){return i(this)}function n(e,r){return o(e,r,t,t)}var o=e.reduce,i=e.all;e.prototype.each=function(e){return o(this,e,t,0)._then(r,void 0,void 0,this,void 0)},e.prototype.mapSeries=function(e){return o(this,e,t,t)},e.each=function(e,n){return o(e,n,t,0)._then(r,void 0,void 0,e,void 0)},e.mapSeries=n}},{}],12:[function(e,t,r){"use strict";function n(e,t){function r(n){if(!(this instanceof r))return new r(n);d(this,"message","string"==typeof n?n:t),d(this,"name",e),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this)}return l(r,Error),r}function o(e){if(!(this instanceof o))return new o(e);d(this,"name","OperationalError"),d(this,"message",e),this.cause=e,this.isOperational=!0, +e instanceof Error?(d(this,"message",e.message),d(this,"stack",e.stack)):Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}var i,s,a=e("./es5"),u=a.freeze,c=e("./util"),l=c.inherits,d=c.notEnumerableProp,f=n("Warning","warning"),p=n("CancellationError","cancellation error"),h=n("TimeoutError","timeout error"),v=n("AggregateError","aggregate error");try{i=TypeError,s=RangeError}catch(e){i=n("TypeError","type error"),s=n("RangeError","range error")}for(var m="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),y=0;y1?e.cancelPromise._reject(t):e.cancelPromise._cancel(),e.cancelPromise=null,!0)}function a(){return c.call(this,this.promise._target()._settledValue())}function u(e){if(!s(this,e))return f.e=e,f}function c(e){var o=this.promise,c=this.handler;if(!this.called){this.called=!0;var l=this.isFinallyHandler()?c.call(o._boundValue()):c.call(o._boundValue(),e);if(l===n)return l;if(void 0!==l){o._setReturnedNonUndefined();var p=r(l,o);if(p instanceof t){if(null!=this.cancelPromise){if(p._isCancelled()){var h=new d("late cancellation observer");return o._attachExtraTrace(h),f.e=h,f}p.isPending()&&p._attachCancellationCallback(new i(this))}return p._then(a,u,void 0,this,void 0)}}}return o.isRejected()?(s(this),f.e=e,f):(s(this),e)}var l=e("./util"),d=t.CancellationError,f=l.errorObj,p=e("./catch_filter")(n);return o.prototype.isFinallyHandler=function(){return 0===this.type},i.prototype._resultCancelled=function(){s(this.finallyHandler)},t.prototype._passThrough=function(e,t,r,n){return"function"!=typeof e?this.then():this._then(r,n,void 0,new o(this,t,e),void 0)},t.prototype.lastly=t.prototype.finally=function(e){return this._passThrough(e,0,c,c)},t.prototype.tap=function(e){return this._passThrough(e,1,c)},t.prototype.tapCatch=function(e){var r=arguments.length;if(1===r)return this._passThrough(e,1,void 0,c);var n,o=new Array(r-1),i=0;for(n=0;n0&&"function"==typeof arguments[t]){e=arguments[t];var n}var o=[].slice.call(arguments);e&&o.pop();var n=new r(o).promise();return void 0!==e?n.spread(e):n}}},{"./util":36}],18:[function(e,t,r){"use strict";t.exports=function(t,r,n,o,i,s){function a(e,t,r,n){this.constructor$(e),this._promise._captureStackTrace();var o=c();this._callback=null===o?t:l.domainBind(o,t),this._preservedValues=n===i?new Array(this.length()):null,this._limit=r,this._inFlight=0,this._queue=[],p.invoke(this._asyncInit,this,void 0)}function u(e,r,o,i){if("function"!=typeof r)return n("expecting a function but got "+l.classString(r));var s=0;if(void 0!==o){if("object"!=typeof o||null===o)return t.reject(new TypeError("options argument must be an object but it is "+l.classString(o)));if("number"!=typeof o.concurrency)return t.reject(new TypeError("'concurrency' must be a number but it is "+l.classString(o.concurrency)));s=o.concurrency}return s="number"==typeof s&&isFinite(s)&&s>=1?s:0,new a(e,r,s,i).promise()}var c=t._getDomain,l=e("./util"),d=l.tryCatch,f=l.errorObj,p=t._async;l.inherits(a,r),a.prototype._asyncInit=function(){this._init$(void 0,-2)},a.prototype._init=function(){},a.prototype._promiseFulfilled=function(e,r){var n=this._values,i=this.length(),a=this._preservedValues,u=this._limit;if(r<0){if(r=-1*r-1,n[r]=e,u>=1&&(this._inFlight--,this._drainQueue(),this._isResolved()))return!0}else{if(u>=1&&this._inFlight>=u)return n[r]=e,this._queue.push(r),!1;null!==a&&(a[r]=e);var c=this._promise,l=this._callback,p=c._boundValue();c._pushContext();var h=d(l).call(p,e,r,i),v=c._popContext();if(s.checkForgottenReturns(h,v,null!==a?"Promise.filter":"Promise.map",c),h===f)return this._reject(h.e),!0;var m=o(h,this._promise);if(m instanceof t){m=m._target();var y=m._bitField;if(0==(50397184&y))return u>=1&&this._inFlight++,n[r]=m,m._proxy(this,-1*(r+1)),!1;if(0==(33554432&y))return 0!=(16777216&y)?(this._reject(m._reason()),!0):(this._cancel(),!0);h=m._value()}n[r]=h}return++this._totalResolved>=i&&(null!==a?this._filter(n,a):this._resolve(n),!0)},a.prototype._drainQueue=function(){for(var e=this._queue,t=this._limit,r=this._values;e.length>0&&this._inFlight1){i.deprecated("calling Promise.try with more than 1 argument");var c=arguments[1],l=arguments[2];u=s.isArray(c)?a(e).apply(l,c):a(e).call(l,c)}else u=a(e)();var d=n._popContext();return i.checkForgottenReturns(u,d,"Promise.try",n),n._resolveFromSyncValue(u),n},t.prototype._resolveFromSyncValue=function(e){e===s.errorObj?this._rejectCallback(e.e,!1):this._resolveCallback(e,!0)}}},{"./util":36}],20:[function(e,t,r){"use strict";function n(e){return e instanceof Error&&l.getPrototypeOf(e)===Error.prototype}function o(e){var t;if(n(e)){t=new c(e),t.name=e.name,t.message=e.message,t.stack=e.stack;for(var r=l.keys(e),o=0;o1){var r,n=new Array(t-1),o=0;for(r=0;r0&&"function"!=typeof e&&"function"!=typeof t){var r=".then() only accepts functions but was passed: "+h.classString(e);arguments.length>1&&(r+=", "+h.classString(t)),this._warn(r)}return this._then(e,t,void 0,void 0,void 0)},i.prototype.done=function(e,t){this._then(e,t,void 0,void 0,void 0)._setIsFinal()},i.prototype.spread=function(e){return"function"!=typeof e?f("expecting a function but got "+h.classString(e)):this.all()._then(e,void 0,void 0,w,void 0)},i.prototype.toJSON=function(){var e={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(e.fulfillmentValue=this.value(),e.isFulfilled=!0):this.isRejected()&&(e.rejectionReason=this.reason(),e.isRejected=!0),e},i.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new T(this).promise()},i.prototype.error=function(e){return this.caught(h.originatesFromRejection,e)},i.getNewLibraryCopy=r.exports,i.is=function(e){return e instanceof i},i.fromNode=i.fromCallback=function(e){var t=new i(E);t._captureStackTrace();var r=arguments.length>1&&!!Object(arguments[1]).multiArgs,n=D(e)(O(t,r));return n===A&&t._rejectCallback(n.e,!0),t._isFateSealed()||t._setAsyncGuaranteed(),t},i.all=function(e){return new T(e).promise()},i.cast=function(e){var t=k(e);return t instanceof i||(t=new i(E),t._captureStackTrace(),t._setFulfilled(),t._rejectionHandler0=e),t},i.resolve=i.fulfilled=i.cast,i.reject=i.rejected=function(e){var t=new i(E);return t._captureStackTrace(),t._rejectCallback(e,!0),t},i.setScheduler=function(e){if("function"!=typeof e)throw new g("expecting a function but got "+h.classString(e));return y.setScheduler(e)},i.prototype._then=function(e,t,r,n,o){var s=void 0!==o,a=s?o:new i(E),u=this._target(),l=u._bitField;s||(a._propagateFrom(this,3),a._captureStackTrace(),void 0===n&&0!=(2097152&this._bitField)&&(n=0!=(50397184&l)?this._boundValue():u===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,a));var d=c();if(0!=(50397184&l)){var f,p,v=u._settlePromiseCtx;0!=(33554432&l)?(p=u._rejectionHandler0,f=e):0!=(16777216&l)?(p=u._fulfillmentHandler0,f=t,u._unsetRejectionIsUnhandled()):(v=u._settlePromiseLateCancellationObserver,p=new b("late cancellation observer"),u._attachExtraTrace(p),f=t),y.invoke(v,u,{handler:null===d?f:"function"==typeof f&&h.domainBind(d,f),promise:a,receiver:n,value:p})}else u._addCallbacks(e,t,a,n,d);return a},i.prototype._length=function(){return 65535&this._bitField},i.prototype._isFateSealed=function(){return 0!=(117506048&this._bitField)},i.prototype._isFollowing=function(){return 67108864==(67108864&this._bitField)},i.prototype._setLength=function(e){this._bitField=-65536&this._bitField|65535&e},i.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField,this._fireEvent("promiseFulfilled",this)},i.prototype._setRejected=function(){this._bitField=16777216|this._bitField,this._fireEvent("promiseRejected",this)},i.prototype._setFollowing=function(){this._bitField=67108864|this._bitField,this._fireEvent("promiseResolved",this)},i.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},i.prototype._isFinal=function(){return(4194304&this._bitField)>0},i.prototype._unsetCancelled=function(){this._bitField=-65537&this._bitField},i.prototype._setCancelled=function(){this._bitField=65536|this._bitField,this._fireEvent("promiseCancelled",this)},i.prototype._setWillBeCancelled=function(){this._bitField=8388608|this._bitField},i.prototype._setAsyncGuaranteed=function(){y.hasCustomScheduler()||(this._bitField=134217728|this._bitField)},i.prototype._receiverAt=function(e){var t=0===e?this._receiver0:this[4*e-4+3];if(t!==p)return void 0===t&&this._isBound()?this._boundValue():t},i.prototype._promiseAt=function(e){return this[4*e-4+2]},i.prototype._fulfillmentHandlerAt=function(e){return this[4*e-4+0]},i.prototype._rejectionHandlerAt=function(e){return this[4*e-4+1]},i.prototype._boundValue=function(){},i.prototype._migrateCallback0=function(e){var t=(e._bitField,e._fulfillmentHandler0),r=e._rejectionHandler0,n=e._promise0,o=e._receiverAt(0);void 0===o&&(o=p),this._addCallbacks(t,r,n,o,null)},i.prototype._migrateCallbackAt=function(e,t){var r=e._fulfillmentHandlerAt(t),n=e._rejectionHandlerAt(t),o=e._promiseAt(t),i=e._receiverAt(t);void 0===i&&(i=p),this._addCallbacks(r,n,o,i,null)},i.prototype._addCallbacks=function(e,t,r,n,o){var i=this._length();if(i>=65531&&(i=0,this._setLength(0)),0===i)this._promise0=r,this._receiver0=n,"function"==typeof e&&(this._fulfillmentHandler0=null===o?e:h.domainBind(o,e)),"function"==typeof t&&(this._rejectionHandler0=null===o?t:h.domainBind(o,t));else{var s=4*i-4;this[s+2]=r,this[s+3]=n,"function"==typeof e&&(this[s+0]=null===o?e:h.domainBind(o,e)),"function"==typeof t&&(this[s+1]=null===o?t:h.domainBind(o,t))}return this._setLength(i+1),i},i.prototype._proxy=function(e,t){this._addCallbacks(void 0,void 0,t,e,null)},i.prototype._resolveCallback=function(e,t){if(0==(117506048&this._bitField)){if(e===this)return this._rejectCallback(l(),!1);var r=k(e,this);if(!(r instanceof i))return this._fulfill(e);t&&this._propagateFrom(r,2);var n=r._target();if(n===this)return void this._reject(l());var o=n._bitField;if(0==(50397184&o)){var s=this._length();s>0&&n._migrateCallback0(this);for(var a=1;a>>16)){if(e===this){var r=l();return this._attachExtraTrace(r),this._reject(r)}this._setFulfilled(),this._rejectionHandler0=e,(65535&t)>0&&(0!=(134217728&t)?this._settlePromises():y.settlePromises(this),this._dereferenceTrace())}},i.prototype._reject=function(e){var t=this._bitField;if(!((117506048&t)>>>16)){if(this._setRejected(),this._fulfillmentHandler0=e,this._isFinal())return y.fatalError(e,h.isNode);(65535&t)>0?y.settlePromises(this):this._ensurePossibleRejectionHandled()}},i.prototype._fulfillPromises=function(e,t){for(var r=1;r0){if(0!=(16842752&e)){var r=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,r,e),this._rejectPromises(t,r)}else{var n=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,n,e),this._fulfillPromises(t,n)}this._setLength(0)}this._clearCancellationData()},i.prototype._settledValue=function(){var e=this._bitField;return 0!=(33554432&e)?this._rejectionHandler0:0!=(16777216&e)?this._fulfillmentHandler0:void 0},i.defer=i.pending=function(){return I.deprecated("Promise.defer","new Promise"),{promise:new i(E),resolve:s,reject:a}},h.notEnumerableProp(i,"_makeSelfResolutionError",l),t("./method")(i,E,k,f,I),t("./bind")(i,E,k,I),t("./cancel")(i,T,f,I),t("./direct_resolve")(i),t("./synchronous_inspection")(i),t("./join")(i,T,k,E,y,c),i.Promise=i,i.version="3.5.3",t("./map.js")(i,T,f,k,E,I),t("./call_get.js")(i),t("./using.js")(i,f,k,R,E,I),t("./timers.js")(i,E,I),t("./generators.js")(i,f,E,k,n,I),t("./nodeify.js")(i),t("./promisify.js")(i,E),t("./props.js")(i,T,k,f),t("./race.js")(i,E,k,f),t("./reduce.js")(i,T,f,k,E,I),t("./settle.js")(i,T,I),t("./some.js")(i,T,f),t("./filter.js")(i,E),t("./each.js")(i,E),t("./any.js")(i),h.toFastProperties(i),h.toFastProperties(i.prototype),u({a:1}),u({b:2}),u({c:3}),u(1),u(function(){}),u(void 0),u(!1),u(new i(E)),I.setBounds(m.firstLineError,h.lastLineError),i}},{"./any.js":1,"./async":2,"./bind":3,"./call_get.js":5,"./cancel":6,"./catch_filter":7,"./context":8,"./debuggability":9,"./direct_resolve":10,"./each.js":11,"./errors":12,"./es5":13,"./filter.js":14,"./finally":15,"./generators.js":16,"./join":17,"./map.js":18,"./method":19,"./nodeback":20,"./nodeify.js":21,"./promise_array":23,"./promisify.js":24,"./props.js":25,"./race.js":27,"./reduce.js":28,"./settle.js":30,"./some.js":31,"./synchronous_inspection":32,"./thenables":33,"./timers.js":34,"./using.js":35,"./util":36}],23:[function(e,t,r){"use strict";t.exports=function(t,r,n,o,i){function s(e){switch(e){case-2:return[];case-3:return{};case-6:return new Map}}function a(e){var n=this._promise=new t(r);e instanceof t&&n._propagateFrom(e,3),n._setOnCancel(this),this._values=e,this._length=0,this._totalResolved=0,this._init(void 0,-2)}var u=e("./util");u.isArray;return u.inherits(a,i),a.prototype.length=function(){return this._length},a.prototype.promise=function(){return this._promise},a.prototype._init=function e(r,i){var a=n(this._values,this._promise);if(a instanceof t){a=a._target();var c=a._bitField;if(this._values=a,0==(50397184&c))return this._promise._setAsyncGuaranteed(),a._then(e,this._reject,void 0,this,i);if(0==(33554432&c))return 0!=(16777216&c)?this._reject(a._reason()):this._cancel();a=a._value()}if(null===(a=u.asArray(a))){var l=o("expecting an array or an iterable object but got "+u.classString(a)).reason();return void this._promise._rejectCallback(l,!1)}if(0===a.length)return void(-5===i?this._resolveEmptyArray():this._resolve(s(i)));this._iterate(a)},a.prototype._iterate=function(e){var r=this.getActualLength(e.length);this._length=r,this._values=this.shouldCopyValues()?new Array(r):this._values;for(var o=this._promise,i=!1,s=null,a=0;a=this._length&&(this._resolve(this._values),!0)},a.prototype._promiseCancelled=function(){return this._cancel(),!0},a.prototype._promiseRejected=function(e){return this._totalResolved++,this._reject(e),!0},a.prototype._resultCancelled=function(){if(!this._isResolved()){var e=this._values;if(this._cancel(),e instanceof t)e.cancel();else for(var r=0;r=this._length){var r;if(this._isMap)r=f(this._values);else{r={};for(var n=this.length(),o=0,i=this.length();o>1},t.prototype.props=function(){return s(this)},t.props=function(e){return s(e)}}},{"./es5":13,"./util":36}],26:[function(e,t,r){"use strict";function n(e,t,r,n,o){for(var i=0;i=this._length&&(this._resolve(this._values),!0)},o.prototype._promiseFulfilled=function(e,t){var r=new i;return r._bitField=33554432,r._settledValueField=e,this._promiseResolved(t,r)},o.prototype._promiseRejected=function(e,t){var r=new i;return r._bitField=16777216,r._settledValueField=e,this._promiseResolved(t,r)},t.settle=function(e){return n.deprecated(".settle()",".reflect()"),new o(e).promise()},t.prototype.settle=function(){return t.settle(this)}}},{"./util":36}],31:[function(e,t,r){"use strict";t.exports=function(t,r,n){function o(e){this.constructor$(e),this._howMany=0,this._unwrap=!1,this._initialized=!1}function i(e,t){if((0|t)!==t||t<0)return n("expecting a positive integer\n\n See http://goo.gl/MqrFmX\n");var r=new o(e),i=r.promise();return r.setHowMany(t),r.init(),i}var s=e("./util"),a=e("./errors").RangeError,u=e("./errors").AggregateError,c=s.isArray,l={};s.inherits(o,r),o.prototype._init=function(){if(this._initialized){if(0===this._howMany)return void this._resolve([]);this._init$(void 0,-5);var e=c(this._values);!this._isResolved()&&e&&this._howMany>this._canPossiblyFulfill()&&this._reject(this._getRangeError(this.length()))}},o.prototype.init=function(){this._initialized=!0,this._init()},o.prototype.setUnwrap=function(){this._unwrap=!0},o.prototype.howMany=function(){return this._howMany},o.prototype.setHowMany=function(e){this._howMany=e},o.prototype._promiseFulfilled=function(e){return this._addFulfilled(e),this._fulfilled()===this.howMany()&&(this._values.length=this.howMany(),1===this.howMany()&&this._unwrap?this._resolve(this._values[0]):this._resolve(this._values),!0)},o.prototype._promiseRejected=function(e){return this._addRejected(e),this._checkOutcome()},o.prototype._promiseCancelled=function(){return this._values instanceof t||null==this._values?this._cancel():(this._addRejected(l),this._checkOutcome())},o.prototype._checkOutcome=function(){if(this.howMany()>this._canPossiblyFulfill()){for(var e=new u,t=this.length();t0?this._reject(e):this._cancel(),!0}return!1},o.prototype._fulfilled=function(){return this._totalResolved},o.prototype._rejected=function(){return this._values.length-this.length()},o.prototype._addRejected=function(e){this._values.push(e)},o.prototype._addFulfilled=function(e){this._values[this._totalResolved++]=e},o.prototype._canPossiblyFulfill=function(){return this.length()-this._rejected()},o.prototype._getRangeError=function(e){var t="Input array must contain at least "+this._howMany+" items but contains only "+e+" items";return new a(t)},o.prototype._resolveEmptyArray=function(){this._reject(this._getRangeError(0))},t.some=function(e,t){return i(e,t)},t.prototype.some=function(e){return i(this,e)},t._SomePromiseArray=o}},{"./errors":12,"./util":36}],32:[function(e,t,r){"use strict";t.exports=function(e){function t(e){void 0!==e?(e=e._target(),this._bitField=e._bitField,this._settledValueField=e._isFateSealed()?e._settledValue():void 0):(this._bitField=0,this._settledValueField=void 0)}t.prototype._settledValue=function(){return this._settledValueField};var r=t.prototype.value=function(){if(!this.isFulfilled())throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},n=t.prototype.error=t.prototype.reason=function(){if(!this.isRejected())throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},o=t.prototype.isFulfilled=function(){return 0!=(33554432&this._bitField)},i=t.prototype.isRejected=function(){return 0!=(16777216&this._bitField)},s=t.prototype.isPending=function(){return 0==(50397184&this._bitField)},a=t.prototype.isResolved=function(){return 0!=(50331648&this._bitField)};t.prototype.isCancelled=function(){return 0!=(8454144&this._bitField)},e.prototype.__isCancelled=function(){return 65536==(65536&this._bitField)},e.prototype._isCancelled=function(){return this._target().__isCancelled()},e.prototype.isCancelled=function(){return 0!=(8454144&this._target()._bitField)},e.prototype.isPending=function(){return s.call(this._target())},e.prototype.isRejected=function(){return i.call(this._target())},e.prototype.isFulfilled=function(){return o.call(this._target())},e.prototype.isResolved=function(){return a.call(this._target())},e.prototype.value=function(){return r.call(this._target())},e.prototype.reason=function(){var e=this._target();return e._unsetRejectionIsUnhandled(),n.call(e)},e.prototype._value=function(){return this._settledValue()},e.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},e.PromiseInspection=t}},{}],33:[function(e,t,r){"use strict";t.exports=function(t,r){function n(e,n){if(l(e)){if(e instanceof t)return e;var o=i(e);if(o===c){n&&n._pushContext();var u=t.reject(o.e);return n&&n._popContext(),u}if("function"==typeof o){if(s(e)){var u=new t(r);return e._then(u._fulfill,u._reject,void 0,u,null),u}return a(e,o,n)}}return e}function o(e){return e.then}function i(e){try{return o(e)}catch(e){return c.e=e,c}}function s(e){try{return d.call(e,"_promise0")}catch(e){return!1}}function a(e,n,o){function i(e){a&&(a._resolveCallback(e),a=null)}function s(e){a&&(a._rejectCallback(e,d,!0),a=null)}var a=new t(r),l=a;o&&o._pushContext(),a._captureStackTrace(),o&&o._popContext();var d=!0,f=u.tryCatch(n).call(e,i,s);return d=!1,a&&f===c&&(a._rejectCallback(f.e,!0,!0),a=null),l}var u=e("./util"),c=u.errorObj,l=u.isObject,d={}.hasOwnProperty;return n}},{"./util":36}],34:[function(e,t,r){"use strict";t.exports=function(t,r,n){function o(e){this.handle=e}function i(e){return clearTimeout(this.handle),e}function s(e){throw clearTimeout(this.handle),e}var a=e("./util"),u=t.TimeoutError;o.prototype._resultCancelled=function(){clearTimeout(this.handle)};var c=function(e){return l(+this).thenReturn(e)},l=t.delay=function(e,i){var s,a;return void 0!==i?(s=t.resolve(i)._then(c,null,null,e,void 0),n.cancellation()&&i instanceof t&&s._setOnCancel(i)):(s=new t(r),a=setTimeout(function(){s._fulfill()},+e),n.cancellation()&&s._setOnCancel(new o(a)),s._captureStackTrace()),s._setAsyncGuaranteed(),s};t.prototype.delay=function(e){return l(e,this)};var d=function(e,t,r){var n;n="string"!=typeof t?t instanceof Error?t:new u("operation timed out"):new u(t),a.markAsOriginatingFromRejection(n),e._attachExtraTrace(n),e._reject(n),null!=r&&r.cancel()};t.prototype.timeout=function(e,t){e=+e;var r,a,u=new o(setTimeout(function(){r.isPending()&&d(r,t,a)},e));return n.cancellation()?(a=this.then(),r=a._then(i,s,void 0,u,void 0),r._setOnCancel(u)):r=this._then(i,s,void 0,u,void 0),r}}},{"./util":36}],35:[function(e,t,r){"use strict";t.exports=function(t,r,n,o,i,s){function a(e){setTimeout(function(){throw e},0)}function u(e){var t=n(e);return t!==e&&"function"==typeof e._isDisposable&&"function"==typeof e._getDisposer&&e._isDisposable()&&t._setDisposable(e._getDisposer()),t}function c(e,r){function o(){if(s>=c)return l._fulfill();var i=u(e[s++]);if(i instanceof t&&i._isDisposable()){try{i=n(i._getDisposer().tryDispose(r),e.promise)}catch(e){return a(e)}if(i instanceof t)return i._then(o,a,null,null,null)}o()}var s=0,c=e.length,l=new t(i);return o(),l}function l(e,t,r){this._data=e,this._promise=t,this._context=r}function d(e,t,r){this.constructor$(e,t,r)}function f(e){return l.isDisposer(e)?(this.resources[this.index]._setDisposable(e),e.promise()):e}function p(e){this.length=e,this.promise=null,this[e-1]=null}var h=e("./util"),v=e("./errors").TypeError,m=e("./util").inherits,y=h.errorObj,_=h.tryCatch,g={};l.prototype.data=function(){return this._data},l.prototype.promise=function(){return this._promise},l.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():g},l.prototype.tryDispose=function(e){var t=this.resource(),r=this._context;void 0!==r&&r._pushContext();var n=t!==g?this.doDispose(t,e):null;return void 0!==r&&r._popContext(),this._promise._unsetDisposable(),this._data=null,n},l.isDisposer=function(e){return null!=e&&"function"==typeof e.resource&&"function"==typeof e.tryDispose},m(d,l),d.prototype.doDispose=function(e,t){return this.data().call(e,e,t)},p.prototype._resultCancelled=function(){for(var e=this.length,r=0;r0},t.prototype._getDisposer=function(){return this._disposer},t.prototype._unsetDisposable=function(){this._bitField=-131073&this._bitField,this._disposer=void 0},t.prototype.disposer=function(e){if("function"==typeof e)return new d(e,this,o());throw new v}}},{"./errors":12,"./util":36}],36:[function(t,r,o){"use strict";function i(){try{var e=O;return O=null,e.apply(this,arguments)}catch(e){return j.e=e,j}}function s(e){return O=e,i}function a(e){return null==e||!0===e||!1===e||"string"==typeof e||"number"==typeof e}function u(e){return"function"==typeof e||"object"==typeof e&&null!==e}function c(e){return a(e)?new Error(_(e)):e}function l(e,t){var r,n=e.length,o=new Array(n+1);for(r=0;r1,n=t.length>0&&!(1===t.length&&"constructor"===t[0]),o=P.test(e+"")&&I.names(e).length>0;if(r||n||o)return!0}return!1}catch(e){return!1}}function v(e){function t(){}function r(){return typeof n.foo}t.prototype=e;var n=new t;return r(),r(),e}function m(e){return L.test(e)}function y(e,t,r){for(var n=new Array(e),o=0;o10||t[0]>0}(),K.isNode&&K.toFastProperties(e);try{throw new Error}catch(e){K.lastLineError=e}r.exports=K},{"./es5":13}]},{},[4])(4)}),"undefined"!=typeof window&&null!==window?window.P=window.Promise:"undefined"!=typeof self&&null!==self&&(self.P=self.Promise)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("timers").setImmediate)},{_process:237,timers:249}],90:[function(e,t,r){!function(e,n){"function"==typeof define&&define.amd?define([],n):"object"==typeof r?t.exports=n():e.returnExports=n()}(this,function(){function e(o,i){if("function"!=typeof i)throw new Error("Bad callback given: "+i);if(!o)throw new Error("No options given");var a=o.onResponse;if(o="string"==typeof o?{uri:o}:JSON.parse(JSON.stringify(o)),o.onResponse=a,o.verbose&&(e.log=n()),o.url&&(o.uri=o.url,delete o.url),!o.uri&&""!==o.uri)throw new Error("options.uri is a required argument");if("string"!=typeof o.uri)throw new Error("options.uri must be a string");for(var u=["proxy","_redirectsFollowed","maxRedirects","followRedirect"],c=0;c>18&63,i=u>>12&63,s=u>>6&63,a=63&u,p[d++]=c.charAt(o)+c.charAt(i)+c.charAt(s)+c.charAt(a)}while(l299)&&r.error){e=new Error("CouchDB error: "+(r.error.reason||r.error.error));for(var o in r)e[o]=r[o];return n(e,t,r)}return n(e,t,r)}return"string"==typeof t&&(t={uri:t}),t.json=!0,t.body&&(t.json=t.body),delete t.body,n=n||r,e(t,o)},e})},{}],91:[function(e,t,r){(function(e){!function(n){function o(e){throw new RangeError(D[e])}function i(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function s(e,t){var r=e.split("@"),n="";return r.length>1&&(n=r[0]+"@",e=r[1]),e=e.replace(A,"."),n+i(e.split("."),t).join(".")}function a(e){for(var t,r,n=[],o=0,i=e.length;o=55296&&t<=56319&&o65535&&(e-=65536,t+=L(e>>>10&1023|55296),e=56320|1023&e),t+=L(e)}).join("")}function c(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:w}function l(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function d(e,t,r){var n=0;for(e=r?P(e/x):e>>1,e+=P(e/t);e>M*k>>1;n+=w)e=P(e/M);return P(n+(M+1)*e/(e+T))}function f(e){var t,r,n,i,s,a,l,f,p,h,v=[],m=e.length,y=0,_=I,g=R;for(r=e.lastIndexOf(C),r<0&&(r=0),n=0;n=128&&o("not-basic"),v.push(e.charCodeAt(n));for(i=r>0?r+1:0;i=m&&o("invalid-input"),f=c(e.charCodeAt(i++)),(f>=w||f>P((E-y)/a))&&o("overflow"),y+=f*a,p=l<=g?S:l>=g+k?k:l-g,!(fP(E/h)&&o("overflow"),a*=h;t=v.length+1,g=d(y-s,t,0==s),P(y/t)>E-_&&o("overflow"),_+=P(y/t),y%=t,v.splice(y++,0,_)}return u(v)}function p(e){var t,r,n,i,s,u,c,f,p,h,v,m,y,_,g,b=[];for(e=a(e),m=e.length,t=I,r=0,s=R,u=0;u=t&&vP((E-r)/y)&&o("overflow"),r+=(c-t)*y,t=c,u=0;uE&&o("overflow"),v==t){for(f=r,p=w;h=p<=s?S:p>=s+k?k:p-s,!(f= 0x80 (not a basic code point)","invalid-input":"Invalid input"},M=w-S,P=Math.floor,L=String.fromCharCode;if(g={version:"1.4.1",ucs2:{decode:a,encode:u},decode:f,encode:p,toASCII:v,toUnicode:h},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return g});else if(m&&y)if(t.exports==m)y.exports=g;else for(b in g)g.hasOwnProperty(b)&&(m[b]=g[b]);else n.punycode=g}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],92:[function(e,t,r){var n=e("base-x");t.exports=n("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},{"base-x":87}],93:[function(e,t,r){"use strict";function n(e){if(e>Q)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return t.__proto__=o.prototype,t}function o(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return u(e)}return i(e,t,r)}function i(e,t,r){if("string"==typeof e)return c(e,t);if(ArrayBuffer.isView(e))return l(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(V(e,ArrayBuffer)||e&&V(e.buffer,ArrayBuffer))return d(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return o.from(n,t,r);var i=f(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.from(e[Symbol.toPrimitive]("string"),t,r) +;throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function s(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function a(e,t,r){return s(e),e<=0?n(e):void 0!==t?"string"==typeof r?n(e).fill(t,r):n(e).fill(t):n(e)}function u(e){return s(e),n(e<0?0:0|p(e))}function c(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!o.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|v(e,t),i=n(r),s=i.write(e,t);return s!==r&&(i=i.slice(0,s)),i}function l(e){for(var t=e.length<0?0:0|p(e.length),r=n(t),o=0;o=Q)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Q.toString(16)+" bytes");return 0|e}function h(e){return+e!=e&&(e=0),o.alloc(+e)}function v(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||V(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return q(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return G(e).length;default:if(i)return n?-1:q(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,t>>>=0,r<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return O(this,t,r);case"utf8":case"utf-8":return R(this,t,r);case"ascii":return C(this,t,r);case"latin1":case"binary":return j(this,t,r);case"base64":return x(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function y(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function _(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,W(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=o.from(t,n)),o.isBuffer(t))return 0===t.length?-1:g(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):g(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function g(e,t,r,n,o){function i(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}var s=1,a=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,r/=2}var c;if(o){var l=-1;for(c=r;ca&&(r=a-u),c=r;c>=0;c--){for(var d=!0,f=0;fo&&(n=o):n=o;var i=t.length;n>i/2&&(n=i/2);for(var s=0;s239?4:i>223?3:i>191?2:1;if(o+a<=r){var u,c,l,d;switch(a){case 1:i<128&&(s=i);break;case 2:u=e[o+1],128==(192&u)&&(d=(31&i)<<6|63&u)>127&&(s=d);break;case 3:u=e[o+1],c=e[o+2],128==(192&u)&&128==(192&c)&&(d=(15&i)<<12|(63&u)<<6|63&c)>2047&&(d<55296||d>57343)&&(s=d);break;case 4:u=e[o+1],c=e[o+2],l=e[o+3],128==(192&u)&&128==(192&c)&&128==(192&l)&&(d=(15&i)<<18|(63&u)<<12|(63&c)<<6|63&l)>65535&&d<1114112&&(s=d)}}null===s?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),o+=a}return I(n)}function I(e){var t=e.length;if(t<=J)return String.fromCharCode.apply(String,e);for(var r="",n=0;nn)&&(r=n);for(var o="",i=t;ir)throw new RangeError("Trying to access beyond buffer length")}function M(e,t,r,n,i,s){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function P(e,t,r,n,o,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(e,t,r,n,o){return t=+t,r>>>=0,o||P(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38),z.write(e,t,r,n,23,4),r+4}function U(e,t,r,n,o){return t=+t,r>>>=0,o||P(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308),z.write(e,t,r,n,52,8),r+8}function N(e){if(e=e.split("=")[0],e=e.trim().replace(Y,""),e.length<2)return"";for(;e.length%4!=0;)e+="=";return e}function F(e){return e<16?"0"+e.toString(16):e.toString(16)}function q(e,t){t=t||1/0;for(var r,n=e.length,o=null,i=[],s=0;s55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function B(e){for(var t=[],r=0;r>8,o=r%256,i.push(o),i.push(n);return i}function G(e){return H.toByteArray(N(e))}function $(e,t,r,n){for(var o=0;o=t.length||o>=e.length);++o)t[o+r]=e[o];return o}function V(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function W(e){return e!==e}var H=e("base64-js"),z=e("ieee754");r.Buffer=o,r.SlowBuffer=h,r.INSPECT_MAX_BYTES=50;var Q=2147483647;r.kMaxLength=Q,o.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return!1}}(),o.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),o.poolSize=8192,o.from=function(e,t,r){return i(e,t,r)},o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,o.alloc=function(e,t,r){return a(e,t,r)},o.allocUnsafe=function(e){return u(e)},o.allocUnsafeSlow=function(e){return u(e)},o.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==o.prototype},o.compare=function(e,t){if(V(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),V(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,i=0,s=Math.min(r,n);it&&(e+=" ... "),""},o.prototype.compare=function(e,t,r,n,i){if(V(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var s=i-n,a=r-t,u=Math.min(s,a),c=this.slice(n,i),l=e.slice(t,r),d=0;d>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-t;if((void 0===r||r>o)&&(r=o),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return E(this,e,t,r);case"ascii":return w(this,e,t,r);case"latin1":case"binary":return S(this,e,t,r);case"base64":return k(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var J=4096;o.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||D(e,t,this.length);for(var n=this[e],o=1,i=0;++i>>=0,t>>>=0,r||D(e,t,this.length);for(var n=this[e+--t],o=1;t>0&&(o*=256);)n+=this[e+--t]*o;return n},o.prototype.readUInt8=function(e,t){return e>>>=0,t||D(e,1,this.length),this[e]},o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||D(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||D(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||D(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUInt32BE=function(e,t){return e>>>=0,t||D(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||D(e,t,this.length);for(var n=this[e],o=1,i=0;++i=o&&(n-=Math.pow(2,8*t)),n},o.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||D(e,t,this.length);for(var n=t,o=1,i=this[e+--n];n>0&&(o*=256);)i+=this[e+--n]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i},o.prototype.readInt8=function(e,t){return e>>>=0,t||D(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||D(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(e,t){e>>>=0,t||D(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(e,t){return e>>>=0,t||D(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e>>>=0,t||D(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readFloatLE=function(e,t){return e>>>=0,t||D(e,4,this.length),z.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e>>>=0,t||D(e,4,this.length),z.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e>>>=0,t||D(e,8,this.length),z.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e>>>=0,t||D(e,8,this.length),z.read(this,e,!1,52,8)},o.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){M(this,e,t,r,Math.pow(2,8*r)-1,0)}var o=1,i=0;for(this[t]=255&e;++i>>=0,r>>>=0,!n){M(this,e,t,r,Math.pow(2,8*r)-1,0)}var o=r-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+r},o.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,255,0),this[t]=255&e,t+1},o.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},o.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var o=Math.pow(2,8*r-1);M(this,e,t,r,o-1,-o)}var i=0,s=1,a=0;for(this[t]=255&e;++i>0)-a&255;return t+r},o.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var o=Math.pow(2,8*r-1);M(this,e,t,r,o-1,-o)}var i=r-1,s=1,a=0;for(this[t+i]=255&e;--i>=0&&(s*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/s>>0)-a&255;return t+r},o.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},o.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeFloatLE=function(e,t,r){return L(this,e,t,!0,r)},o.prototype.writeFloatBE=function(e,t,r){return L(this,e,t,!1,r)},o.prototype.writeDoubleLE=function(e,t,r){return U(this,e,t,!0,r)},o.prototype.writeDoubleBE=function(e,t,r){return U(this,e,t,!1,r)},o.prototype.copy=function(e,t,r,n){if(!o.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--s)e[s+t]=this[s+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return i},o.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!o.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){var i=e.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(e=i)}}else"number"==typeof e&&(e&=255);if(t<0||this.length>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var s;if("number"==typeof e)for(s=t;s0&&!c.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(f,"\\$1")+'"'}function a(e){this.parameters=Object.create(null),this.type=e}var u=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,c=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,l=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,d=/\\([\u000b\u0020-\u00ff])/g,f=/([\\"])/g,p=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;r.format=n,r.parse=o},{}],95:[function(e,t,r){e("../modules/web.dom.iterable"),e("../modules/es6.string.iterator"),t.exports=e("../modules/core.get-iterator")},{"../modules/core.get-iterator":204,"../modules/es6.string.iterator":222,"../modules/web.dom.iterable":233}],96:[function(e,t,r){e("../modules/web.dom.iterable"),e("../modules/es6.string.iterator"),t.exports=e("../modules/core.is-iterable")},{"../modules/core.is-iterable":205,"../modules/es6.string.iterator":222,"../modules/web.dom.iterable":233}],97:[function(e,t,r){var n=e("../../modules/_core"),o=n.JSON||(n.JSON={stringify:JSON.stringify});t.exports=function(e){return o.stringify.apply(o,arguments)}},{"../../modules/_core":131}],98:[function(e,t,r){e("../../modules/es6.number.is-finite"),t.exports=e("../../modules/_core").Number.isFinite},{"../../modules/_core":131,"../../modules/es6.number.is-finite":207}],99:[function(e,t,r){e("../../modules/es6.number.is-integer"),t.exports=e("../../modules/_core").Number.isInteger},{"../../modules/_core":131,"../../modules/es6.number.is-integer":208}],100:[function(e,t,r){e("../../modules/es6.object.assign"),t.exports=e("../../modules/_core").Object.assign},{"../../modules/_core":131,"../../modules/es6.object.assign":209}],101:[function(e,t,r){e("../../modules/es6.object.create");var n=e("../../modules/_core").Object;t.exports=function(e,t){return n.create(e,t)}},{"../../modules/_core":131,"../../modules/es6.object.create":210}],102:[function(e,t,r){e("../../modules/es6.object.define-property");var n=e("../../modules/_core").Object;t.exports=function(e,t,r){return n.defineProperty(e,t,r)}},{"../../modules/_core":131,"../../modules/es6.object.define-property":211}],103:[function(e,t,r){e("../../modules/es7.object.entries"),t.exports=e("../../modules/_core").Object.entries},{"../../modules/_core":131,"../../modules/es7.object.entries":224}],104:[function(e,t,r){e("../../modules/es6.object.freeze"),t.exports=e("../../modules/_core").Object.freeze},{"../../modules/_core":131,"../../modules/es6.object.freeze":212}],105:[function(e,t,r){e("../../modules/es6.object.get-prototype-of"),t.exports=e("../../modules/_core").Object.getPrototypeOf},{"../../modules/_core":131,"../../modules/es6.object.get-prototype-of":213}],106:[function(e,t,r){e("../../modules/es6.object.keys"),t.exports=e("../../modules/_core").Object.keys},{"../../modules/_core":131,"../../modules/es6.object.keys":214}],107:[function(e,t,r){e("../../modules/es6.object.set-prototype-of"),t.exports=e("../../modules/_core").Object.setPrototypeOf},{"../../modules/_core":131,"../../modules/es6.object.set-prototype-of":215}],108:[function(e,t,r){e("../../modules/es7.object.values"),t.exports=e("../../modules/_core").Object.values},{"../../modules/_core":131,"../../modules/es7.object.values":225}],109:[function(e,t,r){e("../modules/es6.object.to-string"),e("../modules/es6.string.iterator"),e("../modules/web.dom.iterable"),e("../modules/es6.promise"),e("../modules/es7.promise.finally"),e("../modules/es7.promise.try"),t.exports=e("../modules/_core").Promise},{"../modules/_core":131,"../modules/es6.object.to-string":216,"../modules/es6.promise":217,"../modules/es6.string.iterator":222,"../modules/es7.promise.finally":226,"../modules/es7.promise.try":227,"../modules/web.dom.iterable":233}],110:[function(e,t,r){e("../../modules/es6.reflect.construct"),t.exports=e("../../modules/_core").Reflect.construct},{"../../modules/_core":131,"../../modules/es6.reflect.construct":218}],111:[function(e,t,r){e("../../modules/es6.reflect.get-prototype-of"),t.exports=e("../../modules/_core").Reflect.getPrototypeOf},{"../../modules/_core":131,"../../modules/es6.reflect.get-prototype-of":219}],112:[function(e,t,r){e("../../modules/es6.reflect.set-prototype-of"),t.exports=e("../../modules/_core").Reflect.setPrototypeOf},{"../../modules/_core":131,"../../modules/es6.reflect.set-prototype-of":220}],113:[function(e,t,r){e("../modules/es6.object.to-string"),e("../modules/es6.string.iterator"),e("../modules/web.dom.iterable"),e("../modules/es6.set"),e("../modules/es7.set.to-json"),e("../modules/es7.set.of"),e("../modules/es7.set.from"),t.exports=e("../modules/_core").Set},{"../modules/_core":131,"../modules/es6.object.to-string":216,"../modules/es6.set":221,"../modules/es6.string.iterator":222,"../modules/es7.set.from":228,"../modules/es7.set.of":229,"../modules/es7.set.to-json":230,"../modules/web.dom.iterable":233}],114:[function(e,t,r){e("../../modules/es6.symbol"),e("../../modules/es6.object.to-string"),e("../../modules/es7.symbol.async-iterator"),e("../../modules/es7.symbol.observable"),t.exports=e("../../modules/_core").Symbol},{"../../modules/_core":131,"../../modules/es6.object.to-string":216,"../../modules/es6.symbol":223,"../../modules/es7.symbol.async-iterator":231,"../../modules/es7.symbol.observable":232}],115:[function(e,t,r){e("../../modules/es6.string.iterator"),e("../../modules/web.dom.iterable"),t.exports=e("../../modules/_wks-ext").f("iterator")},{"../../modules/_wks-ext":201,"../../modules/es6.string.iterator":222,"../../modules/web.dom.iterable":233}],116:[function(e,t,r){t.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},{}],117:[function(e,t,r){t.exports=function(){}},{}],118:[function(e,t,r){t.exports=function(e,t,r,n){if(!(e instanceof t)||void 0!==n&&n in e)throw TypeError(r+": incorrect invocation!");return e}},{}],119:[function(e,t,r){var n=e("./_is-object");t.exports=function(e){if(!n(e))throw TypeError(e+" is not an object!");return e}},{"./_is-object":151}],120:[function(e,t,r){var n=e("./_for-of");t.exports=function(e,t){var r=[];return n(e,!1,r.push,r,t),r}},{"./_for-of":140}],121:[function(e,t,r){var n=e("./_to-iobject"),o=e("./_to-length"),i=e("./_to-absolute-index");t.exports=function(e){return function(t,r,s){var a,u=n(t),c=o(u.length),l=i(s,c);if(e&&r!=r){for(;c>l;)if((a=u[l++])!=a)return!0}else for(;c>l;l++)if((e||l in u)&&u[l]===r)return e||l||0;return!e&&-1}}},{"./_to-absolute-index":191,"./_to-iobject":193,"./_to-length":194}],122:[function(e,t,r){var n=e("./_ctx"),o=e("./_iobject"),i=e("./_to-object"),s=e("./_to-length"),a=e("./_array-species-create");t.exports=function(e,t){var r=1==e,u=2==e,c=3==e,l=4==e,d=6==e,f=5==e||d,p=t||a;return function(t,a,h){for(var v,m,y=i(t),_=o(y),g=n(a,h,3),b=s(_.length),E=0,w=r?p(t,b):u?p(t,0):void 0;b>E;E++)if((f||E in _)&&(v=_[E],m=g(v,E,y),e))if(r)w[E]=m;else if(m)switch(e){case 3:return!0;case 5:return v;case 6:return E;case 2:w.push(v)}else if(l)return!1;return d?-1:c||l?l:w}}},{"./_array-species-create":124,"./_ctx":132,"./_iobject":147,"./_to-length":194,"./_to-object":195}],123:[function(e,t,r){var n=e("./_is-object"),o=e("./_is-array"),i=e("./_wks")("species");t.exports=function(e){var t;return o(e)&&(t=e.constructor,"function"!=typeof t||t!==Array&&!o(t.prototype)||(t=void 0),n(t)&&null===(t=t[i])&&(t=void 0)),void 0===t?Array:t}},{"./_is-array":149,"./_is-object":151,"./_wks":202}],124:[function(e,t,r){var n=e("./_array-species-constructor");t.exports=function(e,t){return new(n(e))(t)}},{"./_array-species-constructor":123}],125:[function(e,t,r){"use strict";var n=e("./_a-function"),o=e("./_is-object"),i=e("./_invoke"),s=[].slice,a={},u=function(e,t,r){if(!(t in a)){for(var n=[],o=0;o1?arguments[1]:void 0,3);r=r?r.n:this._f;)for(n(r.v,r.k,this);r&&r.r;)r=r.p},has:function(e){return!!m(h(this,t),e)}}),f&&n(l.prototype,"size",{get:function(){return h(this,t)[v]}}),l},def:function(e,t,r){var n,o,i=m(e,t);return i?i.v=r:(e._l=i={i:o=p(t,!0),k:t,v:r,p:n=e._l,n:void 0,r:!1},e._f||(e._f=i),n&&(n.n=i),e[v]++,"F"!==o&&(e._i[o]=i)),e},getEntry:m,setStrong:function(e,t,r){c(e,t,function(e,r){this._t=h(e,t),this._k=r,this._l=void 0},function(){for(var e=this,t=e._k,r=e._l;r&&r.r;)r=r.p;return e._t&&(e._l=r=r?r.n:e._t._f)?"keys"==t?l(0,r.k):"values"==t?l(0,r.v):l(0,[r.k,r.v]):(e._t=void 0,l(1))},r?"entries":"values",!r,!0),d(t)}}},{"./_an-instance":118,"./_ctx":132,"./_descriptors":134,"./_for-of":140,"./_iter-define":154,"./_iter-step":156,"./_meta":159,"./_object-create":163,"./_object-dp":164,"./_redefine-all":179,"./_set-species":184,"./_validate-collection":199}],129:[function(e,t,r){var n=e("./_classof"),o=e("./_array-from-iterable");t.exports=function(e){return function(){if(n(this)!=e)throw TypeError(e+"#toJSON isn't generic");return o(this)}}},{"./_array-from-iterable":120,"./_classof":126}],130:[function(e,t,r){"use strict";var n=e("./_global"),o=e("./_export"),i=e("./_meta"),s=e("./_fails"),a=e("./_hide"),u=e("./_redefine-all"),c=e("./_for-of"),l=e("./_an-instance"),d=e("./_is-object"),f=e("./_set-to-string-tag"),p=e("./_object-dp").f,h=e("./_array-methods")(0),v=e("./_descriptors");t.exports=function(e,t,r,m,y,_){var g=n[e],b=g,E=y?"set":"add",w=b&&b.prototype,S={};return v&&"function"==typeof b&&(_||w.forEach&&!s(function(){(new b).entries().next()}))?(b=t(function(t,r){l(t,b,e,"_c"),t._c=new g,void 0!=r&&c(r,y,t[E],t)}), +h("add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON".split(","),function(e){var t="add"==e||"set"==e;e in w&&(!_||"clear"!=e)&&a(b.prototype,e,function(r,n){if(l(this,b,e),!t&&_&&!d(r))return"get"==e&&void 0;var o=this._c[e](0===r?0:r,n);return t?this:o})}),_||p(b.prototype,"size",{get:function(){return this._c.size}})):(b=m.getConstructor(t,e,y,E),u(b.prototype,r),i.NEED=!0),f(b,e),S[e]=b,o(o.G+o.W+o.F,S),_||m.setStrong(b,e,y),b}},{"./_an-instance":118,"./_array-methods":122,"./_descriptors":134,"./_export":138,"./_fails":139,"./_for-of":140,"./_global":141,"./_hide":143,"./_is-object":151,"./_meta":159,"./_object-dp":164,"./_redefine-all":179,"./_set-to-string-tag":185}],131:[function(e,t,r){var n=t.exports={version:"2.5.7"};"number"==typeof __e&&(__e=n)},{}],132:[function(e,t,r){var n=e("./_a-function");t.exports=function(e,t,r){if(n(e),void 0===t)return e;switch(r){case 1:return function(r){return e.call(t,r)};case 2:return function(r,n){return e.call(t,r,n)};case 3:return function(r,n,o){return e.call(t,r,n,o)}}return function(){return e.apply(t,arguments)}}},{"./_a-function":116}],133:[function(e,t,r){t.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},{}],134:[function(e,t,r){t.exports=!e("./_fails")(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},{"./_fails":139}],135:[function(e,t,r){var n=e("./_is-object"),o=e("./_global").document,i=n(o)&&n(o.createElement);t.exports=function(e){return i?o.createElement(e):{}}},{"./_global":141,"./_is-object":151}],136:[function(e,t,r){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},{}],137:[function(e,t,r){var n=e("./_object-keys"),o=e("./_object-gops"),i=e("./_object-pie");t.exports=function(e){var t=n(e),r=o.f;if(r)for(var s,a=r(e),u=i.f,c=0;a.length>c;)u.call(e,s=a[c++])&&t.push(s);return t}},{"./_object-gops":169,"./_object-keys":172,"./_object-pie":173}],138:[function(e,t,r){var n=e("./_global"),o=e("./_core"),i=e("./_ctx"),s=e("./_hide"),a=e("./_has"),u=function(e,t,r){var c,l,d,f=e&u.F,p=e&u.G,h=e&u.S,v=e&u.P,m=e&u.B,y=e&u.W,_=p?o:o[t]||(o[t]={}),g=_.prototype,b=p?n:h?n[t]:(n[t]||{}).prototype;p&&(r=t);for(c in r)(l=!f&&b&&void 0!==b[c])&&a(_,c)||(d=l?b[c]:r[c],_[c]=p&&"function"!=typeof b[c]?r[c]:m&&l?i(d,n):y&&b[c]==d?function(e){var t=function(t,r,n){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,r)}return new e(t,r,n)}return e.apply(this,arguments)};return t.prototype=e.prototype,t}(d):v&&"function"==typeof d?i(Function.call,d):d,v&&((_.virtual||(_.virtual={}))[c]=d,e&u.R&&g&&!g[c]&&s(g,c,d)))};u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,t.exports=u},{"./_core":131,"./_ctx":132,"./_global":141,"./_has":142,"./_hide":143}],139:[function(e,t,r){t.exports=function(e){try{return!!e()}catch(e){return!0}}},{}],140:[function(e,t,r){var n=e("./_ctx"),o=e("./_iter-call"),i=e("./_is-array-iter"),s=e("./_an-object"),a=e("./_to-length"),u=e("./core.get-iterator-method"),c={},l={},r=t.exports=function(e,t,r,d,f){var p,h,v,m,y=f?function(){return e}:u(e),_=n(r,d,t?2:1),g=0;if("function"!=typeof y)throw TypeError(e+" is not iterable!");if(i(y)){for(p=a(e.length);p>g;g++)if((m=t?_(s(h=e[g])[0],h[1]):_(e[g]))===c||m===l)return m}else for(v=y.call(e);!(h=v.next()).done;)if((m=o(v,_,h.value,t))===c||m===l)return m};r.BREAK=c,r.RETURN=l},{"./_an-object":119,"./_ctx":132,"./_is-array-iter":148,"./_iter-call":152,"./_to-length":194,"./core.get-iterator-method":203}],141:[function(e,t,r){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},{}],142:[function(e,t,r){var n={}.hasOwnProperty;t.exports=function(e,t){return n.call(e,t)}},{}],143:[function(e,t,r){var n=e("./_object-dp"),o=e("./_property-desc");t.exports=e("./_descriptors")?function(e,t,r){return n.f(e,t,o(1,r))}:function(e,t,r){return e[t]=r,e}},{"./_descriptors":134,"./_object-dp":164,"./_property-desc":178}],144:[function(e,t,r){var n=e("./_global").document;t.exports=n&&n.documentElement},{"./_global":141}],145:[function(e,t,r){t.exports=!e("./_descriptors")&&!e("./_fails")(function(){return 7!=Object.defineProperty(e("./_dom-create")("div"),"a",{get:function(){return 7}}).a})},{"./_descriptors":134,"./_dom-create":135,"./_fails":139}],146:[function(e,t,r){t.exports=function(e,t,r){var n=void 0===r;switch(t.length){case 0:return n?e():e.call(r);case 1:return n?e(t[0]):e.call(r,t[0]);case 2:return n?e(t[0],t[1]):e.call(r,t[0],t[1]);case 3:return n?e(t[0],t[1],t[2]):e.call(r,t[0],t[1],t[2]);case 4:return n?e(t[0],t[1],t[2],t[3]):e.call(r,t[0],t[1],t[2],t[3])}return e.apply(r,t)}},{}],147:[function(e,t,r){var n=e("./_cof");t.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==n(e)?e.split(""):Object(e)}},{"./_cof":127}],148:[function(e,t,r){var n=e("./_iterators"),o=e("./_wks")("iterator"),i=Array.prototype;t.exports=function(e){return void 0!==e&&(n.Array===e||i[o]===e)}},{"./_iterators":157,"./_wks":202}],149:[function(e,t,r){var n=e("./_cof");t.exports=Array.isArray||function(e){return"Array"==n(e)}},{"./_cof":127}],150:[function(e,t,r){var n=e("./_is-object"),o=Math.floor;t.exports=function(e){return!n(e)&&isFinite(e)&&o(e)===e}},{"./_is-object":151}],151:[function(e,t,r){t.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},{}],152:[function(e,t,r){var n=e("./_an-object");t.exports=function(e,t,r,o){try{return o?t(n(r)[0],r[1]):t(r)}catch(t){var i=e.return;throw void 0!==i&&n(i.call(e)),t}}},{"./_an-object":119}],153:[function(e,t,r){"use strict";var n=e("./_object-create"),o=e("./_property-desc"),i=e("./_set-to-string-tag"),s={};e("./_hide")(s,e("./_wks")("iterator"),function(){return this}),t.exports=function(e,t,r){e.prototype=n(s,{next:o(1,r)}),i(e,t+" Iterator")}},{"./_hide":143,"./_object-create":163,"./_property-desc":178,"./_set-to-string-tag":185,"./_wks":202}],154:[function(e,t,r){"use strict";var n=e("./_library"),o=e("./_export"),i=e("./_redefine"),s=e("./_hide"),a=e("./_iterators"),u=e("./_iter-create"),c=e("./_set-to-string-tag"),l=e("./_object-gpo"),d=e("./_wks")("iterator"),f=!([].keys&&"next"in[].keys()),p=function(){return this};t.exports=function(e,t,r,h,v,m,y){u(r,t,h);var _,g,b,E=function(e){if(!f&&e in T)return T[e];switch(e){case"keys":case"values":return function(){return new r(this,e)}}return function(){return new r(this,e)}},w=t+" Iterator",S="values"==v,k=!1,T=e.prototype,x=T[d]||T["@@iterator"]||v&&T[v],R=x||E(v),I=v?S?E("entries"):R:void 0,C="Array"==t?T.entries||x:x;if(C&&(b=l(C.call(new e)))!==Object.prototype&&b.next&&(c(b,w,!0),n||"function"==typeof b[d]||s(b,d,p)),S&&x&&"values"!==x.name&&(k=!0,R=function(){return x.call(this)}),n&&!y||!f&&!k&&T[d]||s(T,d,R),a[t]=R,a[w]=p,v)if(_={values:S?R:E("values"),keys:m?R:E("keys"),entries:I},y)for(g in _)g in T||i(T,g,_[g]);else o(o.P+o.F*(f||k),t,_);return _}},{"./_export":138,"./_hide":143,"./_iter-create":153,"./_iterators":157,"./_library":158,"./_object-gpo":170,"./_redefine":180,"./_set-to-string-tag":185,"./_wks":202}],155:[function(e,t,r){var n=e("./_wks")("iterator"),o=!1;try{var i=[7][n]();i.return=function(){o=!0},Array.from(i,function(){throw 2})}catch(e){}t.exports=function(e,t){if(!t&&!o)return!1;var r=!1;try{var i=[7],s=i[n]();s.next=function(){return{done:r=!0}},i[n]=function(){return s},e(i)}catch(e){}return r}},{"./_wks":202}],156:[function(e,t,r){t.exports=function(e,t){return{value:t,done:!!e}}},{}],157:[function(e,t,r){t.exports={}},{}],158:[function(e,t,r){t.exports=!0},{}],159:[function(e,t,r){var n=e("./_uid")("meta"),o=e("./_is-object"),i=e("./_has"),s=e("./_object-dp").f,a=0,u=Object.isExtensible||function(){return!0},c=!e("./_fails")(function(){return u(Object.preventExtensions({}))}),l=function(e){s(e,n,{value:{i:"O"+ ++a,w:{}}})},d=function(e,t){if(!o(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!i(e,n)){if(!u(e))return"F";if(!t)return"E";l(e)}return e[n].i},f=function(e,t){if(!i(e,n)){if(!u(e))return!0;if(!t)return!1;l(e)}return e[n].w},p=function(e){return c&&h.NEED&&u(e)&&!i(e,n)&&l(e),e},h=t.exports={KEY:n,NEED:!1,fastKey:d,getWeak:f,onFreeze:p}},{"./_fails":139,"./_has":142,"./_is-object":151,"./_object-dp":164,"./_uid":197}],160:[function(e,t,r){var n=e("./_global"),o=e("./_task").set,i=n.MutationObserver||n.WebKitMutationObserver,s=n.process,a=n.Promise,u="process"==e("./_cof")(s);t.exports=function(){var e,t,r,c=function(){var n,o;for(u&&(n=s.domain)&&n.exit();e;){o=e.fn,e=e.next;try{o()}catch(n){throw e?r():t=void 0,n}}t=void 0,n&&n.enter()};if(u)r=function(){s.nextTick(c)};else if(!i||n.navigator&&n.navigator.standalone)if(a&&a.resolve){var l=a.resolve(void 0);r=function(){l.then(c)}}else r=function(){o.call(n,c)};else{var d=!0,f=document.createTextNode("");new i(c).observe(f,{characterData:!0}),r=function(){f.data=d=!d}}return function(n){var o={fn:n,next:void 0};t&&(t.next=o),e||(e=o,r()),t=o}}},{"./_cof":127,"./_global":141,"./_task":190}],161:[function(e,t,r){"use strict";function n(e){var t,r;this.promise=new e(function(e,n){if(void 0!==t||void 0!==r)throw TypeError("Bad Promise constructor");t=e,r=n}),this.resolve=o(t),this.reject=o(r)}var o=e("./_a-function");t.exports.f=function(e){return new n(e)}},{"./_a-function":116}],162:[function(e,t,r){"use strict";var n=e("./_object-keys"),o=e("./_object-gops"),i=e("./_object-pie"),s=e("./_to-object"),a=e("./_iobject"),u=Object.assign;t.exports=!u||e("./_fails")(function(){var e={},t={},r=Symbol(),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach(function(e){t[e]=e}),7!=u({},e)[r]||Object.keys(u({},t)).join("")!=n})?function(e,t){for(var r=s(e),u=arguments.length,c=1,l=o.f,d=i.f;u>c;)for(var f,p=a(arguments[c++]),h=l?n(p).concat(l(p)):n(p),v=h.length,m=0;v>m;)d.call(p,f=h[m++])&&(r[f]=p[f]);return r}:u},{"./_fails":139,"./_iobject":147,"./_object-gops":169,"./_object-keys":172,"./_object-pie":173,"./_to-object":195}],163:[function(e,t,r){var n=e("./_an-object"),o=e("./_object-dps"),i=e("./_enum-bug-keys"),s=e("./_shared-key")("IE_PROTO"),a=function(){},u=function(){var t,r=e("./_dom-create")("iframe"),n=i.length;for(r.style.display="none",e("./_html").appendChild(r),r.src="javascript:",t=r.contentWindow.document,t.open(),t.write(" + + + diff --git a/origin_migrator/dest/dest.js b/origin_migrator/dest/dest.js new file mode 100644 index 0000000000..d5ffd42b85 --- /dev/null +++ b/origin_migrator/dest/dest.js @@ -0,0 +1,125 @@ +/* +Copyright 2018 New Vector Ltd + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +const SOURCE_ORIGIN = 'file://'; + +const IndexedDBCryptoStore = window.matrixcs.IndexedDBCryptoStore; +const cryptoStore = new IndexedDBCryptoStore(window.indexedDB, 'matrix-js-sdk:crypto'); + +let accountStored = 0; +let sessionsStored = 0; +let inboundGroupSessionsStored = 0; +let deviceDataStored = 0; +let roomsStored = 0; +let localStorageKeysStored = 0; + +const promises = []; + +async function onMessage(e) { + if (e.origin !== SOURCE_ORIGIN) return; + + const data = e.data.data; // bleh, naming clash + switch (e.data.cmd) { + case 'init': + // start with clean stores before we migrate data in + window.localStorage.clear(); + await cryptoStore.deleteAllData(); + + e.source.postMessage({ + cmd: 'initOK', + }, SOURCE_ORIGIN); + break; + case 'storeAccount': + promises.push(cryptoStore.doTxn( + 'readwrite', [IndexedDBCryptoStore.STORE_ACCOUNT], + (txn) => { + cryptoStore.storeAccount(txn, data); + }, + ).then(() => { + ++accountStored; + })); + break; + case 'storeSessions': + promises.push(cryptoStore.doTxn( + 'readwrite', [IndexedDBCryptoStore.STORE_SESSIONS], + (txn) => { + for (const sess of data) { + cryptoStore.storeEndToEndSession(sess.deviceKey, sess.sessionId, sess, txn); + } + }, + ).then(() => { + sessionsStored += data.length; + })); + break; + case 'storeInboundGroupSessions': + promises.push(cryptoStore.doTxn( + 'readwrite', [IndexedDBCryptoStore.STORE_INBOUND_GROUP_SESSIONS], + (txn) => { + for (const sess of data) { + cryptoStore.addEndToEndInboundGroupSession( + sess.senderKey, sess.sessionId, sess.sessionData, txn, + ); + } + }, + ).then(() => { + inboundGroupSessionsStored += data.length; + })); + break; + case 'storeDeviceData': + promises.push(cryptoStore.doTxn( + 'readwrite', [IndexedDBCryptoStore.STORE_DEVICE_DATA], + (txn) => { + cryptoStore.storeEndToEndDeviceData(data, txn); + }, + ).then(() => { + ++deviceDataStored; + })); + break; + case 'storeRooms': + promises.push(cryptoStore.doTxn( + 'readwrite', [IndexedDBCryptoStore.STORE_ROOMS], + (txn) => { + for (const [roomId, roomInfo] of Object.entries(data)) { + cryptoStore.storeEndToEndRoom(roomId, roomInfo, txn); + } + }, + ).then(() => { + ++roomsStored; + })); + break; + case 'storeLocalStorage': + window.localStorage.setItem(data.key, data.val); + ++localStorageKeysStored; + break; + case 'getSummary': + await Promise.all(promises); + e.source.postMessage({ + cmd: 'summary', + data: { + accountStored, + sessionsStored, + inboundGroupSessionsStored, + deviceDataStored, + roomsStored, + localStorageKeysStored, + }, + }, SOURCE_ORIGIN); + break; + } +} + +window.addEventListener('message', onMessage); + diff --git a/origin_migrator/source.html b/origin_migrator/source.html new file mode 100644 index 0000000000..ade265c777 --- /dev/null +++ b/origin_migrator/source.html @@ -0,0 +1,7 @@ + + + + + + + diff --git a/origin_migrator/source.js b/origin_migrator/source.js new file mode 100644 index 0000000000..0cbee89f94 --- /dev/null +++ b/origin_migrator/source.js @@ -0,0 +1,210 @@ +/* +Copyright 2018 New Vector Ltd + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +const TARGET_ORIGIN = 'vector://vector'; +const BATCH_SIZE = 500; +let destFrame; + +let initResolver = null; +let getSummaryResolver = null; + +function onMessage(e) { + if (e.origin !== TARGET_ORIGIN) return; + + if (e.data.cmd === 'initOK' && initResolver) { + initResolver(); + initResolver = null; + } else if (e.data.cmd === 'summary' && getSummaryResolver) { + getSummaryResolver(e.data.data); + getSummaryResolver = null; + } +} + +async function initDestFrame() { + return new Promise(resolve => { + initResolver = resolve; + destFrame.postMessage({ + cmd: 'init', + }, TARGET_ORIGIN); + }); +} + +async function getSummary() { + return new Promise(resolve => { + getSummaryResolver = resolve; + destFrame.postMessage({ + cmd: 'getSummary', + }, TARGET_ORIGIN); + }); +} + +async function doMigrate() { + let accountSent = 0; + let sessionsSent = 0; + let inboundGroupSessionsSent = 0; + let deviceDataSent = 0; + let roomsSent = 0; + let localStorageKeysSent = 0; + + if (!window.ipcRenderer) { + console.error("ipcRenderer not found"); + return; + } + + if (window.localStorage.getItem('mx_user_id') === null) { + window.ipcRenderer.send("origin_migration_nodata"); + return; + } + + destFrame = window.parent.frames.dest; + + await initDestFrame(); + + const IndexedDBCryptoStore = window.matrixcs.IndexedDBCryptoStore; + + const cryptoStore = new IndexedDBCryptoStore(window.indexedDB, 'matrix-js-sdk:crypto'); + + await cryptoStore.doTxn( + 'readonly', [IndexedDBCryptoStore.STORE_ACCOUNT], + (txn) => { + cryptoStore.getAccount(txn, (account) => { + destFrame.postMessage({ + cmd: 'storeAccount', + data: account, + }, TARGET_ORIGIN); + ++accountSent; + }); + }, + ); + + await cryptoStore.doTxn( + 'readonly', [IndexedDBCryptoStore.STORE_SESSIONS], + (txn) => { + let sessBatch = []; + cryptoStore.getAllEndToEndSessions(txn, (sessInfo) => { + if (sessInfo) { + ++sessionsSent; + sessBatch.push(sessInfo); + } + if (sessBatch.length >= BATCH_SIZE || sessInfo === null) { + destFrame.postMessage({ + cmd: 'storeSessions', + data: sessBatch, + }, TARGET_ORIGIN); + sessBatch = []; + } + }); + }, + ); + + await cryptoStore.doTxn( + 'readonly', [IndexedDBCryptoStore.STORE_INBOUND_GROUP_SESSIONS], + (txn) => { + let sessBatch = []; + cryptoStore.getAllEndToEndInboundGroupSessions(txn, (sessInfo) => { + if (sessInfo) { + ++inboundGroupSessionsSent; + sessBatch.push(sessInfo); + } + if (sessBatch.length >= BATCH_SIZE || sessInfo === null) { + destFrame.postMessage({ + cmd: 'storeInboundGroupSessions', + data: sessBatch, + }, TARGET_ORIGIN); + sessBatch = []; + } + }); + }, + ); + + await cryptoStore.doTxn( + 'readonly', [IndexedDBCryptoStore.STORE_DEVICE_DATA], + (txn) => { + cryptoStore.getEndToEndDeviceData(txn, (deviceData) => { + destFrame.postMessage({ + cmd: 'storeDeviceData', + data: deviceData, + }, TARGET_ORIGIN); + ++deviceDataSent; + }); + }, + ); + + await cryptoStore.doTxn( + 'readonly', [IndexedDBCryptoStore.STORE_ROOMS], + (txn) => { + cryptoStore.getEndToEndRooms(txn, (rooms) => { + destFrame.postMessage({ + cmd: 'storeRooms', + data: rooms, + }, TARGET_ORIGIN); + ++roomsSent; + }); + }, + ); + + // we don't bother migrating; + // * sync data (we can just initialsync again) + // * logs + // * key requests (worst case they'll just be re-sent) + // * sessions needing backup (feature isn't available on Electron) + + for (let i = 0; i < window.localStorage.length; ++i) { + const key = window.localStorage.key(i); + const val = window.localStorage.getItem(key); + + destFrame.postMessage({ + cmd: 'storeLocalStorage', + data: { key, val }, + }, TARGET_ORIGIN); + ++localStorageKeysSent; + } + + const summary = await getSummary(); + let success = false; + if ( + summary.accountStored === accountSent && + summary.sessionsStored === sessionsSent && + summary.inboundGroupSessionsStored === inboundGroupSessionsSent && + summary.deviceDataStored === deviceDataSent && + summary.roomsStored === roomsSent && + summary.localStorageKeysStored === localStorageKeysSent + ) { + success = true; + window.localStorage.clear(); + await cryptoStore.deleteAllData(); + + // we don't bother migrating them, but also blow away the sync & logs db, + // otherwise they'll just hang about taking up space + await new Promise(resolve => { + const req = window.indexedDB.deleteDatabase('matrix-js-sdk:riot-web-sync'); + req.onsuccess = resolve; + req.onerror = resolve; + }); + await new Promise(resolve => { + const req = window.indexedDB.deleteDatabase('logs'); + req.onsuccess = resolve; + req.onerror = resolve; + }); + } + + window.ipcRenderer.send("origin_migration_complete", success, { + accountSent, sessionsSent, inboundGroupSessionsSent, + deviceDataSent, roomsSent, localStorageKeysSent, + }, summary); +} + +window.addEventListener('message', onMessage); diff --git a/package-lock.json b/package-lock.json index 738238d30f..46f716045f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "riot-web", - "version": "0.17.5", + "version": "0.17.8", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -11,9 +11,9 @@ "dev": true }, "7zip-bin": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/7zip-bin/-/7zip-bin-4.0.2.tgz", - "integrity": "sha512-XtGk+IF57pr852UK1AhQJXqmm1WmSgS5uISL+LPs0z/iAxXouMvdlLJrHPeukP6gd7yR2rDTMSMkHNODgwIq7A==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/7zip-bin/-/7zip-bin-4.1.0.tgz", + "integrity": "sha512-AsnBZN3a8/JcNt+KPkGGODaA4c7l3W5+WpeKgGSbstSLxqWtTXqd1ieJGBQ8IFCtRg8DmmKUcSkIkUc0A4p3YA==", "dev": true }, "7zip-bin-linux": { @@ -46,6 +46,62 @@ "@babel/highlight": "^7.0.0" } }, + "@babel/generator": { + "version": "7.0.0-beta.44", + "resolved": "http://registry.npmjs.org/@babel/generator/-/generator-7.0.0-beta.44.tgz", + "integrity": "sha512-5xVb7hlhjGcdkKpMXgicAVgx8syK5VJz193k0i/0sLP6DzE6lRrU1K3B/rFefgdo9LPGMAOOOAWW4jycj07ShQ==", + "dev": true, + "requires": { + "@babel/types": "7.0.0-beta.44", + "jsesc": "^2.5.1", + "lodash": "^4.2.0", + "source-map": "^0.5.0", + "trim-right": "^1.0.1" + }, + "dependencies": { + "jsesc": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.1.tgz", + "integrity": "sha1-5CGiqOINawgZ3yiQj3glJrlt0f4=", + "dev": true + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + } + } + }, + "@babel/helper-function-name": { + "version": "7.0.0-beta.44", + "resolved": "http://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.44.tgz", + "integrity": "sha512-MHRG2qZMKMFaBavX0LWpfZ2e+hLloT++N7rfM3DYOMUOGCD8cVjqZpwiL8a0bOX3IYcQev1ruciT0gdFFRTxzg==", + "dev": true, + "requires": { + "@babel/helper-get-function-arity": "7.0.0-beta.44", + "@babel/template": "7.0.0-beta.44", + "@babel/types": "7.0.0-beta.44" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.0.0-beta.44", + "resolved": "http://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.44.tgz", + "integrity": "sha512-w0YjWVwrM2HwP6/H3sEgrSQdkCaxppqFeJtAnB23pRiJB5E/O9Yp7JAAeWBl+gGEgmBFinnTyOv2RN7rcSmMiw==", + "dev": true, + "requires": { + "@babel/types": "7.0.0-beta.44" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.0.0-beta.44", + "resolved": "http://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0-beta.44.tgz", + "integrity": "sha512-aQ7QowtkgKKzPGf0j6u77kBMdUFVBKNHw2p/3HX/POt5/oz8ec5cs0GwlgM8Hz7ui5EwJnzyfRmkNF1Nx1N7aA==", + "dev": true, + "requires": { + "@babel/types": "7.0.0-beta.44" + } + }, "@babel/highlight": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.0.0.tgz", @@ -58,9 +114,9 @@ } }, "@babel/runtime": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.1.2.tgz", - "integrity": "sha512-Y3SCjmhSupzFB6wcv1KmmFucH6gDVnI30WjOcicV10ju0cZjak3Jcs67YLIXBrmZYw1xCrVeJPbycFwrqNyxpg==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.2.0.tgz", + "integrity": "sha512-oouEibCbHMVdZSDlJBO6bZmID/zA/G/Qx3H1d3rSNPTD+L8UNKvCat7aKWSJ74zYbm5zWGh0GQN0hKj8zYFTCg==", "requires": { "regenerator-runtime": "^0.12.0" }, @@ -72,6 +128,129 @@ } } }, + "@babel/template": { + "version": "7.0.0-beta.44", + "resolved": "http://registry.npmjs.org/@babel/template/-/template-7.0.0-beta.44.tgz", + "integrity": "sha512-w750Sloq0UNifLx1rUqwfbnC6uSUk0mfwwgGRfdLiaUzfAOiH0tHJE6ILQIUi3KYkjiCDTskoIsnfqZvWLBDng==", + "dev": true, + "requires": { + "@babel/code-frame": "7.0.0-beta.44", + "@babel/types": "7.0.0-beta.44", + "babylon": "7.0.0-beta.44", + "lodash": "^4.2.0" + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.0.0-beta.44", + "resolved": "http://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0-beta.44.tgz", + "integrity": "sha512-cuAuTTIQ9RqcFRJ/Y8PvTh+paepNcaGxwQwjIDRWPXmzzyAeCO4KqS9ikMvq0MCbRk6GlYKwfzStrcP3/jSL8g==", + "dev": true, + "requires": { + "@babel/highlight": "7.0.0-beta.44" + } + }, + "@babel/highlight": { + "version": "7.0.0-beta.44", + "resolved": "http://registry.npmjs.org/@babel/highlight/-/highlight-7.0.0-beta.44.tgz", + "integrity": "sha512-Il19yJvy7vMFm8AVAh6OZzaFoAd0hbkeMZiX3P5HGD+z7dyI7RzndHB0dg6Urh/VAFfHtpOIzDUSxmY6coyZWQ==", + "dev": true, + "requires": { + "chalk": "^2.0.0", + "esutils": "^2.0.2", + "js-tokens": "^3.0.0" + } + }, + "babylon": { + "version": "7.0.0-beta.44", + "resolved": "http://registry.npmjs.org/babylon/-/babylon-7.0.0-beta.44.tgz", + "integrity": "sha512-5Hlm13BJVAioCHpImtFqNOF2H3ieTOHd0fmFGMxOJ9jgeFqeAwsv3u5P5cR7CSeFrkgHsT19DgFJkHV0/Mcd8g==", + "dev": true + }, + "js-tokens": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "dev": true + } + } + }, + "@babel/traverse": { + "version": "7.0.0-beta.44", + "resolved": "http://registry.npmjs.org/@babel/traverse/-/traverse-7.0.0-beta.44.tgz", + "integrity": "sha512-UHuDz8ukQkJCDASKHf+oDt3FVUzFd+QYfuBIsiNu/4+/ix6pP/C+uQZJ6K1oEfbCMv/IKWbgDEh7fcsnIE5AtA==", + "dev": true, + "requires": { + "@babel/code-frame": "7.0.0-beta.44", + "@babel/generator": "7.0.0-beta.44", + "@babel/helper-function-name": "7.0.0-beta.44", + "@babel/helper-split-export-declaration": "7.0.0-beta.44", + "@babel/types": "7.0.0-beta.44", + "babylon": "7.0.0-beta.44", + "debug": "^3.1.0", + "globals": "^11.1.0", + "invariant": "^2.2.0", + "lodash": "^4.2.0" + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.0.0-beta.44", + "resolved": "http://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0-beta.44.tgz", + "integrity": "sha512-cuAuTTIQ9RqcFRJ/Y8PvTh+paepNcaGxwQwjIDRWPXmzzyAeCO4KqS9ikMvq0MCbRk6GlYKwfzStrcP3/jSL8g==", + "dev": true, + "requires": { + "@babel/highlight": "7.0.0-beta.44" + } + }, + "@babel/highlight": { + "version": "7.0.0-beta.44", + "resolved": "http://registry.npmjs.org/@babel/highlight/-/highlight-7.0.0-beta.44.tgz", + "integrity": "sha512-Il19yJvy7vMFm8AVAh6OZzaFoAd0hbkeMZiX3P5HGD+z7dyI7RzndHB0dg6Urh/VAFfHtpOIzDUSxmY6coyZWQ==", + "dev": true, + "requires": { + "chalk": "^2.0.0", + "esutils": "^2.0.2", + "js-tokens": "^3.0.0" + } + }, + "babylon": { + "version": "7.0.0-beta.44", + "resolved": "http://registry.npmjs.org/babylon/-/babylon-7.0.0-beta.44.tgz", + "integrity": "sha512-5Hlm13BJVAioCHpImtFqNOF2H3ieTOHd0fmFGMxOJ9jgeFqeAwsv3u5P5cR7CSeFrkgHsT19DgFJkHV0/Mcd8g==", + "dev": true + }, + "globals": { + "version": "11.8.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.8.0.tgz", + "integrity": "sha512-io6LkyPVuzCHBSQV9fmOwxZkUk6nIaGmxheLDgmuFv89j0fm2aqDbIXKAGfzCMHqz3HLF2Zf8WSG6VqMh2qFmA==", + "dev": true + }, + "js-tokens": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "dev": true + } + } + }, + "@babel/types": { + "version": "7.0.0-beta.44", + "resolved": "http://registry.npmjs.org/@babel/types/-/types-7.0.0-beta.44.tgz", + "integrity": "sha512-5eTV4WRmqbaFM3v9gHAIljEQJU4Ssc6fxL61JN+Oe2ga/BwyjzjamwkCVVAQjHGuAX8i0BWo42dshL8eO5KfLQ==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.2.0", + "to-fast-properties": "^2.0.0" + }, + "dependencies": { + "to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", + "dev": true + } + } + }, "@webassemblyjs/ast": { "version": "1.7.10", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.7.10.tgz", @@ -412,51 +591,97 @@ } }, "app-builder-bin": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/app-builder-bin/-/app-builder-bin-2.1.4.tgz", - "integrity": "sha512-i5ZfZtnAQqVZXpFYpvkQK/V0p9RwJjCW7X3CRcyDrnR3p1mQRoRTMSfPrtGTo1ens7kTfzk2S2i0QXq+gEplLg==", + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/app-builder-bin/-/app-builder-bin-2.6.3.tgz", + "integrity": "sha512-JL8C41e6yGIchFsHP/q15aGNedAaUakLhkV6ER0Yxafx08sRnlDnlkAkEIKjX7edg/4i7swpGa6CBv1zX9GgCA==", "dev": true }, "app-builder-lib": { - "version": "20.29.0", - "resolved": "https://registry.npmjs.org/app-builder-lib/-/app-builder-lib-20.29.0.tgz", - "integrity": "sha512-pXIHWNdeQ+jqI5xv4L274YZo2AOSotXsH9/Q83+qgiAa62F/PIWgcd0LWWa//CD929+FrRFEgBq9sagh9uUTHw==", + "version": "20.38.5", + "resolved": "https://registry.npmjs.org/app-builder-lib/-/app-builder-lib-20.38.5.tgz", + "integrity": "sha512-vVgM9d9twwlhr+8vNAJOAD9dyVBRk7reuVa1BE1OmvaHb1M+fS8KpvcDKVdBqX9KDHy7zSc57mnIcHgax4/XMA==", "dev": true, "requires": { - "7zip-bin": "~4.0.2", - "app-builder-bin": "2.1.4", + "7zip-bin": "~4.1.0", + "app-builder-bin": "2.6.3", "async-exit-hook": "^2.0.1", - "bluebird-lst": "^1.0.5", - "builder-util": "7.0.0", - "builder-util-runtime": "5.0.0", + "bluebird-lst": "^1.0.6", + "builder-util": "9.6.2", + "builder-util-runtime": "8.1.1", "chromium-pickle-js": "^0.2.0", - "debug": "^4.1.0", + "debug": "^4.1.1", "ejs": "^2.6.1", "electron-osx-sign": "0.4.11", - "electron-publish": "20.29.0", - "fs-extra-p": "^4.6.1", + "electron-publish": "20.38.5", + "fs-extra-p": "^7.0.0", "hosted-git-info": "^2.7.1", - "is-ci": "^1.2.1", - "isbinaryfile": "^3.0.3", - "js-yaml": "^3.12.0", + "is-ci": "^2.0.0", + "isbinaryfile": "^4.0.0", + "js-yaml": "^3.12.1", "lazy-val": "^1.0.3", "minimatch": "^3.0.4", "normalize-package-data": "^2.4.0", "plist": "^3.0.1", - "read-config-file": "3.1.2", + "read-config-file": "3.2.1", "sanitize-filename": "^1.6.1", "semver": "^5.6.0", - "temp-file": "^3.1.3" + "temp-file": "^3.3.2" }, "dependencies": { + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "ci-info": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", + "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", + "dev": true + }, "debug": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.0.tgz", - "integrity": "sha512-heNPJUJIqC+xB6ayLAMHaIrmN9HKa7aQO8MGqKpvCA+uJYVcvR6l5kgdrhRuwPFHU7P5/A1w0BjByPHwpfTDKg==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", "dev": true, "requires": { "ms": "^2.1.1" } + }, + "is-ci": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", + "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", + "dev": true, + "requires": { + "ci-info": "^2.0.0" + } + }, + "isbinaryfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-4.0.0.tgz", + "integrity": "sha512-RBtmso6l2mCaEsUvXngMTIjg3oheXo0MgYzzfT6sk44RYggPnm9fT+cQJAmzRnJIxPHXg9FZglqDJGW28dvcqA==", + "dev": true + }, + "js-yaml": { + "version": "3.12.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.1.tgz", + "integrity": "sha512-um46hB9wNOKlwkHgiuyEVAybXBjwFUV0Z/RaHJblRd9DXltue9FTYvzCr9ErQrK9Adz5MU4gHWVaNUfdmrC8qA==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true } } }, @@ -1008,16 +1233,51 @@ } }, "babel-eslint": { - "version": "6.1.2", - "resolved": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-6.1.2.tgz", - "integrity": "sha1-UpNBn+NnLWZZjTJ9qWlFZ7pqXy8=", + "version": "8.2.6", + "resolved": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-8.2.6.tgz", + "integrity": "sha512-aCdHjhzcILdP8c9lej7hvXKvQieyRt20SF102SIGyY4cUIiw6UaAtK4j2o3dXX74jEmy0TJ0CEhv4fTIM3SzcA==", "dev": true, "requires": { - "babel-traverse": "^6.0.20", - "babel-types": "^6.0.19", - "babylon": "^6.0.18", - "lodash.assign": "^4.0.0", - "lodash.pickby": "^4.0.0" + "@babel/code-frame": "7.0.0-beta.44", + "@babel/traverse": "7.0.0-beta.44", + "@babel/types": "7.0.0-beta.44", + "babylon": "7.0.0-beta.44", + "eslint-scope": "3.7.1", + "eslint-visitor-keys": "^1.0.0" + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.0.0-beta.44", + "resolved": "http://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0-beta.44.tgz", + "integrity": "sha512-cuAuTTIQ9RqcFRJ/Y8PvTh+paepNcaGxwQwjIDRWPXmzzyAeCO4KqS9ikMvq0MCbRk6GlYKwfzStrcP3/jSL8g==", + "dev": true, + "requires": { + "@babel/highlight": "7.0.0-beta.44" + } + }, + "@babel/highlight": { + "version": "7.0.0-beta.44", + "resolved": "http://registry.npmjs.org/@babel/highlight/-/highlight-7.0.0-beta.44.tgz", + "integrity": "sha512-Il19yJvy7vMFm8AVAh6OZzaFoAd0hbkeMZiX3P5HGD+z7dyI7RzndHB0dg6Urh/VAFfHtpOIzDUSxmY6coyZWQ==", + "dev": true, + "requires": { + "chalk": "^2.0.0", + "esutils": "^2.0.2", + "js-tokens": "^3.0.0" + } + }, + "babylon": { + "version": "7.0.0-beta.44", + "resolved": "http://registry.npmjs.org/babylon/-/babylon-7.0.0-beta.44.tgz", + "integrity": "sha512-5Hlm13BJVAioCHpImtFqNOF2H3ieTOHd0fmFGMxOJ9jgeFqeAwsv3u5P5cR7CSeFrkgHsT19DgFJkHV0/Mcd8g==", + "dev": true + }, + "js-tokens": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "dev": true + } } }, "babel-generator": { @@ -1277,8 +1537,7 @@ "babel-plugin-syntax-dynamic-import": { "version": "6.18.0", "resolved": "https://registry.npmjs.org/babel-plugin-syntax-dynamic-import/-/babel-plugin-syntax-dynamic-import-6.18.0.tgz", - "integrity": "sha1-jWomIpyDdFqZgqRBBRVyyqF5sdo=", - "dev": true + "integrity": "sha1-jWomIpyDdFqZgqRBBRVyyqF5sdo=" }, "babel-plugin-syntax-exponentiation-operator": { "version": "6.13.0", @@ -1979,6 +2238,14 @@ } } }, + "base-x": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.5.tgz", + "integrity": "sha512-C3picSgzPSLE+jW3tcBzJoGwitOtazb5B+5YmAxZm2ybmTi9LNgAtDO/jjVEBZwHoXmDBZ9m/IELj3elJVRBcA==", + "requires": { + "safe-buffer": "^5.0.1" + } + }, "base64-arraybuffer": { "version": "0.1.5", "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz", @@ -2070,12 +2337,12 @@ "integrity": "sha512-dhHTWMI7kMx5whMQntl7Vr9C6BvV10lFXDAasnqnrMYhXVCzzk6IO9Fo2L75jXHT07WrOngL1WDXOp+yYS91Yg==" }, "bluebird-lst": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/bluebird-lst/-/bluebird-lst-1.0.5.tgz", - "integrity": "sha512-Ey0bDNys5qpYPhZ/oQ9vOEvD0TYQDTILMXWP2iGfvMg7rSDde+oV4aQQgqRH+CvBFNz2BSDQnPGMUl6LKBUUQA==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/bluebird-lst/-/bluebird-lst-1.0.6.tgz", + "integrity": "sha512-CBWFoPuUPpcvMUxfyr8DKdI5d4kjxFl1h39+VbKxP3KJWJHEsLtuT4pPLkjpxCGU6Ask21tvbnftWXdqIxYldQ==", "dev": true, "requires": { - "bluebird": "^3.5.1" + "bluebird": "^3.5.2" } }, "bluebird-lst-c": { @@ -2339,6 +2606,14 @@ "electron-to-chromium": "^1.2.7" } }, + "bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha1-vhYedsNU9veIrkBx9j806MTwpCo=", + "requires": { + "base-x": "^3.0.2" + } + }, "buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.2.1.tgz", @@ -2396,64 +2671,113 @@ "dev": true }, "builder-util": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/builder-util/-/builder-util-7.0.0.tgz", - "integrity": "sha512-GnszunK4uX1F8XP4U01m47VME0UQo97wM1i8h77j6+7V0xMz8faL9BHdv2O8/iOZ8HjfKSRJ+1v7RHohF6H0lA==", + "version": "9.6.2", + "resolved": "https://registry.npmjs.org/builder-util/-/builder-util-9.6.2.tgz", + "integrity": "sha512-cWl/0/Q851lesMmXp1IjreeAX1QAWA9e+iU2IT61oh+CvMYJnDwao2m9ZCHammdw2zllrwWu4fOC3gvsb/yOCw==", "dev": true, "requires": { - "7zip-bin": "~4.0.2", - "app-builder-bin": "2.1.4", - "bluebird-lst": "^1.0.5", - "builder-util-runtime": "^5.0.0", - "chalk": "^2.4.1", - "debug": "^4.1.0", - "fs-extra-p": "^4.6.1", - "is-ci": "^1.2.1", - "js-yaml": "^3.12.0", - "lazy-val": "^1.0.3", - "semver": "^5.6.0", - "source-map-support": "^0.5.9", + "7zip-bin": "~4.1.0", + "app-builder-bin": "2.6.3", + "bluebird-lst": "^1.0.6", + "builder-util-runtime": "^8.1.1", + "chalk": "^2.4.2", + "debug": "^4.1.1", + "fs-extra-p": "^7.0.0", + "is-ci": "^2.0.0", + "js-yaml": "^3.12.1", + "source-map-support": "^0.5.10", "stat-mode": "^0.2.2", - "temp-file": "^3.1.3" + "temp-file": "^3.3.2" }, "dependencies": { + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "ci-info": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", + "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", + "dev": true + }, "debug": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.0.tgz", - "integrity": "sha512-heNPJUJIqC+xB6ayLAMHaIrmN9HKa7aQO8MGqKpvCA+uJYVcvR6l5kgdrhRuwPFHU7P5/A1w0BjByPHwpfTDKg==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", "dev": true, "requires": { "ms": "^2.1.1" } }, + "is-ci": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", + "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", + "dev": true, + "requires": { + "ci-info": "^2.0.0" + } + }, + "js-yaml": { + "version": "3.12.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.1.tgz", + "integrity": "sha512-um46hB9wNOKlwkHgiuyEVAybXBjwFUV0Z/RaHJblRd9DXltue9FTYvzCr9ErQrK9Adz5MU4gHWVaNUfdmrC8qA==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, "source-map-support": { - "version": "0.5.9", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.9.tgz", - "integrity": "sha512-gR6Rw4MvUlYy83vP0vxoVNzM6t8MUXqNuRsuBmBHQDu1Fh6X015FrLdgoDKcNdkwGubozq0P4N0Q37UyFVr1EA==", + "version": "0.5.10", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.10.tgz", + "integrity": "sha512-YfQ3tQFTK/yzlGJuX8pTwa4tifQj4QS2Mj7UegOu8jAz59MqIiMGPXxQhVQiIMNzayuUSF/jEuVnfFF5JqybmQ==", "dev": true, "requires": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true } } }, "builder-util-runtime": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-5.0.0.tgz", - "integrity": "sha512-mTyLqmzdPzavKQNAfxcGu6kqaDiPCtFKJG+nNO9SYfL6lY7VgTUW+45iXhowc5ElmPj0eSTDaIGlScxVMwFUEA==", + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-8.1.1.tgz", + "integrity": "sha512-+ieS4PMB33vVE2S3ZNWBEQJ1zKmAs/agrBdh7XadE1lKLjrH4aXYuOh9OOGdxqIRldhlhNBaF+yKMMEFOdNVig==", "dev": true, "requires": { - "bluebird-lst": "^1.0.5", - "debug": "^4.1.0", - "fs-extra-p": "^4.6.1", + "bluebird-lst": "^1.0.6", + "debug": "^4.1.1", + "fs-extra-p": "^7.0.0", "sax": "^1.2.4" }, "dependencies": { "debug": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.0.tgz", - "integrity": "sha512-heNPJUJIqC+xB6ayLAMHaIrmN9HKa7aQO8MGqKpvCA+uJYVcvR6l5kgdrhRuwPFHU7P5/A1w0BjByPHwpfTDKg==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", "dev": true, "requires": { "ms": "^2.1.1" @@ -3076,11 +3400,6 @@ "wrap-ansi": "^2.0.0" } }, - "co": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" - }, "code-point-at": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", @@ -3884,6 +4203,105 @@ "integrity": "sha1-ojD2T1aDEOFJgAmUB5DsmVRbyn4=", "dev": true }, + "css-loader": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-2.1.0.tgz", + "integrity": "sha512-MoOu+CStsGrSt5K2OeZ89q3Snf+IkxRfAIt9aAKg4piioTrhtP1iEFPu+OVn3Ohz24FO6L+rw9UJxBILiSBw5Q==", + "dev": true, + "requires": { + "icss-utils": "^4.0.0", + "loader-utils": "^1.2.1", + "lodash": "^4.17.11", + "postcss": "^7.0.6", + "postcss-modules-extract-imports": "^2.0.0", + "postcss-modules-local-by-default": "^2.0.3", + "postcss-modules-scope": "^2.0.0", + "postcss-modules-values": "^2.0.0", + "postcss-value-parser": "^3.3.0", + "schema-utils": "^1.0.0" + }, + "dependencies": { + "big.js": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", + "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==", + "dev": true + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "loader-utils": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.2.3.tgz", + "integrity": "sha512-fkpz8ejdnEMG3s37wGL07iSBDg99O9D5yflE9RGNH3hRdx9SOwYfnGYdZOUIZitN8E+E2vkq3MUMYMvPYl5ZZA==", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^2.0.0", + "json5": "^1.0.1" + } + }, + "postcss": { + "version": "7.0.13", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.13.tgz", + "integrity": "sha512-h8SY6kQTd1wISHWjz+E6cswdhMuyBZRb16pSTv3W4zYZ3/YbyWeJdNUeOXB5IdZqE1U76OUEjjjqsC3z2f3hVg==", + "dev": true, + "requires": { + "chalk": "^2.4.2", + "source-map": "^0.6.1", + "supports-color": "^6.1.0" + } + }, + "schema-utils": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz", + "integrity": "sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g==", + "dev": true, + "requires": { + "ajv": "^6.1.0", + "ajv-errors": "^1.0.0", + "ajv-keywords": "^3.1.0" + } + }, + "supports-color": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", + "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, "css-select": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", @@ -3908,12 +4326,42 @@ } } }, + "css-selector-tokenizer": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/css-selector-tokenizer/-/css-selector-tokenizer-0.7.1.tgz", + "integrity": "sha512-xYL0AMZJ4gFzJQsHUKa5jiWWi2vH77WVNg7JYRyewwj6oPh4yb/y6Y9ZCw9dsj/9UauMhtuxR+ogQd//EdEVNA==", + "dev": true, + "requires": { + "cssesc": "^0.1.0", + "fastparse": "^1.1.1", + "regexpu-core": "^1.0.0" + }, + "dependencies": { + "regexpu-core": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-1.0.0.tgz", + "integrity": "sha1-hqdj9Y7k18L2sQLkdkBQ3n7ZDGs=", + "dev": true, + "requires": { + "regenerate": "^1.2.1", + "regjsgen": "^0.2.0", + "regjsparser": "^0.1.4" + } + } + } + }, "css-what": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.2.tgz", "integrity": "sha512-wan8dMWQ0GUeF7DGEPVjhHemVW/vy6xUYmFzRY8RYqgA0JtXC9rJmbScBjqSu6dg9q0lwPQy6ZAmJVr3PPTvqQ==", "dev": true }, + "cssesc": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-0.1.0.tgz", + "integrity": "sha1-yBSQPkViM3GgR3tAEJqq++6t27Q=", + "dev": true + }, "custom-event": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/custom-event/-/custom-event-1.0.1.tgz", @@ -4146,19 +4594,46 @@ "integrity": "sha1-zl15f5fib4vnvv9T99xA4cGp7Ew=" }, "dmg-builder": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/dmg-builder/-/dmg-builder-6.0.0.tgz", - "integrity": "sha512-nGeCoIctKP48QhohyQ6Uxx754XKyfVa5nx8YK6STIxTXoGTDWR/dwy8m4iCkM77//sd2wMdP9KYsUDuPxtbpLA==", + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/dmg-builder/-/dmg-builder-6.5.4.tgz", + "integrity": "sha512-EaEkF8weXez3iAwgYffjcYfumauUh5x+BggMgn/IuihNIA5/WfzRAUR4wMq9aII2zwArlw+rIrX6ZHKbmtkQmA==", "dev": true, "requires": { - "app-builder-lib": "~20.29.0", - "bluebird-lst": "^1.0.5", - "builder-util": "~7.0.0", - "fs-extra-p": "^4.6.1", + "app-builder-lib": "~20.38.5", + "bluebird-lst": "^1.0.6", + "builder-util": "~9.6.2", + "fs-extra-p": "^7.0.0", "iconv-lite": "^0.4.24", - "js-yaml": "^3.12.0", + "js-yaml": "^3.12.1", "parse-color": "^1.0.0", "sanitize-filename": "^1.6.1" + }, + "dependencies": { + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "js-yaml": { + "version": "3.12.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.1.tgz", + "integrity": "sha512-um46hB9wNOKlwkHgiuyEVAybXBjwFUV0Z/RaHJblRd9DXltue9FTYvzCr9ErQrK9Adz5MU4gHWVaNUfdmrC8qA==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + } } }, "dns-equal": { @@ -4270,9 +4745,9 @@ } }, "dotenv": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-6.1.0.tgz", - "integrity": "sha512-/veDn2ztgRlB7gKmE3i9f6CmDIyXAy6d5nBq+whO9SLX+Zs1sXEgFLPi+aSuWqUuusMfbi84fT8j34fs1HaYUw==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-6.2.0.tgz", + "integrity": "sha512-HygQCKUBSFl8wKQZBSemMywRWcEDNidvNbjGVyZu3nbZ8qq9ubiPoGLMdRDpfSrpkkm9BXYFkpKxxFX38o/76w==", "dev": true }, "dotenv-expand": { @@ -4354,24 +4829,24 @@ "dev": true }, "electron-builder": { - "version": "20.29.0", - "resolved": "https://registry.npmjs.org/electron-builder/-/electron-builder-20.29.0.tgz", - "integrity": "sha512-i1v5dD0u8tu5rq8Nq3DohEj/Gm7WKSysvlbeb5oCvmJ0YslbsQm/Iq6SGLTmJbXlYp3hoL3djuBaWC+oM2hagw==", + "version": "20.38.5", + "resolved": "https://registry.npmjs.org/electron-builder/-/electron-builder-20.38.5.tgz", + "integrity": "sha512-p88IDHhH2J4hA6KwRBJY+OfVZuFtFIShY3Uh/TwYAfbX0v1RhKZytuGdO8sty2zcWxDYX74xDBv+X9oN6qEIRQ==", "dev": true, "requires": { - "app-builder-lib": "20.29.0", - "bluebird-lst": "^1.0.5", - "builder-util": "7.0.0", - "builder-util-runtime": "5.0.0", - "chalk": "^2.4.1", - "dmg-builder": "6.0.0", - "fs-extra-p": "^4.6.1", - "is-ci": "^1.2.1", + "app-builder-lib": "20.38.5", + "bluebird-lst": "^1.0.6", + "builder-util": "9.6.2", + "builder-util-runtime": "8.1.1", + "chalk": "^2.4.2", + "dmg-builder": "6.5.4", + "fs-extra-p": "^7.0.0", + "is-ci": "^2.0.0", "lazy-val": "^1.0.3", - "read-config-file": "3.1.2", + "read-config-file": "3.2.1", "sanitize-filename": "^1.6.1", "update-notifier": "^2.5.0", - "yargs": "^12.0.2" + "yargs": "^12.0.5" }, "dependencies": { "ansi-regex": { @@ -4381,9 +4856,26 @@ "dev": true }, "camelcase": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", - "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.0.0.tgz", + "integrity": "sha512-faqwZqnWxbxn+F1d399ygeamQNy3lPp/H9H6rNrqYh4FSVCtcY+3cub1MxA8o9mDd55mM8Aghuu/kuyYA6VTsA==", + "dev": true + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "ci-info": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", + "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", "dev": true }, "cliui": { @@ -4397,13 +4889,19 @@ "wrap-ansi": "^2.0.0" } }, - "decamelize": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-2.0.0.tgz", - "integrity": "sha512-Ikpp5scV3MSYxY39ymh45ZLEecsTdv/Xj2CaQfI8RLMuwi7XvjX9H/fhraiSuU+C5w5NTDu4ZU72xNiZnurBPg==", + "execa": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", + "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", "dev": true, "requires": { - "xregexp": "4.0.0" + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" } }, "find-up": { @@ -4415,12 +4913,30 @@ "locate-path": "^3.0.0" } }, + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, "invert-kv": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz", "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==", "dev": true }, + "is-ci": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", + "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", + "dev": true, + "requires": { + "ci-info": "^2.0.0" + } + }, "is-fullwidth-code-point": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", @@ -4447,20 +4963,20 @@ } }, "os-locale": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.0.1.tgz", - "integrity": "sha512-7g5e7dmXPtzcP4bgsZ8ixDVqA7oWYuEz4lOSujeWyliPai4gfVDiFIcwBg3aGCPnmSGfzOKTK3ccPn0CKv3DBw==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz", + "integrity": "sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q==", "dev": true, "requires": { - "execa": "^0.10.0", + "execa": "^1.0.0", "lcid": "^2.0.0", "mem": "^4.0.0" } }, "p-limit": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.0.0.tgz", - "integrity": "sha512-fl5s52lI5ahKCernzzIyAP0QAZbGIovtVHGwpcu1Jr/EpzLVDI2myISHwGqK7m8uQFugVWSrbxH7XnhGtvEc+A==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.1.0.tgz", + "integrity": "sha512-NhURkNcrVB+8hNfLuysU8enY5xn2KXphsHBaC2YmRNTZRc7RWusw6apSpdEj3jo4CMb6W9nrF6tTnsJsJeyu6g==", "dev": true, "requires": { "p-try": "^2.0.0" @@ -4487,6 +5003,16 @@ "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", "dev": true }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, "string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", @@ -4513,13 +5039,13 @@ "dev": true }, "yargs": { - "version": "12.0.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.2.tgz", - "integrity": "sha512-e7SkEx6N6SIZ5c5H22RTZae61qtn3PYUE8JYbBFlK9sYmh3DMQ6E5ygtaG/2BW0JZi4WGgTR2IV5ChqlqrDGVQ==", + "version": "12.0.5", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.5.tgz", + "integrity": "sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw==", "dev": true, "requires": { "cliui": "^4.0.0", - "decamelize": "^2.0.0", + "decamelize": "^1.2.0", "find-up": "^3.0.0", "get-caller-file": "^1.0.1", "os-locale": "^3.0.0", @@ -4529,16 +5055,17 @@ "string-width": "^2.0.0", "which-module": "^2.0.0", "y18n": "^3.2.1 || ^4.0.0", - "yargs-parser": "^10.1.0" + "yargs-parser": "^11.1.1" } }, "yargs-parser": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz", - "integrity": "sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ==", + "version": "11.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-11.1.1.tgz", + "integrity": "sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ==", "dev": true, "requires": { - "camelcase": "^4.1.0" + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" } } } @@ -4793,18 +5320,37 @@ } }, "electron-publish": { - "version": "20.29.0", - "resolved": "https://registry.npmjs.org/electron-publish/-/electron-publish-20.29.0.tgz", - "integrity": "sha512-Kc5u5YaJLcGWPrp3bFk8NdrYk5gNVG4lZqbAIZnYNPuOLMCNgUk4UqrONO6iuAE6x/vWOoovszf1gGIT7G01UA==", + "version": "20.38.5", + "resolved": "https://registry.npmjs.org/electron-publish/-/electron-publish-20.38.5.tgz", + "integrity": "sha512-EhdPm6t0nKDfa0r3KjV1kSFcz03VrzgJRv7v5nHkkpQZB6OSmDNlHq7k66NBwQhPK3i4CK+uvehljZAP28vbCA==", "dev": true, "requires": { - "bluebird-lst": "^1.0.5", - "builder-util": "~7.0.0", - "builder-util-runtime": "^5.0.0", - "chalk": "^2.4.1", - "fs-extra-p": "^4.6.1", + "bluebird-lst": "^1.0.6", + "builder-util": "~9.6.2", + "builder-util-runtime": "^8.1.1", + "chalk": "^2.4.2", + "fs-extra-p": "^7.0.0", "lazy-val": "^1.0.3", - "mime": "^2.3.1" + "mime": "^2.4.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "mime": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.0.tgz", + "integrity": "sha512-ikBcWwyqXQSHKtciCcctu9YfPbFYZ4+gbHEmE0Q8jzcTYQg5dHCr3g2wwAZjPoJfQVXZq6KXAjpXOTf5/cjT7w==", + "dev": true + } } }, "electron-to-chromium": { @@ -5085,6 +5631,16 @@ "esutils": "^2.0.2" } }, + "eslint-scope": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.0.tgz", + "integrity": "sha512-1G6UTDi7Jc1ELFwnR58HV4fK9OQK4S6N985f166xqXxpjU6plxFISJa2Ba9KCQuFa8RCnj/lSFJbHo7UFDBnUA==", + "dev": true, + "requires": { + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + } + }, "glob": { "version": "7.1.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", @@ -5162,9 +5718,9 @@ } }, "eslint-scope": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.0.tgz", - "integrity": "sha512-1G6UTDi7Jc1ELFwnR58HV4fK9OQK4S6N985f166xqXxpjU6plxFISJa2Ba9KCQuFa8RCnj/lSFJbHo7UFDBnUA==", + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.1.tgz", + "integrity": "sha1-PWPD7f2gLgbgGkUq2IyqzHzctug=", "dev": true, "requires": { "esrecurse": "^4.1.0", @@ -5531,6 +6087,12 @@ "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", "dev": true }, + "fastparse": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/fastparse/-/fastparse-1.1.2.tgz", + "integrity": "sha512-483XLLxTVIwWK3QTrMGRqUfUpoOs/0hbQrl2oz4J0pAcm3A3bu84wxTFqGqkJzewCLdME38xJLJAxBABfQT8sQ==", + "dev": true + }, "favico.js": { "version": "0.3.10", "resolved": "https://registry.npmjs.org/favico.js/-/favico.js-0.3.10.tgz", @@ -5569,7 +6131,7 @@ "dependencies": { "core-js": { "version": "1.2.7", - "resolved": "http://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz", "integrity": "sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY=" } } @@ -5598,9 +6160,32 @@ "object-assign": "^4.0.1" } }, + "file-loader": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/file-loader/-/file-loader-3.0.1.tgz", + "integrity": "sha512-4sNIOXgtH/9WZq4NvlfU3Opn5ynUsqBwSLyM+I7UOwdGigTBYfVVQEwe/msZNX/j4pCJTIM14Fsw66Svo1oVrw==", + "dev": true, + "requires": { + "loader-utils": "^1.0.2", + "schema-utils": "^1.0.0" + }, + "dependencies": { + "schema-utils": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz", + "integrity": "sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g==", + "dev": true, + "requires": { + "ajv": "^6.1.0", + "ajv-errors": "^1.0.0", + "ajv-keywords": "^3.1.0" + } + } + } + }, "file-saver": { "version": "1.3.8", - "resolved": "http://registry.npmjs.org/file-saver/-/file-saver-1.3.8.tgz", + "resolved": "https://registry.npmjs.org/file-saver/-/file-saver-1.3.8.tgz", "integrity": "sha512-spKHSBQIxxS81N/O21WmuXA2F6wppUCsutpzenOeZzOCCJ5gEfcbqJP983IrpLXzYmXnMUa6J03SubcNPdKrlg==" }, "filename-regex": { @@ -5763,7 +6348,7 @@ }, "fbjs": { "version": "0.1.0-alpha.7", - "resolved": "http://registry.npmjs.org/fbjs/-/fbjs-0.1.0-alpha.7.tgz", + "resolved": "https://registry.npmjs.org/fbjs/-/fbjs-0.1.0-alpha.7.tgz", "integrity": "sha1-rUMIuPIy+zxzYDNJ6nJdHpw5Mjw=", "requires": { "core-js": "^1.0.0", @@ -5773,7 +6358,7 @@ }, "whatwg-fetch": { "version": "0.9.0", - "resolved": "http://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-0.9.0.tgz", + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-0.9.0.tgz", "integrity": "sha1-DjaExsuZlbQ+/J3wPkw2XZX9nMA=" } } @@ -5938,19 +6523,19 @@ } }, "fs-extra-p": { - "version": "4.6.1", - "resolved": "https://registry.npmjs.org/fs-extra-p/-/fs-extra-p-4.6.1.tgz", - "integrity": "sha512-IsTMbUS0svZKZTvqF4vDS9c/L7Mw9n8nZQWWeSzAGacOSe+8CzowhUN0tdZEZFIJNP5HC7L9j3MMikz/G4hDeQ==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/fs-extra-p/-/fs-extra-p-7.0.0.tgz", + "integrity": "sha512-5tg5jBOd0xIXjwj4PDnafOXL5TyPVzjxLby4DPKev53wurEXp7IsojBaD4Lj5M5w7jxw0pbkEU0fFEPmcKoMnA==", "dev": true, "requires": { - "bluebird-lst": "^1.0.5", - "fs-extra": "^6.0.1" + "bluebird-lst": "^1.0.6", + "fs-extra": "^7.0.0" }, "dependencies": { "fs-extra": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-6.0.1.tgz", - "integrity": "sha512-GnyIkKhhzXZUWFCaJzvyDLEEgDkPfb4/TPvJCJVuS8MWZgoSsErf++QpiAlDnKFcqhRlm+tIOcencCjyJE6ZCA==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", "dev": true, "requires": { "graceful-fs": "^4.1.2", @@ -6701,7 +7286,7 @@ }, "got": { "version": "6.7.1", - "resolved": "http://registry.npmjs.org/got/-/got-6.7.1.tgz", + "resolved": "https://registry.npmjs.org/got/-/got-6.7.1.tgz", "integrity": "sha1-JAzQV4WpoY5WHcG0S0HHY+8ejbA=", "dev": true, "requires": { @@ -6741,34 +7326,24 @@ "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" }, "har-validator": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz", - "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", + "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", "requires": { - "ajv": "^5.3.0", + "ajv": "^6.5.5", "har-schema": "^2.0.0" }, "dependencies": { "ajv": { - "version": "5.5.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", - "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.7.0.tgz", + "integrity": "sha512-RZXPviBTtfmtka9n9sy1N5M5b82CbxWIR6HIis4s3WQTXDJamc/0gpCWNGz6EWdWp4DOfjzJfhz/AS9zVPjjWg==", "requires": { - "co": "^4.6.0", - "fast-deep-equal": "^1.0.0", + "fast-deep-equal": "^2.0.1", "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.3.0" + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" } - }, - "fast-deep-equal": { - "version": "1.1.0", - "resolved": "http://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", - "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" - }, - "json-schema-traverse": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", - "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" } } }, @@ -6919,9 +7494,9 @@ } }, "hoist-non-react-statics": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.0.1.tgz", - "integrity": "sha512-1kXwPsOi0OGQIZNVMPvgWJ9tSnGMiMfJdihqEzrPEXlHOBh9AAHXX/QYmAJTXztnz/K+PQ8ryCb4eGaN6HlGbQ==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.2.1.tgz", + "integrity": "sha512-TFsu3TV3YLY+zFTZDrN8L2DTFanObwmBLpWvJs1qfUuEQ5bTAdFcwfx2T/bsCXfM9QHSLvjfP+nihEl0yvozxw==", "requires": { "react-is": "^16.3.2" } @@ -7412,6 +7987,65 @@ "safer-buffer": ">= 2.1.2 < 3" } }, + "icss-replace-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/icss-replace-symbols/-/icss-replace-symbols-1.1.0.tgz", + "integrity": "sha1-Bupvg2ead0njhs/h/oEq5dsiPe0=", + "dev": true + }, + "icss-utils": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/icss-utils/-/icss-utils-4.0.0.tgz", + "integrity": "sha512-bA/xGiwWM17qjllIs9X/y0EjsB7e0AV08F3OL8UPsoNkNRibIuu8f1eKTnQ8QO1DteKKTxTUAn+IEWUToIwGOA==", + "dev": true, + "requires": { + "postcss": "^7.0.5" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "postcss": { + "version": "7.0.13", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.13.tgz", + "integrity": "sha512-h8SY6kQTd1wISHWjz+E6cswdhMuyBZRb16pSTv3W4zYZ3/YbyWeJdNUeOXB5IdZqE1U76OUEjjjqsC3z2f3hVg==", + "dev": true, + "requires": { + "chalk": "^2.4.2", + "source-map": "^0.6.1", + "supports-color": "^6.1.0" + } + }, + "supports-color": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", + "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, "ieee754": { "version": "1.1.12", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.12.tgz", @@ -8463,27 +9097,27 @@ }, "dependencies": { "react": { - "version": "16.6.0", - "resolved": "https://registry.npmjs.org/react/-/react-16.6.0.tgz", - "integrity": "sha512-zJPnx/jKtuOEXCbQ9BKaxDMxR0001/hzxXwYxG8septeyYGfsgAei6NgfbVgOhbY1WOP2o3VPs/E9HaN+9hV3Q==", + "version": "16.7.0", + "resolved": "https://registry.npmjs.org/react/-/react-16.7.0.tgz", + "integrity": "sha512-StCz3QY8lxTb5cl2HJxjwLFOXPIFQp+p+hxQfc8WE0QiLfCtIlKj8/+5tjjKm8uSTlAW+fCPaavGFS06V9Ar3A==", "optional": true, "requires": { "loose-envify": "^1.1.0", "object-assign": "^4.1.1", "prop-types": "^15.6.2", - "scheduler": "^0.10.0" + "scheduler": "^0.12.0" } }, "react-dom": { - "version": "16.6.0", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.6.0.tgz", - "integrity": "sha512-Stm2D9dXEUUAQdvpvhvFj/DEXwC2PAL/RwEMhoN4dvvD2ikTlJegEXf97xryg88VIAU22ZAP7n842l+9BTz6+w==", + "version": "16.7.0", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.7.0.tgz", + "integrity": "sha512-D0Ufv1ExCAmF38P2Uh1lwpminZFRXEINJe53zRAbm4KPwSyd6DY/uDoS0Blj9jvPpn1+wivKpZYc8aAAN/nAkg==", "optional": true, "requires": { "loose-envify": "^1.1.0", "object-assign": "^4.1.1", "prop-types": "^15.6.2", - "scheduler": "^0.10.0" + "scheduler": "^0.12.0" } } } @@ -8544,12 +9178,6 @@ "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.11.tgz", "integrity": "sha512-DHb1ub+rMjjrxqlB3H56/6MXtm1lSksDp2rA2cNWjG8mlDUYFhUj3Di2Zn5IwSU87xLv8tNIQ7sSwE/YOX/D/Q==" }, - "lodash.assign": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz", - "integrity": "sha1-DZnzzNem0mHRm9rrkkUAXShYCOc=", - "dev": true - }, "lodash.clonedeep": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", @@ -8581,12 +9209,6 @@ "resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.1.tgz", "integrity": "sha512-eWw5r+PYICtEBgrBE5hhlT6aAa75f411bgDz/ZL2KZqYV03USvucsxcHUIlGTDTECs1eunpI7HOV7U+WLDvNdQ==" }, - "lodash.pickby": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/lodash.pickby/-/lodash.pickby-4.6.0.tgz", - "integrity": "sha1-feoh2MGNdwOifHBMFdO4SmfjOv8=", - "dev": true - }, "lodash.toarray": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.toarray/-/lodash.toarray-4.4.0.tgz", @@ -8702,13 +9324,15 @@ "dev": true }, "matrix-js-sdk": { - "version": "github:matrix-org/matrix-js-sdk#604af1ac8c180dcdddb761485eb03fad382bd06d", - "from": "github:matrix-org/matrix-js-sdk#develop", + "version": "0.14.2", + "resolved": "https://registry.npmjs.org/matrix-js-sdk/-/matrix-js-sdk-0.14.2.tgz", + "integrity": "sha512-6Wvzv3fKjlmNz/tqGlvBy2RouqyK8VfR2elXaJlFpPnSOiE6+CNeF8vJZC7Ch4e+/W3LDnpG6IIVZ55iMEULyg==", "requires": { "another-json": "^0.2.0", "babel-runtime": "^6.26.0", "bluebird": "^3.5.0", "browser-request": "^0.3.3", + "bs58": "^4.0.1", "content-type": "^1.0.2", "loglevel": "1.6.1", "qs": "^6.5.2", @@ -8726,9 +9350,11 @@ } }, "matrix-react-sdk": { - "version": "github:matrix-org/matrix-react-sdk#507bfb4b69c9d45ba8e1165e8865b0479fcb6d7c", - "from": "github:matrix-org/matrix-react-sdk#develop", + "version": "0.14.7", + "resolved": "https://registry.npmjs.org/matrix-react-sdk/-/matrix-react-sdk-0.14.7.tgz", + "integrity": "sha512-CbgX/OxdjvRKQ8TPzeJH0RD3kAMPk8lFxzmfgSzR9gWQ0bdXeBT6iadWQLe9dujjBviU1rMDl+Wy8NYgd8FmdQ==", "requires": { + "babel-plugin-syntax-dynamic-import": "^6.18.0", "babel-runtime": "^6.26.0", "bluebird": "^3.5.0", "blueimp-canvas-to-blob": "^3.5.0", @@ -8766,27 +9392,14 @@ "slate-react": "^0.18.10", "text-encoding-utf-8": "^1.0.1", "url": "^0.11.0", - "whatwg-fetch": "^1.1.1" + "whatwg-fetch": "^1.1.1", + "zxcvbn": "^4.4.2" }, "dependencies": { "gemini-scrollbar": { "version": "github:matrix-org/gemini-scrollbar#b302279810d05319ac5ff1bd34910bff32325c7b", "from": "github:matrix-org/gemini-scrollbar#b302279810d05319ac5ff1bd34910bff32325c7b" }, - "matrix-js-sdk": { - "version": "github:matrix-org/matrix-js-sdk#604af1ac8c180dcdddb761485eb03fad382bd06d", - "from": "github:matrix-org/matrix-js-sdk#604af1ac8c180dcdddb761485eb03fad382bd06d", - "requires": { - "another-json": "^0.2.0", - "babel-runtime": "^6.26.0", - "bluebird": "^3.5.0", - "browser-request": "^0.3.3", - "content-type": "^1.0.2", - "loglevel": "1.6.1", - "memfs": "^2.10.1", - "request": "^2.88.0" - } - }, "react-gemini-scrollbar": { "version": "github:matrix-org/react-gemini-scrollbar#5e97aef7e034efc8db1431f4b0efe3b26e249ae9", "from": "github:matrix-org/react-gemini-scrollbar#5e97aef7e034efc8db1431f4b0efe3b26e249ae9", @@ -8813,7 +9426,7 @@ }, "whatwg-fetch": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-1.1.1.tgz", "integrity": "sha1-rDydOfMgxtzlM5lp0FTvQ90zMxk=" } } @@ -8863,7 +9476,7 @@ }, "memoize-one": { "version": "3.1.1", - "resolved": "http://registry.npmjs.org/memoize-one/-/memoize-one-3.1.1.tgz", + "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-3.1.1.tgz", "integrity": "sha512-YqVh744GsMlZu6xkhGslPSqSurOv6P+kLN2J3ysBZfagLcL5FdRK/0UpgLoL8hwjjEvvAVkjJZyFP+1T6p1vgA==" }, "memory-fs": { @@ -9509,12 +10122,6 @@ "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==", "dev": true }, - "olm": { - "version": "3.0.0", - "resolved": "https://matrix.org/packages/npm/olm/olm-3.0.0.tgz", - "integrity": "sha512-gAJC+uQfDIJDtj7tNBu6qXA3Ldw4OXCshVCZNPMl1E9CTBD7Hj063IjFGVF6NBw6+nOYQDgMgQkoBtk5GyCyBw==", - "optional": true - }, "on-finished": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", @@ -9980,7 +10587,7 @@ "dependencies": { "async": { "version": "1.5.2", - "resolved": "http://registry.npmjs.org/async/-/async-1.5.2.tgz", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", "dev": true }, @@ -10174,6 +10781,222 @@ } } }, + "postcss-modules-extract-imports": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-2.0.0.tgz", + "integrity": "sha512-LaYLDNS4SG8Q5WAWqIJgdHPJrDDr/Lv775rMBFUbgjTz6j34lUznACHcdRWroPvXANP2Vj7yNK57vp9eFqzLWQ==", + "dev": true, + "requires": { + "postcss": "^7.0.5" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "postcss": { + "version": "7.0.13", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.13.tgz", + "integrity": "sha512-h8SY6kQTd1wISHWjz+E6cswdhMuyBZRb16pSTv3W4zYZ3/YbyWeJdNUeOXB5IdZqE1U76OUEjjjqsC3z2f3hVg==", + "dev": true, + "requires": { + "chalk": "^2.4.2", + "source-map": "^0.6.1", + "supports-color": "^6.1.0" + } + }, + "supports-color": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", + "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "postcss-modules-local-by-default": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/postcss-modules-local-by-default/-/postcss-modules-local-by-default-2.0.4.tgz", + "integrity": "sha512-WvuSaTKXUqYJbnT7R3YrsNrHv/C5vRfr5VglS4bFOk0MYT4CLBfc/xgExA+x2RftlYgiBDvWmVs191Xv8S8gZQ==", + "dev": true, + "requires": { + "css-selector-tokenizer": "^0.7.0", + "postcss": "^7.0.6", + "postcss-value-parser": "^3.3.1" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "postcss": { + "version": "7.0.13", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.13.tgz", + "integrity": "sha512-h8SY6kQTd1wISHWjz+E6cswdhMuyBZRb16pSTv3W4zYZ3/YbyWeJdNUeOXB5IdZqE1U76OUEjjjqsC3z2f3hVg==", + "dev": true, + "requires": { + "chalk": "^2.4.2", + "source-map": "^0.6.1", + "supports-color": "^6.1.0" + } + }, + "supports-color": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", + "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "postcss-modules-scope": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/postcss-modules-scope/-/postcss-modules-scope-2.0.1.tgz", + "integrity": "sha512-7+6k9c3/AuZ5c596LJx9n923A/j3nF3ormewYBF1RrIQvjvjXe1xE8V8A1KFyFwXbvnshT6FBZFX0k/F1igneg==", + "dev": true, + "requires": { + "css-selector-tokenizer": "^0.7.0", + "postcss": "^7.0.6" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "postcss": { + "version": "7.0.13", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.13.tgz", + "integrity": "sha512-h8SY6kQTd1wISHWjz+E6cswdhMuyBZRb16pSTv3W4zYZ3/YbyWeJdNUeOXB5IdZqE1U76OUEjjjqsC3z2f3hVg==", + "dev": true, + "requires": { + "chalk": "^2.4.2", + "source-map": "^0.6.1", + "supports-color": "^6.1.0" + } + }, + "supports-color": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", + "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "postcss-modules-values": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/postcss-modules-values/-/postcss-modules-values-2.0.0.tgz", + "integrity": "sha512-Ki7JZa7ff1N3EIMlPnGTZfUMe69FFwiQPnVSXC9mnn3jozCRBYIxiZd44yJOV2AmabOo4qFf8s0dC/+lweG7+w==", + "dev": true, + "requires": { + "icss-replace-symbols": "^1.1.0", + "postcss": "^7.0.6" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "postcss": { + "version": "7.0.13", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.13.tgz", + "integrity": "sha512-h8SY6kQTd1wISHWjz+E6cswdhMuyBZRb16pSTv3W4zYZ3/YbyWeJdNUeOXB5IdZqE1U76OUEjjjqsC3z2f3hVg==", + "dev": true, + "requires": { + "chalk": "^2.4.2", + "source-map": "^0.6.1", + "supports-color": "^6.1.0" + } + }, + "supports-color": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", + "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, "postcss-nested": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/postcss-nested/-/postcss-nested-3.0.0.tgz", @@ -10388,9 +11211,9 @@ "dev": true }, "psl": { - "version": "1.1.29", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", - "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==" + "version": "1.1.31", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.31.tgz", + "integrity": "sha512-/6pt4+C+T+wZUieKR620OpzN/LlnNKuWjy1iFLQ/UG35JqHlR/89MP1d96dUfkf6Dne3TuLQzOYEYshJ+Hx8mw==" }, "public-encrypt": { "version": "4.0.3", @@ -10474,9 +11297,9 @@ "dev": true }, "raf": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/raf/-/raf-3.4.0.tgz", - "integrity": "sha512-pDP/NMRAXoTfrhCfyfSEwJAKLaxBU9eApMeBPB1TkDouZmvPerIClV8lTAd+uF8ZiTaVl69e1FCxQrAd/VTjGw==", + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/raf/-/raf-3.4.1.tgz", + "integrity": "sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==", "requires": { "performance-now": "^2.1.0" } @@ -10559,12 +11382,6 @@ } } }, - "raw-loader": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/raw-loader/-/raw-loader-0.5.1.tgz", - "integrity": "sha1-DD0L6u2KAclm2Xh793goElKpeao=", - "dev": true - }, "rc": { "version": "1.2.8", "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", @@ -10644,9 +11461,9 @@ "integrity": "sha1-Aj1vObsVyXwHHp5g0A0TbqxfoLQ=" }, "react-is": { - "version": "16.6.0", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.6.0.tgz", - "integrity": "sha512-q8U7k0Fi7oxF1HvQgyBjPwDXeMplEsArnKt2iYhuIF86+GBbgLHdAmokL3XUFjTd7Q363OSNG55FOGUdONVn1g==" + "version": "16.7.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.7.0.tgz", + "integrity": "sha512-Z0VRQdF4NPDoI0tsXVMLkJLiwEBa+RP66g0xDHxgxysxSoCUccSten4RTF/UFvZF1dZvZ9Zu1sx+MDXwcOR34g==" }, "react-lifecycles-compat": { "version": "3.0.4", @@ -10671,12 +11488,12 @@ } }, "react-redux": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-5.1.0.tgz", - "integrity": "sha512-CRMpEx8+ccpoVxQrQDkG1obExNYpj6dZ1Ni7lUNFB9wcxOhy02tIqpFo4IUXc0kYvCGMu6ABj9A4imEX2VGZJQ==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-5.1.1.tgz", + "integrity": "sha512-LE7Ned+cv5qe7tMV5BPYkGQ5Lpg8gzgItK07c67yHvJ8t0iaD9kPFPAli/mYkiyJYrs2pJgExR2ZgsGqlrOApg==", "requires": { "@babel/runtime": "^7.1.2", - "hoist-non-react-statics": "^3.0.0", + "hoist-non-react-statics": "^3.1.0", "invariant": "^2.2.4", "loose-envify": "^1.1.0", "prop-types": "^15.6.1", @@ -10694,30 +11511,67 @@ } }, "read-config-file": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/read-config-file/-/read-config-file-3.1.2.tgz", - "integrity": "sha512-QCATYzlYHvmWps/W/eP7rcKuhYRYZg5XKeXFxSJRIXvn+KSw1+Ntz2et1aBz5TrEpawGrxWZ7zBipj+/v0xwWQ==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/read-config-file/-/read-config-file-3.2.1.tgz", + "integrity": "sha512-yW4hZZXdNN+Paij5JVAiTv1lUsAN5QRBU5NqotQqwYdVkUczSmDzm66VLu0eojiZt2zFeYptTFDAYlalDGuHdA==", "dev": true, "requires": { - "ajv": "^6.5.2", + "ajv": "^6.7.0", "ajv-keywords": "^3.2.0", - "bluebird-lst": "^1.0.5", - "dotenv": "^6.0.0", + "bluebird-lst": "^1.0.6", + "dotenv": "^6.2.0", "dotenv-expand": "^4.2.0", - "fs-extra-p": "^4.6.1", - "js-yaml": "^3.12.0", - "json5": "^1.0.1", + "fs-extra-p": "^7.0.0", + "js-yaml": "^3.12.1", + "json5": "^2.1.0", "lazy-val": "^1.0.3" }, "dependencies": { + "ajv": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.7.0.tgz", + "integrity": "sha512-RZXPviBTtfmtka9n9sy1N5M5b82CbxWIR6HIis4s3WQTXDJamc/0gpCWNGz6EWdWp4DOfjzJfhz/AS9zVPjjWg==", + "dev": true, + "requires": { + "fast-deep-equal": "^2.0.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "js-yaml": { + "version": "3.12.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.1.tgz", + "integrity": "sha512-um46hB9wNOKlwkHgiuyEVAybXBjwFUV0Z/RaHJblRd9DXltue9FTYvzCr9ErQrK9Adz5MU4gHWVaNUfdmrC8qA==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, "json5": { - "version": "1.0.1", - "resolved": "http://registry.npmjs.org/json5/-/json5-1.0.1.tgz", - "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.0.tgz", + "integrity": "sha512-8Mh9h6xViijj36g7Dxi+Y4S6hNGV96vcJZr/SrlHh1LR/pEn/8j/+qIBbs44YKl69Lrfctp4QD+AdWLTMqEZAQ==", "dev": true, "requires": { "minimist": "^1.2.0" } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true } } }, @@ -11231,7 +12085,7 @@ }, "htmlparser2": { "version": "3.3.0", - "resolved": "http://registry.npmjs.org/htmlparser2/-/htmlparser2-3.3.0.tgz", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.3.0.tgz", "integrity": "sha1-zHDQWln2VC5D8OaFyYLhTJJKnv4=", "dev": true, "requires": { @@ -11249,7 +12103,7 @@ }, "readable-stream": { "version": "1.0.34", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", "dev": true, "requires": { @@ -11358,9 +12212,9 @@ "integrity": "sha1-79qpjqdFEyTQkrKyFjpqHXqaIUc=" }, "resize-observer-polyfill": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.0.tgz", - "integrity": "sha512-M2AelyJDVR/oLnToJLtuDJRBBWUGUvvGigj1411hXhAdyFWqMaqHp7TixW3FpiLuVaikIcR1QL+zqoJoZlOgpg==" + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz", + "integrity": "sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg==" }, "resolve": { "version": "1.8.1", @@ -11536,9 +12390,9 @@ "dev": true }, "scheduler": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.10.0.tgz", - "integrity": "sha512-+TSTVTCBAA3h8Anei3haDc1IRwMeDmtI/y/o3iBe3Mjl2vwYF9DtPDt929HyRmV/e7au7CLu8sc4C4W0VOs29w==", + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.12.0.tgz", + "integrity": "sha512-t7MBR28Akcp4Jm+QoR63XgAi9YgCUmgvDHqf5otgAj4QvdoBE4ImCX0ffehefePPG+aitiYHp0g/mW6s4Tp+dw==", "optional": true, "requires": { "loose-envify": "^1.1.0", @@ -11791,17 +12645,17 @@ } }, "slate-base64-serializer": { - "version": "0.2.77", - "resolved": "https://registry.npmjs.org/slate-base64-serializer/-/slate-base64-serializer-0.2.77.tgz", - "integrity": "sha512-EZ5XpKf7l2mYIzbB0rdExAZ5FPgm252hmDtR5wTBY5m79ekw/xc016HxJrlg0HufMQKcRsQtuEhBRrwyLiWuag==", + "version": "0.2.94", + "resolved": "https://registry.npmjs.org/slate-base64-serializer/-/slate-base64-serializer-0.2.94.tgz", + "integrity": "sha512-jltk0PwOS1lu/TRHTN/qW67+VSXlbX1d0GottPloKjYwHBbH47GVT/G+hmkOdrGXzV7P6220BvQwN8Xq2RaJ5A==", "requires": { "isomorphic-base64": "^1.0.2" } }, "slate-dev-environment": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/slate-dev-environment/-/slate-dev-environment-0.2.0.tgz", - "integrity": "sha512-xxh3ThUSHYDwRUaywRQeOySJFI1kU4mYw9uDUbjk3VTpt0BHCFufHkCU5f22U8HyP7b2nDVFwfyXg1Q0o+Ksag==", + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/slate-dev-environment/-/slate-dev-environment-0.2.1.tgz", + "integrity": "sha512-mPWPKnL9ptWV7ndNoJIi4URIKNpoSDUh+v7o/0ecMBS4sJLW1EY4VTZyhK3Dy829hcsXYmtXSzhdmQBvPEid6Q==", "requires": { "is-in-browser": "^1.1.3" } @@ -11817,12 +12671,12 @@ "integrity": "sha512-QdXa+qmOG46VrTfnzn2gUVzs1WiO3Q+zCv3XomzMNGdgAJjCgHBs3jaeQD845h15loS3OJ181gCNAkB3dby6Hw==" }, "slate-hotkeys": { - "version": "0.2.7", - "resolved": "https://registry.npmjs.org/slate-hotkeys/-/slate-hotkeys-0.2.7.tgz", - "integrity": "sha512-k6iaR24w15CSM24jbi6My4WD2ePw4Byn8x3ARz3UtKrfSEO4F8Er/aPxegLhBujNE9u041uBMGeua44rlhemkw==", + "version": "0.2.8", + "resolved": "https://registry.npmjs.org/slate-hotkeys/-/slate-hotkeys-0.2.8.tgz", + "integrity": "sha512-9d8hkXYGcuPMPxC3LvdhXZQGWMs0LISe3uKGp1dHandPNxffqxDHcgTJSYtUDyxM4Dve4eJByJQ4oBbYawUGDw==", "requires": { "is-hotkey": "0.1.4", - "slate-dev-environment": "^0.2.0" + "slate-dev-environment": "^0.2.1" } }, "slate-html-serializer": { @@ -11835,9 +12689,9 @@ } }, "slate-plain-serializer": { - "version": "0.6.16", - "resolved": "https://registry.npmjs.org/slate-plain-serializer/-/slate-plain-serializer-0.6.16.tgz", - "integrity": "sha512-swQAe2ehGhsJWSOyGsmLWs/JSya5k8ipwOHpW1fy1hb1sU8BnU/0y9PMxGPCbpUugbSCFURmm6MPlj04Tc1/sg==" + "version": "0.6.33", + "resolved": "https://registry.npmjs.org/slate-plain-serializer/-/slate-plain-serializer-0.6.33.tgz", + "integrity": "sha512-dkbWQvB9FA/qN3HfkQ++xksaBHZsa6NCBG42OV70Y2wLSjN7Ym8NzQMR4bb5i67kL+ko+TXJ0Qg2sNiOEATCNQ==" }, "slate-prop-types": { "version": "0.4.67", @@ -11866,9 +12720,9 @@ }, "dependencies": { "memoize-one": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-4.0.2.tgz", - "integrity": "sha512-ucx2DmXTeZTsS4GPPUZCbULAN7kdPT1G+H49Y34JjbQ5ESc6OGhVxKvb1iKhr9v19ZB9OtnHwNnhUnNR/7Wteg==" + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-4.0.3.tgz", + "integrity": "sha512-QmpUu4KqDmX0plH4u+tf0riMc1KHE1+lw95cMrLlXQAFOx/xnBtwhZ52XJxd9X2O6kwKBqX32kmhbhlobD0cuw==" } } }, @@ -12335,9 +13189,9 @@ } }, "sprintf-js": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.1.tgz", - "integrity": "sha1-Nr54Mgr+WAH2zqPueLblqrlA6gw=" + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.2.tgz", + "integrity": "sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==" }, "srcset": { "version": "1.0.0", @@ -12349,9 +13203,9 @@ } }, "sshpk": { - "version": "1.15.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.15.1.tgz", - "integrity": "sha512-mSdgNUaidk+dRU5MhYtN9zebdzF2iG0cNPWy8HG+W8y+fT1JnSkh0fzzpjOa0L7P8i1Rscz38t0h4gPcKz43xA==", + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.0.tgz", + "integrity": "sha512-Zhev35/y7hRMcID/upReIvRse+I9SVhyVre/KTJSJQWMz3C3+G+HpO7m1wK/yckEtujKZ7dS4hkVxAnmHaIGVQ==", "requires": { "asn1": "~0.2.3", "assert-plus": "^1.0.0", @@ -12679,15 +13533,14 @@ } }, "temp-file": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/temp-file/-/temp-file-3.1.3.tgz", - "integrity": "sha512-oz2J77loDE9sGrlRTqBzwbsUvoBD2BpyXeaRPKyGwBIwaamSs2jdqAfhutw7Tch9llr1u8E2ruoug09rNPa3PA==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/temp-file/-/temp-file-3.3.2.tgz", + "integrity": "sha512-FGKccAW0Mux9hC/2bdUIe4bJRv4OyVo4RpVcuplFird1V/YoplIFbnPZjfzbJSf/qNvRZIRB9/4n/RkI0GziuQ==", "dev": true, "requires": { "async-exit-hook": "^2.0.1", - "bluebird-lst": "^1.0.5", - "fs-extra-p": "^4.6.1", - "lazy-val": "^1.0.3" + "bluebird-lst": "^1.0.6", + "fs-extra-p": "^7.0.0" } }, "term-size": { @@ -13495,6 +14348,16 @@ "ms": "2.0.0" } }, + "eslint-scope": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.0.tgz", + "integrity": "sha512-1G6UTDi7Jc1ELFwnR58HV4fK9OQK4S6N985f166xqXxpjU6plxFISJa2Ba9KCQuFa8RCnj/lSFJbHo7UFDBnUA==", + "dev": true, + "requires": { + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + } + }, "expand-brackets": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", @@ -14060,7 +14923,7 @@ "dependencies": { "pify": { "version": "2.3.0", - "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true } @@ -14347,9 +15210,9 @@ } }, "write-file-atomic": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.3.0.tgz", - "integrity": "sha512-xuPeK4OdjWqtfi59ylvVL0Yn35SF3zgcAcv7rBPFHVaEapaDr4GdGgm3j7ckTwH9wHL7fGmgfAnb0+THrHb8tA==", + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.4.2.tgz", + "integrity": "sha512-s0b6vB3xIVRLWywa6X9TOMA7k9zio0TMOsl9ZnDkliA/cfJlpHXAscj0gbHVJiTdIuAYpIyqS5GW91fqm6gG5g==", "dev": true, "requires": { "graceful-fs": "^4.1.11", @@ -14376,7 +15239,7 @@ }, "xmlbuilder": { "version": "9.0.7", - "resolved": "http://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=", "dev": true }, @@ -14476,6 +15339,11 @@ } } } + }, + "zxcvbn": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/zxcvbn/-/zxcvbn-4.4.2.tgz", + "integrity": "sha1-KOwXzwl0PtyrBW3dixsGJizHPDA=" } } } diff --git a/package.json b/package.json index 4adbf57c00..f63f57a2db 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "riot-web", "productName": "Riot", "main": "electron_app/src/electron-main.js", - "version": "0.17.5", + "version": "0.17.9", "description": "A feature-rich client for Matrix.org", "author": "New Vector Ltd.", "repository": { @@ -33,8 +33,8 @@ "build:res": "node scripts/copy-res.js", "build:modernizr": "modernizr -c .modernizr.json -d src/vector/modernizr.js", "build:compile": "npm run reskindex && babel --source-maps -d lib src", - "build:bundle": "cross-env NODE_ENV=production webpack-cli -p --progress --bail --mode production", - "build:bundle:dev": "webpack-cli --progress --bail --mode development", + "build:bundle": "cross-env NODE_ENV=production webpack -p --progress --bail --mode production", + "build:bundle:dev": "webpack --progress --bail --mode development", "build:electron": "npm run clean && npm run build && npm run install:electron && build -wml --ia32 --x64", "build:react-sdk": "node scripts/npm-sub.js matrix-react-sdk run build", "build:js-sdk": "node scripts/npm-sub.js matrix-js-sdk run start:init", @@ -70,8 +70,8 @@ "gemini-scrollbar": "github:matrix-org/gemini-scrollbar#b302279", "gfm.css": "^1.1.2", "highlight.js": "^9.13.1", - "matrix-js-sdk": "matrix-org/matrix-js-sdk#develop", - "matrix-react-sdk": "matrix-org/matrix-react-sdk#develop", + "matrix-js-sdk": "0.14.3", + "matrix-react-sdk": "0.14.8", "modernizr": "^3.6.0", "prop-types": "^15.6.2", "react": "^15.6.0", @@ -84,7 +84,7 @@ "autoprefixer": "^6.6.0", "babel-cli": "^6.26.0", "babel-core": "^6.26.3", - "babel-eslint": "^6.1.2", + "babel-eslint": "^8.1.1", "babel-loader": "^7.1.5", "babel-plugin-add-module-exports": "^0.2.1", "babel-plugin-transform-async-to-bluebird": "^1.1.1", @@ -100,7 +100,8 @@ "concurrently": "^4.0.1", "cpx": "^1.3.2", "cross-env": "^4.0.0", - "electron-builder": "^20.29.0", + "css-loader": "^2.1.0", + "electron-builder": "^20.38.5", "electron-builder-squirrel-windows": "^11.6.1", "electron-devtools-installer": "^2.2.4", "emojione": "^2.2.7", @@ -110,6 +111,7 @@ "eslint-plugin-flowtype": "^2.50.3", "eslint-plugin-react": "^7.11.1", "expect": "^1.16.0", + "file-loader": "^3.0.1", "fs-extra": "^0.30.0", "html-webpack-plugin": "^3.2.0", "json-loader": "^0.5.3", @@ -136,7 +138,6 @@ "postcss-scss": "^1.0.6", "postcss-simple-vars": "^4.1.0", "postcss-strip-inline-comments": "^0.1.5", - "raw-loader": "^0.5.1", "react-addons-perf": "^15.4.0", "react-addons-test-utils": "^15.6.0", "rimraf": "^2.4.3", @@ -146,18 +147,19 @@ "webpack-dev-server": "^3.1.10" }, "optionalDependencies": { - "olm": "https://matrix.org/packages/npm/olm/olm-3.0.0.tgz" + "olm": "https://matrix.org/packages/npm/olm/olm-3.1.0-pre1.tgz" }, "build": { "appId": "im.riot.app", - "electronVersion": "3.0.5", + "electronVersion": "4.0.1", "files": [ "node_modules/**", "src/**", "img/**" ], "extraResources": [ - "webapp/**/*" + "webapp/**/*", + "origin_migrator/**/*" ], "linux": { "target": "deb", diff --git a/release.sh b/release.sh index b5bdb010ce..67869bc3c9 100755 --- a/release.sh +++ b/release.sh @@ -47,4 +47,4 @@ git commit package.json -m "$tag" cd .. -exec ./node_modules/matrix-js-sdk/release.sh -z "$orig_args" +exec ./node_modules/matrix-js-sdk/release.sh -u vector-im -z "$orig_args" diff --git a/res/home.html b/res/home.html index 934e491ecd..7819d2e18c 100644 --- a/res/home.html +++ b/res/home.html @@ -4,289 +4,197 @@ * voodoo where we have to set display: none by default */ -.mx_HomePage_header h1 { - margin-left: 0px; - margin-bottom: 0px; - margin-top: 20px; - margin-right: 20px; - color: #454545; +h1::after { + content: "!"; } -.mx_HomePage_header h2 { - margin-left: 0px; - margin-top: 5px; - margin-bottom: 20px; - margin-right: 20px; - color: #454545; -} - -.mx_HomePage_header h1 a { - color: #454545; -} - -.mx_HomePage h3 { - margin-top: 30px; -} - -.mx_HomePage_header { - border: 1px solid #76CFA6; - background-color: #eaf5f0; - border-radius: 5px; - align-items: center; -} - -.mx_HomePage_col { +.mx_HomePage_body { display: flex; - flex-direction: row; + flex-direction: column; + justify-content: center; + height: 100%; } -.mx_HomePage_toprow { - flex-wrap: wrap; +.mx_Parent { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + -ms-flex-direction: column; + flex-direction: column; + -webkit-box-pack: center; + -webkit-justify-content: center; + -ms-flex-pack: center; + justify-content: center; + -webkit-box-align: center; + -webkit-align-items: center; + -ms-flex-align: center; + align-items: center; + text-align: center; + margin-bottom: 50px; } -.mx_HomePage_row { - flex: 1 1 0; - margin-right: 20px; +.mx_Well { + display: block; + -webkit-box-pack: center; + -webkit-justify-content: center; + -ms-flex-pack: center; + justify-content: center; + -webkit-flex-wrap: wrap; + -ms-flex-wrap: wrap; + flex-wrap: wrap; + -webkit-box-align: center; + -webkit-align-items: center; + -ms-flex-align: center; + align-items: center; + border-radius: 10px; + background-color: #F2F5F8; +} + +.mx_ButtonParent { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + padding: 10px 20px; + -webkit-box-orient: horizontal; + -webkit-box-direction: normal; + -webkit-flex-direction: row; + -ms-flex-direction: row; + flex-direction: row; + -webkit-box-pack: center; + -webkit-justify-content: center; + -ms-flex-pack: center; + justify-content: center; + -webkit-box-align: center; + -webkit-align-items: center; + -ms-flex-align: center; + align-items: center; + border-radius: 4px; + width: 150px; + background-repeat: no-repeat; + background-position: 10px center; + text-decoration: none; + color: #2e2f32 !important; +} + +.mx_ButtonRow { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + width: 480px; + -webkit-justify-content: space-around; + -ms-flex-pack: distribute; + justify-content: space-around; + -webkit-box-align: center; + -webkit-align-items: center; + -ms-flex-align: center; + align-items: center; + justify-content: space-between; + padding: 0 40px; + box-sizing: border-box; + margin: 28px 0; +} + +.mx_ButtonRow_guest { + display: none; +} + +/* mx_HomePage_guest is set on the `HomePage` component for guest users */ +.mx_HomePage_guest .mx_ButtonRow_guest { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; display: flex; - flex-direction: row; - flex-wrap: wrap; } -.mx_HomePage_logo { - margin-top: 20px; - margin-left: 40px; - margin-right: 40px; - margin-bottom: 20px; - display: inline; - height: 100px; +.mx_buttonheadline { + margin-bottom: 14px; } -.mx_HomePage_room { - cursor: pointer; - float: left; - text-decoration: none; - text-align: center; - padding-left: 10px; - padding-right: 10px; - width: 120px; +.mx_buttonlabel { + margin-left: 20px; } -.mx_HomePage_toprow .mx_HomePage_room { - width: 64px; +.mx_buttonwrappertext { + font-size: 13px; + margin-bottom: 10px; } - -.mx_HomePage_room .mx_HomePage_icon { - border-radius: 50%; - width: 64px; - height: 64px; +.mx_Header2 { + font-size: 32px; + font-weight: 600; + margin-top: 40px; } -.mx_HomePage_room .mx_HomePage_name { - display: block; +.mx_Header22 { + font-size: 14px; + font-weight: 200; + margin-bottom: 40px; } -.mx_HomePage_room .mx_HomePage_desc { - display: block; - font-size: 12px; - margin-top: 8px; +.mx_ButtonSignIn { + background-color: #368BD6; + color: white !important; } -.mx_HomePage_comment { - display: flex; - align-items: center; - margin-left: 100px; - min-height: 64px; +.mx_ButtonCreateAccount { + background-color: #03B381; + color: white !important; } -.mx_HomePage_container h3::after, -.mx_HomePage_container h4::after { - content: ":"; +.mx_secondarybutton { + background-color: #FFFFFF; + color: #2E2F32; } -.mx_HomePage_container { - display: block ! important; - margin: 20px; +.mx_Button_iconSignIn { + background-image: url('home/images/icon-sign-in.svg'); +} +.mx_Button_iconCreateAccount { + background-image: url('home/images/icon-create-account.svg'); +} +.mx_Button_iconHelp { + background-image: url('home/images/icon-help.svg'); +} +.mx_Button_iconRoomDirectory { + background-image: url('home/images/icon-room-directory.svg'); } -.mx_HomePage_container h1, -.mx_HomePage_container h2, -.mx_HomePage_container h3, -.mx_HomePage_container h4 { - font-weight: 600; -} -
-
- -
-

_t("Welcome to Riot.im")

-

_t("Decentralised, encrypted chat & collaboration powered by [matrix]")

+
+ + + +

_t("Welcome to Riot.im")

+

_t("Decentralised, encrypted chat & collaboration powered by [matrix]")

+ -
-
-
-

_t("Search the room directory")

- - +
+
+
_t("Need help?")
+
+
_t("Chat with Riot Bot")
- - _t("Lots of rooms already exist in Matrix, linked to existing networks (Slack, IRC, Gitter etc) or independent. Check out the directory!") -
-
-
-
-

_t("Chat with Riot Bot")

- - +
+
_t("Explore rooms")
+
+
_t("Room Directory")
- - _t("Get started with some tips from Riot Bot!") -
- -

_t("General discussion about Matrix and Riot")

- -
-
- - - Matrix HQ - - _t("Discussion of all things Matrix!") -
-
- - - Riot - - _t("Riot/Web & Desktop chat") -
-
- - - #riot-ios - - _t("Riot/iOS & matrix-ios-sdk chat") -
-
- - - #riot-android - - _t("Riot/Android & matrix-android-sdk chat") -
-
- -

_t("Matrix technical discussions")

-

_t("Running Matrix services")

- -
-
- - - Synapse Support Community - - _t("Community-run support for Synapse") -
-
- - - #dendrite:matrix.org - - _t("Admin support for Dendrite") -
-
- - - Synapse Homeowners - - _t("Announcements about Synapse releases") -
-
- - - IRC Matrix Bridges - - _t("Support for those using and running matrix-appservice-irc") -
-
- -

_t("Building services on Matrix")

- -
-
- - - #matrix-dev:matrix.org - - _t("Support for those using the Matrix spec") -
-
- - - End-to-end crypto in Matrix - - _t("Design and implementation of E2E in Matrix") -
-
- - - #vr:matrix.org - - _t("Implementing VR services with Matrix") -
-
- - - #webrtc:matrix.org - - _t("Implementing VoIP services with Matrix") -
-
- - - Matrix Identity - - _t("Discussion of the Identity Service API") -
-
- - - Matrix Bridging - - _t("Support for those using, running and writing other bridges") -
-
- -

_t("Contributing code to Matrix and Riot")

- -
-
- - - #riot-dev - - _t("Dev chat for the Riot/Web dev team") -
-
- - - #dendrite-dev - - _t("Dev chat for the Dendrite dev team") -
-
- - - Riot Translations - - _t("Co-ordination for Riot translators") -
-
diff --git a/res/home/images/icon-create-account.svg b/res/home/images/icon-create-account.svg new file mode 100644 index 0000000000..c9d25f2fa9 --- /dev/null +++ b/res/home/images/icon-create-account.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/res/home/images/icon-help.svg b/res/home/images/icon-help.svg new file mode 100644 index 0000000000..dc96f8e0cf --- /dev/null +++ b/res/home/images/icon-help.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/res/home/images/icon-room-directory.svg b/res/home/images/icon-room-directory.svg new file mode 100644 index 0000000000..6f888611f1 --- /dev/null +++ b/res/home/images/icon-room-directory.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/res/home/images/icon-sign-in.svg b/res/home/images/icon-sign-in.svg new file mode 100644 index 0000000000..584b2f0add --- /dev/null +++ b/res/home/images/icon-sign-in.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/res/home/images/icons-directory.svg b/res/home/images/icons-directory.svg new file mode 100644 index 0000000000..2688b84713 --- /dev/null +++ b/res/home/images/icons-directory.svg @@ -0,0 +1,24 @@ + + + + icons_directory + Created with Sketch. + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/res/home/images/logo.svg b/res/home/images/logo.svg index a5f70e5e4c..79039b70d0 100644 --- a/res/home/images/logo.svg +++ b/res/home/images/logo.svg @@ -1,76 +1,16 @@ - - - - -New_logo - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + diff --git a/res/themes/riot/img/backgrounds/valley.jpg b/res/themes/riot/img/backgrounds/valley.jpg new file mode 100644 index 0000000000..4779c9d7cf Binary files /dev/null and b/res/themes/riot/img/backgrounds/valley.jpg differ diff --git a/res/themes/riot/img/logos/riot-im-logo-1.png b/res/themes/riot/img/logos/riot-im-logo-1.png deleted file mode 100644 index 768679da66..0000000000 Binary files a/res/themes/riot/img/logos/riot-im-logo-1.png and /dev/null differ diff --git a/res/themes/riot/img/logos/riot-im-logo-1.svg b/res/themes/riot/img/logos/riot-im-logo-1.svg deleted file mode 100644 index a806c3bfda..0000000000 --- a/res/themes/riot/img/logos/riot-im-logo-1.svg +++ /dev/null @@ -1,158 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/res/themes/riot/img/logos/riot-im-logo-2.svg b/res/themes/riot/img/logos/riot-im-logo-2.svg deleted file mode 100644 index f9cc92f13b..0000000000 --- a/res/themes/riot/img/logos/riot-im-logo-2.svg +++ /dev/null @@ -1,165 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/res/themes/riot/img/logos/riot-im-logo-3.svg b/res/themes/riot/img/logos/riot-im-logo-3.svg deleted file mode 100644 index 7f81dacd72..0000000000 --- a/res/themes/riot/img/logos/riot-im-logo-3.svg +++ /dev/null @@ -1,173 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/res/themes/riot/img/logos/riot-im-logo-4.svg b/res/themes/riot/img/logos/riot-im-logo-4.svg deleted file mode 100644 index 307868e604..0000000000 --- a/res/themes/riot/img/logos/riot-im-logo-4.svg +++ /dev/null @@ -1,185 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/res/themes/riot/img/logos/riot-im-logo-5.svg b/res/themes/riot/img/logos/riot-im-logo-5.svg deleted file mode 100644 index 2653d7c9c8..0000000000 --- a/res/themes/riot/img/logos/riot-im-logo-5.svg +++ /dev/null @@ -1,110 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/res/themes/riot/img/logos/riot-im-logo-black-text.png b/res/themes/riot/img/logos/riot-im-logo-black-text.png new file mode 100644 index 0000000000..2b4334616e Binary files /dev/null and b/res/themes/riot/img/logos/riot-im-logo-black-text.png differ diff --git a/res/themes/riot/img/logos/riot-im-logo-black-text.svg b/res/themes/riot/img/logos/riot-im-logo-black-text.svg new file mode 100644 index 0000000000..ce50d65d49 --- /dev/null +++ b/res/themes/riot/img/logos/riot-im-logo-black-text.svg @@ -0,0 +1,17 @@ + + + + alt black logotype + Created with Sketch. + + + + + + + + + + + + \ No newline at end of file diff --git a/res/themes/riot/img/logos/riot-im-logo.png b/res/themes/riot/img/logos/riot-im-logo.png new file mode 100644 index 0000000000..66651582de Binary files /dev/null and b/res/themes/riot/img/logos/riot-im-logo.png differ diff --git a/res/themes/riot/img/logos/riot-im-logo.svg b/res/themes/riot/img/logos/riot-im-logo.svg new file mode 100644 index 0000000000..8a7956cc65 --- /dev/null +++ b/res/themes/riot/img/logos/riot-im-logo.svg @@ -0,0 +1,17 @@ + + + + animatedLogo-0 + Created with Sketch. + + + + + + + + + + + + \ No newline at end of file diff --git a/res/themes/riot/img/logos/riot-logo-1.svg b/res/themes/riot/img/logos/riot-logo-1.svg deleted file mode 100644 index 297608b899..0000000000 --- a/res/themes/riot/img/logos/riot-logo-1.svg +++ /dev/null @@ -1 +0,0 @@ -Asset 4 \ No newline at end of file diff --git a/res/themes/riot/img/logos/riot-logo-2.svg b/res/themes/riot/img/logos/riot-logo-2.svg deleted file mode 100644 index 757f62309e..0000000000 --- a/res/themes/riot/img/logos/riot-logo-2.svg +++ /dev/null @@ -1 +0,0 @@ -Asset 2 \ No newline at end of file diff --git a/res/themes/riot/img/logos/riot-logo-3.svg b/res/themes/riot/img/logos/riot-logo-3.svg deleted file mode 100644 index d71b489a44..0000000000 --- a/res/themes/riot/img/logos/riot-logo-3.svg +++ /dev/null @@ -1 +0,0 @@ -Asset 5 \ No newline at end of file diff --git a/res/themes/riot/img/logos/riot-logo-4.svg b/res/themes/riot/img/logos/riot-logo-4.svg deleted file mode 100644 index aa5522f609..0000000000 --- a/res/themes/riot/img/logos/riot-logo-4.svg +++ /dev/null @@ -1 +0,0 @@ -Asset 3 \ No newline at end of file diff --git a/res/themes/riot/img/logos/riot-logo-5.svg b/res/themes/riot/img/logos/riot-logo-5.svg deleted file mode 100644 index 6cbc259257..0000000000 --- a/res/themes/riot/img/logos/riot-logo-5.svg +++ /dev/null @@ -1 +0,0 @@ -Asset 1 \ No newline at end of file diff --git a/res/themes/riot/img/logos/riot-logo-bw.svg b/res/themes/riot/img/logos/riot-logo-bw.svg deleted file mode 100644 index e7d6e869ba..0000000000 --- a/res/themes/riot/img/logos/riot-logo-bw.svg +++ /dev/null @@ -1 +0,0 @@ -Asset 6 \ No newline at end of file diff --git a/res/themes/riot/img/logos/riot-logo.svg b/res/themes/riot/img/logos/riot-logo.svg deleted file mode 100644 index cbfaa62577..0000000000 --- a/res/themes/riot/img/logos/riot-logo.svg +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/res/themes/riot/img/logos/riot.im logo.svg b/res/themes/riot/img/logos/riot.im logo.svg deleted file mode 100644 index 5ebd96e84b..0000000000 --- a/res/themes/riot/img/logos/riot.im logo.svg +++ /dev/null @@ -1,169 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/res/themes/status/css/_StatusLogin.scss b/res/themes/status/css/_StatusLogin.scss index 6872727423..d3d9914ff5 100644 --- a/res/themes/status/css/_StatusLogin.scss +++ b/res/themes/status/css/_StatusLogin.scss @@ -88,7 +88,7 @@ limitations under the License. // overrides of .mx_Login - .mx_Login_box { + .mx_AuthPage_modal { width: 330px; min-height: initial; padding-top: 40px; @@ -100,13 +100,13 @@ limitations under the License. font-size: 16px; line-height: 25px; background-color: $form-bg-color; - background-image: url(../../themes/status/img/dot.svg); - box-shadow: 0px 5px 16px 0px rgba(25,12,46,0.16); + background-image: url("$(status)/img/dot.svg"); + box-shadow: 0px 5px 16px 0px rgba(25,12,46,0.16); position: relative; text-align: center; } - .mx_Login_logo { + .mx_AuthHeader_logo { background-color: #fff; width: 74px; height: 74px; @@ -118,13 +118,13 @@ limitations under the License. margin-left: -36px; } - .mx_Login_logo img { + .mx_AuthHeader_logo img { width: 36px; height: 36px; padding: 19px; } - .mx_Login_box h2 { + .mx_AuthPage_modal h2 { text-align: center; color: $form-fg-color; font-size: 25px; diff --git a/res/themes/status/css/_fonts.scss b/res/themes/status/css/_fonts.scss new file mode 100644 index 0000000000..e53b463839 --- /dev/null +++ b/res/themes/status/css/_fonts.scss @@ -0,0 +1,15 @@ +@font-face { + font-family:PostGrotesk-Medium; + src:url('https://status.im/fonts/PostGrotesk-Medium.eot'); + src:url('https://status.im/fonts/PostGrotesk-Medium.eot?#iefix') format("embedded-opentype"),url('https://status.im/fonts/PostGrotesk-Medium.woff') format("woff"),url('https://status.im/fonts/PostGrotesk-Medium.svg#PostGrotesk-Medium') format("svg"); + font-weight: 400; + font-style: normal; +} + +@font-face { + font-family:PostGrotesk-Book; + src:url('https://status.im/fonts/PostGrotesk-Book.eot'); + src:url('https://status.im/fonts/PostGrotesk-Book.eot?#iefix') format("embedded-opentype"),url('https://status.im/fonts/PostGrotesk-Book.woff') format("woff"),url('https://status.im/fonts/PostGrotesk-Book.svg#PostGrotesk-Book') format("svg"); + font-weight: 400; + font-style: normal; +} diff --git a/res/themes/status/css/_paths.scss b/res/themes/status/css/_paths.scss new file mode 100644 index 0000000000..3a1140ecf9 --- /dev/null +++ b/res/themes/status/css/_paths.scss @@ -0,0 +1,5 @@ +// Path from root SCSS file (such as `status.scss`) to `res` dir in `matrix-react-sdk` +$res: ../../../../node_modules/matrix-react-sdk/res; + +// Path from root SCSS file (such as `status.scss`) to `status` dir in `riot-web` +$status: ..; diff --git a/res/themes/status/css/_status.scss b/res/themes/status/css/_status.scss index c99af14e94..c2ce5dd281 100644 --- a/res/themes/status/css/_status.scss +++ b/res/themes/status/css/_status.scss @@ -1,19 +1,3 @@ -@font-face { - font-family:PostGrotesk-Medium; - src:url('https://status.im/fonts/PostGrotesk-Medium.eot'); - src:url('https://status.im/fonts/PostGrotesk-Medium.eot?#iefix') format("embedded-opentype"),url('https://status.im/fonts/PostGrotesk-Medium.woff') format("woff"),url('https://status.im/fonts/PostGrotesk-Medium.svg#PostGrotesk-Medium') format("svg"); - font-weight: 400; - font-style: normal; -} - -@font-face { - font-family:PostGrotesk-Book; - src:url('https://status.im/fonts/PostGrotesk-Book.eot'); - src:url('https://status.im/fonts/PostGrotesk-Book.eot?#iefix') format("embedded-opentype"),url('https://status.im/fonts/PostGrotesk-Book.woff') format("woff"),url('https://status.im/fonts/PostGrotesk-Book.svg#PostGrotesk-Book') format("svg"); - font-weight: 400; - font-style: normal; -} - // We deliberately prioritise Arial over Helvetica here due to diacritic problems (see _base.scss) // N.B. that the status.im website uses: // font-family:PostGrotesk-Book,-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif; @@ -68,6 +52,8 @@ $focus-bg-color: #dddddd; // button UI (white-on-green in light skin) $accent-fg-color: #ffffff; $accent-color: #6CC1F6; +$accent-color-alt: $accent-color; +$accent-color-50pct: #6CC1F67F; $accent-hover-color: #84cfff; $selection-fg-color: $primary-bg-color; @@ -117,7 +103,11 @@ $primary-hairline-color: #e5e5e5; // used for the border of input text fields $input-border-color: #c9cfd4; +$input-darker-bg-color: #c1c9d6; +$input-darker-fg-color: #9fa9ba; +$button-bg-color: #7ac9a1; +$button-fg-color: white; // apart from login forms, which have stronger border $strong-input-border-color: #c7c7c7; @@ -128,6 +118,7 @@ $input-fg-color: rgba(74, 74, 74, 0.9); // context menus $menu-border-color: rgba(187, 187, 187, 0.5); $menu-bg-color: #f6f6f6; +$menu-selected-color: #f5f8fa; $avatar-initial-color: #ffffff; $avatar-bg-color: transparent; @@ -162,6 +153,15 @@ $roomtile-name-color: #ffffff; $roomtile-selected-bg-color: #465561; $roomtile-focused-bg-color: #6d8597; +$username-variant1-color: #1e7ddc; +$username-variant2-color: #a756a8; +$username-variant3-color: #7ac9a1; +$username-variant4-color: #f2809d; +$username-variant5-color: #ffc666; +$username-variant6-color: #76ddd7; +$username-variant7-color: #45529b; +$username-variant8-color: #bfd251; + $roomsublist-background: rgba(0, 0, 0, 0.2); $roomsublist-label-fg-color: #ffffff; $roomsublist-label-bg-color: $secondary-accent-color; @@ -187,8 +187,8 @@ $event-redacted-border-color: #cccccc; // event timestamp $event-timestamp-color: #acacac; -$edit-button-url: "../../img/icon_context_message.svg"; -$copy-button-url: "../../img/icon_copy_message.svg"; +$edit-button-url: "$(res)/img/icon_context_message.svg"; +$copy-button-url: "$(res)/img/icon_copy_message.svg"; // e2e $e2e-verified-color: #76cfa5; // N.B. *NOT* the same as $accent-color diff --git a/res/themes/status/css/status.scss b/res/themes/status/css/status.scss index b4f6590040..c5fa1fe114 100644 --- a/res/themes/status/css/status.scss +++ b/res/themes/status/css/status.scss @@ -1,3 +1,5 @@ +@import "_paths.scss"; +@import "_fonts.scss"; @import "../../../../node_modules/matrix-react-sdk/res/themes/light/css/_base.scss"; @import "_status.scss"; @import "../../../../node_modules/matrix-react-sdk/res/css/_components.scss"; diff --git a/scripts/copy-res.js b/scripts/copy-res.js index e41fa88f3c..012cdf794b 100755 --- a/scripts/copy-res.js +++ b/scripts/copy-res.js @@ -53,15 +53,11 @@ const COPY_LIST = [ ["res/home.html", "webapp"], ["res/home-status.html", "webapp"], ["res/home/**", "webapp/home"], - ["res/vector-icons/**", "webapp/vector-icons"], - ["node_modules/matrix-react-sdk/res/{fonts,img,themes,media}/**", "webapp"], ["res/themes/**", "webapp/themes"], + ["res/vector-icons/**", "webapp/vector-icons"], + ["node_modules/matrix-react-sdk/res/media/**", "webapp/media"], ["node_modules/emojione/assets/svg/*", "webapp/emojione/svg/"], ["node_modules/emojione/assets/png/*", "webapp/emojione/png/"], - // XXX: This is tied quite heavily to the matching olm.js so it really should be - // in the bundle dir with the js to avoid caching issues giving us wasm that - // doesn't match our js, but I cannot find any way to get webpack to do this. - ["node_modules/olm/olm.wasm", "webapp", { directwatch: 1 }], ["node_modules/olm/olm_legacy.js", "webapp", { directwatch: 1 }], ["./config.json", "webapp", { directwatch: 1 }], ]; diff --git a/scripts/fetch-develop.deps.sh b/scripts/fetch-develop.deps.sh index 57eda6ebd9..b748088adb 100755 --- a/scripts/fetch-develop.deps.sh +++ b/scripts/fetch-develop.deps.sh @@ -9,45 +9,49 @@ set -e GIT_CLONE_ARGS=("$@") - -# Look in the many different CI env vars for which branch we're -# building -if [[ "$TRAVIS" == true ]]; then - curbranch="${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}" -else - # ghprbSourceBranch for jenkins github pull request builder - # GIT_BRANCH for other jenkins builds - curbranch="${ghprbSourceBranch:-$GIT_BRANCH}" - # Otherwise look at the actual branch we're on - if [ -z "$curbranch" ] - then - curbranch=`git rev-parse --abbrev-ref HEAD` - fi -fi - -# Chop 'origin' off the start as jenkins ends up using -# branches on the origin, but this doesn't work if we -# specify the branch when cloning. -curbranch=${curbranch#origin/} - -echo "Determined branch to be $curbranch" +[ -z "$defbranch" ] && defbranch="develop" # clone a specific branch of a github repo function clone() { org=$1 repo=$2 branch=$3 - git clone https://github.com/$org/$repo.git $repo --branch $branch \ - "${GIT_CLONE_ARGS[@]}" + + # Chop 'origin' off the start as jenkins ends up using + # branches on the origin, but this doesn't work if we + # specify the branch when cloning. + branch=${branch#origin/} + + if [ -n "$branch" ] + then + echo "Trying to use $org/$repo#$branch" + git clone https://github.com/$org/$repo.git $repo --branch $branch \ + "${GIT_CLONE_ARGS[@]}" + return $? + fi + return 1 } function dodep() { org=$1 repo=$2 rm -rf $repo - clone $org $repo $curbranch || { - [ "$curbranch" != 'develop' ] && clone $org $repo develop - } || return $? + + # Try the PR author's branch in case it exists on the deps as well. + # Try the target branch of the push or PR. + # Use the default branch as the last resort. + if [[ "$TRAVIS" == true ]]; then + clone $org $repo $TRAVIS_PULL_REQUEST_BRANCH || + clone $org $repo $TRAVIS_BRANCH || + clone $org $repo $defbranch || + return $? + else + clone $org $repo $ghprbSourceBranch || + clone $org $repo $GIT_BRANCH || + clone $org $repo `git rev-parse --abbrev-ref HEAD` || + clone $org $repo $defbranch || + return $? + fi echo "$repo set to branch "`git -C "$repo" rev-parse --abbrev-ref HEAD` diff --git a/scripts/jenkins.sh b/scripts/jenkins.sh index 7b5b4c8e2e..a0e88e4d14 100755 --- a/scripts/jenkins.sh +++ b/scripts/jenkins.sh @@ -4,21 +4,23 @@ set -e export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" -nvm use 6 +nvm use 10 set -x -# check out corresponding branches of dependencies. -# -# clone the deps with depth 1: we know we will only ever need that one -# commit. -`dirname $0`/fetch-develop.deps.sh --depth 1 - npm install # apparently npm 3.10.3 on node 6.4.0 doesn't upgrade #develop target with npm install unless explicitly asked. npm install olm +# check out corresponding branches of dependencies. +# +# clone the deps with depth 1: we know we will only ever need that one +# commit. +# We need to do this after npm install otherwise modern node versions +# just reset it back. +`dirname $0`/fetch-develop.deps.sh --depth 1 + # install olm. A naive 'npm i ./olm/olm-*.tgz' fails because it uses the url # from our package.json (or even matrix-js-sdk's) in preference. # diff --git a/src/components/structures/VectorHomePage.js b/src/components/structures/VectorHomePage.js index 7f74130349..a2e5fe05ea 100644 --- a/src/components/structures/VectorHomePage.js +++ b/src/components/structures/VectorHomePage.js @@ -17,7 +17,6 @@ limitations under the License. 'use strict'; -import React from 'react'; import HomePage from 'matrix-react-sdk/lib/components/structures/HomePage'; import sanitizeHtml from 'sanitize-html'; import { _t } from 'matrix-react-sdk/lib/languageHandler'; diff --git a/src/components/views/login/VectorLoginFooter.js b/src/components/views/auth/VectorAuthFooter.js similarity index 63% rename from src/components/views/login/VectorLoginFooter.js rename to src/components/views/auth/VectorAuthFooter.js index 26e01c06de..ded8e22976 100644 --- a/src/components/views/login/VectorLoginFooter.js +++ b/src/components/views/auth/VectorAuthFooter.js @@ -1,5 +1,6 @@ /* Copyright 2015, 2016 OpenMarket Ltd +Copyright 2019 New Vector Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -16,28 +17,28 @@ limitations under the License. 'use strict'; -var React = require('react'); +const React = require('react'); import { _t } from 'matrix-react-sdk/lib/languageHandler'; import SettingsStore from 'matrix-react-sdk/lib/settings/SettingsStore'; module.exports = React.createClass({ - displayName: 'VectorLoginFooter', + displayName: 'VectorAuthFooter', statics: { - replaces: 'LoginFooter', + replaces: 'AuthFooter', }, render: function() { // FIXME: replace this with a proper Status skin // ...except then we wouldn't be able to switch to the Status theme at runtime. - if (SettingsStore.getValue("theme") === 'status') return
; - + if (SettingsStore.getValue("theme") === 'status') return
; + return ( -
- blog  ·   - twitter  ·   - github  ·   - { _t('powered by Matrix') } + ); - } + }, }); diff --git a/src/components/views/login/VectorLoginHeader.js b/src/components/views/auth/VectorAuthHeaderLogo.js similarity index 67% rename from src/components/views/login/VectorLoginHeader.js rename to src/components/views/auth/VectorAuthHeaderLogo.js index d0ee793489..7a40f44559 100644 --- a/src/components/views/login/VectorLoginHeader.js +++ b/src/components/views/auth/VectorAuthHeaderLogo.js @@ -1,5 +1,6 @@ /* Copyright 2015, 2016 OpenMarket Ltd +Copyright 2019 New Vector Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,13 +20,12 @@ limitations under the License. import React from 'react'; import PropTypes from 'prop-types'; -const i = [1, 2, 3, 4, 5][Math.floor(Math.random() * 5)]; -const DEFAULT_LOGO_URI = "themes/riot/img/logos/riot-im-logo-" + i + ".svg"; +const LOGO_URI = "themes/riot/img/logos/riot-im-logo-black-text.svg"; module.exports = React.createClass({ - displayName: 'VectorLoginHeader', + displayName: 'VectorAuthHeaderLogo', statics: { - replaces: 'LoginHeader', + replaces: 'AuthHeaderLogo', }, propTypes: { icon: PropTypes.string, @@ -33,11 +33,9 @@ module.exports = React.createClass({ render: function() { return ( -
-
- Riot -
+
+ Riot
); - } + }, }); diff --git a/src/components/views/auth/VectorAuthPage.js b/src/components/views/auth/VectorAuthPage.js new file mode 100644 index 0000000000..e277cb18c8 --- /dev/null +++ b/src/components/views/auth/VectorAuthPage.js @@ -0,0 +1,70 @@ +/* +Copyright 2019 New Vector Ltd + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +'use strict'; + +const React = require('react'); +import sdk from 'matrix-react-sdk/lib/index'; + +module.exports = React.createClass({ + displayName: 'VectorAuthPage', + + statics: { + replaces: 'AuthPage', + }, + + render: function() { + const AuthFooter = sdk.getComponent('auth.AuthFooter'); + + const pageStyle = { + background: 'center/cover fixed url(themes/riot/img/backgrounds/valley.jpg)', + }; + + const modalStyle = { + position: 'relative', + background: 'initial', + }; + + const blurStyle = { + position: 'absolute', + top: 0, + right: 0, + bottom: 0, + left: 0, + filter: 'blur(10px)', + background: pageStyle.background, + }; + + const modalContentStyle = { + display: 'flex', + zIndex: 1, + background: 'rgba(255, 255, 255, 0.59)', + borderRadius: '4px', + }; + + return ( +
+
+
+
+ { this.props.children } +
+
+ +
+ ); + }, +}); diff --git a/src/components/views/login/VectorCustomServerDialog.js b/src/components/views/auth/VectorCustomServerDialog.js similarity index 66% rename from src/components/views/login/VectorCustomServerDialog.js rename to src/components/views/auth/VectorCustomServerDialog.js index 8395f1396c..b817cc3feb 100644 --- a/src/components/views/login/VectorCustomServerDialog.js +++ b/src/components/views/auth/VectorCustomServerDialog.js @@ -15,10 +15,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -var React = require("react"); -var sanitizeHtml = require("sanitize-html"); +const React = require("react"); import { _t } from 'matrix-react-sdk/lib/languageHandler'; +/** + * This is identical to `CustomServerDialog` except for replacing "this app" + * with "Riot". + */ module.exports = React.createClass({ displayName: 'VectorCustomServerDialog', statics: { @@ -32,13 +35,17 @@ module.exports = React.createClass({ { _t('Custom Server Options') }
- This allows "+ - "you to use Riot with an existing Matrix account on a different home "+ - "server.

You can also set a custom identity server but you won't "+ - "be able to invite users by email address, or be invited by email address yourself.", - ))}} /> +

{_t( + "You can use the custom server options to sign into other " + + "Matrix servers by specifying a different homeserver URL. This " + + "allows you to use Riot with an existing Matrix account on a " + + "different homeserver.", + )}

+

{_t( + "You can also set a custom identity server, but you won't be " + + "able to invite users by email address, or be invited by email " + + "address yourself.", + )}

); - } + }, }); diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 9641f0dd71..9c467cfc2f 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -1,39 +1,21 @@ { - "Riot is not supported on mobile web. Install the app?": "Riot is not supported on mobile web. Install the app?", "Riot Desktop on %(platformName)s": "Riot Desktop on %(platformName)s", "Unknown device": "Unknown device", "%(appName)s via %(browserName)s on %(osName)s": "%(appName)s via %(browserName)s on %(osName)s", "You need to be using HTTPS to place a screen-sharing call.": "You need to be using HTTPS to place a screen-sharing call.", - "Custom Server Options": "Custom Server Options", - "You can use the custom server options to sign into other Matrix servers by specifying a different Home server URL.
This allows you to use Riot with an existing Matrix account on a different home server.

You can also set a custom identity server but you won't be able to invite users by email address, or be invited by email address yourself.": "You can use the custom server options to sign into other Matrix servers by specifying a different Home server URL.
This allows you to use Riot with an existing Matrix account on a different home server.

You can also set a custom identity server but you won't be able to invite users by email address, or be invited by email address yourself.", - "Dismiss": "Dismiss", "powered by Matrix": "powered by Matrix", + "Custom Server Options": "Custom Server Options", + "You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use Riot with an existing Matrix account on a different homeserver.": "You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use Riot with an existing Matrix account on a different homeserver.", + "You can also set a custom identity server, but you won't be able to invite users by email address, or be invited by email address yourself.": "You can also set a custom identity server, but you won't be able to invite users by email address, or be invited by email address yourself.", + "Dismiss": "Dismiss", "Welcome to Riot.im": "Welcome to Riot.im", "Decentralised, encrypted chat & collaboration powered by [matrix]": "Decentralised, encrypted chat & collaboration powered by [matrix]", - "Search the room directory": "Search the room directory", - "Lots of rooms already exist in Matrix, linked to existing networks (Slack, IRC, Gitter etc) or independent. Check out the directory!": "Lots of rooms already exist in Matrix, linked to existing networks (Slack, IRC, Gitter etc) or independent. Check out the directory!", + "Sign In": "Sign In", + "Create Account": "Create Account", + "Need help?": "Need help?", "Chat with Riot Bot": "Chat with Riot Bot", - "Get started with some tips from Riot Bot!": "Get started with some tips from Riot Bot!", - "General discussion about Matrix and Riot": "General discussion about Matrix and Riot", - "Discussion of all things Matrix!": "Discussion of all things Matrix!", - "Riot/Web & Desktop chat": "Riot/Web & Desktop chat", - "Riot/iOS & matrix-ios-sdk chat": "Riot/iOS & matrix-ios-sdk chat", - "Riot/Android & matrix-android-sdk chat": "Riot/Android & matrix-android-sdk chat", - "Matrix technical discussions": "Matrix technical discussions", - "Running Matrix services": "Running Matrix services", - "Community-run support for Synapse": "Community-run support for Synapse", - "Admin support for Dendrite": "Admin support for Dendrite", - "Announcements about Synapse releases": "Announcements about Synapse releases", - "Support for those using and running matrix-appservice-irc": "Support for those using and running matrix-appservice-irc", - "Building services on Matrix": "Building services on Matrix", - "Support for those using the Matrix spec": "Support for those using the Matrix spec", - "Design and implementation of E2E in Matrix": "Design and implementation of E2E in Matrix", - "Implementing VR services with Matrix": "Implementing VR services with Matrix", - "Implementing VoIP services with Matrix": "Implementing VoIP services with Matrix", - "Discussion of the Identity Service API": "Discussion of the Identity Service API", - "Support for those using, running and writing other bridges": "Support for those using, running and writing other bridges", - "Contributing code to Matrix and Riot": "Contributing code to Matrix and Riot", - "Dev chat for the Riot/Web dev team": "Dev chat for the Riot/Web dev team", - "Dev chat for the Dendrite dev team": "Dev chat for the Dendrite dev team", - "Co-ordination for Riot translators": "Co-ordination for Riot translators" + "Explore rooms": "Explore rooms", + "Room Directory": "Room Directory", + "Search the room directory": "Search the room directory", + "Get started with some tips from Riot Bot!": "Get started with some tips from Riot Bot!" } diff --git a/src/i18n/strings/hi.json b/src/i18n/strings/hi.json index 0967ef424b..82b716bd00 100644 --- a/src/i18n/strings/hi.json +++ b/src/i18n/strings/hi.json @@ -1 +1,39 @@ -{} +{ + "Riot is not supported on mobile web. Install the app?": "रायट फ़ोन पर समर्थन नहीं हैं। एप्लिकेशन इनस्टॉल करना चाहेंगे ?", + "Riot Desktop on %(platformName)s": "%(platformName)s पर रायट डेस्कटॉप", + "Unknown device": "अज्ञात यन्त्र", + "%(appName)s via %(browserName)s on %(osName)s": "%(osName)s पर %(browserName)s के माध्यम से %(appName)s", + "You need to be using HTTPS to place a screen-sharing call.": "स्क्रीन साझा की कॉल करने के लिए आपको HTTPS का उपयोग करने की आवश्यकता है।", + "Custom Server Options": "कस्टम सर्वर विकल्प", + "You can use the custom server options to sign into other Matrix servers by specifying a different Home server URL.
This allows you to use Riot with an existing Matrix account on a different home server.

You can also set a custom identity server but you won't be able to invite users by email address, or be invited by email address yourself.": "आप एक अलग होम सर्वर यूआरएल निर्दिष्ट करके अन्य मैट्रिक्स सर्वरों में साइन इन करने के लिए कस्टम सर्वर विकल्प का उपयोग कर सकते हैं।
यह आपको एक अलग होम सर्वर पर मौजूदा मैट्रिक्स खाते के साथ रायट का उपयोग करने की अनुमति देता है।

आप अपना आइडेंटिटी सर्वर भी सेट कर सकते हैं लेकिन आप ईमेल पते से उपयोगकर्ताओं को आमंत्रित नहीं कर पाएंगे, या ईमेल पते से स्वयं आमंत्रित नहीं हों सकेंगे।", + "Dismiss": "खारिज", + "powered by Matrix": "मैट्रिक्स द्वारा संचालित", + "Welcome to Riot.im": "Riot.im में आपका स्वागत है", + "Decentralised, encrypted chat & collaboration powered by [matrix]": "[मैट्रिक्स] द्वारा संचालित विकेंद्रीकृत, एन्क्रिप्टेड चैट और सहयोगिता", + "Search the room directory": "रूम डायरेक्टरी में खोजें", + "Lots of rooms already exist in Matrix, linked to existing networks (Slack, IRC, Gitter etc) or independent. Check out the directory!": "मौजूदा नेटवर्क से जुड़े मैट्रिक्स में बहुत से कमरे पहले से मौजूद हैं (स्लैक, आईआरसी, गिटर इत्यादि) या स्वतंत्र। डायरेक्टरी देखें!", + "Chat with Riot Bot": "रायट बॉट के साथ चैट करें", + "Get started with some tips from Riot Bot!": "रायट बॉट से कुछ सुझावों के साथ शुरू करें!", + "General discussion about Matrix and Riot": "मैट्रिक्स और रायट के बारे में सामान्य चर्चा", + "Discussion of all things Matrix!": "मैट्रिक्स की सभी चीजों की चर्चा!", + "Riot/Web & Desktop chat": "रायट/वेब और डेस्कटॉप चैट", + "Riot/iOS & matrix-ios-sdk chat": "रायट / iOS और matrix-ios-sdk चैट", + "Riot/Android & matrix-android-sdk chat": "रायट / एंड्रॉइड और matrix-android-sdk चैट", + "Matrix technical discussions": "मैट्रिक्स तकनीकी चर्चाएं", + "Running Matrix services": "मैट्रिक्स सेवाएं चलाना", + "Community-run support for Synapse": "सामुदायिक चालित Synapse के लिए समर्थन", + "Admin support for Dendrite": "डेंडर्राइट के लिए व्यवस्थापक समर्थन", + "Announcements about Synapse releases": "Synapse रिलीज के बारे में घोषणाएं", + "Support for those using and running matrix-appservice-irc": "Matrix-appservice-irc का उपयोग और चलाने वाले लोगों के लिए समर्थन", + "Building services on Matrix": "मैट्रिक्स पर सेवाएं बनाना", + "Support for those using the Matrix spec": "मैट्रिक्स spec का उपयोग करने वालों के लिए समर्थन", + "Design and implementation of E2E in Matrix": "मैट्रिक्स में E2E के डिजाइन और कार्यान्वयन", + "Implementing VR services with Matrix": "मैट्रिक्स के साथ VR सेवाओं को लागू करना", + "Implementing VoIP services with Matrix": "मैट्रिक्स के साथ वीओआईपी सेवाओं को लागू करना", + "Discussion of the Identity Service API": "आइडेंटिटी सर्विस API की चर्चा", + "Support for those using, running and writing other bridges": "अन्य ब्रिज का उपयोग, चलाने और लिखने वालों के लिए समर्थन", + "Contributing code to Matrix and Riot": "मैट्रिक्स और रायट में कोड योगदान करना", + "Dev chat for the Riot/Web dev team": "रायट / वेब डेव टीम के लिए डेवलपर चैट", + "Dev chat for the Dendrite dev team": "डेन्ड्राइट देव टीम के लिए डेवलपर चैट", + "Co-ordination for Riot translators": "रायट अनुवादकों के लिए समन्वय" +} diff --git a/src/i18n/strings/hr.json b/src/i18n/strings/hr.json new file mode 100644 index 0000000000..c03a82905f --- /dev/null +++ b/src/i18n/strings/hr.json @@ -0,0 +1,39 @@ +{ + "Riot is not supported on mobile web. Install the app?": "Riot nije podržan na mobilnom pregledniku. Instalirati aplikaciju?", + "Riot Desktop on %(platformName)s": "Riot Desktop na %(platformName)s", + "Unknown device": "Nepoznati uređaj", + "%(appName)s via %(browserName)s on %(osName)s": "%(appName)s preko %(browserName)s na %(osName)s", + "You need to be using HTTPS to place a screen-sharing call.": "Morate koristiti HTTPS kako biste pokrenuli poziv s dijeljenjem ekrana.", + "Custom Server Options": "Prilagođene opcije poslužitelja", + "You can use the custom server options to sign into other Matrix servers by specifying a different Home server URL.
This allows you to use Riot with an existing Matrix account on a different home server.

You can also set a custom identity server but you won't be able to invite users by email address, or be invited by email address yourself.": "Možete koristiti prilagođene opcije poslužitelja za prijavu na ostale Matrix poslužitelje, navodeći drugačiji URL za Kućni poslužitelj.
Ovo vam omogućuje da koristite Riot s postojećim Matrix računom na različitom kućnom poslužitelju.

Također možete postaviti prilagođeni poslužitelj identiteta, ali u tom slučaju nećete moći pozivati korisnike preko njihove email adrese, niti sami biti pozvani preko vase email adrese.", + "Dismiss": "Odbaci", + "powered by Matrix": "powered by Matrix", + "Welcome to Riot.im": "Dobrodošli u Riot.im", + "Chat with Riot Bot": "Razgovor s Riot Botom", + "Get started with some tips from Riot Bot!": "Krenite s par savjeta od Riot Bota!", + "General discussion about Matrix and Riot": "Opća rasprava o Matrixu i Riotu", + "Discussion of all things Matrix!": "Rasprava o svemu vezanome za Matrix!", + "Riot/Web & Desktop chat": "Riot/Web & Desktop chat", + "Riot/iOS & matrix-ios-sdk chat": "Riot/iOS & matrix-ios-sdk chat", + "Riot/Android & matrix-android-sdk chat": "Riot/Android & matrix-android-sdk chat", + "Matrix technical discussions": "Tehničke rasprave o Matrixu", + "Running Matrix services": "Pokretanje Matrix usluga", + "Community-run support for Synapse": "Podrška zajednice za Synapse", + "Admin support for Dendrite": "Administratorska podrška za Dendrite", + "Announcements about Synapse releases": "Obavijesti o izdanjima Synapsea", + "Support for those using and running matrix-appservice-irc": "Podrška onima koji koriste i pokreću matrix-appservice-irc", + "Building services on Matrix": "Razvoj usluga na Matrixu", + "Support for those using the Matrix spec": "Podrška onima koji koriste Matrix spec", + "Design and implementation of E2E in Matrix": "Dizajn i implementacija E2E u Matrixu", + "Implementing VR services with Matrix": "Implementiranje VR usluga s Matrixom", + "Implementing VoIP services with Matrix": "Implementiranje VoIP usluga s Matrixom", + "Discussion of the Identity Service API": "Rasprava vezana za Identity Service API", + "Support for those using, running and writing other bridges": "Podrška onima koji koriste, pokreću i pišu ostale mostove", + "Contributing code to Matrix and Riot": "Doprinos kodu Matrixa i Riota", + "Dev chat for the Riot/Web dev team": "Dev chat za Riot/Web dev tim", + "Dev chat for the Dendrite dev team": "Dev chat za Dendrite dev team", + "Co-ordination for Riot translators": "Koordinacija Riot prevoditelja", + "Decentralised, encrypted chat & collaboration powered by [matrix]": "Decentralizirani, enkriptirani chat & kolaboracija powered by [matrix]", + "Search the room directory": "Pretražite imenik soba", + "Lots of rooms already exist in Matrix, linked to existing networks (Slack, IRC, Gitter etc) or independent. Check out the directory!": "Veliki broj soba već postoji na Matrixu, povezanih s postojećim mrežama (Slack, IRC, Gitter itd) ili nezavisnih. Zavirite u imenik!" +} diff --git a/src/i18n/strings/it.json b/src/i18n/strings/it.json index f563819e87..6b54fe22b2 100644 --- a/src/i18n/strings/it.json +++ b/src/i18n/strings/it.json @@ -29,7 +29,7 @@ "Support for those using, running and writing other bridges": "Supporto per chi usa, amministra e scrive altri ponti (bridge)", "Contributing code to Matrix and Riot": "Contributi di codice per Matrix e Riot", "%(appName)s via %(browserName)s on %(osName)s": "%(appName)s tramite %(browserName)s su %(osName)s", - "Decentralised, encrypted chat & collaboration powered by [matrix]": "Chat criptate e decentralizzate & collaborazione offerta da [matrix]", + "Decentralised, encrypted chat & collaboration powered by [matrix]": "Chat criptate, decentralizzate e collaborazioni offerte da [matrix]", "Discussion of all things Matrix!": "Discussione su tutto riguardo Matrix!", "Dev chat for the Riot/Web dev team": "Chat per gli sviluppatori di Riot/Web", "Dev chat for the Dendrite dev team": "Chat per gli sviluppatori di Dendrite", diff --git a/src/i18n/strings/pt.json b/src/i18n/strings/pt.json index db6de1436d..f122a4d5ff 100644 --- a/src/i18n/strings/pt.json +++ b/src/i18n/strings/pt.json @@ -23,7 +23,7 @@ "Admin support for Dendrite": "Suporte de administração para o Dendrite", "Announcements about Synapse releases": "Anúncios acerca de lançamentos do Synapse", "Support for those using and running matrix-appservice-irc": "Suporte para aqueles a correr e a utilizar o matrix-appservice-irc", - "Building services on Matrix": "Construir serviços no Matrix", + "Building services on Matrix": "Construindo serviços no Matrix", "Support for those using the Matrix spec": "Suporte para os utilizadores da especificação do Matrix", "Design and implementation of E2E in Matrix": "Design e implementação de encriptação ponto-a-ponto (E2E) no Matrix", "Implementing VR services with Matrix": "Implementar serviços de realidade virtual (VR) com o Matrix", @@ -33,5 +33,7 @@ "Contributing code to Matrix and Riot": "Contribuir código para o Matrix e para o Riot", "Dev chat for the Riot/Web dev team": "Conversa de desenvolvimento para a equipa do Riot/Web", "Dev chat for the Dendrite dev team": "Conversa de desenvolvimento para a equipa do Dendrite", - "Lots of rooms already exist in Matrix, linked to existing networks (Slack, IRC, Gitter etc) or independent. Check out the directory!": "Já existem muitas salas no Matrix, ligadas a redes já existentes (Slack, IRC, Gitter, etc) ou independentes. Dê uma vista de olhos no diretório!" + "Lots of rooms already exist in Matrix, linked to existing networks (Slack, IRC, Gitter etc) or independent. Check out the directory!": "Já existem muitas salas no Matrix, ligadas a redes já existentes (Slack, IRC, Gitter, etc) ou independentes. Dê uma vista de olhos no diretório!", + "You can use the custom server options to sign into other Matrix servers by specifying a different Home server URL.
This allows you to use Riot with an existing Matrix account on a different home server.

You can also set a custom identity server but you won't be able to invite users by email address, or be invited by email address yourself.": "Você pode usar as opções de servidor personalizado para entrar em outros servidores Matrix, especificando um diferente URL de servidor doméstico.
Isto permite que você utilize Riot com uma conta Matrix existente em um servidor doméstico diferente.

Você também pode definir um servidor de identidade personalizado, porém não poderá convidar usuários por endereço de e-mail nem ser convidado por endereço de e-mail.", + "Co-ordination for Riot translators": "Coordenação para tradutores do Riot" } diff --git a/src/i18n/strings/pt_BR.json b/src/i18n/strings/pt_BR.json index afdfc1604b..2bbf5c4a19 100644 --- a/src/i18n/strings/pt_BR.json +++ b/src/i18n/strings/pt_BR.json @@ -1,7 +1,7 @@ { "Custom Server Options": "Opções para Servidor Personalizado", "Dismiss": "Descartar", - "powered by Matrix": "rodando a partir do Matrix", + "powered by Matrix": "oferecido por Matrix", "%(appName)s via %(browserName)s on %(osName)s": "%(appName)s via %(browserName)s em %(osName)s", "Riot Desktop on %(platformName)s": "Riot para computadores desktop em %(platformName)s", "Riot is not supported on mobile web. Install the app?": "Riot versão web não é suportado a partir de celular. Quer instalar o app para celular?", @@ -33,7 +33,7 @@ "Dev chat for the Riot/Web dev team": "Chat de desenvolvimento para o time devel do Riot/Web", "Dev chat for the Dendrite dev team": "Chat de desenvolvimento para o time devel do Dendrite", "Lots of rooms already exist in Matrix, linked to existing networks (Slack, IRC, Gitter etc) or independent. Check out the directory!": "Muitas salas já existem no Matrix, algumas independentes, e outras relacionadas a redes existentes (tais como Slack, IRC, Gitter, entre outras). Dê uma olhada na lista de salas públicas!", - "Decentralised, encrypted chat & collaboration powered by [matrix]": "Chat descentralizado, criptografado e colaborativo impulsionado por [matrix]", + "Decentralised, encrypted chat & collaboration powered by [matrix]": "Chat descentralizado, criptografado e colaborativo oferecido por [matrix]", "You can use the custom server options to sign into other Matrix servers by specifying a different Home server URL.
This allows you to use Riot with an existing Matrix account on a different home server.

You can also set a custom identity server but you won't be able to invite users by email address, or be invited by email address yourself.": "Você pode usar as opções customizadas de servidor para conectar-se a outros servidores Matrix ao especificar uma outra URL de Servidor de Base (homeserver).
Isso permite que você use o Riot com uma conta Matrix existente em outro servidor de base.

Você também pode definir um servidor de identidade customizado, mas neste caso você não poderá convidar outras pesoas por endereço de email, ou ser convidada/o pelo seu endereço de email.", "Co-ordination for Riot translators": "Coordenação para tradutores Riot" } diff --git a/src/i18n/strings/vi.json b/src/i18n/strings/vi.json new file mode 100644 index 0000000000..58ceb1add2 --- /dev/null +++ b/src/i18n/strings/vi.json @@ -0,0 +1,20 @@ +{ + "Riot is not supported on mobile web. Install the app?": "Riot không được hỗ trợ trên mobile web. Hãy cài app?", + "Riot Desktop on %(platformName)s": "Riot Desktop trên %(platformName)s", + "Unknown device": "Thiết bị không được nhận biết", + "%(appName)s via %(browserName)s on %(osName)s": "%(appName)s với %(browserName)s trên %(osName)s", + "You need to be using HTTPS to place a screen-sharing call.": "Bạn phải sử dụng HTTPS để dùng chức năng chia sẻ màn hình.", + "Custom Server Options": "Các lựa chọn máy chủ", + "You can use the custom server options to sign into other Matrix servers by specifying a different Home server URL.
This allows you to use Riot with an existing Matrix account on a different home server.

You can also set a custom identity server but you won't be able to invite users by email address, or be invited by email address yourself.": "Bạn có thể sử dụng các máy chủ khác để đăng nhập vào Matrix bằng cách khai báo đường dẫn Home server.
Cách này cho phép bạn sử dụng tài khoản hiện tại trên một Home server khác.

Bạn cũng có thể chọn một Server định danh nhưng bạn không thể mời người dùng khác qua email.", + "Dismiss": "Bỏ qua", + "powered by Matrix": "tài trợ bởi Matrix", + "Welcome to Riot.im": "Chào mừng tới Riot.im", + "Decentralised, encrypted chat & collaboration powered by [matrix]": "Chat phân tán, mã hóa & giao tiếp được tài trợ bởi [matrix]", + "Search the room directory": "Tìm trong danh sách phòng", + "Lots of rooms already exist in Matrix, linked to existing networks (Slack, IRC, Gitter etc) or independent. Check out the directory!": "Rất nhiều phòng đã có sẵn trong Matrix, liên kết với các hệ thống mạng xã hội khác (Slack, IRC, Gitter,...) hoặc hoạt động độc lập. Hãy kiểm tra!", + "Chat with Riot Bot": "Chat với Riot Bot", + "Get started with some tips from Riot Bot!": "Bắt đầu với các hướng dẫn từ Riot Bot!", + "General discussion about Matrix and Riot": "Thảo luận chung về Matrix và Riot", + "Discussion of all things Matrix!": "Thào luận về mọi vấn đề liên quan đến Matrix!", + "Riot/Web & Desktop chat": "Riot/Web & Desktop chat" +} diff --git a/src/vector/index.html b/src/vector/index.html index 4ba65c3e06..5451ec5232 100644 --- a/src/vector/index.html +++ b/src/vector/index.html @@ -34,31 +34,13 @@ } %> -
+
- <% for (var i=0; i < htmlWebpackPlugin.files.js.length; i++) { - if (_.endsWith(htmlWebpackPlugin.files.js[i], 'olm.js')) { - var array = htmlWebpackPlugin.files.js; - htmlWebpackPlugin.files.js.unshift(htmlWebpackPlugin.files.js[i]); - htmlWebpackPlugin.files.js.splice(i, 1); - } - } - - for (var i=0; i < htmlWebpackPlugin.files.js.length; i++) { - // Not a particularly graceful way of not putting the indexeddb worker script - // into the main page - if (_.endsWith(htmlWebpackPlugin.files.js[i], 'indexeddb-worker.js')) { - %> - - <% - continue; - } - %> - - <% } %> - + + +
diff --git a/src/vector/platform/ElectronPlatform.js b/src/vector/platform/ElectronPlatform.js index 1f261c2515..ca43b22dfd 100644 --- a/src/vector/platform/ElectronPlatform.js +++ b/src/vector/platform/ElectronPlatform.js @@ -3,6 +3,7 @@ /* Copyright 2016 Aviral Dasgupta Copyright 2016 OpenMarket Ltd +Copyright 2018 New Vector Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -21,9 +22,10 @@ import VectorBasePlatform, {updateCheckStatusEnum} from './VectorBasePlatform'; import dis from 'matrix-react-sdk/lib/dispatcher'; import { _t } from 'matrix-react-sdk/lib/languageHandler'; import Promise from 'bluebird'; -import {remote, ipcRenderer, desktopCapturer} from 'electron'; import rageshake from 'matrix-react-sdk/lib/rageshake/rageshake'; +const ipcRenderer = window.ipcRenderer; + remote.autoUpdater.on('update-downloaded', onUpdateDownloaded); var globalKeybindings = {}; @@ -44,23 +46,21 @@ function onUpdateDownloaded(ev: Event, releaseNotes: string, ver: string, date: } function platformFriendlyName(): string { - console.log(window.process); - switch (window.process.platform) { - case 'darwin': - return 'macOS'; - case 'freebsd': - return 'FreeBSD'; - case 'openbsd': - return 'OpenBSD'; - case 'sunos': - return 'SunOS'; - case 'win32': - return 'Windows'; - default: - // Sorry, Linux users: you get lumped into here, - // but only because Linux's capitalisation is - // normal. We do care about you. - return window.process.platform[0].toUpperCase() + window.process.platform.slice(1); + // used to use window.process but the same info is available here + if (navigator.userAgent.includes('Macintosh')) { + return 'macOS'; + } else if (navigator.userAgent.includes('FreeBSD')) { + return 'FreeBSD'; + } else if (navigator.userAgent.includes('OpenBSD')) { + return 'OpenBSD'; + } else if (navigator.userAgent.includes('SunOS')) { + return 'SunOS'; + } else if (navigator.userAgent.includes('Windows')) { + return 'Windows'; + } else if (navigator.userAgent.includes('Linux')) { + return 'Linux'; + } else { + return 'Unknown'; } } @@ -87,9 +87,11 @@ function getUpdateCheckStatus(status) { export default class ElectronPlatform extends VectorBasePlatform { constructor() { super(); - dis.register(_onAction); - this.updatable = Boolean(remote.autoUpdater.getFeedURL()); + this._pendingIpcCalls = {}; + this._nextIpcCallId = 0; + + dis.register(_onAction); /* IPC Call `check_updates` returns: true if there is an update available @@ -105,6 +107,15 @@ export default class ElectronPlatform extends VectorBasePlatform { this.showUpdateCheck = false; }); + // try to flush the rageshake logs to indexeddb before quit. + ipcRenderer.on('before-quit', function() { + console.log('riot-desktop closing'); + rageshake.flush(); + }); + + ipcRenderer.on('ipcReply', this._onIpcReply.bind(this)); + ipcRenderer.on('update-downloaded', this.onUpdateDownloaded.bind(this)); + this.startUpdateCheck = this.startUpdateCheck.bind(this); this.stopUpdateCheck = this.stopUpdateCheck.bind(this); @@ -128,6 +139,15 @@ export default class ElectronPlatform extends VectorBasePlatform { }); } + async onUpdateDownloaded(ev, updateInfo) { + dis.dispatch({ + action: 'new_version', + currentVersion: await this.getAppVersion(), + newVersion: updateInfo, + releaseNotes: updateInfo.releaseNotes, + }); + } + getHumanReadableName(): string { return 'Electron Platform'; // no translation required: only used for analytics } @@ -154,7 +174,7 @@ export default class ElectronPlatform extends VectorBasePlatform { // maybe we should pass basic styling (italics, bold, underline) through from MD // we only have to strip out < and > as the spec doesn't include anything about things like & // so we shouldn't assume that all implementations will treat those properly. Very basic tag parsing is done. - if (window.process.platform === 'linux') { + if (navigator.userAgent.includes('Linux')) { msg = msg.replace(//g, '>'); } @@ -168,17 +188,13 @@ export default class ElectronPlatform extends VectorBasePlatform { }, ); - notification.onclick = function() { + notification.onclick = () => { dis.dispatch({ action: 'view_room', room_id: room.roomId, }); global.focus(); - const win = remote.getCurrentWindow(); - - if (win.isMinimized()) win.restore(); - else if (!win.isVisible()) win.show(); - else win.focus(); + this._ipcCall('focusWindow'); }; return notification; @@ -192,8 +208,25 @@ export default class ElectronPlatform extends VectorBasePlatform { notif.close(); } - getAppVersion(): Promise { - return Promise.resolve(remote.app.getVersion()); + async getAppVersion(): Promise { + return await this._ipcCall('getAppVersion'); + } + + supportsAutoLaunch() { + return true; + } + + async getAutoLaunchEnabled() { + return await this._ipcCall('getAutoLaunchEnabled'); + } + + async setAutoLaunchEnabled(enabled) { + return await this._ipcCall('setAutoLaunchEnabled', enabled); + } + + async canSelfUpdate(): boolean { + const feedUrl = await this._ipcCall('getUpdateFeedUrl'); + return Boolean(feedUrl); } startUpdateCheck() { @@ -238,52 +271,47 @@ export default class ElectronPlatform extends VectorBasePlatform { return null; } - isElectron(): boolean { return true; } - requestNotificationPermission(): Promise { return Promise.resolve('granted'); } reload() { - remote.getCurrentWebContents().reload(); + // we used to remote to the main process to get it to + // reload the webcontents, but in practice this is unnecessary: + // the normal way works fine. + window.location.reload(false); } - /* BEGIN copied and slightly-modified code - * setupScreenSharingForIframe function from: - * https://github.com/jitsi/jitsi-meet-electron-utils - * Copied directly here to avoid the need for a native electron module for - * 'just a bit of JavaScript' - * NOTE: Apache v2.0 licensed - */ - setupScreenSharingForIframe(iframe: Object) { - iframe.contentWindow.JitsiMeetElectron = { - /** - * Get sources available for screensharing. The callback is invoked - * with an array of DesktopCapturerSources. - * - * @param {Function} callback - The success callback. - * @param {Function} errorCallback - The callback for errors. - * @param {Object} options - Configuration for getting sources. - * @param {Array} options.types - Specify the desktop source types - * to get, with valid sources being "window" and "screen". - * @param {Object} options.thumbnailSize - Specify how big the - * preview images for the sources should be. The valid keys are - * height and width, e.g. { height: number, width: number}. By - * default electron will return images with height and width of - * 150px. - */ - obtainDesktopStreams(callback, errorCallback, options = {}) { - desktopCapturer.getSources(options, - (error, sources) => { - if (error) { - errorCallback(error); - return; - } - - callback(sources); - }); - }, - }; + async migrateFromOldOrigin() { + return this._ipcCall('origin_migrate'); + } + + async _ipcCall(name, ...args) { + const ipcCallId = ++this._nextIpcCallId; + return new Promise((resolve, reject) => { + this._pendingIpcCalls[ipcCallId] = {resolve, reject}; + window.ipcRenderer.send('ipcCall', {id: ipcCallId, name, args}); + // Maybe add a timeout to these? Probably not necessary. + }); + } + + _onIpcReply(ev, payload) { + if (payload.id === undefined) { + console.warn("Ignoring IPC reply with no ID"); + return; + } + + if (this._pendingIpcCalls[payload.id] === undefined) { + console.warn("Unknown IPC payload ID: " + payload.id); + return; + } + + const callbacks = this._pendingIpcCalls[payload.id]; + delete this._pendingIpcCalls[payload.id]; + if (payload.error) { + callbacks.reject(payload.error); + } else { + callbacks.resolve(payload.reply); + } } - /* END of copied and slightly-modified code */ } diff --git a/src/vector/platform/VectorBasePlatform.js b/src/vector/platform/VectorBasePlatform.js index 4bf300a536..602a0c27c9 100644 --- a/src/vector/platform/VectorBasePlatform.js +++ b/src/vector/platform/VectorBasePlatform.js @@ -3,6 +3,7 @@ /* Copyright 2016 Aviral Dasgupta Copyright 2016 OpenMarket Ltd +Copyright 2018 New Vector Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -45,7 +46,6 @@ export default class VectorBasePlatform extends BasePlatform { this.favicon = new Favico({animation: 'none'}); this.showUpdateCheck = false; this._updateFavicon(); - this.updatable = true; this.startUpdateCheck = this.startUpdateCheck.bind(this); this.stopUpdateCheck = this.stopUpdateCheck.bind(this); @@ -60,8 +60,8 @@ export default class VectorBasePlatform extends BasePlatform { // This needs to be in in a try block as it will throw // if there are more than 100 badge count changes in // its internal queue - let bgColor = "#d00", - notif = this.notificationCount; + let bgColor = "#d00"; + let notif = this.notificationCount; if (this.errorDidOccur) { notif = notif || "×"; @@ -88,6 +88,19 @@ export default class VectorBasePlatform extends BasePlatform { this._updateFavicon(); } + supportsAutoLaunch() { + return false; + } + + // XXX: Surely this should be a setting like any other? + async getAutoLaunchEnabled() { + return false; + } + + async setAutoLaunchEnabled(enabled) { + throw new Error("Unimplemented"); + } + /** * Begin update polling, if applicable */ @@ -97,8 +110,8 @@ export default class VectorBasePlatform extends BasePlatform { /** * Whether we can call checkForUpdate on this platform build */ - canSelfUpdate(): boolean { - return this.updatable; + async canSelfUpdate(): boolean { + return false; } startUpdateCheck() { @@ -114,7 +127,7 @@ export default class VectorBasePlatform extends BasePlatform { dis.dispatch({ action: 'check_updates', value: false, - }) + }); } getUpdateCheckStatusEnum() { @@ -136,4 +149,12 @@ export default class VectorBasePlatform extends BasePlatform { getDefaultDeviceDisplayName(): string { return _t("Unknown device"); } + + /** + * Migrate account data from a previous origin + * Used only for the electron app + */ + async migrateFromOldOrigin() { + return false; + } } diff --git a/src/vector/platform/WebPlatform.js b/src/vector/platform/WebPlatform.js index cfe5134662..d850dd6ddd 100644 --- a/src/vector/platform/WebPlatform.js +++ b/src/vector/platform/WebPlatform.js @@ -26,7 +26,7 @@ import Promise from 'bluebird'; import url from 'url'; import UAParser from 'ua-parser-js'; -var POKE_RATE_MS = 10 * 60 * 1000; // 10 min +const POKE_RATE_MS = 10 * 60 * 1000; // 10 min export default class WebPlatform extends VectorBasePlatform { constructor() { @@ -142,6 +142,10 @@ export default class WebPlatform extends VectorBasePlatform { setInterval(this.pollForUpdate.bind(this), POKE_RATE_MS); } + async canSelfUpdate(): boolean { + return true; + } + pollForUpdate() { return this._getVersion().then((ver) => { if (this.runningVersion === null) { diff --git a/src/vector/rageshakesetup.js b/src/vector/rageshakesetup.js new file mode 100644 index 0000000000..4c37624959 --- /dev/null +++ b/src/vector/rageshakesetup.js @@ -0,0 +1,64 @@ +/* +Copyright 2018 New Vector Ltd + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +/* + * Separate file that sets up rageshake logging when imported. + * This is necessary so that rageshake logging is set up before + * anything else. Webpack puts all import statements at the top + * of the file before any code, so imports will always be + * evaluated first. Other imports can cause other code to be + * evaluated (eg. the loglevel library in js-sdk, which if set + * up before rageshake causes some js-sdk logging to be missing + * from the rageshake.) + */ + +import rageshake from "matrix-react-sdk/lib/rageshake/rageshake"; +import SdkConfig from "matrix-react-sdk/lib/SdkConfig"; + +function initRageshake() { + rageshake.init().then(() => { + console.log("Initialised rageshake."); + console.log("To fix line numbers in Chrome: " + + "Meatball menu → Settings → Blackboxing → Add /rageshake\\.js$"); + + window.addEventListener('beforeunload', (e) => { + console.log('riot-web closing'); + // try to flush the logs to indexeddb + rageshake.flush(); + }); + + rageshake.cleanup(); + }, (err) => { + console.error("Failed to initialise rageshake: " + err); + }); +} + +initRageshake(); + +global.mxSendRageshake = function(text, withLogs) { + if (withLogs === undefined) withLogs = true; + require(['matrix-react-sdk/lib/rageshake/submit-rageshake'], (s) => { + s(SdkConfig.get().bug_report_endpoint_url, { + userText: text, + sendLogs: withLogs, + progressCallback: console.log.bind(console), + }).then(() => { + console.log("Bug report sent!"); + }, (err) => { + console.error(err); + }); + }); +}; diff --git a/src/vector/url_utils.js b/src/vector/url_utils.js index cfa8eae142..cbaefa0c82 100644 --- a/src/vector/url_utils.js +++ b/src/vector/url_utils.js @@ -23,16 +23,16 @@ import qs from 'querystring'; export function parseQsFromFragment(location) { // if we have a fragment, it will start with '#', which we need to drop. // (if we don't, this will return ''). - var fragment = location.hash.substring(1); + const fragment = location.hash.substring(1); // our fragment may contain a query-param-like section. we need to fish // this out *before* URI-decoding because the params may contain ? and & // characters which are only URI-encoded once. - var hashparts = fragment.split('?'); + const hashparts = fragment.split('?'); - var result = { + const result = { location: decodeURIComponent(hashparts[0]), - params: {} + params: {}, }; if (hashparts.length > 1) { diff --git a/test/all-tests.js b/test/all-tests.js index 2ed1693293..156b854258 100644 --- a/test/all-tests.js +++ b/test/all-tests.js @@ -6,8 +6,8 @@ // ideally these unit tests could be run under nodejs rather than in a browser // via karma, but having two separate test frameworks in the same project // seems confusing -var unit_tests = require.context('./unit-tests', true, /\.js$/); +const unit_tests = require.context('./unit-tests', true, /\.js$/); unit_tests.keys().forEach(unit_tests); -var app_tests = require.context('./app-tests', true, /\.jsx?$/); +const app_tests = require.context('./app-tests', true, /\.jsx?$/); app_tests.keys().forEach(app_tests); diff --git a/test/app-tests/joining.js b/test/app-tests/joining.js index fc380e7d58..16b29fcb84 100644 --- a/test/app-tests/joining.js +++ b/test/app-tests/joining.js @@ -17,40 +17,40 @@ limitations under the License. /* joining.js: tests for the various paths when joining a room */ import PlatformPeg from 'matrix-react-sdk/lib/PlatformPeg'; -import Platform from '../../src/vector/platform'; +import WebPlatform from '../../src/vector/platform/WebPlatform'; require('skin-sdk'); -var jssdk = require('matrix-js-sdk'); +const jssdk = require('matrix-js-sdk'); -var sdk = require('matrix-react-sdk'); -var peg = require('matrix-react-sdk/lib/MatrixClientPeg'); -var dis = require('matrix-react-sdk/lib/dispatcher'); -var PageTypes = require('matrix-react-sdk/lib/PageTypes'); -var MatrixChat = sdk.getComponent('structures.MatrixChat'); -var RoomDirectory = sdk.getComponent('structures.RoomDirectory'); -var RoomPreviewBar = sdk.getComponent('rooms.RoomPreviewBar'); -var RoomView = sdk.getComponent('structures.RoomView'); +const sdk = require('matrix-react-sdk'); +const peg = require('matrix-react-sdk/lib/MatrixClientPeg'); +const dis = require('matrix-react-sdk/lib/dispatcher'); +const PageTypes = require('matrix-react-sdk/lib/PageTypes'); +const MatrixChat = sdk.getComponent('structures.MatrixChat'); +const RoomDirectory = sdk.getComponent('structures.RoomDirectory'); +const RoomPreviewBar = sdk.getComponent('rooms.RoomPreviewBar'); +const RoomView = sdk.getComponent('structures.RoomView'); -var React = require('react'); -var ReactDOM = require('react-dom'); -var ReactTestUtils = require('react-addons-test-utils'); -var expect = require('expect'); +const React = require('react'); +const ReactDOM = require('react-dom'); +const ReactTestUtils = require('react-addons-test-utils'); +const expect = require('expect'); import Promise from 'bluebird'; -var test_utils = require('../test-utils'); -var MockHttpBackend = require('matrix-mock-request'); +const test_utils = require('../test-utils'); +const MockHttpBackend = require('matrix-mock-request'); -var HS_URL='http://localhost'; -var IS_URL='http://localhost'; -var USER_ID='@me:localhost'; -var ACCESS_TOKEN='access_token'; +const HS_URL='http://localhost'; +const IS_URL='http://localhost'; +const USER_ID='@me:localhost'; +const ACCESS_TOKEN='access_token'; -describe('joining a room', function () { - describe('over federation', function () { - var parentDiv; - var httpBackend; - var matrixChat; +describe('joining a room', function() { + describe('over federation', function() { + let parentDiv; + let httpBackend; + let matrixChat; beforeEach(function() { test_utils.beforeEach(this); @@ -71,9 +71,15 @@ describe('joining a room', function () { } }); - it('should not get stuck at a spinner', function() { - var ROOM_ALIAS = '#alias:localhost'; - var ROOM_ID = '!id:localhost'; + // TODO: Re-enable test + // The test is currently disabled because the room directory now resides in a dialog, + // which is not accessible from the MatrixChat component anymore. Convincing react that + // the dialog does exist and is under a different tree is incredibly difficult though, + // so for now the test has been disabled. We should revisit this test when someone has + // the time to kill to figure this out. Problem area is highlighted within the test. + xit('should not get stuck at a spinner', function() { + const ROOM_ALIAS = '#alias:localhost'; + const ROOM_ID = '!id:localhost'; httpBackend.when('GET', '/pushrules').respond(200, {}); httpBackend.when('POST', '/filter').respond(200, { filter_id: 'fid' }); @@ -88,9 +94,9 @@ describe('joining a room', function () { localStorage.setItem("mx_access_token", ACCESS_TOKEN ); localStorage.setItem("mx_user_id", USER_ID); - PlatformPeg.set(new Platform()); + PlatformPeg.set(new WebPlatform()); - var mc = ( + const mc = ( {throw new Error("unimplemented");}} initialScreenAfterLogin={{ @@ -100,7 +106,7 @@ describe('joining a room', function () { ); matrixChat = ReactDOM.render(mc, parentDiv); - var roomView; + let roomView; // wait for /sync to happen. This may take some time, as the client // has to initialise indexeddb. @@ -118,11 +124,22 @@ describe('joining a room', function () { }).then(() => { console.log(`${Date.now()} App made requests for directory view; switching to a room.`); - var roomDir = ReactTestUtils.findRenderedComponentWithType( - matrixChat, RoomDirectory); + // TODO: Make this look in the right spot for the directory dialog. + // See the comment block at the top of the test for a bit more information. The short + // story here is that the RoomDirectory does not exist under matrixChat anymore, or even + // the parentDiv we have access to. Asking React to find the RoomDirectory as a child of + // the document results in it complaining that you didn't give it a component tree to + // search in. When you do get a reference to the component tree based off the document + // root and ask it to search, it races and can't find the component in time. To top it + // all off, MatrixReactTestUtils can't find the element in time either even with a very + // high number of attempts. Assuming we can get a reference to the RoomDirectory in a + // dialog, the rest of the test should be fine. + const roomDir = ReactTestUtils.findRenderedComponentWithType( + matrixChat, RoomDirectory, + ); // enter an alias in the input, and simulate enter - var input = ReactTestUtils.findRenderedDOMComponentWithTag( + const input = ReactTestUtils.findRenderedDOMComponentWithTag( roomDir, 'input'); input.value = ROOM_ALIAS; ReactTestUtils.Simulate.change(input); diff --git a/test/app-tests/loading.js b/test/app-tests/loading.js index dab616577a..ed87403d7b 100644 --- a/test/app-tests/loading.js +++ b/test/app-tests/loading.js @@ -17,7 +17,7 @@ limitations under the License. /* loading.js: test the myriad paths we have for loading the application */ import PlatformPeg from 'matrix-react-sdk/lib/PlatformPeg'; -import Platform from '../../src/vector/platform'; +import WebPlatform from '../../src/vector/platform/WebPlatform'; import 'skin-sdk'; @@ -40,10 +40,21 @@ import * as test_utils from '../test-utils'; import MockHttpBackend from 'matrix-mock-request'; import {parseQs, parseQsFromFragment} from '../../src/vector/url_utils'; -var DEFAULT_HS_URL='http://my_server'; -var DEFAULT_IS_URL='http://my_is'; +const DEFAULT_HS_URL='http://my_server'; +const DEFAULT_IS_URL='http://my_is'; -describe('loading:', function () { +expect.extend({ + toStartWith(prefix) { + expect.assert( + this.actual.startsWith(prefix), + 'expected %s to start with %s', + this.actual, prefix, + ); + return this; + } +}); + +describe('loading:', function() { let parentDiv; let httpBackend; @@ -74,7 +85,7 @@ describe('loading:', function () { }); }); - afterEach(async function () { + afterEach(async function() { console.log(`${Date.now()}: loading: afterEach`); if (parentDiv) { ReactDOM.unmountComponentAtNode(parentDiv); @@ -112,12 +123,12 @@ describe('loading:', function () { toString: function() { return this.search + this.hash; }, }; - let tokenLoginCompleteDefer = Promise.defer(); + const tokenLoginCompleteDefer = Promise.defer(); tokenLoginCompletePromise = tokenLoginCompleteDefer.promise; function onNewScreen(screen) { console.log(Date.now() + " newscreen "+screen); - var hash = '#/' + screen; + const hash = '#/' + screen; windowLocation.hash = hash; console.log(Date.now() + " browser URI now "+ windowLocation); } @@ -129,7 +140,7 @@ describe('loading:', function () { return { screen: fragparts.location.substring(1), params: fragparts.params, - } + }; } const MatrixChat = sdk.getComponent('structures.MatrixChat'); @@ -140,9 +151,9 @@ describe('loading:', function () { default_is_url: DEFAULT_IS_URL, }, opts.config || {}); - PlatformPeg.set(new Platform()); + PlatformPeg.set(new WebPlatform()); - var params = parseQs(windowLocation); + const params = parseQs(windowLocation); matrixChat = ReactDOM.render( tokenLoginCompleteDefer.resolve()} initialScreenAfterLogin={getScreenFromLocation(windowLocation)} makeRegistrationUrl={() => {throw new Error('Not implemented');}} - />, parentDiv + />, parentDiv, ); } @@ -179,7 +190,7 @@ describe('loading:', function () { } describe("Clean load with no stored credentials:", function() { - it('gives a login panel by default', function (done) { + it('gives a login panel by default', function(done) { loadApp(); Promise.delay(1).then(() => { @@ -243,7 +254,7 @@ describe('loading:', function () { return awaitLoginComponent(matrixChat).then(() => { // we expect a single component ReactTestUtils.findRenderedComponentWithType( - matrixChat, sdk.getComponent('structures.login.Login')); + matrixChat, sdk.getComponent('structures.auth.Login')); // the only outstanding request should be a GET /login // (in particular there should be no /register request for @@ -257,7 +268,6 @@ describe('loading:', function () { } return completeLogin(matrixChat); }).then(() => { - // once the sync completes, we should have a room view ReactTestUtils.findRenderedComponentWithType( matrixChat, sdk.getComponent('structures.HomePage')); @@ -333,40 +343,6 @@ describe('loading:', function () { }).done(done, done); }); - it("logs in correctly with a Riot Team Server", function() { - sdk.setFetch(httpBackend.fetchFn); // XXX: ought to restore this! - - httpBackend.when('GET', '/pushrules').respond(200, {}); - httpBackend.when('POST', '/filter').respond(200, { filter_id: 'fid' }); - - loadApp({ - config: { - teamServerConfig: { - teamServerURL: 'http://my_team_server', - }, - }, - }); - - return Promise.delay(1).then(() => { - // we expect a loading spinner while we log into the RTS - assertAtLoadingSpinner(matrixChat); - - httpBackend.when('GET', 'my_team_server/login').respond(200, { - team_token: 'nom', - }); - return httpBackend.flush(); - }).then(() => { - return awaitSyncingSpinner(matrixChat) - }).then(() => { - // we got a sync spinner - let the sync complete - return expectAndAwaitSync(); - }).then(() => { - // once the sync completes, we should have a home page - ReactTestUtils.findRenderedComponentWithType( - matrixChat, sdk.getComponent('structures.HomePage')); - }); - }); - describe('/#/login link:', function() { beforeEach(function() { loadApp({ @@ -380,7 +356,7 @@ describe('loading:', function () { it('shows a login view', function() { // we expect a single component ReactTestUtils.findRenderedComponentWithType( - matrixChat, sdk.getComponent('structures.login.Login') + matrixChat, sdk.getComponent('structures.auth.Login'), ); // the only outstanding request should be a GET /login @@ -408,7 +384,7 @@ describe('loading:', function () { }); describe('Guest auto-registration:', function() { - it('shows a home page by default', function (done) { + it('shows a home page by default', function(done) { loadApp(); Promise.delay(1).then(() => { @@ -438,10 +414,7 @@ describe('loading:', function () { }).done(done, done); }); - it('uses the last known homeserver to register with', function (done) { - localStorage.setItem("mx_hs_url", "https://homeserver" ); - localStorage.setItem("mx_is_url", "https://idserver" ); - + it('uses the default homeserver to register with', function(done) { loadApp(); Promise.delay(1).then(() => { @@ -450,7 +423,7 @@ describe('loading:', function () { assertAtLoadingSpinner(matrixChat); httpBackend.when('POST', '/register').check(function(req) { - expect(req.path).toMatch(new RegExp("^https://homeserver/")); + expect(req.path).toStartWith(DEFAULT_HS_URL); expect(req.queryParams.kind).toEqual('guest'); }).respond(200, { user_id: "@guest:localhost", @@ -463,21 +436,21 @@ describe('loading:', function () { }).then(() => { return expectAndAwaitSync(); }).then((req) => { - expect(req.path).toMatch(new RegExp("^https://homeserver/")); + expect(req.path).toStartWith(DEFAULT_HS_URL); // once the sync completes, we should have a home page httpBackend.verifyNoOutstandingExpectation(); ReactTestUtils.findRenderedComponentWithType( matrixChat, sdk.getComponent('structures.HomePage')); expect(windowLocation.hash).toEqual("#/home"); - expect(MatrixClientPeg.get().baseUrl).toEqual("https://homeserver"); - expect(MatrixClientPeg.get().idBaseUrl).toEqual("https://idserver"); + expect(MatrixClientPeg.get().baseUrl).toEqual(DEFAULT_HS_URL); + expect(MatrixClientPeg.get().idBaseUrl).toEqual(DEFAULT_IS_URL); }).done(done, done); }); it('shows a room view if we followed a room link', function(done) { loadApp({ - uriFragment: "#/room/!room:id" + uriFragment: "#/room/!room:id", }); Promise.delay(1).then(() => { // at this point, we're trying to do a guest registration; @@ -547,7 +520,7 @@ describe('loading:', function () { // we expect a single component ReactTestUtils.findRenderedComponentWithType( - matrixChat, sdk.getComponent('structures.login.Login') + matrixChat, sdk.getComponent('structures.auth.Login'), ); }); @@ -555,7 +528,7 @@ describe('loading:', function () { // ILAG renders this obsolete. I think. it('should allow us to return to the app', function() { const login = ReactTestUtils.findRenderedComponentWithType( - matrixChat, sdk.getComponent('structures.login.Login') + matrixChat, sdk.getComponent('structures.auth.Login') ); const linkText = 'Return to app'; @@ -580,7 +553,7 @@ describe('loading:', function () { }); describe('Token login:', function() { - it('logs in successfully', function (done) { + it('logs in successfully', function(done) { loadApp({ queryString: "?loginToken=secretToken&homeserver=https%3A%2F%2Fhomeserver&identityServer=https%3A%2F%2Fidserver", }); @@ -623,7 +596,7 @@ describe('loading:', function () { function completeLogin(matrixChat) { // we expect a single component const login = ReactTestUtils.findRenderedComponentWithType( - matrixChat, sdk.getComponent('structures.login.Login')); + matrixChat, sdk.getComponent('structures.auth.Login')); httpBackend.when('POST', '/login').check(function(req) { expect(req.data.type).toEqual('m.login.password'); @@ -658,7 +631,7 @@ describe('loading:', function () { // assert that we are on the loading page function assertAtLoadingSpinner(matrixChat) { - var domComponent = ReactDOM.findDOMNode(matrixChat); + const domComponent = ReactDOM.findDOMNode(matrixChat); expect(domComponent.className).toEqual("mx_MatrixChat_splash"); // just the spinner @@ -697,12 +670,12 @@ function awaitSyncingSpinner(matrixChat, retryLimit, retryCount) { } function assertAtSyncingSpinner(matrixChat) { - var domComponent = ReactDOM.findDOMNode(matrixChat); + const domComponent = ReactDOM.findDOMNode(matrixChat); expect(domComponent.className).toEqual("mx_MatrixChat_splash"); ReactTestUtils.findRenderedComponentWithType( matrixChat, sdk.getComponent('elements.Spinner')); - var logoutLink = ReactTestUtils.findRenderedDOMComponentWithTag( + const logoutLink = ReactTestUtils.findRenderedDOMComponentWithTag( matrixChat, 'a'); expect(logoutLink.text).toEqual("Logout"); } @@ -736,6 +709,6 @@ function awaitRoomView(matrixChat, retryLimit, retryCount) { function awaitLoginComponent(matrixChat, attempts) { return MatrixReactTestUtils.waitForRenderedComponentWithType( - matrixChat, sdk.getComponent('structures.login.Login'), attempts, + matrixChat, sdk.getComponent('structures.auth.Login'), attempts, ); } diff --git a/test/skin-sdk.js b/test/skin-sdk.js index 3421d5d07d..b839df8fa4 100644 --- a/test/skin-sdk.js +++ b/test/skin-sdk.js @@ -4,5 +4,5 @@ * Skins the react-sdk with the vector components */ -var sdk = require('matrix-react-sdk'); +const sdk = require('matrix-react-sdk'); sdk.loadSkin(require('../src/component-index')); diff --git a/test/test-utils.js b/test/test-utils.js index a5b22febfe..4e07be1497 100644 --- a/test/test-utils.js +++ b/test/test-utils.js @@ -8,7 +8,7 @@ import Promise from 'bluebird'; * @param {Mocha.Context} context The test context */ export function beforeEach(context) { - var desc = context.currentTest.fullTitle(); + const desc = context.currentTest.fullTitle(); console.log(); console.log(desc); console.log(new Array(1 + desc.length).join("=")); @@ -22,7 +22,7 @@ export function beforeEach(context) { * returns true if the current environment supports webrtc */ export function browserSupportsWebRTC() { - var n = global.window.navigator; + const n = global.window.navigator; return n.getUserMedia || n.webkitGetUserMedia || n.mozGetUserMedia; } diff --git a/webpack.config.js b/webpack.config.js index f335aa3c1b..d0711eaf40 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -4,7 +4,7 @@ const ExtractTextPlugin = require('extract-text-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin'); let og_image_url = process.env.RIOT_OG_IMAGE_URL; -if (!og_image_url) og_image_url = 'https://riot.im/app/themes/riot/img/logos/riot-im-logo-1.png'; +if (!og_image_url) og_image_url = 'https://riot.im/app/themes/riot/img/logos/riot-im-logo-black-text.png'; module.exports = { entry: { @@ -16,34 +16,42 @@ module.exports = { "mobileguide": "./src/vector/mobile_guide/index.js", // CSS themes - "theme-light": "./node_modules/matrix-react-sdk/res/themes/light/css/light.scss", - "theme-dark": "./node_modules/matrix-react-sdk/res/themes/dark/css/dark.scss", - "theme-status": "./res/themes/status/css/status.scss", + //"theme-light": "./node_modules/matrix-react-sdk/res/themes/light/css/light.scss", + //"theme-dark": "./node_modules/matrix-react-sdk/res/themes/dark/css/dark.scss", + "theme-dharma": "./node_modules/matrix-react-sdk/res/themes/dharma/css/dharma.scss", + //"theme-status": "./res/themes/status/css/status.scss", }, module: { rules: [ { enforce: 'pre', test: /\.js$/, use: "source-map-loader", exclude: /node_modules/, }, { test: /\.js$/, use: "babel-loader", include: path.resolve(__dirname, 'src') }, + { + test: /\.wasm$/, + loader: "file-loader", + type: "javascript/auto", // https://github.com/webpack/webpack/issues/6725 + options: { + name: '[name].[hash:7].[ext]', + outputPath: '.', + }, + }, { test: /\.scss$/, // 1. postcss-loader turns the SCSS into normal CSS. - // 2. raw-loader turns the CSS into a javascript module - // whose default export is a string containing the CSS. - // (raw-loader is similar to css-loader, but the latter - // would also drag in the imgs and fonts that our CSS refers to - // as webpack inputs.) + // 2. css-loader turns the CSS into a JS module whose default + // export is a string containing the CSS, while also adding + // the images and fonts from CSS as Webpack inputs. // 3. ExtractTextPlugin turns that string into a separate asset. use: ExtractTextPlugin.extract({ use: [ - "raw-loader", + "css-loader", { loader: 'postcss-loader', options: { config: { - path: './postcss.config.js' - } - } - } + path: './postcss.config.js', + }, + }, + }, ], }), }, @@ -51,10 +59,40 @@ module.exports = { // this works similarly to the scss case, without postcss. test: /\.css$/, use: ExtractTextPlugin.extract({ - use: "raw-loader" + use: "css-loader", }), }, - + { + test: /\.(gif|png|svg|ttf)$/, + // Use a content-based hash in the name so that we can set a long cache + // lifetime for assets while still delivering changes quickly. + oneOf: [ + { + // Images referenced in CSS files + issuer: /\.(scss|css)$/, + loader: 'file-loader', + options: { + name: '[name].[hash:7].[ext]', + outputPath: getImgOutputPath, + publicPath: function(url, resourcePath) { + // CSS image usages end up in the `bundles/[hash]` output + // directory, so we adjust the final path to navigate up + // twice. + const outputPath = getImgOutputPath(url, resourcePath); + return toPublicPath(path.join("../..", outputPath)); + }, + }, + }, + { + // Images referenced in HTML and JS files + loader: 'file-loader', + options: { + name: '[name].[hash:7].[ext]', + outputPath: getImgOutputPath, + }, + }, + ], + }, ], noParse: [ // for cross platform compatibility use [\\\/] as the path separator @@ -74,14 +112,13 @@ module.exports = { output: { path: path.join(__dirname, "webapp"), - // the generated js (and CSS, from the ExtractTextPlugin) are put in a + // The generated JS (and CSS, from the ExtractTextPlugin) are put in a // unique subdirectory for the build. There will only be one such // 'bundle' directory in the generated tarball; however, hosting // servers can collect 'bundles' from multiple versions into one // directory and symlink it into place - this allows users who loaded // an older version of the application to continue to access webpack // chunks even after the app is redeployed. - // filename: "bundles/[hash]/[name].js", chunkFilename: "bundles/[hash]/[name].js", devtoolModuleFilenameTemplate: function(info) { @@ -108,11 +145,6 @@ module.exports = { "matrix-js-sdk": path.resolve('./node_modules/matrix-js-sdk'), }, }, - externals: { - // Don't try to bundle electron: leave it as a commonjs dependency - // (the 'commonjs' here means it will output a 'require') - "electron": "commonjs electron", - }, plugins: [ new webpack.DefinePlugin({ 'process.env': { @@ -162,3 +194,27 @@ module.exports = { inline: false, }, }; + +/** + * Merge assets found via CSS and imports into a single tree, while also preserving + * directories under `res`. + * + * @param {string} url The adjusted name of the file, such as `warning.1234567.svg`. + * @param {string} resourcePath The absolute path to the source file with unmodified name. + * @return {string} The returned paths will look like `img/warning.1234567.svg`. + */ +function getImgOutputPath(url, resourcePath) { + const prefix = /^.*[/\\]res[/\\]/; + const outputDir = path.dirname(resourcePath).replace(prefix, ""); + return path.join(outputDir, path.basename(url)); +} + +/** + * Convert path to public path format, which always uses forward slashes, since it will + * be placed directly into things like CSS files. + * + * @param {string} path Some path to a file. + */ +function toPublicPath(path) { + return path.replace(/\\/g, '/'); +}