!function(e){function t(t){for(var n,o,i=t[0],a=t[1],s=0,u=[];s(.*?)<\\/"+s+">|<"+s+">|<"+s+"\\s*\\/>)"]=n[s];r=_(r,a)}return r}function _(e,t){var n=[e],r=!1;for(var o in t){var i=new RegExp(o),s=!1;for(var l in n){var u=n[l];if("string"==typeof u){var d=u.match(i);if(d){s=!0;var p=d.slice(2),f=u.substr(0,d.index),h=u.substr(d.index+d[0].length),m=void 0;"object"===(void 0===(m=t[o]instanceof Function?t[o].apply(null,p):t[o])?"undefined":(0,a.default)(m))&&(r=!0),n.splice(l,1),""!==h&&n.splice(l,0,h),"string"==typeof m&&""===m||n.splice(l,0,m),""!==f&&n.splice(l,0,f)}}}s||"%\\(count\\)s"!==o&&console.log("Could not find "+i+" in "+e)}return r?c.default.createElement.apply(c.default,["span",null].concat(n)):n.join("")}function v(){return new u.default(function(e,t){var r=void 0;try{r=n(1511)}catch(e){r=h+"languages.json"}(0,s.default)({method:"GET",url:r},function(n,r,o){n||r.status<200||r.status>=300?t({err:n,response:r}):e(JSON.parse(o))})})}function y(e){return new u.default(function(t,n){(0,s.default)({method:"GET",url:e},function(e,o,a){e||o.status<200||o.status>=300?n({err:e,response:o}):t(function(e){var t={},n=!0,o=!1,a=void 0;try{for(var s,l=(0,r.default)((0,i.default)(e));!(n=(s=l.next()).done);n=!0){var u=s.value,c=u.split("|",2);if(2===c.length){var d=t[c[0]];void 0===d&&(d={},t[c[0]]=d),d[c[1]]=e[u]}else t[u]=e[u]}}catch(e){o=!0,a=e}finally{try{!n&&l.return&&l.return()}finally{if(o)throw a}}return t}(JSON.parse(a)))})})}l.default.setSeparator("|"),l.default.setFallbackLocale("en")},function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t,n){"use strict";t.__esModule=!0;var r,o=n(241),i=(r=o)&&r.__esModule?r:{default:r};t.default=function(){function e(e,t){for(var n=0;n0;)f(e)}function f(e){var t=e.shift();if("function"!=typeof t)t._settlePromises();else{var n=e.shift(),r=e.shift();t.call(n,r)}}l.prototype.setScheduler=function(e){var t=this._schedule;return this._schedule=e,this._customScheduler=!0,t},l.prototype.hasCustomScheduler=function(){return this._customScheduler},l.prototype.enableTrampoline=function(){this._trampolineEnabled=!0},l.prototype.disableTrampolineIfNecessary=function(){s.hasDevTools&&(this._trampolineEnabled=!1)},l.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues},l.prototype.fatalError=function(e,n){n?(t.stderr.write("Fatal "+(e instanceof Error?e.stack:e)+"\n"),t.exit(2)):this.throwLater(e)},l.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")}},s.hasDevTools?(l.prototype.invokeLater=function(e,t,n){this._trampolineEnabled?u.call(this,e,t,n):this._schedule(function(){setTimeout(function(){e.call(t,n)},100)})},l.prototype.invoke=function(e,t,n){this._trampolineEnabled?c.call(this,e,t,n):this._schedule(function(){e.call(t,n)})},l.prototype.settlePromises=function(e){this._trampolineEnabled?d.call(this,e):this._schedule(function(){e._settlePromises()})}):(l.prototype.invokeLater=u,l.prototype.invoke=c,l.prototype.settlePromises=d),l.prototype._drainQueues=function(){p(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,p(this._lateQueue)},l.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},l.prototype._reset=function(){this._isTickUsed=!1},n.exports=l,n.exports.firstLineError=o},{"./queue":26,"./schedule":29,"./util":36}],3:[function(e,t,n){"use strict";t.exports=function(e,t,n,r){var o=!1,i=function(e,t){this._reject(t)},a=function(e,t){t.promiseRejectionQueued=!0,t.bindingPromise._then(i,i,null,this,e)},s=function(e,t){0==(50397184&this._bitField)&&this._resolveCallback(t.target)},l=function(e,t){t.promiseRejectionQueued||this._reject(e)};e.prototype.bind=function(i){o||(o=!0,e.prototype._propagateFrom=r.propagateFromFunction(),e.prototype._boundValue=r.boundValueFunction());var u=n(i),c=new e(t);c._propagateFrom(this,1);var d=this._target();if(c._setBoundTo(u),u instanceof e){var p={promiseRejectionQueued:!1,promise:c,target:d,bindingPromise:u};d._then(t,a,void 0,c,p),u._then(s,l,void 0,c,p),c._setOnCancel(u)}else c._resolveCallback(d);return c},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,n){return e.resolve(n).bind(t)}}},{}],4:[function(e,t,n){"use strict";var r;"undefined"!=typeof Promise&&(r=Promise);var o=e("./promise")();o.noConflict=function(){try{Promise===o&&(Promise=r)}catch(e){}return o},t.exports=o},{"./promise":22}],5:[function(e,t,n){"use strict";var r=Object.create;if(r){var o=r(null),i=r(null);o[" size"]=i[" size"]=0}t.exports=function(t){var n=e("./util"),r=n.canEvaluate;n.isIdentifier;function o(e){return function(e,r){var o;if(null!=e&&(o=e[r]),"function"!=typeof o){var i="Object "+n.classString(e)+" has no method '"+n.toString(r)+"'";throw new t.TypeError(i)}return o}(e,this.pop()).apply(e,this)}function i(e){return e[this]}function a(e){var t=+this;return t<0&&(t=Math.max(0,t+e.length)),e[t]}t.prototype.call=function(e){var t=[].slice.call(arguments,1);return t.push(e),this._then(o,void 0,void 0,t,void 0)},t.prototype.get=function(e){var t;if("number"==typeof e)t=a;else if(r){var n=(void 0)(e);t=null!==n?n:i}else t=i;return this._then(t,void 0,void 0,e,void 0)}}},{"./util":36}],6:[function(e,t,n){"use strict";t.exports=function(t,n,r,o){var i=e("./util"),a=i.tryCatch,s=i.errorObj,l=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 n=e._cancellationParent;if(null==n||!n._isCancellable()){e._isFollowing()?e._followee().cancel():e._cancelBranched();break}e._isFollowing()&&e._followee().cancel(),e._setWillBeCancelled(),t=e,e=n}},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(),l.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 n=0;n=0)return n[e]}return e.prototype._promiseCreated=function(){},e.prototype._pushContext=function(){},e.prototype._popContext=function(){return null},e._peekContext=e.prototype._peekContext=function(){},r.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promiseCreated=null,n.push(this._trace))},r.prototype._popContext=function(){if(void 0!==this._trace){var e=n.pop(),t=e._promiseCreated;return e._promiseCreated=null,t}return null},r.CapturedTrace=null,r.create=function(){if(t)return new r},r.deactivateLongStackTraces=function(){},r.activateLongStackTraces=function(){var n=e.prototype._pushContext,i=e.prototype._popContext,a=e._peekContext,s=e.prototype._peekContext,l=e.prototype._promiseCreated;r.deactivateLongStackTraces=function(){e.prototype._pushContext=n,e.prototype._popContext=i,e._peekContext=a,e.prototype._peekContext=s,e.prototype._promiseCreated=l,t=!1},t=!0,e.prototype._pushContext=r.prototype._pushContext,e.prototype._popContext=r.prototype._popContext,e._peekContext=e.prototype._peekContext=o,e.prototype._promiseCreated=function(){var e=this._peekContext();e&&null==e._promiseCreated&&(e._promiseCreated=this)}},r}},{}],9:[function(e,n,r){"use strict";n.exports=function(n,r){var o,i,a,s=n._getDomain,l=n._async,u=e("./errors").Warning,c=e("./util"),d=e("./es5"),p=c.canAttachTrace,f=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,h=/\((?:timers\.js):\d+:\d+\)/,m=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,g=null,_=null,v=!1,y=!(0==c.env("BLUEBIRD_DEBUG")),b=!(0==c.env("BLUEBIRD_WARNINGS")||!y&&!c.env("BLUEBIRD_WARNINGS")),E=!(0==c.env("BLUEBIRD_LONG_STACK_TRACES")||!y&&!c.env("BLUEBIRD_LONG_STACK_TRACES")),S=0!=c.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&(b||!!c.env("BLUEBIRD_W_FORGOTTEN_RETURN"));n.prototype.suppressUnhandledRejections=function(){var e=this._target();e._bitField=-1048577&e._bitField|524288},n.prototype._ensurePossibleRejectionHandled=function(){if(0==(524288&this._bitField)){this._setRejectionIsUnhandled();var e=this;setTimeout(function(){e._notifyUnhandledRejection()},1)}},n.prototype._notifyUnhandledRejectionIsHandled=function(){H("rejectionHandled",o,void 0,this)},n.prototype._setReturnedNonUndefined=function(){this._bitField=268435456|this._bitField},n.prototype._returnedNonUndefined=function(){return 0!=(268435456&this._bitField)},n.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var e=this._settledValue();this._setUnhandledRejectionIsNotified(),H("unhandledRejection",i,e,this)}},n.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=262144|this._bitField},n.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=-262145&this._bitField},n.prototype._isUnhandledRejectionNotified=function(){return(262144&this._bitField)>0},n.prototype._setRejectionIsUnhandled=function(){this._bitField=1048576|this._bitField},n.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-1048577&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},n.prototype._isRejectionUnhandled=function(){return(1048576&this._bitField)>0},n.prototype._warn=function(e,t,n){return G(e,t,n||this)},n.onPossiblyUnhandledRejection=function(e){var t=s();i="function"==typeof e?null===t?e:c.domainBind(t,e):void 0},n.onUnhandledRejectionHandled=function(e){var t=s();o="function"==typeof e?null===t?e:c.domainBind(t,e):void 0};var w=function(){};n.longStackTraces=function(){if(l.haveItemsQueued()&&!Z.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");if(!Z.longStackTraces&&Y()){var e=n.prototype._captureStackTrace,t=n.prototype._attachExtraTrace,o=n.prototype._dereferenceTrace;Z.longStackTraces=!0,w=function(){if(l.haveItemsQueued()&&!Z.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");n.prototype._captureStackTrace=e,n.prototype._attachExtraTrace=t,n.prototype._dereferenceTrace=o,r.deactivateLongStackTraces(),l.enableTrampoline(),Z.longStackTraces=!1},n.prototype._captureStackTrace=U,n.prototype._attachExtraTrace=B,n.prototype._dereferenceTrace=j,r.activateLongStackTraces(),l.disableTrampolineIfNecessary()}},n.hasLongStackTraces=function(){return Z.longStackTraces&&Y()};var C=function(){try{if("function"==typeof CustomEvent){var e=new CustomEvent("CustomEvent");return c.global.dispatchEvent(e),function(e,t){var n={detail:t,cancelable:!0};d.defineProperty(n,"promise",{value:t.promise}),d.defineProperty(n,"reason",{value:t.reason});var r=new CustomEvent(e.toLowerCase(),n);return!c.global.dispatchEvent(r)}}if("function"==typeof Event){e=new Event("CustomEvent");return c.global.dispatchEvent(e),function(e,t){var n=new Event(e.toLowerCase(),{cancelable:!0});return n.detail=t,d.defineProperty(n,"promise",{value:t.promise}),d.defineProperty(n,"reason",{value:t.reason}),!c.global.dispatchEvent(n)}}return(e=document.createEvent("CustomEvent")).initCustomEvent("testingtheevent",!1,!0,{}),c.global.dispatchEvent(e),function(e,t){var n=document.createEvent("CustomEvent");return n.initCustomEvent(e.toLowerCase(),!1,!0,t),!c.global.dispatchEvent(n)}}catch(e){}return function(){return!1}}(),x=c.isNode?function(){return t.emit.apply(t,arguments)}:c.global?function(e){var t="on"+e.toLowerCase(),n=c.global[t];return!!n&&(n.apply(c.global,[].slice.call(arguments,1)),!0)}:function(){return!1};function k(e,t){return{promise:t}}var T={promiseCreated:k,promiseFulfilled:k,promiseRejected:k,promiseResolved:k,promiseCancelled:k,promiseChained:function(e,t,n){return{promise:t,child:n}},warning:function(e,t){return{warning:t}},unhandledRejection:function(e,t,n){return{reason:t,promise:n}},rejectionHandled:k},R=function(e){var t=!1;try{t=x.apply(null,arguments)}catch(e){l.throwLater(e),t=!0}var n=!1;try{n=C(e,T[e].apply(null,arguments))}catch(e){l.throwLater(e),n=!0}return n||t};function F(){return!1}function D(e,t,n){var r=this;try{e(t,n,function(e){if("function"!=typeof e)throw new TypeError("onCancel must be a function, got: "+c.toString(e));r._attachCancellationCallback(e)})}catch(e){return e}}function A(e){if(!this._isCancellable())return this;var t=this._onCancel();void 0!==t?c.isArray(t)?t.push(e):this._setOnCancel([t,e]):this._setOnCancel(e)}function I(){return this._onCancelField}function N(e){this._onCancelField=e}function O(){this._cancellationParent=void 0,this._onCancelField=void 0}function M(e,t){if(0!=(1&t)){this._cancellationParent=e;var n=e._branchesRemainingToCancel;void 0===n&&(n=0),e._branchesRemainingToCancel=n+1}0!=(2&t)&&e._isBound()&&this._setBoundTo(e._boundTo)}n.config=function(e){if("longStackTraces"in(e=Object(e))&&(e.longStackTraces?n.longStackTraces():!e.longStackTraces&&n.hasLongStackTraces()&&w()),"warnings"in e){var t=e.warnings;Z.warnings=!!t,S=Z.warnings,c.isObject(t)&&"wForgottenReturn"in t&&(S=!!t.wForgottenReturn)}if("cancellation"in e&&e.cancellation&&!Z.cancellation){if(l.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");n.prototype._clearCancellationData=O,n.prototype._propagateFrom=M,n.prototype._onCancel=I,n.prototype._setOnCancel=N,n.prototype._attachCancellationCallback=A,n.prototype._execute=D,P=M,Z.cancellation=!0}return"monitoring"in e&&(e.monitoring&&!Z.monitoring?(Z.monitoring=!0,n.prototype._fireEvent=R):!e.monitoring&&Z.monitoring&&(Z.monitoring=!1,n.prototype._fireEvent=F)),n},n.prototype._fireEvent=F,n.prototype._execute=function(e,t,n){try{e(t,n)}catch(e){return e}},n.prototype._onCancel=function(){},n.prototype._setOnCancel=function(e){},n.prototype._attachCancellationCallback=function(e){},n.prototype._captureStackTrace=function(){},n.prototype._attachExtraTrace=function(){},n.prototype._dereferenceTrace=function(){},n.prototype._clearCancellationData=function(){},n.prototype._propagateFrom=function(e,t){};var P=function(e,t){0!=(2&t)&&e._isBound()&&this._setBoundTo(e._boundTo)};function L(){var e=this._boundTo;return void 0!==e&&e instanceof n?e.isFulfilled()?e.value():void 0:e}function U(){this._trace=new J(this._peekContext())}function B(e,t){if(p(e)){var n=this._trace;if(void 0!==n&&t&&(n=n._parent),void 0!==n)n.attachExtraTrace(e);else if(!e.__stackCleaned__){var r=V(e);c.notEnumerableProp(e,"stack",r.message+"\n"+r.stack.join("\n")),c.notEnumerableProp(e,"__stackCleaned__",!0)}}}function j(){this._trace=void 0}function G(e,t,r){if(Z.warnings){var o,i=new u(e);if(t)r._attachExtraTrace(i);else if(Z.longStackTraces&&(o=n._peekContext()))o.attachExtraTrace(i);else{var a=V(i);i.stack=a.message+"\n"+a.stack.join("\n")}R("warning",i)||z(i,"",!0)}}function q(e){for(var t=[],n=0;n0?function(e){for(var t=e.stack.replace(/\s+$/g,"").split("\n"),n=0;n0&&"SyntaxError"!=e.name&&(t=t.slice(n)),t}(e):[" (No stack trace)"],{message:n,stack:"SyntaxError"==e.name?t:q(t)}}function z(e,t,n){if("undefined"!=typeof console){var r;if(c.isObject(e)){var o=e.stack;r=t+_(o,e)}else r=t+String(e);"function"==typeof a?a(r,n):"function"!=typeof console.log&&"object"!=typeof console.log||console.log(r)}}function H(e,t,n,r){var o=!1;try{"function"==typeof t&&(o=!0,"rejectionHandled"===e?t(r):t(n,r))}catch(e){l.throwLater(e)}"unhandledRejection"===e?R(e,n,r)||o||z(n,"Unhandled rejection "):R(e,r)}function K(e){var t;if("function"==typeof e)t="[function "+(e.name||"anonymous")+"]";else{t=e&&"function"==typeof e.toString?e.toString():c.toString(e);if(/\[object [a-zA-Z0-9$_]+\]/.test(t))try{t=JSON.stringify(e)}catch(e){}0===t.length&&(t="(empty array)")}return"(<"+function(e){if(e.length<41)return e;return e.substr(0,38)+"..."}(t)+">, no stack trace)"}function Y(){return"function"==typeof X}var W=function(){return!1},$=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;function Q(e){var t=e.match($);if(t)return{fileName:t[1],line:parseInt(t[2],10)}}function J(e){this._parent=e,this._promisesCreated=0;var t=this._length=1+(void 0===e?0:e._length);X(this,J),t>32&&this.uncycle()}c.inherits(J,Error),r.CapturedTrace=J,J.prototype.uncycle=function(){var e=this._length;if(!(e<2)){for(var t=[],n={},r=0,o=this;void 0!==o;++r)t.push(o),o=o._parent;for(r=(e=this._length=r)-1;r>=0;--r){var i=t[r].stack;void 0===n[i]&&(n[i]=r)}for(r=0;r0&&(t[a-1]._parent=void 0,t[a-1]._length=1),t[r]._parent=void 0,t[r]._length=1;var s=r>0?t[r-1]:this;a=0;--u)t[u]._length=l,l++;return}}}},J.prototype.attachExtraTrace=function(e){if(!e.__stackCleaned__){this.uncycle();for(var t=V(e),n=t.message,r=[t.stack],o=this;void 0!==o;)r.push(q(o.stack.split("\n"))),o=o._parent;!function(e){for(var t=e[0],n=1;n=0;--s)if(r[s]===i){a=s;break}for(s=a;s>=0;--s){var l=r[s];if(t[o]!==l)break;t.pop(),o--}t=r}}(r),function(e){for(var t=0;t=0)return g=/@/,_=t,v=!0,function(e){e.stack=(new Error).stack};try{throw new Error}catch(e){r="stack"in e}return"stack"in o||!r||"number"!=typeof Error.stackTraceLimit?(_=function(e,t){return"string"==typeof e?e:"object"!=typeof t&&"function"!=typeof t||void 0===t.name||void 0===t.message?K(t):t.toString()},null):(g=e,_=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&&(a=function(e){console.warn(e)},c.isNode&&t.stderr.isTTY?a=function(e,t){var n=t?"":"";console.warn(n+e+"\n")}:c.isNode||"string"!=typeof(new Error).stack||(a=function(e,t){console.warn("%c"+e,t?"color: darkorange":"color: red")}));var Z={warnings:b,longStackTraces:!1,cancellation:!1,monitoring:!1};return E&&n.longStackTraces(),{longStackTraces:function(){return Z.longStackTraces},warnings:function(){return Z.warnings},cancellation:function(){return Z.cancellation},monitoring:function(){return Z.monitoring},propagateFromFunction:function(){return P},boundValueFunction:function(){return L},checkForgottenReturns:function(e,t,n,r,o){if(void 0===e&&null!==t&&S){if(void 0!==o&&o._returnedNonUndefined())return;if(0==(65535&r._bitField))return;n&&(n+=" ");var i="",a="";if(t._trace){for(var s=t._trace.stack.split("\n"),l=q(s),u=l.length-1;u>=0;--u){var c=l[u];if(!h.test(c)){var d=c.match(m);d&&(i="at "+d[1]+":"+d[2]+":"+d[3]+" ");break}}if(l.length>0){var p=l[0];for(u=0;u0&&(a="\n"+s[u-1]);break}}}var f="a promise was created in a "+n+"handler "+i+"but was not returned from it, see http://goo.gl/rRqMUw"+a;r._warn(f,!0,t)}},setBounds:function(e,t){if(Y()){for(var n,r,o=e.stack.split("\n"),i=t.stack.split("\n"),a=-1,s=-1,l=0;l=s||(W=function(e){if(f.test(e))return!0;var t=Q(e);return!!(t&&t.fileName===n&&a<=t.line&&t.line<=s)})}},warn:G,deprecated:function(e,t){var n=e+" is deprecated and will be removed in a future version.";return t&&(n+=" Use "+t+" instead."),G(n)},CapturedTrace:J,fireDomEvent:C,fireGlobalEvent:x}}},{"./errors":12,"./es5":13,"./util":36}],10:[function(e,t,n){"use strict";t.exports=function(e){function t(){return this.value}function n(){throw this.reason}e.prototype.return=e.prototype.thenReturn=function(n){return n instanceof e&&n.suppressUnhandledRejections(),this._then(t,void 0,void 0,{value:n},void 0)},e.prototype.throw=e.prototype.thenThrow=function(e){return this._then(n,void 0,void 0,{reason:e},void 0)},e.prototype.catchThrow=function(e){if(arguments.length<=1)return this._then(void 0,n,void 0,{reason:e},void 0);var t=arguments[1];return this.caught(e,function(){throw t})},e.prototype.catchReturn=function(n){if(arguments.length<=1)return n instanceof e&&n.suppressUnhandledRejections(),this._then(void 0,t,void 0,{value:n},void 0);var r=arguments[1];r instanceof e&&r.suppressUnhandledRejections();return this.caught(n,function(){return r})}}},{}],11:[function(e,t,n){"use strict";t.exports=function(e,t){var n=e.reduce,r=e.all;function o(){return r(this)}e.prototype.each=function(e){return n(this,e,t,0)._then(o,void 0,void 0,this,void 0)},e.prototype.mapSeries=function(e){return n(this,e,t,t)},e.each=function(e,r){return n(e,r,t,0)._then(o,void 0,void 0,e,void 0)},e.mapSeries=function(e,r){return n(e,r,t,t)}}},{}],12:[function(e,t,n){"use strict";var r,o,i=e("./es5"),a=i.freeze,s=e("./util"),l=s.inherits,u=s.notEnumerableProp;function c(e,t){function n(r){if(!(this instanceof n))return new n(r);u(this,"message","string"==typeof r?r:t),u(this,"name",e),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this)}return l(n,Error),n}var d=c("Warning","warning"),p=c("CancellationError","cancellation error"),f=c("TimeoutError","timeout error"),h=c("AggregateError","aggregate error");try{r=TypeError,o=RangeError}catch(e){r=c("TypeError","type error"),o=c("RangeError","range error")}for(var m="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),g=0;g1?e.cancelPromise._reject(t):e.cancelPromise._cancel(),e.cancelPromise=null,!0)}function d(){return f.call(this,this.promise._target()._settledValue())}function p(e){if(!c(this,e))return a.e=e,a}function f(e){var o=this.promise,s=this.handler;if(!this.called){this.called=!0;var l=this.isFinallyHandler()?s.call(o._boundValue()):s.call(o._boundValue(),e);if(l===r)return l;if(void 0!==l){o._setReturnedNonUndefined();var f=n(l,o);if(f instanceof t){if(null!=this.cancelPromise){if(f._isCancelled()){var h=new i("late cancellation observer");return o._attachExtraTrace(h),a.e=h,a}f.isPending()&&f._attachCancellationCallback(new u(this))}return f._then(d,p,void 0,this,void 0)}}}return o.isRejected()?(c(this),a.e=e,a):(c(this),e)}return l.prototype.isFinallyHandler=function(){return 0===this.type},u.prototype._resultCancelled=function(){c(this.finallyHandler)},t.prototype._passThrough=function(e,t,n,r){return"function"!=typeof e?this.then():this._then(n,r,void 0,new l(this,t,e),void 0)},t.prototype.lastly=t.prototype.finally=function(e){return this._passThrough(e,0,f,f)},t.prototype.tap=function(e){return this._passThrough(e,1,f)},t.prototype.tapCatch=function(e){var n=arguments.length;if(1===n)return this._passThrough(e,1,void 0,f);var r,i=new Array(n-1),a=0;for(r=0;r0&&"function"==typeof arguments[t]&&(e=arguments[t]);var r=[].slice.call(arguments);e&&r.pop();var o=new n(r).promise();return void 0!==e?o.spread(e):o}}},{"./util":36}],18:[function(e,t,n){"use strict";t.exports=function(t,n,r,o,i,a){var s=t._getDomain,l=e("./util"),u=l.tryCatch,c=l.errorObj,d=t._async;function p(e,t,n,r){this.constructor$(e),this._promise._captureStackTrace();var o=s();this._callback=null===o?t:l.domainBind(o,t),this._preservedValues=r===i?new Array(this.length()):null,this._limit=n,this._inFlight=0,this._queue=[],d.invoke(this._asyncInit,this,void 0)}function f(e,n,o,i){if("function"!=typeof n)return r("expecting a function but got "+l.classString(n));var a=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)));a=o.concurrency}return new p(e,n,a="number"==typeof a&&isFinite(a)&&a>=1?a:0,i).promise()}l.inherits(p,n),p.prototype._asyncInit=function(){this._init$(void 0,-2)},p.prototype._init=function(){},p.prototype._promiseFulfilled=function(e,n){var r=this._values,i=this.length(),s=this._preservedValues,l=this._limit;if(n<0){if(r[n=-1*n-1]=e,l>=1&&(this._inFlight--,this._drainQueue(),this._isResolved()))return!0}else{if(l>=1&&this._inFlight>=l)return r[n]=e,this._queue.push(n),!1;null!==s&&(s[n]=e);var d=this._promise,p=this._callback,f=d._boundValue();d._pushContext();var h=u(p).call(f,e,n,i),m=d._popContext();if(a.checkForgottenReturns(h,m,null!==s?"Promise.filter":"Promise.map",d),h===c)return this._reject(h.e),!0;var g=o(h,this._promise);if(g instanceof t){var _=(g=g._target())._bitField;if(0==(50397184&_))return l>=1&&this._inFlight++,r[n]=g,g._proxy(this,-1*(n+1)),!1;if(0==(33554432&_))return 0!=(16777216&_)?(this._reject(g._reason()),!0):(this._cancel(),!0);h=g._value()}r[n]=h}return++this._totalResolved>=i&&(null!==s?this._filter(r,s):this._resolve(r),!0)},p.prototype._drainQueue=function(){for(var e=this._queue,t=this._limit,n=this._values;e.length>0&&this._inFlight1){i.deprecated("calling Promise.try with more than 1 argument");var u=arguments[1],c=arguments[2];r=a.isArray(u)?s(e).apply(c,u):s(e).call(c,u)}else r=s(e)();var d=l._popContext();return i.checkForgottenReturns(r,d,"Promise.try",l),l._resolveFromSyncValue(r),l},t.prototype._resolveFromSyncValue=function(e){e===a.errorObj?this._rejectCallback(e.e,!1):this._resolveCallback(e,!0)}}},{"./util":36}],20:[function(e,t,n){"use strict";var r=e("./util"),o=r.maybeWrapAsError,i=e("./errors").OperationalError,a=e("./es5");var s=/^(?:name|message|stack|cause)$/;function l(e){var t;if(function(e){return e instanceof Error&&a.getPrototypeOf(e)===Error.prototype}(e)){(t=new i(e)).name=e.name,t.message=e.message,t.stack=e.stack;for(var n=a.keys(e),o=0;o1){var n,r=new Array(t-1),o=0;for(n=0;n0&&"function"!=typeof e&&"function"!=typeof t){var n=".then() only accepts functions but was passed: "+u.classString(e);arguments.length>1&&(n+=", "+u.classString(t)),this._warn(n)}return this._then(e,t,void 0,void 0,void 0)},F.prototype.done=function(e,t){this._then(e,t,void 0,void 0,void 0)._setIsFinal()},F.prototype.spread=function(e){return"function"!=typeof e?i("expecting a function but got "+u.classString(e)):this.all()._then(e,void 0,void 0,_,void 0)},F.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},F.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new b(this).promise()},F.prototype.error=function(e){return this.caught(u.originatesFromRejection,e)},F.getNewLibraryCopy=n.exports,F.is=function(e){return e instanceof F},F.fromNode=F.fromCallback=function(e){var t=new F(g);t._captureStackTrace();var n=arguments.length>1&&!!Object(arguments[1]).multiArgs,r=R(e)(k(t,n));return r===T&&t._rejectCallback(r.e,!0),t._isFateSealed()||t._setAsyncGuaranteed(),t},F.all=function(e){return new b(e).promise()},F.cast=function(e){var t=y(e);return t instanceof F||((t=new F(g))._captureStackTrace(),t._setFulfilled(),t._rejectionHandler0=e),t},F.resolve=F.fulfilled=F.cast,F.reject=F.rejected=function(e){var t=new F(g);return t._captureStackTrace(),t._rejectCallback(e,!0),t},F.setScheduler=function(e){if("function"!=typeof e)throw new h("expecting a function but got "+u.classString(e));return p.setScheduler(e)},F.prototype._then=function(e,t,n,r,o){var i=void 0!==o,a=i?o:new F(g),l=this._target(),c=l._bitField;i||(a._propagateFrom(this,3),a._captureStackTrace(),void 0===r&&0!=(2097152&this._bitField)&&(r=0!=(50397184&c)?this._boundValue():l===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,a));var d=s();if(0!=(50397184&c)){var f,h,_=l._settlePromiseCtx;0!=(33554432&c)?(h=l._rejectionHandler0,f=e):0!=(16777216&c)?(h=l._fulfillmentHandler0,f=t,l._unsetRejectionIsUnhandled()):(_=l._settlePromiseLateCancellationObserver,h=new m("late cancellation observer"),l._attachExtraTrace(h),f=t),p.invoke(_,l,{handler:null===d?f:"function"==typeof f&&u.domainBind(d,f),promise:a,receiver:r,value:h})}else l._addCallbacks(e,t,a,r,d);return a},F.prototype._length=function(){return 65535&this._bitField},F.prototype._isFateSealed=function(){return 0!=(117506048&this._bitField)},F.prototype._isFollowing=function(){return 67108864==(67108864&this._bitField)},F.prototype._setLength=function(e){this._bitField=-65536&this._bitField|65535&e},F.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField,this._fireEvent("promiseFulfilled",this)},F.prototype._setRejected=function(){this._bitField=16777216|this._bitField,this._fireEvent("promiseRejected",this)},F.prototype._setFollowing=function(){this._bitField=67108864|this._bitField,this._fireEvent("promiseResolved",this)},F.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},F.prototype._isFinal=function(){return(4194304&this._bitField)>0},F.prototype._unsetCancelled=function(){this._bitField=-65537&this._bitField},F.prototype._setCancelled=function(){this._bitField=65536|this._bitField,this._fireEvent("promiseCancelled",this)},F.prototype._setWillBeCancelled=function(){this._bitField=8388608|this._bitField},F.prototype._setAsyncGuaranteed=function(){p.hasCustomScheduler()||(this._bitField=134217728|this._bitField)},F.prototype._receiverAt=function(e){var t=0===e?this._receiver0:this[4*e-4+3];if(t!==l)return void 0===t&&this._isBound()?this._boundValue():t},F.prototype._promiseAt=function(e){return this[4*e-4+2]},F.prototype._fulfillmentHandlerAt=function(e){return this[4*e-4+0]},F.prototype._rejectionHandlerAt=function(e){return this[4*e-4+1]},F.prototype._boundValue=function(){},F.prototype._migrateCallback0=function(e){e._bitField;var t=e._fulfillmentHandler0,n=e._rejectionHandler0,r=e._promise0,o=e._receiverAt(0);void 0===o&&(o=l),this._addCallbacks(t,n,r,o,null)},F.prototype._migrateCallbackAt=function(e,t){var n=e._fulfillmentHandlerAt(t),r=e._rejectionHandlerAt(t),o=e._promiseAt(t),i=e._receiverAt(t);void 0===i&&(i=l),this._addCallbacks(n,r,o,i,null)},F.prototype._addCallbacks=function(e,t,n,r,o){var i=this._length();if(i>=65531&&(i=0,this._setLength(0)),0===i)this._promise0=n,this._receiver0=r,"function"==typeof e&&(this._fulfillmentHandler0=null===o?e:u.domainBind(o,e)),"function"==typeof t&&(this._rejectionHandler0=null===o?t:u.domainBind(o,t));else{var a=4*i-4;this[a+2]=n,this[a+3]=r,"function"==typeof e&&(this[a+0]=null===o?e:u.domainBind(o,e)),"function"==typeof t&&(this[a+1]=null===o?t:u.domainBind(o,t))}return this._setLength(i+1),i},F.prototype._proxy=function(e,t){this._addCallbacks(void 0,void 0,t,e,null)},F.prototype._resolveCallback=function(e,t){if(0==(117506048&this._bitField)){if(e===this)return this._rejectCallback(r(),!1);var n=y(e,this);if(!(n instanceof F))return this._fulfill(e);t&&this._propagateFrom(n,2);var o=n._target();if(o!==this){var i=o._bitField;if(0==(50397184&i)){var a=this._length();a>0&&o._migrateCallback0(this);for(var s=1;s>>16)){if(e===this){var n=r();return this._attachExtraTrace(n),this._reject(n)}this._setFulfilled(),this._rejectionHandler0=e,(65535&t)>0&&(0!=(134217728&t)?this._settlePromises():p.settlePromises(this),this._dereferenceTrace())}},F.prototype._reject=function(e){var t=this._bitField;if(!((117506048&t)>>>16)){if(this._setRejected(),this._fulfillmentHandler0=e,this._isFinal())return p.fatalError(e,u.isNode);(65535&t)>0?p.settlePromises(this):this._ensurePossibleRejectionHandled()}},F.prototype._fulfillPromises=function(e,t){for(var n=1;n0){if(0!=(16842752&e)){var n=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,n,e),this._rejectPromises(t,n)}else{var r=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,r,e),this._fulfillPromises(t,r)}this._setLength(0)}this._clearCancellationData()},F.prototype._settledValue=function(){var e=this._bitField;return 0!=(33554432&e)?this._rejectionHandler0:0!=(16777216&e)?this._fulfillmentHandler0:void 0},F.defer=F.pending=function(){return w.deprecated("Promise.defer","new Promise"),{promise:new F(g),resolve:D,reject:A}},u.notEnumerableProp(F,"_makeSelfResolutionError",r),e("./method")(F,g,y,i,w),e("./bind")(F,g,y,w),e("./cancel")(F,b,i,w),e("./direct_resolve")(F),e("./synchronous_inspection")(F),e("./join")(F,b,y,g,p,s),F.Promise=F,F.version="3.5.4",e("./map.js")(F,b,i,y,g,w),e("./call_get.js")(F),e("./using.js")(F,i,y,S,g,w),e("./timers.js")(F,g,w),e("./generators.js")(F,i,g,y,a,w),e("./nodeify.js")(F),e("./promisify.js")(F,g),e("./props.js")(F,b,y,i),e("./race.js")(F,g,y,i),e("./reduce.js")(F,b,i,y,g,w),e("./settle.js")(F,b,w),e("./some.js")(F,b,i),e("./filter.js")(F,g),e("./each.js")(F,g),e("./any.js")(F),u.toFastProperties(F),u.toFastProperties(F.prototype),I({a:1}),I({b:2}),I({c:3}),I(1),I(function(){}),I(void 0),I(!1),I(new F(g)),w.setBounds(d.firstLineError,u.lastLineError),F}},{"./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,n){"use strict";t.exports=function(t,n,r,o,i){var a=e("./util");a.isArray;function s(e){var r=this._promise=new t(n);e instanceof t&&r._propagateFrom(e,3),r._setOnCancel(this),this._values=e,this._length=0,this._totalResolved=0,this._init(void 0,-2)}return a.inherits(s,i),s.prototype.length=function(){return this._length},s.prototype.promise=function(){return this._promise},s.prototype._init=function e(n,i){var s=r(this._values,this._promise);if(s instanceof t){var l=(s=s._target())._bitField;if(this._values=s,0==(50397184&l))return this._promise._setAsyncGuaranteed(),s._then(e,this._reject,void 0,this,i);if(0==(33554432&l))return 0!=(16777216&l)?this._reject(s._reason()):this._cancel();s=s._value()}if(null!==(s=a.asArray(s)))0!==s.length?this._iterate(s):-5===i?this._resolveEmptyArray():this._resolve(function(e){switch(e){case-2:return[];case-3:return{};case-6:return new Map}}(i));else{var u=o("expecting an array or an iterable object but got "+a.classString(s)).reason();this._promise._rejectCallback(u,!1)}},s.prototype._iterate=function(e){var n=this.getActualLength(e.length);this._length=n,this._values=this.shouldCopyValues()?new Array(n):this._values;for(var o=this._promise,i=!1,a=null,s=0;s=this._length&&(this._resolve(this._values),!0)},s.prototype._promiseCancelled=function(){return this._cancel(),!0},s.prototype._promiseRejected=function(e){return this._totalResolved++,this._reject(e),!0},s.prototype._resultCancelled=function(){if(!this._isResolved()){var e=this._values;if(this._cancel(),e instanceof t)e.cancel();else for(var n=0;n=this._length){var n;if(this._isMap)n=function(e){for(var t=new i,n=e.length/2|0,r=0;r>1},t.prototype.props=function(){return d(this)},t.props=function(e){return d(e)}}},{"./es5":13,"./util":36}],26:[function(e,t,n){"use strict";function r(e){this._capacity=e,this._length=0,this._front=0}r.prototype._willBeOverCapacity=function(e){return this._capacity=this._length&&(this._resolve(this._values),!0)},i.prototype._promiseFulfilled=function(e,t){var n=new o;return n._bitField=33554432,n._settledValueField=e,this._promiseResolved(t,n)},i.prototype._promiseRejected=function(e,t){var n=new o;return n._bitField=16777216,n._settledValueField=e,this._promiseResolved(t,n)},t.settle=function(e){return r.deprecated(".settle()",".reflect()"),new i(e).promise()},t.prototype.settle=function(){return t.settle(this)}}},{"./util":36}],31:[function(e,t,n){"use strict";t.exports=function(t,n,r){var o=e("./util"),i=e("./errors").RangeError,a=e("./errors").AggregateError,s=o.isArray,l={};function u(e){this.constructor$(e),this._howMany=0,this._unwrap=!1,this._initialized=!1}function c(e,t){if((0|t)!==t||t<0)return r("expecting a positive integer\n\n See http://goo.gl/MqrFmX\n");var n=new u(e),o=n.promise();return n.setHowMany(t),n.init(),o}o.inherits(u,n),u.prototype._init=function(){if(this._initialized)if(0!==this._howMany){this._init$(void 0,-5);var e=s(this._values);!this._isResolved()&&e&&this._howMany>this._canPossiblyFulfill()&&this._reject(this._getRangeError(this.length()))}else this._resolve([])},u.prototype.init=function(){this._initialized=!0,this._init()},u.prototype.setUnwrap=function(){this._unwrap=!0},u.prototype.howMany=function(){return this._howMany},u.prototype.setHowMany=function(e){this._howMany=e},u.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)},u.prototype._promiseRejected=function(e){return this._addRejected(e),this._checkOutcome()},u.prototype._promiseCancelled=function(){return this._values instanceof t||null==this._values?this._cancel():(this._addRejected(l),this._checkOutcome())},u.prototype._checkOutcome=function(){if(this.howMany()>this._canPossiblyFulfill()){for(var e=new a,t=this.length();t0?this._reject(e):this._cancel(),!0}return!1},u.prototype._fulfilled=function(){return this._totalResolved},u.prototype._rejected=function(){return this._values.length-this.length()},u.prototype._addRejected=function(e){this._values.push(e)},u.prototype._addFulfilled=function(e){this._values[this._totalResolved++]=e},u.prototype._canPossiblyFulfill=function(){return this.length()-this._rejected()},u.prototype._getRangeError=function(e){var t="Input array must contain at least "+this._howMany+" items but contains only "+e+" items";return new i(t)},u.prototype._resolveEmptyArray=function(){this._reject(this._getRangeError(0))},t.some=function(e,t){return c(e,t)},t.prototype.some=function(e){return c(this,e)},t._SomePromiseArray=u}},{"./errors":12,"./util":36}],32:[function(e,t,n){"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 n=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()},r=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)},a=t.prototype.isPending=function(){return 0==(50397184&this._bitField)},s=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 a.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 s.call(this._target())},e.prototype.value=function(){return n.call(this._target())},e.prototype.reason=function(){var e=this._target();return e._unsetRejectionIsUnhandled(),r.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,n){"use strict";t.exports=function(t,n){var r=e("./util"),o=r.errorObj,i=r.isObject;var a={}.hasOwnProperty;return function(e,s){if(i(e)){if(e instanceof t)return e;var l=function(e){try{return function(e){return e.then}(e)}catch(e){return o.e=e,o}}(e);if(l===o){s&&s._pushContext();var u=t.reject(l.e);return s&&s._popContext(),u}if("function"==typeof l)return function(e){try{return a.call(e,"_promise0")}catch(e){return!1}}(e)?(u=new t(n),e._then(u._fulfill,u._reject,void 0,u,null),u):function(e,i,a){var s=new t(n),l=s;a&&a._pushContext(),s._captureStackTrace(),a&&a._popContext();var u=!0,c=r.tryCatch(i).call(e,function(e){s&&(s._resolveCallback(e),s=null)},function(e){s&&(s._rejectCallback(e,u,!0),s=null)});return u=!1,s&&c===o&&(s._rejectCallback(c.e,!0,!0),s=null),l}(e,l,s)}return e}}},{"./util":36}],34:[function(e,t,n){"use strict";t.exports=function(t,n,r){var o=e("./util"),i=t.TimeoutError;function a(e){this.handle=e}a.prototype._resultCancelled=function(){clearTimeout(this.handle)};var s=function(e){return l(+this).thenReturn(e)},l=t.delay=function(e,o){var i,l;return void 0!==o?(i=t.resolve(o)._then(s,null,null,e,void 0),r.cancellation()&&o instanceof t&&i._setOnCancel(o)):(i=new t(n),l=setTimeout(function(){i._fulfill()},+e),r.cancellation()&&i._setOnCancel(new a(l)),i._captureStackTrace()),i._setAsyncGuaranteed(),i};t.prototype.delay=function(e){return l(e,this)};function u(e){return clearTimeout(this.handle),e}function c(e){throw clearTimeout(this.handle),e}t.prototype.timeout=function(e,t){var n,s;e=+e;var l=new a(setTimeout(function(){n.isPending()&&function(e,t,n){var r;r="string"!=typeof t?t instanceof Error?t:new i("operation timed out"):new i(t),o.markAsOriginatingFromRejection(r),e._attachExtraTrace(r),e._reject(r),null!=n&&n.cancel()}(n,t,s)},e));return r.cancellation()?(s=this.then(),(n=s._then(u,c,void 0,l,void 0))._setOnCancel(l)):n=this._then(u,c,void 0,l,void 0),n}}},{"./util":36}],35:[function(e,t,n){"use strict";t.exports=function(t,n,r,o,i,a){var s=e("./util"),l=e("./errors").TypeError,u=e("./util").inherits,c=s.errorObj,d=s.tryCatch,p={};function f(e){setTimeout(function(){throw e},0)}function h(e,n){var o=0,a=e.length,s=new t(i);return function i(){if(o>=a)return s._fulfill();var l=function(e){var t=r(e);return t!==e&&"function"==typeof e._isDisposable&&"function"==typeof e._getDisposer&&e._isDisposable()&&t._setDisposable(e._getDisposer()),t}(e[o++]);if(l instanceof t&&l._isDisposable()){try{l=r(l._getDisposer().tryDispose(n),e.promise)}catch(e){return f(e)}if(l instanceof t)return l._then(i,f,null,null,null)}i()}(),s}function m(e,t,n){this._data=e,this._promise=t,this._context=n}function g(e,t,n){this.constructor$(e,t,n)}function _(e){return m.isDisposer(e)?(this.resources[this.index]._setDisposable(e),e.promise()):e}function v(e){this.length=e,this.promise=null,this[e-1]=null}m.prototype.data=function(){return this._data},m.prototype.promise=function(){return this._promise},m.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():p},m.prototype.tryDispose=function(e){var t=this.resource(),n=this._context;void 0!==n&&n._pushContext();var r=t!==p?this.doDispose(t,e):null;return void 0!==n&&n._popContext(),this._promise._unsetDisposable(),this._data=null,r},m.isDisposer=function(e){return null!=e&&"function"==typeof e.resource&&"function"==typeof e.tryDispose},u(g,m),g.prototype.doDispose=function(e,t){return this.data().call(e,e,t)},v.prototype._resultCancelled=function(){for(var e=this.length,n=0;n0},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 g(e,this,o());throw new l}}},{"./errors":12,"./util":36}],36:[function(e,r,o){"use strict";var i=e("./es5"),a="undefined"==typeof navigator,s={e:{}},l,u="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n?n:void 0!==this?this:null;function c(){try{var e=l;return l=null,e.apply(this,arguments)}catch(e){return s.e=e,s}}function d(e){return l=e,c}var p=function(e,t){var n={}.hasOwnProperty;function r(){for(var r in this.constructor=e,this.constructor$=t,t.prototype)n.call(t.prototype,r)&&"$"!==r.charAt(r.length-1)&&(this[r+"$"]=t.prototype[r])}return r.prototype=t.prototype,e.prototype=new r,e.prototype};function f(e){return null==e||!0===e||!1===e||"string"==typeof e||"number"==typeof e}function h(e){return"function"==typeof e||"object"==typeof e&&null!==e}function m(e){return f(e)?new Error(T(e)):e}function g(e,t){var n,r=e.length,o=new Array(r+1);for(n=0;n1,r=t.length>0&&!(1===t.length&&"constructor"===t[0]),o=E.test(e+"")&&i.names(e).length>0;if(n||r||o)return!0}return!1}catch(e){return!1}}function w(e){function t(){}t.prototype=e;var n=new t;function r(){return typeof n.foo}return r(),r(),e}var C=/^[a-z$_][a-z$_0-9]*$/i;function x(e){return C.test(e)}function k(e,t,n){for(var r=new Array(e),o=0;o10||V[0]>0),q.isNode&&q.toFastProperties(t);try{throw new Error}catch(e){q.lastLineError=e}r.exports=q},{"./es5":13}]},{},[4])(4)},e.exports=o(),"undefined"!=typeof window&&null!==window?window.P=window.Promise:"undefined"!=typeof self&&null!==self&&(self.P=self.Promise)}).call(this,n(64),n(18),n(235).setImmediate)},function(e,t,n){e.exports=function(){"use strict";var e=Array.prototype.slice;function t(e,t){t&&(e.prototype=Object.create(t.prototype)),e.prototype.constructor=e}function n(e){return a(e)?e:K(e)}function r(e){return s(e)?e:Y(e)}function o(e){return l(e)?e:W(e)}function i(e){return a(e)&&!u(e)?e:$(e)}function a(e){return!(!e||!e[d])}function s(e){return!(!e||!e[p])}function l(e){return!(!e||!e[f])}function u(e){return s(e)||l(e)}function c(e){return!(!e||!e[h])}t(r,n),t(o,n),t(i,n),n.isIterable=a,n.isKeyed=s,n.isIndexed=l,n.isAssociative=u,n.isOrdered=c,n.Keyed=r,n.Indexed=o,n.Set=i;var d="@@__IMMUTABLE_ITERABLE__@@",p="@@__IMMUTABLE_KEYED__@@",f="@@__IMMUTABLE_INDEXED__@@",h="@@__IMMUTABLE_ORDERED__@@",m=5,g=1<>>0;if(""+n!==t||4294967295===n)return NaN;t=n}return t<0?x(e)+t:t}function T(){return!0}function R(e,t,n){return(0===e||void 0!==n&&e<=-n)&&(void 0===t||void 0!==n&&t>=n)}function F(e,t){return A(e,t,0)}function D(e,t){return A(e,t,t)}function A(e,t,n){return void 0===e?n:e<0?Math.max(0,t+e):void 0===t?e:Math.min(t,e)}var I=0,N=1,O=2,M="function"==typeof Symbol&&Symbol.iterator,P="@@iterator",L=M||P;function U(e){this.next=e}function B(e,t,n,r){var o=0===e?t:1===e?n:[t,n];return r?r.value=o:r={value:o,done:!1},r}function j(){return{value:void 0,done:!0}}function G(e){return!!z(e)}function q(e){return e&&"function"==typeof e.next}function V(e){var t=z(e);return t&&t.call(e)}function z(e){var t=e&&(M&&e[M]||e[P]);if("function"==typeof t)return t}function H(e){return e&&"number"==typeof e.length}function K(e){return null==e?ie():a(e)?e.toSeq():function(e){var t=le(e)||"object"==typeof e&&new te(e);if(!t)throw new TypeError("Expected Array or iterable object of values, or keyed object: "+e);return t}(e)}function Y(e){return null==e?ie().toKeyedSeq():a(e)?s(e)?e.toSeq():e.fromEntrySeq():ae(e)}function W(e){return null==e?ie():a(e)?s(e)?e.entrySeq():e.toIndexedSeq():se(e)}function $(e){return(null==e?ie():a(e)?s(e)?e.entrySeq():e:se(e)).toSetSeq()}U.prototype.toString=function(){return"[Iterator]"},U.KEYS=I,U.VALUES=N,U.ENTRIES=O,U.prototype.inspect=U.prototype.toSource=function(){return this.toString()},U.prototype[L]=function(){return this},t(K,n),K.of=function(){return K(arguments)},K.prototype.toSeq=function(){return this},K.prototype.toString=function(){return this.__toString("Seq {","}")},K.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},K.prototype.__iterate=function(e,t){return ue(this,e,t,!0)},K.prototype.__iterator=function(e,t){return ce(this,e,t,!0)},t(Y,K),Y.prototype.toKeyedSeq=function(){return this},t(W,K),W.of=function(){return W(arguments)},W.prototype.toIndexedSeq=function(){return this},W.prototype.toString=function(){return this.__toString("Seq [","]")},W.prototype.__iterate=function(e,t){return ue(this,e,t,!1)},W.prototype.__iterator=function(e,t){return ce(this,e,t,!1)},t($,K),$.of=function(){return $(arguments)},$.prototype.toSetSeq=function(){return this},K.isSeq=oe,K.Keyed=Y,K.Set=$,K.Indexed=W;var Q,J,X,Z="@@__IMMUTABLE_SEQ__@@";function ee(e){this._array=e,this.size=e.length}function te(e){var t=Object.keys(e);this._object=e,this._keys=t,this.size=t.length}function ne(e){this._iterable=e,this.size=e.length||e.size}function re(e){this._iterator=e,this._iteratorCache=[]}function oe(e){return!(!e||!e[Z])}function ie(){return Q||(Q=new ee([]))}function ae(e){var t=Array.isArray(e)?new ee(e).fromEntrySeq():q(e)?new re(e).fromEntrySeq():G(e)?new ne(e).fromEntrySeq():"object"==typeof e?new te(e):void 0;if(!t)throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+e);return t}function se(e){var t=le(e);if(!t)throw new TypeError("Expected Array or iterable object of values: "+e);return t}function le(e){return H(e)?new ee(e):q(e)?new re(e):G(e)?new ne(e):void 0}function ue(e,t,n,r){var o=e._cache;if(o){for(var i=o.length-1,a=0;a<=i;a++){var s=o[n?i-a:a];if(!1===t(s[1],r?s[0]:a,e))return a+1}return a}return e.__iterateUncached(t,n)}function ce(e,t,n,r){var o=e._cache;if(o){var i=o.length-1,a=0;return new U(function(){var e=o[n?i-a:a];return a++>i?{value:void 0,done:!0}:B(t,r?e[0]:a-1,e[1])})}return e.__iteratorUncached(t,n)}function de(e,t){return t?function e(t,n,r,o){return Array.isArray(n)?t.call(o,r,W(n).map(function(r,o){return e(t,r,o,n)})):fe(n)?t.call(o,r,Y(n).map(function(r,o){return e(t,r,o,n)})):n}(t,e,"",{"":e}):pe(e)}function pe(e){return Array.isArray(e)?W(e).map(pe).toList():fe(e)?Y(e).map(pe).toMap():e}function fe(e){return e&&(e.constructor===Object||void 0===e.constructor)}function he(e,t){if(e===t||e!=e&&t!=t)return!0;if(!e||!t)return!1;if("function"==typeof e.valueOf&&"function"==typeof t.valueOf){if(e=e.valueOf(),t=t.valueOf(),e===t||e!=e&&t!=t)return!0;if(!e||!t)return!1}return!("function"!=typeof e.equals||"function"!=typeof t.equals||!e.equals(t))}function me(e,t){if(e===t)return!0;if(!a(t)||void 0!==e.size&&void 0!==t.size&&e.size!==t.size||void 0!==e.__hash&&void 0!==t.__hash&&e.__hash!==t.__hash||s(e)!==s(t)||l(e)!==l(t)||c(e)!==c(t))return!1;if(0===e.size&&0===t.size)return!0;var n=!u(e);if(c(e)){var r=e.entries();return t.every(function(e,t){var o=r.next().value;return o&&he(o[1],e)&&(n||he(o[0],t))})&&r.next().done}var o=!1;if(void 0===e.size)if(void 0===t.size)"function"==typeof e.cacheResult&&e.cacheResult();else{o=!0;var i=e;e=t,t=i}var d=!0,p=t.__iterate(function(t,r){if(n?!e.has(t):o?!he(t,e.get(r,v)):!he(e.get(r,v),t))return d=!1,!1});return d&&e.size===p}function ge(e,t){if(!(this instanceof ge))return new ge(e,t);if(this._value=e,this.size=void 0===t?1/0:Math.max(0,t),0===this.size){if(J)return J;J=this}}function _e(e,t){if(!e)throw new Error(t)}function ve(e,t,n){if(!(this instanceof ve))return new ve(e,t,n);if(_e(0!==n,"Cannot step a Range by 0"),e=e||0,void 0===t&&(t=1/0),n=void 0===n?1:Math.abs(n),tr?{value:void 0,done:!0}:B(e,o,n[t?r-o++:o++])})},t(te,Y),te.prototype.get=function(e,t){return void 0===t||this.has(e)?this._object[e]:t},te.prototype.has=function(e){return this._object.hasOwnProperty(e)},te.prototype.__iterate=function(e,t){for(var n=this._object,r=this._keys,o=r.length-1,i=0;i<=o;i++){var a=r[t?o-i:i];if(!1===e(n[a],a,this))return i+1}return i},te.prototype.__iterator=function(e,t){var n=this._object,r=this._keys,o=r.length-1,i=0;return new U(function(){var a=r[t?o-i:i];return i++>o?{value:void 0,done:!0}:B(e,a,n[a])})},te.prototype[h]=!0,t(ne,W),ne.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);var n=this._iterable,r=V(n),o=0;if(q(r))for(var i;!(i=r.next()).done&&!1!==e(i.value,o++,this););return o},ne.prototype.__iteratorUncached=function(e,t){if(t)return this.cacheResult().__iterator(e,t);var n=this._iterable,r=V(n);if(!q(r))return new U(j);var o=0;return new U(function(){var t=r.next();return t.done?t:B(e,o++,t.value)})},t(re,W),re.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);for(var n,r=this._iterator,o=this._iteratorCache,i=0;i=r.length){var t=n.next();if(t.done)return t;r[o]=t.value}return B(e,o,r[o++])})},t(ge,W),ge.prototype.toString=function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},ge.prototype.get=function(e,t){return this.has(e)?this._value:t},ge.prototype.includes=function(e){return he(this._value,e)},ge.prototype.slice=function(e,t){var n=this.size;return R(e,t,n)?this:new ge(this._value,D(t,n)-F(e,n))},ge.prototype.reverse=function(){return this},ge.prototype.indexOf=function(e){return he(this._value,e)?0:-1},ge.prototype.lastIndexOf=function(e){return he(this._value,e)?this.size:-1},ge.prototype.__iterate=function(e,t){for(var n=0;n1?" by "+this._step:"")+" ]"},ve.prototype.get=function(e,t){return this.has(e)?this._start+k(this,e)*this._step:t},ve.prototype.includes=function(e){var t=(e-this._start)/this._step;return t>=0&&t=0&&nn?{value:void 0,done:!0}:B(e,i++,a)})},ve.prototype.equals=function(e){return e instanceof ve?this._start===e._start&&this._end===e._end&&this._step===e._step:me(this,e)},t(ye,n),t(be,ye),t(Ee,ye),t(Se,ye),ye.Keyed=be,ye.Indexed=Ee,ye.Set=Se;var we="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(e,t){var n=65535&(e|=0),r=65535&(t|=0);return n*r+((e>>>16)*r+n*(t>>>16)<<16>>>0)|0};function Ce(e){return e>>>1&1073741824|3221225471&e}function xe(e){if(!1===e||null==e)return 0;if("function"==typeof e.valueOf&&(!1===(e=e.valueOf())||null==e))return 0;if(!0===e)return 1;var t,n,r=typeof e;if("number"===r){var o=0|e;for(o!==e&&(o^=4294967295*e);e>4294967295;)o^=e/=4294967295;return Ce(o)}if("string"===r)return e.length>Ne?(void 0===(n=Pe[t=e])&&(n=ke(t),Me===Oe&&(Me=0,Pe={}),Me++,Pe[t]=n),n):ke(e);if("function"==typeof e.hashCode)return e.hashCode();if("object"===r)return function(e){var t;if(De&&void 0!==(t=Te.get(e)))return t;if(void 0!==(t=e[Ie]))return t;if(!Fe){if(void 0!==(t=e.propertyIsEnumerable&&e.propertyIsEnumerable[Ie]))return t;if(void 0!==(t=function(e){if(e&&e.nodeType>0)switch(e.nodeType){case 1:return e.uniqueID;case 9:return e.documentElement&&e.documentElement.uniqueID}}(e)))return t}if(t=++Ae,1073741824&Ae&&(Ae=0),De)Te.set(e,t);else{if(void 0!==Re&&!1===Re(e))throw new Error("Non-extensible objects are not allowed as keys.");if(Fe)Object.defineProperty(e,Ie,{enumerable:!1,configurable:!1,writable:!1,value:t});else if(void 0!==e.propertyIsEnumerable&&e.propertyIsEnumerable===e.constructor.prototype.propertyIsEnumerable)e.propertyIsEnumerable=function(){return this.constructor.prototype.propertyIsEnumerable.apply(this,arguments)},e.propertyIsEnumerable[Ie]=t;else{if(void 0===e.nodeType)throw new Error("Unable to set a non-enumerable property on object.");e[Ie]=t}}return t}(e);if("function"==typeof e.toString)return ke(e.toString());throw new Error("Value type "+r+" cannot be hashed.")}function ke(e){for(var t=0,n=0;n>>n)&_,s=(0===n?r:r>>>n)&_,l=a===s?[nt(e,t,n+m,r,o)]:(i=new Ye(t,r,o),a>1&1431655765))+(e>>2&858993459))+(e>>4)&252645135,e+=e>>8,127&(e+=e>>16)}function lt(e,t,n,r){var o=r?e:C(e);return o[t]=n,o}qe[Ge]=!0,qe.delete=qe.remove,qe.removeIn=qe.deleteIn,Ve.prototype.get=function(e,t,n,r){for(var o=this.entries,i=0,a=o.length;i=ut)return function(e,t,n,r){e||(e=new w);for(var o=new Ye(e,xe(n),[n,r]),i=0;i>>e)&_),i=this.bitmap;return 0==(i&o)?r:this.nodes[st(i&o-1)].get(e+m,t,n,r)},ze.prototype.update=function(e,t,n,r,o,i,a){void 0===n&&(n=xe(r));var s=(0===t?n:n>>>t)&_,l=1<=ct)return function(e,t,n,r,o){for(var i=0,a=new Array(g),s=0;0!==n;s++,n>>>=1)a[s]=1&n?t[i++]:void 0;return a[r]=o,new He(e,i+1,a)}(e,p,u,s,h);if(c&&!h&&2===p.length&&tt(p[1^d]))return p[1^d];if(c&&h&&1===p.length&&tt(h))return h;var y=e&&e===this.ownerID,b=c?h?u:u^l:u|l,E=c?h?lt(p,d,h,y):function(e,t,n){var r=e.length-1;if(n&&t===r)return e.pop(),e;for(var o=new Array(r),i=0,a=0;a>>e)&_,i=this.nodes[o];return i?i.get(e+m,t,n,r):r},He.prototype.update=function(e,t,n,r,o,i,a){void 0===n&&(n=xe(r));var s=(0===t?n:n>>>t)&_,l=o===v,u=this.nodes,c=u[s];if(l&&!c)return this;var d=et(c,e,t+m,n,r,o,i,a);if(d===c)return this;var p=this.count;if(c){if(!d&&--p0&&r=0&&e=e.size||t<0)return e.withMutations(function(e){t<0?kt(e,t).set(0,n):kt(e,0,t+1).set(t,n)});t+=e._origin;var r=e._tail,o=e._root,i=E(b);return t>=Rt(e._capacity)?r=wt(r,e.__ownerID,0,t,n,i):o=wt(o,e.__ownerID,e._level,t,n,i),i.value?e.__ownerID?(e._root=o,e._tail=r,e.__hash=void 0,e.__altered=!0,e):Et(e._origin,e._capacity,e._level,o,r):e}(this,e,t)},pt.prototype.remove=function(e){return this.has(e)?0===e?this.shift():e===this.size-1?this.pop():this.splice(e,1):this},pt.prototype.insert=function(e,t){return this.splice(e,0,t)},pt.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=m,this._root=this._tail=null,this.__hash=void 0,this.__altered=!0,this):St()},pt.prototype.push=function(){var e=arguments,t=this.size;return this.withMutations(function(n){kt(n,0,t+e.length);for(var r=0;r>>t&_;if(r>=this.array.length)return new gt([],e);var o,i=0===r;if(t>0){var a=this.array[r];if((o=a&&a.removeBefore(e,t-m,n))===a&&i)return this}if(i&&!o)return this;var s=Ct(this,e);if(!i)for(var l=0;l>>t&_;if(o>=this.array.length)return this;if(t>0){var i=this.array[o];if((r=i&&i.removeAfter(e,t-m,n))===i&&o===this.array.length-1)return this}var a=Ct(this,e);return a.array.splice(o+1),r&&(a.array[o]=r),a};var _t,vt,yt={};function bt(e,t){var n=e._origin,r=e._capacity,o=Rt(r),i=e._tail;return a(e._root,e._level,0);function a(e,s,l){return 0===s?function(e,a){var s=a===o?i&&i.array:e&&e.array,l=a>n?0:n-a,u=r-a;return u>g&&(u=g),function(){if(l===u)return yt;var e=t?--u:l++;return s&&s[e]}}(e,l):function(e,o,i){var s,l=e&&e.array,u=i>n?0:n-i>>o,c=1+(r-i>>o);return c>g&&(c=g),function(){for(;;){if(s){var e=s();if(e!==yt)return e;s=null}if(u===c)return yt;var n=t?--c:u++;s=a(l&&l[n],o-m,i+(n<>>n&_,l=e&&s0){var u=e&&e.array[s],c=wt(u,t,n-m,r,o,i);return c===u?e:((a=Ct(e,t)).array[s]=c,a)}return l&&e.array[s]===o?e:(S(i),a=Ct(e,t),void 0===o&&s===a.array.length-1?a.array.pop():a.array[s]=o,a)}function Ct(e,t){return t&&e&&t===e.ownerID?e:new gt(e?e.array.slice():[],t)}function xt(e,t){if(t>=Rt(e._capacity))return e._tail;if(t<1<0;)n=n.array[t>>>r&_],r-=m;return n}}function kt(e,t,n){void 0!==t&&(t|=0),void 0!==n&&(n|=0);var r=e.__ownerID||new w,o=e._origin,i=e._capacity,a=o+t,s=void 0===n?i:n<0?i+n:o+n;if(a===o&&s===i)return e;if(a>=s)return e.clear();for(var l=e._level,u=e._root,c=0;a+c<0;)u=new gt(u&&u.array.length?[void 0,u]:[],r),c+=1<<(l+=m);c&&(a+=c,o+=c,s+=c,i+=c);for(var d=Rt(i),p=Rt(s);p>=1<d?new gt([],r):f;if(f&&p>d&&am;v-=m){var y=d>>>v&_;g=g.array[y]=Ct(g.array[y],r)}g.array[d>>>m&_]=f}if(s=p)a-=p,s-=p,l=m,u=null,h=h&&h.removeBefore(r,0,a);else if(a>o||p>>l&_;if(b!==p>>>l&_)break;b&&(c+=(1<o&&(u=u.removeBefore(r,l,a-c)),u&&pi&&(i=u.size),a(l)||(u=u.map(function(e){return de(e)})),r.push(u)}return i>e.size&&(e=e.setSize(i)),at(e,t,r)}function Rt(e){return e>>m<=g&&a.size>=2*i.size?(o=a.filter(function(e,t){return void 0!==e&&s!==t}),r=o.toKeyedSeq().map(function(e){return e[0]}).flip().toMap(),e.__ownerID&&(r.__ownerID=o.__ownerID=e.__ownerID)):(r=i.remove(t),o=s===a.size-1?a.pop():a.set(s,void 0))}else if(l){if(n===a.get(s)[1])return e;r=i,o=a.set(s,[t,n])}else r=i.set(t,a.size),o=a.set(a.size,[t,n]);return e.__ownerID?(e.size=r.size,e._map=r,e._list=o,e.__hash=void 0,e):At(r,o)}function Ot(e,t){this._iter=e,this._useKeys=t,this.size=e.size}function Mt(e){this._iter=e,this.size=e.size}function Pt(e){this._iter=e,this.size=e.size}function Lt(e){this._iter=e,this.size=e.size}function Ut(e){var t=Zt(e);return t._iter=e,t.size=e.size,t.flip=function(){return e},t.reverse=function(){var t=e.reverse.apply(this);return t.flip=function(){return e.reverse()},t},t.has=function(t){return e.includes(t)},t.includes=function(t){return e.has(t)},t.cacheResult=en,t.__iterateUncached=function(t,n){var r=this;return e.__iterate(function(e,n){return!1!==t(n,e,r)},n)},t.__iteratorUncached=function(t,n){if(t===O){var r=e.__iterator(t,n);return new U(function(){var e=r.next();if(!e.done){var t=e.value[0];e.value[0]=e.value[1],e.value[1]=t}return e})}return e.__iterator(t===N?I:N,n)},t}function Bt(e,t,n){var r=Zt(e);return r.size=e.size,r.has=function(t){return e.has(t)},r.get=function(r,o){var i=e.get(r,v);return i===v?o:t.call(n,i,r,e)},r.__iterateUncached=function(r,o){var i=this;return e.__iterate(function(e,o,a){return!1!==r(t.call(n,e,o,a),o,i)},o)},r.__iteratorUncached=function(r,o){var i=e.__iterator(O,o);return new U(function(){var o=i.next();if(o.done)return o;var a=o.value,s=a[0];return B(r,s,t.call(n,a[1],s,e),o)})},r}function jt(e,t){var n=Zt(e);return n._iter=e,n.size=e.size,n.reverse=function(){return e},e.flip&&(n.flip=function(){var t=Ut(e);return t.reverse=function(){return e.flip()},t}),n.get=function(n,r){return e.get(t?n:-1-n,r)},n.has=function(n){return e.has(t?n:-1-n)},n.includes=function(t){return e.includes(t)},n.cacheResult=en,n.__iterate=function(t,n){var r=this;return e.__iterate(function(e,n){return t(e,n,r)},!n)},n.__iterator=function(t,n){return e.__iterator(t,!n)},n}function Gt(e,t,n,r){var o=Zt(e);return r&&(o.has=function(r){var o=e.get(r,v);return o!==v&&!!t.call(n,o,r,e)},o.get=function(r,o){var i=e.get(r,v);return i!==v&&t.call(n,i,r,e)?i:o}),o.__iterateUncached=function(o,i){var a=this,s=0;return e.__iterate(function(e,i,l){if(t.call(n,e,i,l))return s++,o(e,r?i:s-1,a)},i),s},o.__iteratorUncached=function(o,i){var a=e.__iterator(O,i),s=0;return new U(function(){for(;;){var i=a.next();if(i.done)return i;var l=i.value,u=l[0],c=l[1];if(t.call(n,c,u,e))return B(o,r?u:s++,c,i)}})},o}function qt(e,t,n,r){var o=e.size;if(void 0!==t&&(t|=0),void 0!==n&&(n|=0),R(t,n,o))return e;var i=F(t,o),a=D(n,o);if(i!=i||a!=a)return qt(e.toSeq().cacheResult(),t,n,r);var s,l=a-i;l==l&&(s=l<0?0:l);var u=Zt(e);return u.size=0===s?s:e.size&&s||void 0,!r&&oe(e)&&s>=0&&(u.get=function(t,n){return(t=k(this,t))>=0&&ts)return{value:void 0,done:!0};var e=o.next();return r||t===N?e:B(t,l-1,t===I?void 0:e.value[1],e)})},u}function Vt(e,t,n,r){var o=Zt(e);return o.__iterateUncached=function(o,i){var a=this;if(i)return this.cacheResult().__iterate(o,i);var s=!0,l=0;return e.__iterate(function(e,i,u){if(!s||!(s=t.call(n,e,i,u)))return l++,o(e,r?i:l-1,a)}),l},o.__iteratorUncached=function(o,i){var a=this;if(i)return this.cacheResult().__iterator(o,i);var s=e.__iterator(O,i),l=!0,u=0;return new U(function(){var e,i,c;do{if((e=s.next()).done)return r||o===N?e:B(o,u++,o===I?void 0:e.value[1],e);var d=e.value;i=d[0],c=d[1],l&&(l=t.call(n,c,i,a))}while(l);return o===O?e:B(o,i,c,e)})},o}function zt(e,t,n){var r=Zt(e);return r.__iterateUncached=function(r,o){var i=0,s=!1;return function e(l,u){var c=this;l.__iterate(function(o,l){return(!t||u0}function Wt(e,t,r){var o=Zt(e);return o.size=new ee(r).map(function(e){return e.size}).min(),o.__iterate=function(e,t){for(var n,r=this.__iterator(N,t),o=0;!(n=r.next()).done&&!1!==e(n.value,o++,this););return o},o.__iteratorUncached=function(e,o){var i=r.map(function(e){return e=n(e),V(o?e.reverse():e)}),a=0,s=!1;return new U(function(){var n;return s||(n=i.map(function(e){return e.next()}),s=n.some(function(e){return e.done})),s?{value:void 0,done:!0}:B(e,a++,t.apply(null,n.map(function(e){return e.value})))})},o}function $t(e,t){return oe(e)?t:e.constructor(t)}function Qt(e){if(e!==Object(e))throw new TypeError("Expected [K, V] tuple: "+e)}function Jt(e){return Le(e.size),x(e)}function Xt(e){return s(e)?r:l(e)?o:i}function Zt(e){return Object.create((s(e)?Y:l(e)?W:$).prototype)}function en(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):K.prototype.cacheResult.call(this)}function tn(e,t){return e>t?1:e=0;n--)t={value:arguments[n],next:t};return this.__ownerID?(this.size=e,this._head=t,this.__hash=void 0,this.__altered=!0,this):Tn(e,t)},Sn.prototype.pushAll=function(e){if(0===(e=o(e)).size)return this;Le(e.size);var t=this.size,n=this._head;return e.reverse().forEach(function(e){t++,n={value:e,next:n}}),this.__ownerID?(this.size=t,this._head=n,this.__hash=void 0,this.__altered=!0,this):Tn(t,n)},Sn.prototype.pop=function(){return this.slice(1)},Sn.prototype.unshift=function(){return this.push.apply(this,arguments)},Sn.prototype.unshiftAll=function(e){return this.pushAll(e)},Sn.prototype.shift=function(){return this.pop.apply(this,arguments)},Sn.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):Rn()},Sn.prototype.slice=function(e,t){if(R(e,t,this.size))return this;var n=F(e,this.size),r=D(t,this.size);if(r!==this.size)return Ee.prototype.slice.call(this,e,t);for(var o=this.size-n,i=this._head;n--;)i=i.next;return this.__ownerID?(this.size=o,this._head=i,this.__hash=void 0,this.__altered=!0,this):Tn(o,i)},Sn.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?Tn(this.size,this._head,e,this.__hash):(this.__ownerID=e,this.__altered=!1,this)},Sn.prototype.__iterate=function(e,t){if(t)return this.reverse().__iterate(e);for(var n=0,r=this._head;r&&!1!==e(r.value,n++,this);)r=r.next;return n},Sn.prototype.__iterator=function(e,t){if(t)return this.reverse().__iterator(e);var n=0,r=this._head;return new U(function(){if(r){var t=r.value;return r=r.next,B(e,n++,t)}return{value:void 0,done:!0}})},Sn.isStack=wn;var Cn,xn="@@__IMMUTABLE_STACK__@@",kn=Sn.prototype;function Tn(e,t,n,r){var o=Object.create(kn);return o.size=e,o._head=t,o.__ownerID=n,o.__hash=r,o.__altered=!1,o}function Rn(){return Cn||(Cn=Tn(0))}function Fn(e,t){var n=function(n){e.prototype[n]=t[n]};return Object.keys(t).forEach(n),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach(n),e}kn[xn]=!0,kn.withMutations=qe.withMutations,kn.asMutable=qe.asMutable,kn.asImmutable=qe.asImmutable,kn.wasAltered=qe.wasAltered,n.Iterator=U,Fn(n,{toArray:function(){Le(this.size);var e=new Array(this.size||0);return this.valueSeq().__iterate(function(t,n){e[n]=t}),e},toIndexedSeq:function(){return new Mt(this)},toJS:function(){return this.toSeq().map(function(e){return e&&"function"==typeof e.toJS?e.toJS():e}).__toJS()},toJSON:function(){return this.toSeq().map(function(e){return e&&"function"==typeof e.toJSON?e.toJSON():e}).__toJS()},toKeyedSeq:function(){return new Ot(this,!0)},toMap:function(){return Ue(this.toKeyedSeq())},toObject:function(){Le(this.size);var e={};return this.__iterate(function(t,n){e[n]=t}),e},toOrderedMap:function(){return Ft(this.toKeyedSeq())},toOrderedSet:function(){return gn(s(this)?this.valueSeq():this)},toSet:function(){return ln(s(this)?this.valueSeq():this)},toSetSeq:function(){return new Pt(this)},toSeq:function(){return l(this)?this.toIndexedSeq():s(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return Sn(s(this)?this.valueSeq():this)},toList:function(){return pt(s(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(e,t){return 0===this.size?e+t:e+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+t},concat:function(){var t=e.call(arguments,0);return $t(this,function(e,t){var n=s(e),o=[e].concat(t).map(function(e){return a(e)?n&&(e=r(e)):e=n?ae(e):se(Array.isArray(e)?e:[e]),e}).filter(function(e){return 0!==e.size});if(0===o.length)return e;if(1===o.length){var i=o[0];if(i===e||n&&s(i)||l(e)&&l(i))return i}var u=new ee(o);return n?u=u.toKeyedSeq():l(e)||(u=u.toSetSeq()),(u=u.flatten(!0)).size=o.reduce(function(e,t){if(void 0!==e){var n=t.size;if(void 0!==n)return e+n}},0),u}(this,t))},includes:function(e){return this.some(function(t){return he(t,e)})},entries:function(){return this.__iterator(O)},every:function(e,t){Le(this.size);var n=!0;return this.__iterate(function(r,o,i){if(!e.call(t,r,o,i))return n=!1,!1}),n},filter:function(e,t){return $t(this,Gt(this,e,t,!0))},find:function(e,t,n){var r=this.findEntry(e,t);return r?r[1]:n},findEntry:function(e,t){var n;return this.__iterate(function(r,o,i){if(e.call(t,r,o,i))return n=[o,r],!1}),n},findLastEntry:function(e,t){return this.toSeq().reverse().findEntry(e,t)},forEach:function(e,t){return Le(this.size),this.__iterate(t?e.bind(t):e)},join:function(e){Le(this.size),e=void 0!==e?""+e:",";var t="",n=!0;return this.__iterate(function(r){n?n=!1:t+=e,t+=null!=r?r.toString():""}),t},keys:function(){return this.__iterator(I)},map:function(e,t){return $t(this,Bt(this,e,t))},reduce:function(e,t,n){var r,o;return Le(this.size),arguments.length<2?o=!0:r=t,this.__iterate(function(t,i,a){o?(o=!1,r=t):r=e.call(n,r,t,i,a)}),r},reduceRight:function(e,t,n){var r=this.toKeyedSeq().reverse();return r.reduce.apply(r,arguments)},reverse:function(){return $t(this,jt(this,!0))},slice:function(e,t){return $t(this,qt(this,e,t,!0))},some:function(e,t){return!this.every(On(e),t)},sort:function(e){return $t(this,Ht(this,e))},values:function(){return this.__iterator(N)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return void 0!==this.size?0===this.size:!this.some(function(){return!0})},count:function(e,t){return x(e?this.toSeq().filter(e,t):this)},countBy:function(e,t){return function(e,t,n){var r=Ue().asMutable();return e.__iterate(function(o,i){r.update(t.call(n,o,i,e),0,function(e){return e+1})}),r.asImmutable()}(this,e,t)},equals:function(e){return me(this,e)},entrySeq:function(){var e=this;if(e._cache)return new ee(e._cache);var t=e.toSeq().map(Nn).toIndexedSeq();return t.fromEntrySeq=function(){return e.toSeq()},t},filterNot:function(e,t){return this.filter(On(e),t)},findLast:function(e,t,n){return this.toKeyedSeq().reverse().find(e,t,n)},first:function(){return this.find(T)},flatMap:function(e,t){return $t(this,function(e,t,n){var r=Xt(e);return e.toSeq().map(function(o,i){return r(t.call(n,o,i,e))}).flatten(!0)}(this,e,t))},flatten:function(e){return $t(this,zt(this,e,!0))},fromEntrySeq:function(){return new Lt(this)},get:function(e,t){return this.find(function(t,n){return he(n,e)},void 0,t)},getIn:function(e,t){for(var n,r=this,o=nn(e);!(n=o.next()).done;){var i=n.value;if((r=r&&r.get?r.get(i,v):v)===v)return t}return r},groupBy:function(e,t){return function(e,t,n){var r=s(e),o=(c(e)?Ft():Ue()).asMutable();e.__iterate(function(i,a){o.update(t.call(n,i,a,e),function(e){return(e=e||[]).push(r?[a,i]:i),e})});var i=Xt(e);return o.map(function(t){return $t(e,i(t))})}(this,e,t)},has:function(e){return this.get(e,v)!==v},hasIn:function(e){return this.getIn(e,v)!==v},isSubset:function(e){return e="function"==typeof e.includes?e:n(e),this.every(function(t){return e.includes(t)})},isSuperset:function(e){return(e="function"==typeof e.isSubset?e:n(e)).isSubset(this)},keySeq:function(){return this.toSeq().map(In).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},max:function(e){return Kt(this,e)},maxBy:function(e,t){return Kt(this,t,e)},min:function(e){return Kt(this,e?Mn(e):Un)},minBy:function(e,t){return Kt(this,t?Mn(t):Un,e)},rest:function(){return this.slice(1)},skip:function(e){return this.slice(Math.max(0,e))},skipLast:function(e){return $t(this,this.toSeq().reverse().skip(e).reverse())},skipWhile:function(e,t){return $t(this,Vt(this,e,t,!0))},skipUntil:function(e,t){return this.skipWhile(On(e),t)},sortBy:function(e,t){return $t(this,Ht(this,t,e))},take:function(e){return this.slice(0,Math.max(0,e))},takeLast:function(e){return $t(this,this.toSeq().reverse().take(e).reverse())},takeWhile:function(e,t){return $t(this,function(e,t,n){var r=Zt(e);return r.__iterateUncached=function(r,o){var i=this;if(o)return this.cacheResult().__iterate(r,o);var a=0;return e.__iterate(function(e,o,s){return t.call(n,e,o,s)&&++a&&r(e,o,i)}),a},r.__iteratorUncached=function(r,o){var i=this;if(o)return this.cacheResult().__iterator(r,o);var a=e.__iterator(O,o),s=!0;return new U(function(){if(!s)return{value:void 0,done:!0};var e=a.next();if(e.done)return e;var o=e.value,l=o[0],u=o[1];return t.call(n,u,l,i)?r===O?e:B(r,l,u,e):(s=!1,{value:void 0,done:!0})})},r}(this,e,t))},takeUntil:function(e,t){return this.takeWhile(On(e),t)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=function(e){if(e.size===1/0)return 0;var t=c(e),n=s(e),r=t?1:0;return function(e,t){return t=we(t,3432918353),t=we(t<<15|t>>>-15,461845907),t=we(t<<13|t>>>-13,5),t=we((t=(t+3864292196|0)^e)^t>>>16,2246822507),t=Ce((t=we(t^t>>>13,3266489909))^t>>>16)}(e.__iterate(n?t?function(e,t){r=31*r+Bn(xe(e),xe(t))|0}:function(e,t){r=r+Bn(xe(e),xe(t))|0}:t?function(e){r=31*r+xe(e)|0}:function(e){r=r+xe(e)|0}),r)}(this))}});var Dn=n.prototype;Dn[d]=!0,Dn[L]=Dn.values,Dn.__toJS=Dn.toArray,Dn.__toStringMapper=Pn,Dn.inspect=Dn.toSource=function(){return this.toString()},Dn.chain=Dn.flatMap,Dn.contains=Dn.includes,function(){try{Object.defineProperty(Dn,"length",{get:function(){if(!n.noLengthWarning){var e;try{throw new Error}catch(t){e=t.stack}if(-1===e.indexOf("_wrapObject"))return console&&console.warn&&console.warn("iterable.length has been deprecated, use iterable.size or iterable.count(). This warning will become a silent error in a future version. "+e),this.size}}})}catch(e){}}(),Fn(r,{flip:function(){return $t(this,Ut(this))},findKey:function(e,t){var n=this.findEntry(e,t);return n&&n[0]},findLastKey:function(e,t){return this.toSeq().reverse().findKey(e,t)},keyOf:function(e){return this.findKey(function(t){return he(t,e)})},lastKeyOf:function(e){return this.findLastKey(function(t){return he(t,e)})},mapEntries:function(e,t){var n=this,r=0;return $t(this,this.toSeq().map(function(o,i){return e.call(t,[i,o],r++,n)}).fromEntrySeq())},mapKeys:function(e,t){var n=this;return $t(this,this.toSeq().flip().map(function(r,o){return e.call(t,r,o,n)}).flip())}});var An=r.prototype;function In(e,t){return t}function Nn(e,t){return[t,e]}function On(e){return function(){return!e.apply(this,arguments)}}function Mn(e){return function(){return-e.apply(this,arguments)}}function Pn(e){return"string"==typeof e?JSON.stringify(e):e}function Ln(){return C(arguments)}function Un(e,t){return et?-1:0}function Bn(e,t){return e^t+2654435769+(e<<6)+(e>>2)|0}return An[p]=!0,An[L]=Dn.entries,An.__toJS=Dn.toObject,An.__toStringMapper=function(e,t){return JSON.stringify(t)+": "+Pn(e)},Fn(o,{toKeyedSeq:function(){return new Ot(this,!1)},filter:function(e,t){return $t(this,Gt(this,e,t,!1))},findIndex:function(e,t){var n=this.findEntry(e,t);return n?n[0]:-1},indexOf:function(e){var t=this.toKeyedSeq().keyOf(e);return void 0===t?-1:t},lastIndexOf:function(e){var t=this.toKeyedSeq().reverse().keyOf(e);return void 0===t?-1:t},reverse:function(){return $t(this,jt(this,!1))},slice:function(e,t){return $t(this,qt(this,e,t,!1))},splice:function(e,t){var n=arguments.length;if(t=Math.max(0|t,0),0===n||2===n&&!t)return this;e=F(e,e<0?this.count():this.size);var r=this.slice(0,e);return $t(this,1===n?r:r.concat(C(arguments,2),this.slice(e+t)))},findLastIndex:function(e,t){var n=this.toKeyedSeq().findLastKey(e,t);return void 0===n?-1:n},first:function(){return this.get(0)},flatten:function(e){return $t(this,zt(this,e,!1))},get:function(e,t){return(e=k(this,e))<0||this.size===1/0||void 0!==this.size&&e>this.size?t:this.find(function(t,n){return n===e},void 0,t)},has:function(e){return(e=k(this,e))>=0&&(void 0!==this.size?this.size===1/0||e0}},{key:"getOrCreateContainer",value:function(){var e=document.getElementById("mx_Dialog_Container");return e||((e=document.createElement("div")).id="mx_Dialog_Container",document.body.appendChild(e)),e}},{key:"getOrCreateStaticContainer",value:function(){var e=document.getElementById("mx_Dialog_StaticContainer");return e||((e=document.createElement("div")).id="mx_Dialog_StaticContainer",document.body.appendChild(e)),e}},{key:"createTrackedDialog",value:function(e,t){c.default.trackEvent("Modal",e,t);for(var n=arguments.length,r=Array(n>2?n-2:0),o=2;o1?t-1:0),r=1;r2?n-2:0),o=2;o=0&&a._modals.splice(o,1),a._priorityModal===s&&(a._priorityModal=null,a._modals=[]),a._staticModal===s&&(a._staticModal=null,a._modals=[]),a._reRender()},u=this._counter++;return s.elem=m.createElement(_,(0,i.default)({key:u,prom:e},t,{onFinished:l})),s.onFinished=t?t.onFinished:null,s.className=n,r?this._priorityModal=s:o?this._staticModal=s:this._modals.unshift(s),this._reRender(),{close:l}}},{key:"closeAll",value:function(){var e=[].concat((0,o.default)(this._modals),[this._priorityModal]);this._modals=[],this._priorityModal=null,this._staticModal&&0===e.length&&(e.push(this._staticModal),this._staticModal=null);for(var t=0;t")),e._watchers[a]=s,C.watchSetting(t,n,s),a}},{key:"unwatchSetting",value:function(t){e._watchers[t]&&(C.unwatchSetting(e._watchers[t]),delete e._watchers[t])}},{key:"monitorSetting",value:function(t,n){var r=this;this._monitors[t]||(this._monitors[t]={});var o=function(){r._monitors[t][n]=e.watchSetting(t,n,function(e,t,n,r,o){y.default.dispatch({action:"setting_updated",settingName:e,roomId:t,level:n,newValueAtLevel:r,newValue:o})})};if((0,s.default)(this._monitors[t]).find(function(e){return e===n||null===e})){if(null===n){var i=!0,l=!1,u=void 0;try{for(var c,d=(0,a.default)((0,s.default)(this._monitors[t]));!(i=(c=d.next()).done);i=!0){var p=c.value;e.unwatchSetting(this._monitors[t][p])}}catch(e){l=!0,u=e}finally{try{!i&&d.return&&d.return()}finally{if(l)throw u}}this._monitors[t]={},o()}}else o()}},{key:"getDisplayName",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";if(!b.SETTINGS[e]||!b.SETTINGS[e].displayName)return null;var n=b.SETTINGS[e].displayName;return n instanceof Object&&(n=n[t]?n[t]:n.default),(0,_._t)(n)}},{key:"getLabsFeatures",value:function(){var t=(0,s.default)(b.SETTINGS).filter(function(t){return e.isFeature(t)});return v.default.get().enableLabs?t:t.filter(function(t){return"labs"===e._getFeatureState(t)})}},{key:"isFeature",value:function(e){return!!b.SETTINGS[e]&&b.SETTINGS[e].isFeature}},{key:"isFeatureEnabled",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!e.isFeature(t))throw new Error("Setting "+t+" is not a feature");return e.getValue(t,n)}},{key:"setFeatureEnabled",value:function(t,n){if(!b.SETTINGS[t])throw new Error("Setting '"+t+"' does not appear to be a setting.");if(!e.isFeature(t))throw new Error("Setting "+t+" is not a feature");return e.setValue(t,null,"device",n)}},{key:"getValue",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!b.SETTINGS[t])throw new Error("Setting '"+t+"' does not appear to be a setting.");var o=b.SETTINGS[t],i=o.supportedLevelsAreOrdered?o.supportedLevels:G;return e.getValueAt(i[0],t,n,!1,r)}},{key:"getValueAt",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],a=b.SETTINGS[n];if(!a)throw new Error("Setting '"+n+"' does not appear to be a setting.");var s=a.supportedLevelsAreOrdered?a.supportedLevels:G;s.includes("default")||s.push("default");var l=s.indexOf(t);if(-1===l)throw new Error("Level "+t+" is not prioritized");if(e.isFeature(n)){var u=e._getFeatureState(n);if("enable"===u)return!0;if("disable"===u)return!1}var c=e._getHandlers(n);if(a.invertedSettingName&&(n=a.invertedSettingName),o){var d=c[t];if(!d)return e._getFinalValue(a,t,r,null,null);var p=d.getValue(n,r);return e._getFinalValue(a,t,r,p,t)}for(var f=l;f")),console.log("--- default level order: "+(0,r.default)(G)),console.log("--- registered handlers: "+(0,r.default)((0,s.default)(O)));var i=function(t){var o=!0,i=!1,l=void 0;try{for(var u,c=(0,a.default)((0,s.default)(O));!(o=(u=c.next()).done);o=!0){var d=u.value,p=O[d];try{var f=p.getValue(t,n);console.log("--- "+d+"@"+(n||"")+" = "+(0,r.default)(f))}catch(e){console.log("--- "+p+"@"+(n||"")+" THREW ERROR: "+e.message),console.error(e)}if(n)try{var h=p.getValue(t,null);console.log("--- "+d+"@ = "+(0,r.default)(h))}catch(e){console.log("--- "+p+"@ THREW ERROR: "+e.message),console.error(e)}}}catch(e){i=!0,l=e}finally{try{!o&&c.return&&c.return()}finally{if(i)throw l}}console.log("--- calculating as returned by SettingsStore"),console.log("--- these might not match if the setting uses a controller - be warned!");try{var m=e.getValue(t,n);console.log("--- SettingsStore#generic@"+(n||"")+" = "+(0,r.default)(m))}catch(e){console.log("--- SettingsStore#generic@"+(n||"")+" THREW ERROR: "+e.message),console.error(e)}if(n)try{var g=e.getValue(t,null);console.log("--- SettingsStore#generic@ = "+(0,r.default)(g))}catch(e){console.log("--- SettingsStore#generic@$ THREW ERROR: "+e.message),console.error(e)}var _=!0,v=!1,y=void 0;try{for(var b,E=(0,a.default)(G);!(_=(b=E.next()).done);_=!0){var S=b.value;try{var w=e.getValueAt(S,t,n);console.log("--- SettingsStore#"+S+"@"+(n||"")+" = "+(0,r.default)(w))}catch(e){console.log("--- SettingsStore#"+S+"@"+(n||"")+" THREW ERROR: "+e.message),console.error(e)}if(n)try{var C=e.getValueAt(S,t,null);console.log("--- SettingsStore#"+S+"@ = "+(0,r.default)(C))}catch(e){console.log("--- SettingsStore#"+S+"@$ THREW ERROR: "+e.message),console.error(e)}}}catch(e){v=!0,y=e}finally{try{!_&&E.return&&E.return()}finally{if(v)throw y}}};i(t),o.invertedSettingName&&(console.log("--- TESTING INVERTED SETTING NAME"),console.log("--- inverted: "+o.invertedSettingName),i(o.invertedSettingName)),console.log("--- END DEBUG")}},{key:"_getHandler",value:function(t,n){var r=e._getHandlers(t);return r[n]?r[n]:null}},{key:"_getHandlers",value:function(e){if(!b.SETTINGS[e])return{};var t={},n=!0,r=!1,o=void 0;try{for(var i,s=(0,a.default)(b.SETTINGS[e].supportedLevels);!(n=(i=s.next()).done);n=!0){var l=i.value;if(!O[l])throw new Error("Unexpected level "+l);t[l]=O[l]}}catch(e){r=!0,o=e}finally{try{!n&&s.return&&s.return()}finally{if(r)throw o}}return t.default||(t.default=O.default),t}},{key:"_getFeatureState",value:function(e){var t=v.default.get().features,n=v.default.get().enableLabs?"labs":"disable";t&&void 0!==t[e]&&(n=t[e]);return["enable","disable","labs"].includes(n)||(console.warn("Feature state '"+n+"' is invalid for "+e),n="disable"),n}}]),e}();q._watchers={},q._monitors={},t.default=q,e.mxSettingsStore=q}).call(this,n(18))},function(e,t){var n=e.exports={version:"2.6.5"};"number"==typeof __e&&(__e=n)},function(e,t,n){var r; /*! Copyright (c) 2017 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ /*! Copyright (c) 2017 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ !function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n},k=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},T=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),R=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t0&&void 0!==arguments[0]?arguments[0]:{};if(i.Map.isMap(t))return t;if(o()(t))return e.fromJSON(t);throw new Error("`Data.create` only accepts objects or maps, but you passed it: "+t)}},{key:"fromJSON",value:function(e){return new i.Map(e)}}]),e}();F.fromJS=F.fromJSON;var D={data:void 0,key:void 0,nodes:void 0},A=function(e){function t(){return E(this,t),k(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return C(t,e),S(t,[{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={object:this.object,data:this.data.toJSON(),nodes:this.nodes.toArray().map(function(t){return t.toJSON(e)})};return e.preserveKeys&&(t.key=this.key),t}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isDocument(e))return e;if((i.List.isList(e)||Array.isArray(e))&&(e={nodes:e}),o()(e))return t.fromJSON(e);throw new Error("`Document.create` only accepts objects, arrays, lists or documents, but you passed it: "+e)}},{key:"fromJSON",value:function(e){if(t.isDocument(e))return e;var n=e.data,r=void 0===n?{}:n,o=e.key,a=void 0===o?y.create():o,s=e.nodes,l=void 0===s?[]:s;return new t({key:a,data:new i.Map(r),nodes:W.createList(l)})}}]),t}(Object(i.Record)(D)),I={data:void 0,key:void 0,nodes:void 0,type:void 0},N=function(e){function t(){return E(this,t),k(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return C(t,e),S(t,[{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={object:this.object,type:this.type,data:this.data.toJSON(),nodes:this.nodes.toArray().map(function(t){return t.toJSON(e)})};return e.preserveKeys&&(t.key=this.key),t}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isInline(e))return e;if("string"==typeof e&&(e={type:e}),o()(e))return t.fromJSON(e);throw new Error("`Inline.create` only accepts objects, strings or inlines, but you passed it: "+e)}},{key:"createList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(i.List.isList(e)||Array.isArray(e))return new i.List(e.map(t.create));throw new Error("`Inline.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"fromJSON",value:function(e){if(t.isInline(e))return e;var n=e.data,r=void 0===n?{}:n,o=e.key,a=void 0===o?y.create():o,s=e.nodes,l=void 0===s?[]:s,u=e.type;if("string"!=typeof u)throw new Error("`Inline.fromJS` requires a `type` string.");return new t({key:a,type:u,data:new i.Map(r),nodes:W.createList(l)})}},{key:"isInlineList",value:function(e){return i.List.isList(e)&&e.every(function(e){return t.isInline(e)})}}]),t}(Object(i.Record)(I)),O={data:void 0,type:void 0},M=function(e){function t(){return E(this,t),k(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return C(t,e),S(t,[{key:"toJSON",value:function(){return{object:this.object,type:this.type,data:this.data.toJSON()}}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isMark(e))return e;if("string"==typeof e&&(e={type:e}),o()(e))return t.fromJSON(e);throw new Error("`Mark.create` only accepts objects, strings or marks, but you passed it: "+e)}},{key:"createSet",value:function(e){if(i.Set.isSet(e)||Array.isArray(e))return new i.Set(e.map(t.create));if(null==e)return Object(i.Set)();throw new Error("`Mark.createSet` only accepts sets, arrays or null, but you passed it: "+e)}},{key:"createProperties",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isMark(e))return{data:e.data,type:e.type};if("string"==typeof e)return{type:e};if(o()(e)){var n={};return"type"in e&&(n.type=e.type),"data"in e&&(n.data=F.create(e.data)),n}throw new Error("`Mark.createProperties` only accepts objects, strings or marks, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var n=e.data,r=void 0===n?{}:n,o=e.type;if("string"!=typeof o)throw new Error("`Mark.fromJS` requires a `type` string.");return new t({type:o,data:new i.Map(r)})}},{key:"isMarkSet",value:function(e){return i.Set.isSet(e)&&e.every(function(e){return t.isMark(e)})}}]),t}(Object(i.Record)(O)),P={marks:void 0,text:void 0},L=function(e){function t(){return E(this,t),k(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return C(t,e),S(t,[{key:"updateMark",value:function(e,t){var n=this.marks;if(t.equals(e))return this;if(!n.has(e))return this;var r=n.withMutations(function(n){n.remove(e).add(t)});return this.set("marks",r)}},{key:"addMark",value:function(e){var t=this.marks;return this.set("marks",t.add(e))}},{key:"addMarks",value:function(e){var t=this.marks;return this.set("marks",t.union(e))}},{key:"removeMark",value:function(e){var t=this.marks;return this.set("marks",t.remove(e))}},{key:"toJSON",value:function(){return{object:this.object,text:this.text,marks:this.marks.toArray().map(function(e){return e.toJSON()})}}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isLeaf(e))return e;if("string"==typeof e&&(e={text:e}),o()(e))return t.fromJSON(e);throw new Error("`Leaf.create` only accepts objects, strings or leaves, but you passed it: "+e)}},{key:"createLeaves",value:function(e){if(e.size<=1)return e;var t=!1,n=Object(i.List)().withMutations(function(n){e.findLast(function(e,r){var o=n.first();if(o){if(o.marks.equals(e.marks))return t=!0,void n.set(0,o.set("text",""+e.text+o.text));if(""===o.text)return t=!0,void n.set(0,e);if(""===e.text)return void(t=!0)}n.unshift(e)})});return t?n:e}},{key:"splitLeaves",value:function(e,t){if(t<0)return[Object(i.List)(),e];if(0===e.size)return[Object(i.List)(),Object(i.List)()];var n=0,r=-1,o=void 0,a=void 0;return e.find(function(e){r++;var i=n,s=e.text;if((n+=s.length)t)return!1;var l=t-i;return o=e.set("text",s.slice(0,l)),a=e.set("text",s.slice(l)),!0}),o?""===o.text?0===r?[i.List.of(o),e]:[e.take(r),e.skip(r)]:""===a.text?r===e.size-1?[e,i.List.of(a)]:[e.take(r+1),e.skip(r+1)]:[e.take(r).push(o),e.skip(r+1).unshift(a)]:[e,Object(i.List)()]}},{key:"createList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(i.List.isList(e)||Array.isArray(e))return new i.List(e.map(t.create));throw new Error("`Leaf.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var n=e.text,r=void 0===n?"":n,o=e.marks,a=void 0===o?[]:o;return new t({text:r,marks:Object(i.Set)(a.map(M.fromJSON))})}},{key:"isLeafList",value:function(e){return i.List.isList(e)&&e.every(function(e){return t.isLeaf(e)})}}]),t}(Object(i.Record)(P)),U=!0,B=0,j={},G={},q=void 0;function V(e,t){var n=function(t){var n=e[t];if(!n)throw new Error('Object does not have a property named "'+t+'".');e[t]=function(){for(var e=arguments.length,r=Array(e),o=0;o=Number.MAX_SAFE_INTEGER&&(B=0)}function H(e){U=e}var K={leaves:void 0,key:void 0},Y=function(e){function t(){return E(this,t),k(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return C(t,e),S(t,[{key:"searchLeafAtOffset",value:function(e){var t=0,n=0,r=-1;return{leaf:this.leaves.find(function(o){return r++,(t=(n=t)+o.text.length)>=e}),endOffset:t,index:r,startOffset:n}}},{key:"addMark",value:function(e,t,n){var r=i.Set.of(n);return this.addMarks(e,t,r)}},{key:"addMarks",value:function(e,t,n){if(""===this.text&&0===t&&0===e){var r=this.leaves.first();if(!r)return this.set("leaves",i.List.of(L.fromJSON({text:"",marks:n})));var o=r.addMarks(n);return o===r?this:this.set("leaves",i.List.of(o))}if(""===this.text)return this;if(0===t)return this;if(e>=this.text.length)return this;var a=L.splitLeaves(this.leaves,e),s=T(a,2),l=s[0],u=s[1],c=L.splitLeaves(u,t),d=T(c,2),p=d[0],f=d[1],h=l.concat(p.map(function(e){return e.addMarks(n)}),f);return this.setLeaves(h)}},{key:"getLeaves",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=this.leaves;if(0===n.size)return i.List.of(L.create({}));if(!t||0===t.length)return n;if(0===this.text.length)return n;var r=this.key;return t.forEach(function(t){var o=t.start,i=t.end,a=t.mark,s=o.key==r,l=i.key==r;if(s&&l){var u=s?o.offset:0,c=l?i.offset-u:e.text.length-u;if(c<1)return;if(u>=e.text.length)return;if(0!==u||c=this.text.length)return this.getActiveMarks();if(e>=t)return Object(i.Set)();if(""===this.text)return this.getActiveMarks();var n=null,r=0;return this.leaves.forEach(function(o){var i=r;if(!((r=i+o.text.length)<=e)){if(i>=t)return!1;if(n)return(n=n.intersect(o.marks))&&n.size,!1;n=o.marks}}),n||Object(i.Set)()}},{key:"getActiveMarks",value:function(){var e=this;if(0===this.leaves.size)return Object(i.Set)();var t=this.leaves.first().marks;return 0===t.size?t:t.toOrderedSet().withMutations(function(t){e.leaves.forEach(function(e){if(t.intersect(e.marks),0===t.size)return!1})})}},{key:"getMarksBetweenOffsets",value:function(e,t){if(e<=0&&t>=this.text.length)return this.getMarks();if(e>=t)return Object(i.Set)();if(""===this.text)return this.getActiveMarks();var n=null,r=0;return this.leaves.forEach(function(o){var i=r;if(!((r=i+o.text.length)<=e))return!(i>=t)&&void(n=n?n.union(o.marks):o.marks)}),n||Object(i.Set)()}},{key:"getMarks",value:function(){var e=this.getMarksAsArray();return new i.OrderedSet(e)}},{key:"getMarksAsArray",value:function(){if(0===this.leaves.size)return[];var e=this.leaves.first().marks;if(1===this.leaves.size)return e.toArray();var t=[];return this.leaves.forEach(function(e){t.push(e.marks.toArray())}),Array.prototype.concat.apply(e.toArray(),t)}},{key:"getMarksAtIndex",value:function(e){var t=this.searchLeafAtOffset(e).leaf;return t?t.marks:Object(i.Set)()}},{key:"insertText",value:function(e,t,n){if(""===this.text)return this.set("leaves",i.List.of(L.create({text:t,marks:n})));if(0===t.length)return this;n||(n=Object(i.Set)());var r=this.searchLeafAtOffset(e),o=r.startOffset,a=r.leaf,s=r.index,l=e-o,u=a.text.slice(0,l),c=a.text.slice(l),d=this.leaves;if(a.marks.equals(n))return this.set("leaves",d.set(s,a.set("text",u+t+c)));var p=d.splice(s,1,a.set("text",u),L.create({text:t,marks:n}),a.set("text",c));return this.setLeaves(p)}},{key:"removeMark",value:function(e,t,n){if(""===this.text&&0===e&&0===t){var r=this.leaves.first();if(!r)return this;var o=r.removeMark(n);return o===r?this:this.set("leaves",i.List.of(o))}if(t<=0)return this;if(e>=this.text.length)return this;var a=L.splitLeaves(this.leaves,e),s=T(a,2),l=s[0],u=s[1],c=L.splitLeaves(u,t),d=T(c,2),p=d[0],f=d[1],h=l.concat(p.map(function(e){return e.removeMark(n)}),f);return this.setLeaves(h)}},{key:"removeText",value:function(e,t){if(t<=0)return this;if(e>=this.text.length)return this;if(1===t){var n=this.searchLeafAtOffset(e+1),r=n.leaf,o=n.index,a=e-n.startOffset;if(r){if(1===r.text.length){var s=this.leaves.remove(o);return this.setLeaves(s)}var l=r.text.slice(0,a)+r.text.slice(a+t);if(l.length>0)return this.set("leaves",this.leaves.set(o,r.set("text",l)))}}var u=L.splitLeaves(this.leaves,e),c=T(u,2),d=c[0],p=c[1],f=L.splitLeaves(p,t)[1],h=L.createLeaves(d.concat(f));if(1===h.size){var m=h.first();if(""===m.text)return this.set("leaves",i.List.of(m.set("marks",this.getActiveMarks())))}return this.set("leaves",h)}},{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={object:this.object,leaves:this.getLeaves().toArray().map(function(e){return e.toJSON()})};return e.preserveKeys&&(t.key=this.key),t}},{key:"updateMark",value:function(e,t,n,r){var o=n.merge(r);if(""===this.text&&0===t&&0===e){var a=this.leaves.first();if(!a)return this;var s=a.updateMark(n,o);return s===a?this:this.set("leaves",i.List.of(s))}if(t<=0)return this;if(e>=this.text.length)return this;var l=L.splitLeaves(this.leaves,e),u=T(l,2),c=u[0],d=u[1],p=L.splitLeaves(d,t),f=T(p,2),h=f[0],m=f[1],g=c.concat(h.map(function(e){return e.updateMark(n,o)}),m);return this.setLeaves(g)}},{key:"splitText",value:function(e){var t=L.splitLeaves(this.leaves,e);return[this.set("leaves",t[0]),this.set("leaves",t[1]).regenerateKey()]}},{key:"mergeText",value:function(e){var t=this.leaves.concat(e.leaves);return this.setLeaves(t)}},{key:"setLeaves",value:function(e){var t=L.createLeaves(e);if(1===t.size){var n=t.first();if((!n.marks||0===n.marks.size)&&""===n.text)return this.set("leaves",Object(i.List)())}return this.set("leaves",L.createLeaves(e))}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";if(t.isText(e))return e;if("string"==typeof e&&(e={leaves:[{text:e}]}),o()(e)){if(e.text){var n=e,r=n.text,i=n.marks;e={key:n.key,leaves:[{text:r,marks:i}]}}return t.fromJSON(e)}throw new Error("`Text.create` only accepts objects, arrays, strings or texts, but you passed it: "+e)}},{key:"createList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(i.List.isList(e)||Array.isArray(e))return new i.List(e.map(t.create));throw new Error("`Text.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"fromJSON",value:function(e){if(t.isText(e))return e;var n=e.key,r=void 0===n?y.create():n,o=e.leaves;if(o||(e.ranges?(Object(a.a)(!1,"As of slate@0.27.0, the `ranges` property of Slate objects has been renamed to `leaves`."),o=e.ranges):o=Object(i.List)()),Array.isArray(o))o=Object(i.List)(o.map(function(e){return L.create(e)}));else{if(!i.List.isList(o))throw new Error("leaves must be either Array or Immutable.List");o=o.map(function(e){return L.create(e)})}return new t({leaves:L.createLeaves(o),key:r})}},{key:"isTextList",value:function(e){return i.List.isList(e)&&e.every(function(e){return t.isText(e)})}}]),t}(Object(i.Record)(K));V(Y.prototype,["getActiveMarks","getMarks","getMarksAsArray"]);var W=function(){function e(){E(this,e)}return S(e,null,[{key:"create",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e.isNode(t))return t;if(o()(t)){var n=t.object;switch(!n&&t.kind&&(Object(a.a)(!1,"As of slate@0.32.0, the `kind` property of Slate objects has been renamed to `object`."),n=t.kind),n){case"block":return Q.create(t);case"document":return A.create(t);case"inline":return N.create(t);case"text":return Y.create(t);default:throw new Error("`Node.create` requires a `object` string.")}}throw new Error("`Node.create` only accepts objects or nodes but you passed it: "+t)}},{key:"createList",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(i.List.isList(t)||Array.isArray(t))return Object(i.List)(t.map(e.create));throw new Error("`Node.createList` only accepts lists or arrays, but you passed it: "+t)}},{key:"createProperties",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(Q.isBlock(e)||N.isInline(e))return{data:e.data,type:e.type};if("string"==typeof e)return{type:e};if(o()(e)){var t={};return"type"in e&&(t.type=e.type),"data"in e&&(t.data=F.create(e.data)),t}throw new Error("`Node.createProperties` only accepts objects, strings, blocks or inlines, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var t=e.object;switch(!t&&e.kind&&(Object(a.a)(!1,"As of slate@0.32.0, the `kind` property of Slate objects has been renamed to `object`."),t=e.kind),t){case"block":return Q.fromJSON(e);case"document":return A.fromJSON(e);case"inline":return N.fromJSON(e);case"text":return Y.fromJSON(e);default:throw new Error("`Node.fromJSON` requires an `object` of either 'block', 'document', 'inline' or 'text', but you passed: "+e)}}},{key:"isNode",value:function(e){return Q.isBlock(e)||A.isDocument(e)||N.isInline(e)||Y.isText(e)}},{key:"isNodeList",value:function(t){return i.List.isList(t)&&t.every(function(t){return e.isNode(t)})}}]),e}(),$={data:void 0,key:void 0,nodes:void 0,type:void 0},Q=function(e){function t(){return E(this,t),k(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return C(t,e),S(t,[{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={object:this.object,type:this.type,data:this.data.toJSON(),nodes:this.nodes.toArray().map(function(t){return t.toJSON(e)})};return e.preserveKeys&&(t.key=this.key),t}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isBlock(e))return e;if("string"==typeof e&&(e={type:e}),o()(e))return t.fromJSON(e);throw new Error("`Block.create` only accepts objects, strings or blocks, but you passed it: "+e)}},{key:"createList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(i.List.isList(e)||Array.isArray(e))return new i.List(e.map(t.create));throw new Error("`Block.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"fromJSON",value:function(e){if(t.isBlock(e))return e;var n=e.data,r=void 0===n?{}:n,o=e.key,a=void 0===o?y.create():o,s=e.nodes,l=void 0===s?[]:s,u=e.type;if("string"!=typeof u)throw new Error("`Block.fromJSON` requires a `type` string.");return new t({key:a,type:u,data:Object(i.Map)(r),nodes:W.createList(l)})}},{key:"isBlockList",value:function(e){return i.List.isList(e)&&e.every(function(e){return t.isBlock(e)})}}]),t}(Object(i.Record)($)),J={};["deleteBackward","deleteCharBackward","deleteLineBackward","deleteWordBackward","deleteForward","deleteCharForward","deleteWordForward","deleteLineForward","setBlocks","setInlines","splitInline","unwrapBlock","unwrapInline","wrapBlock","wrapInline"].forEach(function(e){J[e]=function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o1&&void 0!==arguments[1]?arguments[1]:1,n=e.value,r=n.selection,o=n.document,i=r.marks||o.getInsertMarksAtRange(r);e.splitBlockAtRange(r,t).moveToEnd(),i&&0!==i.size&&e.select({marks:i})},J.toggleMark=function(e,t){t=M.create(t),e.value.activeMarks.has(t)?e.removeMark(t):e.addMark(t)},J.wrapText=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,r=e.value.selection;e.wrapTextAtRange(r,t,n),r.isCollapsed&&e.moveStartBackward(t.length),e.moveEndBackward(n.length),r.isForward!=e.value.selection.isForward&&e.flip()};var X=55296,Z=57343,ee=/\s/,te=/['\u2018\u2019]/,ne=/[\u0021-\u0023\u0025-\u002A\u002C-\u002F\u003A\u003B\u003F\u0040\u005B-\u005D\u005F\u007B\u007D\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E3B\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/;function re(e){return X<=e&&e<=Z}function oe(e,t){if(ee.test(e))return!1;if(te.test(e)){var n=t.charAt(0),r=ie(n);if(oe(n=t.slice(0,r),t.slice(r)))return!0}return!ne.test(e)}function ie(e){return re(e.charCodeAt(0))?2:1}function ae(e){return ie(e.charAt(0))}function se(e){for(var t=0,n=0,r=!1,o=void 0;o=e.charAt(n);){var i=ie(o);if(oe(o=e.slice(n,n+i),e.slice(n+i)))r=!0,t+=i;else{if(r)break;t+=i}n+=i}return t}var le={getCharLength:ie,getCharOffset:ae,getCharOffsetBackward:function(e,t){return e=e.slice(0,t),ae(e=Object(s.reverse)(e))},getCharOffsetForward:function(e,t){return ae(e=e.slice(t))},getWordOffset:se,getWordOffsetBackward:function(e,t){return e=e.slice(0,t),se(e=Object(s.reverse)(e))},getWordOffsetForward:function(e,t){return se(e=e.slice(t))},isSurrogate:re,isWord:oe},ue={};function ce(e,t){if(e.size!==t.size)return null;for(var n=0;no)return 1}return 0}function de(e){if(null==e)return null;if(i.List.isList(e))return e;if(Array.isArray(e))return Object(i.List)(e);throw new Error("Paths can only be created from arrays or lists, but you passed: "+e)}function pe(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ve(e,t);return[e.slice(0,n),t.slice(0,n)]}function fe(e){return he(e,0-(arguments.length>1&&void 0!==arguments[1]?arguments[1]:1),arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.size-1)}function he(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.size-1,r=e.get(n)+t;return e.set(n,r)}function me(e,t){var n=pe(e,t),r=T(n,2),o=r[0],i=r[1];return e.size2&&void 0!==arguments[2]?arguments[2]:1;if(0!==n){var r=e.value,o=r.document,i=r.schema,a=t,s=a.start,l=a.focus;if(t.isExpanded)e.deleteAtRange(t);else{var u=o.getClosestVoid(s.key,i);if(u)e.removeNodeByKey(u.key);else{var c=o.getClosestBlock(s.key);if(!c||i.isVoid(c)||""!==c.text||1===o.nodes.size){if(!s.isAtStartOfNode(o)){var d=o.getDescendant(s.key);if(s.isAtStartOfNode(d)){var p=o.getPreviousText(d.key),f=o.getClosestBlock(p.key),h=o.getClosestVoid(p.key,i);if(h)return void e.removeNodeByKey(h.key);if(1==n&&f!=c)return t=t.moveAnchorTo(p.key,p.text.length),void e.deleteAtRange(t)}if(n_;){var v=_+(m=o.getPreviousText(m.key)).text.length;if(n<=v){g=v-n;break}_=v}t=t.moveAnchorTo(m.key,g),e.deleteAtRange(t)}}else e.removeNodeByKey(c.key)}}}},ue.deleteCharForwardAtRange=function(e,t){var n=e.value.document,r=t.start,o=n.getClosestBlock(r.key),i=o.getOffset(r.key)+r.offset,a=o.text,s=le.getCharOffsetForward(a,i);e.deleteForwardAtRange(t,s)},ue.deleteLineForwardAtRange=function(e,t){var n=e.value.document,r=t.start,o=n.getClosestBlock(r.key),i=o.getOffset(r.key)+r.offset;e.deleteForwardAtRange(t,o.text.length-i)},ue.deleteWordForwardAtRange=function(e,t){var n=e.value.document,r=t.start,o=n.getClosestBlock(r.key),i=o.getOffset(r.key)+r.offset,a=o.text,s=le.getWordOffsetForward(a,i);e.deleteForwardAtRange(t,s)},ue.deleteForwardAtRange=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(0!==n){var r=e.value,o=r.document,i=r.schema,a=t,s=a.start,l=a.focus;if(t.isExpanded)e.deleteAtRange(t);else{var u=o.getClosestVoid(s.key,i);if(u)e.removeNodeByKey(u.key);else{var c=o.getClosestBlock(s.key);if(c&&!i.isVoid(c)&&""===c.text&&1!==o.nodes.size){var d=o.getNextBlock(c.key);return e.removeNodeByKey(c.key),void(d&&d.key&&e.moveToStartOfNode(d))}if(!s.isAtEndOfNode(o)){var p=o.getDescendant(s.key);if(s.isAtEndOfNode(p)){var f=o.getNextText(p.key),h=o.getClosestBlock(f.key),m=o.getClosestVoid(f.key,i);if(m)return void e.removeNodeByKey(m.key);if(1==n&&h!=c)return t=t.moveFocusTo(f.key,0),void e.deleteAtRange(t)}if(n<=p.text.length-l.offset)return t=t.moveFocusForward(n),void e.deleteAtRange(t);for(var g=p,_=l.offset,v=p.text.length-l.offset;n>v;){var y=v+(g=o.getNextText(g.key)).text.length;if(n<=y){_=n-v;break}v=y}t=t.moveFocusTo(g.key,_),e.deleteAtRange(t)}}}}},ue.insertBlockAtRange=function(e,t,n){n=Q.create(n),t.isExpanded&&(e.deleteAtRange(t),t=t.moveToStart());var r=e.value,o=r.document,i=r.schema,a=t.start,s=a.key,l=a.offset,u=o.getClosestBlock(s),c=o.getClosestInline(s),d=o.getParent(u.key),p=d.nodes.indexOf(u);if(i.isVoid(u)){var f=a.isAtEndOfNode(u)?1:0;e.insertNodeByKey(d.key,p+f,n)}else if(c||""!==u.text)if(a.isAtStartOfNode(u))e.insertNodeByKey(d.key,p,n);else if(a.isAtEndOfNode(u))e.insertNodeByKey(d.key,p+1,n);else{if(c&&i.isVoid(c)){var h=a.isAtEndOfNode(c),m=h?o.getNextText(s):o.getPreviousText(s),g=h?t.moveToStartOfNode(m):t.moveToEndOfNode(m);s=g.start.key,l=g.start.offset}e.withoutNormalizing(function(){e.splitDescendantsByKey(u.key,s,l),e.insertNodeByKey(d.key,p+1,n)})}else e.insertNodeByKey(d.key,p+1,n)},ue.insertFragmentAtRange=function(e,t,n){e.withoutNormalizing(function(){if(t.isExpanded&&(e.deleteAtRange(t),t=e.value.document.getDescendant(t.start.key)?t.moveToStart():t.moveTo(t.end.key,0).normalize(e.value.document)),n.nodes.size){n=n.mapDescendants(function(e){return e.regenerateKey()});var r=t.start,o=e.value,a=o.schema,s=o.document,l=s.getDescendant(r.key),u=s.getClosestBlock(l.key),c=u.getFurthestAncestor(l.key),d=r.isAtStartOfNode(u),p=s.getParent(u.key),f=p.nodes.indexOf(u),h=n.getBlocks(),m=n.nodes.first(),g=n.nodes.last(),_=h.first(),v=h.last();if(_===v&&a.isVoid(_))e.insertBlockAtRange(t,_);else if(m.hasBlockChildren()||g.hasBlockChildren())n.nodes.reverse().forEach(function(n){e.insertBlockAtRange(t,n)});else{if(_!=v){var y=n.getFurthest(_.key,function(e){return 1==e.nodes.size})||_,b=p.nodes.indexOf(u);(n=n.removeNode(y.key)).nodes.forEach(function(t,n){var r=b+n+1;e.insertNodeByKey(p.key,r,t)})}if(0!=r.offset&&e.splitDescendantsByKey(c.key,r.key,r.offset),l=(s=e.value.document).getDescendant(r.key),c=(u=s.getClosestBlock(r.key)).getFurthestAncestor(l.key),_!=v){var E=d?c:u.getNextSibling(c.key),S=E?u.nodes.skipUntil(function(e){return e.key==E.key}):Object(i.List)(),w=v.nodes.size;S.forEach(function(t,n){var r=w+n;e.moveNodeByKey(t.key,v.key,r)})}if(a.isVoid(u)||""!==u.text){var C=u.getFurthestAncestor(l.key),x=u.nodes.indexOf(C);_.nodes.forEach(function(t,n){var o=0==r.offset?0:1,i=x+n+o;e.insertNodeByKey(u.key,i,t)})}else e.removeNodeByKey(u.key),e.insertNodeByKey(p.key,f,_)}}})},ue.insertInlineAtRange=function(e,t,n){n=N.create(n),e.withoutNormalizing(function(){t.isExpanded&&(e.deleteAtRange(t),t=t.moveToStart());var r=e.value,o=r.document,i=r.schema,a=t.start,s=o.getParent(a.key),l=o.assertDescendant(a.key),u=s.nodes.indexOf(l);i.isVoid(s)||(e.splitNodeByKey(a.key,a.offset),e.insertNodeByKey(s.key,u+1,n))})},ue.insertTextAtRange=function(e,t,n,r){var o=e.value,i=o.document,a=o.schema,s=t.start,l=s.key,u=s.offset,c=i.getParent(s.key);a.isVoid(c)||e.withoutNormalizing(function(){t.isExpanded&&(e.deleteAtRange(t),e.value.selection.start.key!==l&&(l=e.value.selection.start.key,u=e.value.selection.start.offset)),e.insertTextByKey(l,u,n,r)})},ue.removeMarkAtRange=function(e,t,n){if(!t.isCollapsed){var r=e.value.document.getTextsAtRange(t),o=t.start,i=t.end;e.withoutNormalizing(function(){r.forEach(function(t){var r=t.key,a=0,s=t.text.length;r==o.key&&(a=o.offset),r==i.key&&(s=i.offset),r==o.key&&r==i.key&&(s=i.offset-o.offset),e.removeMarkByKey(r,a,s,n)})})}},ue.setBlocksAtRange=function(e,t,n){var r=e.value,o=r.document,i=r.schema,a=o.getBlocksAtRange(t),s=t.start,l=t.end,u=t.isCollapsed,c=o.hasVoidParent(s.key,i),d=o.getClosestBlock(s.key),p=o.getClosestBlock(l.key),f=0==u&&0==s.offset&&0==l.offset&&0==c&&s.key==d.getFirstText().key&&l.key==p.getFirstText().key?a.slice(0,-1):a;e.withoutNormalizing(function(){f.forEach(function(t){e.setNodeByKey(t.key,n)})})},ue.setInlinesAtRange=function(e,t,n){var r=e.value.document.getInlinesAtRange(t);e.withoutNormalizing(function(){r.forEach(function(t){e.setNodeByKey(t.key,n)})})},ue.splitBlockAtRange=function(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=t,o=r.start,i=r.end,a=e.value,s=a.document,l=s.assertDescendant(o.key),u=s.getClosestBlock(l.key),c=0;u&&"block"==u.object&&c2&&void 0!==arguments[2]?arguments[2]:1/0;t.isExpanded&&(e.deleteAtRange(t),t=t.moveToStart());for(var r=t.start,o=e.value.document,i=o.assertDescendant(r.key),a=o.getClosestInline(i.key),s=0;a&&"inline"==a.object&&s3&&void 0!==arguments[3]?arguments[3]:n,o=t.start,i=t.end,a=t.moveToStart(),s=t.moveToEnd();o.key==i.key&&(s=s.moveForward(n.length)),e.withoutNormalizing(function(){e.insertTextAtRange(a,n,[]),e.insertTextAtRange(s,r,[])})};var ye={compare:ce,create:de,crop:pe,decrement:fe,increment:he,isAbove:me,isAfter:function(e,t){var n=pe(e,t),r=T(n,2);return 1===ce(r[0],r[1])},isBefore:function(e,t){var n=pe(e,t),r=T(n,2);return-1===ce(r[0],r[1])},isEqual:ge,isOlder:function(e,t){var n=e.size-1,r=pe(e,t,n),o=T(r,2),i=o[0],a=o[1],s=e.get(n),l=t.get(n);return ge(i,a)&&s>l},isSibling:function(e,t){if(e.size!==t.size)return!1;var n=e.butLast(),r=t.butLast();return n.equals(r)},isYounger:_e,lift:function(e){return e.slice(0,-1)},max:function(e,t){return Math.max(e.size,t.size)},min:ve,relate:function(e,t){for(var n=[],r=0;r=r&&(e=fe(e=he(e,1,a),r,a+1))),"move_node"===n){var c=t.newPath,d=c.size-1,p=ge(c,e),f=_e(c,e),h=me(c,e);u?e=c.concat(e.slice(o.size)):(s?e=c:l&&(e=fe(e,1,a)),(p||f||h)&&(e=he(e,1,d)))}var m=Array.isArray(e)?e:[e];return Object(i.List)(m)}},be={addMarkByPath:function(e,t,n,r,o){o=M.create(o);var i=e.value,a=i.document.assertNode(t).getLeaves(),s=[],l=n,u=n+r,c=0;a.forEach(function(e){var n=c,r=n+e.text.length;if(c+=e.text.length,!(rs.text.length&&(r=s.text.length-n);var l=a.createRange({anchor:{path:t,offset:n},focus:{path:t,offset:n+r}}),u=a.getActiveMarksAtRange(l);e.withoutNormalizing(function(){e.removeTextByPath(t,n,r),i?u&&(u=u.filter(function(e){return!i.find(function(t){return e.type===t.type})}),i=u.merge(i)):i=u||[],e.insertTextByPath(t,n,o,i)})},setMarkByPath:function(e,t,n,r,o,i){o=M.create(o),i=M.createProperties(i);var a=e.value;e.applyOperation({type:"set_mark",value:a,path:t,offset:n,length:r,mark:o,properties:i})},setNodeByPath:function(e,t,n){n=W.createProperties(n);var r=e.value,o=r.document.assertNode(t);e.applyOperation({type:"set_node",value:r,path:t,node:o,properties:n})},setTextByPath:function(e,t,n,r){var o=e.value.document.assertNode(t).text.length;e.replaceTextByPath(t,0,o,n,r)},splitNodeByPath:function(e,t,n){var r=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).target,o=void 0===r?null:r,i=e.value,a=i.document.getDescendant(t);e.applyOperation({type:"split_node",value:i,path:t,position:n,target:o,properties:{type:a.type,data:a.data}})},splitDescendantsByPath:function(e,t,n,r){if(t.equals(n))e.splitNodeByPath(n,r);else{var o=e.value.document,i=o.assertNode(t),a=o.assertNode(n),s=o.getAncestors(n).skipUntil(function(e){return e.key==i.key}).reverse().unshift(a),l=void 0,u=void 0;e.withoutNormalizing(function(){s.forEach(function(t){var n=null==u?null:u;u=l?t.nodes.indexOf(l)+1:r,l=t,e.splitNodeByKey(t.key,u,{target:n})})})}},unwrapInlineByPath:function(e,t,n){var r=e.value,o=r.document,i=r.selection,a=o.assertNode(t),s=a.getFirstText(),l=a.getLastText(),u=i.moveToRangeOfNode(s,l);e.unwrapInlineAtRange(u,n)},unwrapBlockByPath:function(e,t,n){var r=e.value,o=r.document,i=r.selection,a=o.assertNode(t),s=a.getFirstText(),l=a.getLastText(),u=i.moveToRangeOfNode(s,l);e.unwrapBlockAtRange(u,n)},unwrapNodeByPath:function(e,t){var n=e.value.document;n.assertNode(t);var r=ye.lift(t),o=n.assertNode(r),i=t.last(),a=r.last(),s=ye.lift(r),l=0===i,u=i===o.nodes.size-1;e.withoutNormalizing(function(){if(1===o.nodes.size)e.moveNodeByPath(t,s,a+1),e.removeNodeByPath(r);else if(l)e.moveNodeByPath(t,s,a);else if(u)e.moveNodeByPath(t,s,a+1);else{var n=ye.increment(t,1,r.size-1);n=n.set(n.size-1,0),e.splitNodeByPath(r,i),e.moveNodeByPath(n,s,a+1)}})},wrapBlockByPath:function(e,t,n){n=(n=Q.create(n)).set("nodes",n.nodes.clear());var r=ye.lift(t),o=t.last(),i=ye.increment(t);e.withoutNormalizing(function(){e.insertNodeByPath(r,o,n),e.moveNodeByPath(i,t,0)})},wrapInlineByPath:function(e,t,n){n=(n=N.create(n)).set("nodes",n.nodes.clear());var r=ye.lift(t),o=t.last(),i=ye.increment(t);e.withoutNormalizing(function(){e.insertNodeByPath(r,o,n),e.moveNodeByPath(i,t,0)})},wrapNodeByPath:function(e,t,n){"block"===(n=W.create(n)).object?e.wrapBlockByPath(t,n):"inline"===n.object&&e.wrapInlineByPath(t,n)}},Ee=function(e){be[e+"ByKey"]=function(t,n){for(var r=arguments.length,o=Array(r>2?r-2:0),i=2;i3?r-3:0),i=3;i3?r-3:0),i=3;i0&&void 0!==arguments[0]?arguments[0]:1;return 0===e?this:e<0?this.moveForward(-e):this.setOffset(this.offset-e)}},{key:"moveForward",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return 0===e?this:e<0?this.moveBackward(-e):this.setOffset(this.offset+e)}},{key:"moveTo",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.key;return"number"==typeof e?(t=e,e=this.path):"string"==typeof e?e=(n=e)===this.key?this.path:null:n=e.equals(this.path)?this.key:null,this.merge({key:n,path:e,offset:t})}},{key:"moveToStartOfNode",value:function(e){var t=e.getFirstText();return this.moveTo(t.key,0)}},{key:"moveToEndOfNode",value:function(e){var t=e.getLastText();return this.moveTo(t.key,t.text.length)}},{key:"normalize",value:function(e){if(null==this.key&&null==this.path)return this.setOffset(null);var n=this.key,r=this.offset,o=this.path,i=e.getNode(n||o);if(!i){Object(a.a)(!1,"A point's `path` or `key` invalid and was reset!");var s=e.getFirstText();return s?this.merge({key:s.key,offset:0,path:e.getPath(s.key)}):t.create()}if("text"!==i.object){Object(a.a)(!1,"A point should not reference a non-text node!");var l=i.getTextAtOffset(r),u=i.getOffset(l.key);return this.merge({offset:r-u,key:l.key,path:e.getPath(l.key)})}return i&&o&&n&&n!==i.key&&Object(a.a)(!1,"A point's `key` did not match its `path`!"),this.merge({key:i.key,path:null==o?e.getPath(i.key):o,offset:null==r?0:Math.min(r,i.text.length)})}},{key:"setKey",value:function(e){return null!==e&&(e=y.create(e)),this.set("key",e)}},{key:"setOffset",value:function(e){return this.set("offset",e)}},{key:"setPath",value:function(e){return null!==e&&(e=ye.create(e)),this.set("path",e)}},{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={object:this.object,key:this.key,offset:this.offset,path:this.path&&this.path.toArray()};return e.preserveKeys||delete t.key,t}},{key:"unset",value:function(){return this.merge({key:null,offset:null,path:null})}},{key:"isSet",get:function(){return null!=this.key&&null!=this.offset&&null!=this.path}},{key:"isUnset",get:function(){return!this.isSet}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isPoint(e))return e;if(o()(e))return t.fromJSON(e);throw new Error("`Point.create` only accepts objects or points, but you passed it: "+e)}},{key:"createProperties",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isPoint(e))return{key:e.key,offset:e.offset,path:e.path};if(o()(e)){var n={};return"key"in e&&(n.key=e.key),"offset"in e&&(n.offset=e.offset),"path"in e&&(n.path=ye.create(e.path)),"path"in e&&!("key"in e)&&(n.key=null),"key"in e&&!("path"in e)&&(n.path=null),n}throw new Error("`Point.createProperties` only accepts objects or points, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var n=e.key,r=void 0===n?null:n,o=e.offset,i=void 0===o?null:o,a=e.path,s=void 0===a?null:a;return new t({key:r,offset:i,path:ye.create(s)})}}]),t}(Object(i.Record)(Re)),De={anchor:void 0,focus:void 0,mark:void 0},Ae=function(e){function t(){return E(this,t),k(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return C(t,e),S(t,[{key:"setProperties",value:function(e){var n=e=t.createProperties(e),r=n.anchor,o=n.focus,i=n.mark,a={};return r&&(a.anchor=Fe.create(r)),o&&(a.focus=Fe.create(o)),i&&(a.mark=M.create(i)),this.merge(a)}},{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{object:this.object,anchor:this.anchor.toJSON(e),focus:this.focus.toJSON(e),mark:this.mark.toJSON(e)}}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isDecoration(e))return e;if(Me.isRange(e))return t.fromJSON(Me.createProperties(e));if(o()(e))return t.fromJSON(e);throw new Error("`Decoration.create` only accepts objects or decorations, but you passed it: "+e)}},{key:"createList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(i.List.isList(e)||Array.isArray(e))return new i.List(e.map(t.create));throw new Error("`Decoration.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"createProperties",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isDecoration(e))return{anchor:Fe.createProperties(e.anchor),focus:Fe.createProperties(e.focus),mark:M.create(e.mark)};if(o()(e)){var n={};return"anchor"in e&&(n.anchor=Fe.create(e.anchor)),"focus"in e&&(n.focus=Fe.create(e.focus)),"mark"in e&&(n.mark=M.create(e.mark)),n}throw new Error("`Decoration.createProperties` only accepts objects or decorations, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var n=e.anchor,r=e.focus,o=e.mark;if(!o)throw new Error("Decorations must be created with a `mark`, but you passed: "+JSON.stringify(e));return new t({anchor:Fe.fromJSON(n||{}),focus:Fe.fromJSON(r||{}),mark:M.fromJSON(o)})}}]),t}(Object(i.Record)(De)),Ie={block:"@@__SLATE_BLOCK__@@",change:"@@__SLATE_CHANGE__@@",decoration:"@@__SLATE_DECORATION__@@",document:"@@__SLATE_DOCUMENT__@@",history:"@@__SLATE_HISTORY__@@",inline:"@@__SLATE_INLINE__@@",leaf:"@@__SLATE_LEAF__@@",mark:"@@__SLATE_MARK__@@",operation:"@@__SLATE_OPERATION__@@",point:"@@__SLATE_POINT__@@",range:"@@__SLATE_RANGE__@@",schema:"@@__SLATE_SCHEMA__@@",selection:"@@__SLATE_SELECTION__@@",stack:"@@__SLATE_STACK__@@",text:"@@__SLATE_TEXT__@@",value:"@@__SLATE_VALUE__@@"};function Ne(e,t){return!(!t||!t[Ie[e]])}var Oe={anchor:void 0,focus:void 0},Me=function(e){function t(){return E(this,t),k(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return C(t,e),S(t,[{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{object:this.object,anchor:this.anchor.toJSON(e),focus:this.focus.toJSON(e)}}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isRange(e))return"range"===e.object?e:t.fromJSON(t.createProperties(e));if(o()(e))return t.fromJSON(e);throw new Error("`Range.create` only accepts objects or ranges, but you passed it: "+e)}},{key:"createList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(i.List.isList(e)||Array.isArray(e))return new i.List(e.map(t.create));throw new Error("`Range.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"createProperties",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isRange(e))return{anchor:Fe.createProperties(e.anchor),focus:Fe.createProperties(e.focus)};if(o()(e)){var n={};return"anchor"in e&&(n.anchor=Fe.create(e.anchor)),"focus"in e&&(n.focus=Fe.create(e.focus)),n}throw new Error("`Range.createProperties` only accepts objects, decorations, ranges or selections, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var n=e.anchor,r=e.focus;return new t({anchor:Fe.fromJSON(n||{}),focus:Fe.fromJSON(r||{})})}},{key:"isRange",value:function(e){return Ne("range",e)||Ae.isDecoration(e)||Le.isSelection(e)}}]),t}(Object(i.Record)(Oe)),Pe={anchor:void 0,focus:void 0,isFocused:void 0,marks:void 0},Le=function(e){function t(){return E(this,t),k(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return C(t,e),S(t,[{key:"setIsFocused",value:function(e){return this.set("isFocused",e)}},{key:"setMarks",value:function(e){return this.set("marks",e)}},{key:"setProperties",value:function(e){var n=e=t.createProperties(e),r=n.anchor,o=n.focus,i=x(n,["anchor","focus"]);return r&&(i.anchor=Fe.create(r)),o&&(i.focus=Fe.create(o)),this.merge(i)}},{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{object:this.object,anchor:this.anchor.toJSON(e),focus:this.focus.toJSON(e),isFocused:this.isFocused,marks:null==this.marks?null:this.marks.toArray().map(function(e){return e.toJSON()})}}},{key:"isBlurred",get:function(){return!this.isFocused}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isSelection(e))return e;if(Me.isRange(e))return t.fromJSON(Me.createProperties(e));if(o()(e))return t.fromJSON(e);throw new Error("`Selection.create` only accepts objects, ranges or selections, but you passed it: "+e)}},{key:"createProperties",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isSelection(e))return{anchor:Fe.createProperties(e.anchor),focus:Fe.createProperties(e.focus),isFocused:e.isFocused,marks:e.marks};if(Me.isRange(e))return{anchor:Fe.createProperties(e.anchor),focus:Fe.createProperties(e.focus)};if(o()(e)){var n={};return"anchor"in e&&(n.anchor=Fe.create(e.anchor)),"focus"in e&&(n.focus=Fe.create(e.focus)),"isFocused"in e&&(n.isFocused=e.isFocused),"marks"in e&&(n.marks=null==e.marks?null:M.createSet(e.marks)),n}throw new Error("`Selection.createProperties` only accepts objects, ranges or selections, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var n=e.anchor,r=e.focus,o=e.isFocused,a=void 0!==o&&o,s=e.marks,l=void 0===s?null:s;return new t({anchor:Fe.fromJSON(n||{}),focus:Fe.fromJSON(r||{}),isFocused:a,marks:null==l?null:new i.Set(l.map(M.fromJSON))})}}]),t}(Object(i.Record)(Pe)),Ue={};function Be(e,t){for(var n,r=arguments.length,o=Array(r>2?r-2:0),i=2;i2&&void 0!==arguments[2]?arguments[2]:1;if(0!==n){if(n<0)return Ve(e,t,-n);var r=t.slice(0,1).toUpperCase()+t.slice(1),o=e.value,i=o.document,a=o.selection,s=o.schema,l=a[t],u=i.hasVoidParent(l.path,s);if(!u&&l.offset-n>=0){var c=a["move"+r+"Backward"](n);e.select(c)}else{var d=i.getPreviousText(l.path);if(d){var p=i.getClosestBlock(l.path).hasNode(d.key),f=d&&i.hasVoidParent(d.key,s);if(e["move"+r+"ToEndOfNode"](d),!u&&!f&&p){var h=e.value.selection["move"+r+"Backward"](n);e.select(h)}}}}}function Ve(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(0!==n){if(n<0)return qe(e,t,-n);var r=t.slice(0,1).toUpperCase()+t.slice(1),o=e.value,i=o.document,a=o.selection,s=o.schema,l=a[t],u=i.getNode(l.path),c=i.hasVoidParent(l.path,s);if(!c&&l.offset+n<=u.text.length){var d=a["move"+r+"Forward"](n);e.select(d)}else{var p=i.getNextText(l.path);if(p){var f=i.getClosestBlock(l.path).hasNode(p.key),h=i.hasVoidParent(p.key,s);if(e["move"+r+"ToStartOfNode"](p),!c&&!h&&f){var m=e.value.selection["move"+r+"Forward"](n);e.select(m)}}}}}Ue.blur=function(e){e.select({isFocused:!1})},Ue.deselect=function(e){var t=Le.create();e.select(t)},Ue.focus=function(e){e.select({isFocused:!0})},Ue.flip=function(e){e.call(Be,"flip")},Ue.moveAnchorBackward=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?n-1:0),o=1;o1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?n-1:0),o=1;o1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r2&&void 0!==arguments[2]?arguments[2]:{};t=Le.createProperties(t);var r=n.snapshot,o=void 0!==r&&r,a=e.value,s=a.document,l=a.selection,u={},c=l.setProperties(t);for(var p in c=s.resolveSelection(c),t=d()(c,Object.keys(t)))!0!==o&&Object(i.is)(t[p],l[p])||(u[p]=t[p]);l.marks&&!u.marks&&(u.anchor||u.focus)&&(u.marks=null),0!==Object.keys(u).length&&e.applyOperation({type:"set_selection",value:a,properties:u,selection:l.toJSON()},o?{skip:!1,merge:!1}:{})},Ue.setAnchor=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:{},n=this,r=n,o=r.undos,a=r.redos,s=t.merge;if(t.skip)return n;var l,u,c=o.peek(),d=c&&c.last();if(null==s&&(l=e,s=!!(u=d)&&("set_selection"==l.type&&"set_selection"==u.type||"insert_text"==l.type&&"insert_text"==u.type&&l.offset==u.offset+u.text.length&&l.path.equals(u.path)||"remove_text"==l.type&&"remove_text"==u.type&&l.offset+l.text.length==u.offset&&l.path.equals(u.path))),ze("save",{operation:e,merge:s}),s&&c){var p=c.push(e);o=(o=o.pop()).push(p)}else{var f=new i.List([e]);o=o.push(f)}return o.size>100&&(o=o.take(100)),a=a.clear(),n=n.set("undos",o).set("redos",a)}},{key:"toJSON",value:function(){return{object:this.object,redos:this.redos.toJSON(),undos:this.undos.toJSON()}}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isHistory(e))return e;if(o()(e))return t.fromJSON(e);throw new Error("`History.create` only accepts objects or histories, but you passed it: "+e)}},{key:"createOperationsList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(i.List.isList(e))return e;if(Array.isArray(e))return new i.List(e);throw new Error("`History.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var n=e.redos,r=void 0===n?[]:n,o=e.undos,a=void 0===o?[]:o;return new t({redos:new i.Stack(r.map(this.createOperationsList)),undos:new i.Stack(a.map(this.createOperationsList))})}}]),t}(Object(i.Record)(He));var Ye={plugins:void 0},We=function(e){function t(){return E(this,t),k(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return C(t,e),S(t,[{key:"getPluginsWith",value:function(e){return this.plugins.filter(function(t){return null!=t[e]})}},{key:"find",value:function(e){for(var t=this.getPluginsWith(e),n=arguments.length,r=Array(n>1?n-1:0),o=1;o1?r-1:0),i=1;i1?n-1:0),o=1;o2?n-2:0),o=2;o0&&void 0!==arguments[0]?arguments[0]:{}).plugins;return new t({plugins:void 0===e?[]:e})}}]),t}(Object(i.Record)(Ye));V(We.prototype,["getPluginsWith"]);var $e=function(e){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};E(this,t);var r=k(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));for(var o in r.code=e,n)r[o]=n[o];return Error.captureStackTrace?Error.captureStackTrace(r,r.constructor):r.stack=(new Error).stack,r}return C(t,e),t}(Error),Qe=f()("slate:schema"),Je=[{match:{object:"document"},nodes:[{match:{object:"block"}}]},{match:{object:"block",first:{object:"block"}},nodes:[{match:{object:"block"}}]},{match:{object:"block",first:[{object:"inline"},{object:"text"}]},nodes:[{match:[{object:"inline"},{object:"text"}]}]},{match:{object:"inline"},nodes:[{match:[{object:"inline"},{object:"text"}]}]},{match:[{object:"block"},{object:"inline"}],nodes:[{min:1}],normalize:function(e,t){var n=t.code,r=t.node;"child_required"===n&&e.insertNodeByKey(r.key,0,Y.create(),{normalize:!1})}},{match:{object:"block"},first:[{object:"block"},{object:"text"}],last:[{object:"block"},{object:"text"}],normalize:function(e,t){var n=t.code,r=t.node,o=Y.create(),i=void 0;if("first_child_object_invalid"===n)i=0;else{if("last_child_object_invalid"!==n)return;i=r.nodes.size}e.insertNodeByKey(r.key,i,o,{normalize:!1})}},{match:{object:"inline"},first:[{object:"block"},{object:"text"}],last:[{object:"block"},{object:"text"}],previous:[{object:"block"},{object:"text"}],next:[{object:"block"},{object:"text"}],normalize:function(e,t){var n=t.code,r=t.node,o=t.index,i=Y.create(),a=void 0;if("first_child_object_invalid"===n)a=0;else if("last_child_object_invalid"===n)a=r.nodes.size;else if("previous_sibling_object_invalid"===n)a=o;else{if("next_sibling_object_invalid"!==n)return;a=o+1}e.insertNodeByKey(r.key,a,i,{normalize:!1})}},{match:{object:"text"},next:[{object:"block"},{object:"inline"}],normalize:function(e,t){var n=t.code,r=t.next;"next_sibling_object_invalid"===n&&e.mergeNodeByKey(r.key,{normalize:!1})}}],Xe={stack:void 0,rules:void 0},Ze=function(e){function t(){return E(this,t),k(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return C(t,e),S(t,[{key:"getNodeRules",value:function(e){return this.rules.filter(function(t){return et(e,t.match)})}},{key:"validateNode",value:function(e){var t=tt(e,this.getNodeRules(e),this.rules,{every:!0});if(t)return new $e(t.code,t)}},{key:"testNode",value:function(e){return!this.validateNode(e)}},{key:"assertNode",value:function(e){var t=this.validateNode(e);if(t)throw t}},{key:"normalizeNode",value:function(e){var t=this.stack.find("normalizeNode",e);if(t)return t;if("text"!=e.object){var n=this.validateNode(e);if(n)return function(e){Qe("normalizing",{error:n});var t=n.rule,r=e.operations.size;t.normalize&&t.normalize(e,n),e.operations.size===r&&function(e,t){var n=t.code,r=t.node,o=t.child,i=t.next,a=t.previous,s=t.key,l=t.mark;switch(n){case"child_object_invalid":case"child_type_invalid":case"child_unknown":case"first_child_object_invalid":case"first_child_type_invalid":case"last_child_object_invalid":case"last_child_type_invalid":return"text"===o.object&&"block"===r.object&&1===r.nodes.size?e.removeNodeByKey(r.key,{normalize:!1}):e.removeNodeByKey(o.key,{normalize:!1});case"previous_sibling_object_invalid":case"previous_sibling_type_invalid":return"text"===a.object&&"block"===r.object&&1===r.nodes.size?e.removeNodeByKey(r.key,{normalize:!1}):e.removeNodeByKey(a.key,{normalize:!1});case"next_sibling_object_invalid":case"next_sibling_type_invalid":return"text"===i.object&&"block"===r.object&&1===r.nodes.size?e.removeNodeByKey(r.key,{normalize:!1}):e.removeNodeByKey(i.key,{normalize:!1});case"child_required":case"node_text_invalid":case"parent_object_invalid":case"parent_type_invalid":return"document"===r.object?r.nodes.forEach(function(t){return e.removeNodeByKey(t.key,{normalize:!1})}):e.removeNodeByKey(r.key,{normalize:!1});case"node_data_invalid":return void 0===r.data.get(s)&&"document"!==r.object?e.removeNodeByKey(r.key,{normalize:!1}):e.setNodeByKey(r.key,{data:r.data.delete(s)},{normalize:!1});case"node_mark_invalid":return r.getTexts().forEach(function(t){return e.removeMarkByKey(t.key,0,t.text.length,l,{normalize:!1})});default:e.removeNodeByKey(r.key,{normalize:!1})}}(e,n)}}}},{key:"isAtomic",value:function(e){var t=this.rules.find(function(t){return"isAtomic"in t&&et(e,t.match)});return!!t&&t.isAtomic}},{key:"isVoid",value:function(e){var t=this.rules.find(function(t){return"isVoid"in t&&et(e,t.match)});return!!t&&t.isVoid}},{key:"toJSON",value:function(){return{object:this.object,rules:this.rules}}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isSchema(e))return e;if(o()(e))return t.fromJSON(e);throw new Error("`Schema.create` only accepts objects or schemas, but you passed it: "+e)}},{key:"fromJSON",value:function(e){if(t.isSchema(e))return e;var n=e.plugins?e.plugins:[{schema:e}],r=[].concat(Je),o=!0,i=!1,a=void 0;try{for(var s,l=n[Symbol.iterator]();!(o=(s=l.next()).done);o=!0){var u=s.value.schema,c=void 0===u?{}:u,d=c.blocks,p=void 0===d?{}:d,f=c.inlines,h=void 0===f?{}:f,m=c.marks,g=void 0===m?{}:m;for(var _ in c.rules&&(r=r.concat(c.rules)),c.document&&r.push(w({match:[{object:"document"}]},c.document)),p)r.push(w({match:[{object:"block",type:_}]},p[_]));for(var v in h)r.push(w({match:[{object:"inline",type:v}]},h[v]));for(var y in g)r.push(w({match:[{object:"mark",type:y}]},g[y]))}}catch(e){i=!0,a=e}finally{try{!o&&l.return&&l.return()}finally{if(i)throw a}}return new t({stack:We.create({plugins:n}),rules:r})}}]),t}(Object(i.Record)(Xe));function et(e,t){return!tt(e,t)}function tt(e,t,n){var r=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).every,o=void 0!==r&&r;if(Array.isArray(t)){var i=t.length?t:[{}],a=void 0,s=!0,l=!1,u=void 0;try{for(var c,d=i[Symbol.iterator]();!(s=(c=d.next()).done);s=!0){var p=tt(e,c.value,n);if(a=a||p,o&&p)return p;if(!o&&!p)return}}catch(e){l=!0,u=e}finally{try{!s&&d.return&&d.return()}finally{if(l)throw u}}return a}return function(e,t){if(null==t.object)return;if(t.object===e.object)return;if("function"==typeof t.object&&t.object(e.object))return;return it("node_object_invalid",{rule:t,node:e})}(e,t)||function(e,t){if(null==t.type)return;if(t.type===e.type)return;if("function"==typeof t.type&&t.type(e.type))return;return it("node_type_invalid",{rule:t,node:e})}(e,t)||function(e,t){if(null==t.data)return;if(null==e.data)return;if("function"==typeof t.data){if(t.data(e.data))return;return it("node_data_invalid",{rule:t,node:e})}for(var n in t.data){var r=t.data[n],o=e.data&&e.data.get(n),i="function"==typeof r?r(o):r===o;if(!i)return it("node_data_invalid",{rule:t,node:e,key:n,value:o})}}(e,t)||function(e,t){if(null==t.marks)return;var n=e.getMarks().toArray(),r=function(n){var r=t.marks.some(function(e){return"function"==typeof e.type?e.type(n.type):e.type===n.type});return r?"continue":{v:it("node_mark_invalid",{rule:t,node:e,mark:n})}},o=!0,i=!1,a=void 0;try{for(var s,l=n[Symbol.iterator]();!(o=(s=l.next()).done);o=!0){var u=s.value,c=r(u);switch(c){case"continue":continue;default:if("object"===(void 0===c?"undefined":b(c)))return c.v}}}catch(e){i=!0,a=e}finally{try{!o&&l.return&&l.return()}finally{if(i)throw a}}}(e,t)||function(e,t){if(null==t.text)return;var n=e.text;if("function"==typeof t.text?t.text(n):t.text.test(n))return;return it("node_text_invalid",{rule:t,node:e,text:n})}(e,t)||function(e,t){if(null==t.first)return;var n=e.nodes.first();if(!n)return;var r=tt(n,t.first);if(!r)return;return r.rule=t,r.node=e,r.child=n,r.code=r.code.replace("node_","first_child_"),r}(e,t)||function(e,t){if(null==t.last)return;var n=e.nodes.last();if(!n)return;var r=tt(n,t.last);if(!r)return;return r.rule=t,r.node=e,r.child=n,r.code=r.code.replace("node_","last_child_"),r}(e,t)||function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(null==e.nodes)return;var r=e.nodes.toArray(),o=null!=t.nodes?t.nodes.slice():[],i=void 0,a=void 0,s=void 0,l=void 0,u=void 0,c=void 0,d=void 0,p=void 0;function f(){return i=null==i?null:0,l=o.shift(),a=l&&l.min,u=l&&l.max,!!l}function h(){return i=null==i?0:i+1,d=c,c=r[s=null==s?0:s+1],p=r[s+1],null!=u&&i==u&&f(),!!c}function m(){i-=1,s-=1}null!=t.nodes&&f();for(;h();){var g=nt(e,c,n)||rt(e,c,d,s,n)||ot(e,c,p,s,n);if(g)return g;if(null!=t.nodes){if(!l)return it("child_unknown",{rule:t,node:e,child:c,index:s});if(l.match){var _=tt(c,l.match);if(_&&i>=a&&f()){m();continue}if(_)return _.rule=t,_.node=e,_.child=c,_.index=s,_.code=_.code.replace("node_","child_"),_}}}if(null!=t.nodes)for(;null!=a;){if(i0&&void 0!==arguments[0]?arguments[0]:{};return new vt(w({},e,{value:this}))}},{key:"addMark",value:function(e,t,n,r){var o=this,i=o.document;return i=i.addMark(e,t,n,r),o=this.set("document",i)}},{key:"insertNode",value:function(e,t){var n=this,r=n.document;return r=r.insertNode(e,t),n=(n=n.set("document",r)).mapRanges(function(e){return e.updatePoints(function(e){return e.setPath(null)})})}},{key:"insertText",value:function(e,t,n,r){var o=this,i=o,a=i.document,s=i.schema;a=a.insertText(e,t,n,r),o=o.set("document",a);var l=a.assertNode(e);return o=(o=o.mapRanges(function(e){var r=e,o=r.anchor,i=r.focus,a=r.isBackward,u=Ae.isDecoration(e)&&s.isAtomic(e.mark);return o.key!==l.key||!(o.offset>t)&&(o.offset!==t||u&&a)||(e=e.moveAnchorForward(n.length)),i.key===l.key&&(i.offset>t||i.offset==t&&(!u||a))&&(e=e.moveFocusForward(n.length)),e})).clearAtomicRanges(l.key,t)}},{key:"mergeNode",value:function(e){var t=this,n=t.document,r=n.mergeNode(e);e=n.resolvePath(e);var o=ye.decrement(e),i=n.getNode(o),a=n.getNode(e);return t=(t=t.set("document",r)).mapRanges(function(e){if("text"===a.object){var t=i.text.length;e.anchor.key===a.key&&(e=e.moveAnchorTo(i.key,t+e.anchor.offset)),e.focus.key===a.key&&(e=e.moveFocusTo(i.key,t+e.focus.offset))}return e=e.updatePoints(function(e){return e.setPath(null)})})}},{key:"moveNode",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=this,o=r.document;return o=o.moveNode(e,t,n),r=(r=r.set("document",o)).mapRanges(function(e){return e.updatePoints(function(e){return e.setPath(null)})})}},{key:"removeMark",value:function(e,t,n,r){var o=this,i=o.document;return i=i.removeMark(e,t,n,r),o=this.set("document",i)}},{key:"removeNode",value:function(e){var t=this,n=t.document,r=n.assertNode(e),o="text"==r.object?r:r.getFirstText()||r,i="text"==r.object?r:r.getLastText()||r,a=n.getPreviousText(o.key),s=n.getNextText(i.key);return n=n.removeNode(e),t=(t=t.set("document",n)).mapRanges(function(e){var t=e,n=t.start,o=t.end;return r.hasNode(n.key)&&(e=a?e.moveStartTo(a.key,a.text.length):s?e.moveStartTo(s.key,0):e.unset()),r.hasNode(o.key)&&(e=a?e.moveEndTo(a.key,a.text.length):s?e.moveEndTo(s.key,0):e.unset()),e=e.updatePoints(function(e){return e.setPath(null)})})}},{key:"removeText",value:function(e,t,n){var r=this,o=r.document;o=o.removeText(e,t,n),r=r.set("document",o);var i=o.assertNode(e),a=n.length,s=t+a;return r=(r=r.clearAtomicRanges(i.key,t,t+a)).mapRanges(function(e){var n=e,r=n.anchor,o=n.focus;return r.key===i.key&&(e=r.offset>=s?e.moveAnchorBackward(a):r.offset>t?e.moveAnchorTo(r.key,t):e),o.key===i.key&&(e=o.offset>=s?e.moveFocusBackward(a):o.offset>t?e.moveFocusTo(o.key,t):e),e})}},{key:"setNode",value:function(e,t){var n=this,r=n.document;return r=r.setNode(e,t),n=n.set("document",r)}},{key:"setMark",value:function(e,t,n,r,o){var i=this,a=i.document;return a=a.setMark(e,t,n,r,o),i=i.set("document",a)}},{key:"setProperties",value:function(e){var t=this,n=t.document,r=e.data,o=e.decorations,i=e.history,a=e.schema,s={};return r&&(s.data=r),i&&(s.history=i),a&&(s.schema=a),o&&(s.decorations=o.map(function(e){return e.isSet?e:n.resolveDecoration(e)})),t=t.merge(s)}},{key:"setSelection",value:function(e){var t=this,n=t,r=n.document,o=n.selection,i=o.setProperties(e);return o=r.resolveSelection(i),t=t.set("selection",o)}},{key:"splitNode",value:function(e,t,n){var r=this,o=r.document,i=o.splitNode(e,t,n),a=o.assertNode(e);return r=(r=r.set("document",i)).mapRanges(function(e){var n=i.getNextText(a.key),r=e,o=r.start,s=r.end;return a.key===o.key&&t<=o.offset&&(e=e.moveStartTo(n.key,o.offset-t)),a.key===s.key&&t<=s.offset&&(e=e.moveEndTo(n.key,s.offset-t)),e=e.updatePoints(function(e){return e.setPath(null)})})}},{key:"mapRanges",value:function(e){var t=this,n=t,r=n.document,o=n.selection,i=n.decorations,a=o.isSet?e(o):o;a||(a=o.unset()),a!==o&&(a=r.createSelection(a)),t=t.set("selection",a);var s=i.map(function(t){var n=t.isSet?e(t):t;return n&&n!==t&&(n=r.createDecoration(n)),n});return s=s.filter(function(e){return!!e}),t=t.set("decorations",s)}},{key:"clearAtomicRanges",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=this,o=r.schema;return r=this.mapRanges(function(r){if(!Ae.isDecoration(r))return r;var i=r.start,a=r.end,s=r.mark;return o.isAtomic(s)?i.key!==e?r:i.offsett)?null:null!=n&&i.offsetn)?null:r:r})}},{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={object:this.object,document:this.document.toJSON(e)};return e.preserveData&&(t.data=this.data.toJSON(e)),e.preserveDecorations&&(t.decorations=this.decorations.toArray().map(function(t){return t.toJSON(e)})),e.preserveHistory&&(t.history=this.history.toJSON(e)),e.preserveSelection&&(t.selection=this.selection.toJSON(e)),e.preserveSchema&&(t.schema=this.schema.toJSON(e)),t}},{key:"startBlock",get:function(){return this.selection.start.key&&this.document.getClosestBlock(this.selection.start.key)}},{key:"endBlock",get:function(){return this.selection.end.key&&this.document.getClosestBlock(this.selection.end.key)}},{key:"anchorBlock",get:function(){return this.selection.anchor.key&&this.document.getClosestBlock(this.selection.anchor.key)}},{key:"focusBlock",get:function(){return this.selection.focus.key&&this.document.getClosestBlock(this.selection.focus.key)}},{key:"startInline",get:function(){return this.selection.start.key&&this.document.getClosestInline(this.selection.start.key)}},{key:"endInline",get:function(){return this.selection.end.key&&this.document.getClosestInline(this.selection.end.key)}},{key:"anchorInline",get:function(){return this.selection.anchor.key&&this.document.getClosestInline(this.selection.anchor.key)}},{key:"focusInline",get:function(){return this.selection.focus.key&&this.document.getClosestInline(this.selection.focus.key)}},{key:"startText",get:function(){return this.selection.start.key&&this.document.getDescendant(this.selection.start.key)}},{key:"endText",get:function(){return this.selection.end.key&&this.document.getDescendant(this.selection.end.key)}},{key:"anchorText",get:function(){return this.selection.anchor.key&&this.document.getDescendant(this.selection.anchor.key)}},{key:"focusText",get:function(){return this.selection.focus.key&&this.document.getDescendant(this.selection.focus.key)}},{key:"nextBlock",get:function(){return this.selection.end.key&&this.document.getNextBlock(this.selection.end.key)}},{key:"previousBlock",get:function(){return this.selection.start.key&&this.document.getPreviousBlock(this.selection.start.key)}},{key:"nextInline",get:function(){return this.selection.end.key&&this.document.getNextInline(this.selection.end.key)}},{key:"previousInline",get:function(){return this.selection.start.key&&this.document.getPreviousInline(this.selection.start.key)}},{key:"nextText",get:function(){return this.selection.end.key&&this.document.getNextText(this.selection.end.key)}},{key:"previousText",get:function(){return this.selection.start.key&&this.document.getPreviousText(this.selection.start.key)}},{key:"marks",get:function(){return this.selection.isUnset?new i.Set:this.selection.marks||this.document.getMarksAtRange(this.selection)}},{key:"activeMarks",get:function(){return this.selection.isUnset?new i.Set:this.selection.marks||this.document.getActiveMarksAtRange(this.selection)}},{key:"blocks",get:function(){return this.selection.isUnset?new i.List:this.document.getBlocksAtRange(this.selection)}},{key:"fragment",get:function(){return this.selection.isUnset?A.create():this.document.getFragmentAtRange(this.selection)}},{key:"inlines",get:function(){return this.selection.isUnset?new i.List:this.document.getInlinesAtRange(this.selection)}},{key:"texts",get:function(){return this.selection.isUnset?new i.List:this.document.getTextsAtRange(this.selection)}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.isValue(e))return e;if(o()(e))return t.fromJSON(e,n);throw new Error("`Value.create` only accepts objects or values, but you passed it: "+e)}},{key:"createProperties",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isValue(e))return{data:e.data,decorations:e.decorations,schema:e.schema};if(o()(e)){var n={};return"data"in e&&(n.data=F.create(e.data)),"decorations"in e&&(n.decorations=Ae.createList(e.decorations)),"schema"in e&&(n.schema=Ze.create(e.schema)),n}throw new Error("`Value.createProperties` only accepts objects or values, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.data,o=void 0===r?{}:r,a=e.decorations,s=void 0===a?[]:a,l=e.document,u=void 0===l?{}:l,c=e.selection,d=void 0===c?{}:c,p=e.schema,f=void 0===p?{}:p,h=e.history,m=void 0===h?{}:h;if(o=F.fromJSON(o),f=Ze.fromJSON(f),m=Ke.fromJSON(m),d=(u=A.fromJSON(u)).createSelection(d),s=Object(i.List)(s.map(function(e){return Ae.fromJSON(e)})),d.isUnset){var g=u.getFirstText();g&&(d=d.moveToStartOfNode(g)),d=u.createSelection(d)}var _=new t({data:o,decorations:s,document:u,selection:d,schema:f,history:m});if(!1!==n.normalize){var v=_.change();v.withoutSaving(function(){return v.normalize()}),_=v.value}return _}}]),t}(Object(i.Record)(at)),lt={setValue:function(e,t){t=st.createProperties(t);var n=e.value;e.applyOperation({type:"set_value",properties:t,value:n})}},ut=w({},J,ue,be,Te,Ue,lt),ct=f()("slate:operation:apply");function dt(e,t){var n=(t=gt.create(t)).type;switch(ct(n,t),n){case"add_mark":var r=t,o=r.path,i=r.offset,a=r.length,s=r.mark;return e.addMark(o,i,a,s);case"insert_node":var l=t,u=l.path,c=l.node;return e.insertNode(u,c);case"insert_text":var d=t,p=d.path,f=d.offset,h=d.text,m=d.marks;return e.insertText(p,f,h,m);case"merge_node":var g=t.path;return e.mergeNode(g);case"move_node":var _=t,v=_.path,y=_.newPath;return e.moveNode(v,y);case"remove_mark":var b=t,E=b.path,S=b.offset,w=b.length,C=b.mark;return e.removeMark(E,S,w,C);case"remove_node":var x=t.path;return e.removeNode(x);case"remove_text":var k=t,T=k.path,R=k.offset,F=k.text;return e.removeText(T,R,F);case"set_mark":var D=t,A=D.path,I=D.offset,N=D.length,O=D.mark,M=D.properties;return e.setMark(A,I,N,O,M);case"set_node":var P=t,L=P.path,U=P.properties;return e.setNode(L,U);case"set_selection":var B=t.properties;return e.setSelection(B);case"set_value":var j=t.properties;return e.setProperties(j);case"split_node":var G=t,q=G.path,V=G.position,z=G.properties;return e.splitNode(q,V,z);default:throw new Error('Unknown operation type: "'+n+'".')}}var pt=f()("slate:operation:invert");function ft(e){var t=(e=gt.create(e)).type;switch(pt(t,e),t){case"insert_node":return e.set("type","remove_node");case"remove_node":return e.set("type","insert_node");case"move_node":var n=e,r=n.newPath,o=n.path,i=r,a=o,s=o.size-1,l=r.size-1;return o.size0&&void 0!==arguments[0]?arguments[0]:{};if(t.isOperation(e))return e;if(o()(e))return t.fromJSON(e);throw new Error("`Operation.create` only accepts objects or operations, but you passed it: "+e)}},{key:"createList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(i.List.isList(e)||Array.isArray(e))return new i.List(e.map(t.create));throw new Error("`Operation.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"fromJSON",value:function(e){if(t.isOperation(e))return e;var n=e.type,r=ht[n],o={type:n};if(!r)throw new Error('`Operation.fromJSON` was passed an unrecognized operation type: "'+n+'"');var i=!0,a=!1,s=void 0;try{for(var l,u=r[Symbol.iterator]();!(i=(l=u.next()).done);i=!0){var c=l.value,d=e[c];if(void 0===d){if("document"==c)continue;if("selection"==c)continue;if("value"==c)continue;if("node"==c&&"insert_node"!=n)continue;throw new Error('`Operation.fromJSON` was passed a "'+n+'" operation without the required "'+c+'" attribute.')}"path"!==c&&"newPath"!==c||(d=ye.create(d)),"mark"===c&&(d=M.create(d)),"marks"===c&&null!=d&&(d=M.createSet(d)),"node"===c&&(d=W.create(d)),"selection"===c&&(d=Le.create(d)),"value"===c&&(d=st.create(d)),"properties"===c&&"merge_node"===n&&(d=W.createProperties(d)),"properties"===c&&"set_mark"===n&&(d=M.createProperties(d)),"properties"===c&&"set_node"===n&&(d=W.createProperties(d)),"properties"===c&&"set_selection"===n&&(d=Le.createProperties(d)),"properties"===c&&"set_value"===n&&(d=st.createProperties(d)),"properties"===c&&"split_node"===n&&(d=W.createProperties(d)),o[c]=d}}catch(e){a=!0,s=e}finally{try{!i&&u.return&&u.return()}finally{if(a)throw s}}return new t(o)}},{key:"isOperationList",value:function(e){return i.List.isList(e)&&e.every(function(e){return t.isOperation(e)})}}]),t}(Object(i.Record)(mt)),_t=f()("slate:change"),vt=function(){function e(t){E(this,e);var n=t.value;this.value=n,this.operations=new i.List,this.tmp={dirty:[],merge:null,normalize:!0,save:!0}}return S(e,[{key:"applyOperation",value:function(e){var t=this.operations,n=this.value,r=n.history;o()(e)&&(e=w({},e,{value:n})),e=gt.create(e);var i=this.tmp,a=i.merge,s=i.save;null==a&&0!==t.size&&(a=!0),_t("apply",{operation:e,save:s,merge:a}),n=e.apply(n),r&&s&&(r=r.save(e,{merge:a}),n=n.set("history",r));var l=function(e){var t=e.type,n=e.node,r=e.path,o=e.newPath;switch(t){case"add_mark":case"insert_text":case"remove_mark":case"remove_text":case"set_mark":case"set_node":return[r];case"insert_node":var i=n.getKeysToPathsTable(),a=Object.values(i).map(function(e){return r.concat(e)}),s=ye.lift(r);return[s,r].concat(R(a));case"split_node":var l=ye.lift(r),u=ye.increment(r);return[l,r,u];case"merge_node":var c=ye.lift(r),d=ye.decrement(r);return[c,d];case"move_node":var p=ye.lift(r),f=ye.lift(o);return ye.isSibling(r,o)||(f.size&&ye.isYounger(r,o)&&(f=ye.decrement(f,1,r.size-1)),p.size&&ye.isYounger(o,r)&&(p=ye.increment(p,1,o.size-1))),[p,f];case"remove_node":var h=ye.lift(r);return[h];default:return[]}}(e),u=this.tmp.dirty.reduce(function(t,n){n=ye.create(n);var r=ye.transform(n,e);return t=t.concat(r.toArray())},l);return this.tmp.dirty=u,this.value=n,this.operations=t.push(e),this}},{key:"applyOperations",value:function(e,t){var n=this;return e.forEach(function(e){return n.applyOperation(e,t)}),this}},{key:"call",value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;rs)throw new Error("A schema rule could not be normalized after sufficient iterations. This is usually due to a `rule.normalize` or `plugin.normalizeNode` function of a schema being incorrectly written, causing an infinite loop.");n()}}()}),this}},{key:"withoutNormalizing",value:function(e){var t=this.tmp.normalize;return this.tmp.normalize=!1,e(this),this.tmp.normalize=t,this.normalizeDirtyPaths(),this}},{key:"withoutMerging",value:function(e){var t=this.tmp.merge;return this.tmp.merge=!1,e(this),this.tmp.merge=t,this}},{key:"withoutSaving",value:function(e){var t=this.tmp.save;return this.tmp.save=!1,e(this),this.tmp.save=t,this}},{key:"setOperationFlag",value:function(e,t){return Object(a.a)(!1,"As of slate@0.41.0 the `change.setOperationFlag` method has been deprecated."),this.tmp[e]=t,this}},{key:"getFlag",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Object(a.a)(!1,"As of slate@0.41.0 the `change.getFlag` method has been deprecated."),void 0!==t[e]?t[e]:this.tmp[e]}},{key:"unsetOperationFlag",value:function(e){return Object(a.a)(!1,"As of slate@0.41.0 the `change.unsetOperationFlag` method has been deprecated."),delete this.tmp[e],this}},{key:"withoutNormalization",value:function(e){return Object(a.a)(!1,"As of slate@0.41.0 the `change.withoutNormalization` helper has been renamed to `change.withoutNormalizing`."),this.withoutNormalizing(e)}}]),e}();function yt(e,t){var n=!0,r=!1,o=void 0;try{for(var i,a=t[Symbol.iterator]();!(n=(i=a.next()).done);n=!0){var s=i.value,l=!0,u=!1,c=void 0;try{for(var d,p=Object.getOwnPropertyNames(e)[Symbol.iterator]();!(l=(d=p.next()).done);l=!0){var f=d.value;if(!s.hasOwnProperty(f)){var h=Object.getOwnPropertyDescriptor(e,f);Object.defineProperty(s,f,h)}}}catch(e){u=!0,c=e}finally{try{!l&&p.return&&p.return()}finally{if(u)throw c}}var m=!0,g=!1,_=void 0;try{for(var v,y=Object.getOwnPropertyNames(e.prototype)[Symbol.iterator]();!(m=(v=y.next()).done);m=!0){var b=v.value;if(!s.prototype.hasOwnProperty(b)){h=Object.getOwnPropertyDescriptor(e.prototype,b);Object.defineProperty(s.prototype,b,h)}}}catch(e){g=!0,_=e}finally{try{!m&&y.return&&y.return()}finally{if(g)throw _}}}}catch(e){r=!0,o=e}finally{try{!n&&a.return&&a.return()}finally{if(r)throw o}}}function bt(e){var t=Ie[e],n="is"+(""+e.charAt(0).toUpperCase()+e.slice(1)),r=function(){function t(){E(this,t)}return S(t,[{key:"object",get:function(){return e}}]),t}();return r[n]=Ne.bind(null,e),r.prototype[t]=!0,r}Object.keys(ut).forEach(function(e){vt.prototype[e]=function(){for(var t=arguments.length,n=Array(t),r=0;r1?r-1:0),i=1;i1&&void 0!==arguments[1]?arguments[1]:1;return(e=this.resolvePath(e))&&this.getNode(e)?e.size-1+t:null}},{key:"getDescendant",value:function(e){if(!(e=this.resolvePath(e)))return null;var t=e.flatMap(function(e){return["nodes",e]});return this.getIn(t)}},{key:"getFragmentAtRange",value:function(e){if((e=this.resolveRange(e)).isUnset)return A.create();for(var t=e,n=t.start,r=t.end,o=this,i=r.path,a=r.offset,s="end";i.size;){var l=i.last();o=o.splitNode(i,a),a=l+1,(i=ye.lift(i)).size||"end"!==s||(i=n.path,a=n.offset,s="start")}var u=n.path.first()+1,c=r.path.first()+2,d=o.nodes.slice(u,c);return A.create({nodes:d})}},{key:"getFurthest",value:function(e,t){var n=this,r=this.getAncestors(e);return r&&r.find(function(e){for(var r=arguments.length,o=Array(r>1?r-1:0),i=1;i1}).last()||null}},{key:"getInlines",value:function(){var e=this.getInlinesAsArray();return Object(i.List)(e)}},{key:"getInlinesAsArray",value:function(){var e=[];return this.nodes.forEach(function(t){"text"!=t.object&&(t.isLeafInline()?e.push(t):e=e.concat(t.getInlinesAsArray()))}),e}},{key:"getInlinesAtRange",value:function(e){var t=this.getInlinesAtRangeAsArray(e);return Object(i.List)(Object(i.OrderedSet)(t))}},{key:"getInlinesAtRangeAsArray",value:function(e){var t=this;return(e=this.resolveRange(e)).isUnset?[]:this.getTextsAtRangeAsArray(e).map(function(e){return t.getClosestInline(e.key)}).filter(function(e){return e})}},{key:"getInlinesByType",value:function(e){var t=this.getInlinesByTypeAsArray(e);return Object(i.List)(t)}},{key:"getInlinesByTypeAsArray",value:function(e){return this.nodes.reduce(function(t,n){return"text"==n.object?t:n.isLeafInline()&&n.type==e?(t.push(n),t):t.concat(n.getInlinesByTypeAsArray(e))},[])}},{key:"getInsertMarksAtRange",value:function(e){var t=(e=this.resolveRange(e)).start;return e.isUnset?Object(i.Set)():e.isCollapsed?this.getMarksAtPosition(t.key,t.offset):this.getDescendant(t.key).getMarksAtIndex(t.offset+1)}},{key:"getMarks",value:function(){var e=this.getMarksAsArray();return Object(i.Set)(e)}},{key:"getMarksAsArray",value:function(){var e,t=[];return this.nodes.forEach(function(e){t.push(e.getMarksAsArray())}),(e=[]).concat.apply(e,t)}},{key:"getMarksAtPosition",value:function(e,t){var n=this.getDescendant(e).getMarksAtIndex(t);if(0!==t)return n;var r=this.getClosestBlock(e);if(""===r.text)return n;var o=this.getPreviousText(e);return o?r.hasDescendant(o.key)?o.getMarksAtIndex(o.text.length):n:Object(i.Set)()}},{key:"getMarksAtRange",value:function(e){return Object(i.Set)(this.getOrderedMarksAtRange(e))}},{key:"getMarksByType",value:function(e){var t=this.getMarksByTypeAsArray(e);return Object(i.Set)(t)}},{key:"getMarksByTypeAsArray",value:function(e){return this.nodes.reduce(function(t,n){return"text"==n.object?t.concat(n.getMarksAsArray().filter(function(t){return t.type==e})):t.concat(n.getMarksByTypeAsArray(e))},[])}},{key:"getNextBlock",value:function(e){var t=this.assertDescendant(e),n=void 0;"block"==t.object?n=t.getLastText():n=this.getClosestBlock(e).getLastText();var r=this.getNextText(n.key);return r?this.getClosestBlock(r.key):null}},{key:"getNextNode",value:function(e){if(!(e=this.resolvePath(e)))return null;if(!e.size)return null;for(var t=e.size;t>0;t--){var n=e.slice(0,t),r=ye.increment(n),o=this.getNode(r);if(o)return o}return null}},{key:"getNextSibling",value:function(e){if(!(e=this.resolvePath(e)))return null;if(!e.size)return null;var t=ye.increment(e);return this.getNode(t)}},{key:"getNextText",value:function(e){if(!(e=this.resolvePath(e)))return null;if(!e.size)return null;var t=this.getNextNode(e);return t?t.getFirstText():null}},{key:"getOffset",value:function(e){this.assertDescendant(e);var t=this.getFurthestAncestor(e),n=this.nodes.takeUntil(function(e){return e==t}).reduce(function(e,t){return e+t.text.length},0);return this.hasChild(e)?n:n+t.getOffset(e)}},{key:"getOffsetAtRange",value:function(e){if((e=this.resolveRange(e)).isUnset)throw new Error("The range cannot be unset to calculcate its offset.");if(e.isExpanded)throw new Error("The range must be collapsed to calculcate its offset.");var t=e.start;return this.getOffset(t.key)+t.offset}},{key:"getOrderedMarks",value:function(){var e=this.getMarksAsArray();return Object(i.OrderedSet)(e)}},{key:"getOrderedMarksAtRange",value:function(e){var t=e=this.resolveRange(e),n=t.start,r=t.end;return e.isUnset?Object(i.OrderedSet)():e.isCollapsed?this.getMarksAtPosition(n.key,n.offset):this.getOrderedMarksBetweenPositions(n.key,n.offset,r.key,r.offset)}},{key:"getOrderedMarksBetweenPositions",value:function(e,t,n,r){if(e===n)return this.getDescendant(e).getMarksBetweenOffsets(t,r);var o=this.getTextsBetweenPositionsAsArray(e,n);return Object(i.OrderedSet)().withMutations(function(i){o.forEach(function(o){o.key===e?i.union(o.getMarksBetweenOffsets(t,o.text.length)):o.key===n?i.union(o.getMarksBetweenOffsets(0,r)):i.union(o.getMarks())})})}},{key:"getOrderedMarksByType",value:function(e){var t=this.getMarksByTypeAsArray(e);return Object(i.OrderedSet)(t)}},{key:"getParent",value:function(e){if(!(e=this.resolvePath(e)))return null;if(!e.size)return null;var t=ye.lift(e);return this.getNode(t)}},{key:"getPreviousBlock",value:function(e){var t=this.assertDescendant(e),n=void 0;"block"==t.object?n=t.getFirstText():n=this.getClosestBlock(e).getFirstText();var r=this.getPreviousText(n.key);return r?this.getClosestBlock(r.key):null}},{key:"getPreviousNode",value:function(e){if(!(e=this.resolvePath(e)))return null;if(!e.size)return null;for(var t=e.size;t>0;t--){var n=e.slice(0,t);if(0!==n.last()){var r=ye.decrement(n),o=this.getNode(r);if(o)return o}}return null}},{key:"getPreviousSibling",value:function(e){if(!(e=this.resolvePath(e)))return null;if(!e.size)return null;if(0===e.last())return null;var t=ye.decrement(e);return this.getNode(t)}},{key:"getPreviousText",value:function(e){if(!(e=this.resolvePath(e)))return null;if(!e.size)return null;var t=this.getPreviousNode(e);return t?t.getLastText():null}},{key:"getSelectionIndexes",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=e.start,r=e.end;if(!t)return null;if(e.isUnset)return null;if(n.key==r.key){var o=this.getFurthestAncestor(n.key),i=o?this.nodes.indexOf(o):null;return{start:i,end:i+1}}var a=null,s=null;return this.nodes.forEach(function(e,t){return"text"==e.object?(null==a&&e.key==n.key&&(a=t),null==s&&e.key==r.key&&(s=t+1)):(null==a&&e.hasDescendant(n.key)&&(a=t),null==s&&e.hasDescendant(r.key)&&(s=t+1)),null==a||null==s}),t&&null==a&&(a=0),t&&null==s&&(s=this.nodes.size),null==a?null:{start:a,end:s}}},{key:"getTextAtOffset",value:function(e){if(0===e)return this.getFirstText();if(e===this.text.length)return this.getLastText();if(e<0||e>this.text.length)return null;var t=0;return this.getTexts().find(function(n,r,o){return(t+=n.text.length)>e})}},{key:"getTextDirection",value:function(){var e=m()(this.text);return"neutral"===e?null:e}},{key:"getTexts",value:function(){var e=this.getTextsAsArray();return Object(i.List)(e)}},{key:"getTextsAsArray",value:function(){var e=[];return this.nodes.forEach(function(t){"text"==t.object?e.push(t):e=e.concat(t.getTextsAsArray())}),e}},{key:"getTextsAtRange",value:function(e){if((e=this.resolveRange(e)).isUnset)return Object(i.List)();var t=e,n=t.start,r=t.end;return Object(i.List)(this.getTextsBetweenPositionsAsArray(n.key,r.key))}},{key:"getTextsAtRangeAsArray",value:function(e){if((e=this.resolveRange(e)).isUnset)return[];var t=e,n=t.start,r=t.end;return this.getTextsBetweenPositionsAsArray(n.key,r.key)}},{key:"getTextsBetweenPositionsAsArray",value:function(e,t){var n=this.getDescendant(e);if(e==t)return[n];var r=this.getDescendant(t),o=this.getTextsAsArray(),i=o.indexOf(n),a=o.indexOf(r,i);return o.slice(i,a+1)}},{key:"hasBlockChildren",value:function(){return!(!this.nodes||!this.nodes.find(function(e){return"block"===e.object}))}},{key:"hasChild",value:function(e){return!!this.getChild(e)}},{key:"hasInlineChildren",value:function(){return!(!this.nodes||!this.nodes.find(function(e){return"inline"===e.object||"text"===e.object}))}},{key:"hasDescendant",value:function(e){return!!this.getDescendant(e)}},{key:"hasVoidParent",value:function(e,t){return!!this.getClosestVoid(e,t)}},{key:"insertNode",value:function(e,t){var n=(e=this.resolvePath(e)).last(),r=ye.lift(e),o=this.assertNode(r),i=o.nodes.splice(n,0,t);return o=o.set("nodes",i),this.replaceNode(r,o)}},{key:"insertText",value:function(e,t,n,r){var o=this.assertDescendant(e);return e=this.resolvePath(e),o=o.insertText(t,n,r),this.replaceNode(e,o)}},{key:"isLeafBlock",value:function(){var e=this.object,t=this.nodes.first();return"block"===e&&"block"!==t.object}},{key:"isLeafInline",value:function(){var e=this.object,t=this.nodes.first();return"inline"===e&&"inline"!==t.object}},{key:"mapChildren",value:function(e){var t=this,n=this.nodes;return n.forEach(function(r,o){var i=e(r,o,t.nodes);i!==r&&(n=n.set(i.key,i))}),this.set("nodes",n)}},{key:"mapDescendants",value:function(e){var t=this,n=this.nodes;return n.forEach(function(r,o){var i=r;"text"!==i.object&&(i=i.mapDescendants(e)),(i=e(i,o,t.nodes))!==r&&(n=n.set(o,i))}),this.set("nodes",n)}},{key:"mergeNode",value:function(e){var t=this.assertNode(e);if(0===(e=this.resolvePath(e)).last())throw new Error("Unable to merge node because it has no previous sibling: "+t);var n=ye.decrement(e),r=this.assertNode(n);if(r.object!==t.object)throw new Error("Unable to merge two different kinds of nodes: "+r+" and "+t);var o="text"===r.object?r.mergeText(t):r.set("nodes",r.nodes.concat(t.nodes)),i=this;return i=(i=(i=i.removeNode(e)).removeNode(n)).insertNode(n,o)}},{key:"moveNode",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=this.assertNode(e);e=this.resolvePath(e),t=this.resolvePath(t,n);var o=ye.lift(t);this.assertNode(o);var i=ye.crop(e,t),a=T(i,2),s=a[0],l=a[1],u=ye.compare(s,l);e.size1?n-1:0),o=1;o1&&void 0!==arguments[1]?arguments[1]:e;return this.setPoints([this.anchor.moveToStartOfNode(e),this.focus.moveToEndOfNode(t)])}},{key:"moveToStart",value:function(){return this.setEnd(this.start)}},{key:"moveToStartOfNode",value:function(e){return this.updatePoints(function(t){return t.moveToStartOfNode(e)})}},{key:"normalize",value:function(e){return this.updatePoints(function(t){return t.normalize(e)})}},{key:"setAnchor",value:function(e){return this.set("anchor",e)}},{key:"setEnd",value:function(e){return this.isBackward?this.setAnchor(e):this.setFocus(e)}},{key:"setFocus",value:function(e){return this.set("focus",e)}},{key:"setPoints",value:function(e){var t=T(e,2),n=t[0],r=t[1];return this.set("anchor",n).set("focus",r)}},{key:"updatePoints",value:function(e){var t=this.anchor,n=this.focus;return t=e(t),n=e(n),this.merge({anchor:t,focus:n})}},{key:"setStart",value:function(e){return this.isBackward?this.setFocus(e):this.setAnchor(e)}},{key:"setProperties",value:function(e){var t=e=Me.createProperties(e),n=t.anchor,r=t.focus,o=x(t,["anchor","focus"]);return n&&(o.anchor=Fe.create(n)),r&&(o.focus=Fe.create(r)),this.merge(o)}},{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{object:this.object,anchor:this.anchor.toJSON(e),focus:this.focus.toJSON(e)}}},{key:"toRange",value:function(){var e=Me.createProperties(this);return Me.create(e)}},{key:"unset",value:function(){return this.updatePoints(function(e){return e.unset()})}},{key:"isCollapsed",get:function(){return this.anchor===this.focus||this.anchor.key===this.focus.key&&this.anchor.offset===this.focus.offset}},{key:"isExpanded",get:function(){return!this.isCollapsed}},{key:"isBackward",get:function(){var e=this.isUnset,t=this.anchor,n=this.focus;return e?null:t.key===n.key?t.offset>n.offset:ye.isBefore(n.path,t.path)}},{key:"isForward",get:function(){var e=this.isBackward;return null==e?null:!e}},{key:"isUnset",get:function(){var e=this.anchor,t=this.focus;return e.isUnset||t.isUnset}},{key:"isSet",get:function(){return!this.isUnset}},{key:"start",get:function(){return this.isBackward?this.focus:this.anchor}},{key:"end",get:function(){return this.isBackward?this.anchor:this.focus}}]),e}(),[Ae,Me,Le]);var Ft={apply:dt,invert:ft},Dt={Block:Q,Changes:ut,Data:F,Decoration:Ae,Document:A,History:Ke,Inline:N,KeyUtils:y,Leaf:L,Mark:M,Node:W,Operation:gt,Operations:Ft,PathUtils:ye,Point:Fe,Range:Me,resetMemoization:z,Schema:Ze,Selection:Le,Stack:We,Text:Y,TextUtils:le,useMemoization:H,Value:st};t.default=Dt},function(e,t,n){"use strict";var r=function(e){};e.exports=function(e,t,n,o,i,a,s,l){if(r(t),!e){var u;if(void 0===t)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,o,i,a,s,l],d=0;(u=new Error(t.replace(/%s/g,function(){return c[d++]}))).name="Invariant Violation"}throw u.framesToPop=1,u}}},function(e,t,n){var r=n(36);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t,n){e.exports={default:n(1296),__esModule:!0}},function(e,t,n){var r=n(37),o=n(21),i=n(69),a=n(62),s=n(59),l=function(e,t,n){var u,c,d,p=e&l.F,f=e&l.G,h=e&l.S,m=e&l.P,g=e&l.B,_=e&l.W,v=f?o:o[t]||(o[t]={}),y=v.prototype,b=f?r:h?r[t]:(r[t]||{}).prototype;for(u in f&&(n=t),n)(c=!p&&b&&void 0!==b[u])&&s(v,u)||(d=c?b[u]:n[u],v[u]=f&&"function"!=typeof b[u]?n[u]:g&&c?i(d,r):_&&b[u]==d?function(e){var t=function(t,n,r){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,r)}return e.apply(this,arguments)};return t.prototype=e.prototype,t}(d):m&&"function"==typeof d?i(Function.call,d):d,m&&((v.virtual||(v.virtual={}))[u]=d,e&l.R&&y&&!y[u]&&a(y,u,d)))};l.F=1,l.G=2,l.S=4,l.P=8,l.B=16,l.W=32,l.U=64,l.R=128,e.exports=l},function(e,t,n){"use strict";(function(r){Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULTS=void 0;var o=l(n(27)),i=l(n(14)),a=l(n(3)),s=l(n(4));function l(e){return e&&e.__esModule?e:{default:e}}var u=t.DEFAULTS={integrations_ui_url:"https://scalar.vector.im/",integrations_rest_url:"https://scalar.vector.im/api",bug_report_endpoint_url:null},c=function(){function e(){(0,a.default)(this,e)}return(0,s.default)(e,null,[{key:"get",value:function(){return r.mxReactSdkConfig||{}}},{key:"put",value:function(e){for(var t=(0,i.default)(u),n=0;n>>0;if("function"!=typeof e)throw new TypeError;for(var r=[],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&&(n=t);var a=new Array(i);for(r=0;r>>0;if("function"!=typeof e)throw new TypeError(e+" is not a function");for(arguments.length>1&&(n=t),r=0;r1){var i=Object(arguments[1]);for(var a in i)t.call(i,a)&&(r[a]=i[a])}return r}}()),e.super_=t,e.prototype=(0,r.default)(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},e.exports.isNumber=function(e){return"number"==typeof e&&isFinite(e)},e.exports.removeHiddenChars=function(e){return s(e.normalize("NFD").replace(u,""))};var u=/[\u200B-\u200D\u0300-\u036f\uFEFF\s]/g;function c(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}e.exports.escapeRegExp=c,e.exports.globToRegexp=function(e,t){t="boolean"!=typeof t||t;var n=c(e);return n=(n=n.replace(/\\\*/g,".*")).replace(/\?/g,"."),t&&(n=n.replace(/\\\[(!|)(.*)\\]/g,function(e,t,n,r,o){return"["+(t?"^":"")+n.replace(/\\-/,"-")+"]"})),n}},function(e,t,n){"use strict";t.__esModule=!0;var r,o=n(27),i=(r=o)&&r.__esModule?r:{default:r};t.default=i.default||function(e){for(var t=1;t * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. */var r=n(2277);function o(e){return!0===r(e)&&"[object Object]"===Object.prototype.toString.call(e)}e.exports=function(e){var t,n;return!1!==o(e)&&("function"==typeof(t=e.constructor)&&(!1!==o(n=t.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf")))}},function(e,t,n){var r=n(102),o=Math.min;e.exports=function(e){return e>0?o(r(e),9007199254740991):0}},function(e,t,n){"use strict";t.__esModule=!0;var r,o=n(241),i=(r=o)&&r.__esModule?r:{default:r};t.default=function(e,t,n){return t in e?(0,i.default)(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t,n){e.exports=!n(58)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,n){"use strict"; /* object-assign (c) Sindre Sorhus @license MIT */var r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,a,s=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),l=1;l0&&a.length>o&&!a.warned){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=a.length,s=l,console&&console.warn&&console.warn(s)}return e}function d(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=function(){for(var e=[],t=0;t0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var l=o[e];if(void 0===l)return!1;if("function"==typeof l)i(l,this,t);else{var u=l.length,c=h(l,u);for(n=0;n=0;i--)if(n[i]===t||n[i].listener===t){a=n[i].listener,o=i;break}if(o<0)return this;0===o?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},s.prototype.listeners=function(e){return p(this,e,!0)},s.prototype.rawListeners=function(e){return p(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},s.prototype.listenerCount=f,s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){"use strict";e.exports=n(1342)},function(e,t,n){var r=n(119);e.exports=function(e){return Object(r(e))}},function(e,t,n){var r=n(2311);e.exports=function(e){if(t=e,t&&t.window===t)return e;var t;var n=r(e);if(o){n.parentWindow.execScript("document._parentWindow = window;","Javascript");var i=n._parentWindow;return n._parentWindow=null,i}return n.defaultView||n.parentWindow};var o=n(2312)},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var r=n(172),o=n(123);e.exports=function(e){return r(o(e))}},function(e,t,n){"use strict";t.__esModule=!0;var r=i(n(424)),o=i(n(17));function i(e){return e&&e.__esModule?e:{default:e}}t.default=function(){return function(e,t){if(Array.isArray(e))return e;if((0,r.default)(Object(e)))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var s,l=(0,o.default)(e);!(r=(s=l.next()).done)&&(n.push(s.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&l.return&&l.return()}finally{if(i)throw a}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}()},function(e,t,n){var r=n(48),o=n(80);e.exports=n(46)?function(e,t,n){return r.f(e,t,o(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){"use strict";t.a=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(!e){var n=console.warn||console.log;n("Warning: "+t)}}},function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var l,u=[],c=!1,d=-1;function p(){c&&l&&(c=!1,l.length?u=l.concat(u):d=-1,u.length&&f())}function f(){if(!c){var e=s(p);c=!0;for(var t=u.length;t;){for(l=u,u=[];++d1)for(var n=1;n"):e.replace(f,"#/$1"):(console.warn('Unexpected hash location "'+e+'"'),"#/")}(n)}var g={"App Platform":{id:1,expl:(0,s._td)("The platform you're on"),example:"Electron Platform"},"App Version":{id:2,expl:(0,s._td)("The version of Riot.im"),example:"15.0.0"},"User Type":{id:3,expl:(0,s._td)("Whether or not you're logged in (we don't record your username)"),example:"Logged In"},"Chosen Language":{id:4,expl:(0,s._td)("Your language of choice"),example:"en"},Instance:{id:5,expl:(0,s._td)("Which officially provided instance you are using, if any"),example:"app"},"RTE: Uses Richtext Mode":{id:6,expl:(0,s._td)("Whether or not you're using the Richtext mode of the Rich Text Editor"),example:"off"},Breadcrumbs:{id:9,expl:(0,s._td)("Whether or not you're using the 'breadcrumbs' feature (avatars above the room list)"),example:"disabled"},"Homeserver URL":{id:7,expl:(0,s._td)("Your homeserver's URL"),example:"https://matrix.org"},"Identity Server URL":{id:8,expl:(0,s._td)("Your identity server's URL"),example:"https://vector.im"}};function _(e,t){return e.includes(t)?t:""}var v=function(){function e(){(0,i.default)(this,e),this._paq=null,this.disabled=!0,this.firstPage=!0}return(0,a.default)(e,[{key:"enable",value:function(){(this._paq||this._init())&&(this.disabled=!1)}},{key:"disable",value:function(){this.trackEvent("Analytics","opt-out"),this._paq.push(["disableHeartBeatTimer"]),this.disabled=!0}},{key:"_init",value:function(){var e=this,t=u.default.get();if(t&&t.piwik&&t.piwik.url&&t.piwik.siteId){var n=t.piwik.url,r=t.piwik.siteId,o=this;window._paq=this._paq=window._paq||[],this._paq.push(["setTrackerUrl",n+"piwik.php"]),this._paq.push(["setSiteId",r]),this._paq.push(["trackAllContentImpressions"]),this._paq.push(["discardHashTag",!1]),this._paq.push(["enableHeartBeatTimer"]);var i,a,c=l.default.get();return this._setVisitVariable("App Platform",c.getHumanReadableName()),c.getAppVersion().then(function(t){e._setVisitVariable("App Version",t)}).catch(function(){e._setVisitVariable("App Version","unknown")}),this._setVisitVariable("Chosen Language",(0,s.getCurrentLanguage)()),"riot.im"===window.location.hostname&&this._setVisitVariable("Instance",window.location.pathname),i=document.createElement("script"),a=document.getElementsByTagName("script")[0],i.type="text/javascript",i.async=!0,i.defer=!0,i.src=n+"piwik.js",i.onload=function(){console.log("Initialised anonymous analytics"),o._paq=window._paq},a.parentNode.insertBefore(i,a),!0}}},{key:"trackPageChange",value:function(e){this.disabled||(this.firstPage?this.firstPage=!1:("number"==typeof e?this._paq.push(["setGenerationTimeMs",e]):console.warn("Analytics.trackPageChange: expected generationTimeMs to be a number"),this._paq.push(["setCustomUrl",m()]),this._paq.push(["trackPageView"])))}},{key:"trackEvent",value:function(e,t,n,r){this.disabled||(this._paq.push(["setCustomUrl",m()]),this._paq.push(["trackEvent",e,t,n,r]))}},{key:"logout",value:function(){this.disabled||this._paq.push(["deleteCookies"])}},{key:"_setVisitVariable",value:function(e,t){this.disabled||this._paq.push(["setCustomVariable",g[e].id,e,t,"visit"])}},{key:"setLoggedIn",value:function(e,t,n){if(!this.disabled){var r=u.default.get();if(r.piwik){var o=r.piwik.whitelistedHSUrls||[],i=r.piwik.whitelistedISUrls||[];this._setVisitVariable("User Type",e?"Guest":"Logged In"),this._setVisitVariable("Homeserver URL",_(o,t)),this._setVisitVariable("Identity Server URL",_(i,n))}}}},{key:"setRichtextMode",value:function(e){this.disabled||this._setVisitVariable("RTE: Uses Richtext Mode",e?"on":"off")}},{key:"setBreadcrumbs",value:function(e){this.disabled||this._setVisitVariable("Breadcrumbs",e?"enabled":"disabled")}},{key:"showDetailsModal",value:function(){var e=[];if(window.Piwik){var t=window.Piwik.getAsyncTracker();e=(0,o.default)(g).map(function(e){return t.getCustomVariable(e.id)}).filter(Boolean)}else e=(0,r.default)(g).map(function(e){return[e,(0,s._t)("e.g. %(exampleValue)s",{exampleValue:g[e].example})]});var n=window.screen.width+"x"+window.screen.height,i=[{expl:(0,s._td)("Every page you use in the app"),value:(0,s._t)("e.g. ",{},{CurrentPageURL:m()})},{expl:(0,s._td)("Your User Agent"),value:navigator.userAgent},{expl:(0,s._td)("Your device resolution"),value:n}],a=d.default.getComponent("dialogs.ErrorDialog");c.default.createTrackedDialog("Analytics Details","",a,{title:(0,s._t)("Analytics"),description:React.createElement("div",{className:"mx_AnalyticsModal"},React.createElement("div",null,(0,s._t)("The information being sent to us to help make Riot.im better includes:")),React.createElement("table",null,e.map(function(e){return React.createElement("tr",{key:e[0]},React.createElement("td",null,(0,s._t)(g[e[0]].expl)),void 0!==e[1]&&React.createElement("td",null,React.createElement("code",null,e[1])))}),i.map(function(e,t){return React.createElement("tr",{key:t},React.createElement("td",null,(0,s._t)(e.expl)),React.createElement("td",null,React.createElement("code",null,e.value)))})),React.createElement("div",null,(0,s._t)("Where this page includes identifiable information, such as a room, user or group ID, that data is removed before being sent to the server.")))})}}]),e}();t.mxAnalytics||(t.mxAnalytics=new v),e.exports=t.mxAnalytics}).call(this,n(18))},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,n){e.exports={default:n(400),__esModule:!0}},function(e,t,n){var r=n(105);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,o){return e.call(t,n,r,o)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){var r=n(28),o=n(21),i=n(58);e.exports=function(e,t){var n=(o.Object||{})[e]||Object[e],a={};a[e]=t(n),r(r.S+r.F*i(function(){n(1)}),"Object",a)}},function(e,t,n){"use strict";var r=!("undefined"==typeof window||!window.document||!window.document.createElement),o={canUseDOM:r,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:r&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:r&&!!window.screen,isInWorker:!r};e.exports=o},function(e,t,n){e.exports={default:n(1443),__esModule:!0}},function(e,t,n){"use strict";var r=n(1469),o=n(1470);function i(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=y,t.resolve=function(e,t){return y(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?y(e,!1,!0).resolveObject(t):t},t.format=function(e){o.isString(e)&&(e=y(e));return e instanceof i?e.format():i.prototype.format.call(e)},t.Url=i;var a=/^([a-z0-9.+-]+:)/i,s=/:[0-9]*$/,l=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,u=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),c=["'"].concat(u),d=["%","/","?",";","#"].concat(c),p=["/","?","#"],f=/^[+a-z0-9A-Z_-]{0,63}$/,h=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},g={javascript:!0,"javascript:":!0},_={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},v=n(305);function y(e,t,n){if(e&&o.isObject(e)&&e instanceof i)return e;var r=new i;return r.parse(e,t,n),r}i.prototype.parse=function(e,t,n){if(!o.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var i=e.indexOf("?"),s=-1!==i&&i127?N+="x":N+=I[O];if(!N.match(f)){var P=D.slice(0,T),L=D.slice(T+1),U=I.match(h);U&&(P.push(U[1]),L.unshift(U[2])),L.length&&(y="/"+L.join(".")+y),this.hostname=P.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),F||(this.hostname=r.toASCII(this.hostname));var B=this.port?":"+this.port:"",j=this.hostname||"";this.host=j+B,this.href+=this.host,F&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==y[0]&&(y="/"+y))}if(!m[S])for(T=0,A=c.length;T0)&&n.host.split("@"))&&(n.auth=F.shift(),n.host=n.hostname=F.shift());return n.search=e.search,n.query=e.query,o.isNull(n.pathname)&&o.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!w.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var x=w.slice(-1)[0],k=(n.host||e.host||w.length>1)&&("."===x||".."===x)||""===x,T=0,R=w.length;R>=0;R--)"."===(x=w[R])?w.splice(R,1):".."===x?(w.splice(R,1),T++):T&&(w.splice(R,1),T--);if(!E&&!S)for(;T--;T)w.unshift("..");!E||""===w[0]||w[0]&&"/"===w[0].charAt(0)||w.unshift(""),k&&"/"!==w.join("/").substr(-1)&&w.push("");var F,D=""===w[0]||w[0]&&"/"===w[0].charAt(0);C&&(n.hostname=n.host=D?"":w.length?w.shift():"",(F=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=F.shift(),n.host=n.hostname=F.shift()));return(E=E||n.host&&w.length)&&!D&&w.unshift(""),w.length?n.pathname=w.join("/"):(n.pathname=null,n.path=null),o.isNull(n.pathname)&&o.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},i.prototype.parseHost=function(){var e=this.host,t=s.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,n){"use strict";var r,o=y(n(14)),i=y(n(45)),a=y(n(6)),s=y(n(3)),l=y(n(4)),u=y(n(7)),c=y(n(8)),d=y(n(15)),p=y(n(49)),f=n(10),h=(r=(0,f.coroutine)(d.default.mark(function e(t){return d.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(S>=w)){e.next=3;break}return e.next=3,(0,f.resolve)(new p.default(function(e,t){C.push(e)}));case 3:return S++,e.prev=4,e.next=7,(0,f.resolve)(t());case 7:return e.abrupt("return",e.sent);case 10:throw e.prev=10,e.t0=e.catch(4),e.t0;case 13:return e.prev=13,S--,x(),e.finish(13);case 17:case"end":return e.stop()}},e,this,[[4,10,13,17]])})),function(e){return r.apply(this,arguments)}),m=y(n(54)),g=n(253),_=y(n(154)),v=y(n(9));function y(e){return e&&e.__esModule?e:{default:e}}function b(e){return e.chunk.map(function(e){return(0,g.groupMemberFromApiObject)(e)})}function E(e){return e.chunk.map(function(e){return(0,g.groupRoomFromApiObject)(e)})}var S=0,w=3,C=[];function x(){var e=C.shift();"function"==typeof e&&e()}var k=function(e){function t(){var e,n;(0,s.default)(this,t);var r=(0,u.default)(this,(t.__proto__||(0,a.default)(t)).call(this));return r.STATE_KEY={GroupMembers:"GroupMembers",GroupInvitedMembers:"GroupInvitedMembers",Summary:"Summary",GroupRooms:"GroupRooms"},r._state={},r._state[r.STATE_KEY.Summary]={},r._state[r.STATE_KEY.GroupRooms]={},r._state[r.STATE_KEY.GroupMembers]={},r._state[r.STATE_KEY.GroupInvitedMembers]={},r._ready={},r._ready[r.STATE_KEY.Summary]={},r._ready[r.STATE_KEY.GroupRooms]={},r._ready[r.STATE_KEY.GroupMembers]={},r._ready[r.STATE_KEY.GroupInvitedMembers]={},r._fetchResourcePromise=(e={},(0,i.default)(e,r.STATE_KEY.Summary,{}),(0,i.default)(e,r.STATE_KEY.GroupRooms,{}),(0,i.default)(e,r.STATE_KEY.GroupMembers,{}),(0,i.default)(e,r.STATE_KEY.GroupInvitedMembers,{}),e),r._resourceFetcher=(n={},(0,i.default)(n,r.STATE_KEY.Summary,function(e){return h(function(){return v.default.get().getGroupSummary(e)})}),(0,i.default)(n,r.STATE_KEY.GroupRooms,function(e){return h(function(){return v.default.get().getGroupRooms(e).then(E)})}),(0,i.default)(n,r.STATE_KEY.GroupMembers,function(e){return h(function(){return v.default.get().getGroupUsers(e).then(b)})}),(0,i.default)(n,r.STATE_KEY.GroupInvitedMembers,function(e){return h(function(){return v.default.get().getGroupInvitedUsers(e).then(b)})}),n),r}return(0,c.default)(t,e),(0,l.default)(t,[{key:"_fetchResource",value:function(e,t){var n=this;if(!this._fetchResourcePromise[e][t]){var r=this._resourceFetcher[e](t);return this._fetchResourcePromise[e][t]=r,r.then(function(r){n._state[e][t]=r,n._ready[e][t]=!0,n._notifyListeners()}).catch(function(r){e===n.STATE_KEY.GroupInvitedMembers&&403===r.httpStatus||(console.error("Failed to get resource "+e+" for "+t,r),n.emit("error",r,t,e))}).finally(function(){delete n._fetchResourcePromise[e][t]}),r}}},{key:"_notifyListeners",value:function(){this.emit("update")}},{key:"registerListener",value:function(e,t){var n=this;return this.on("update",t),this.emit("update"),e&&(this._fetchResource(this.STATE_KEY.Summary,e),this._fetchResource(this.STATE_KEY.GroupRooms,e),this._fetchResource(this.STATE_KEY.GroupMembers,e),this._fetchResource(this.STATE_KEY.GroupInvitedMembers,e)),{unregister:function(){n.unregisterListener(t)}}}},{key:"unregisterListener",value:function(e){this.removeListener("update",e)}},{key:"isStateReady",value:function(e,t){return this._ready[t][e]}},{key:"getGroupIdsForRoomId",value:function(e){var t=this;return(0,o.default)(this._state[this.STATE_KEY.GroupRooms]).filter(function(n){return(t._state[t.STATE_KEY.GroupRooms][n]||[]).some(function(t){return t.roomId===e})})}},{key:"getSummary",value:function(e){return this._state[this.STATE_KEY.Summary][e]||{}}},{key:"getGroupRooms",value:function(e){return this._state[this.STATE_KEY.GroupRooms][e]||[]}},{key:"getGroupMembers",value:function(e){return this._state[this.STATE_KEY.GroupMembers][e]||[]}},{key:"getGroupInvitedMembers",value:function(e){return this._state[this.STATE_KEY.GroupInvitedMembers][e]||[]}},{key:"getGroupPublicity",value:function(e){return(this._state[this.STATE_KEY.Summary][e]||{}).user?(this._state[this.STATE_KEY.Summary][e]||{}).user.is_publicised:null}},{key:"isUserPrivileged",value:function(e){return(this._state[this.STATE_KEY.Summary][e]||{}).user?(this._state[this.STATE_KEY.Summary][e]||{}).user.is_privileged:null}},{key:"refreshGroupRooms",value:function(e){return this._fetchResource(this.STATE_KEY.GroupRooms,e)}},{key:"refreshGroupMembers",value:function(e){return this._fetchResource(this.STATE_KEY.GroupMembers,e)}},{key:"addRoomToGroup",value:function(e,t,n){return v.default.get().addRoomToGroup(e,t,n).then(this._fetchResource.bind(this,this.STATE_KEY.GroupRooms,e))}},{key:"updateGroupRoomVisibility",value:function(e,t,n){return v.default.get().updateGroupRoomVisibility(e,t,n).then(this._fetchResource.bind(this,this.STATE_KEY.GroupRooms,e))}},{key:"removeRoomFromGroup",value:function(e,t){return v.default.get().removeRoomFromGroup(e,t).then(this._fetchResource.bind(this,this.STATE_KEY.Summary,e)).then(this._fetchResource.bind(this,this.STATE_KEY.GroupRooms,e))}},{key:"inviteUserToGroup",value:function(e,t){return v.default.get().inviteUserToGroup(e,t).then(this._fetchResource.bind(this,this.STATE_KEY.GroupInvitedMembers,e))}},{key:"acceptGroupInvite",value:function(e){return v.default.get().acceptGroupInvite(e).then(this._fetchResource.bind(this,this.STATE_KEY.Summary,e)).then(this._fetchResource.bind(this,this.STATE_KEY.GroupRooms,e)).then(this._fetchResource.bind(this,this.STATE_KEY.GroupMembers,e)).then(this._fetchResource.bind(this,this.STATE_KEY.GroupInvitedMembers,e))}},{key:"joinGroup",value:function(e){return v.default.get().joinGroup(e).then(this._fetchResource.bind(this,this.STATE_KEY.Summary,e)).then(this._fetchResource.bind(this,this.STATE_KEY.GroupRooms,e)).then(this._fetchResource.bind(this,this.STATE_KEY.GroupMembers,e)).then(this._fetchResource.bind(this,this.STATE_KEY.GroupInvitedMembers,e))}},{key:"leaveGroup",value:function(e){return v.default.get().leaveGroup(e).then(this._fetchResource.bind(this,this.STATE_KEY.Summary,e)).then(this._fetchResource.bind(this,this.STATE_KEY.GroupRooms,e)).then(this._fetchResource.bind(this,this.STATE_KEY.GroupMembers,e))}},{key:"addRoomToGroupSummary",value:function(e,t,n){return v.default.get().addRoomToGroupSummary(e,t,n).then(this._fetchResource.bind(this,this.STATE_KEY.Summary,e))}},{key:"addUserToGroupSummary",value:function(e,t,n){return v.default.get().addUserToGroupSummary(e,t,n).then(this._fetchResource.bind(this,this.STATE_KEY.Summary,e))}},{key:"removeRoomFromGroupSummary",value:function(e,t){return v.default.get().removeRoomFromGroupSummary(e,t).then(this._fetchResource.bind(this,this.STATE_KEY.Summary,e))}},{key:"removeUserFromGroupSummary",value:function(e,t){return v.default.get().removeUserFromGroupSummary(e,t).then(this._fetchResource.bind(this,this.STATE_KEY.Summary,e))}},{key:"setGroupPublicity",value:function(e,t){return v.default.get().setGroupPublicity(e,t).then(function(){_.default.invalidatePublicisedGroups(v.default.get().credentials.userId)}).then(this._fetchResource.bind(this,this.STATE_KEY.Summary,e))}}]),t}(m.default),T=null;T||(T=new k),e.exports=T},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.closest=t.distance=t.patch=t.absolute=t.negate=t.isEqual=t.subtract=t.add=void 0;var r=i(n(34)),o=i(n(45));function i(e){return e&&e.__esModule?e:{default:e}}t.add=function(e,t){return{x:e.x+t.x,y:e.y+t.y}},t.subtract=function(e,t){return{x:e.x-t.x,y:e.y-t.y}},t.isEqual=function(e,t){return e.x===t.x&&e.y===t.y},t.negate=function(e){return{x:0!==e.x?-e.x:0,y:0!==e.y?-e.y:0}},t.absolute=function(e){return{x:Math.abs(e.x),y:Math.abs(e.y)}},t.patch=function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return n={},(0,o.default)(n,e,t),(0,o.default)(n,"x"===e?"y":"x",r),n};var a=t.distance=function(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))};t.closest=function(e,t){return Math.min.apply(Math,(0,r.default)(t.map(function(t){return a(e,t)})))}},function(e,t,n){"use strict";(function(t){var r=i(n(3)),o=i(n(4));function i(e){return e&&e.__esModule?e:{default:e}}var a=function(){function e(){(0,r.default)(this,e),this.platform=null}return(0,o.default)(e,[{key:"get",value:function(){return this.platform}},{key:"set",value:function(e){this.platform=e}}]),e}();t.mxPlatformPeg||(t.mxPlatformPeg=new a),e.exports=t.mxPlatformPeg}).call(this,n(18))},function(e,t,n){var r=n(51),o=n(159);e.exports=n(50)?function(e,t,n){return r.f(e,t,o(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){var r=n(30),o=n(77),i=n(87),a=n(160)("src"),s=n(1094),l=(""+s).split("toString");n(99).inspectSource=function(e){return s.call(e)},(e.exports=function(e,t,n,s){var u="function"==typeof n;u&&(i(n,"name")||o(n,"name",t)),e[t]!==n&&(u&&(i(n,a)||o(n,a,e[t]?""+e[t]:l.join(String(t)))),e===r?e[t]=n:s?e[t]?e[t]=n:o(e,t,n):(delete e[t],o(e,t,n)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[a]||s.call(this)})},function(e,t,n){var r=n(12),o=n(35),i=n(119),a=/"/g,s=function(e,t,n,r){var o=String(i(e)),s="<"+t;return""!==n&&(s+=" "+n+'="'+String(r).replace(a,""")+'"'),s+">"+o+""};e.exports=function(e,t){var n={};n[e]=t(s),r(r.P+r.F*o(function(){var t=""[e]('"');return t!==t.toLowerCase()||t.split('"').length>3}),"String",n)}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t){e.exports={}},function(e,t,n){var r=n(171),o=n(134);e.exports=Object.keys||function(e){return r(e,o)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RoomPermalinkCreator=t.baseUrl=t.host=void 0;var r=p(n(14)),o=p(n(17)),i=p(n(61)),a=p(n(200)),s=p(n(3)),l=p(n(4));t.makeUserPermalink=function(e){return h+"/#/"+e},t.makeRoomPermalink=function(e){var t=h+"/#/"+e;if(!e)throw new Error("can't permalink a falsey roomId");if("!"!==e[0])return t;var n=u.default.get().getRoom(e);if(!n)return t;var r=new m(n);return r.load(),r.forRoom()},t.makeGroupPermalink=function(e){return h+"/#/"+e},t.encodeServerCandidates=g;var u=p(n(9)),c=p(n(1683)),d=p(n(31));function p(e){return e&&e.__esModule?e:{default:e}}var f=t.host="matrix.to",h=t.baseUrl="https://"+f,m=t.RoomPermalinkCreator=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if((0,s.default)(this,e),this._room=t,this._roomId=t?t.roomId:n,this._highestPlUserId=null,this._populationMap=null,this._bannedHostsRegexps=null,this._allowedHostsRegexps=null,this._serverCandidates=null,this._started=!1,!this._roomId)throw new Error("Failed to resolve a roomId for the permalink creator to use");this.onMembership=this.onMembership.bind(this),this.onRoomState=this.onRoomState.bind(this)}return(0,l.default)(e,[{key:"load",value:function(){this._room&&this._room.currentState?(this._updateAllowedServers(),this._updateHighestPlUser(),this._updatePopulationMap(),this._updateServerCandidates()):console.warn("Tried to load a permalink creator with no room state")}},{key:"start",value:function(){this.load(),this._room.on("RoomMember.membership",this.onMembership),this._room.on("RoomState.events",this.onRoomState),this._started=!0}},{key:"stop",value:function(){this._room.removeListener("RoomMember.membership",this.onMembership),this._room.removeListener("RoomState.events",this.onRoomState),this._started=!1}},{key:"isStarted",value:function(){return this._started}},{key:"forEvent",value:function(e){var t=this._roomId;return""+(h+"/#/"+t+"/"+e)+g(this._serverCandidates)}},{key:"forRoom",value:function(){var e=this._roomId;return""+(h+"/#/"+e)+g(this._serverCandidates)}},{key:"onRoomState",value:function(e){switch(e.getType()){case"m.room.server_acl":return this._updateAllowedServers(),this._updateHighestPlUser(),this._updatePopulationMap(),void this._updateServerCandidates();case"m.room.power_levels":return this._updateHighestPlUser(),void this._updateServerCandidates()}}},{key:"onMembership",value:function(e,t,n){var r=t.userId,o=t.membership,i=_(r),a="join"!==n&&"join"===o;"join"===n&&"join"!==o?this._populationMap[i]--:a&&this._populationMap[i]++,this._updateHighestPlUser(),this._updateServerCandidates()}},{key:"_updateHighestPlUser",value:function(){var e=this,t=this._room.currentState.getStateEvents("m.room.power_levels","");if(t){var n=t.getContent();if(n){var r=n.users;if(r){var o=(0,a.default)(r).filter(function(t){var n=(0,i.default)(t,1)[0],r=e._room.getMember(n);if(!r||"join"!==r.membership)return!1;var o=_(n);return!b(o)&&!y(o,e._bannedHostsRegexps)&&y(o,e._allowedHostsRegexps)}).reduce(function(e,t){return t[1]>e[1]?t:e},[null,0]),s=(0,i.default)(o,2),l=s[0],u=s[1];if(null!==l&&u>=50)return void(this._highestPlUserId=l)}}}this._highestPlUserId=null}},{key:"_updateAllowedServers",value:function(){var e=[],t=[new RegExp(".*")];if(this._room.currentState){var n=this._room.currentState.getStateEvents("m.room.server_acl","");if(n&&n.getContent()){var r=function(e){return new RegExp("^"+d.default.globToRegexp(e,!1)+"$")};(n.getContent().deny||[]).forEach(function(t){return e.push(r(t))});var o=n.getContent().allow||[];t=[],o.forEach(function(e){return t.push(r(e))})}}this._bannedHostsRegexps=e,this._allowedHostsRegexps=t}},{key:"_updatePopulationMap",value:function(){var e={},t=!0,n=!1,r=void 0;try{for(var i,a=(0,o.default)(this._room.getJoinedMembers());!(t=(i=a.next()).done);t=!0){var s=_(i.value.userId);e[s]||(e[s]=0),e[s]++}}catch(e){n=!0,r=e}finally{try{!t&&a.return&&a.return()}finally{if(n)throw r}}this._populationMap=e}},{key:"_updateServerCandidates",value:function(){var e=this,t=[];this._highestPlUserId&&t.push(_(this._highestPlUserId));var n=(0,r.default)(this._populationMap).sort(function(t,n){return e._populationMap[n]-e._populationMap[t]}).filter(function(n){return!t.includes(n)&&!b(n)&&!y(n,e._bannedHostsRegexps)&&y(n,e._allowedHostsRegexps)}).slice(0,3-t.length);t=t.concat(n),this._serverCandidates=t}}]),e}();function g(e){return e&&0!==e.length?"?via="+e.map(function(e){return encodeURIComponent(e)}).join("&via="):""}function _(e){return e.split(":").splice(1).join(":")}function v(e){return e?new URL("https://"+e).hostname:null}function y(e,t){if(!(e=v(e)))return!0;if(t.length>0&&!t[0].test)throw new Error(t[0]);return t.filter(function(t){return t.test(e)}).length>0}function b(e){return!!(e=v(e))&&(e.startsWith("[")&&e.endsWith("]")&&(e=e.substring(1,e.length-1)),(0,c.default)(e))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isOnlyCtrlOrCmdKeyEvent=function(e){return navigator.platform.toUpperCase().indexOf("MAC")>=0?e.metaKey&&!e.altKey&&!e.ctrlKey&&!e.shiftKey:e.ctrlKey&&!e.altKey&&!e.metaKey&&!e.shiftKey},t.isOnlyCtrlOrCmdIgnoreShiftKeyEvent=function(e){return navigator.platform.toUpperCase().indexOf("MAC")>=0?e.metaKey&&!e.altKey&&!e.ctrlKey:e.ctrlKey&&!e.altKey&&!e.metaKey};t.KeyCode={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,ESCAPE:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46,KEY_A:65,KEY_B:66,KEY_C:67,KEY_D:68,KEY_E:69,KEY_F:70,KEY_G:71,KEY_H:72,KEY_I:73,KEY_J:74,KEY_K:75,KEY_L:76,KEY_M:77,KEY_N:78,KEY_O:79,KEY_P:80,KEY_Q:81,KEY_R:82,KEY_S:83,KEY_T:84,KEY_U:85,KEY_V:86,KEY_W:87,KEY_X:88,KEY_Y:89,KEY_Z:90}},function(e,t,n){"use strict";n.r(t);var r=function(e,t){return e===t};t.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r,n=void 0,o=[],i=void 0,a=!1,s=function(e,n){return t(e,o[n])};return function(){for(var t=arguments.length,r=Array(t),l=0;l=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t){e.exports=!0},function(e,t,n){var r=n(123);e.exports=function(e){return Object(r(e))}},function(e,t,n){"use strict";e.exports={debugTool:null}},function(e,t,n){"use strict";var r=n(1442),o=r.getLogger("matrix");o.setLevel(r.levels.DEBUG),e.exports=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.formatCount=function(e){return e<1e3?e:e<1e4?(e/1e3).toFixed(1)+"K":e<1e5?(e/1e3).toFixed(0)+"K":e<1e7?(e/1e6).toFixed(1)+"M":e<1e8?(e/1e6).toFixed(0)+"M":(e/1e9).toFixed(1)+"B"},t.formatCryptoKey=function(e){return e.match(/.{1,4}/g).join(" ")},t.hashCode=o,t.getUserNameColorClass=function(e){return"mx_Username_color"+(o(e)%8+1)},t.formatCommaSeparatedList=function(e,t){var n=void 0===t?0:Math.max(e.length-t,0);if(0===e.length)return"";if(1===e.length)return e[0];if(n>0)return e=e.slice(0,t),(0,r._t)("%(items)s and %(count)s others",{items:e.join(", "),count:n});var o=e.pop();return(0,r._t)("%(items)s and %(lastItem)s",{items:e.join(", "),lastItem:o})};var r=n(2);function o(e){var t=0,n=void 0;if(0===e.length)return t;for(n=0;n0?r:n)(e)}},function(e,t,n){"use strict";var r=n(35);e.exports=function(e,t){return!!e&&r(function(){t?e.call(null,function(){},1):e.call(null)})}},function(e,t,n){e.exports={default:n(382),__esModule:!0}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t,n){"use strict";function r(e){return function(){return e}}var o=function(){};o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},function(e,t,n){"use strict";var r=n(39),o=n(47),i=n(590),a=n(177),s=n(591),l=n(178),u=n(293),c=n(25),d=[],p=0,f=i.getPooled(),h=!1,m=null;function g(){S.ReactReconcileTransaction&&m||r("123")}var _=[{initialize:function(){this.dirtyComponentsLength=d.length},close:function(){this.dirtyComponentsLength!==d.length?(d.splice(0,this.dirtyComponentsLength),E()):d.length=0}},{initialize:function(){this.callbackQueue.reset()},close:function(){this.callbackQueue.notifyAll()}}];function v(){this.reinitializeTransaction(),this.dirtyComponentsLength=null,this.callbackQueue=i.getPooled(),this.reconcileTransaction=S.ReactReconcileTransaction.getPooled(!0)}function y(e,t){return e._mountOrder-t._mountOrder}function b(e){var t=e.dirtyComponentsLength;t!==d.length&&r("124",t,d.length),d.sort(y),p++;for(var n=0;n>18&63,i=l>>12&63,a=l>>6&63,s=63&l,f[d++]=u.charAt(o)+u.charAt(i)+u.charAt(a)+u.charAt(s)}while(c299)&&r.error){for(var o in e=new Error("CouchDB error: "+(r.error.reason||r.error.error)),r)e[o]=r[o];return n(e,t,r)}return n(e,t,r)})},t})?r.apply(t,o):r)||(e.exports=i)},function(e,t,n){var r=n(649),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();e.exports=i},function(e,t){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=_(n(14)),o=_(n(61)),i=_(n(200)),a=_(n(72)),s=_(n(49)),l=_(n(3)),u=_(n(4)),c=_(n(9)),d=_(n(29)),p=_(n(13)),f=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(73)),h=_(n(317)),m=_(n(20)),g=_(n(205));function _(e){return e&&e.__esModule?e:{default:e}}var v=function(){function e(){(0,l.default)(this,e)}return(0,u.default)(e,null,[{key:"canUserModifyWidgets",value:function(e){if(!e)return console.warn("No room ID specified"),!1;var t=c.default.get();if(!t)return console.warn("User must be be logged in"),!1;var n=t.getRoom(e);if(!n)return console.warn("Room ID "+e+" is not recognised"),!1;var r=t.credentials.userId;return r?"join"!==n.getMyMembership()?(console.warn("User "+r+" is not in room "+e),!1):n.currentState.maySendStateEvent("im.vector.modular.widgets",r):(console.warn("Failed to get user ID"),!1)}},{key:"isScalarUrl",value:function(e){if(!e)return console.error("Scalar URL check failed. No URL specified"),!1;var t=f.parse(e),n=d.default.get().integrations_widgets_urls;n&&0!==n.length||(n=[d.default.get().integrations_rest_url]);for(var r=0;r");else{var i=document.createElement("div");i.appendChild(o.cloneNode(!0)),n+=i.innerHTML}}return n},t.sanitizedHtmlNode=function(e){var t=(0,p.default)(e,I);return d.default.createElement("div",{dangerouslySetInnerHTML:{__html:t},dir:"auto"})},t.isUrlPermitted=function(e){try{var t=y.default.parse(e);return!!t.protocol&&F.includes(t.protocol.slice(0,-1))}catch(e){return!1}},t.bodyToHtml=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r="org.matrix.custom.html"===e.format&&e.formatted_body,o=!1,i=I;n.forComposerQuote&&(i=N);var a=void 0,s=void 0,l=void 0;try{if(t&&t.length>0){var u=new M("mx_EventTile_searchHighlight",n.highlightLink),f=t.map(function(e){return(0,p.default)(e,i)});i.textFilter=function(e){return u.applyHighlights(e,f).join("")}}var h=e.formatted_body;n.stripReplyFallback&&h&&(h=c.default.stripHTMLReply(h)),a=n.stripReplyFallback?c.default.stripPlainReply(e.body):e.body,o=D(r?h:e.body),r&&(l=!0,s=(0,p.default)(h,i))}finally{delete i.textFilter}if(n.returnString)return l?s:a;var m=!1;if(!n.disableBigEmoji&&o){var g=void 0!==a?a.trim():"";g=(g=g.replace(k,"")).replace(x,"");var v=T.exec(g);m=v&&v[0]&&v[0].length===g.length&&(null==e.formatted_body||!e.formatted_body.includes("https://matrix.to/"))}var y=(0,_.default)({mx_EventTile_body:!0,mx_EventTile_bigEmoji:m,"markdown-body":r&&!m});return l?d.default.createElement("span",{key:"body",className:y,dangerouslySetInnerHTML:{__html:s},dir:"auto"}):d.default.createElement("span",{key:"body",className:y,dir:"auto"},a)},t.linkifyString=P,t.linkifyElement=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:h.default.options;return(0,m.default)(e,t)},t.linkifyAndSanitizeHtml=function(e){return(0,p.default)(P(e),I)};var c=S(n(257)),d=S(n(0)),p=S(n(454)),f=(S(n(469)),function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(1871))),h=S(n(209)),m=S(n(1876)),g=S(n(1878)),_=(S(n(942)),S(n(22))),v=S(n(9)),y=S(n(73)),b=S(n(944)),E=S(n(1883));function S(e){return e&&e.__esModule?e:{default:e}}(0,h.default)(f);var w=/([\ud800-\udbff])([\udc00-\udfff])/,C=/([\u2100-\u2bff])/,x=new RegExp("‍| ","g"),k=new RegExp("\\s","g"),T=new RegExp("^("+E.default.source+")+$","i"),R=/^#[0-9a-fA-F]{6}$/,F=["http","https","ftp","mailto","magnet"];function D(e){return w.test(e)||C.test(e)}var A={a:function(e,t){if(t.href){t.target="_blank";var n=void 0;if(n=t.href.match(h.default.VECTOR_URL_PATTERN))t.href=n[1],delete t.target;else if(n=t.href.match(h.default.MATRIXTO_URL_PATTERN)){var r=n[1];switch(r[0]){case"@":t.href="#/user/"+r;break;case"+":t.href="#/group/"+r;break;case"#":case"!":t.href="#/room/"+r}delete t.target}}return t.rel="noopener",{tagName:e,attribs:t}},img:function(e,t){return t.src&&t.src.startsWith("mxc://")?(t.src=v.default.get().mxcUrlToHttp(t.src,t.width||800,t.height||600),{tagName:e,attribs:t}):{tagName:e,attribs:{}}},code:function(e,t){if(void 0!==t.class){var n=t.class.split(/\s/).filter(function(e){return e.startsWith("language-")});t.class=n.join(" ")}return{tagName:e,attribs:t}},"*":function(e,t){delete t.style;var n={"data-mx-color":"color","data-mx-bg-color":"background-color"},r="";return(0,u.default)(n).forEach(function(e){var o=n[e],i=t[e];i&&"string"==typeof i&&R.test(i)&&(r+=o+":"+i+";",delete t[e])}),r&&(t.style=r),{tagName:e,attribs:t}}},I={allowedTags:["font","del","h1","h2","h3","h4","h5","h6","blockquote","p","a","ul","ol","sup","sub","nl","li","b","i","u","strong","em","strike","code","hr","br","div","table","thead","caption","tbody","tr","th","td","pre","span","img"],allowedAttributes:{font:["color","data-mx-bg-color","data-mx-color","style"],span:["data-mx-bg-color","data-mx-color","style"],a:["href","name","target","rel"],img:["src","width","height","alt","title"],ol:["start"],code:["class"]},selfClosing:["img","br","hr","area","base","basefont","input","link","meta"],allowedSchemes:F,allowProtocolRelative:!1,transformTags:A},N=(0,l.default)({},I);N.transformTags={code:A.code,"*":A["*"]};var O=function(){function e(t,n){(0,a.default)(this,e),this.highlightClass=t,this.highlightLink=n}return(0,s.default)(e,[{key:"applyHighlights",value:function(e,t){for(var n=0,r=void 0,o=[],i=t[0];(r=e.toLowerCase().indexOf(i.toLowerCase(),n))>=0;){if(r>n){var a=e.substring(n,r);o=o.concat(this._applySubHighlights(a,t))}var s=r+i.length;o.push(this._processSnippet(e.substring(r,s),!0)),n=s}return n!==e.length&&(a=e.substring(n,void 0),o=o.concat(this._applySubHighlights(a,t))),o}},{key:"_applySubHighlights",value:function(e,t){return t[1]?this.applyHighlights(e,t.slice(1)):[this._processSnippet(e,!1)]}}]),e}(),M=function(e){function t(){return(0,a.default)(this,t),(0,o.default)(this,(t.__proto__||(0,r.default)(t)).apply(this,arguments))}return(0,i.default)(t,e),(0,s.default)(t,[{key:"_processSnippet",value:function(e,t){if(!t)return e;var n=''+e+"";return this.highlightLink&&(n=''+n+""),n}}]),t}(O);!function(e){function t(e,n){(0,a.default)(this,t);var i=(0,o.default)(this,(t.__proto__||(0,r.default)(t)).call(this,e,n));return i._key=0,i}(0,i.default)(t,e),(0,s.default)(t,[{key:"_processSnippet",value:function(e,t){var n=this._key++,r=d.default.createElement("span",{key:n,className:t?this.highlightClass:null},e);return t&&this.highlightLink&&(r=d.default.createElement("a",{key:n,href:this.highlightLink},r)),r}}])}(O);function P(e){return(0,g.default)(e)}},function(e,t){var n=Array.isArray;e.exports=n},function(e,t,n){e.exports=n.p+"img/cancel.4b9715b.svg"},function(e,t,n){var r=n(36);e.exports=function(e,t){if(!r(e))return e;var n,o;if(t&&"function"==typeof(n=e.toString)&&!r(o=n.call(e)))return o;if("function"==typeof(n=e.valueOf)&&!r(o=n.call(e)))return o;if(!t&&"function"==typeof(n=e.toString)&&!r(o=n.call(e)))return o;throw TypeError("Can't convert object to primitive value")}},function(e,t){e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){var r=n(12),o=n(99),i=n(35);e.exports=function(e,t){var n=(o.Object||{})[e]||Object[e],a={};a[e]=t(n),r(r.S+r.F*i(function(){n(1)}),"Object",a)}},function(e,t,n){var r=n(100),o=n(225),i=n(56),a=n(44),s=n(373);e.exports=function(e,t){var n=1==e,l=2==e,u=3==e,c=4==e,d=6==e,p=5==e||d,f=t||s;return function(t,s,h){for(var m,g,_=i(t),v=o(_),y=r(s,h,3),b=a(v.length),E=0,S=n?f(t,b):l?f(t,0):void 0;b>E;E++)if((p||E in v)&&(g=y(m=v[E],E,_),e))if(n)S[E]=g;else if(g)switch(e){case 3:return!0;case 5:return m;case 6:return E;case 2:S.push(m)}else if(c)return!1;return d?-1:u||c?c:S}}},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t){e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){n(390);for(var r=n(37),o=n(62),i=n(81),a=n(41)("toStringTag"),s="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),l=0;l0&&void 0!==arguments[0]?arguments[0]:void 0,t=this.getWireContent(),n=t&&t["m.relates_to"];return n&&n.rel_type&&n.event_id&&(e&&n.rel_type===e||!e)},getRelation:function(){return this.isRelation()?this.getWireContent()["m.relates_to"]:null},makeReplaced:function(e){this.isRedacted()||this._replacingEvent!==e&&(this._replacingEvent=e,this.emit("Event.replaced",this))},replacementOrOwnStatus:function(){return this._replacingEvent?this._replacingEvent.status:this.status},replacingEventId:function(){return this._replacingEvent&&this._replacingEvent.getId()},replacingEvent:function(){return this._replacingEvent},toJSON:function(){var e={type:this.getType(),sender:this.getSender(),content:this.getContent(),event_id:this.getId(),origin_server_ts:this.getTs(),unsigned:this.getUnsigned(),room_id:this.getRoomId()};return this.isEncrypted()?{decrypted:e,encrypted:this.event}:e}});var d=["event_id","type","room_id","user_id","sender","state_key","prev_state","content","unsigned","origin_server_ts"].reduce(function(e,t){return e[t]=1,e},{}),p={"m.room.member":{membership:1},"m.room.create":{creator:1},"m.room.join_rules":{join_rule:1},"m.room.power_levels":{ban:1,events:1,events_default:1,kick:1,redact:1,state_default:1,users:1,users_default:1},"m.room.aliases":{aliases:1}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=u(n(14)),o=u(n(17)),i=u(n(3)),a=u(n(4)),s=u(n(9)),l=u(n(448));function u(e){return e&&e.__esModule?e:{default:e}}var c=function(){function e(t){(0,i.default)(this,e),this.matrixClient=t,this.roomToUser=null,this._hasSentOutPatchDirectAccountDataPatch=!1,this._onAccountData=this._onAccountData.bind(this);var n=t.getAccountData("m.direct");this.mDirectEvent=n?n.getContent():{},this.userToRooms=null}return(0,a.default)(e,[{key:"start",value:function(){this._populateRoomToUser(),this.matrixClient.on("accountData",this._onAccountData)}},{key:"stop",value:function(){this.matrixClient.removeListener("accountData",this._onAccountData)}},{key:"_onAccountData",value:function(e){"m.direct"==e.getType()&&(this.mDirectEvent=this.matrixClient.getAccountData("m.direct").getContent()||{},this.userToRooms=null,this.roomToUser=null)}},{key:"_patchUpSelfDMs",value:function(e){var t=this,n=this.matrixClient.getUserId(),r=e[n];if(r){var o=r.map(function(e){var r=t.matrixClient.getRoom(e);if(r){var o=r.guessDMUserId();if(o&&o!==n)return{userId:o,roomId:e}}}).filter(function(e){return!!e});return!!o.length&&(e[n]=r.filter(function(e){return!o.some(function(t){return t.roomId===e})}),o.forEach(function(t){var n=t.userId,r=t.roomId,o=e[n];o?(o.push(r),e[n]=(0,l.default)(o)):e[n]=[r]}),!0)}}},{key:"getDMRoomsForUserId",value:function(e){return this._getUserToRooms()[e]||[]}},{key:"getUserIdForRoomId",value:function(e){if(null==this.roomToUser&&this._populateRoomToUser(),void 0===this.roomToUser[e]){var t=this.matrixClient.getRoom(e);if(t)return t.getDMInviter()}return this.roomToUser[e]}},{key:"_getUserToRooms",value:function(){if(!this.userToRooms){var e=this.mDirectEvent,t=e[this.matrixClient.getUserId()];if(t&&t.length){var n=this._patchUpSelfDMs(e);console.warn("Invalid m.direct account data detected (self-chats that shouldn't be), patching it up."),n&&!this._hasSentOutPatchDirectAccountDataPatch&&(this._hasSentOutPatchDirectAccountDataPatch=!0,this.matrixClient.setAccountData("m.direct",e))}this.userToRooms=e}return this.userToRooms}},{key:"_populateRoomToUser",value:function(){this.roomToUser={};var e=!0,t=!1,n=void 0;try{for(var i,a=(0,o.default)((0,r.default)(this._getUserToRooms()));!(e=(i=a.next()).done);e=!0){var s=i.value,l=!0,u=!1,c=void 0;try{for(var d,p=(0,o.default)(this.userToRooms[s]);!(l=(d=p.next()).done);l=!0){var f=d.value;this.roomToUser[f]=s}}catch(e){u=!0,c=e}finally{try{!l&&p.return&&p.return()}finally{if(u)throw c}}}}catch(e){t=!0,n=e}finally{try{!e&&a.return&&a.return()}finally{if(t)throw n}}}}],[{key:"makeShared",value:function(){return e._sharedInstance=new e(s.default.get()),e._sharedInstance}},{key:"shared",value:function(){return e._sharedInstance}}]),e}();t.default=c,e.exports=t.default},function(e,t,n){"use strict";if(n(50)){var r=n(145),o=n(30),i=n(35),a=n(12),s=n(280),l=n(381),u=n(100),c=n(166),d=n(159),p=n(77),f=n(168),h=n(102),m=n(44),g=n(570),_=n(162),v=n(118),y=n(87),b=n(190),E=n(36),S=n(56),w=n(370),C=n(163),x=n(90),k=n(164).f,T=n(372),R=n(160),F=n(42),D=n(121),A=n(270),I=n(228),N=n(375),O=n(192),M=n(275),P=n(165),L=n(374),U=n(559),B=n(51),j=n(89),G=B.f,q=j.f,V=o.RangeError,z=o.TypeError,H=o.Uint8Array,K=Array.prototype,Y=l.ArrayBuffer,W=l.DataView,$=D(0),Q=D(2),J=D(3),X=D(4),Z=D(5),ee=D(6),te=A(!0),ne=A(!1),re=N.values,oe=N.keys,ie=N.entries,ae=K.lastIndexOf,se=K.reduce,le=K.reduceRight,ue=K.join,ce=K.sort,de=K.slice,pe=K.toString,fe=K.toLocaleString,he=F("iterator"),me=F("toStringTag"),ge=R("typed_constructor"),_e=R("def_constructor"),ve=s.CONSTR,ye=s.TYPED,be=s.VIEW,Ee=D(1,function(e,t){return ke(I(e,e[_e]),t)}),Se=i(function(){return 1===new H(new Uint16Array([1]).buffer)[0]}),we=!!H&&!!H.prototype.set&&i(function(){new H(1).set({})}),Ce=function(e,t){var n=h(e);if(n<0||n%t)throw V("Wrong offset!");return n},xe=function(e){if(E(e)&&ye in e)return e;throw z(e+" is not a typed array!")},ke=function(e,t){if(!(E(e)&&ge in e))throw z("It is not a typed array constructor!");return new e(t)},Te=function(e,t){return Re(I(e,e[_e]),t)},Re=function(e,t){for(var n=0,r=t.length,o=ke(e,r);r>n;)o[n]=t[n++];return o},Fe=function(e,t,n){G(e,t,{get:function(){return this._d[n]}})},De=function(e){var t,n,r,o,i,a,s=S(e),l=arguments.length,c=l>1?arguments[1]:void 0,d=void 0!==c,p=T(s);if(null!=p&&!w(p)){for(a=p.call(s),r=[],t=0;!(i=a.next()).done;t++)r.push(i.value);s=r}for(d&&l>2&&(c=u(c,arguments[2],2)),t=0,n=m(s.length),o=ke(this,n);n>t;t++)o[t]=d?c(s[t],t):s[t];return o},Ae=function(){for(var e=0,t=arguments.length,n=ke(this,t);t>e;)n[e]=arguments[e++];return n},Ie=!!H&&i(function(){fe.call(new H(1))}),Ne=function(){return fe.apply(Ie?de.call(xe(this)):xe(this),arguments)},Oe={copyWithin:function(e,t){return U.call(xe(this),e,t,arguments.length>2?arguments[2]:void 0)},every:function(e){return X(xe(this),e,arguments.length>1?arguments[1]:void 0)},fill:function(e){return L.apply(xe(this),arguments)},filter:function(e){return Te(this,Q(xe(this),e,arguments.length>1?arguments[1]:void 0))},find:function(e){return Z(xe(this),e,arguments.length>1?arguments[1]:void 0)},findIndex:function(e){return ee(xe(this),e,arguments.length>1?arguments[1]:void 0)},forEach:function(e){$(xe(this),e,arguments.length>1?arguments[1]:void 0)},indexOf:function(e){return ne(xe(this),e,arguments.length>1?arguments[1]:void 0)},includes:function(e){return te(xe(this),e,arguments.length>1?arguments[1]:void 0)},join:function(e){return ue.apply(xe(this),arguments)},lastIndexOf:function(e){return ae.apply(xe(this),arguments)},map:function(e){return Ee(xe(this),e,arguments.length>1?arguments[1]:void 0)},reduce:function(e){return se.apply(xe(this),arguments)},reduceRight:function(e){return le.apply(xe(this),arguments)},reverse:function(){for(var e,t=xe(this).length,n=Math.floor(t/2),r=0;r1?arguments[1]:void 0)},sort:function(e){return ce.call(xe(this),e)},subarray:function(e,t){var n=xe(this),r=n.length,o=_(e,r);return new(I(n,n[_e]))(n.buffer,n.byteOffset+o*n.BYTES_PER_ELEMENT,m((void 0===t?r:_(t,r))-o))}},Me=function(e,t){return Te(this,de.call(xe(this),e,t))},Pe=function(e){xe(this);var t=Ce(arguments[1],1),n=this.length,r=S(e),o=m(r.length),i=0;if(o+t>n)throw V("Wrong length!");for(;i255?255:255&r),o.v[f](n*t+o.o,r,Se)}(this,n,e)},enumerable:!0})};y?(h=n(function(e,n,r,o){c(e,h,u,"_d");var i,a,s,l,d=0,f=0;if(E(n)){if(!(n instanceof Y||"ArrayBuffer"==(l=b(n))||"SharedArrayBuffer"==l))return ye in n?Re(h,n):De.call(h,n);i=n,f=Ce(r,t);var _=n.byteLength;if(void 0===o){if(_%t)throw V("Wrong length!");if((a=_-f)<0)throw V("Wrong length!")}else if((a=m(o)*t)+f>_)throw V("Wrong length!");s=a/t}else s=g(n),i=new Y(a=s*t);for(p(e,"_d",{b:i,o:f,l:a,e:s,v:new W(i)});ddocument.F=Object<\/script>"),e.close(),l=e.F;r--;)delete l.prototype[i[r]];return l()};e.exports=Object.create||function(e,t){var n;return null!==e?(s.prototype=r(e),n=new s,s.prototype=null,n[a]=e):n=l(),void 0===t?n:o(n,t)}},function(e,t,n){var r=n(122),o=Math.min;e.exports=function(e){return e>0?o(r(e),9007199254740991):0}},function(e,t,n){var r=n(133)("keys"),o=n(107);e.exports=function(e){return r[e]||(r[e]=o(e))}},function(e,t,n){var r=n(21),o=n(37),i=o["__core-js_shared__"]||(o["__core-js_shared__"]={});(e.exports=function(e,t){return i[e]||(i[e]=void 0!==t?t:{})})("versions",[]).push({version:r.version,mode:n(92)?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,n){var r=n(48).f,o=n(59),i=n(41)("toStringTag");e.exports=function(e,t,n){e&&!o(e=n?e:e.prototype,i)&&r(e,i,{configurable:!0,value:t})}},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,n){"use strict";e.exports={current:null}},function(e,t,n){"use strict";var r=n(47),o=n(177),i=n(108),a=(n(40),["dispatchConfig","_targetInst","nativeEvent","isDefaultPrevented","isPropagationStopped","_dispatchListeners","_dispatchInstances"]),s={type:null,target:null,currentTarget:i.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};function l(e,t,n,r){this.dispatchConfig=e,this._targetInst=t,this.nativeEvent=n;var o=this.constructor.Interface;for(var a in o)if(o.hasOwnProperty(a)){0;var s=o[a];s?this[a]=s(n):"target"===a?this.target=r:this[a]=n[a]}var l=null!=n.defaultPrevented?n.defaultPrevented:!1===n.returnValue;return this.isDefaultPrevented=l?i.thatReturnsTrue:i.thatReturnsFalse,this.isPropagationStopped=i.thatReturnsFalse,this}r(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=i.thatReturnsTrue)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=i.thatReturnsTrue)},persist:function(){this.isPersistent=i.thatReturnsTrue},isPersistent:i.thatReturnsFalse,destructor:function(){var e=this.constructor.Interface;for(var t in e)this[t]=null;for(var n=0;n0)){e.next=27;break}return console.warn("Refusing to start conference call widget in "+t+" a conference call widget is already present"),b=d.default.getComponent("dialogs.ErrorDialog"),c.default.createTrackedDialog("Already have Jitsi Widget","",b,{title:(0,p._t)("Call in Progress"),description:(0,p._t)("A call is already in progress!")}),e.abrupt("return");case 27:E=Math.random().toString(36).substring(2),S=u.roomId.replace(/[^A-Za-z0-9]/g,"")+E,w=["confId="+encodeURIComponent(S),"isAudioConf="+("voice"===n?"true":"false"),"displayName=$matrix_display_name","avatarUrl=$matrix_avatar_url","email=$matrix_user_id"].join("&"),C=void 0,C=m.default.get().integrations_jitsi_widget_url?m.default.get().integrations_jitsi_widget_url+"?"+w:m.default.get().integrations_rest_url+"/widgets/jitsi.html?"+w,x={widgetSessionId:E},k="jitsi_"+l.default.get().credentials.userId+"_"+Date.now(),_.default.setRoomWidget(t,k,"jitsi",C,"Jitsi",x).then(function(){console.log("Jitsi widget added")}).catch(function(e){if("M_FORBIDDEN"===e.errcode){var t=d.default.getComponent("dialogs.ErrorDialog");c.default.createTrackedDialog("Call Failed","",t,{title:(0,p._t)("Permission Required"),description:(0,p._t)("You do not have permission to start a conference call in this room")})}console.error(e)});case 35:case"end":return e.stop()}},e,this,[[2,8]])})),function(e,t){return r.apply(this,arguments)}),l=b(n(9)),u=b(n(76)),c=b(n(16)),d=b(n(5)),p=n(2),f=b(n(19)),h=b(n(13)),m=b(n(29)),g=n(452),_=b(n(114)),v=b(n(317)),y=b(n(183));function b(e){return e&&e.__esModule?e:{default:e}}t.mxCalls={};var E=t.mxCalls,S=null,w={};function C(e){var t=document.getElementById(e);t&&(w[e]?w[e]=w[e].then(function(){return t.load(),t.play()}):w[e]=t.play())}function x(e){var t=document.getElementById(e);t&&(w[e]?w[e]=w[e].then(function(){return t.pause()}):w[e]=t.pause())}function k(e){e.on("error",function(t){if(console.error("Call error: %s",t),console.error(t.stack),"unknown_devices"===t.code){var n=d.default.getComponent("dialogs.QuestionDialog");c.default.createTrackedDialog("Call Failed","",n,{title:(0,p._t)("Call Failed"),description:(0,p._t)("There are unknown devices in this room: if you proceed without verifying them, it will be possible for someone to eavesdrop on your call."),button:(0,p._t)("Review Devices"),onFinished:function(t){if(t){var n=l.default.get().getRoom(e.roomId);(0,g.showUnknownDeviceDialogForCalls)(l.default.get(),n,function(){!function(e){"outbound"===e.direction?h.default.dispatch({action:"place_call",room_id:e.roomId,type:e.type}):e.answer()}(e)},"outbound"===e.direction?(0,p._t)("Call Anyway"):(0,p._t)("Answer Anyway"),"outbound"===e.direction?(0,p._t)("Call"):(0,p._t)("Answer"))}}})}else{var r=d.default.getComponent("dialogs.ErrorDialog");c.default.createTrackedDialog("Call Failed","",r,{title:(0,p._t)("Call Failed"),description:t.message})}}),e.on("hangup",function(){T(void 0,e.roomId,"ended")}),e.on("state",function(t,n){if("ringing"===t)T(e,e.roomId,"ringing"),x("ringbackAudio");else if("invite_sent"===t)T(e,e.roomId,"ringback"),C("ringbackAudio");else if("ended"===t&&"connected"===n)T(void 0,e.roomId,"ended"),x("ringbackAudio"),C("callendAudio");else if("ended"===t&&"invite_sent"===n&&("remote"===e.hangupParty||"local"===e.hangupParty&&"invite_timeout"===e.hangupReason)){T(e,e.roomId,"busy"),x("ringbackAudio"),C("busyAudio");var r=d.default.getComponent("dialogs.ErrorDialog");c.default.createTrackedDialog("Call Handler","Call Timeout",r,{title:(0,p._t)("Call Timeout"),description:(0,p._t)("The remote side failed to pick up")+"."})}else"invite_sent"===n?(T(e,e.roomId,"stop_ringback"),x("ringbackAudio")):"ringing"===n?(T(e,e.roomId,"stop_ringing"),x("ringbackAudio")):"connected"===t&&(T(e,e.roomId,"connected"),x("ringbackAudio"))})}function T(e,t,n){console.log("Call state in %s changed to %s (%s)",t,n,e?e.call_state:"-"),E[t]=e,"ringing"===n?C("ringAudio"):e&&"ringing"===e.call_state&&x("ringAudio"),e&&(e.call_state=n),h.default.dispatch({action:"call_state",room_id:t,state:n})}t.mxCallHandler||h.default.register(function(t){switch(t.action){case"place_call":if(e.exports.getAnyActiveCall()){var n=d.default.getComponent("dialogs.ErrorDialog");return void c.default.createTrackedDialog("Call Handler","Existing Call",n,{title:(0,p._t)("Existing Call"),description:(0,p._t)("You are already in a call.")})}if(!l.default.get().supportsVoip()){var r=d.default.getComponent("dialogs.ErrorDialog");return void c.default.createTrackedDialog("Call Handler","VoIP is unsupported",r,{title:(0,p._t)("VoIP is unsupported"),description:(0,p._t)("You cannot place VoIP calls in this browser.")})}var o=l.default.get().getRoom(t.room_id);if(!o)return void console.error("Room %s does not exist.",t.room_id);var i=o.getJoinedMembers();if(i.length<=1){var a=d.default.getComponent("dialogs.ErrorDialog");return void c.default.createTrackedDialog("Call Handler","Cannot place call with self",a,{description:(0,p._t)("You cannot place a call with yourself.")})}2===i.length?(console.log("Place %s call in %s",t.type,t.room_id),function(e){if(k(e),"voice"===t.type)e.placeVoiceCall();else if("video"===t.type)e.placeVideoCall(t.remote_element,t.local_element);else if("screensharing"===t.type){var n=u.default.get().screenCaptureErrorString();if(n){T(void 0,e.roomId,"ended"),console.log("Can't capture screen: "+n);var r=d.default.getComponent("dialogs.ErrorDialog");return void c.default.createTrackedDialog("Call Handler","Unable to capture screen",r,{title:(0,p._t)("Unable to capture screen"),description:n})}e.placeScreenSharingCall(t.remote_element,t.local_element)}else console.error("Unknown conf call type: %s",t.type)}(f.default.createNewMatrixCall(l.default.get(),t.room_id))):h.default.dispatch({action:"place_conference_call",room_id:t.room_id,type:t.type,remote_element:t.remote_element,local_element:t.local_element});break;case"place_conference_call":console.log("Place conference call in %s",t.room_id),s(t.room_id,t.type);break;case"incoming_call":if(e.exports.getAnyActiveCall())return;if(!l.default.get().supportsVoip())return;var m=t.call;k(m),T(m,m.roomId,"ringing");break;case"hangup":if(!E[t.room_id])return;E[t.room_id].hangup(),T(null,t.room_id,"ended");break;case"answer":if(!E[t.room_id])return;E[t.room_id].answer(),T(E[t.room_id],t.room_id,"connected"),h.default.dispatch({action:"view_room",room_id:t.room_id})}});var R={getCallForRoom:function(t){var n=e.exports.getCall(t);return n||(S&&(n=S.getConferenceCallForRoom(t)),n||null)},getCall:function(e){return E[e]||null},getAnyActiveCall:function(){for(var e=(0,o.default)(E),t=0;t2&&void 0!==arguments[2])||arguments[2],o=function(){if(d.default.unmountComponentAtNode(m()),t&&t.onFinished){for(var e=arguments.length,n=Array(e),r=0;r1&&void 0!==arguments[1]&&arguments[1],n=new Date,a=o(),s=i();if(e.toDateString()===n.toDateString())return c(e,t);if(n.getTime()-e.getTime()<5184e5)return(0,r._t)("%(weekDayName)s %(time)s",{weekDayName:a[e.getDay()],time:c(e,t)});if(n.getFullYear()===e.getFullYear())return(0,r._t)("%(weekDayName)s, %(monthName)s %(day)s %(time)s",{weekDayName:a[e.getDay()],monthName:s[e.getMonth()],day:e.getDate(),time:c(e,t)});return l(e,t)},t.formatFullDateNoTime=function(e){var t=o(),n=i();return(0,r._t)("%(weekDayName)s, %(monthName)s %(day)s %(fullYear)s",{weekDayName:t[e.getDay()],monthName:n[e.getMonth()],day:e.getDate(),fullYear:e.getFullYear()})},t.formatFullDate=l,t.formatFullTime=u,t.formatTime=c,t.wantsDateSeparator=function(e,t){if(!t||!e)return!1;if(Math.abs(e.getTime()-t.getTime())>d)return!0;return e.getDay()!==t.getDay()};var r=n(2);function o(){return[(0,r._t)("Sun"),(0,r._t)("Mon"),(0,r._t)("Tue"),(0,r._t)("Wed"),(0,r._t)("Thu"),(0,r._t)("Fri"),(0,r._t)("Sat")]}function i(){return[(0,r._t)("Jan"),(0,r._t)("Feb"),(0,r._t)("Mar"),(0,r._t)("Apr"),(0,r._t)("May"),(0,r._t)("Jun"),(0,r._t)("Jul"),(0,r._t)("Aug"),(0,r._t)("Sep"),(0,r._t)("Oct"),(0,r._t)("Nov"),(0,r._t)("Dec")]}function a(e){return(e<10?"0":"")+e}function s(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.getHours()%12,o=a(e.getMinutes()),i=e.getHours()>=12?(0,r._t)("PM"):(0,r._t)("AM");return n=n||12,t?n+":"+o+":"+a(e.getSeconds())+i:n+":"+o+i}function l(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=o(),a=i();return(0,r._t)("%(weekDayName)s, %(monthName)s %(day)s %(fullYear)s %(time)s",{weekDayName:n[e.getDay()],monthName:a[e.getMonth()],day:e.getDate(),fullYear:e.getFullYear(),time:u(e,t)})}function u(e){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?s(e,!0):a(e.getHours())+":"+a(e.getMinutes())+":"+a(e.getSeconds())}function c(e){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?s(e):a(e.getHours())+":"+a(e.getMinutes())}var d=864e5},function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}},function(e,t,n){"use strict";(function(r){function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}t.log=function(){var e;return"object"===("undefined"==typeof console?"undefined":o(console))&&console.log&&(e=console).log.apply(e,arguments)},t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;var n="color: "+this.color;t.splice(1,0,n,"color: inherit");var r=0,o=0;t[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(r++,"%c"===e&&(o=r))}),t.splice(o,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){var e;try{e=t.storage.getItem("debug")}catch(e){}!e&&void 0!==r&&"env"in r&&(e=Object({NODE_ENV:"production"}).DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.exports=n(2275)(t),e.exports.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this,n(64))},,function(e,t){e.exports=!1},function(e,t,n){var r=n(160)("meta"),o=n(36),i=n(87),a=n(51).f,s=0,l=Object.isExtensible||function(){return!0},u=!n(35)(function(){return l(Object.preventExtensions({}))}),c=function(e){a(e,r,{value:{i:"O"+ ++s,w:{}}})},d=e.exports={KEY:r,NEED:!1,fastKey:function(e,t){if(!o(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!i(e,r)){if(!l(e))return"F";if(!t)return"E";c(e)}return e[r].i},getWeak:function(e,t){if(!i(e,r)){if(!l(e))return!0;if(!t)return!1;c(e)}return e[r].w},onFreeze:function(e){return u&&d.NEED&&l(e)&&!i(e,r)&&c(e),e}}},function(e,t,n){var r=n(42)("unscopables"),o=Array.prototype;null==o[r]&&n(77)(o,r,{}),e.exports=function(e){o[r][e]=!0}},function(e,t,n){var r=n(38),o=n(37).document,i=r(o)&&r(o.createElement);e.exports=function(e){return i?o.createElement(e):{}}},function(e,t,n){var r=n(107)("meta"),o=n(38),i=n(59),a=n(48).f,s=0,l=Object.isExtensible||function(){return!0},u=!n(58)(function(){return l(Object.preventExtensions({}))}),c=function(e){a(e,r,{value:{i:"O"+ ++s,w:{}}})},d=e.exports={KEY:r,NEED:!1,fastKey:function(e,t){if(!o(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!i(e,r)){if(!l(e))return"F";if(!t)return"E";c(e)}return e[r].i},getWeak:function(e,t){if(!i(e,r)){if(!l(e))return!0;if(!t)return!1;c(e)}return e[r].w},onFreeze:function(e){return u&&d.NEED&&l(e)&&!i(e,r)&&c(e),e}}},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";t.__esModule=!0;var r=i(n(6)),o=i(n(584));function i(e){return e&&e.__esModule?e:{default:e}}t.default=function e(t,n,i){null===t&&(t=Function.prototype);var a=(0,o.default)(t,n);if(void 0===a){var s=(0,r.default)(t);return null===s?void 0:e(s,n,i)}if("value"in a)return a.value;var l=a.get;return void 0!==l?l.call(i):void 0}},function(e,t,n){"use strict";e.exports=function(e,t,n,r,o,i,a,s){if(!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var u=[n,r,o,i,a,s],c=0;l=new Error("Invariant Violation: "+t.replace(/%s/g,function(){return u[c++]}))}throw l.framesToPop=1,l}}},function(e,t,n){"use strict";(function(t){var r=m(n(17)),o=m(n(9)),i=m(n(76)),a=m(n(447)),s=m(n(66)),l=m(n(182)),u=m(n(13)),c=m(n(5)),d=n(2),p=m(n(16)),f=n(20),h=m(f);function m(e){return e&&e.__esModule?e:{default:e}}var g={notifsByRoom:{},pendingEncryptedEventIds:[],notificationMessageForEvent:function(e){return a.default.textForEvent(e)},_displayPopupNotification:function(e,n){var r=i.default.get();if(r&&r.supportsNotifications()&&r.maySendNotifications()&&!t.document.hasFocus()){var o=this.notificationMessageForEvent(e);if(o){var a=void 0;e.sender&&n.name!==e.sender.name?"m.room.member"===e.getType()?a=n.name:e.sender&&(a=e.sender.name+" ("+n.name+")",e.getContent().body&&(o=e.getContent().body)):(a=n.name,e.getContent().body&&(o=e.getContent().body)),this.isBodyEnabled()||(o="");var s=e.sender?l.default.avatarUrlForMember(e.sender,40,40,"crop"):null,u=r.displayNotification(a,o,s,n);u&&(void 0===this.notifsByRoom[e.getRoomId()]&&(this.notifsByRoom[e.getRoomId()]=[]),this.notifsByRoom[e.getRoomId()].push(u))}}},_playAudioNotification:function(e,t){var n=document.getElementById("messageAudio");n&&n.play()},start:function(){this.boundOnEvent=this.onEvent.bind(this),this.boundOnSyncStateChange=this.onSyncStateChange.bind(this),this.boundOnRoomReceipt=this.onRoomReceipt.bind(this),this.boundOnEventDecrypted=this.onEventDecrypted.bind(this),o.default.get().on("event",this.boundOnEvent),o.default.get().on("Room.receipt",this.boundOnRoomReceipt),o.default.get().on("Event.decrypted",this.boundOnEventDecrypted),o.default.get().on("sync",this.boundOnSyncStateChange),this.toolbarHidden=!1,this.isSyncing=!1},stop:function(){o.default.get()&&this.boundOnRoomTimeline&&(o.default.get().removeListener("Event",this.boundOnEvent),o.default.get().removeListener("Room.receipt",this.boundOnRoomReceipt),o.default.get().removeListener("Event.decrypted",this.boundOnEventDecrypted),o.default.get().removeListener("sync",this.boundOnSyncStateChange)),this.isSyncing=!1},supportsDesktopNotifications:function(){var e=i.default.get();return e&&e.supportsNotifications()},setEnabled:function(e,t){var n=i.default.get();n&&(s.default.trackEvent("Notifier","Set Enabled",e),h.default.isLevelSupported(f.SettingLevel.DEVICE)&&h.default.setValue("audioNotificationsEnabled",null,f.SettingLevel.DEVICE,this.isEnabled()),e?n.requestNotificationPermission().done(function(e){if("granted"===e)t&&t(),u.default.dispatch({action:"notifier_enabled",value:!0});else{var n="denied"===e?(0,d._t)("Riot does not have permission to send you notifications - please check your browser settings"):(0,d._t)("Riot was not given permission to send notifications - please try again"),r=c.default.getComponent("dialogs.ErrorDialog");p.default.createTrackedDialog("Unable to enable Notifications",e,r,{title:(0,d._t)("Unable to enable Notifications"),description:n})}}):u.default.dispatch({action:"notifier_enabled",value:!1}),this.setToolbarHidden(!0))},isEnabled:function(){return this.isPossible()&&h.default.getValue("notificationsEnabled")},isPossible:function(){var e=i.default.get();return!!e&&(!!e.supportsNotifications()&&!!e.maySendNotifications())},isBodyEnabled:function(){return this.isEnabled()&&h.default.getValue("notificationBodyEnabled")},isAudioEnabled:function(){return this.isEnabled()&&h.default.getValue("audioNotificationsEnabled")},setToolbarHidden:function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.toolbarHidden=e,s.default.trackEvent("Notifier","Set Toolbar Hidden",e),u.default.dispatch({action:"notifier_enabled",value:this.isEnabled()}),n&&t.localStorage&&t.localStorage.setItem("notifications_hidden",e)},shouldShowToolbar:function(){var e=o.default.get();return!!e&&(!e.isGuest()&&this.supportsDesktopNotifications()&&!this.isEnabled()&&!this._isToolbarHidden())},_isToolbarHidden:function(){return t.localStorage?"true"===t.localStorage.getItem("notifications_hidden"):this.toolbarHidden},onSyncStateChange:function(e){"SYNCING"===e?this.isSyncing=!0:"STOPPED"!==e&&"ERROR"!==e||(this.isSyncing=!1)},onEvent:function(e){if(this.isSyncing&&(!e.sender||e.sender.userId!==o.default.get().credentials.userId))if(e.isBeingDecrypted()||e.isDecryptionFailure())for(this.pendingEncryptedEventIds.push(e.getId());this.pendingEncryptedEventIds.length>20;)this.pendingEncryptedEventIds.shift();else this._evaluateEvent(e)},onEventDecrypted:function(e){if(!e.isDecryptionFailure()){var t=this.pendingEncryptedEventIds.indexOf(e.getId());-1!==t&&(this.pendingEncryptedEventIds.splice(t,1),this._evaluateEvent(e))}},onRoomReceipt:function(e,t){if(0===t.getUnreadNotificationCount()){var n=i.default.get();if(!n)return;if(void 0===this.notifsByRoom[t.roomId])return;var o=!0,a=!1,s=void 0;try{for(var l,u=(0,r.default)(this.notifsByRoom[t.roomId]);!(o=(l=u.next()).done);o=!0){var c=l.value;n.clearNotification(c)}}catch(e){a=!0,s=e}finally{try{!o&&u.return&&u.return()}finally{if(a)throw s}}delete this.notifsByRoom[t.roomId]}},_evaluateEvent:function(e){var t=o.default.get().getRoom(e.getRoomId()),n=o.default.get().getPushActionsForEvent(e);n&&n.notify&&(this.isEnabled()&&this._displayPopupNotification(e,t),n.tweaks.sound&&this.isAudioEnabled()&&(i.default.get().loudNotification(e,t),this._playAudioNotification(e,t)))}};t.mxNotifier||(t.mxNotifier=g),e.exports=t.mxNotifier}).call(this,n(18))},function(e,t,n){"use strict";(function(r){Object.defineProperty(t,"__esModule",{value:!0});var o=h(n(15)),i=h(n(14)),a=n(10),s=h(a),l=h(n(6)),u=h(n(3)),c=h(n(4)),d=h(n(7)),p=h(n(8)),f=h(n(54));function h(e){return e&&e.__esModule?e:{default:e}}var m=!0,g=function(e){function t(e){(0,u.default)(this,t);var n=(0,d.default)(this,(t.__proto__||(0,l.default)(t)).call(this));return n._matrixClient=e,n._userGroups={},n._groupProfiles={},n._groupProfilesPromise={},n._usersPending={},n._usersInFlight={},n._debounceTimeoutID=null,n}return(0,p.default)(t,e),(0,c.default)(t,[{key:"groupSupport",value:function(){return m}},{key:"invalidatePublicisedGroups",value:function(e){delete this._userGroups[e]}},{key:"getPublicisedGroupsCached",value:function(e,t){var n=this;return this._userGroups[t]?s.default.resolve(this._userGroups[t]):this._usersPending[t]?this._usersPending[t].prom:this._usersInFlight[t]?this._usersInFlight[t].prom:(this._usersPending[t]={},this._usersPending[t].prom=new s.default(function(e,r){n._usersPending[t].resolve=e,n._usersPending[t].reject=r}).then(function(e){return n._userGroups[t]=e,setTimeout(function(){delete n._userGroups[t]},18e5),n._userGroups[t]}).catch(function(e){if("M_UNRECOGNIZED"===e.errcode)return console.warn("Cannot display flair, server does not support groups"),void(m=!1);throw console.error("Could not get groups for user",t,e),e}).finally(function(){delete n._usersInFlight[t]}),this._debounceTimeoutID&&clearTimeout(this._debounceTimeoutID),this._debounceTimeoutID=setTimeout(function(){n._batchedGetPublicGroups(e)},200),this._usersPending[t].prom)}},{key:"_batchedGetPublicGroups",value:function(){var e=(0,a.coroutine)(o.default.mark(function e(t){var n,r,s=this;return o.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this._usersInFlight=this._usersPending,this._usersPending={},n={users:[]},e.prev=3,e.next=6,(0,a.resolve)(t.getPublicisedGroups((0,i.default)(this._usersInFlight)));case 6:n=e.sent,e.next=13;break;case 9:return e.prev=9,e.t0=e.catch(3),(0,i.default)(this._usersInFlight).forEach(function(t){s._usersInFlight[t]&&s._usersInFlight[t].reject(e.t0)}),e.abrupt("return");case 13:r=n.users,(0,i.default)(this._usersInFlight).forEach(function(e){s._usersInFlight[e]&&s._usersInFlight[e].resolve(r[e]||[])});case 15:case"end":return e.stop()}},e,this,[[3,9]])}));return function(t){return e.apply(this,arguments)}}()},{key:"getGroupProfileCached",value:function(){var e=(0,a.coroutine)(o.default.mark(function e(t,n){var r,i=this;return o.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._groupProfiles[n]){e.next=2;break}return e.abrupt("return",this._groupProfiles[n]);case 2:if(!this._groupProfilesPromise[n]){e.next=12;break}return e.prev=3,e.next=6,(0,a.resolve)(this._groupProfilesPromise[n]);case 6:e.next=11;break;case 8:return e.prev=8,e.t0=e.catch(3),e.abrupt("return",null);case 11:return e.abrupt("return",this._groupProfiles[n]);case 12:return console.log("FlairStore: Request group profile of "+n),this._groupProfilesPromise[n]=t.getGroupProfile(n),r=void 0,e.prev=15,e.next=18,(0,a.resolve)(this._groupProfilesPromise[n]);case 18:r=e.sent,e.next=26;break;case 21:return e.prev=21,e.t1=e.catch(15),console.log("FlairStore: Failed to get group profile for "+n,e.t1),delete this._groupProfilesPromise[n],e.abrupt("return",null);case 26:return this._groupProfiles[n]={groupId:n,avatarUrl:r.avatar_url,name:r.name,shortDescription:r.short_description},delete this._groupProfilesPromise[n],console.log("FlairStore: Emit updateGroupProfile for "+n),this.emit("updateGroupProfile"),setTimeout(function(){i.refreshGroupProfile(t,n)},18e5),e.abrupt("return",this._groupProfiles[n]);case 32:case"end":return e.stop()}},e,this,[[3,8],[15,21]])}));return function(t,n){return e.apply(this,arguments)}}()},{key:"refreshGroupProfile",value:function(e,t){return delete this._groupProfiles[t],this.getGroupProfileCached(e,t)}}]),t}(f.default);void 0===r.singletonFlairStore&&(r.singletonFlairStore=new g),t.default=r.singletonFlairStore,e.exports=t.default}).call(this,n(18))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=s(n(17)),o=s(n(14));t.getDisplayAliasForRoom=function(e){return e.getCanonicalAlias()||e.getAliases()[0]},t.getOnlyOtherMember=l,t.isConfCallRoom=function(e,t,n){if(void 0!==u[e.roomId])return u[e.roomId];var r=function(e,t,n){if(!n)return!1;if("join"!=e.getMyMembership())return!1;var r=l(e,t);if(!r)return!1;if(n.isConferenceUser(r.userId))return!0;return!1}(e,t,n);return u[e.roomId]=r,r},t.looksLikeDirectMessageRoom=function(e,t){var n=e.getMyMembership(),r=e.getMember(t);if("join"==n||"ban"===n||r&&r.isKicked()){var i=(0,o.default)(e.tags),a=e.currentState.getJoinedMemberCount()+e.currentState.getInvitedMemberCount();if(2===a&&!i.length)return!0}return!1},t.guessAndSetDMRoom=function(e,t){var n=void 0;if(t){var o=function(e,t){var n=void 0,o=void 0,i=!0,a=!1,s=void 0;try{for(var l,u=(0,r.default)(e.getJoinedMembers());!(i=(l=u.next()).done);i=!0){var c=l.value;c.userId!=t&&((void 0===n||c.events.member&&c.events.member.getTs()-1&&h.splice(m,1)}}}catch(e){u=!0,c=e}finally{try{!l&&p.return&&p.return()}finally{if(u)throw c}}if(t){var g=s[t]||[];-1==g.indexOf(e)&&g.push(e),s[t]=g}return i.default.get().setAccountData("m.direct",s)}},function(e,t){e.exports=function(e){return null!=e&&"object"==typeof e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(212),i=(r=o)&&r.__esModule?r:{default:r};t.default=function(){var e=window.pageYOffset,t=window.pageXOffset,n=t+window.innerWidth,r=e+window.innerHeight;return(0,i.default)({top:e,left:t,right:n,bottom:r})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e){return"private-react-beautiful-dnd-key-do-not-use-"+e};t.storeKey=r("store"),t.droppableIdKey=r("droppable-id"),t.dimensionMarshalKey=r("dimension-marshal"),t.styleContextKey=r("style-context"),t.canLiftContextKey=r("can-lift")},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t,n){var r=n(544),o=n(358);e.exports=Object.keys||function(e){return r(e,o)}},function(e,t,n){var r=n(102),o=Math.max,i=Math.min;e.exports=function(e,t){return(e=r(e))<0?o(e+t,0):i(e,t)}},function(e,t,n){var r=n(26),o=n(545),i=n(358),a=n(357)("IE_PROTO"),s=function(){},l=function(){var e,t=n(355)("iframe"),r=i.length;for(t.style.display="none",n(359).appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("