!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=v(r,a)}return r}function v(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 f=d.slice(2),p=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,f):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),""!==p&&n.splice(l,0,p)}}}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 y(){return new u.default(function(e,t){var r=void 0;try{r=n(1519)}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 b(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(251),i=(r=o)&&r.__esModule?r:{default:r};t.default=function(){function e(e,t){for(var n=0;n0;)p(e)}function p(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(){f(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,f(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 f={promiseRejectionQueued:!1,promise:c,target:d,bindingPromise:u};d._then(t,a,void 0,c,f),u._then(s,l,void 0,c,f),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"),f=c.canAttachTrace,p=/[\\\/]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&&W()){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=B,n.prototype._attachExtraTrace=U,n.prototype._dereferenceTrace=j,r.activateLongStackTraces(),l.disableTrampolineIfNecessary()}},n.hasLongStackTraces=function(){return Z.longStackTraces&&W()};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 N(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 A(){return this._onCancelField}function I(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=A,n.prototype._setOnCancel=I,n.prototype._attachCancellationCallback=N,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 B(){this._trace=new J(this._peekContext())}function U(e,t){if(f(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=q(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=q(i);i.stack=a.message+"\n"+a.stack.join("\n")}R("warning",i)||z(i,"",!0)}}function V(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:V(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 W(){return"function"==typeof X}var Y=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=q(e),n=t.message,r=[t.stack],o=this;void 0!==o;)r.push(V(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=V(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 f=l[0];for(u=0;u0&&(a="\n"+s[u-1]);break}}}var p="a promise was created in a "+n+"handler "+i+"but was not returned from it, see http://goo.gl/rRqMUw"+a;r._warn(p,!0,t)}},setBounds:function(e,t){if(W()){for(var n,r,o=e.stack.split("\n"),i=t.stack.split("\n"),a=-1,s=-1,l=0;l=s||(Y=function(e){if(p.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"),f=c("CancellationError","cancellation error"),p=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 p.call(this,this.promise._target()._settledValue())}function f(e){if(!c(this,e))return a.e=e,a}function p(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 p=n(l,o);if(p instanceof t){if(null!=this.cancelPromise){if(p._isCancelled()){var h=new i("late cancellation observer");return o._attachExtraTrace(h),a.e=h,a}p.isPending()&&p._attachCancellationCallback(new u(this))}return p._then(d,f,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,p,p)},t.prototype.tap=function(e){return this._passThrough(e,1,p)},t.prototype.tapCatch=function(e){var n=arguments.length;if(1===n)return this._passThrough(e,1,void 0,p);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 f(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 p(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 f(e,n,a="number"==typeof a&&isFinite(a)&&a>=1?a:0,i).promise()}l.inherits(f,n),f.prototype._asyncInit=function(){this._init$(void 0,-2)},f.prototype._init=function(){},f.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,f=this._callback,p=d._boundValue();d._pushContext();var h=u(f).call(p,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)},f.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 f.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 p,h,_=l._settlePromiseCtx;0!=(33554432&c)?(h=l._rejectionHandler0,p=e):0!=(16777216&c)?(h=l._fulfillmentHandler0,p=t,l._unsetRejectionIsUnhandled()):(_=l._settlePromiseLateCancellationObserver,h=new m("late cancellation observer"),l._attachExtraTrace(h),p=t),f.invoke(_,l,{handler:null===d?p:"function"==typeof p&&u.domainBind(d,p),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(){f.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():f.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 f.fatalError(e,u.isNode);(65535&t)>0?f.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:N}},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,f,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),A({a:1}),A({b:2}),A({c:3}),A(1),A(function(){}),A(void 0),A(!1),A(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,f={};function p(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 p(e)}if(l instanceof t)return l._then(i,p,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():f},m.prototype.tryDispose=function(e){var t=this.resource(),n=this._context;void 0!==n&&n._pushContext();var r=t!==f?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 f=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 p(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 p(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||q[0]>0),V.isNode&&V.toFastProperties(t);try{throw new Error}catch(e){V.lastLineError=e}r.exports=V},{"./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(66),n(18),n(243).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:W(e)}function o(e){return l(e)?e:Y(e)}function i(e){return a(e)&&!u(e)?e:$(e)}function a(e){return!(!e||!e[d])}function s(e){return!(!e||!e[f])}function l(e){return!(!e||!e[p])}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__@@",f="@@__IMMUTABLE_KEYED__@@",p="@@__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 N(e,t,0)}function D(e,t){return N(e,t,t)}function N(e,t,n){return void 0===e?n:e<0?Math.max(0,t+e):void 0===t?e:Math.min(t,e)}var A=0,I=1,O=2,M="function"==typeof Symbol&&Symbol.iterator,P="@@iterator",L=M||P;function B(e){this.next=e}function U(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 V(e){return e&&"function"==typeof e.next}function q(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 W(e){return null==e?ie().toKeyedSeq():a(e)?s(e)?e.toSeq():e.fromEntrySeq():ae(e)}function Y(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()}B.prototype.toString=function(){return"[Iterator]"},B.KEYS=A,B.VALUES=I,B.ENTRIES=O,B.prototype.inspect=B.prototype.toSource=function(){return this.toString()},B.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(W,K),W.prototype.toKeyedSeq=function(){return this},t(Y,K),Y.of=function(){return Y(arguments)},Y.prototype.toIndexedSeq=function(){return this},Y.prototype.toString=function(){return this.__toString("Seq [","]")},Y.prototype.__iterate=function(e,t){return ue(this,e,t,!1)},Y.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=W,K.Set=$,K.Indexed=Y;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():V(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):V(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 B(function(){var e=o[n?i-a:a];return a++>i?{value:void 0,done:!0}:U(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,Y(n).map(function(r,o){return e(t,r,o,n)})):pe(n)?t.call(o,r,W(n).map(function(r,o){return e(t,r,o,n)})):n}(t,e,"",{"":e}):fe(e)}function fe(e){return Array.isArray(e)?Y(e).map(fe).toList():pe(e)?W(e).map(fe).toMap():e}function pe(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,f=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===f}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}:U(e,o,n[t?r-o++:o++])})},t(te,W),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 B(function(){var a=r[t?o-i:i];return i++>o?{value:void 0,done:!0}:U(e,a,n[a])})},te.prototype[h]=!0,t(ne,Y),ne.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);var n=this._iterable,r=q(n),o=0;if(V(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=q(n);if(!V(r))return new B(j);var o=0;return new B(function(){var t=r.next();return t.done?t:U(e,o++,t.value)})},t(re,Y),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 U(e,o,r[o++])})},t(ge,Y),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}:U(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>Ie?(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[Ae]))return t;if(!Fe){if(void 0!==(t=e.propertyIsEnumerable&&e.propertyIsEnumerable[Ae]))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=++Ne,1073741824&Ne&&(Ne=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,Ae,{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[Ae]=t;else{if(void 0===e.nodeType)throw new Error("Unable to set a non-enumerable property on object.");e[Ae]=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 We(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}Ve[Ge]=!0,Ve.delete=Ve.remove,Ve.removeIn=Ve.deleteIn,qe.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 We(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,f,u,s,h);if(c&&!h&&2===f.length&&tt(f[1^d]))return f[1^d];if(c&&h&&1===f.length&&tt(h))return h;var y=e&&e===this.ownerID,b=c?h?u:u^l:u|l,E=c?h?lt(f,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 f=this.count;if(c){if(!d&&--f0&&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)},ft.prototype.remove=function(e){return this.has(e)?0===e?this.shift():e===this.size-1?this.pop():this.splice(e,1):this},ft.prototype.insert=function(e,t){return this.splice(e,0,t)},ft.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()},ft.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),f=Rt(s);f>=1<d?new gt([],r):p;if(p&&f>d&&am;v-=m){var y=d>>>v&_;g=g.array[y]=Ct(g.array[y],r)}g.array[d>>>m&_]=p}if(s=f)a-=f,s-=f,l=m,u=null,h=h&&h.removeBefore(r,0,a);else if(a>o||f>>l&_;if(b!==f>>>l&_)break;b&&(c+=(1<o&&(u=u.removeBefore(r,l,a-c)),u&&fi&&(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):Nt(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 Bt(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 B(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===I?A:I,n)},t}function Ut(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 B(function(){var o=i.next();if(o.done)return o;var a=o.value,s=a[0];return U(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=Bt(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 B(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 U(o,r?u:s++,c,i)}})},o}function Vt(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 Vt(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===I?e:U(t,l-1,t===A?void 0:e.value[1],e)})},u}function qt(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 B(function(){var e,i,c;do{if((e=s.next()).done)return r||o===I?e:U(o,u++,o===A?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:U(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 Yt(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(I,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),q(o?e.reverse():e)}),a=0,s=!1;return new B(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}:U(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)?W:l(e)?Y:$).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 B(function(){if(r){var t=r.value;return r=r.next,U(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=Ve.withMutations,kn.asMutable=Ve.asMutable,kn.asImmutable=Ve.asImmutable,kn.wasAltered=Ve.wasAltered,n.Iterator=B,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 Be(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 ft(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(A)},map:function(e,t){return $t(this,Ut(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,Vt(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(I)},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=Be().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(In).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():Be()).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(An).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):Bn)},minBy:function(e,t){return Kt(this,t?Mn(t):Bn,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,qt(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 B(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:U(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+Un(xe(e),xe(t))|0}:function(e,t){r=r+Un(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,Bt(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 Nn=r.prototype;function An(e,t){return t}function In(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 Bn(e,t){return et?-1:0}function Un(e,t){return e^t+2654435769+(e<<6)+(e>>2)|0}return Nn[f]=!0,Nn[L]=Dn.entries,Nn.__toJS=Dn.toObject,Nn.__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,Vt(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;o2?n-2:0),o=2;o1?t-1:0),r=1;r1?t-1:0),r=1;r2?n-2:0),o=2;o2?n-2:0),o=2;o=0&&n._modals.splice(a,1),n._priorityModal===e&&(n._priorityModal=null,n._modals=[]),n._staticModal===e&&(n._staticModal=null,n._modals=[]),n._reRender()}}},{key:"createDialogAsync",value:function(e,t,n,r,o){var i=this._buildModal(e,t,n),a=i.modal,s=i.closeDialog;return r?this._priorityModal=a:o?this._staticModal=a:this._modals.unshift(a),this._reRender(),{close:s}}},{key:"appendDialogAsync",value:function(e,t,n){var r=this._buildModal(e,t,n),o=r.modal,i=r.closeDialog;return this._modals.push(o),this._reRender(),{close:i}}},{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 f=c.value;e.unwatchSetting(this._monitors[t][f])}}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 f=d.getValue(n,r);return e._getFinalValue(a,t,r,f,t)}for(var p=l;p")),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,f=O[d];try{var p=f.getValue(t,n);console.log("--- "+d+"@"+(n||"")+" = "+(0,r.default)(p))}catch(e){console.log("--- "+f+"@"+(n||"")+" THREW ERROR: "+e.message),console.error(e)}if(n)try{var h=f.getValue(t,null);console.log("--- "+d+"@ = "+(0,r.default)(h))}catch(e){console.log("--- "+f+"@ 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}();V._watchers={},V._monitors={},t.default=V,e.mxSettingsStore=V}).call(this,n(18))},function(e,t,n){(function(t){var r=n(620);const o=n(133),i=n(1499);var a;r.request(function(e,t){return e.qs=i.stringify(e.qs||{},e.qsStringifyOptions),o(e,t)});try{a=t.indexedDB}catch(e){}a&&r.setCryptoStoreFactory(function(){return new r.IndexedDBCryptoStore(a,"matrix-js-sdk:crypto")}),e.exports=r,t.matrixcs=r}).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},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,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:Y.createList(l)})}}]),t}(Object(i.Record)(D)),A={data:void 0,key:void 0,nodes:void 0,type:void 0},I=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:Y.createList(l)})}},{key:"isInlineList",value:function(e){return i.List.isList(e)&&e.every(function(e){return t.isInline(e)})}}]),t}(Object(i.Record)(A)),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)),B=!0,U=0,j={},G={},V=void 0;function q(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&&(U=0)}function H(e){B=e}var K={leaves:void 0,key:void 0},W=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),f=d[0],p=d[1],h=l.concat(f.map(function(e){return e.addMarks(n)}),p);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 f=d.splice(s,1,a.set("text",u),L.create({text:t,marks:n}),a.set("text",c));return this.setLeaves(f)}},{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),f=d[0],p=d[1],h=l.concat(f.map(function(e){return e.removeMark(n)}),p);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],f=c[1],p=L.splitLeaves(f,t)[1],h=L.createLeaves(d.concat(p));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],f=L.splitLeaves(d,t),p=T(f,2),h=p[0],m=p[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));q(W.prototype,["getActiveMarks","getMarks","getMarksAsArray"]);var Y=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 N.create(t);case"inline":return I.create(t);case"text":return W.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)||I.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 N.fromJSON(e);case"inline":return I.fromJSON(e);case"text":return W.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)||N.isDocument(e)||I.isInline(e)||W.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:Y.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 fe(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 pe(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=fe(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 f=o.getPreviousText(d.key),p=o.getClosestBlock(f.key),h=o.getClosestVoid(f.key,i);if(h)return void e.removeNodeByKey(h.key);if(1==n&&p!=c)return t=t.moveAnchorTo(f.key,f.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 f=o.getDescendant(s.key);if(s.isAtEndOfNode(f)){var p=o.getNextText(f.key),h=o.getClosestBlock(p.key),m=o.getClosestVoid(p.key,i);if(m)return void e.removeNodeByKey(m.key);if(1==n&&h!=c)return t=t.moveFocusTo(p.key,0),void e.deleteAtRange(t)}if(n<=f.text.length-l.offset)return t=t.moveFocusForward(n),void e.deleteAtRange(t);for(var g=f,_=l.offset,v=f.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),f=d.nodes.indexOf(u);if(i.isVoid(u)){var p=a.isAtEndOfNode(u)?1:0;e.insertNodeByKey(d.key,f+p,n)}else if(c||""!==u.text)if(a.isAtStartOfNode(u))e.insertNodeByKey(d.key,f,n);else if(a.isAtEndOfNode(u))e.insertNodeByKey(d.key,f+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,f+1,n)})}else e.insertNodeByKey(d.key,f+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),f=s.getParent(u.key),p=f.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=f.nodes.indexOf(u);(n=n.removeNode(y.key)).nodes.forEach(function(t,n){var r=b+n+1;e.insertNodeByKey(f.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(f.key,p,_)}}})},ue.insertInlineAtRange=function(e,t,n){n=I.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),f=o.getClosestBlock(l.key),p=0==u&&0==s.offset&&0==l.offset&&0==c&&s.key==d.getFirstText().key&&l.key==f.getFirstText().key?a.slice(0,-1):a;e.withoutNormalizing(function(){p.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:fe,decrement:pe,increment:he,isAbove:me,isAfter:function(e,t){var n=fe(e,t),r=T(n,2);return 1===ce(r[0],r[1])},isBefore:function(e,t){var n=fe(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=fe(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=pe(e=he(e,1,a),r,a+1))),"move_node"===n){var c=t.newPath,d=c.size-1,f=ge(c,e),p=_e(c,e),h=me(c,e);u?e=c.concat(e.slice(o.size)):(s?e=c:l&&(e=pe(e,1,a)),(f||p||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=Y.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=I.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=Y.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},Ne=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)),Ae={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 Ie(e,t){return!(!t||!t[Ae[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 Ie("range",e)||Ne.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)),Be={};function Ue(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 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.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 f=i.getClosestBlock(l.path).hasNode(d.key),p=d&&i.hasVoidParent(d.key,s);if(e["move"+r+"ToEndOfNode"](d),!u&&!p&&f){var h=e.value.selection["move"+r+"Backward"](n);e.select(h)}}}}}function qe(e,t){var n=arguments.length>2&&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.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 f=i.getNextText(l.path);if(f){var p=i.getClosestBlock(l.path).hasNode(f.key),h=i.hasVoidParent(f.key,s);if(e["move"+r+"ToStartOfNode"](f),!c&&!h&&p){var m=e.value.selection["move"+r+"Forward"](n);e.select(m)}}}}}Be.blur=function(e){e.select({isFocused:!1})},Be.deselect=function(e){var t=Le.create();e.select(t)},Be.focus=function(e){e.select({isFocused:!0})},Be.flip=function(e){e.call(Ue,"flip")},Be.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 f in c=s.resolveSelection(c),t=d()(c,Object.keys(t)))!0!==o&&Object(i.is)(t[f],l[f])||(u[f]=t[f]);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}:{})},Be.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 f=c.push(e);o=(o=o.pop()).push(f)}else{var p=new i.List([e]);o=o.push(p)}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 We={plugins:void 0},Ye=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)(We));q(Ye.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=p()("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,W.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=W.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=W.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,f=void 0===d?{}:d,p=c.inlines,h=void 0===p?{}:p,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)),f)r.push(w({match:[{object:"block",type:_}]},f[_]));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:Ye.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 f=tt(e,c.value,n);if(a=a||f,o&&f)return f;if(!o&&!f)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,f=void 0;function p(){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],f=r[s+1],null!=u&&i==u&&p(),!!c}function m(){i-=1,s-=1}null!=t.nodes&&p();for(;h();){var g=nt(e,c,n)||rt(e,c,d,s,n)||ot(e,c,f,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&&p()){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=Ne.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(!Ne.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?N.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=Ne.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,f=e.schema,p=void 0===f?{}:f,h=e.history,m=void 0===h?{}:h;if(o=F.fromJSON(o),p=Ze.fromJSON(p),m=Ke.fromJSON(m),d=(u=N.fromJSON(u)).createSelection(d),s=Object(i.List)(s.map(function(e){return Ne.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:p,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,Be,lt),ct=p()("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,f=d.path,p=d.offset,h=d.text,m=d.marks;return e.insertText(f,p,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,N=D.path,A=D.offset,I=D.length,O=D.mark,M=D.properties;return e.setMark(N,A,I,O,M);case"set_node":var P=t,L=P.path,B=P.properties;return e.setNode(L,B);case"set_selection":var U=t.properties;return e.setSelection(U);case"set_value":var j=t.properties;return e.setProperties(j);case"split_node":var G=t,V=G.path,q=G.position,z=G.properties;return e.splitNode(V,q,z);default:throw new Error('Unknown operation type: "'+n+'".')}}var ft=p()("slate:operation:invert");function pt(e){var t=(e=gt.create(e)).type;switch(ft(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=Y.create(d)),"selection"===c&&(d=Le.create(d)),"value"===c&&(d=st.create(d)),"properties"===c&&"merge_node"===n&&(d=Y.createProperties(d)),"properties"===c&&"set_mark"===n&&(d=M.createProperties(d)),"properties"===c&&"set_node"===n&&(d=Y.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=Y.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=p()("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 f=ye.lift(r),p=ye.lift(o);return ye.isSibling(r,o)||(p.size&&ye.isYounger(r,o)&&(p=ye.decrement(p,1,r.size-1)),f.size&&ye.isYounger(o,r)&&(f=ye.increment(f,1,o.size-1))),[f,p];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,f=Object.getOwnPropertyNames(e)[Symbol.iterator]();!(l=(d=f.next()).done);l=!0){var p=d.value;if(!s.hasOwnProperty(p)){var h=Object.getOwnPropertyDescriptor(e,p);Object.defineProperty(s,p,h)}}}catch(e){u=!0,c=e}finally{try{!l&&f.return&&f.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=Ae[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]=Ie.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 N.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 N.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}(),[Ne,Me,Le]);var Ft={apply:dt,invert:pt},Dt={Block:Q,Changes:ut,Data:F,Decoration:Ne,Document:N,History:Ke,Inline:I,KeyUtils:y,Leaf:L,Mark:M,Node:Y,Operation:gt,Operations:Ft,PathUtils:ye,Point:Fe,Range:Me,resetMemoization:z,Schema:Ze,Selection:Le,Stack:Ye,Text:W,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(38);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t,n){e.exports={default:n(1306),__esModule:!0}},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>>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){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,n){e.exports={default:n(399),__esModule:!0}},function(e,t,n){"use strict";t.__esModule=!0;var r,o=n(130),i=(r=o)&&r.__esModule?r:{default:r};t.default=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. */var r=n(2303);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(107),o=Math.min;e.exports=function(e){return e>0?o(r(e),9007199254740991):0}},function(e,t,n){var r=n(46),o=n(175),i=n(140),a=Object.defineProperty;t.f=n(47)?Object.defineProperty:function(e,t,n){if(r(e),t=i(t,!0),r(n),o)try{return a(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){var r=n(39);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t,n){e.exports=!n(63)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,n){"use strict";t.__esModule=!0;var r,o=n(251),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={default:n(1462),__esModule:!0}},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 f(this,e,!0)},s.prototype.rawListeners=function(e){return f(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},s.prototype.listenerCount=p,s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){const r=n(307),o=r.getLogger("matrix");o.setLevel(r.levels.DEBUG),e.exports=o},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var r=n(127);e.exports=function(e){return Object(r(e))}},function(e,t,n){var r=n(178),o=n(110);e.exports=function(e){return r(o(e))}},function(e,t,n){var r=n(2337);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(2338)},function(e,t,n){"use strict";t.__esModule=!0;var r=i(n(432)),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){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t){e.exports={}},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 f(){c&&l&&(c=!1,l.length?u=l.concat(u):d=-1,u.length&&p())}function p(){if(!c){var e=s(f);c=!0;for(var t=u.length;t;){for(l=u,u=[];++d1)for(var n=1;n"):e.replace(p,"#/$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){"use strict";t.__esModule=!0;var r=a(n(400)),o=a(n(402)),i="function"==typeof o.default&&"symbol"==typeof r.default?function(e){return typeof e}:function(e){return e&&"function"==typeof o.default&&e.constructor===o.default&&e!==o.default.prototype?"symbol":typeof e};function a(e){return e&&e.__esModule?e:{default:e}}t.default="function"==typeof o.default&&"symbol"===i(r.default)?function(e){return void 0===e?"undefined":i(e)}:function(e){return e&&"function"==typeof o.default&&e.constructor===o.default&&e!==o.default.prototype?"symbol":void 0===e?"undefined":i(e)}},function(e,t,n){e.exports={default:n(410),__esModule:!0}},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){"use strict";var r=n(237)(!0);n(138)(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,n=this._i;return n>=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t,n){var r=n(111);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){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,n){var r=n(177),o=n(132);e.exports=Object.keys||function(e){return r(e,o)}},function(e,t,n){var r=n(29),o=n(21),i=n(63);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(1452),__esModule:!0}},function(e,t,n){"use strict";var r=n(1478),o=n(1479);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),f=["/","?","#"],p=/^[+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(316);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?I+="x":I+=A[O];if(!I.match(p)){var P=D.slice(0,T),L=D.slice(T+1),B=A.match(h);B&&(P.push(B[1]),L.unshift(B[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 U=this.port?":"+this.port:"",j=this.hostname||"";this.host=j+U,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,N=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(15)),i=y(n(48)),a=y(n(6)),s=y(n(3)),l=y(n(4)),u=y(n(7)),c=y(n(8)),d=y(n(14)),f=y(n(49)),p=n(10),h=(r=(0,p.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,p.resolve)(new f.default(function(e,t){C.push(e)}));case 3:return S++,e.prev=4,e.next=7,(0,p.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(56)),g=n(265),_=y(n(159)),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});var r=S(n(6)),o=S(n(7)),i=S(n(8)),a=S(n(3)),s=S(n(4)),l=S(n(27)),u=S(n(15));t.mightContainEmoji=N,t.isSingleEmoji=function(e){return N(e)&&R.test(e)},t.unicodeToShortcode=function(e){var t=b.default.find(function(t){return t.unicode===e});return t&&t.shortcodes?":"+t.shortcodes[0]+":":""},t.shortcodeToUnicode=function(e){e=e.slice(1,e.length-1);var t=b.default.find(function(t){return t.shortcodes&&t.shortcodes.includes(e)});return t?t.unicode:null},t.processHtmlForSending=function(e){var t=document.createElement("div");if(t.innerHTML=e,0===t.children.length)return t.innerHTML;for(var n="",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,f.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&&D.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=O);var a=void 0,s=void 0,l=void 0;try{if(t&&t.length>0){var u=new P("mx_EventTile_searchHighlight",n.highlightLink),p=t.map(function(e){return(0,f.default)(e,i)});i.textFilter=function(e){return u.applyHighlights(e,p).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=N(r?h:e.body),r&&(l=!0,s=(0,f.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=L,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,f.default)(L(e),I)};var c=S(n(269)),d=S(n(0)),f=S(n(460)),p=(S(n(474)),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(1881))),h=S(n(217)),m=S(n(1886)),g=S(n(1888)),_=(S(n(951)),S(n(22))),v=S(n(9)),y=S(n(79)),b=S(n(953)),E=S(n(1893));function S(e){return e&&e.__esModule?e:{default:e}}(0,h.default)(p);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=new RegExp("^("+E.default.source+")$","i"),F=/^#[0-9a-fA-F]{6}$/,D=["http","https","ftp","mailto","magnet"];function N(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&&F.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:D,allowProtocolRelative:!1,transformTags:A},O=(0,l.default)({},I);O.transformTags={code:A.code,"*":A["*"]};var M=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}(),P=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}(M);!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}}])}(M);function L(e){return(0,g.default)(e)}},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(36)),o=i(n(48));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){var r=n(53),o=n(164);e.exports=n(52)?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(31),o=n(83),i=n(93),a=n(165)("src"),s=n(1104),l=(""+s).split("toString");n(104).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(37),i=n(127),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=!0},function(e,t,n){var r=n(110);e.exports=function(e){return Object(r(e))}},function(e,t,n){"use strict";var r=n(307),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.RoomPermalinkCreator=t.baseUrl=t.host=void 0;var r=f(n(15)),o=f(n(17)),i=f(n(62)),a=f(n(208)),s=f(n(3)),l=f(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=f(n(9)),c=f(n(1693)),d=f(n(33));function f(e){return e&&e.__esModule?e:{default:e}}var p=t.host="matrix.to",h=t.baseUrl="https://"+p,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,KEY_BACKTICK:223}},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;l0)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(37);e.exports=function(e,t){return!!e&&r(function(){t?e.call(null,function(){},1):e.call(null)})}},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){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,n){var r=n(46),o=n(200),i=n(132),a=n(113)("IE_PROTO"),s=function(){},l=function(){var e,t=n(139)("iframe"),r=i.length;for(t.style.display="none",n(201).appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("