}\n */\n getKeysClaimed: function getKeysClaimed() {\n return {\n ed25519: this._claimedEd25519Key\n };\n },\n\n /**\n * Get the ed25519 the sender of this event claims to own.\n *\n * For Olm messages, this claim is encoded directly in the plaintext of the\n * event itself. For megolm messages, it is implied by the m.room_key event\n * which established the megolm session.\n *\n * Until we download the device list of the sender, it's just a claim: the\n * device list gives a proof that the owner of the curve25519 key used for\n * this event (and returned by #getSenderKey) also owns the ed25519 key by\n * signing the public curve25519 key with the ed25519 key.\n *\n * In general, applications should not use this method directly, but should\n * instead use MatrixClient.getEventSenderDeviceInfo.\n *\n * @return {string}\n */\n getClaimedEd25519Key: function getClaimedEd25519Key() {\n return this._claimedEd25519Key;\n },\n\n /**\n * Get the curve25519 keys of the devices which were involved in telling us\n * about the claimedEd25519Key and sender curve25519 key.\n *\n * Normally this will be empty, but in the case of a forwarded megolm\n * session, the sender keys are sent to us by another device (the forwarding\n * device), which we need to trust to do this. In that case, the result will\n * be a list consisting of one entry.\n *\n * If the device that sent us the key (A) got it from another device which\n * it wasn't prepared to vouch for (B), the result will be [A, B]. And so on.\n *\n * @return {string[]} base64-encoded curve25519 keys, from oldest to newest.\n */\n getForwardingCurve25519KeyChain: function getForwardingCurve25519KeyChain() {\n return this._forwardingCurve25519KeyChain;\n },\n\n getUnsigned: function getUnsigned() {\n return this.event.unsigned || {};\n },\n\n /**\n * Update the content of an event in the same way it would be by the server\n * if it were redacted before it was sent to us\n *\n * @param {module:models/event.MatrixEvent} redaction_event\n * event causing the redaction\n */\n makeRedacted: function makeRedacted(redaction_event) {\n // quick sanity-check\n if (!redaction_event.event) {\n throw new Error(\"invalid redaction_event in makeRedacted\");\n }\n\n // we attempt to replicate what we would see from the server if\n // the event had been redacted before we saw it.\n //\n // The server removes (most of) the content of the event, and adds a\n // \"redacted_because\" key to the unsigned section containing the\n // redacted event.\n if (!this.event.unsigned) {\n this.event.unsigned = {};\n }\n this.event.unsigned.redacted_because = redaction_event.event;\n\n var key = void 0;\n for (key in this.event) {\n if (!this.event.hasOwnProperty(key)) {\n continue;\n }\n if (!_REDACT_KEEP_KEY_MAP[key]) {\n delete this.event[key];\n }\n }\n\n var keeps = _REDACT_KEEP_CONTENT_MAP[this.getType()] || {};\n var content = this.getContent();\n for (key in content) {\n if (!content.hasOwnProperty(key)) {\n continue;\n }\n if (!keeps[key]) {\n delete content[key];\n }\n }\n },\n\n /**\n * Check if this event has been redacted\n *\n * @return {boolean} True if this event has been redacted\n */\n isRedacted: function isRedacted() {\n return Boolean(this.getUnsigned().redacted_because);\n },\n\n /**\n * Get the push actions, if known, for this event\n *\n * @return {?Object} push actions\n */\n getPushActions: function getPushActions() {\n return this._pushActions;\n },\n\n /**\n * Set the push actions for this event.\n *\n * @param {Object} pushActions push actions\n */\n setPushActions: function setPushActions(pushActions) {\n this._pushActions = pushActions;\n },\n\n /**\n * Replace the `event` property and recalculate any properties based on it.\n * @param {Object} event the object to assign to the `event` property\n */\n handleRemoteEcho: function handleRemoteEcho(event) {\n this.event = event;\n // successfully sent.\n this.status = null;\n }\n});\n\n/* _REDACT_KEEP_KEY_MAP gives the keys we keep when an event is redacted\n *\n * This is specified here:\n * http://matrix.org/speculator/spec/HEAD/client_server/unstable.html#redactions\n *\n * Also:\n * - We keep 'unsigned' since that is created by the local server\n * - We keep user_id for backwards-compat with v1\n */\nvar _REDACT_KEEP_KEY_MAP = ['event_id', 'type', 'room_id', 'user_id', 'sender', 'state_key', 'prev_state', 'content', 'unsigned', 'origin_server_ts'].reduce(function (ret, val) {\n ret[val] = 1;return ret;\n}, {});\n\n// a map from event type to the .content keys we keep when an event is redacted\nvar _REDACT_KEEP_CONTENT_MAP = {\n 'm.room.member': { 'membership': 1 },\n 'm.room.create': { 'creator': 1 },\n 'm.room.join_rules': { 'join_rule': 1 },\n 'm.room.power_levels': { 'ban': 1, 'events': 1, 'events_default': 1,\n 'kick': 1, 'redact': 1, 'state_default': 1,\n 'users': 1, 'users_default': 1\n },\n 'm.room.aliases': { 'aliases': 1 }\n};\n\n/**\n * Fires when an event is decrypted\n *\n * @event module:models/event.MatrixEvent#\"Event.decrypted\"\n *\n * @param {module:models/event.MatrixEvent} event\n * The matrix event which has been decrypted\n * @param {module:crypto/algorithms/base.DecryptionError?} err\n * The error that occured during decryption, or `undefined` if no\n * error occured.\n */\n//# sourceMappingURL=event.js.map","module.exports = function(module) {\r\n\tif (!module.webpackPolyfill) {\r\n\t\tmodule.deprecate = function() {};\r\n\t\tmodule.paths = [];\r\n\t\t// module.parent = undefined by default\r\n\t\tif (!module.children) module.children = [];\r\n\t\tObject.defineProperty(module, \"loaded\", {\r\n\t\t\tenumerable: true,\r\n\t\t\tget: function() {\r\n\t\t\t\treturn module.l;\r\n\t\t\t}\r\n\t\t});\r\n\t\tObject.defineProperty(module, \"id\", {\r\n\t\t\tenumerable: true,\r\n\t\t\tget: function() {\r\n\t\t\t\treturn module.i;\r\n\t\t\t}\r\n\t\t});\r\n\t\tmodule.webpackPolyfill = 1;\r\n\t}\r\n\treturn module;\r\n};\r\n","/*\nCopyright 2016, 2017 OpenMarket Ltd\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\"use strict\";\n\n/**\n * @module models/event-timeline\n */\n\nvar _freeze = require(\"babel-runtime/core-js/object/freeze\");\n\nvar _freeze2 = _interopRequireDefault(_freeze);\n\nvar _getIterator2 = require(\"babel-runtime/core-js/get-iterator\");\n\nvar _getIterator3 = _interopRequireDefault(_getIterator2);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar RoomState = require(\"./room-state\");\n\n/**\n * Construct a new EventTimeline\n *\n * An EventTimeline represents a contiguous sequence of events in a room.\n *\n *
As well as keeping track of the events themselves, it stores the state of\n * the room at the beginning and end of the timeline, and pagination tokens for\n * going backwards and forwards in the timeline.\n *\n *
In order that clients can meaningfully maintain an index into a timeline,\n * the EventTimeline object tracks a 'baseIndex'. This starts at zero, but is\n * incremented when events are prepended to the timeline. The index of an event\n * relative to baseIndex therefore remains constant.\n *\n *
Once a timeline joins up with its neighbour, they are linked together into a\n * doubly-linked list.\n *\n * @param {EventTimelineSet} eventTimelineSet the set of timelines this is part of\n * @constructor\n */\nfunction EventTimeline(eventTimelineSet) {\n this._eventTimelineSet = eventTimelineSet;\n this._roomId = eventTimelineSet.room ? eventTimelineSet.room.roomId : null;\n this._events = [];\n this._baseIndex = 0;\n this._startState = new RoomState(this._roomId);\n this._startState.paginationToken = null;\n this._endState = new RoomState(this._roomId);\n this._endState.paginationToken = null;\n\n this._prevTimeline = null;\n this._nextTimeline = null;\n\n // this is used by client.js\n this._paginationRequests = { 'b': null, 'f': null };\n\n this._name = this._roomId + \":\" + new Date().toISOString();\n}\n\n/**\n * Symbolic constant for methods which take a 'direction' argument:\n * refers to the start of the timeline, or backwards in time.\n */\nEventTimeline.BACKWARDS = \"b\";\n\n/**\n * Symbolic constant for methods which take a 'direction' argument:\n * refers to the end of the timeline, or forwards in time.\n */\nEventTimeline.FORWARDS = \"f\";\n\n/**\n * Initialise the start and end state with the given events\n *\n *
This can only be called before any events are added.\n *\n * @param {MatrixEvent[]} stateEvents list of state events to initialise the\n * state with.\n * @throws {Error} if an attempt is made to call this after addEvent is called.\n */\nEventTimeline.prototype.initialiseState = function (stateEvents) {\n if (this._events.length > 0) {\n throw new Error(\"Cannot initialise state after events are added\");\n }\n\n // We previously deep copied events here and used different copies in\n // the oldState and state events: this decision seems to date back\n // quite a way and was apparently made to fix a bug where modifications\n // made to the start state leaked through to the end state.\n // This really shouldn't be possible though: the events themselves should\n // not change. Duplicating the events uses a lot of extra memory,\n // so we now no longer do it. To assert that they really do never change,\n // freeze them! Note that we can't do this for events in general:\n // although it looks like the only things preventing us are the\n // 'status' flag, forwardLooking (which is only set once when adding to the\n // timeline) and possibly the sender (which seems like it should never be\n // reset but in practice causes a lot of the tests to break).\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = (0, _getIterator3.default)(stateEvents), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var e = _step.value;\n\n (0, _freeze2.default)(e);\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n this._startState.setStateEvents(stateEvents);\n this._endState.setStateEvents(stateEvents);\n};\n\n/**\n * Forks the (live) timeline, taking ownership of the existing directional state of this timeline.\n * All attached listeners will keep receiving state updates from the new live timeline state.\n * The end state of this timeline gets replaced with an independent copy of the current RoomState,\n * and will need a new pagination token if it ever needs to paginate forwards.\n\n * @param {string} direction EventTimeline.BACKWARDS to get the state at the\n * start of the timeline; EventTimeline.FORWARDS to get the state at the end\n * of the timeline.\n *\n * @return {EventTimeline} the new timeline\n */\nEventTimeline.prototype.forkLive = function (direction) {\n var forkState = this.getState(direction);\n var timeline = new EventTimeline(this._eventTimelineSet);\n timeline._startState = forkState.clone();\n // Now clobber the end state of the new live timeline with that from the\n // previous live timeline. It will be identical except that we'll keep\n // using the same RoomMember objects for the 'live' set of members with any\n // listeners still attached\n timeline._endState = forkState;\n // Firstly, we just stole the current timeline's end state, so it needs a new one.\n // Make an immutable copy of the state so back pagination will get the correct sentinels.\n this._endState = forkState.clone();\n return timeline;\n};\n\n/**\n * Creates an independent timeline, inheriting the directional state from this timeline.\n *\n * @param {string} direction EventTimeline.BACKWARDS to get the state at the\n * start of the timeline; EventTimeline.FORWARDS to get the state at the end\n * of the timeline.\n *\n * @return {EventTimeline} the new timeline\n */\nEventTimeline.prototype.fork = function (direction) {\n var forkState = this.getState(direction);\n var timeline = new EventTimeline(this._eventTimelineSet);\n timeline._startState = forkState.clone();\n timeline._endState = forkState.clone();\n return timeline;\n};\n\n/**\n * Get the ID of the room for this timeline\n * @return {string} room ID\n */\nEventTimeline.prototype.getRoomId = function () {\n return this._roomId;\n};\n\n/**\n * Get the filter for this timeline's timelineSet (if any)\n * @return {Filter} filter\n */\nEventTimeline.prototype.getFilter = function () {\n return this._eventTimelineSet.getFilter();\n};\n\n/**\n * Get the timelineSet for this timeline\n * @return {EventTimelineSet} timelineSet\n */\nEventTimeline.prototype.getTimelineSet = function () {\n return this._eventTimelineSet;\n};\n\n/**\n * Get the base index.\n *\n *
This is an index which is incremented when events are prepended to the\n * timeline. An individual event therefore stays at the same index in the array\n * relative to the base index (although note that a given event's index may\n * well be less than the base index, thus giving that event a negative relative\n * index).\n *\n * @return {number}\n */\nEventTimeline.prototype.getBaseIndex = function () {\n return this._baseIndex;\n};\n\n/**\n * Get the list of events in this context\n *\n * @return {MatrixEvent[]} An array of MatrixEvents\n */\nEventTimeline.prototype.getEvents = function () {\n return this._events;\n};\n\n/**\n * Get the room state at the start/end of the timeline\n *\n * @param {string} direction EventTimeline.BACKWARDS to get the state at the\n * start of the timeline; EventTimeline.FORWARDS to get the state at the end\n * of the timeline.\n *\n * @return {RoomState} state at the start/end of the timeline\n */\nEventTimeline.prototype.getState = function (direction) {\n if (direction == EventTimeline.BACKWARDS) {\n return this._startState;\n } else if (direction == EventTimeline.FORWARDS) {\n return this._endState;\n } else {\n throw new Error(\"Invalid direction '\" + direction + \"'\");\n }\n};\n\n/**\n * Get a pagination token\n *\n * @param {string} direction EventTimeline.BACKWARDS to get the pagination\n * token for going backwards in time; EventTimeline.FORWARDS to get the\n * pagination token for going forwards in time.\n *\n * @return {?string} pagination token\n */\nEventTimeline.prototype.getPaginationToken = function (direction) {\n return this.getState(direction).paginationToken;\n};\n\n/**\n * Set a pagination token\n *\n * @param {?string} token pagination token\n *\n * @param {string} direction EventTimeline.BACKWARDS to set the pagination\n * token for going backwards in time; EventTimeline.FORWARDS to set the\n * pagination token for going forwards in time.\n */\nEventTimeline.prototype.setPaginationToken = function (token, direction) {\n this.getState(direction).paginationToken = token;\n};\n\n/**\n * Get the next timeline in the series\n *\n * @param {string} direction EventTimeline.BACKWARDS to get the previous\n * timeline; EventTimeline.FORWARDS to get the next timeline.\n *\n * @return {?EventTimeline} previous or following timeline, if they have been\n * joined up.\n */\nEventTimeline.prototype.getNeighbouringTimeline = function (direction) {\n if (direction == EventTimeline.BACKWARDS) {\n return this._prevTimeline;\n } else if (direction == EventTimeline.FORWARDS) {\n return this._nextTimeline;\n } else {\n throw new Error(\"Invalid direction '\" + direction + \"'\");\n }\n};\n\n/**\n * Set the next timeline in the series\n *\n * @param {EventTimeline} neighbour previous/following timeline\n *\n * @param {string} direction EventTimeline.BACKWARDS to set the previous\n * timeline; EventTimeline.FORWARDS to set the next timeline.\n *\n * @throws {Error} if an attempt is made to set the neighbouring timeline when\n * it is already set.\n */\nEventTimeline.prototype.setNeighbouringTimeline = function (neighbour, direction) {\n if (this.getNeighbouringTimeline(direction)) {\n throw new Error(\"timeline already has a neighbouring timeline - \" + \"cannot reset neighbour\");\n }\n\n if (direction == EventTimeline.BACKWARDS) {\n this._prevTimeline = neighbour;\n } else if (direction == EventTimeline.FORWARDS) {\n this._nextTimeline = neighbour;\n } else {\n throw new Error(\"Invalid direction '\" + direction + \"'\");\n }\n\n // make sure we don't try to paginate this timeline\n this.setPaginationToken(null, direction);\n};\n\n/**\n * Add a new event to the timeline, and update the state\n *\n * @param {MatrixEvent} event new event\n * @param {boolean} atStart true to insert new event at the start\n */\nEventTimeline.prototype.addEvent = function (event, atStart) {\n var stateContext = atStart ? this._startState : this._endState;\n\n // only call setEventMetadata on the unfiltered timelineSets\n var timelineSet = this.getTimelineSet();\n if (timelineSet.room && timelineSet.room.getUnfilteredTimelineSet() === timelineSet) {\n EventTimeline.setEventMetadata(event, stateContext, atStart);\n\n // modify state\n if (event.isState()) {\n stateContext.setStateEvents([event]);\n // it is possible that the act of setting the state event means we\n // can set more metadata (specifically sender/target props), so try\n // it again if the prop wasn't previously set. It may also mean that\n // the sender/target is updated (if the event set was a room member event)\n // so we want to use the *updated* member (new avatar/name) instead.\n //\n // However, we do NOT want to do this on member events if we're going\n // back in time, else we'll set the .sender value for BEFORE the given\n // member event, whereas we want to set the .sender value for the ACTUAL\n // member event itself.\n if (!event.sender || event.getType() === \"m.room.member\" && !atStart) {\n EventTimeline.setEventMetadata(event, stateContext, atStart);\n }\n }\n }\n\n var insertIndex = void 0;\n\n if (atStart) {\n insertIndex = 0;\n } else {\n insertIndex = this._events.length;\n }\n\n this._events.splice(insertIndex, 0, event); // insert element\n if (atStart) {\n this._baseIndex++;\n }\n};\n\n/**\n * Static helper method to set sender and target properties\n *\n * @param {MatrixEvent} event the event whose metadata is to be set\n * @param {RoomState} stateContext the room state to be queried\n * @param {bool} toStartOfTimeline if true the event's forwardLooking flag is set false\n */\nEventTimeline.setEventMetadata = function (event, stateContext, toStartOfTimeline) {\n // set sender and target properties\n event.sender = stateContext.getSentinelMember(event.getSender());\n if (event.getType() === \"m.room.member\") {\n event.target = stateContext.getSentinelMember(event.getStateKey());\n }\n if (event.isState()) {\n // room state has no concept of 'old' or 'current', but we want the\n // room state to regress back to previous values if toStartOfTimeline\n // is set, which means inspecting prev_content if it exists. This\n // is done by toggling the forwardLooking flag.\n if (toStartOfTimeline) {\n event.forwardLooking = false;\n }\n }\n};\n\n/**\n * Remove an event from the timeline\n *\n * @param {string} eventId ID of event to be removed\n * @return {?MatrixEvent} removed event, or null if not found\n */\nEventTimeline.prototype.removeEvent = function (eventId) {\n for (var i = this._events.length - 1; i >= 0; i--) {\n var ev = this._events[i];\n if (ev.getId() == eventId) {\n this._events.splice(i, 1);\n if (i < this._baseIndex) {\n this._baseIndex--;\n }\n return ev;\n }\n }\n return null;\n};\n\n/**\n * Return a string to identify this timeline, for debugging\n *\n * @return {string} name for this timeline\n */\nEventTimeline.prototype.toString = function () {\n return this._name;\n};\n\n/**\n * The EventTimeline class\n */\nmodule.exports = EventTimeline;\n//# sourceMappingURL=event-timeline.js.map","'use strict';\n\nvar _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _createClass2 = require('babel-runtime/helpers/createClass');\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nvar _bluebird = require('bluebird');\n\nvar _bluebird2 = _interopRequireDefault(_bluebird);\n\nvar _SettingsStore = require('./settings/SettingsStore');\n\nvar _SettingsStore2 = _interopRequireDefault(_SettingsStore);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/*\nCopyright 2016 OpenMarket Ltd\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nvar request = require('browser-request');\n\nvar SdkConfig = require('./SdkConfig');\nvar MatrixClientPeg = require('./MatrixClientPeg');\n\nvar ScalarAuthClient = function () {\n function ScalarAuthClient() {\n (0, _classCallCheck3.default)(this, ScalarAuthClient);\n\n this.scalarToken = null;\n }\n\n (0, _createClass3.default)(ScalarAuthClient, [{\n key: 'connect',\n value: function connect() {\n var _this = this;\n\n return this.getScalarToken().then(function (tok) {\n _this.scalarToken = tok;\n });\n }\n }, {\n key: 'hasCredentials',\n value: function hasCredentials() {\n return this.scalarToken != null; // undef or null\n }\n\n // Returns a scalar_token string\n\n }, {\n key: 'getScalarToken',\n value: function getScalarToken() {\n var _this2 = this;\n\n var token = window.localStorage.getItem(\"mx_scalar_token\");\n\n if (!token) {\n return this.registerForToken();\n } else {\n return this.validateToken(token).then(function (userId) {\n var me = MatrixClientPeg.get().getUserId();\n if (userId !== me) {\n throw new Error(\"Scalar token is owned by someone else: \" + me);\n }\n return token;\n }).catch(function (err) {\n console.error(err);\n\n // Something went wrong - try to get a new token.\n console.warn(\"Registering for new scalar token\");\n return _this2.registerForToken();\n });\n }\n }\n }, {\n key: 'validateToken',\n value: function validateToken(token) {\n var url = SdkConfig.get().integrations_rest_url + \"/account\";\n\n return new _bluebird2.default(function (resolve, reject) {\n request({\n method: \"GET\",\n uri: url,\n qs: { scalar_token: token },\n json: true\n }, function (err, response, body) {\n if (err) {\n reject(err);\n } else if (response.statusCode / 100 !== 2) {\n reject({ statusCode: response.statusCode });\n } else if (!body || !body.user_id) {\n reject(new Error(\"Missing user_id in response\"));\n } else {\n resolve(body.user_id);\n }\n });\n });\n }\n }, {\n key: 'registerForToken',\n value: function registerForToken() {\n var _this3 = this;\n\n // Get openid bearer token from the HS as the first part of our dance\n return MatrixClientPeg.get().getOpenIdToken().then(function (token_object) {\n // Now we can send that to scalar and exchange it for a scalar token\n return _this3.exchangeForScalarToken(token_object);\n }).then(function (token_object) {\n window.localStorage.setItem(\"mx_scalar_token\", token_object);\n return token_object;\n });\n }\n }, {\n key: 'exchangeForScalarToken',\n value: function exchangeForScalarToken(openid_token_object) {\n var scalar_rest_url = SdkConfig.get().integrations_rest_url;\n\n return new _bluebird2.default(function (resolve, reject) {\n request({\n method: 'POST',\n uri: scalar_rest_url + '/register',\n body: openid_token_object,\n json: true\n }, function (err, response, body) {\n if (err) {\n reject(err);\n } else if (response.statusCode / 100 !== 2) {\n reject({ statusCode: response.statusCode });\n } else if (!body || !body.scalar_token) {\n reject(new Error(\"Missing scalar_token in response\"));\n } else {\n resolve(body.scalar_token);\n }\n });\n });\n }\n }, {\n key: 'getScalarPageTitle',\n value: function getScalarPageTitle(url) {\n var scalarPageLookupUrl = SdkConfig.get().integrations_rest_url + '/widgets/title_lookup';\n scalarPageLookupUrl = this.getStarterLink(scalarPageLookupUrl);\n scalarPageLookupUrl += '&curl=' + encodeURIComponent(url);\n\n return new _bluebird2.default(function (resolve, reject) {\n request({\n method: 'GET',\n uri: scalarPageLookupUrl,\n json: true\n }, function (err, response, body) {\n if (err) {\n reject(err);\n } else if (response.statusCode / 100 !== 2) {\n reject({ statusCode: response.statusCode });\n } else if (!body) {\n reject(new Error(\"Missing page title in response\"));\n } else {\n var title = \"\";\n if (body.page_title_cache_item && body.page_title_cache_item.cached_title) {\n title = body.page_title_cache_item.cached_title;\n }\n resolve(title);\n }\n });\n });\n }\n\n /**\n * Mark all assets associated with the specified widget as \"disabled\" in the\n * integration manager database.\n * This can be useful to temporarily prevent purchased assets from being displayed.\n * @param {string} widgetType [description]\n * @param {string} widgetId [description]\n * @return {Promise} Resolves on completion\n */\n\n }, {\n key: 'disableWidgetAssets',\n value: function disableWidgetAssets(widgetType, widgetId) {\n var url = SdkConfig.get().integrations_rest_url + '/widgets/set_assets_state';\n url = this.getStarterLink(url);\n return new _bluebird2.default(function (resolve, reject) {\n request({\n method: 'GET',\n uri: url,\n json: true,\n qs: {\n 'widget_type': widgetType,\n 'widget_id': widgetId,\n 'state': 'disable'\n }\n }, function (err, response, body) {\n if (err) {\n reject(err);\n } else if (response.statusCode / 100 !== 2) {\n reject({ statusCode: response.statusCode });\n } else if (!body) {\n reject(new Error(\"Failed to set widget assets state\"));\n } else {\n resolve();\n }\n });\n });\n }\n }, {\n key: 'getScalarInterfaceUrlForRoom',\n value: function getScalarInterfaceUrlForRoom(room, screen, id) {\n var roomId = room.roomId;\n var roomName = room.name;\n var url = SdkConfig.get().integrations_ui_url;\n url += \"?scalar_token=\" + encodeURIComponent(this.scalarToken);\n url += \"&room_id=\" + encodeURIComponent(roomId);\n url += \"&room_name=\" + encodeURIComponent(roomName);\n url += \"&theme=\" + encodeURIComponent(_SettingsStore2.default.getValue(\"theme\"));\n if (id) {\n url += '&integ_id=' + encodeURIComponent(id);\n }\n if (screen) {\n url += '&screen=' + encodeURIComponent(screen);\n }\n return url;\n }\n }, {\n key: 'getStarterLink',\n value: function getStarterLink(starterLinkUrl) {\n return starterLinkUrl + \"?scalar_token=\" + encodeURIComponent(this.scalarToken);\n }\n }]);\n return ScalarAuthClient;\n}();\n\nmodule.exports = ScalarAuthClient;\n//# sourceMappingURL=ScalarAuthClient.js.map","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _createClass2 = require('babel-runtime/helpers/createClass');\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/*\nCopyright 2015 OpenMarket Ltd\nCopyright 2017 New Vector Ltd\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nvar DEBUG = 0;\n\n// utility to turn #rrggbb or rgb(r,g,b) into [red,green,blue]\nfunction colorToRgb(color) {\n if (!color) {\n return [0, 0, 0];\n }\n\n if (color[0] === '#') {\n color = color.slice(1);\n if (color.length === 3) {\n color = color[0] + color[0] + color[1] + color[1] + color[2] + color[2];\n }\n var val = parseInt(color, 16);\n var r = val >> 16 & 255;\n var g = val >> 8 & 255;\n var b = val & 255;\n return [r, g, b];\n } else {\n var match = color.match(/rgb\\((.*?),(.*?),(.*?)\\)/);\n if (match) {\n return [parseInt(match[1]), parseInt(match[2]), parseInt(match[3])];\n }\n }\n return [0, 0, 0];\n}\n\n// utility to turn [red,green,blue] into #rrggbb\nfunction rgbToColor(rgb) {\n var val = rgb[0] << 16 | rgb[1] << 8 | rgb[2];\n return '#' + (0x1000000 + val).toString(16).slice(1);\n}\n\nvar Tinter = function () {\n function Tinter() {\n (0, _classCallCheck3.default)(this, Tinter);\n\n // The default colour keys to be replaced as referred to in CSS\n // (should be overridden by .mx_theme_accentColor and .mx_theme_secondaryAccentColor)\n this.keyRgb = [\"rgb(118, 207, 166)\", // Vector Green\n \"rgb(234, 245, 240)\", // Vector Light Green\n \"rgb(211, 239, 225)\"];\n\n // Some algebra workings for calculating the tint % of Vector Green & Light Green\n // x * 118 + (1 - x) * 255 = 234\n // x * 118 + 255 - 255 * x = 234\n // x * 118 - x * 255 = 234 - 255\n // (255 - 118) x = 255 - 234\n // x = (255 - 234) / (255 - 118) = 0.16\n\n // The colour keys to be replaced as referred to in SVGs\n this.keyHex = [\"#76CFA6\", // Vector Green\n \"#EAF5F0\", // Vector Light Green\n \"#D3EFE1\", // roomsublist-label-bg-color (20% Green overlaid on Light Green)\n \"#FFFFFF\", // white highlights of the SVGs (for switching to dark theme)\n \"#000000\"];\n\n // track the replacement colours actually being used\n // defaults to our keys.\n this.colors = [this.keyHex[0], this.keyHex[1], this.keyHex[2], this.keyHex[3], this.keyHex[4]];\n\n // track the most current tint request inputs (which may differ from the\n // end result stored in this.colors\n this.currentTint = [undefined, undefined, undefined, undefined, undefined];\n\n this.cssFixups = [\n // { theme: {\n // style: a style object that should be fixed up taken from a stylesheet\n // attr: name of the attribute to be clobbered, e.g. 'color'\n // index: ordinal of primary, secondary or tertiary\n // },\n // }\n ];\n\n // CSS attributes to be fixed up\n this.cssAttrs = [\"color\", \"backgroundColor\", \"borderColor\", \"borderTopColor\", \"borderBottomColor\", \"borderLeftColor\"];\n\n this.svgAttrs = [\"fill\", \"stroke\"];\n\n // List of functions to call when the tint changes.\n this.tintables = [];\n\n // the currently loaded theme (if any)\n this.theme = undefined;\n\n // whether to force a tint (e.g. after changing theme)\n this.forceTint = false;\n }\n\n /**\n * Register a callback to fire when the tint changes.\n * This is used to rewrite the tintable SVGs with the new tint.\n *\n * It's not possible to unregister a tintable callback. So this can only be\n * used to register a static callback. If a set of tintables will change\n * over time then the best bet is to register a single callback for the\n * entire set.\n *\n * @param {Function} tintable Function to call when the tint changes.\n */\n\n\n (0, _createClass3.default)(Tinter, [{\n key: 'registerTintable',\n value: function registerTintable(tintable) {\n this.tintables.push(tintable);\n }\n }, {\n key: 'getKeyRgb',\n value: function getKeyRgb() {\n return this.keyRgb;\n }\n }, {\n key: 'tint',\n value: function tint(primaryColor, secondaryColor, tertiaryColor) {\n this.currentTint[0] = primaryColor;\n this.currentTint[1] = secondaryColor;\n this.currentTint[2] = tertiaryColor;\n\n this.calcCssFixups();\n\n if (DEBUG) {\n console.log(\"Tinter.tint(\" + primaryColor + \", \" + secondaryColor + \", \" + tertiaryColor + \")\");\n }\n\n if (!primaryColor) {\n primaryColor = this.keyRgb[0];\n secondaryColor = this.keyRgb[1];\n tertiaryColor = this.keyRgb[2];\n }\n\n if (!secondaryColor) {\n var x = 0.16; // average weighting factor calculated from vector green & light green\n var rgb = colorToRgb(primaryColor);\n rgb[0] = x * rgb[0] + (1 - x) * 255;\n rgb[1] = x * rgb[1] + (1 - x) * 255;\n rgb[2] = x * rgb[2] + (1 - x) * 255;\n secondaryColor = rgbToColor(rgb);\n }\n\n if (!tertiaryColor) {\n var _x = 0.19;\n var rgb1 = colorToRgb(primaryColor);\n var rgb2 = colorToRgb(secondaryColor);\n rgb1[0] = _x * rgb1[0] + (1 - _x) * rgb2[0];\n rgb1[1] = _x * rgb1[1] + (1 - _x) * rgb2[1];\n rgb1[2] = _x * rgb1[2] + (1 - _x) * rgb2[2];\n tertiaryColor = rgbToColor(rgb1);\n }\n\n if (this.forceTint == false && this.colors[0] === primaryColor && this.colors[1] === secondaryColor && this.colors[2] === tertiaryColor) {\n return;\n }\n\n this.forceTint = false;\n\n this.colors[0] = primaryColor;\n this.colors[1] = secondaryColor;\n this.colors[2] = tertiaryColor;\n\n if (DEBUG) {\n console.log(\"Tinter.tint final: (\" + primaryColor + \", \" + secondaryColor + \", \" + tertiaryColor + \")\");\n }\n\n // go through manually fixing up the stylesheets.\n this.applyCssFixups();\n\n // tell all the SVGs to go fix themselves up\n // we don't do this as a dispatch otherwise it will visually lag\n this.tintables.forEach(function (tintable) {\n tintable();\n });\n }\n }, {\n key: 'tintSvgWhite',\n value: function tintSvgWhite(whiteColor) {\n this.currentTint[3] = whiteColor;\n\n if (!whiteColor) {\n whiteColor = this.colors[3];\n }\n if (this.colors[3] === whiteColor) {\n return;\n }\n this.colors[3] = whiteColor;\n this.tintables.forEach(function (tintable) {\n tintable();\n });\n }\n }, {\n key: 'tintSvgBlack',\n value: function tintSvgBlack(blackColor) {\n this.currentTint[4] = blackColor;\n\n if (!blackColor) {\n blackColor = this.colors[4];\n }\n if (this.colors[4] === blackColor) {\n return;\n }\n this.colors[4] = blackColor;\n this.tintables.forEach(function (tintable) {\n tintable();\n });\n }\n }, {\n key: 'setTheme',\n value: function setTheme(theme) {\n this.theme = theme;\n\n // update keyRgb from the current theme CSS itself, if it defines it\n if (document.getElementById('mx_theme_accentColor')) {\n this.keyRgb[0] = window.getComputedStyle(document.getElementById('mx_theme_accentColor')).color;\n }\n if (document.getElementById('mx_theme_secondaryAccentColor')) {\n this.keyRgb[1] = window.getComputedStyle(document.getElementById('mx_theme_secondaryAccentColor')).color;\n }\n if (document.getElementById('mx_theme_tertiaryAccentColor')) {\n this.keyRgb[2] = window.getComputedStyle(document.getElementById('mx_theme_tertiaryAccentColor')).color;\n }\n\n this.calcCssFixups();\n this.forceTint = true;\n\n this.tint(this.currentTint[0], this.currentTint[1], this.currentTint[2]);\n\n if (theme === 'dark') {\n // abuse the tinter to change all the SVG's #fff to #2d2d2d\n // XXX: obviously this shouldn't be hardcoded here.\n this.tintSvgWhite('#2d2d2d');\n this.tintSvgBlack('#dddddd');\n } else {\n this.tintSvgWhite('#ffffff');\n this.tintSvgBlack('#000000');\n }\n }\n }, {\n key: 'calcCssFixups',\n value: function calcCssFixups() {\n // cache our fixups\n if (this.cssFixups[this.theme]) return;\n\n if (DEBUG) {\n console.debug(\"calcCssFixups start for \" + this.theme + \" (checking \" + document.styleSheets.length + \" stylesheets)\");\n }\n\n this.cssFixups[this.theme] = [];\n\n for (var i = 0; i < document.styleSheets.length; i++) {\n var ss = document.styleSheets[i];\n try {\n if (!ss) continue; // well done safari >:(\n // Chromium apparently sometimes returns null here; unsure why.\n // see $14534907369972FRXBx:matrix.org in HQ\n // ...ah, it's because there's a third party extension like\n // privacybadger inserting its own stylesheet in there with a\n // resource:// URI or something which results in a XSS error.\n // See also #vector:matrix.org/$145357669685386ebCfr:matrix.org\n // ...except some browsers apparently return stylesheets without\n // hrefs, which we have no choice but ignore right now\n\n // XXX seriously? we are hardcoding the name of vector's CSS file in\n // here?\n //\n // Why do we need to limit it to vector's CSS file anyway - if there\n // are other CSS files affecting the doc don't we want to apply the\n // same transformations to them?\n //\n // Iterating through the CSS looking for matches to hack on feels\n // pretty horrible anyway. And what if the application skin doesn't use\n // Vector Green as its primary color?\n // --richvdh\n\n // Yes, tinting assumes that you are using the Riot skin for now.\n // The right solution will be to move the CSS over to react-sdk.\n // And yes, the default assets for the base skin might as well use\n // Vector Green as any other colour.\n // --matthew\n\n // stylesheets we don't have permission to access (eg. ones from extensions) have a null\n // href and will throw exceptions if we try to access their rules.\n if (!ss.href || !ss.href.match(new RegExp('/theme-' + this.theme + '.css$'))) continue;\n if (ss.disabled) continue;\n if (!ss.cssRules) continue;\n\n if (DEBUG) console.debug(\"calcCssFixups checking \" + ss.cssRules.length + \" rules for \" + ss.href);\n\n for (var j = 0; j < ss.cssRules.length; j++) {\n var rule = ss.cssRules[j];\n if (!rule.style) continue;\n if (rule.selectorText && rule.selectorText.match(/#mx_theme/)) continue;\n for (var k = 0; k < this.cssAttrs.length; k++) {\n var attr = this.cssAttrs[k];\n for (var l = 0; l < this.keyRgb.length; l++) {\n if (rule.style[attr] === this.keyRgb[l]) {\n this.cssFixups[this.theme].push({\n style: rule.style,\n attr: attr,\n index: l\n });\n }\n }\n }\n }\n } catch (e) {\n // Catch any random exceptions that happen here: all sorts of things can go\n // wrong with this (nulls, SecurityErrors) and mostly it's for other\n // stylesheets that we don't want to proces anyway. We should not propagate an\n // exception out since this will cause the app to fail to start.\n console.log(\"Failed to calculate CSS fixups for a stylesheet: \" + ss.href, e);\n }\n }\n if (DEBUG) {\n console.log(\"calcCssFixups end (\" + this.cssFixups[this.theme].length + \" fixups)\");\n }\n }\n }, {\n key: 'applyCssFixups',\n value: function applyCssFixups() {\n if (DEBUG) {\n console.log(\"applyCssFixups start (\" + this.cssFixups[this.theme].length + \" fixups)\");\n }\n for (var i = 0; i < this.cssFixups[this.theme].length; i++) {\n var cssFixup = this.cssFixups[this.theme][i];\n try {\n cssFixup.style[cssFixup.attr] = this.colors[cssFixup.index];\n } catch (e) {\n // Firefox Quantum explodes if you manually edit the CSS in the\n // inspector and then try to do a tint, as apparently all the\n // fixups are then stale.\n console.error(\"Failed to apply cssFixup in Tinter! \", e.name);\n }\n }\n if (DEBUG) console.log(\"applyCssFixups end\");\n }\n\n // XXX: we could just move this all into TintableSvg, but as it's so similar\n // to the CSS fixup stuff in Tinter (just that the fixups are stored in TintableSvg)\n // keeping it here for now.\n\n }, {\n key: 'calcSvgFixups',\n value: function calcSvgFixups(svgs) {\n // go through manually fixing up SVG colours.\n // we could do this by stylesheets, but keeping the stylesheets\n // updated would be a PITA, so just brute-force search for the\n // key colour; cache the element and apply.\n\n if (DEBUG) console.log(\"calcSvgFixups start for \" + svgs);\n var fixups = [];\n for (var i = 0; i < svgs.length; i++) {\n var svgDoc = void 0;\n try {\n svgDoc = svgs[i].contentDocument;\n } catch (e) {\n var msg = 'Failed to get svg.contentDocument of ' + svgs[i].toString();\n if (e.message) {\n msg += e.message;\n }\n if (e.stack) {\n msg += ' | stack: ' + e.stack;\n }\n console.error(msg);\n }\n if (!svgDoc) continue;\n var tags = svgDoc.getElementsByTagName(\"*\");\n for (var j = 0; j < tags.length; j++) {\n var tag = tags[j];\n for (var k = 0; k < this.svgAttrs.length; k++) {\n var attr = this.svgAttrs[k];\n for (var l = 0; l < this.keyHex.length; l++) {\n if (tag.getAttribute(attr) && tag.getAttribute(attr).toUpperCase() === this.keyHex[l]) {\n fixups.push({\n node: tag,\n attr: attr,\n index: l\n });\n }\n }\n }\n }\n }\n if (DEBUG) console.log(\"calcSvgFixups end\");\n\n return fixups;\n }\n }, {\n key: 'applySvgFixups',\n value: function applySvgFixups(fixups) {\n if (DEBUG) console.log(\"applySvgFixups start for \" + fixups);\n for (var i = 0; i < fixups.length; i++) {\n var svgFixup = fixups[i];\n svgFixup.node.setAttribute(svgFixup.attr, this.colors[svgFixup.index]);\n }\n if (DEBUG) console.log(\"applySvgFixups end\");\n }\n }]);\n return Tinter;\n}();\n\nif (global.singletonTinter === undefined) {\n global.singletonTinter = new Tinter();\n}\nexports.default = global.singletonTinter;\nmodule.exports = exports['default'];\n//# sourceMappingURL=Tinter.js.map","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a duplex stream is just a stream that is both readable and writable.\n// Since JS doesn't have multiple prototypal inheritance, this class\n// prototypally inherits from Readable, and then parasitically from\n// Writable.\n\n'use strict';\n\n/**/\n\nvar processNextTick = require('process-nextick-args');\n/**/\n\n/**/\nvar objectKeys = Object.keys || function (obj) {\n var keys = [];\n for (var key in obj) {\n keys.push(key);\n }return keys;\n};\n/**/\n\nmodule.exports = Duplex;\n\n/**/\nvar util = require('core-util-is');\nutil.inherits = require('inherits');\n/**/\n\nvar Readable = require('./_stream_readable');\nvar Writable = require('./_stream_writable');\n\nutil.inherits(Duplex, Readable);\n\nvar keys = objectKeys(Writable.prototype);\nfor (var v = 0; v < keys.length; v++) {\n var method = keys[v];\n if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];\n}\n\nfunction Duplex(options) {\n if (!(this instanceof Duplex)) return new Duplex(options);\n\n Readable.call(this, options);\n Writable.call(this, options);\n\n if (options && options.readable === false) this.readable = false;\n\n if (options && options.writable === false) this.writable = false;\n\n this.allowHalfOpen = true;\n if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;\n\n this.once('end', onend);\n}\n\n// the no-half-open enforcer\nfunction onend() {\n // if we allow half-open state, or if the writable side ended,\n // then we're ok.\n if (this.allowHalfOpen || this._writableState.ended) return;\n\n // no more data can be written.\n // But allow more writes to happen in this tick.\n processNextTick(onEndNT, this);\n}\n\nfunction onEndNT(self) {\n self.end();\n}\n\nObject.defineProperty(Duplex.prototype, 'destroyed', {\n get: function () {\n if (this._readableState === undefined || this._writableState === undefined) {\n return false;\n }\n return this._readableState.destroyed && this._writableState.destroyed;\n },\n set: function (value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (this._readableState === undefined || this._writableState === undefined) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._readableState.destroyed = value;\n this._writableState.destroyed = value;\n }\n});\n\nDuplex.prototype._destroy = function (err, cb) {\n this.push(null);\n this.end();\n\n processNextTick(cb, err);\n};\n\nfunction forEach(xs, f) {\n for (var i = 0, l = xs.length; i < l; i++) {\n f(xs[i], i);\n }\n}","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _extends2 = require('babel-runtime/helpers/extends');\n\nvar _extends3 = _interopRequireDefault(_extends2);\n\nvar _setImmediate2 = require('babel-runtime/core-js/set-immediate');\n\nvar _setImmediate3 = _interopRequireDefault(_setImmediate2);\n\nvar _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');\n\nvar _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);\n\nvar _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _createClass2 = require('babel-runtime/helpers/createClass');\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nvar _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');\n\nvar _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);\n\nvar _inherits2 = require('babel-runtime/helpers/inherits');\n\nvar _inherits3 = _interopRequireDefault(_inherits2);\n\nexports.createMenu = createMenu;\n\nvar _react = require('react');\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _reactDom = require('react-dom');\n\nvar _reactDom2 = _interopRequireDefault(_reactDom);\n\nvar _propTypes = require('prop-types');\n\nvar _propTypes2 = _interopRequireDefault(_propTypes);\n\nvar _classnames = require('classnames');\n\nvar _classnames2 = _interopRequireDefault(_classnames);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// Shamelessly ripped off Modal.js. There's probably a better way\n// of doing reusable widgets like dialog boxes & menus where we go and\n// pass in a custom control as the actual body.\n\n/*\nCopyright 2015, 2016 OpenMarket Ltd\nCopyright 2018 New Vector Ltd\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nvar ContextualMenuContainerId = \"mx_ContextualMenu_Container\";\n\nfunction getOrCreateContainer() {\n var container = document.getElementById(ContextualMenuContainerId);\n\n if (!container) {\n container = document.createElement(\"div\");\n container.id = ContextualMenuContainerId;\n document.body.appendChild(container);\n }\n\n return container;\n}\n\nvar ContextualMenu = function (_React$Component) {\n (0, _inherits3.default)(ContextualMenu, _React$Component);\n\n function ContextualMenu() {\n (0, _classCallCheck3.default)(this, ContextualMenu);\n\n var _this = (0, _possibleConstructorReturn3.default)(this, (ContextualMenu.__proto__ || (0, _getPrototypeOf2.default)(ContextualMenu)).call(this));\n\n _this.state = {\n contextMenuRect: null\n };\n\n _this.onContextMenu = _this.onContextMenu.bind(_this);\n _this.collectContextMenuRect = _this.collectContextMenuRect.bind(_this);\n return _this;\n }\n\n (0, _createClass3.default)(ContextualMenu, [{\n key: 'collectContextMenuRect',\n value: function collectContextMenuRect(element) {\n // We don't need to clean up when unmounting, so ignore\n if (!element) return;\n\n this.setState({\n contextMenuRect: element.getBoundingClientRect()\n });\n }\n }, {\n key: 'onContextMenu',\n value: function onContextMenu(e) {\n if (this.props.closeMenu) {\n this.props.closeMenu();\n\n e.preventDefault();\n var x = e.clientX;\n var y = e.clientY;\n\n // XXX: This isn't pretty but the only way to allow opening a different context menu on right click whilst\n // a context menu and its click-guard are up without completely rewriting how the context menus work.\n (0, _setImmediate3.default)(function () {\n var clickEvent = document.createEvent('MouseEvents');\n clickEvent.initMouseEvent('contextmenu', true, true, window, 0, 0, 0, x, y, false, false, false, false, 0, null);\n document.elementFromPoint(x, y).dispatchEvent(clickEvent);\n });\n }\n }\n }, {\n key: 'render',\n value: function render() {\n var position = {};\n var chevronFace = null;\n\n var props = this.props;\n\n if (props.top) {\n position.top = props.top;\n } else {\n position.bottom = props.bottom;\n }\n\n if (props.left) {\n position.left = props.left;\n chevronFace = 'left';\n } else {\n position.right = props.right;\n chevronFace = 'right';\n }\n\n var contextMenuRect = this.state.contextMenuRect || null;\n var padding = 10;\n\n var chevronOffset = {};\n if (props.chevronFace) {\n chevronFace = props.chevronFace;\n }\n if (chevronFace === 'top' || chevronFace === 'bottom') {\n chevronOffset.left = props.chevronOffset;\n } else {\n var target = position.top;\n\n // By default, no adjustment is made\n var adjusted = target;\n\n // If we know the dimensions of the context menu, adjust its position\n // such that it does not leave the (padded) window.\n if (contextMenuRect) {\n adjusted = Math.min(position.top, document.body.clientHeight - contextMenuRect.height - padding);\n }\n\n position.top = adjusted;\n chevronOffset.top = Math.max(props.chevronOffset, props.chevronOffset + target - adjusted);\n }\n\n // To override the default chevron colour, if it's been set\n var chevronCSS = \"\";\n if (props.menuColour) {\n chevronCSS = '\\n .mx_ContextualMenu_chevron_left:after {\\n border-right-color: ' + props.menuColour + ';\\n }\\n .mx_ContextualMenu_chevron_right:after {\\n border-left-color: ' + props.menuColour + ';\\n }\\n .mx_ContextualMenu_chevron_top:after {\\n border-left-color: ' + props.menuColour + ';\\n }\\n .mx_ContextualMenu_chevron_bottom:after {\\n border-left-color: ' + props.menuColour + ';\\n }\\n ';\n }\n\n var chevron = _react2.default.createElement('div', { style: chevronOffset, className: \"mx_ContextualMenu_chevron_\" + chevronFace });\n var className = 'mx_ContextualMenu_wrapper';\n\n var menuClasses = (0, _classnames2.default)({\n 'mx_ContextualMenu': true,\n 'mx_ContextualMenu_left': chevronFace === 'left',\n 'mx_ContextualMenu_right': chevronFace === 'right',\n 'mx_ContextualMenu_top': chevronFace === 'top',\n 'mx_ContextualMenu_bottom': chevronFace === 'bottom'\n });\n\n var menuStyle = {};\n if (props.menuWidth) {\n menuStyle.width = props.menuWidth;\n }\n\n if (props.menuHeight) {\n menuStyle.height = props.menuHeight;\n }\n\n if (props.menuColour) {\n menuStyle[\"backgroundColor\"] = props.menuColour;\n }\n\n if (!isNaN(Number(props.menuPaddingTop))) {\n menuStyle[\"paddingTop\"] = props.menuPaddingTop;\n }\n if (!isNaN(Number(props.menuPaddingLeft))) {\n menuStyle[\"paddingLeft\"] = props.menuPaddingLeft;\n }\n if (!isNaN(Number(props.menuPaddingBottom))) {\n menuStyle[\"paddingBottom\"] = props.menuPaddingBottom;\n }\n if (!isNaN(Number(props.menuPaddingRight))) {\n menuStyle[\"paddingRight\"] = props.menuPaddingRight;\n }\n\n var ElementClass = props.elementClass;\n\n // FIXME: If a menu uses getDefaultProps it clobbers the onFinished\n // property set here so you can't close the menu from a button click!\n return _react2.default.createElement(\n 'div',\n { className: className, style: position },\n _react2.default.createElement(\n 'div',\n { className: menuClasses, style: menuStyle, ref: this.collectContextMenuRect },\n chevron,\n _react2.default.createElement(ElementClass, (0, _extends3.default)({}, props, { onFinished: props.closeMenu, onResize: props.windowResize }))\n ),\n props.hasBackground && _react2.default.createElement('div', { className: 'mx_ContextualMenu_background',\n onClick: props.closeMenu, onContextMenu: this.onContextMenu }),\n _react2.default.createElement(\n 'style',\n null,\n chevronCSS\n )\n );\n }\n }]);\n return ContextualMenu;\n}(_react2.default.Component);\n\nexports.default = ContextualMenu;\nfunction createMenu(ElementClass, props) {\n var hasBackground = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n\n var closeMenu = function closeMenu() {\n _reactDom2.default.unmountComponentAtNode(getOrCreateContainer());\n\n if (props && props.onFinished) {\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n props.onFinished.apply(null, args);\n }\n };\n\n // We only reference closeMenu once per call to createMenu\n var menu = _react2.default.createElement(ContextualMenu, (0, _extends3.default)({\n hasBackground: hasBackground\n }, props, {\n elementClass: ElementClass,\n closeMenu: closeMenu // eslint-disable-line react/jsx-no-bind\n , windowResize: closeMenu // eslint-disable-line react/jsx-no-bind\n }));\n\n _reactDom2.default.render(menu, getOrCreateContainer());\n\n return { close: closeMenu };\n}\n//# sourceMappingURL=ContextualMenu.js.map","var baseIsNative = require('./_baseIsNative'),\n getValue = require('./_getValue');\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\nmodule.exports = getNative;\n","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _bluebird = require('bluebird');\n\nvar _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _createClass2 = require('babel-runtime/helpers/createClass');\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nvar _react = require('react');\n\nvar _react2 = _interopRequireDefault(_react);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar AutocompleteProvider = function () {\n function AutocompleteProvider(commandRegex, forcedCommandRegex) {\n (0, _classCallCheck3.default)(this, AutocompleteProvider);\n\n if (commandRegex) {\n if (!commandRegex.global) {\n throw new Error('commandRegex must have global flag set');\n }\n this.commandRegex = commandRegex;\n }\n if (forcedCommandRegex) {\n if (!forcedCommandRegex.global) {\n throw new Error('forcedCommandRegex must have global flag set');\n }\n this.forcedCommandRegex = forcedCommandRegex;\n }\n }\n\n (0, _createClass3.default)(AutocompleteProvider, [{\n key: 'destroy',\n value: function destroy() {}\n // stub\n\n\n /**\n * Of the matched commands in the query, returns the first that contains or is contained by the selection, or null.\n */\n\n }, {\n key: 'getCurrentCommand',\n value: function getCurrentCommand(query, selection) {\n var force = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n\n var commandRegex = this.commandRegex;\n\n if (force && this.shouldForceComplete()) {\n commandRegex = this.forcedCommandRegex || /\\S+/g;\n }\n\n if (commandRegex == null) {\n return null;\n }\n\n commandRegex.lastIndex = 0;\n\n var match = void 0;\n while ((match = commandRegex.exec(query)) != null) {\n var start = match.index;\n var end = start + match[0].length;\n if (selection.start <= end && selection.end >= start) {\n return {\n command: match,\n range: {\n start: start,\n end: end\n }\n };\n }\n }\n return {\n command: null,\n range: {\n start: -1,\n end: -1\n }\n };\n }\n }, {\n key: 'getCompletions',\n value: function () {\n var _ref = (0, _bluebird.method)(function (query, selection) {\n var force = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n\n return [];\n });\n\n function getCompletions(_x2, _x3, _x4) {\n return _ref.apply(this, arguments);\n }\n\n return getCompletions;\n }()\n }, {\n key: 'getName',\n value: function getName() {\n return 'Default Provider';\n }\n }, {\n key: 'renderCompletions',\n value: function renderCompletions(completions) {\n console.error('stub; should be implemented in subclasses');\n return null;\n }\n\n // Whether we should provide completions even if triggered forcefully, without a sigil.\n\n }, {\n key: 'shouldForceComplete',\n value: function shouldForceComplete() {\n return false;\n }\n }]);\n return AutocompleteProvider;\n}(); /*\n Copyright 2016 Aviral Dasgupta\n Copyright 2017 Vector Creations Ltd\n Copyright 2017, 2018 New Vector Ltd\n \n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\nexports.default = AutocompleteProvider;\nmodule.exports = exports['default'];\n//# sourceMappingURL=AutocompleteProvider.js.map","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.PillCompletion = exports.TextualCompletion = undefined;\n\nvar _extends2 = require('babel-runtime/helpers/extends');\n\nvar _extends3 = _interopRequireDefault(_extends2);\n\nvar _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');\n\nvar _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);\n\nvar _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');\n\nvar _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);\n\nvar _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _createClass2 = require('babel-runtime/helpers/createClass');\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nvar _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');\n\nvar _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);\n\nvar _inherits2 = require('babel-runtime/helpers/inherits');\n\nvar _inherits3 = _interopRequireDefault(_inherits2);\n\nvar _react = require('react');\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _propTypes = require('prop-types');\n\nvar _propTypes2 = _interopRequireDefault(_propTypes);\n\nvar _classnames = require('classnames');\n\nvar _classnames2 = _interopRequireDefault(_classnames);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/* These were earlier stateless functional components but had to be converted\nsince we need to use refs/findDOMNode to access the underlying DOM node to focus the correct completion,\nsomething that is not entirely possible with stateless functional components. One could\npresumably wrap them in a
before rendering but I think this is the better way to do it.\n */\n\nvar TextualCompletion = exports.TextualCompletion = function (_React$Component) {\n (0, _inherits3.default)(TextualCompletion, _React$Component);\n\n function TextualCompletion() {\n (0, _classCallCheck3.default)(this, TextualCompletion);\n return (0, _possibleConstructorReturn3.default)(this, (TextualCompletion.__proto__ || (0, _getPrototypeOf2.default)(TextualCompletion)).apply(this, arguments));\n }\n\n (0, _createClass3.default)(TextualCompletion, [{\n key: 'render',\n value: function render() {\n var _props = this.props,\n title = _props.title,\n subtitle = _props.subtitle,\n description = _props.description,\n className = _props.className,\n restProps = (0, _objectWithoutProperties3.default)(_props, ['title', 'subtitle', 'description', 'className']);\n\n return _react2.default.createElement(\n 'div',\n (0, _extends3.default)({ className: (0, _classnames2.default)('mx_Autocomplete_Completion_block', className) }, restProps),\n _react2.default.createElement(\n 'span',\n { className: 'mx_Autocomplete_Completion_title' },\n title\n ),\n _react2.default.createElement(\n 'span',\n { className: 'mx_Autocomplete_Completion_subtitle' },\n subtitle\n ),\n _react2.default.createElement(\n 'span',\n { className: 'mx_Autocomplete_Completion_description' },\n description\n )\n );\n }\n }]);\n return TextualCompletion;\n}(_react2.default.Component); /*\n Copyright 2016 Aviral Dasgupta\n \n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\nTextualCompletion.propTypes = {\n title: _propTypes2.default.string,\n subtitle: _propTypes2.default.string,\n description: _propTypes2.default.string,\n className: _propTypes2.default.string\n};\n\nvar PillCompletion = exports.PillCompletion = function (_React$Component2) {\n (0, _inherits3.default)(PillCompletion, _React$Component2);\n\n function PillCompletion() {\n (0, _classCallCheck3.default)(this, PillCompletion);\n return (0, _possibleConstructorReturn3.default)(this, (PillCompletion.__proto__ || (0, _getPrototypeOf2.default)(PillCompletion)).apply(this, arguments));\n }\n\n (0, _createClass3.default)(PillCompletion, [{\n key: 'render',\n value: function render() {\n var _props2 = this.props,\n title = _props2.title,\n subtitle = _props2.subtitle,\n description = _props2.description,\n initialComponent = _props2.initialComponent,\n className = _props2.className,\n restProps = (0, _objectWithoutProperties3.default)(_props2, ['title', 'subtitle', 'description', 'initialComponent', 'className']);\n\n return _react2.default.createElement(\n 'div',\n (0, _extends3.default)({ className: (0, _classnames2.default)('mx_Autocomplete_Completion_pill', className) }, restProps),\n initialComponent,\n _react2.default.createElement(\n 'span',\n { className: 'mx_Autocomplete_Completion_title' },\n title\n ),\n _react2.default.createElement(\n 'span',\n { className: 'mx_Autocomplete_Completion_subtitle' },\n subtitle\n ),\n _react2.default.createElement(\n 'span',\n { className: 'mx_Autocomplete_Completion_description' },\n description\n )\n );\n }\n }]);\n return PillCompletion;\n}(_react2.default.Component);\n\nPillCompletion.propTypes = {\n title: _propTypes2.default.string,\n subtitle: _propTypes2.default.string,\n description: _propTypes2.default.string,\n initialComponent: _propTypes2.default.element,\n className: _propTypes2.default.string\n};\n//# sourceMappingURL=Components.js.map","var def = require('./_object-dp').f;\nvar has = require('./_has');\nvar TAG = require('./_wks')('toStringTag');\n\nmodule.exports = function (it, tag, stat) {\n if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });\n};\n","var $export = require('./_export');\nvar defined = require('./_defined');\nvar fails = require('./_fails');\nvar spaces = require('./_string-ws');\nvar space = '[' + spaces + ']';\nvar non = '\\u200b\\u0085';\nvar ltrim = RegExp('^' + space + space + '*');\nvar rtrim = RegExp(space + space + '*$');\n\nvar exporter = function (KEY, exec, ALIAS) {\n var exp = {};\n var FORCE = fails(function () {\n return !!spaces[KEY]() || non[KEY]() != non;\n });\n var fn = exp[KEY] = FORCE ? exec(trim) : spaces[KEY];\n if (ALIAS) exp[ALIAS] = fn;\n $export($export.P + $export.F * FORCE, 'String', exp);\n};\n\n// 1 -> String#trimLeft\n// 2 -> String#trimRight\n// 3 -> String#trim\nvar trim = exporter.trim = function (string, TYPE) {\n string = String(defined(string));\n if (TYPE & 1) string = string.replace(ltrim, '');\n if (TYPE & 2) string = string.replace(rtrim, '');\n return string;\n};\n\nmodule.exports = exporter;\n","module.exports = {};\n","var isObject = require('./_is-object');\nmodule.exports = function (it, TYPE) {\n if (!isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!');\n return it;\n};\n","'use strict';\nvar LIBRARY = require('./_library');\nvar $export = require('./_export');\nvar redefine = require('./_redefine');\nvar hide = require('./_hide');\nvar has = require('./_has');\nvar Iterators = require('./_iterators');\nvar $iterCreate = require('./_iter-create');\nvar setToStringTag = require('./_set-to-string-tag');\nvar getPrototypeOf = require('./_object-gpo');\nvar ITERATOR = require('./_wks')('iterator');\nvar BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`\nvar FF_ITERATOR = '@@iterator';\nvar KEYS = 'keys';\nvar VALUES = 'values';\n\nvar returnThis = function () { return this; };\n\nmodule.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {\n $iterCreate(Constructor, NAME, next);\n var getMethod = function (kind) {\n if (!BUGGY && kind in proto) return proto[kind];\n switch (kind) {\n case KEYS: return function keys() { return new Constructor(this, kind); };\n case VALUES: return function values() { return new Constructor(this, kind); };\n } return function entries() { return new Constructor(this, kind); };\n };\n var TAG = NAME + ' Iterator';\n var DEF_VALUES = DEFAULT == VALUES;\n var VALUES_BUG = false;\n var proto = Base.prototype;\n var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];\n var $default = $native || getMethod(DEFAULT);\n var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;\n var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;\n var methods, key, IteratorPrototype;\n // Fix native\n if ($anyNative) {\n IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));\n if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {\n // Set @@toStringTag to native iterators\n setToStringTag(IteratorPrototype, TAG, true);\n // fix for some old engines\n if (!LIBRARY && !has(IteratorPrototype, ITERATOR)) hide(IteratorPrototype, ITERATOR, returnThis);\n }\n }\n // fix Array#{values, @@iterator}.name in V8 / FF\n if (DEF_VALUES && $native && $native.name !== VALUES) {\n VALUES_BUG = true;\n $default = function values() { return $native.call(this); };\n }\n // Define iterator\n if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {\n hide(proto, ITERATOR, $default);\n }\n // Plug for library\n Iterators[NAME] = $default;\n Iterators[TAG] = returnThis;\n if (DEFAULT) {\n methods = {\n values: DEF_VALUES ? $default : getMethod(VALUES),\n keys: IS_SET ? $default : getMethod(KEYS),\n entries: $entries\n };\n if (FORCED) for (key in methods) {\n if (!(key in proto)) redefine(proto, key, methods[key]);\n } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);\n }\n return methods;\n};\n","var classof = require('./_classof');\nvar ITERATOR = require('./_wks')('iterator');\nvar Iterators = require('./_iterators');\nmodule.exports = require('./_core').getIteratorMethod = function (it) {\n if (it != undefined) return it[ITERATOR]\n || it['@@iterator']\n || Iterators[classof(it)];\n};\n","var scope = (typeof global !== \"undefined\" && global) ||\n (typeof self !== \"undefined\" && self) ||\n window;\nvar apply = Function.prototype.apply;\n\n// DOM APIs, for completeness\n\nexports.setTimeout = function() {\n return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);\n};\nexports.setInterval = function() {\n return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);\n};\nexports.clearTimeout =\nexports.clearInterval = function(timeout) {\n if (timeout) {\n timeout.close();\n }\n};\n\nfunction Timeout(id, clearFn) {\n this._id = id;\n this._clearFn = clearFn;\n}\nTimeout.prototype.unref = Timeout.prototype.ref = function() {};\nTimeout.prototype.close = function() {\n this._clearFn.call(scope, this._id);\n};\n\n// Does not start the time, just sets up the members needed.\nexports.enroll = function(item, msecs) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = msecs;\n};\n\nexports.unenroll = function(item) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = -1;\n};\n\nexports._unrefActive = exports.active = function(item) {\n clearTimeout(item._idleTimeoutId);\n\n var msecs = item._idleTimeout;\n if (msecs >= 0) {\n item._idleTimeoutId = setTimeout(function onTimeout() {\n if (item._onTimeout)\n item._onTimeout();\n }, msecs);\n }\n};\n\n// setimmediate attaches itself to the global object\nrequire(\"setimmediate\");\n// On some exotic environments, it's not clear which object `setimmediate` was\n// able to install onto. Search each possibility in the same order as the\n// `setimmediate` library.\nexports.setImmediate = (typeof self !== \"undefined\" && self.setImmediate) ||\n (typeof global !== \"undefined\" && global.setImmediate) ||\n (this && this.setImmediate);\nexports.clearImmediate = (typeof self !== \"undefined\" && self.clearImmediate) ||\n (typeof global !== \"undefined\" && global.clearImmediate) ||\n (this && this.clearImmediate);\n","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\n'use strict';\n\nvar _assign = require('object-assign');\n\nvar ReactCurrentOwner = require('./ReactCurrentOwner');\n\nvar warning = require('fbjs/lib/warning');\nvar canDefineProperty = require('./canDefineProperty');\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\nvar REACT_ELEMENT_TYPE = require('./ReactElementSymbol');\n\nvar RESERVED_PROPS = {\n key: true,\n ref: true,\n __self: true,\n __source: true\n};\n\nvar specialPropKeyWarningShown, specialPropRefWarningShown;\n\nfunction hasValidRef(config) {\n if (process.env.NODE_ENV !== 'production') {\n if (hasOwnProperty.call(config, 'ref')) {\n var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;\n if (getter && getter.isReactWarning) {\n return false;\n }\n }\n }\n return config.ref !== undefined;\n}\n\nfunction hasValidKey(config) {\n if (process.env.NODE_ENV !== 'production') {\n if (hasOwnProperty.call(config, 'key')) {\n var getter = Object.getOwnPropertyDescriptor(config, 'key').get;\n if (getter && getter.isReactWarning) {\n return false;\n }\n }\n }\n return config.key !== undefined;\n}\n\nfunction defineKeyPropWarningGetter(props, displayName) {\n var warnAboutAccessingKey = function () {\n if (!specialPropKeyWarningShown) {\n specialPropKeyWarningShown = true;\n process.env.NODE_ENV !== 'production' ? warning(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName) : void 0;\n }\n };\n warnAboutAccessingKey.isReactWarning = true;\n Object.defineProperty(props, 'key', {\n get: warnAboutAccessingKey,\n configurable: true\n });\n}\n\nfunction defineRefPropWarningGetter(props, displayName) {\n var warnAboutAccessingRef = function () {\n if (!specialPropRefWarningShown) {\n specialPropRefWarningShown = true;\n process.env.NODE_ENV !== 'production' ? warning(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName) : void 0;\n }\n };\n warnAboutAccessingRef.isReactWarning = true;\n Object.defineProperty(props, 'ref', {\n get: warnAboutAccessingRef,\n configurable: true\n });\n}\n\n/**\n * Factory method to create a new React element. This no longer adheres to\n * the class pattern, so do not use new to call it. Also, no instanceof check\n * will work. Instead test $$typeof field against Symbol.for('react.element') to check\n * if something is a React Element.\n *\n * @param {*} type\n * @param {*} key\n * @param {string|object} ref\n * @param {*} self A *temporary* helper to detect places where `this` is\n * different from the `owner` when React.createElement is called, so that we\n * can warn. We want to get rid of owner and replace string `ref`s with arrow\n * functions, and as long as `this` and owner are the same, there will be no\n * change in behavior.\n * @param {*} source An annotation object (added by a transpiler or otherwise)\n * indicating filename, line number, and/or other information.\n * @param {*} owner\n * @param {*} props\n * @internal\n */\nvar ReactElement = function (type, key, ref, self, source, owner, props) {\n var element = {\n // This tag allow us to uniquely identify this as a React Element\n $$typeof: REACT_ELEMENT_TYPE,\n\n // Built-in properties that belong on the element\n type: type,\n key: key,\n ref: ref,\n props: props,\n\n // Record the component responsible for creating this element.\n _owner: owner\n };\n\n if (process.env.NODE_ENV !== 'production') {\n // The validation flag is currently mutative. We put it on\n // an external backing store so that we can freeze the whole object.\n // This can be replaced with a WeakMap once they are implemented in\n // commonly used development environments.\n element._store = {};\n\n // To make comparing ReactElements easier for testing purposes, we make\n // the validation flag non-enumerable (where possible, which should\n // include every environment we run tests in), so the test framework\n // ignores it.\n if (canDefineProperty) {\n Object.defineProperty(element._store, 'validated', {\n configurable: false,\n enumerable: false,\n writable: true,\n value: false\n });\n // self and source are DEV only properties.\n Object.defineProperty(element, '_self', {\n configurable: false,\n enumerable: false,\n writable: false,\n value: self\n });\n // Two elements created in two different places should be considered\n // equal for testing purposes and therefore we hide it from enumeration.\n Object.defineProperty(element, '_source', {\n configurable: false,\n enumerable: false,\n writable: false,\n value: source\n });\n } else {\n element._store.validated = false;\n element._self = self;\n element._source = source;\n }\n if (Object.freeze) {\n Object.freeze(element.props);\n Object.freeze(element);\n }\n }\n\n return element;\n};\n\n/**\n * Create and return a new ReactElement of the given type.\n * See https://facebook.github.io/react/docs/top-level-api.html#react.createelement\n */\nReactElement.createElement = function (type, config, children) {\n var propName;\n\n // Reserved names are extracted\n var props = {};\n\n var key = null;\n var ref = null;\n var self = null;\n var source = null;\n\n if (config != null) {\n if (hasValidRef(config)) {\n ref = config.ref;\n }\n if (hasValidKey(config)) {\n key = '' + config.key;\n }\n\n self = config.__self === undefined ? null : config.__self;\n source = config.__source === undefined ? null : config.__source;\n // Remaining properties are added to a new props object\n for (propName in config) {\n if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {\n props[propName] = config[propName];\n }\n }\n }\n\n // Children can be more than one argument, and those are transferred onto\n // the newly allocated props object.\n var childrenLength = arguments.length - 2;\n if (childrenLength === 1) {\n props.children = children;\n } else if (childrenLength > 1) {\n var childArray = Array(childrenLength);\n for (var i = 0; i < childrenLength; i++) {\n childArray[i] = arguments[i + 2];\n }\n if (process.env.NODE_ENV !== 'production') {\n if (Object.freeze) {\n Object.freeze(childArray);\n }\n }\n props.children = childArray;\n }\n\n // Resolve default props\n if (type && type.defaultProps) {\n var defaultProps = type.defaultProps;\n for (propName in defaultProps) {\n if (props[propName] === undefined) {\n props[propName] = defaultProps[propName];\n }\n }\n }\n if (process.env.NODE_ENV !== 'production') {\n if (key || ref) {\n if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) {\n var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;\n if (key) {\n defineKeyPropWarningGetter(props, displayName);\n }\n if (ref) {\n defineRefPropWarningGetter(props, displayName);\n }\n }\n }\n }\n return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);\n};\n\n/**\n * Return a function that produces ReactElements of a given type.\n * See https://facebook.github.io/react/docs/top-level-api.html#react.createfactory\n */\nReactElement.createFactory = function (type) {\n var factory = ReactElement.createElement.bind(null, type);\n // Expose the type on the factory and the prototype so that it can be\n // easily accessed on elements. E.g. `
.type === Foo`.\n // This should not be named `constructor` since this may not be the function\n // that created the element, and it may not even be a constructor.\n // Legacy hook TODO: Warn if this is accessed\n factory.type = type;\n return factory;\n};\n\nReactElement.cloneAndReplaceKey = function (oldElement, newKey) {\n var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);\n\n return newElement;\n};\n\n/**\n * Clone and return a new ReactElement using element as the starting point.\n * See https://facebook.github.io/react/docs/top-level-api.html#react.cloneelement\n */\nReactElement.cloneElement = function (element, config, children) {\n var propName;\n\n // Original props are copied\n var props = _assign({}, element.props);\n\n // Reserved names are extracted\n var key = element.key;\n var ref = element.ref;\n // Self is preserved since the owner is preserved.\n var self = element._self;\n // Source is preserved since cloneElement is unlikely to be targeted by a\n // transpiler, and the original source is probably a better indicator of the\n // true owner.\n var source = element._source;\n\n // Owner will be preserved, unless ref is overridden\n var owner = element._owner;\n\n if (config != null) {\n if (hasValidRef(config)) {\n // Silently steal the ref from the parent.\n ref = config.ref;\n owner = ReactCurrentOwner.current;\n }\n if (hasValidKey(config)) {\n key = '' + config.key;\n }\n\n // Remaining properties override existing props\n var defaultProps;\n if (element.type && element.type.defaultProps) {\n defaultProps = element.type.defaultProps;\n }\n for (propName in config) {\n if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {\n if (config[propName] === undefined && defaultProps !== undefined) {\n // Resolve default props\n props[propName] = defaultProps[propName];\n } else {\n props[propName] = config[propName];\n }\n }\n }\n }\n\n // Children can be more than one argument, and those are transferred onto\n // the newly allocated props object.\n var childrenLength = arguments.length - 2;\n if (childrenLength === 1) {\n props.children = children;\n } else if (childrenLength > 1) {\n var childArray = Array(childrenLength);\n for (var i = 0; i < childrenLength; i++) {\n childArray[i] = arguments[i + 2];\n }\n props.children = childArray;\n }\n\n return ReactElement(element.type, key, ref, self, source, owner, props);\n};\n\n/**\n * Verifies the object is a ReactElement.\n * See https://facebook.github.io/react/docs/top-level-api.html#react.isvalidelement\n * @param {?object} object\n * @return {boolean} True if `object` is a valid component.\n * @final\n */\nReactElement.isValidElement = function (object) {\n return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;\n};\n\nmodule.exports = ReactElement;","exports.f = Object.getOwnPropertySymbols;\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\n'use strict';\n\nvar _prodInvariant = require('./reactProdInvariant');\n\nvar invariant = require('fbjs/lib/invariant');\n\nfunction checkMask(value, bitmask) {\n return (value & bitmask) === bitmask;\n}\n\nvar DOMPropertyInjection = {\n /**\n * Mapping from normalized, camelcased property names to a configuration that\n * specifies how the associated DOM property should be accessed or rendered.\n */\n MUST_USE_PROPERTY: 0x1,\n HAS_BOOLEAN_VALUE: 0x4,\n HAS_NUMERIC_VALUE: 0x8,\n HAS_POSITIVE_NUMERIC_VALUE: 0x10 | 0x8,\n HAS_OVERLOADED_BOOLEAN_VALUE: 0x20,\n\n /**\n * Inject some specialized knowledge about the DOM. This takes a config object\n * with the following properties:\n *\n * isCustomAttribute: function that given an attribute name will return true\n * if it can be inserted into the DOM verbatim. Useful for data-* or aria-*\n * attributes where it's impossible to enumerate all of the possible\n * attribute names,\n *\n * Properties: object mapping DOM property name to one of the\n * DOMPropertyInjection constants or null. If your attribute isn't in here,\n * it won't get written to the DOM.\n *\n * DOMAttributeNames: object mapping React attribute name to the DOM\n * attribute name. Attribute names not specified use the **lowercase**\n * normalized name.\n *\n * DOMAttributeNamespaces: object mapping React attribute name to the DOM\n * attribute namespace URL. (Attribute names not specified use no namespace.)\n *\n * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.\n * Property names not specified use the normalized name.\n *\n * DOMMutationMethods: Properties that require special mutation methods. If\n * `value` is undefined, the mutation method should unset the property.\n *\n * @param {object} domPropertyConfig the config as described above.\n */\n injectDOMPropertyConfig: function (domPropertyConfig) {\n var Injection = DOMPropertyInjection;\n var Properties = domPropertyConfig.Properties || {};\n var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {};\n var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};\n var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {};\n var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};\n\n if (domPropertyConfig.isCustomAttribute) {\n DOMProperty._isCustomAttributeFunctions.push(domPropertyConfig.isCustomAttribute);\n }\n\n for (var propName in Properties) {\n !!DOMProperty.properties.hasOwnProperty(propName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'injectDOMPropertyConfig(...): You\\'re trying to inject DOM property \\'%s\\' which has already been injected. You may be accidentally injecting the same DOM property config twice, or you may be injecting two configs that have conflicting property names.', propName) : _prodInvariant('48', propName) : void 0;\n\n var lowerCased = propName.toLowerCase();\n var propConfig = Properties[propName];\n\n var propertyInfo = {\n attributeName: lowerCased,\n attributeNamespace: null,\n propertyName: propName,\n mutationMethod: null,\n\n mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY),\n hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE),\n hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE),\n hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE),\n hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE)\n };\n !(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Value can be one of boolean, overloaded boolean, or numeric value, but not a combination: %s', propName) : _prodInvariant('50', propName) : void 0;\n\n if (process.env.NODE_ENV !== 'production') {\n DOMProperty.getPossibleStandardName[lowerCased] = propName;\n }\n\n if (DOMAttributeNames.hasOwnProperty(propName)) {\n var attributeName = DOMAttributeNames[propName];\n propertyInfo.attributeName = attributeName;\n if (process.env.NODE_ENV !== 'production') {\n DOMProperty.getPossibleStandardName[attributeName] = propName;\n }\n }\n\n if (DOMAttributeNamespaces.hasOwnProperty(propName)) {\n propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName];\n }\n\n if (DOMPropertyNames.hasOwnProperty(propName)) {\n propertyInfo.propertyName = DOMPropertyNames[propName];\n }\n\n if (DOMMutationMethods.hasOwnProperty(propName)) {\n propertyInfo.mutationMethod = DOMMutationMethods[propName];\n }\n\n DOMProperty.properties[propName] = propertyInfo;\n }\n }\n};\n\n/* eslint-disable max-len */\nvar ATTRIBUTE_NAME_START_CHAR = ':A-Z_a-z\\\\u00C0-\\\\u00D6\\\\u00D8-\\\\u00F6\\\\u00F8-\\\\u02FF\\\\u0370-\\\\u037D\\\\u037F-\\\\u1FFF\\\\u200C-\\\\u200D\\\\u2070-\\\\u218F\\\\u2C00-\\\\u2FEF\\\\u3001-\\\\uD7FF\\\\uF900-\\\\uFDCF\\\\uFDF0-\\\\uFFFD';\n/* eslint-enable max-len */\n\n/**\n * DOMProperty exports lookup objects that can be used like functions:\n *\n * > DOMProperty.isValid['id']\n * true\n * > DOMProperty.isValid['foobar']\n * undefined\n *\n * Although this may be confusing, it performs better in general.\n *\n * @see http://jsperf.com/key-exists\n * @see http://jsperf.com/key-missing\n */\nvar DOMProperty = {\n ID_ATTRIBUTE_NAME: 'data-reactid',\n ROOT_ATTRIBUTE_NAME: 'data-reactroot',\n\n ATTRIBUTE_NAME_START_CHAR: ATTRIBUTE_NAME_START_CHAR,\n ATTRIBUTE_NAME_CHAR: ATTRIBUTE_NAME_START_CHAR + '\\\\-.0-9\\\\u00B7\\\\u0300-\\\\u036F\\\\u203F-\\\\u2040',\n\n /**\n * Map from property \"standard name\" to an object with info about how to set\n * the property in the DOM. Each object contains:\n *\n * attributeName:\n * Used when rendering markup or with `*Attribute()`.\n * attributeNamespace\n * propertyName:\n * Used on DOM node instances. (This includes properties that mutate due to\n * external factors.)\n * mutationMethod:\n * If non-null, used instead of the property or `setAttribute()` after\n * initial render.\n * mustUseProperty:\n * Whether the property must be accessed and mutated as an object property.\n * hasBooleanValue:\n * Whether the property should be removed when set to a falsey value.\n * hasNumericValue:\n * Whether the property must be numeric or parse as a numeric and should be\n * removed when set to a falsey value.\n * hasPositiveNumericValue:\n * Whether the property must be positive numeric or parse as a positive\n * numeric and should be removed when set to a falsey value.\n * hasOverloadedBooleanValue:\n * Whether the property can be used as a flag as well as with a value.\n * Removed when strictly equal to false; present without a value when\n * strictly equal to true; present with a value otherwise.\n */\n properties: {},\n\n /**\n * Mapping from lowercase property names to the properly cased version, used\n * to warn in the case of missing properties. Available only in __DEV__.\n *\n * autofocus is predefined, because adding it to the property whitelist\n * causes unintended side effects.\n *\n * @type {Object}\n */\n getPossibleStandardName: process.env.NODE_ENV !== 'production' ? { autofocus: 'autoFocus' } : null,\n\n /**\n * All of the isCustomAttribute() functions that have been injected.\n */\n _isCustomAttributeFunctions: [],\n\n /**\n * Checks whether a property name is a custom attribute.\n * @method\n */\n isCustomAttribute: function (attributeName) {\n for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) {\n var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i];\n if (isCustomAttributeFn(attributeName)) {\n return true;\n }\n }\n return false;\n },\n\n injection: DOMPropertyInjection\n};\n\nmodule.exports = DOMProperty;","/**\n * Copyright (c) 2015-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\n'use strict';\n\nvar DOMNamespaces = require('./DOMNamespaces');\nvar setInnerHTML = require('./setInnerHTML');\n\nvar createMicrosoftUnsafeLocalFunction = require('./createMicrosoftUnsafeLocalFunction');\nvar setTextContent = require('./setTextContent');\n\nvar ELEMENT_NODE_TYPE = 1;\nvar DOCUMENT_FRAGMENT_NODE_TYPE = 11;\n\n/**\n * In IE (8-11) and Edge, appending nodes with no children is dramatically\n * faster than appending a full subtree, so we essentially queue up the\n * .appendChild calls here and apply them so each node is added to its parent\n * before any children are added.\n *\n * In other browsers, doing so is slower or neutral compared to the other order\n * (in Firefox, twice as slow) so we only do this inversion in IE.\n *\n * See https://github.com/spicyj/innerhtml-vs-createelement-vs-clonenode.\n */\nvar enableLazy = typeof document !== 'undefined' && typeof document.documentMode === 'number' || typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string' && /\\bEdge\\/\\d/.test(navigator.userAgent);\n\nfunction insertTreeChildren(tree) {\n if (!enableLazy) {\n return;\n }\n var node = tree.node;\n var children = tree.children;\n if (children.length) {\n for (var i = 0; i < children.length; i++) {\n insertTreeBefore(node, children[i], null);\n }\n } else if (tree.html != null) {\n setInnerHTML(node, tree.html);\n } else if (tree.text != null) {\n setTextContent(node, tree.text);\n }\n}\n\nvar insertTreeBefore = createMicrosoftUnsafeLocalFunction(function (parentNode, tree, referenceNode) {\n // DocumentFragments aren't actually part of the DOM after insertion so\n // appending children won't update the DOM. We need to ensure the fragment\n // is properly populated first, breaking out of our lazy approach for just\n // this level. Also, some