@pie-element/explicit-constructed-response 9.3.4-next.0 → 10.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/configure/lib/alternateResponses.js +139 -184
- package/configure/lib/alternateResponses.js.map +1 -1
- package/configure/lib/alternateSection.js +272 -369
- package/configure/lib/alternateSection.js.map +1 -1
- package/configure/lib/defaults.js +2 -3
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/ecr-toolbar.js +124 -186
- package/configure/lib/ecr-toolbar.js.map +1 -1
- package/configure/lib/index.js +126 -203
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/main.js +434 -550
- package/configure/lib/main.js.map +1 -1
- package/configure/lib/markupUtils.js +26 -49
- package/configure/lib/markupUtils.js.map +1 -1
- package/configure/lib/utils.js +5 -5
- package/configure/lib/utils.js.map +1 -1
- package/configure/package.json +9 -7
- package/controller/lib/defaults.js +2 -3
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +169 -260
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +3 -3
- package/lib/index.js +71 -115
- package/lib/index.js.map +1 -1
- package/lib/main.js +174 -248
- package/lib/main.js.map +1 -1
- package/lib/print.js +39 -83
- package/lib/print.js.map +1 -1
- package/package.json +14 -15
- package/module/configure.js +0 -1
- package/module/controller.js +0 -7460
- package/module/demo.js +0 -45
- package/module/element.js +0 -1
- package/module/index.html +0 -21
- package/module/manifest.json +0 -22
- package/module/print-demo.js +0 -83
- package/module/print.html +0 -18
- package/module/print.js +0 -1
package/module/element.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_dll_debug as e,_dll_lodash as t,_dll_react as r,_dll_react_dom_server as n,_dll_prop_types as o,_dll_material_ui__core_styles as i,_dll_classnames as a,_dll_react_dom as s,_dll_material_ui__core as u,_dll_pie_lib__render_ui as c,_dll_material_ui__icons as l,_dll_pie_lib__correct_answer_toggle as f}from"../../../@pie-lib/shared-module@^1.17.5/module/index.js";import{_dll_pie_lib__math_rendering as h}from"../../../@pie-lib/math-rendering-module@^3.1.5/module/index.js";import{_dll_pie_lib__drag as d}from"../../../@pie-lib/drag-module@^2.11.5/module/index.js";import{_dll_pie_lib__editable_html as p}from"../../../@pie-lib/editable-html-module@^5.9.5/module/index.js";var v="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},y={};Object.defineProperty(y,"__esModule",{value:!0});class g extends CustomEvent{constructor(e,t,r){super(g.TYPE,{bubbles:!0,composed:!0,detail:{complete:t,component:e,hasModel:r}}),this.component=e,this.complete=t}}g.TYPE="model-set";var m=y.ModelSetEvent=g;class k extends CustomEvent{constructor(e,t){super(k.TYPE,{bubbles:!0,composed:!0,detail:{complete:t,component:e}}),this.component=e,this.complete=t}}k.TYPE="session-changed";var b=y.SessionChangedEvent=k,_=Object.prototype.toString,w=function(e){switch(_.call(e)){case"[object Function]":return"function";case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array";case"[object String]":return"string"}if("object"==typeof e&&e&&"number"==typeof e.length)try{if("function"==typeof e.callee)return"arguments"}catch(e){if(e instanceof TypeError)return"arguments"}return null===e?"null":void 0===e?"undefined":e&&1===e.nodeType?"element":e===Object(e)?"object":typeof e},x=function(e){return null!=e&&"object"==typeof e&&!1===Array.isArray(e)};function O(e){return!0===x(e)&&"[object Object]"===Object.prototype.toString.call(e)}var A=function(e){var t,r;return!1!==O(e)&&("function"==typeof(t=e.constructor)&&(!1!==O(r=t.prototype)&&!1!==r.hasOwnProperty("isPrototypeOf")))},S="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function E(){throw new Error("setTimeout has not been defined")}function N(){throw new Error("clearTimeout has not been defined")}var T=E,j=N;function P(e){if(T===setTimeout)return setTimeout(e,0);if((T===E||!T)&&setTimeout)return T=setTimeout,setTimeout(e,0);try{return T(e,0)}catch(t){try{return T.call(null,e,0)}catch(t){return T.call(this,e,0)}}}"function"==typeof S.setTimeout&&(T=setTimeout),"function"==typeof S.clearTimeout&&(j=clearTimeout);var C,B=[],z=!1,R=-1;function L(){z&&C&&(z=!1,C.length?B=C.concat(B):R=-1,B.length&&K())}function K(){if(!z){var e=P(L);z=!0;for(var t=B.length;t;){for(C=B,B=[];++R<t;)C&&C[R].run();R=-1,t=B.length}C=null,z=!1,function(e){if(j===clearTimeout)return clearTimeout(e);if((j===N||!j)&&clearTimeout)return j=clearTimeout,clearTimeout(e);try{j(e)}catch(t){try{return j.call(null,e)}catch(t){return j.call(this,e)}}}(e)}}function F(e,t){this.fun=e,this.array=t}F.prototype.run=function(){this.fun.apply(null,this.array)};function I(){}var D=I,M=I,J=I,U=I,V=I,q=I,W=I;var H=S.performance||{},$=H.now||H.mozNow||H.msNow||H.oNow||H.webkitNow||function(){return(new Date).getTime()};var Y=new Date;var G={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];B.push(new F(e,t)),1!==B.length||z||P(K)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:D,addListener:M,once:J,off:U,removeListener:V,removeAllListeners:q,emit:W,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*$.call(H),r=Math.floor(t),n=Math.floor(t%1*1e9);return e&&(r-=e[0],(n-=e[1])<0&&(r--,n+=1e9)),[r,n]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-Y)/1e3}},Q=G&&G.env&&G.env.FORBID_DEPRECATIONS,X=G&&G.env&&G.env.FORBID_WARNINGS,Z=void 0!==G&&G.env&&!0,ee="undefined"!=typeof console&&"function"==typeof console.log&&"function"==typeof console.warn&&"function"==typeof console.error;function te(e,t){if(Z&&ee){for(var r,n=arguments.length,o=Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];(r=console)[e].apply(r,[t].concat(o))}}function re(e,t){throw new Error(t)}var ne={deprecate:function(e,t){for(var r=Q?re:te,n=arguments.length,o=Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];r.apply(void 0,["warn","Deprecation ("+e+"): "+t].concat(o))},error:function(e){if(ee){for(var t,r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];(t=console).error.apply(t,[e].concat(n))}},warn:function(e){for(var t=X?re:te,r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];t.apply(void 0,["warn","Warning: "+e].concat(n))}},oe={};function ie(e){e&&(e.value=!0)}function ae(){}function se(e){return void 0===e.size&&(e.size=e.__iterate(ce)),e.size}function ue(e,t){if("number"!=typeof t){var r=t>>>0;if(""+r!==t||4294967295===r)return NaN;t=r}return t<0?se(e)+t:t}function ce(){return!0}function le(e,t,r){return(0===e&&!pe(e)||void 0!==r&&e<=-r)&&(void 0===t||void 0!==r&&t>=r)}function fe(e,t){return de(e,t,0)}function he(e,t){return de(e,t,t)}function de(e,t,r){return void 0===e?r:pe(e)?t===1/0?t:0|Math.max(0,t+e):void 0===t||t===e?e:0|Math.min(t,e)}function pe(e){return e<0||0===e&&1/e==-1/0}function ve(e){return Boolean(e&&e["@@__IMMUTABLE_ITERABLE__@@"])}function ye(e){return Boolean(e&&e["@@__IMMUTABLE_KEYED__@@"])}function ge(e){return Boolean(e&&e["@@__IMMUTABLE_INDEXED__@@"])}function me(e){return ye(e)||ge(e)}var ke=function(e){return ve(e)?e:Ie(e)},be=function(e){function t(e){return ye(e)?e:De(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(ke),_e=function(e){function t(e){return ge(e)?e:Me(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(ke),we=function(e){function t(e){return ve(e)&&!me(e)?e:Je(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(ke);ke.Keyed=be,ke.Indexed=_e,ke.Set=we;function xe(e){return Boolean(e&&e["@@__IMMUTABLE_SEQ__@@"])}function Oe(e){return Boolean(e&&e["@@__IMMUTABLE_RECORD__@@"])}function Ae(e){return ve(e)||Oe(e)}var Se="@@__IMMUTABLE_ORDERED__@@";function Ee(e){return Boolean(e&&e[Se])}var Ne="function"==typeof Symbol&&Symbol.iterator,Te=Ne||"@@iterator",je=function(e){this.next=e};function Pe(e,t,r,n){var o=0===e?t:1===e?r:[t,r];return n?n.value=o:n={value:o,done:!1},n}function Ce(){return{value:void 0,done:!0}}function Be(e){return!!Array.isArray(e)||!!Le(e)}function ze(e){return e&&"function"==typeof e.next}function Re(e){var t=Le(e);return t&&t.call(e)}function Le(e){var t=e&&(Ne&&e[Ne]||e["@@iterator"]);if("function"==typeof t)return t}je.prototype.toString=function(){return"[Iterator]"},je.KEYS=0,je.VALUES=1,je.ENTRIES=2,je.prototype.inspect=je.prototype.toSource=function(){return this.toString()},je.prototype[Te]=function(){return this};var Ke=Object.prototype.hasOwnProperty;function Fe(e){return!(!Array.isArray(e)&&"string"!=typeof e)||e&&"object"==typeof e&&Number.isInteger(e.length)&&e.length>=0&&(0===e.length?1===Object.keys(e).length:e.hasOwnProperty(e.length-1))}var Ie=function(e){function t(e){return null==e?He():Ae(e)?e.toSeq():function(e){var t=Ge(e);if(t)return(n=Le(r=e))&&n===r.entries?t.fromEntrySeq():function(e){var t=Le(e);return t&&t===e.keys}(e)?t.toSetSeq():t;var r,n;if("object"==typeof e)return new Ve(e);throw new TypeError("Expected Array or collection object of values, or keyed object: "+e)}(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.toSeq=function(){return this},t.prototype.toString=function(){return this.__toString("Seq {","}")},t.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},t.prototype.__iterate=function(e,t){var r=this._cache;if(r){for(var n=r.length,o=0;o!==n;){var i=r[t?n-++o:o++];if(!1===e(i[1],i[0],this))break}return o}return this.__iterateUncached(e,t)},t.prototype.__iterator=function(e,t){var r=this._cache;if(r){var n=r.length,o=0;return new je((function(){if(o===n)return{value:void 0,done:!0};var i=r[t?n-++o:o++];return Pe(e,i[0],i[1])}))}return this.__iteratorUncached(e,t)},t}(ke),De=function(e){function t(e){return null==e?He().toKeyedSeq():ve(e)?ye(e)?e.toSeq():e.fromEntrySeq():Oe(e)?e.toSeq():$e(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.toKeyedSeq=function(){return this},t}(Ie),Me=function(e){function t(e){return null==e?He():ve(e)?ye(e)?e.entrySeq():e.toIndexedSeq():Oe(e)?e.toSeq().entrySeq():Ye(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){return t(arguments)},t.prototype.toIndexedSeq=function(){return this},t.prototype.toString=function(){return this.__toString("Seq [","]")},t}(Ie),Je=function(e){function t(e){return(ve(e)&&!me(e)?e:Me(e)).toSetSeq()}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){return t(arguments)},t.prototype.toSetSeq=function(){return this},t}(Ie);Ie.isSeq=xe,Ie.Keyed=De,Ie.Set=Je,Ie.Indexed=Me,Ie.prototype["@@__IMMUTABLE_SEQ__@@"]=!0;var Ue=function(e){function t(e){this._array=e,this.size=e.length}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.get=function(e,t){return this.has(e)?this._array[ue(this,e)]:t},t.prototype.__iterate=function(e,t){for(var r=this._array,n=r.length,o=0;o!==n;){var i=t?n-++o:o++;if(!1===e(r[i],i,this))break}return o},t.prototype.__iterator=function(e,t){var r=this._array,n=r.length,o=0;return new je((function(){if(o===n)return{value:void 0,done:!0};var i=t?n-++o:o++;return Pe(e,i,r[i])}))},t}(Me),Ve=function(e){function t(e){var t=Object.keys(e);this._object=e,this._keys=t,this.size=t.length}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.get=function(e,t){return void 0===t||this.has(e)?this._object[e]:t},t.prototype.has=function(e){return Ke.call(this._object,e)},t.prototype.__iterate=function(e,t){for(var r=this._object,n=this._keys,o=n.length,i=0;i!==o;){var a=n[t?o-++i:i++];if(!1===e(r[a],a,this))break}return i},t.prototype.__iterator=function(e,t){var r=this._object,n=this._keys,o=n.length,i=0;return new je((function(){if(i===o)return{value:void 0,done:!0};var a=n[t?o-++i:i++];return Pe(e,a,r[a])}))},t}(De);Ve.prototype[Se]=!0;var qe,We=function(e){function t(e){this._collection=e,this.size=e.length||e.size}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);var r=Re(this._collection),n=0;if(ze(r))for(var o;!(o=r.next()).done&&!1!==e(o.value,n++,this););return n},t.prototype.__iteratorUncached=function(e,t){if(t)return this.cacheResult().__iterator(e,t);var r=Re(this._collection);if(!ze(r))return new je(Ce);var n=0;return new je((function(){var t=r.next();return t.done?t:Pe(e,n++,t.value)}))},t}(Me);function He(){return qe||(qe=new Ue([]))}function $e(e){var t=Ge(e);if(t)return t.fromEntrySeq();if("object"==typeof e)return new Ve(e);throw new TypeError("Expected Array or collection object of [k, v] entries, or keyed object: "+e)}function Ye(e){var t=Ge(e);if(t)return t;throw new TypeError("Expected Array or collection object of values: "+e)}function Ge(e){return Fe(e)?new Ue(e):Be(e)?new We(e):void 0}function Qe(e){return Boolean(e&&e["@@__IMMUTABLE_MAP__@@"])}function Xe(e){return Qe(e)&&Ee(e)}function Ze(e){return Boolean(e&&"function"==typeof e.equals&&"function"==typeof e.hashCode)}function et(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!=e&&t!=t)return!0;if(!e||!t)return!1}return!!(Ze(e)&&Ze(t)&&e.equals(t))}var tt="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(e,t){var r=65535&(e|=0),n=65535&(t|=0);return r*n+((e>>>16)*n+r*(t>>>16)<<16>>>0)|0};function rt(e){return e>>>1&1073741824|3221225471&e}var nt=Object.prototype.valueOf;function ot(e){if(null==e)return it(e);if("function"==typeof e.hashCode)return rt(e.hashCode(e));var t,r=(t=e).valueOf!==nt&&"function"==typeof t.valueOf?t.valueOf(t):t;if(null==r)return it(r);switch(typeof r){case"boolean":return r?1108378657:1108378656;case"number":return function(e){if(e!=e||e===1/0)return 0;var t=0|e;t!==e&&(t^=4294967295*e);for(;e>4294967295;)t^=e/=4294967295;return rt(t)}(r);case"string":return r.length>vt?function(e){var t=mt[e];void 0===t&&(t=at(e),gt===yt&&(gt=0,mt={}),gt++,mt[e]=t);return t}(r):at(r);case"object":case"function":return function(e){var t;if(ft&&void 0!==(t=lt.get(e)))return t;if(void 0!==(t=e[pt]))return t;if(!ut){if(void 0!==(t=e.propertyIsEnumerable&&e.propertyIsEnumerable[pt]))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=ct(),ft)lt.set(e,t);else{if(void 0!==st&&!1===st(e))throw new Error("Non-extensible objects are not allowed as keys.");if(ut)Object.defineProperty(e,pt,{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[pt]=t;else{if(void 0===e.nodeType)throw new Error("Unable to set a non-enumerable property on object.");e[pt]=t}}return t}(r);case"symbol":return function(e){var t=ht[e];if(void 0!==t)return t;return t=ct(),ht[e]=t,t}(r);default:if("function"==typeof r.toString)return at(r.toString());throw new Error("Value type "+typeof r+" cannot be hashed.")}}function it(e){return null===e?1108378658:1108378659}function at(e){for(var t=0,r=0;r<e.length;r++)t=31*t+e.charCodeAt(r)|0;return rt(t)}var st=Object.isExtensible,ut=function(){try{return Object.defineProperty({},"@",{}),!0}catch(e){return!1}}();function ct(){var e=++dt;return 1073741824&dt&&(dt=0),e}var lt,ft="function"==typeof WeakMap;ft&&(lt=new WeakMap);var ht=Object.create(null),dt=0,pt="__immutablehash__";"function"==typeof Symbol&&(pt=Symbol(pt));var vt=16,yt=255,gt=0,mt={},kt=function(e){function t(e,t){this._iter=e,this._useKeys=t,this.size=e.size}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.get=function(e,t){return this._iter.get(e,t)},t.prototype.has=function(e){return this._iter.has(e)},t.prototype.valueSeq=function(){return this._iter.valueSeq()},t.prototype.reverse=function(){var e=this,t=At(this,!0);return this._useKeys||(t.valueSeq=function(){return e._iter.toSeq().reverse()}),t},t.prototype.map=function(e,t){var r=this,n=Ot(this,e,t);return this._useKeys||(n.valueSeq=function(){return r._iter.toSeq().map(e,t)}),n},t.prototype.__iterate=function(e,t){var r=this;return this._iter.__iterate((function(t,n){return e(t,n,r)}),t)},t.prototype.__iterator=function(e,t){return this._iter.__iterator(e,t)},t}(De);kt.prototype[Se]=!0;var bt=function(e){function t(e){this._iter=e,this.size=e.size}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.includes=function(e){return this._iter.includes(e)},t.prototype.__iterate=function(e,t){var r=this,n=0;return t&&se(this),this._iter.__iterate((function(o){return e(o,t?r.size-++n:n++,r)}),t)},t.prototype.__iterator=function(e,t){var r=this,n=this._iter.__iterator(1,t),o=0;return t&&se(this),new je((function(){var i=n.next();return i.done?i:Pe(e,t?r.size-++o:o++,i.value,i)}))},t}(Me),_t=function(e){function t(e){this._iter=e,this.size=e.size}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.has=function(e){return this._iter.includes(e)},t.prototype.__iterate=function(e,t){var r=this;return this._iter.__iterate((function(t){return e(t,t,r)}),t)},t.prototype.__iterator=function(e,t){var r=this._iter.__iterator(1,t);return new je((function(){var t=r.next();return t.done?t:Pe(e,t.value,t.value,t)}))},t}(Je),wt=function(e){function t(e){this._iter=e,this.size=e.size}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.entrySeq=function(){return this._iter.toSeq()},t.prototype.__iterate=function(e,t){var r=this;return this._iter.__iterate((function(t){if(t){Lt(t);var n=ve(t);return e(n?t.get(1):t[1],n?t.get(0):t[0],r)}}),t)},t.prototype.__iterator=function(e,t){var r=this._iter.__iterator(1,t);return new je((function(){for(;;){var t=r.next();if(t.done)return t;var n=t.value;if(n){Lt(n);var o=ve(n);return Pe(e,o?n.get(0):n[0],o?n.get(1):n[1],t)}}}))},t}(De);function xt(e){var t=Ft(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=It,t.__iterateUncached=function(t,r){var n=this;return e.__iterate((function(e,r){return!1!==t(r,e,n)}),r)},t.__iteratorUncached=function(t,r){if(2===t){var n=e.__iterator(t,r);return new je((function(){var e=n.next();if(!e.done){var t=e.value[0];e.value[0]=e.value[1],e.value[1]=t}return e}))}return e.__iterator(1===t?0:1,r)},t}function Ot(e,t,r){var n=Ft(e);return n.size=e.size,n.has=function(t){return e.has(t)},n.get=function(n,o){var i=e.get(n,oe);return i===oe?o:t.call(r,i,n,e)},n.__iterateUncached=function(n,o){var i=this;return e.__iterate((function(e,o,a){return!1!==n(t.call(r,e,o,a),o,i)}),o)},n.__iteratorUncached=function(n,o){var i=e.__iterator(2,o);return new je((function(){var o=i.next();if(o.done)return o;var a=o.value,s=a[0];return Pe(n,s,t.call(r,a[1],s,e),o)}))},n}function At(e,t){var r=this,n=Ft(e);return n._iter=e,n.size=e.size,n.reverse=function(){return e},e.flip&&(n.flip=function(){var t=xt(e);return t.reverse=function(){return e.flip()},t}),n.get=function(r,n){return e.get(t?r:-1-r,n)},n.has=function(r){return e.has(t?r:-1-r)},n.includes=function(t){return e.includes(t)},n.cacheResult=It,n.__iterate=function(r,n){var o=this,i=0;return n&&se(e),e.__iterate((function(e,a){return r(e,t?a:n?o.size-++i:i++,o)}),!n)},n.__iterator=function(n,o){var i=0;o&&se(e);var a=e.__iterator(2,!o);return new je((function(){var e=a.next();if(e.done)return e;var s=e.value;return Pe(n,t?s[0]:o?r.size-++i:i++,s[1],e)}))},n}function St(e,t,r,n){var o=Ft(e);return n&&(o.has=function(n){var o=e.get(n,oe);return o!==oe&&!!t.call(r,o,n,e)},o.get=function(n,o){var i=e.get(n,oe);return i!==oe&&t.call(r,i,n,e)?i:o}),o.__iterateUncached=function(o,i){var a=this,s=0;return e.__iterate((function(e,i,u){if(t.call(r,e,i,u))return s++,o(e,n?i:s-1,a)}),i),s},o.__iteratorUncached=function(o,i){var a=e.__iterator(2,i),s=0;return new je((function(){for(;;){var i=a.next();if(i.done)return i;var u=i.value,c=u[0],l=u[1];if(t.call(r,l,c,e))return Pe(o,n?c:s++,l,i)}}))},o}function Et(e,t,r,n){var o=e.size;if(le(t,r,o))return e;var i=fe(t,o),a=he(r,o);if(i!=i||a!=a)return Et(e.toSeq().cacheResult(),t,r,n);var s,u=a-i;u==u&&(s=u<0?0:u);var c=Ft(e);return c.size=0===s?s:e.size&&s||void 0,!n&&xe(e)&&s>=0&&(c.get=function(t,r){return(t=ue(this,t))>=0&&t<s?e.get(t+i,r):r}),c.__iterateUncached=function(t,r){var o=this;if(0===s)return 0;if(r)return this.cacheResult().__iterate(t,r);var a=0,u=!0,c=0;return e.__iterate((function(e,r){if(!u||!(u=a++<i))return c++,!1!==t(e,n?r:c-1,o)&&c!==s})),c},c.__iteratorUncached=function(t,r){if(0!==s&&r)return this.cacheResult().__iterator(t,r);if(0===s)return new je(Ce);var o=e.__iterator(t,r),a=0,u=0;return new je((function(){for(;a++<i;)o.next();if(++u>s)return{value:void 0,done:!0};var e=o.next();return n||1===t||e.done?e:Pe(t,u-1,0===t?void 0:e.value[1],e)}))},c}function Nt(e,t,r,n){var o=Ft(e);return o.__iterateUncached=function(o,i){var a=this;if(i)return this.cacheResult().__iterate(o,i);var s=!0,u=0;return e.__iterate((function(e,i,c){if(!s||!(s=t.call(r,e,i,c)))return u++,o(e,n?i:u-1,a)})),u},o.__iteratorUncached=function(o,i){var a=this;if(i)return this.cacheResult().__iterator(o,i);var s=e.__iterator(2,i),u=!0,c=0;return new je((function(){var e,i,l;do{if((e=s.next()).done)return n||1===o?e:Pe(o,c++,0===o?void 0:e.value[1],e);var f=e.value;i=f[0],l=f[1],u&&(u=t.call(r,l,i,a))}while(u);return 2===o?e:Pe(o,i,l,e)}))},o}function Tt(e,t){var r=ye(e),n=[e].concat(t).map((function(e){return ve(e)?r&&(e=be(e)):e=r?$e(e):Ye(Array.isArray(e)?e:[e]),e})).filter((function(e){return 0!==e.size}));if(0===n.length)return e;if(1===n.length){var o=n[0];if(o===e||r&&ye(o)||ge(e)&&ge(o))return o}var i=new Ue(n);return r?i=i.toKeyedSeq():ge(e)||(i=i.toSetSeq()),(i=i.flatten(!0)).size=n.reduce((function(e,t){if(void 0!==e){var r=t.size;if(void 0!==r)return e+r}}),0),i}function jt(e,t,r){var n=Ft(e);return n.__iterateUncached=function(o,i){if(i)return this.cacheResult().__iterate(o,i);var a=0,s=!1;return function e(u,c){u.__iterate((function(i,u){return(!t||c<t)&&ve(i)?e(i,c+1):(a++,!1===o(i,r?u:a-1,n)&&(s=!0)),!s}),i)}(e,0),a},n.__iteratorUncached=function(n,o){if(o)return this.cacheResult().__iterator(n,o);var i=e.__iterator(n,o),a=[],s=0;return new je((function(){for(;i;){var e=i.next();if(!1===e.done){var u=e.value;if(2===n&&(u=u[1]),t&&!(a.length<t)||!ve(u))return r?e:Pe(n,s++,u,e);a.push(i),i=u.__iterator(n,o)}else i=a.pop()}return{value:void 0,done:!0}}))},n}function Pt(e,t,r){t||(t=Dt);var n=ye(e),o=0,i=e.toSeq().map((function(t,n){return[n,t,o++,r?r(t,n,e):t]})).valueSeq().toArray();return i.sort((function(e,r){return t(e[3],r[3])||e[2]-r[2]})).forEach(n?function(e,t){i[t].length=2}:function(e,t){i[t]=e[1]}),n?De(i):ge(e)?Me(i):Je(i)}function Ct(e,t,r){if(t||(t=Dt),r){var n=e.toSeq().map((function(t,n){return[t,r(t,n,e)]})).reduce((function(e,r){return Bt(t,e[1],r[1])?r:e}));return n&&n[0]}return e.reduce((function(e,r){return Bt(t,e,r)?r:e}))}function Bt(e,t,r){var n=e(r,t);return 0===n&&r!==t&&(null==r||r!=r)||n>0}function zt(e,t,r,n){var o=Ft(e),i=new Ue(r).map((function(e){return e.size}));return o.size=n?i.max():i.min(),o.__iterate=function(e,t){for(var r,n=this.__iterator(1,t),o=0;!(r=n.next()).done&&!1!==e(r.value,o++,this););return o},o.__iteratorUncached=function(e,o){var i=r.map((function(e){return e=ke(e),Re(o?e.reverse():e)})),a=0,s=!1;return new je((function(){var r;return s||(r=i.map((function(e){return e.next()})),s=n?r.every((function(e){return e.done})):r.some((function(e){return e.done}))),s?{value:void 0,done:!0}:Pe(e,a++,t.apply(null,r.map((function(e){return e.value}))))}))},o}function Rt(e,t){return e===t?e:xe(e)?t:e.constructor(t)}function Lt(e){if(e!==Object(e))throw new TypeError("Expected [K, V] tuple: "+e)}function Kt(e){return ye(e)?be:ge(e)?_e:we}function Ft(e){return Object.create((ye(e)?De:ge(e)?Me:Je).prototype)}function It(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):Ie.prototype.cacheResult.call(this)}function Dt(e,t){return void 0===e&&void 0===t?0:void 0===e?1:void 0===t?-1:e>t?1:e<t?-1:0}function Mt(e,t){t=t||0;for(var r=Math.max(0,e.length-t),n=new Array(r),o=0;o<r;o++)n[o]=e[o+t];return n}function Jt(e,t){if(!e)throw new Error(t)}function Ut(e){Jt(e!==1/0,"Cannot perform this action with an infinite size.")}function Vt(e){if(Fe(e)&&"string"!=typeof e)return e;if(Ee(e))return e.toArray();throw new TypeError("Invalid keyPath: expected Ordered Collection or Array: "+e)}bt.prototype.cacheResult=kt.prototype.cacheResult=_t.prototype.cacheResult=wt.prototype.cacheResult=It;var qt=Object.prototype.toString;function Wt(e){return"object"==typeof e&&(Ae(e)||Array.isArray(e)||function(e){if(!e||"object"!=typeof e||"[object Object]"!==qt.call(e))return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var r=t,n=Object.getPrototypeOf(t);null!==n;)r=n,n=Object.getPrototypeOf(r);return r===t}(e))}function Ht(e){try{return"string"==typeof e?JSON.stringify(e):String(e)}catch(t){return JSON.stringify(e)}}function $t(e,t,r){return Ae(e)?e.get(t,r):function(e,t){return Ae(e)?e.has(t):Wt(e)&&Ke.call(e,t)}(e,t)?"function"==typeof e.get?e.get(t):e[t]:r}function Yt(e){if(Array.isArray(e))return Mt(e);var t={};for(var r in e)Ke.call(e,r)&&(t[r]=e[r]);return t}function Gt(e,t,r,n){n||(n=r,r=void 0);var o=Qt(Ae(e),e,Vt(t),0,r,n);return o===oe?r:o}function Qt(e,t,r,n,o,i){var a=t===oe;if(n===r.length){var s=a?o:t,u=i(s);return u===s?t:u}if(!a&&!Wt(t))throw new TypeError("Cannot update within non-data-structure value in path ["+r.slice(0,n).map(Ht)+"]: "+t);var c=r[n],l=a?oe:$t(t,c,oe),f=Qt(l===oe?e:Ae(l),l,r,n+1,o,i);return f===l?t:f===oe?function(e,t){if(!Wt(e))throw new TypeError("Cannot update non-data-structure value: "+e);if(Ae(e)){if(!e.remove)throw new TypeError("Cannot update immutable value without .remove() method: "+e);return e.remove(t)}if(!Ke.call(e,t))return e;var r=Yt(e);return Array.isArray(r)?r.splice(t,1):delete r[t],r}(t,c):function(e,t,r){if(!Wt(e))throw new TypeError("Cannot update non-data-structure value: "+e);if(Ae(e)){if(!e.set)throw new TypeError("Cannot update immutable value without .set() method: "+e);return e.set(t,r)}if(Ke.call(e,t)&&r===e[t])return e;var n=Yt(e);return n[t]=r,n}(a?e?Nr():{}:t,c,f)}function Xt(e,t){return function(e,t,r){return Gt(e,t,oe,(function(){return r}))}(this,e,t)}function Zt(e){return function(e,t){return Gt(e,t,(function(){return oe}))}(this,e)}function er(e,t,r,n){return Gt(e,[t],r,n)}function tr(e,t,r){return 1===arguments.length?e(this):er(this,e,t,r)}function rr(e,t,r){return Gt(this,e,t,r)}function nr(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return ir(this,e)}function or(e){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];if("function"!=typeof e)throw new TypeError("Invalid merger function: "+e);return ir(this,t,e)}function ir(e,t,r){for(var n=[],o=0;o<t.length;o++){var i=be(t[o]);0!==i.size&&n.push(i)}return 0===n.length?e:0!==e.toSeq().size||e.__ownerID||1!==n.length?e.withMutations((function(e){for(var t=r?function(t,n){er(e,n,oe,(function(e){return e===oe?t:r(e,t,n)}))}:function(t,r){e.set(r,t)},o=0;o<n.length;o++)n[o].forEach(t)})):e.constructor(n[0])}function ar(e,t,r){return sr(e,t,function(e){function t(r,n,o){return Wt(r)&&Wt(n)&&(i=n,a=Ie(r),s=Ie(i),ge(a)===ge(s)&&ye(a)===ye(s))?sr(r,[n],t):e?e(r,n,o):n;var i,a,s}return t}(r))}function sr(e,t,r){if(!Wt(e))throw new TypeError("Cannot merge into non-data-structure value: "+e);if(Ae(e))return"function"==typeof r&&e.mergeWith?e.mergeWith.apply(e,[r].concat(t)):e.merge?e.merge.apply(e,t):e.concat.apply(e,t);for(var n=Array.isArray(e),o=e,i=n?_e:be,a=n?function(t){o===e&&(o=Yt(o)),o.push(t)}:function(t,n){var i=Ke.call(o,n),a=i&&r?r(o[n],t,n):t;i&&a===o[n]||(o===e&&(o=Yt(o)),o[n]=a)},s=0;s<t.length;s++)i(t[s]).forEach(a);return o}function ur(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return ar(this,e)}function cr(e){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];return ar(this,t,e)}function lr(e){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];return Gt(this,e,Nr(),(function(e){return sr(e,t)}))}function fr(e){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];return Gt(this,e,Nr(),(function(e){return ar(e,t)}))}function hr(e){var t=this.asMutable();return e(t),t.wasAltered()?t.__ensureOwner(this.__ownerID):this}function dr(){return this.__ownerID?this:this.__ensureOwner(new ae)}function pr(){return this.__ensureOwner()}function vr(){return this.__altered}var yr=function(e){function t(t){return null==t?Nr():Qe(t)&&!Ee(t)?t:Nr().withMutations((function(r){var n=e(t);Ut(n.size),n.forEach((function(e,t){return r.set(t,e)}))}))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return Nr().withMutations((function(t){for(var r=0;r<e.length;r+=2){if(r+1>=e.length)throw new Error("Missing value for key: "+e[r]);t.set(e[r],e[r+1])}}))},t.prototype.toString=function(){return this.__toString("Map {","}")},t.prototype.get=function(e,t){return this._root?this._root.get(0,void 0,e,t):t},t.prototype.set=function(e,t){return Tr(this,e,t)},t.prototype.remove=function(e){return Tr(this,e,oe)},t.prototype.deleteAll=function(e){var t=ke(e);return 0===t.size?this:this.withMutations((function(e){t.forEach((function(t){return e.remove(t)}))}))},t.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):Nr()},t.prototype.sort=function(e){return Zr(Pt(this,e))},t.prototype.sortBy=function(e,t){return Zr(Pt(this,t,e))},t.prototype.map=function(e,t){var r=this;return this.withMutations((function(n){n.forEach((function(o,i){n.set(i,e.call(t,o,i,r))}))}))},t.prototype.__iterator=function(e,t){return new Or(this,e,t)},t.prototype.__iterate=function(e,t){var r=this,n=0;return this._root&&this._root.iterate((function(t){return n++,e(t[1],t[0],r)}),t),n},t.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?Er(this.size,this._root,e,this.__hash):0===this.size?Nr():(this.__ownerID=e,this.__altered=!1,this)},t}(be);yr.isMap=Qe;var gr=yr.prototype;gr["@@__IMMUTABLE_MAP__@@"]=!0,gr.delete=gr.remove,gr.removeAll=gr.deleteAll,gr.setIn=Xt,gr.removeIn=gr.deleteIn=Zt,gr.update=tr,gr.updateIn=rr,gr.merge=gr.concat=nr,gr.mergeWith=or,gr.mergeDeep=ur,gr.mergeDeepWith=cr,gr.mergeIn=lr,gr.mergeDeepIn=fr,gr.withMutations=hr,gr.wasAltered=vr,gr.asImmutable=pr,gr["@@transducer/init"]=gr.asMutable=dr,gr["@@transducer/step"]=function(e,t){return e.set(t[0],t[1])},gr["@@transducer/result"]=function(e){return e.asImmutable()};var mr=function(e,t){this.ownerID=e,this.entries=t};mr.prototype.get=function(e,t,r,n){for(var o=this.entries,i=0,a=o.length;i<a;i++)if(et(r,o[i][0]))return o[i][1];return n},mr.prototype.update=function(e,t,r,n,o,i,a){for(var s=o===oe,u=this.entries,c=0,l=u.length;c<l&&!et(n,u[c][0]);c++);var f=c<l;if(f?u[c][1]===o:s)return this;if(ie(a),(s||!f)&&ie(i),!s||1!==u.length){if(!f&&!s&&u.length>=Rr)return function(e,t,r,n){e||(e=new ae);for(var o=new wr(e,ot(r),[r,n]),i=0;i<t.length;i++){var a=t[i];o=o.update(e,0,void 0,a[0],a[1])}return o}(e,u,n,o);var h=e&&e===this.ownerID,d=h?u:Mt(u);return f?s?c===l-1?d.pop():d[c]=d.pop():d[c]=[n,o]:d.push([n,o]),h?(this.entries=d,this):new mr(e,d)}};var kr=function(e,t,r){this.ownerID=e,this.bitmap=t,this.nodes=r};kr.prototype.get=function(e,t,r,n){void 0===t&&(t=ot(r));var o=1<<(31&(0===e?t:t>>>e)),i=this.bitmap;return 0==(i&o)?n:this.nodes[Br(i&o-1)].get(e+5,t,r,n)},kr.prototype.update=function(e,t,r,n,o,i,a){void 0===r&&(r=ot(n));var s=31&(0===t?r:r>>>t),u=1<<s,c=this.bitmap,l=0!=(c&u);if(!l&&o===oe)return this;var f=Br(c&u-1),h=this.nodes,d=l?h[f]:void 0,p=jr(d,e,t+5,r,n,o,i,a);if(p===d)return this;if(!l&&p&&h.length>=Lr)return function(e,t,r,n,o){for(var i=0,a=new Array(32),s=0;0!==r;s++,r>>>=1)a[s]=1&r?t[i++]:void 0;return a[n]=o,new br(e,i+1,a)}(e,h,c,s,p);if(l&&!p&&2===h.length&&Pr(h[1^f]))return h[1^f];if(l&&p&&1===h.length&&Pr(p))return p;var v=e&&e===this.ownerID,y=l?p?c:c^u:c|u,g=l?p?zr(h,f,p,v):function(e,t,r){var n=e.length-1;if(r&&t===n)return e.pop(),e;for(var o=new Array(n),i=0,a=0;a<n;a++)a===t&&(i=1),o[a]=e[a+i];return o}(h,f,v):function(e,t,r,n){var o=e.length+1;if(n&&t+1===o)return e[t]=r,e;for(var i=new Array(o),a=0,s=0;s<o;s++)s===t?(i[s]=r,a=-1):i[s]=e[s+a];return i}(h,f,p,v);return v?(this.bitmap=y,this.nodes=g,this):new kr(e,y,g)};var br=function(e,t,r){this.ownerID=e,this.count=t,this.nodes=r};br.prototype.get=function(e,t,r,n){void 0===t&&(t=ot(r));var o=31&(0===e?t:t>>>e),i=this.nodes[o];return i?i.get(e+5,t,r,n):n},br.prototype.update=function(e,t,r,n,o,i,a){void 0===r&&(r=ot(n));var s=31&(0===t?r:r>>>t),u=o===oe,c=this.nodes,l=c[s];if(u&&!l)return this;var f=jr(l,e,t+5,r,n,o,i,a);if(f===l)return this;var h=this.count;if(l){if(!f&&--h<Kr)return function(e,t,r,n){for(var o=0,i=0,a=new Array(r),s=0,u=1,c=t.length;s<c;s++,u<<=1){var l=t[s];void 0!==l&&s!==n&&(o|=u,a[i++]=l)}return new kr(e,o,a)}(e,c,h,s)}else h++;var d=e&&e===this.ownerID,p=zr(c,s,f,d);return d?(this.count=h,this.nodes=p,this):new br(e,h,p)};var _r=function(e,t,r){this.ownerID=e,this.keyHash=t,this.entries=r};_r.prototype.get=function(e,t,r,n){for(var o=this.entries,i=0,a=o.length;i<a;i++)if(et(r,o[i][0]))return o[i][1];return n},_r.prototype.update=function(e,t,r,n,o,i,a){void 0===r&&(r=ot(n));var s=o===oe;if(r!==this.keyHash)return s?this:(ie(a),ie(i),Cr(this,e,t,r,[n,o]));for(var u=this.entries,c=0,l=u.length;c<l&&!et(n,u[c][0]);c++);var f=c<l;if(f?u[c][1]===o:s)return this;if(ie(a),(s||!f)&&ie(i),s&&2===l)return new wr(e,this.keyHash,u[1^c]);var h=e&&e===this.ownerID,d=h?u:Mt(u);return f?s?c===l-1?d.pop():d[c]=d.pop():d[c]=[n,o]:d.push([n,o]),h?(this.entries=d,this):new _r(e,this.keyHash,d)};var wr=function(e,t,r){this.ownerID=e,this.keyHash=t,this.entry=r};wr.prototype.get=function(e,t,r,n){return et(r,this.entry[0])?this.entry[1]:n},wr.prototype.update=function(e,t,r,n,o,i,a){var s=o===oe,u=et(n,this.entry[0]);return(u?o===this.entry[1]:s)?this:(ie(a),s?void ie(i):u?e&&e===this.ownerID?(this.entry[1]=o,this):new wr(e,this.keyHash,[n,o]):(ie(i),Cr(this,e,t,ot(n),[n,o])))},mr.prototype.iterate=_r.prototype.iterate=function(e,t){for(var r=this.entries,n=0,o=r.length-1;n<=o;n++)if(!1===e(r[t?o-n:n]))return!1},kr.prototype.iterate=br.prototype.iterate=function(e,t){for(var r=this.nodes,n=0,o=r.length-1;n<=o;n++){var i=r[t?o-n:n];if(i&&!1===i.iterate(e,t))return!1}},wr.prototype.iterate=function(e,t){return e(this.entry)};var xr,Or=function(e){function t(e,t,r){this._type=t,this._reverse=r,this._stack=e._root&&Sr(e._root)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.next=function(){for(var e=this._type,t=this._stack;t;){var r=t.node,n=t.index++,o=void 0;if(r.entry){if(0===n)return Ar(e,r.entry)}else if(r.entries){if(n<=(o=r.entries.length-1))return Ar(e,r.entries[this._reverse?o-n:n])}else if(n<=(o=r.nodes.length-1)){var i=r.nodes[this._reverse?o-n:n];if(i){if(i.entry)return Ar(e,i.entry);t=this._stack=Sr(i,t)}continue}t=this._stack=this._stack.__prev}return{value:void 0,done:!0}},t}(je);function Ar(e,t){return Pe(e,t[0],t[1])}function Sr(e,t){return{node:e,index:0,__prev:t}}function Er(e,t,r,n){var o=Object.create(gr);return o.size=e,o._root=t,o.__ownerID=r,o.__hash=n,o.__altered=!1,o}function Nr(){return xr||(xr=Er(0))}function Tr(e,t,r){var n,o;if(e._root){var i={value:!1},a={value:!1};if(n=jr(e._root,e.__ownerID,0,void 0,t,r,i,a),!a.value)return e;o=e.size+(i.value?r===oe?-1:1:0)}else{if(r===oe)return e;o=1,n=new mr(e.__ownerID,[[t,r]])}return e.__ownerID?(e.size=o,e._root=n,e.__hash=void 0,e.__altered=!0,e):n?Er(o,n):Nr()}function jr(e,t,r,n,o,i,a,s){return e?e.update(t,r,n,o,i,a,s):i===oe?e:(ie(s),ie(a),new wr(t,n,[o,i]))}function Pr(e){return e.constructor===wr||e.constructor===_r}function Cr(e,t,r,n,o){if(e.keyHash===n)return new _r(t,n,[e.entry,o]);var i,a=31&(0===r?e.keyHash:e.keyHash>>>r),s=31&(0===r?n:n>>>r),u=a===s?[Cr(e,t,r+5,n,o)]:(i=new wr(t,n,o),a<s?[e,i]:[i,e]);return new kr(t,1<<a|1<<s,u)}function Br(e){return e=(e=(858993459&(e-=e>>1&1431655765))+(e>>2&858993459))+(e>>4)&252645135,e+=e>>8,127&(e+=e>>16)}function zr(e,t,r,n){var o=n?e:Mt(e);return o[t]=r,o}var Rr=8,Lr=16,Kr=8;function Fr(e){return Boolean(e&&e["@@__IMMUTABLE_LIST__@@"])}var Ir=function(e){function t(t){var r=Wr();if(null==t)return r;if(Fr(t))return t;var n=e(t),o=n.size;return 0===o?r:(Ut(o),o>0&&o<32?qr(0,o,5,null,new Mr(n.toArray())):r.withMutations((function(e){e.setSize(o),n.forEach((function(t,r){return e.set(r,t)}))})))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.prototype.toString=function(){return this.__toString("List [","]")},t.prototype.get=function(e,t){if((e=ue(this,e))>=0&&e<this.size){var r=Yr(this,e+=this._origin);return r&&r.array[31&e]}return t},t.prototype.set=function(e,t){return function(e,t,r){if((t=ue(e,t))!=t)return e;if(t>=e.size||t<0)return e.withMutations((function(e){t<0?Gr(e,t).set(0,r):Gr(e,0,t+1).set(t,r)}));t+=e._origin;var n=e._tail,o=e._root,i={value:!1};t>=Qr(e._capacity)?n=Hr(n,e.__ownerID,0,t,r,i):o=Hr(o,e.__ownerID,e._level,t,r,i);if(!i.value)return e;if(e.__ownerID)return e._root=o,e._tail=n,e.__hash=void 0,e.__altered=!0,e;return qr(e._origin,e._capacity,e._level,o,n)}(this,e,t)},t.prototype.remove=function(e){return this.has(e)?0===e?this.shift():e===this.size-1?this.pop():this.splice(e,1):this},t.prototype.insert=function(e,t){return this.splice(e,0,t)},t.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=5,this._root=this._tail=this.__hash=void 0,this.__altered=!0,this):Wr()},t.prototype.push=function(){var e=arguments,t=this.size;return this.withMutations((function(r){Gr(r,0,t+e.length);for(var n=0;n<e.length;n++)r.set(t+n,e[n])}))},t.prototype.pop=function(){return Gr(this,0,-1)},t.prototype.unshift=function(){var e=arguments;return this.withMutations((function(t){Gr(t,-e.length);for(var r=0;r<e.length;r++)t.set(r,e[r])}))},t.prototype.shift=function(){return Gr(this,1)},t.prototype.concat=function(){for(var t=arguments,r=[],n=0;n<arguments.length;n++){var o=t[n],i=e("string"!=typeof o&&Be(o)?o:[o]);0!==i.size&&r.push(i)}return 0===r.length?this:0!==this.size||this.__ownerID||1!==r.length?this.withMutations((function(e){r.forEach((function(t){return t.forEach((function(t){return e.push(t)}))}))})):this.constructor(r[0])},t.prototype.setSize=function(e){return Gr(this,0,e)},t.prototype.map=function(e,t){var r=this;return this.withMutations((function(n){for(var o=0;o<r.size;o++)n.set(o,e.call(t,n.get(o),o,r))}))},t.prototype.slice=function(e,t){var r=this.size;return le(e,t,r)?this:Gr(this,fe(e,r),he(t,r))},t.prototype.__iterator=function(e,t){var r=t?this.size:0,n=Vr(this,t);return new je((function(){var o=n();return o===Ur?{value:void 0,done:!0}:Pe(e,t?--r:r++,o)}))},t.prototype.__iterate=function(e,t){for(var r,n=t?this.size:0,o=Vr(this,t);(r=o())!==Ur&&!1!==e(r,t?--n:n++,this););return n},t.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?qr(this._origin,this._capacity,this._level,this._root,this._tail,e,this.__hash):0===this.size?Wr():(this.__ownerID=e,this.__altered=!1,this)},t}(_e);Ir.isList=Fr;var Dr=Ir.prototype;Dr["@@__IMMUTABLE_LIST__@@"]=!0,Dr.delete=Dr.remove,Dr.merge=Dr.concat,Dr.setIn=Xt,Dr.deleteIn=Dr.removeIn=Zt,Dr.update=tr,Dr.updateIn=rr,Dr.mergeIn=lr,Dr.mergeDeepIn=fr,Dr.withMutations=hr,Dr.wasAltered=vr,Dr.asImmutable=pr,Dr["@@transducer/init"]=Dr.asMutable=dr,Dr["@@transducer/step"]=function(e,t){return e.push(t)},Dr["@@transducer/result"]=function(e){return e.asImmutable()};var Mr=function(e,t){this.array=e,this.ownerID=t};Mr.prototype.removeBefore=function(e,t,r){if(r===t?1<<t:0===this.array.length)return this;var n=r>>>t&31;if(n>=this.array.length)return new Mr([],e);var o,i=0===n;if(t>0){var a=this.array[n];if((o=a&&a.removeBefore(e,t-5,r))===a&&i)return this}if(i&&!o)return this;var s=$r(this,e);if(!i)for(var u=0;u<n;u++)s.array[u]=void 0;return o&&(s.array[n]=o),s},Mr.prototype.removeAfter=function(e,t,r){if(r===(t?1<<t:0)||0===this.array.length)return this;var n,o=r-1>>>t&31;if(o>=this.array.length)return this;if(t>0){var i=this.array[o];if((n=i&&i.removeAfter(e,t-5,r))===i&&o===this.array.length-1)return this}var a=$r(this,e);return a.array.splice(o+1),n&&(a.array[o]=n),a};var Jr,Ur={};function Vr(e,t){var r=e._origin,n=e._capacity,o=Qr(n),i=e._tail;return a(e._root,e._level,0);function a(e,s,u){return 0===s?function(e,a){var s=a===o?i&&i.array:e&&e.array,u=a>r?0:r-a,c=n-a;c>32&&(c=32);return function(){if(u===c)return Ur;var e=t?--c:u++;return s&&s[e]}}(e,u):function(e,o,i){var s,u=e&&e.array,c=i>r?0:r-i>>o,l=1+(n-i>>o);l>32&&(l=32);return function(){for(;;){if(s){var e=s();if(e!==Ur)return e;s=null}if(c===l)return Ur;var r=t?--l:c++;s=a(u&&u[r],o-5,i+(r<<o))}}}(e,s,u)}}function qr(e,t,r,n,o,i,a){var s=Object.create(Dr);return s.size=t-e,s._origin=e,s._capacity=t,s._level=r,s._root=n,s._tail=o,s.__ownerID=i,s.__hash=a,s.__altered=!1,s}function Wr(){return Jr||(Jr=qr(0,0,5))}function Hr(e,t,r,n,o,i){var a,s=n>>>r&31,u=e&&s<e.array.length;if(!u&&void 0===o)return e;if(r>0){var c=e&&e.array[s],l=Hr(c,t,r-5,n,o,i);return l===c?e:((a=$r(e,t)).array[s]=l,a)}return u&&e.array[s]===o?e:(i&&ie(i),a=$r(e,t),void 0===o&&s===a.array.length-1?a.array.pop():a.array[s]=o,a)}function $r(e,t){return t&&e&&t===e.ownerID?e:new Mr(e?e.array.slice():[],t)}function Yr(e,t){if(t>=Qr(e._capacity))return e._tail;if(t<1<<e._level+5){for(var r=e._root,n=e._level;r&&n>0;)r=r.array[t>>>n&31],n-=5;return r}}function Gr(e,t,r){void 0!==t&&(t|=0),void 0!==r&&(r|=0);var n=e.__ownerID||new ae,o=e._origin,i=e._capacity,a=o+t,s=void 0===r?i:r<0?i+r:o+r;if(a===o&&s===i)return e;if(a>=s)return e.clear();for(var u=e._level,c=e._root,l=0;a+l<0;)c=new Mr(c&&c.array.length?[void 0,c]:[],n),l+=1<<(u+=5);l&&(a+=l,o+=l,s+=l,i+=l);for(var f=Qr(i),h=Qr(s);h>=1<<u+5;)c=new Mr(c&&c.array.length?[c]:[],n),u+=5;var d=e._tail,p=h<f?Yr(e,s-1):h>f?new Mr([],n):d;if(d&&h>f&&a<i&&d.array.length){for(var v=c=$r(c,n),y=u;y>5;y-=5){var g=f>>>y&31;v=v.array[g]=$r(v.array[g],n)}v.array[f>>>5&31]=d}if(s<i&&(p=p&&p.removeAfter(n,0,s)),a>=h)a-=h,s-=h,u=5,c=null,p=p&&p.removeBefore(n,0,a);else if(a>o||h<f){for(l=0;c;){var m=a>>>u&31;if(m!==h>>>u&31)break;m&&(l+=(1<<u)*m),u-=5,c=c.array[m]}c&&a>o&&(c=c.removeBefore(n,u,a-l)),c&&h<f&&(c=c.removeAfter(n,u,h-l)),l&&(a-=l,s-=l)}return e.__ownerID?(e.size=s-a,e._origin=a,e._capacity=s,e._level=u,e._root=c,e._tail=p,e.__hash=void 0,e.__altered=!0,e):qr(a,s,u,c,p)}function Qr(e){return e<32?0:e-1>>>5<<5}var Xr,Zr=function(e){function t(e){return null==e?tn():Xe(e)?e:tn().withMutations((function(t){var r=be(e);Ut(r.size),r.forEach((function(e,r){return t.set(r,e)}))}))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.prototype.toString=function(){return this.__toString("OrderedMap {","}")},t.prototype.get=function(e,t){var r=this._map.get(e);return void 0!==r?this._list.get(r)[1]:t},t.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this.__altered=!0,this):tn()},t.prototype.set=function(e,t){return rn(this,e,t)},t.prototype.remove=function(e){return rn(this,e,oe)},t.prototype.__iterate=function(e,t){var r=this;return this._list.__iterate((function(t){return t&&e(t[1],t[0],r)}),t)},t.prototype.__iterator=function(e,t){return this._list.fromEntrySeq().__iterator(e,t)},t.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._map.__ensureOwner(e),r=this._list.__ensureOwner(e);return e?en(t,r,e,this.__hash):0===this.size?tn():(this.__ownerID=e,this.__altered=!1,this._map=t,this._list=r,this)},t}(yr);function en(e,t,r,n){var o=Object.create(Zr.prototype);return o.size=e?e.size:0,o._map=e,o._list=t,o.__ownerID=r,o.__hash=n,o.__altered=!1,o}function tn(){return Xr||(Xr=en(Nr(),Wr()))}function rn(e,t,r){var n,o,i=e._map,a=e._list,s=i.get(t),u=void 0!==s;if(r===oe){if(!u)return e;a.size>=32&&a.size>=2*i.size?(n=(o=a.filter((function(e,t){return void 0!==e&&s!==t}))).toKeyedSeq().map((function(e){return e[0]})).flip().toMap(),e.__ownerID&&(n.__ownerID=o.__ownerID=e.__ownerID)):(n=i.remove(t),o=s===a.size-1?a.pop():a.set(s,void 0))}else if(u){if(r===a.get(s)[1])return e;n=i,o=a.set(s,[t,r])}else n=i.set(t,a.size),o=a.set(a.size,[t,r]);return e.__ownerID?(e.size=n.size,e._map=n,e._list=o,e.__hash=void 0,e.__altered=!0,e):en(n,o)}Zr.isOrderedMap=Xe,Zr.prototype[Se]=!0,Zr.prototype.delete=Zr.prototype.remove;function nn(e){return Boolean(e&&e["@@__IMMUTABLE_STACK__@@"])}var on=function(e){function t(e){return null==e?cn():nn(e)?e:cn().pushAll(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.prototype.toString=function(){return this.__toString("Stack [","]")},t.prototype.get=function(e,t){var r=this._head;for(e=ue(this,e);r&&e--;)r=r.next;return r?r.value:t},t.prototype.peek=function(){return this._head&&this._head.value},t.prototype.push=function(){var e=arguments;if(0===arguments.length)return this;for(var t=this.size+arguments.length,r=this._head,n=arguments.length-1;n>=0;n--)r={value:e[n],next:r};return this.__ownerID?(this.size=t,this._head=r,this.__hash=void 0,this.__altered=!0,this):un(t,r)},t.prototype.pushAll=function(t){if(0===(t=e(t)).size)return this;if(0===this.size&&nn(t))return t;Ut(t.size);var r=this.size,n=this._head;return t.__iterate((function(e){r++,n={value:e,next:n}}),!0),this.__ownerID?(this.size=r,this._head=n,this.__hash=void 0,this.__altered=!0,this):un(r,n)},t.prototype.pop=function(){return this.slice(1)},t.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):cn()},t.prototype.slice=function(t,r){if(le(t,r,this.size))return this;var n=fe(t,this.size);if(he(r,this.size)!==this.size)return e.prototype.slice.call(this,t,r);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):un(o,i)},t.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?un(this.size,this._head,e,this.__hash):0===this.size?cn():(this.__ownerID=e,this.__altered=!1,this)},t.prototype.__iterate=function(e,t){var r=this;if(t)return new Ue(this.toArray()).__iterate((function(t,n){return e(t,n,r)}),t);for(var n=0,o=this._head;o&&!1!==e(o.value,n++,this);)o=o.next;return n},t.prototype.__iterator=function(e,t){if(t)return new Ue(this.toArray()).__iterator(e,t);var r=0,n=this._head;return new je((function(){if(n){var t=n.value;return n=n.next,Pe(e,r++,t)}return{value:void 0,done:!0}}))},t}(_e);on.isStack=nn;var an,sn=on.prototype;function un(e,t,r,n){var o=Object.create(sn);return o.size=e,o._head=t,o.__ownerID=r,o.__hash=n,o.__altered=!1,o}function cn(){return an||(an=un(0))}sn["@@__IMMUTABLE_STACK__@@"]=!0,sn.shift=sn.pop,sn.unshift=sn.push,sn.unshiftAll=sn.pushAll,sn.withMutations=hr,sn.wasAltered=vr,sn.asImmutable=pr,sn["@@transducer/init"]=sn.asMutable=dr,sn["@@transducer/step"]=function(e,t){return e.unshift(t)},sn["@@transducer/result"]=function(e){return e.asImmutable()};function ln(e){return Boolean(e&&e["@@__IMMUTABLE_SET__@@"])}function fn(e){return ln(e)&&Ee(e)}function hn(e,t){if(e===t)return!0;if(!ve(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||ye(e)!==ye(t)||ge(e)!==ge(t)||Ee(e)!==Ee(t))return!1;if(0===e.size&&0===t.size)return!0;var r=!me(e);if(Ee(e)){var n=e.entries();return t.every((function(e,t){var o=n.next().value;return o&&et(o[1],e)&&(r||et(o[0],t))}))&&n.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 a=!0,s=t.__iterate((function(t,n){if(r?!e.has(t):o?!et(t,e.get(n,oe)):!et(e.get(n,oe),t))return a=!1,!1}));return a&&e.size===s}function dn(e,t){var r=function(r){e.prototype[r]=t[r]};return Object.keys(t).forEach(r),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach(r),e}function pn(e){if(!e||"object"!=typeof e)return e;if(!ve(e)){if(!Wt(e))return e;e=Ie(e)}if(ye(e)){var t={};return e.__iterate((function(e,r){t[r]=pn(e)})),t}var r=[];return e.__iterate((function(e){r.push(pn(e))})),r}var vn=function(e){function t(t){return null==t?bn():ln(t)&&!Ee(t)?t:bn().withMutations((function(r){var n=e(t);Ut(n.size),n.forEach((function(e){return r.add(e)}))}))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.fromKeys=function(e){return this(be(e).keySeq())},t.intersect=function(e){return(e=ke(e).toArray()).length?gn.intersect.apply(t(e.pop()),e):bn()},t.union=function(e){return(e=ke(e).toArray()).length?gn.union.apply(t(e.pop()),e):bn()},t.prototype.toString=function(){return this.__toString("Set {","}")},t.prototype.has=function(e){return this._map.has(e)},t.prototype.add=function(e){return mn(this,this._map.set(e,e))},t.prototype.remove=function(e){return mn(this,this._map.remove(e))},t.prototype.clear=function(){return mn(this,this._map.clear())},t.prototype.map=function(e,t){var r=this,n=!1,o=mn(this,this._map.mapEntries((function(o){var i=o[1],a=e.call(t,i,i,r);return a!==i&&(n=!0),[a,a]}),t));return n?o:this},t.prototype.union=function(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];return 0===(t=t.filter((function(e){return 0!==e.size}))).length?this:0!==this.size||this.__ownerID||1!==t.length?this.withMutations((function(r){for(var n=0;n<t.length;n++)e(t[n]).forEach((function(e){return r.add(e)}))})):this.constructor(t[0])},t.prototype.intersect=function(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];if(0===t.length)return this;t=t.map((function(t){return e(t)}));var n=[];return this.forEach((function(e){t.every((function(t){return t.includes(e)}))||n.push(e)})),this.withMutations((function(e){n.forEach((function(t){e.remove(t)}))}))},t.prototype.subtract=function(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];if(0===t.length)return this;t=t.map((function(t){return e(t)}));var n=[];return this.forEach((function(e){t.some((function(t){return t.includes(e)}))&&n.push(e)})),this.withMutations((function(e){n.forEach((function(t){e.remove(t)}))}))},t.prototype.sort=function(e){return Fn(Pt(this,e))},t.prototype.sortBy=function(e,t){return Fn(Pt(this,t,e))},t.prototype.wasAltered=function(){return this._map.wasAltered()},t.prototype.__iterate=function(e,t){var r=this;return this._map.__iterate((function(t){return e(t,t,r)}),t)},t.prototype.__iterator=function(e,t){return this._map.__iterator(e,t)},t.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._map.__ensureOwner(e);return e?this.__make(t,e):0===this.size?this.__empty():(this.__ownerID=e,this._map=t,this)},t}(we);vn.isSet=ln;var yn,gn=vn.prototype;function mn(e,t){return e.__ownerID?(e.size=t.size,e._map=t,e):t===e._map?e:0===t.size?e.__empty():e.__make(t)}function kn(e,t){var r=Object.create(gn);return r.size=e?e.size:0,r._map=e,r.__ownerID=t,r}function bn(){return yn||(yn=kn(Nr()))}gn["@@__IMMUTABLE_SET__@@"]=!0,gn.delete=gn.remove,gn.merge=gn.concat=gn.union,gn.withMutations=hr,gn.asImmutable=pr,gn["@@transducer/init"]=gn.asMutable=dr,gn["@@transducer/step"]=function(e,t){return e.add(t)},gn["@@transducer/result"]=function(e){return e.asImmutable()},gn.__empty=bn,gn.__make=kn;var _n,wn=function(e){function t(e,r,n){if(!(this instanceof t))return new t(e,r,n);if(Jt(0!==n,"Cannot step a Range by 0"),e=e||0,void 0===r&&(r=1/0),n=void 0===n?1:Math.abs(n),r<e&&(n=-n),this._start=e,this._end=r,this._step=n,this.size=Math.max(0,Math.ceil((r-e)/n-1)+1),0===this.size){if(_n)return _n;_n=this}}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return 0===this.size?"Range []":"Range [ "+this._start+"..."+this._end+(1!==this._step?" by "+this._step:"")+" ]"},t.prototype.get=function(e,t){return this.has(e)?this._start+ue(this,e)*this._step:t},t.prototype.includes=function(e){var t=(e-this._start)/this._step;return t>=0&&t<this.size&&t===Math.floor(t)},t.prototype.slice=function(e,r){return le(e,r,this.size)?this:(e=fe(e,this.size),(r=he(r,this.size))<=e?new t(0,0):new t(this.get(e,this._end),this.get(r,this._end),this._step))},t.prototype.indexOf=function(e){var t=e-this._start;if(t%this._step==0){var r=t/this._step;if(r>=0&&r<this.size)return r}return-1},t.prototype.lastIndexOf=function(e){return this.indexOf(e)},t.prototype.__iterate=function(e,t){for(var r=this.size,n=this._step,o=t?this._start+(r-1)*n:this._start,i=0;i!==r&&!1!==e(o,t?r-++i:i++,this);)o+=t?-n:n;return i},t.prototype.__iterator=function(e,t){var r=this.size,n=this._step,o=t?this._start+(r-1)*n:this._start,i=0;return new je((function(){if(i===r)return{value:void 0,done:!0};var a=o;return o+=t?-n:n,Pe(e,t?r-++i:i++,a)}))},t.prototype.equals=function(e){return e instanceof t?this._start===e._start&&this._end===e._end&&this._step===e._step:hn(this,e)},t}(Me);function xn(e,t,r){for(var n=Vt(t),o=0;o!==n.length;)if((e=$t(e,n[o++],oe))===oe)return r;return e}function On(e,t){return xn(this,e,t)}function An(){Ut(this.size);var e={};return this.__iterate((function(t,r){e[r]=t})),e}ke.isIterable=ve,ke.isKeyed=ye,ke.isIndexed=ge,ke.isAssociative=me,ke.isOrdered=Ee,ke.Iterator=je,dn(ke,{toArray:function(){Ut(this.size);var e=new Array(this.size||0),t=ye(this),r=0;return this.__iterate((function(n,o){e[r++]=t?[o,n]:n})),e},toIndexedSeq:function(){return new bt(this)},toJS:function(){return pn(this)},toKeyedSeq:function(){return new kt(this,!0)},toMap:function(){return yr(this.toKeyedSeq())},toObject:An,toOrderedMap:function(){return Zr(this.toKeyedSeq())},toOrderedSet:function(){return Fn(ye(this)?this.valueSeq():this)},toSet:function(){return vn(ye(this)?this.valueSeq():this)},toSetSeq:function(){return new _t(this)},toSeq:function(){return ge(this)?this.toIndexedSeq():ye(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return on(ye(this)?this.valueSeq():this)},toList:function(){return Ir(ye(this)?this.valueSeq():this)},toString:function(){return"[Collection]"},__toString:function(e,t){return 0===this.size?e+t:e+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+t},concat:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return Rt(this,Tt(this,e))},includes:function(e){return this.some((function(t){return et(t,e)}))},entries:function(){return this.__iterator(2)},every:function(e,t){Ut(this.size);var r=!0;return this.__iterate((function(n,o,i){if(!e.call(t,n,o,i))return r=!1,!1})),r},filter:function(e,t){return Rt(this,St(this,e,t,!0))},find:function(e,t,r){var n=this.findEntry(e,t);return n?n[1]:r},forEach:function(e,t){return Ut(this.size),this.__iterate(t?e.bind(t):e)},join:function(e){Ut(this.size),e=void 0!==e?""+e:",";var t="",r=!0;return this.__iterate((function(n){r?r=!1:t+=e,t+=null!=n?n.toString():""})),t},keys:function(){return this.__iterator(0)},map:function(e,t){return Rt(this,Ot(this,e,t))},reduce:function(e,t,r){return jn(this,e,t,r,arguments.length<2,!1)},reduceRight:function(e,t,r){return jn(this,e,t,r,arguments.length<2,!0)},reverse:function(){return Rt(this,At(this,!0))},slice:function(e,t){return Rt(this,Et(this,e,t,!0))},some:function(e,t){return!this.every(Bn(e),t)},sort:function(e){return Rt(this,Pt(this,e))},values:function(){return this.__iterator(1)},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 se(e?this.toSeq().filter(e,t):this)},countBy:function(e,t){return function(e,t,r){var n=yr().asMutable();return e.__iterate((function(o,i){n.update(t.call(r,o,i,e),0,(function(e){return e+1}))})),n.asImmutable()}(this,e,t)},equals:function(e){return hn(this,e)},entrySeq:function(){var e=this;if(e._cache)return new Ue(e._cache);var t=e.toSeq().map(Cn).toIndexedSeq();return t.fromEntrySeq=function(){return e.toSeq()},t},filterNot:function(e,t){return this.filter(Bn(e),t)},findEntry:function(e,t,r){var n=r;return this.__iterate((function(r,o,i){if(e.call(t,r,o,i))return n=[o,r],!1})),n},findKey:function(e,t){var r=this.findEntry(e,t);return r&&r[0]},findLast:function(e,t,r){return this.toKeyedSeq().reverse().find(e,t,r)},findLastEntry:function(e,t,r){return this.toKeyedSeq().reverse().findEntry(e,t,r)},findLastKey:function(e,t){return this.toKeyedSeq().reverse().findKey(e,t)},first:function(e){return this.find(ce,null,e)},flatMap:function(e,t){return Rt(this,function(e,t,r){var n=Kt(e);return e.toSeq().map((function(o,i){return n(t.call(r,o,i,e))})).flatten(!0)}(this,e,t))},flatten:function(e){return Rt(this,jt(this,e,!0))},fromEntrySeq:function(){return new wt(this)},get:function(e,t){return this.find((function(t,r){return et(r,e)}),void 0,t)},getIn:On,groupBy:function(e,t){return function(e,t,r){var n=ye(e),o=(Ee(e)?Zr():yr()).asMutable();e.__iterate((function(i,a){o.update(t.call(r,i,a,e),(function(e){return(e=e||[]).push(n?[a,i]:i),e}))}));var i=Kt(e);return o.map((function(t){return Rt(e,i(t))})).asImmutable()}(this,e,t)},has:function(e){return this.get(e,oe)!==oe},hasIn:function(e){return xn(this,e,oe)!==oe},isSubset:function(e){return e="function"==typeof e.includes?e:ke(e),this.every((function(t){return e.includes(t)}))},isSuperset:function(e){return(e="function"==typeof e.isSubset?e:ke(e)).isSubset(this)},keyOf:function(e){return this.findKey((function(t){return et(t,e)}))},keySeq:function(){return this.toSeq().map(Pn).toIndexedSeq()},last:function(e){return this.toSeq().reverse().first(e)},lastKeyOf:function(e){return this.toKeyedSeq().reverse().keyOf(e)},max:function(e){return Ct(this,e)},maxBy:function(e,t){return Ct(this,t,e)},min:function(e){return Ct(this,e?zn(e):Ln)},minBy:function(e,t){return Ct(this,t?zn(t):Ln,e)},rest:function(){return this.slice(1)},skip:function(e){return 0===e?this:this.slice(Math.max(0,e))},skipLast:function(e){return 0===e?this:this.slice(0,-Math.max(0,e))},skipWhile:function(e,t){return Rt(this,Nt(this,e,t,!0))},skipUntil:function(e,t){return this.skipWhile(Bn(e),t)},sortBy:function(e,t){return Rt(this,Pt(this,t,e))},take:function(e){return this.slice(0,Math.max(0,e))},takeLast:function(e){return this.slice(-Math.max(0,e))},takeWhile:function(e,t){return Rt(this,function(e,t,r){var n=Ft(e);return n.__iterateUncached=function(n,o){var i=this;if(o)return this.cacheResult().__iterate(n,o);var a=0;return e.__iterate((function(e,o,s){return t.call(r,e,o,s)&&++a&&n(e,o,i)})),a},n.__iteratorUncached=function(n,o){var i=this;if(o)return this.cacheResult().__iterator(n,o);var a=e.__iterator(2,o),s=!0;return new je((function(){if(!s)return{value:void 0,done:!0};var e=a.next();if(e.done)return e;var o=e.value,u=o[0],c=o[1];return t.call(r,c,u,i)?2===n?e:Pe(n,u,c,e):(s=!1,{value:void 0,done:!0})}))},n}(this,e,t))},takeUntil:function(e,t){return this.takeWhile(Bn(e),t)},update:function(e){return e(this)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=function(e){if(e.size===1/0)return 0;var t=Ee(e),r=ye(e),n=t?1:0;return function(e,t){return t=tt(t,3432918353),t=tt(t<<15|t>>>-15,461845907),t=tt(t<<13|t>>>-13,5),t=tt((t=(t+3864292196|0)^e)^t>>>16,2246822507),t=rt((t=tt(t^t>>>13,3266489909))^t>>>16)}(e.__iterate(r?t?function(e,t){n=31*n+Kn(ot(e),ot(t))|0}:function(e,t){n=n+Kn(ot(e),ot(t))|0}:t?function(e){n=31*n+ot(e)|0}:function(e){n=n+ot(e)|0}),n)}(this))}});var Sn=ke.prototype;Sn["@@__IMMUTABLE_ITERABLE__@@"]=!0,Sn[Te]=Sn.values,Sn.toJSON=Sn.toArray,Sn.__toStringMapper=Ht,Sn.inspect=Sn.toSource=function(){return this.toString()},Sn.chain=Sn.flatMap,Sn.contains=Sn.includes,dn(be,{flip:function(){return Rt(this,xt(this))},mapEntries:function(e,t){var r=this,n=0;return Rt(this,this.toSeq().map((function(o,i){return e.call(t,[i,o],n++,r)})).fromEntrySeq())},mapKeys:function(e,t){var r=this;return Rt(this,this.toSeq().flip().map((function(n,o){return e.call(t,n,o,r)})).flip())}});var En=be.prototype;En["@@__IMMUTABLE_KEYED__@@"]=!0,En[Te]=Sn.entries,En.toJSON=An,En.__toStringMapper=function(e,t){return Ht(t)+": "+Ht(e)},dn(_e,{toKeyedSeq:function(){return new kt(this,!1)},filter:function(e,t){return Rt(this,St(this,e,t,!1))},findIndex:function(e,t){var r=this.findEntry(e,t);return r?r[0]:-1},indexOf:function(e){var t=this.keyOf(e);return void 0===t?-1:t},lastIndexOf:function(e){var t=this.lastKeyOf(e);return void 0===t?-1:t},reverse:function(){return Rt(this,At(this,!1))},slice:function(e,t){return Rt(this,Et(this,e,t,!1))},splice:function(e,t){var r=arguments.length;if(t=Math.max(t||0,0),0===r||2===r&&!t)return this;e=fe(e,e<0?this.count():this.size);var n=this.slice(0,e);return Rt(this,1===r?n:n.concat(Mt(arguments,2),this.slice(e+t)))},findLastIndex:function(e,t){var r=this.findLastEntry(e,t);return r?r[0]:-1},first:function(e){return this.get(0,e)},flatten:function(e){return Rt(this,jt(this,e,!1))},get:function(e,t){return(e=ue(this,e))<0||this.size===1/0||void 0!==this.size&&e>this.size?t:this.find((function(t,r){return r===e}),void 0,t)},has:function(e){return(e=ue(this,e))>=0&&(void 0!==this.size?this.size===1/0||e<this.size:-1!==this.indexOf(e))},interpose:function(e){return Rt(this,function(e,t){var r=Ft(e);return r.size=e.size&&2*e.size-1,r.__iterateUncached=function(r,n){var o=this,i=0;return e.__iterate((function(e){return(!i||!1!==r(t,i++,o))&&!1!==r(e,i++,o)}),n),i},r.__iteratorUncached=function(r,n){var o,i=e.__iterator(1,n),a=0;return new je((function(){return(!o||a%2)&&(o=i.next()).done?o:a%2?Pe(r,a++,t):Pe(r,a++,o.value,o)}))},r}(this,e))},interleave:function(){var e=[this].concat(Mt(arguments)),t=zt(this.toSeq(),Me.of,e),r=t.flatten(!0);return t.size&&(r.size=t.size*e.length),Rt(this,r)},keySeq:function(){return wn(0,this.size)},last:function(e){return this.get(-1,e)},skipWhile:function(e,t){return Rt(this,Nt(this,e,t,!1))},zip:function(){var e=[this].concat(Mt(arguments));return Rt(this,zt(this,Rn,e))},zipAll:function(){var e=[this].concat(Mt(arguments));return Rt(this,zt(this,Rn,e,!0))},zipWith:function(e){var t=Mt(arguments);return t[0]=this,Rt(this,zt(this,e,t))}});var Nn=_e.prototype;Nn["@@__IMMUTABLE_INDEXED__@@"]=!0,Nn[Se]=!0,dn(we,{get:function(e,t){return this.has(e)?e:t},includes:function(e){return this.has(e)},keySeq:function(){return this.valueSeq()}});var Tn=we.prototype;function jn(e,t,r,n,o,i){return Ut(e.size),e.__iterate((function(e,i,a){o?(o=!1,r=e):r=t.call(n,r,e,i,a)}),i),r}function Pn(e,t){return t}function Cn(e,t){return[t,e]}function Bn(e){return function(){return!e.apply(this,arguments)}}function zn(e){return function(){return-e.apply(this,arguments)}}function Rn(){return Mt(arguments)}function Ln(e,t){return e<t?1:e>t?-1:0}function Kn(e,t){return e^t+2654435769+(e<<6)+(e>>2)|0}Tn.has=Sn.includes,Tn.contains=Tn.includes,Tn.keys=Tn.values,dn(De,En),dn(Me,Nn),dn(Je,Tn);var Fn=function(e){function t(e){return null==e?Jn():fn(e)?e:Jn().withMutations((function(t){var r=we(e);Ut(r.size),r.forEach((function(e){return t.add(e)}))}))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.fromKeys=function(e){return this(be(e).keySeq())},t.prototype.toString=function(){return this.__toString("OrderedSet {","}")},t}(vn);Fn.isOrderedSet=fn;var In,Dn=Fn.prototype;function Mn(e,t){var r=Object.create(Dn);return r.size=e?e.size:0,r._map=e,r.__ownerID=t,r}function Jn(){return In||(In=Mn(tn()))}Dn[Se]=!0,Dn.zip=Nn.zip,Dn.zipWith=Nn.zipWith,Dn.zipAll=Nn.zipAll,Dn.__empty=Jn,Dn.__make=Mn;var Un=function(e,t){var r;!function(e){if(Oe(e))throw new Error("Can not call `Record` with an immutable Record as default values. Use a plain javascript object instead.");if(Ae(e))throw new Error("Can not call `Record` with an immutable Collection as default values. Use a plain javascript object instead.");if(null===e||"object"!=typeof e)throw new Error("Can not call `Record` with a non-object as default values. Use a plain javascript object instead.")}(e);var n=function(i){var a=this;if(i instanceof n)return i;if(!(this instanceof n))return new n(i);if(!r){r=!0;var s=Object.keys(e),u=o._indices={};o._name=t,o._keys=s,o._defaultValues=e;for(var c=0;c<s.length;c++){var l=s[c];u[l]=c,o[l]?"object"==typeof console&&console.warn&&console.warn("Cannot define "+Yn(this)+' with property "'+l+'" since that property name is part of the Record API.'):Qn(o,l)}}return this.__ownerID=void 0,this._values=Ir().withMutations((function(e){e.setSize(a._keys.length),be(i).forEach((function(t,r){e.set(a._indices[r],t===a._defaultValues[r]?void 0:t)}))})),this},o=n.prototype=Object.create(Hn);return o.constructor=n,t&&(n.displayName=t),n};Un.prototype.toString=function(){for(var e,t=Yn(this)+" { ",r=this._keys,n=0,o=r.length;n!==o;n++)t+=(n?", ":"")+(e=r[n])+": "+Ht(this.get(e));return t+" }"},Un.prototype.equals=function(e){return this===e||e&&Gn(this).equals(Gn(e))},Un.prototype.hashCode=function(){return Gn(this).hashCode()},Un.prototype.has=function(e){return this._indices.hasOwnProperty(e)},Un.prototype.get=function(e,t){if(!this.has(e))return t;var r=this._indices[e],n=this._values.get(r);return void 0===n?this._defaultValues[e]:n},Un.prototype.set=function(e,t){if(this.has(e)){var r=this._values.set(this._indices[e],t===this._defaultValues[e]?void 0:t);if(r!==this._values&&!this.__ownerID)return $n(this,r)}return this},Un.prototype.remove=function(e){return this.set(e)},Un.prototype.clear=function(){var e=this._values.clear().setSize(this._keys.length);return this.__ownerID?this:$n(this,e)},Un.prototype.wasAltered=function(){return this._values.wasAltered()},Un.prototype.toSeq=function(){return Gn(this)},Un.prototype.toJS=function(){return pn(this)},Un.prototype.entries=function(){return this.__iterator(2)},Un.prototype.__iterator=function(e,t){return Gn(this).__iterator(e,t)},Un.prototype.__iterate=function(e,t){return Gn(this).__iterate(e,t)},Un.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._values.__ensureOwner(e);return e?$n(this,t,e):(this.__ownerID=e,this._values=t,this)},Un.isRecord=Oe,Un.getDescriptiveName=Yn;var Vn,qn,Wn,Hn=Un.prototype;function $n(e,t,r){var n=Object.create(Object.getPrototypeOf(e));return n._values=t,n.__ownerID=r,n}function Yn(e){return e.constructor.displayName||e.constructor.name||"Record"}function Gn(e){return $e(e._keys.map((function(t){return[t,e.get(t)]})))}function Qn(e,t){try{Object.defineProperty(e,t,{get:function(){return this.get(t)},set:function(e){Jt(this.__ownerID,"Cannot set on an immutable record."),this.set(t,e)}})}catch(e){}}Hn["@@__IMMUTABLE_RECORD__@@"]=!0,Hn.delete=Hn.remove,Hn.deleteIn=Hn.removeIn=Zt,Hn.getIn=On,Hn.hasIn=Sn.hasIn,Hn.merge=nr,Hn.mergeWith=or,Hn.mergeIn=lr,Hn.mergeDeep=ur,Hn.mergeDeepWith=cr,Hn.mergeDeepIn=fr,Hn.setIn=Xt,Hn.update=tr,Hn.updateIn=rr,Hn.withMutations=hr,Hn.asMutable=dr,Hn.asImmutable=pr,Hn[Te]=Hn.entries,Hn.toJSON=Hn.toObject=Sn.toObject,Hn.inspect=Hn.toSource=function(){return this.toString()},function(e){function t(e,r){if(!(this instanceof t))return new t(e,r);if(this._value=e,this.size=void 0===r?1/0:Math.max(0,r),0===this.size){if(Vn)return Vn;Vn=this}}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},t.prototype.get=function(e,t){return this.has(e)?this._value:t},t.prototype.includes=function(e){return et(this._value,e)},t.prototype.slice=function(e,r){var n=this.size;return le(e,r,n)?this:new t(this._value,he(r,n)-fe(e,n))},t.prototype.reverse=function(){return this},t.prototype.indexOf=function(e){return et(this._value,e)?0:-1},t.prototype.lastIndexOf=function(e){return et(this._value,e)?this.size:-1},t.prototype.__iterate=function(e,t){for(var r=this.size,n=0;n!==r&&!1!==e(this._value,t?r-++n:n++,this););return n},t.prototype.__iterator=function(e,t){var r=this,n=this.size,o=0;return new je((function(){return o===n?{value:void 0,done:!0}:Pe(e,t?n-++o:o++,r._value)}))},t.prototype.equals=function(e){return e instanceof t?et(this._value,e._value):hn(e)}}(Me),qn=new RegExp("^[^֑-߿יִ-﷽ﹰ-ﻼ]*[A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--]"),Wn=new RegExp("^[^A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--]*[֑-߿יִ-﷽ﹰ-ﻼ]");var Xn,Zn,eo=function(e){return e=e.toString(),Wn.test(e)?"rtl":qn.test(e)?"ltr":"neutral"},to={exports:{}};Xn=to,Zn=to.exports,function(e){var t=Zn,r=Xn&&Xn.exports==t&&Xn,n="object"==typeof v&&v;n.global!==n&&n.window!==n||(e=n);var o=/([\0-\u02FF\u0370-\u1AAF\u1B00-\u1DBF\u1E00-\u20CF\u2100-\uD7FF\uE000-\uFE1F\uFE30-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])([\u0300-\u036F\u1AB0-\u1AFF\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]+)/g,i=/([\uD800-\uDBFF])([\uDC00-\uDFFF])/g,a=function(e){for(var t="",r=(e=e.replace(o,(function(e,t,r){return a(r)+t})).replace(i,"$2$1")).length;r--;)t+=e.charAt(r);return t},s={version:"0.2.0",reverse:a};if(t&&!t.nodeType)if(r)r.exports=s;else for(var u in s)s.hasOwnProperty(u)&&(t[u]=s[u]);else e.esrever=s}(v);var ro=Object.prototype.hasOwnProperty,no=Object.prototype.toString;var oo=function(e){if(null==e)return!0;if("boolean"==typeof e)return!1;if("number"==typeof e)return 0===e;if("string"==typeof e)return 0===e.length;if("function"==typeof e)return 0===e.length;if(Array.isArray(e))return 0===e.length;if(e instanceof Error)return""===e.message;if(e.toString==no)switch(e.toString()){case"[object File]":case"[object Map]":case"[object Set]":return 0===e.size;case"[object Object]":for(var t in e)if(ro.call(e,t))return!1;return!0}return!1};const io=e,{isEqual:ao}=t,{pick:so}=t,{omit:uo}=t;var co={BLOCK:"@@__SLATE_BLOCK__@@",CHANGE:"@@__SLATE_CHANGE__@@",CHARACTER:"@@__SLATE_CHARACTER__@@",DOCUMENT:"@@__SLATE_DOCUMENT__@@",HISTORY:"@@__SLATE_HISTORY__@@",INLINE:"@@__SLATE_INLINE__@@",LEAF:"@@__SLATE_LEAF__@@",MARK:"@@__SLATE_MARK__@@",OPERATION:"@@__SLATE_OPERATION__@@",RANGE:"@@__SLATE_RANGE__@@",SCHEMA:"@@__SLATE_SCHEMA__@@",STACK:"@@__SLATE_STACK__@@",TEXT:"@@__SLATE_TEXT__@@",VALUE:"@@__SLATE_VALUE__@@"};function lo(e,t){return!(!t||!t[co[e]])}var fo=void 0,ho=void 0;function po(){fo=0,ho=function(){return""+fo++}}po();var vo={create:function(e){if(null==e)return ho();if("string"==typeof e)return e;throw new Error("Keys must be strings, but you passed: "+e)},setGenerator:function(e){ho=e},resetGenerator:po},yo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},go=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},mo=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),ko=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},bo=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},_o=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},wo=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},xo=function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)},Oo=function(e){function t(){return go(this,t),_o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return bo(t,e),mo(t,[{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={object:this.object,type:this.type,isVoid:this.isVoid,data:this.data.toJSON(),nodes:this.nodes.toArray().map((function(t){return t.toJSON(e)}))};return e.preserveKeys&&(t.key=this.key),t}},{key:"toJS",value:function(e){return this.toJSON(e)}},{key:"object",get:function(){return"block"}},{key:"kind",get:function(){return ne.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}},{key:"isEmpty",get:function(){return!this.isVoid&&!this.nodes.some((function(e){return!e.isEmpty}))}},{key:"text",get:function(){return this.getText()}}],[{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}),A(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(Ir.isList(e)||Array.isArray(e)){var r=new Ir(e.map(t.create));return r}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 r=e.data,n=void 0===r?{}:r,o=e.isVoid,i=void 0!==o&&o,a=e.key,s=void 0===a?vo.create():a,u=e.nodes,c=void 0===u?[]:u,l=e.type;if("string"!=typeof l)throw new Error("`Block.fromJSON` requires a `type` string.");return new t({key:s,type:l,isVoid:!!i,data:yr(n),nodes:t.createChildren(c)})}},{key:"isBlockList",value:function(e){return Ir.isList(e)&&e.every((function(e){return t.isBlock(e)}))}}]),t}(Un({data:new yr,isVoid:!1,key:void 0,nodes:new Ir,type:void 0}));Oo.fromJS=Oo.fromJSON,Oo.isBlock=lo.bind(null,"BLOCK"),Oo.prototype[co.BLOCK]=!0;var Ao=function(e){function t(){return go(this,t),_o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return bo(t,e),mo(t,[{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={object:this.object,type:this.type,isVoid:this.isVoid,data:this.data.toJSON(),nodes:this.nodes.toArray().map((function(t){return t.toJSON(e)}))};return e.preserveKeys&&(t.key=this.key),t}},{key:"toJS",value:function(e){return this.toJSON(e)}},{key:"object",get:function(){return"inline"}},{key:"kind",get:function(){return ne.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}},{key:"isEmpty",get:function(){return!this.isVoid&&!this.nodes.some((function(e){return!e.isEmpty}))}},{key:"text",get:function(){return this.getText()}}],[{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}),A(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(Ir.isList(e)||Array.isArray(e)){var r=new Ir(e.map(t.create));return r}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 r=e.data,n=void 0===r?{}:r,o=e.isVoid,i=void 0!==o&&o,a=e.key,s=void 0===a?vo.create():a,u=e.nodes,c=void 0===u?[]:u,l=e.type;if("string"!=typeof l)throw new Error("`Inline.fromJS` requires a `type` string.");return new t({key:s,type:l,isVoid:!!i,data:new yr(n),nodes:t.createChildren(c)})}},{key:"isInlineList",value:function(e){return Ir.isList(e)&&e.every((function(e){return t.isInline(e)}))}}]),t}(Un({data:new yr,isVoid:!1,key:void 0,nodes:new Ir,type:void 0}));Ao.fromJS=Ao.fromJSON,Ao.isInline=lo.bind(null,"INLINE"),Ao.prototype[co.INLINE]=!0;var So=function(){function e(){go(this,e)}return mo(e,null,[{key:"create",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(yr.isMap(t))return t;if(A(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 yr(e)}}]),e}();So.fromJS=So.fromJSON;var Eo={},No={};function To(e,t){var r=function(t){var r=e[t];if(!r)throw new Error('Object does not have a property named "'+t+'".');e[t]=function(){for(var e=arguments.length,n=Array(e),o=0;o<e;o++)n[o]=arguments[o];0!==this.__cache_key&&(this.__cache_key=0,this.__cache=new Map,this.__cache_no_args={}),this.__cache||(this.__cache=new Map),this.__cache_no_args||(this.__cache_no_args={});var i=0!==n.length,a=void 0,s=void 0;if(i?(s=[t].concat(n),a=jo(this.__cache,s)):a=this.__cache_no_args[t],undefined!==a)return a===No?void 0:a;var u=r.apply(this,n),c=void 0===u?No:u;return i?this.__cache=Po(this.__cache,s,c):this.__cache_no_args[t]=c,u}},n=!0,o=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){r(a.value)}}catch(e){o=!0,i=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}}function jo(e,t){var r=!0,n=!1,o=void 0;try{for(var i,a=t[Symbol.iterator]();!(r=(i=a.next()).done);r=!0){var s=i.value;if(undefined===(e=e.get(s)))return}}catch(e){n=!0,o=e}finally{try{!r&&a.return&&a.return()}finally{if(n)throw o}}return e.get(Eo)}function Po(e,t,r){var n=e,o=void 0,i=!0,a=!1,s=void 0;try{for(var u,c=t[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var l=u.value;undefined===(o=n.get(l))&&(o=new Map,n.set(l,o)),n=o}}catch(e){a=!0,s=e}finally{try{!i&&c.return&&c.return()}finally{if(a)throw s}}return o.set(Eo,r),e}var Co=function(e){function t(){return go(this,t),_o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return bo(t,e),mo(t,[{key:"getComponent",value:function(e){return e.__getComponent(this)}},{key:"toJSON",value:function(){return{object:this.object,type:this.type,data:this.data.toJSON()}}},{key:"toJS",value:function(){return this.toJSON()}},{key:"object",get:function(){return"mark"}},{key:"kind",get:function(){return ne.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}}],[{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}),A(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(vn.isSet(e)||Array.isArray(e))return new vn(e.map(t.create));if(null==e)return vn();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(A(e)){var r={};return"type"in e&&(r.type=e.type),"data"in e&&(r.data=So.create(e.data)),r}throw new Error("`Mark.createProperties` only accepts objects, strings or marks, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var r=e.data,n=void 0===r?{}:r,o=e.type;if("string"!=typeof o)throw new Error("`Mark.fromJS` requires a `type` string.");return new t({type:o,data:new yr(n)})}},{key:"isMarkSet",value:function(e){return vn.isSet(e)&&e.every((function(e){return t.isMark(e)}))}}]),t}(Un({data:new yr,type:void 0}));Co.fromJS=Co.fromJSON,Co.isMark=lo.bind(null,"MARK"),Co.prototype[co.MARK]=!0,To(Co.prototype,["getComponent"]);var Bo={};["deleteBackward","deleteCharBackward","deleteLineBackward","deleteWordBackward","deleteForward","deleteCharForward","deleteWordForward","deleteLineForward","setBlocks","setInlines","splitInline","unwrapBlock","unwrapInline","wrapBlock","wrapInline"].forEach((function(e){Bo[e]=function(t){for(var r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];var i=t.value,a=i.selection,s=e+"AtRange";t[s].apply(t,[a].concat(n)),e.match(/Backward$/)?t.collapseToStart():e.match(/Forward$/)&&t.collapseToEnd()}})),Bo.setBlock=function(){ne.deprecate("slate@0.33.0","The `setBlock` method of Slate changes has been renamed to `setBlocks`."),Bo.setBlocks.apply(Bo,arguments)},Bo.setInline=function(){ne.deprecate("slate@0.33.0","The `setInline` method of Slate changes has been renamed to `setInlines`."),Bo.setInlines.apply(Bo,arguments)},Bo.addMark=function(e,t){t=Co.create(t);var r=e.value,n=r.document,o=r.selection;if(o.isExpanded)e.addMarkAtRange(o,t);else if(o.marks){var i=o.marks.add(t),a=o.set("marks",i);e.select(a)}else{var s=n.getActiveMarksAtRange(o).add(t),u=o.set("marks",s);e.select(u)}},Bo.addMarks=function(e,t){t.forEach((function(t){return e.addMark(t)}))},Bo.delete=function(e){var t=e.value.selection;e.deleteAtRange(t),e.collapseToStart()},Bo.insertBlock=function(e,t){t=Oo.create(t);var r=e.value.selection;e.insertBlockAtRange(r,t);var n=e.value.document.getNode(t.key);n&&e.collapseToEndOf(n)},Bo.insertFragment=function(e,t){if(t.nodes.size){var r=e.value,n=r,o=n.document,i=n.selection,a=r,s=a.startText,u=a.endText,c=a.startInline,l=t.getLastText(),f=t.getClosestInline(l.key),h=t.nodes.first(),d=t.nodes.last(),p=o.getTexts().map((function(e){return e.key})),v=!c||i.hasEdgeAtStartOf(s)||i.hasEdgeAtEndOf(u),y=h.hasBlockChildren()||d.hasBlockChildren();e.insertFragmentAtRange(i,t);var g=(o=(r=e.value).document).getTexts().filter((function(e){return!p.includes(e.key)})),m=v?g.last():g.takeLast(2).first();m&&(f||y)?e.select(i.collapseToEndOf(m)):m?e.select(i.collapseToStartOf(m).move(l.text.length)):e.select(i.collapseToStart().move(l.text.length))}},Bo.insertInline=function(e,t){t=Ao.create(t);var r=e.value.selection;e.insertInlineAtRange(r,t);var n=e.value.document.getNode(t.key);n&&e.collapseToEndOf(n)},Bo.insertText=function(e,t,r){var n=e.value,o=n.document,i=n.selection;r=r||i.marks||o.getInsertMarksAtRange(i),e.insertTextAtRange(i,t,r),i.marks&&o!=e.value.document&&e.select({marks:null})},Bo.splitBlock=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=e.value,n=r.selection,o=r.document,i=n.marks||o.getInsertMarksAtRange(n);e.splitBlockAtRange(n,t).collapseToEnd(),i&&0!==i.size&&e.select({marks:i})},Bo.removeMark=function(e,t){t=Co.create(t);var r=e.value,n=r.document,o=r.selection;if(o.isExpanded)e.removeMarkAtRange(o,t);else if(o.marks){var i=o.marks.remove(t),a=o.set("marks",i);e.select(a)}else{var s=n.getActiveMarksAtRange(o).remove(t),u=o.set("marks",s);e.select(u)}},Bo.replaceMark=function(e,t,r){e.removeMark(t),e.addMark(r)},Bo.toggleMark=function(e,t){t=Co.create(t),e.value.activeMarks.has(t)?e.removeMark(t):e.addMark(t)},Bo.wrapText=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,n=e.value,o=n.selection;e.wrapTextAtRange(o,t,r),o.isCollapsed&&e.moveStart(0-t.length),e.moveEnd(0-r.length),o.isForward!=e.value.selection.isForward&&e.flip()};var zo=function(e){function t(){return go(this,t),_o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return bo(t,e),mo(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:"toJS",value:function(e){return this.toJSON(e)}},{key:"object",get:function(){return"document"}},{key:"kind",get:function(){return ne.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}},{key:"isEmpty",get:function(){return!this.nodes.some((function(e){return!e.isEmpty}))}},{key:"text",get:function(){return this.getText()}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isDocument(e))return e;if((Ir.isList(e)||Array.isArray(e))&&(e={nodes:e}),A(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 r=e.data,n=void 0===r?{}:r,o=e.key,i=void 0===o?vo.create():o,a=e.nodes,s=void 0===a?[]:a;return new t({key:i,data:new yr(n),nodes:t.createChildren(s)})}}]),t}(Un({data:new yr,key:void 0,nodes:new Ir}));function Ro(e,t){if(e.size!==t.size)return null;for(var r=0;r<e.size;r++){var n=e.get(r),o=t.get(r);if(n<o)return-1;if(n>o)return 1}return 0}function Lo(e){if(null==e)return null;if(Ir.isList(e))return e;if(Array.isArray(e))return Ir(e);throw new Error("Paths can only be created from arrays or lists, but you passed: "+e)}function Ko(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Io(e,t),n=e.slice(0,r),o=t.slice(0,r);return[n,o]}function Fo(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.size-1,n=e.get(r),o=n+t,i=e.set(r,o);return i}function Io(e,t){return Math.min(e.size,t.size)}zo.fromJS=zo.fromJSON,zo.isDocument=lo.bind(null,"DOCUMENT"),zo.prototype[co.DOCUMENT]=!0;var Do={compare:Ro,create:Lo,crop:Ko,decrement:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.size-1;return Fo(e,0-t,r)},increment:Fo,isAbove:function(e,t){var r=Ko(e,t),n=wo(r,2),o=n[0],i=n[1];return e.size<t.size&&0===Ro(o,i)},isAfter:function(e,t){var r=Ko(e,t),n=wo(r,2);return 1===Ro(n[0],n[1])},isBefore:function(e,t){var r=Ko(e,t),n=wo(r,2);return-1===Ro(n[0],n[1])},lift:function(e){return e.slice(0,-1)},max:function(e,t){return Math.max(e.size,t.size)},min:Io,relate:function(e,t){for(var r=[],n=0;n<e.size&&n<t.size;n++){var o=e.get(n);if(o!==t.get(n))break;r.push(o)}return Lo(r)}},Mo=function(e){function t(){return go(this,t),_o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return bo(t,e),mo(t,[{key:"hasAnchorAtStartOf",value:function(e){if(0!=this.anchorOffset)return!1;var t=Jo(e);return this.anchorKey==t.key}},{key:"hasAnchorAtEndOf",value:function(e){var t=Uo(e);return this.anchorKey==t.key&&this.anchorOffset==t.text.length}},{key:"hasAnchorBetween",value:function(e,t,r){return this.anchorOffset<=r&&t<=this.anchorOffset&&this.hasAnchorIn(e)}},{key:"hasAnchorIn",value:function(e){return"text"==e.object?e.key==this.anchorKey:null!=this.anchorKey&&e.hasDescendant(this.anchorKey)}},{key:"hasFocusAtEndOf",value:function(e){var t=Uo(e);return this.focusKey==t.key&&this.focusOffset==t.text.length}},{key:"hasFocusAtStartOf",value:function(e){if(0!=this.focusOffset)return!1;var t=Jo(e);return this.focusKey==t.key}},{key:"hasFocusBetween",value:function(e,t,r){return t<=this.focusOffset&&this.focusOffset<=r&&this.hasFocusIn(e)}},{key:"hasFocusIn",value:function(e){return"text"==e.object?e.key==this.focusKey:null!=this.focusKey&&e.hasDescendant(this.focusKey)}},{key:"isAtStartOf",value:function(e){return this.isCollapsed&&this.hasAnchorAtStartOf(e)}},{key:"isAtEndOf",value:function(e){return this.isCollapsed&&this.hasAnchorAtEndOf(e)}},{key:"focus",value:function(){return this.merge({isFocused:!0})}},{key:"blur",value:function(){return this.merge({isFocused:!1})}},{key:"deselect",value:function(){return this.merge({anchorKey:null,anchorOffset:0,anchorPath:null,focusKey:null,focusOffset:0,focusPath:null,isFocused:!1,isBackward:!1})}},{key:"flip",value:function(){return this.merge({anchorKey:this.focusKey,anchorOffset:this.focusOffset,anchorPath:this.focusPath,focusKey:this.anchorKey,focusOffset:this.anchorOffset,focusPath:this.anchorPath,isBackward:null==this.isBackward?null:!this.isBackward})}},{key:"moveAnchor",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=this.anchorKey,r=this.focusKey,n=this.focusOffset,o=this.isBackward,i=this.anchorOffset+e;return this.merge({anchorOffset:i,isBackward:t==r?i>n:o})}},{key:"moveFocus",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=this.anchorKey,r=this.anchorOffset,n=this.focusKey,o=this.isBackward,i=this.focusOffset+e;return this.merge({focusOffset:i,isBackward:n==t?r>i:o})}},{key:"moveAnchorTo",value:function(e,t){var r=this.anchorKey,n=this.focusKey,o=this.focusOffset,i=this.anchorPath,a=this.focusPath,s=this.isBackward;if("string"==typeof e){var u=e===r,c=e===n;return this.merge({anchorKey:e,anchorPath:c?a:u?i:null,anchorOffset:t,isBackward:c?t>o:u?s:null})}var l=e,f=l&&l.equals(i),h=l&&l.equals(a);return this.merge({anchorPath:l,anchorKey:f?r:h?n:null,anchorOffset:t,isBackward:h?t>o:f?s:null})}},{key:"moveFocusTo",value:function(e,t){var r=this.focusKey,n=this.anchorKey,o=this.anchorOffset,i=this.anchorPath,a=this.focusPath,s=this.isBackward;if("string"==typeof e){var u=e===n,c=e===r;return this.merge({focusKey:e,focusPath:u?i:c?a:null,focusOffset:t,isBackward:u?t<o:c?s:null})}var l=e,f=l&&l.equals(i),h=l&&l.equals(a);return this.merge({focusPath:l,focusKey:h?r:f?n:null,focusOffset:t,isBackward:f?t<o:h?s:null})}},{key:"moveAnchorOffsetTo",value:function(e){return this.merge({anchorOffset:e,isBackward:this.anchorKey==this.focusKey?e>this.focusOffset:this.isBackward})}},{key:"moveFocusOffsetTo",value:function(e){return this.merge({focusOffset:e,isBackward:this.anchorKey==this.focusKey?this.anchorOffset>e:this.isBackward})}},{key:"moveOffsetsTo",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return this.moveAnchorOffsetTo(e).moveFocusOffsetTo(t)}},{key:"moveToAnchor",value:function(){return this.moveFocusTo(this.anchorKey,this.anchorOffset)}},{key:"moveToFocus",value:function(){return this.moveAnchorTo(this.focusKey,this.focusOffset)}},{key:"moveAnchorToStartOf",value:function(e){return e=Jo(e),this.moveAnchorTo(e.key,0)}},{key:"moveAnchorToEndOf",value:function(e){return e=Uo(e),this.moveAnchorTo(e.key,e.text.length)}},{key:"moveFocusToStartOf",value:function(e){return e=Jo(e),this.moveFocusTo(e.key,0)}},{key:"moveFocusToEndOf",value:function(e){return e=Uo(e),this.moveFocusTo(e.key,e.text.length)}},{key:"moveToRangeOf",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,r=this.isBackward?this.flip():this;return r.moveAnchorToStartOf(e).moveFocusToEndOf(t)}},{key:"normalize",value:function(e){var t=this,r=t.anchorKey,n=t.anchorOffset,o=t.anchorPath,i=t.focusKey,a=t.focusOffset,s=t.focusPath,u=t.isBackward,c=void 0===n?"undefined":yo(n),l=void 0===a?"undefined":yo(a);if("number"==c&&"number"==l||ne.warn('The range offsets should be numbers, but they were of type "'+c+'" and "'+l+'".'),null==r&&null==o||null==i&&null==s)return t.merge({anchorKey:null,anchorOffset:0,anchorPath:null,focusKey:null,focusOffset:0,focusPath:null,isBackward:!1});var f=e.getNode(r||o),h=e.getNode(i||s);if(!f||!h){ne.warn("The range was invalid and was reset. The range in question was:",t);var d=e.getFirstText(),p=d&&e.getPath(d.key);return t.merge({anchorKey:d?d.key:null,anchorOffset:0,anchorPath:d?p:null,focusKey:d?d.key:null,focusOffset:0,focusPath:d?p:null,isBackward:!1})}if("text"!=f.object){ne.warn("The range anchor was set to a Node that is not a Text node. This should not happen and can degrade performance. The node in question was:",f);var v=f.getTextAtOffset(n);n-=f.getOffset(v.key),f=v}if("text"!=h.object){ne.warn("The range focus was set to a Node that is not a Text node. This should not happen and can degrade performance. The node in question was:",h);var y=h.getTextAtOffset(a);a-=h.getOffset(y.key),h=y}if(r=f.key,i=h.key,o=e.getPath(r),s=e.getPath(i),null==u){var g=Do.compare(o,s);u=0===g?n>a:1===g}return t.merge({anchorKey:r,anchorOffset:n,anchorPath:o,focusKey:i,focusOffset:a,focusPath:s,isBackward:u})}},{key:"toJSON",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={object:this.object,anchorKey:this.anchorKey,anchorOffset:this.anchorOffset,anchorPath:this.anchorPath&&this.anchorPath.toArray(),focusKey:this.focusKey,focusOffset:this.focusOffset,focusPath:this.focusPath&&this.focusPath.toArray(),isAtomic:this.isAtomic,isBackward:this.isBackward,isFocused:this.isFocused,marks:null==this.marks?null:this.marks.toArray().map((function(e){return e.toJSON()}))};return e.preserveKeys||(delete t.anchorKey,delete t.focusKey),t}},{key:"toJS",value:function(){return this.toJSON()}},{key:"object",get:function(){return"range"}},{key:"kind",get:function(){return ne.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}},{key:"isBlurred",get:function(){return!this.isFocused}},{key:"isCollapsed",get:function(){return this.anchorKey==this.focusKey&&this.anchorOffset==this.focusOffset}},{key:"isExpanded",get:function(){return!this.isCollapsed}},{key:"isForward",get:function(){return null==this.isBackward?null:!this.isBackward}},{key:"isSet",get:function(){return null!=this.anchorKey&&null!=this.focusKey||null!=this.anchorPath&&null!=this.focusPath}},{key:"isUnset",get:function(){return!this.isSet}},{key:"startKey",get:function(){return this.isBackward?this.focusKey:this.anchorKey}},{key:"startOffset",get:function(){return this.isBackward?this.focusOffset:this.anchorOffset}},{key:"startPath",get:function(){return this.isBackward?this.focusPath:this.anchorPath}},{key:"endKey",get:function(){return this.isBackward?this.anchorKey:this.focusKey}},{key:"endOffset",get:function(){return this.isBackward?this.anchorOffset:this.focusOffset}},{key:"endPath",get:function(){return this.isBackward?this.anchorPath:this.focusPath}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isRange(e))return e;if(A(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(Ir.isList(e)||Array.isArray(e)){var r=new Ir(e.map(t.create));return r}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{anchorKey:e.anchorKey,anchorOffset:e.anchorOffset,anchorPath:e.anchorPath,focusKey:e.focusKey,focusOffset:e.focusOffset,focusPath:e.focusPath,isAtomic:e.isAtomic,isBackward:e.isBackward,isFocused:e.isFocused,marks:e.marks};if(A(e)){var r={};return"anchorKey"in e&&(r.anchorKey=e.anchorKey),"anchorOffset"in e&&(r.anchorOffset=e.anchorOffset),"anchorPath"in e&&(r.anchorPath=Do.create(e.anchorPath)),"focusKey"in e&&(r.focusKey=e.focusKey),"focusOffset"in e&&(r.focusOffset=e.focusOffset),"focusPath"in e&&(r.focusPath=Do.create(e.focusPath)),"isAtomic"in e&&(r.isAtomic=e.isAtomic),"isBackward"in e&&(r.isBackward=e.isBackward),"isFocused"in e&&(r.isFocused=e.isFocused),"marks"in e&&(r.marks=null==e.marks?null:Co.createSet(e.marks)),"anchorPath"in e&&!("anchorKey"in e)&&(r.anchorKey=null),"anchorKey"in e&&!("anchorPath"in e)&&(r.anchorPath=null),"focusPath"in e&&!("focusKey"in e)&&(r.focusKey=null),"focusKey"in e&&!("focusPath"in e)&&(r.focusPath=null),r}throw new Error("`Range.createProperties` only accepts objects or ranges, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var r=e.anchorKey,n=void 0===r?null:r,o=e.anchorOffset,i=void 0===o?0:o,a=e.anchorPath,s=void 0===a?null:a,u=e.focusKey,c=void 0===u?null:u,l=e.focusOffset,f=void 0===l?0:l,h=e.focusPath,d=void 0===h?null:h,p=e.isAtomic,v=void 0!==p&&p,y=e.isBackward,g=void 0===y?null:y,m=e.isFocused,k=void 0!==m&&m,b=e.marks,_=void 0===b?null:b;return new t({anchorKey:n,anchorOffset:i,anchorPath:Do.create(s),focusKey:c,focusOffset:f,focusPath:Do.create(d),isAtomic:v,isBackward:g,isFocused:k,marks:null==_?null:new vn(_.map(Co.fromJSON))})}},{key:"isRange",value:function(e){return!(!e||!e[co.RANGE])}}]),t}(Un({anchorKey:null,anchorOffset:0,anchorPath:null,focusKey:null,focusOffset:0,focusPath:null,isAtomic:!1,isBackward:null,isFocused:!1,marks:null}));Mo.fromJS=Mo.fromJSON,Mo.prototype[co.RANGE]=!0;[["move",""],["move","To"],["move","ToStartOf"],["move","ToEndOf"]].forEach((function(e){var t=wo(e,2),r=t[0],n=t[1];Mo.prototype[""+r+n]=function(){var e;return(e=this[r+"Anchor"+n].apply(this,arguments))[r+"Focus"+n].apply(e,arguments)}}));[["has","AtStartOf",!0],["has","AtEndOf",!0],["has","Between",!0],["has","In",!0],["collapseTo",""],["move",""],["moveTo",""],["move","To"],["move","OffsetTo"]].forEach((function(e){var t=wo(e,3),r=t[0],n=t[1],o=t[2],i=r+"Anchor"+n,a=r+"Focus"+n;Mo.prototype[r+"Start"+n]=function(){return this.isBackward?this[a].apply(this,arguments):this[i].apply(this,arguments)},Mo.prototype[r+"End"+n]=function(){return this.isBackward?this[i].apply(this,arguments):this[a].apply(this,arguments)},o&&(Mo.prototype[r+"Edge"+n]=function(){return this[i].apply(this,arguments)||this[a].apply(this,arguments)})}));function Jo(e){return"text"==e.object?e:e.getFirstText()}function Uo(e){return"text"==e.object?e:e.getLastText()}[["collapseTo","moveTo"],["collapseToAnchor","moveToAnchor"],["collapseToFocus","moveToFocus"],["collapseToStart","moveToStart"],["collapseToEnd","moveToEnd"],["collapseToStartOf","moveToStartOf"],["collapseToEndOf","moveToEndOf"],["extend","moveFocus"],["extendTo","moveFocusTo"],["extendToStartOf","moveFocusToStartOf"],["extendToEndOf","moveFocusToEndOf"]].forEach((function(e){var t=wo(e,2),r=t[0],n=t[1];Mo.prototype[r]=function(){return this[n].apply(this,arguments)}}));var Vo=function(e){function t(){return go(this,t),_o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return bo(t,e),mo(t,[{key:"toJSON",value:function(){return{object:this.object,text:this.text,marks:this.marks.toArray().map((function(e){return e.toJSON()}))}}},{key:"toJS",value:function(){return this.toJSON()}},{key:"object",get:function(){return"character"}},{key:"kind",get:function(){return ne.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isCharacter(e))return e;if("string"==typeof e&&(e={text:e}),A(e))return t.fromJSON(e);throw new Error("`Character.create` only accepts objects, strings or characters, but you passed it: "+e)}},{key:"createList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if("string"==typeof e&&(e=e.split("")),Ir.isList(e)||Array.isArray(e)){var r=new Ir(e.map(t.create));return r}throw new Error("`Block.createList` only accepts strings, arrays or lists, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var r=e.text,n=e.marks,o=void 0===n?[]:n;if("string"!=typeof r)throw new Error("`Character.fromJSON` requires a block `text` string.");return new t({text:r,marks:new vn(o)})}},{key:"isCharacterList",value:function(e){return Ir.isList(e)&&e.every((function(e){return t.isCharacter(e)}))}}]),t}(Un({marks:new vn,text:""}));Vo.fromJS=Vo.fromJSON,Vo.isCharacter=lo.bind(null,"CHARACTER"),Vo.prototype[co.CHARACTER]=!0;var qo=function(e){function t(){return go(this,t),_o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return bo(t,e),mo(t,[{key:"getCharacters",value:function(){ne.deprecate("slate@0.34.0","The `characters` property of Slate objects is deprecated");var e=this.marks;return Vo.createList(this.text.split("").map((function(t){return Vo.create({text:t,marks:e})})))}},{key:"updateMark",value:function(e,t){var r=this.marks;if(t.equals(e))return this;if(!r.has(e))return this;var n=r.withMutations((function(r){r.remove(e).add(t)}));return this.set("marks",n)}},{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:"toJS",value:function(){return this.toJSON()}},{key:"object",get:function(){return"leaf"}},{key:"kind",get:function(){return ne.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}}],[{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}),A(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,r=Ir().withMutations((function(r){e.findLast((function(e,n){var o=r.first();if(o){if(o.marks.equals(e.marks))return t=!0,void r.set(0,o.set("text",""+e.text+o.text));if(""===o.text)return t=!0,void r.set(0,e);if(""===e.text)return void(t=!0)}r.unshift(e)}))}));return t?r:e}},{key:"splitLeaves",value:function(e,t){if(t<0)return[Ir(),e];if(0===e.size)return[Ir(),Ir()];var r=0,n=-1,o=void 0,i=void 0;return e.find((function(e){n++;var a=r,s=e.text;if((r+=s.length)<t)return!1;if(a>t)return!1;var u=t-a;return o=e.set("text",s.slice(0,u)),i=e.set("text",s.slice(u)),!0})),o?""===o.text?0===n?[Ir.of(o),e]:[e.take(n),e.skip(n)]:""===i.text?n===e.size-1?[e,Ir.of(i)]:[e.take(n+1),e.skip(n+1)]:[e.take(n).push(o),e.skip(n+1).unshift(i)]:[e,Ir()]}},{key:"createList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(Ir.isList(e)||Array.isArray(e)){var r=new Ir(e.map(t.create));return r}throw new Error("`Leaf.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var r=e.text,n=void 0===r?"":r,o=e.marks;return new t({text:n,marks:vn((void 0===o?[]:o).map(Co.fromJSON))})}},{key:"isLeafList",value:function(e){return Ir.isList(e)&&e.every((function(e){return t.isLeaf(e)}))}}]),t}(Un({marks:vn(),text:""}));qo.fromJS=qo.fromJSON,qo.isLeaf=lo.bind(null,"LEAF"),qo.prototype[co.LEAF]=!0;var Wo=function(e){function t(){return go(this,t),_o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return bo(t,e),mo(t,[{key:"getString",value:function(){return this.leaves.reduce((function(e,t){return e+t.text}),"")}},{key:"searchLeafAtOffset",value:function(e){var t=0,r=0,n=-1;return{leaf:this.leaves.find((function(o){return n++,(t=(r=t)+o.text.length)>=e})),endOffset:t,index:n,startOffset:r}}},{key:"addMark",value:function(e,t,r){var n=vn.of(r);return this.addMarks(e,t,n)}},{key:"addMarks",value:function(e,t,r){if(""===this.text&&0===t&&0===e){var n=this.leaves.first();if(!n)return this.set("leaves",Ir.of(qo.fromJSON({text:"",marks:r})));var o=n.addMarks(r);return o===n?this:this.set("leaves",Ir.of(o))}if(""===this.text)return this;if(0===t)return this;if(e>=this.text.length)return this;var i=qo.splitLeaves(this.leaves,e),a=wo(i,2),s=a[0],u=a[1],c=qo.splitLeaves(u,t),l=wo(c,2),f=l[0],h=l[1],d=s.concat(f.map((function(e){return e.addMarks(r)})),h);return this.setLeaves(d)}},{key:"getDecorations",value:function(e){return e.__getDecorations(this)}},{key:"getLeaves",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=this.leaves;if(0===r.size)return Ir.of(qo.create({}));if(!t||0===t.length)return r;if(0===this.text.length)return r;var n=this.key;return t.forEach((function(t){var o=t.startKey,i=t.endKey,a=t.startOffset,s=t.endOffset,u=t.marks,c=o==n,l=i==n;if(c&&l){var f=c?a:0,h=l?s-f:e.text.length-f;if(h<1)return;if(f>=e.text.length)return;if(0!==f||h<e.text.length){var d=qo.splitLeaves(r,f),p=wo(d,2),v=p[0],y=p[1],g=qo.splitLeaves(y,h),m=wo(g,2),k=m[0],b=m[1];return void(r=v.concat(k.map((function(e){return e.addMarks(u)})),b))}}r=r.map((function(e){return e.addMarks(u)}))})),r===this.leaves?r:qo.createLeaves(r)}},{key:"getActiveMarksBetweenOffsets",value:function(e,t){if(e<=0&&t>=this.text.length)return this.getActiveMarks();if(e>=t)return vn();if(""===this.text)return this.getActiveMarks();var r=null,n=0;return this.leaves.forEach((function(o){var i=n;if(!((n=i+o.text.length)<=e)){if(i>=t)return!1;if(r)return(r=r.intersect(o.marks))&&r.size,!1;r=o.marks}})),r||vn()}},{key:"getActiveMarks",value:function(){var e=this;if(0===this.leaves.size)return vn();var t=this.leaves.first().marks;return 0===t.size?t:t.withMutations((function(t){e.leaves.forEach((function(e){if(t.intersect(e.marks),0===t.size)return!1}))}))}},{key:"getFirstText",value:function(){return this}},{key:"getLastText",value:function(){return this}},{key:"getMarksBetweenOffsets",value:function(e,t){if(e<=0&&t>=this.text.length)return this.getMarks();if(e>=t)return vn();if(""===this.text)return this.getActiveMarks();var r=null,n=0;return this.leaves.forEach((function(o){var i=n;if(!((n=i+o.text.length)<=e))return!(i>=t)&&void(r=r?r.union(o.marks):o.marks)})),r||vn()}},{key:"getMarks",value:function(){var e=this.getMarksAsArray();return new Fn(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:vn()}},{key:"getNode",value:function(e){return this.key==e?this:null}},{key:"hasNode",value:function(e){return!!this.getNode(e)}},{key:"insertText",value:function(e,t,r){if(""===this.text)return this.set("leaves",Ir.of(qo.create({text:t,marks:r})));if(0===t.length)return this;r||(r=vn());var n=this.searchLeafAtOffset(e),o=n.startOffset,i=n.leaf,a=n.index,s=e-o,u=i.text.slice(0,s),c=i.text.slice(s),l=this.leaves;if(i.marks.equals(r))return this.set("leaves",l.set(a,i.set("text",u+t+c)));var f=l.splice(a,1,i.set("text",u),qo.create({text:t,marks:r}),i.set("text",c));return this.setLeaves(f)}},{key:"regenerateKey",value:function(){var e=vo.create();return this.set("key",e)}},{key:"removeMark",value:function(e,t,r){if(""===this.text&&0===e&&0===t){var n=this.leaves.first();if(!n)return this;var o=n.removeMark(r);return o===n?this:this.set("leaves",Ir.of(o))}if(t<=0)return this;if(e>=this.text.length)return this;var i=qo.splitLeaves(this.leaves,e),a=wo(i,2),s=a[0],u=a[1],c=qo.splitLeaves(u,t),l=wo(c,2),f=l[0],h=l[1],d=s.concat(f.map((function(e){return e.removeMark(r)})),h);return this.setLeaves(d)}},{key:"removeText",value:function(e,t){if(t<=0)return this;if(e>=this.text.length)return this;if(1===t){var r=this.searchLeafAtOffset(e+1),n=r.leaf,o=r.index,i=e-r.startOffset;if(n){if(1===n.text.length){var a=this.leaves.remove(o);return this.setLeaves(a)}var s=n.text.slice(0,i)+n.text.slice(i+t);if(s.length>0)return this.set("leaves",this.leaves.set(o,n.set("text",s)))}}var u=qo.splitLeaves(this.leaves,e),c=wo(u,2),l=c[0],f=c[1],h=qo.splitLeaves(f,t)[1],d=qo.createLeaves(l.concat(h));if(1===d.size){var p=d.first();if(""===p.text)return this.set("leaves",Ir.of(p.set("marks",this.getActiveMarks())))}return this.set("leaves",d)}},{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:"toJS",value:function(e){return this.toJSON(e)}},{key:"updateMark",value:function(e,t,r,n){var o=r.merge(n);if(""===this.text&&0===t&&0===e){var i=this.leaves.first();if(!i)return this;var a=i.updateMark(r,o);return a===i?this:this.set("leaves",Ir.of(a))}if(t<=0)return this;if(e>=this.text.length)return this;var s=qo.splitLeaves(this.leaves,e),u=wo(s,2),c=u[0],l=u[1],f=qo.splitLeaves(l,t),h=wo(f,2),d=h[0],p=h[1],v=c.concat(d.map((function(e){return e.updateMark(r,o)})),p);return this.setLeaves(v)}},{key:"splitText",value:function(e){var t=qo.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:"normalize",value:function(e){return e.normalizeNode(this)}},{key:"validate",value:function(e){return e.validateNode(this)}},{key:"getFirstInvalidDescendant",value:function(e){return this.validate(e)?this:null}},{key:"setLeaves",value:function(e){var t=qo.createLeaves(e);if(1===t.size){var r=t.first();if((!r.marks||0===r.marks.size)&&""===r.text)return this.set("leaves",Ir())}return this.set("leaves",qo.createLeaves(e))}},{key:"object",get:function(){return"text"}},{key:"kind",get:function(){return ne.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}},{key:"isEmpty",get:function(){return""==this.text}},{key:"text",get:function(){return this.getString()}},{key:"characters",get:function(){return this.leaves.flatMap((function(e){return e.getCharacters()}))}}],[{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}]}),A(e)){if(e.text){var r=e,n=r.text,o=r.marks,i=r.key;e={key:i,leaves:[{text:n,marks:o}]}}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(Ir.isList(e)||Array.isArray(e)){var r=new Ir(e.map(t.create));return r}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 r=e.key,n=void 0===r?vo.create():r,o=e.leaves;if(o||(e.ranges?(ne.deprecate("slate@0.27.0","The `ranges` property of Slate objects has been renamed to `leaves`."),o=e.ranges):o=Ir()),Array.isArray(o))o=Ir(o.map((function(e){return qo.create(e)})));else{if(!Ir.isList(o))throw new Error("leaves must be either Array or Immutable.List");o=o.map((function(e){return qo.create(e)}))}return new t({leaves:qo.createLeaves(o),key:n})}},{key:"isTextList",value:function(e){return Ir.isList(e)&&e.every((function(e){return t.isText(e)}))}}]),t}(Un({leaves:Ir(),key:void 0}));Wo.fromJS=Wo.fromJSON,Wo.isText=lo.bind(null,"TEXT"),Wo.prototype[co.TEXT]=!0,To(Wo.prototype,["getDecorations","getActiveMarks","getMarks","getMarksAsArray","normalize","validate","getString"]);var Ho=function(){function e(){go(this,e)}return mo(e,[{key:"addMark",value:function(e,t,r,n){var o=this.assertDescendant(e);return e=this.resolvePath(e),o=o.addMark(t,r,n),this.replaceNode(e,o)}},{key:"filterDescendants",value:function(e){var t=[];return this.forEachDescendant((function(r,n,o){e(r,n,o)&&t.push(r)})),Ir(t)}},{key:"findDescendant",value:function(e){var t=null;return this.forEachDescendant((function(r,n,o){if(e(r,n,o))return t=r,!1})),t}},{key:"forEachDescendant",value:function(e){var t=void 0;return this.nodes.forEach((function(r,n,o){return!1===e(r,n,o)?(t=!1,!1):"text"!=r.object?t=r.forEachDescendant(e):void 0})),t}},{key:"getActiveMarksAtRange",value:function(e){if((e=e.normalize(this)).isUnset)return vn();if(e.isCollapsed){var t=e,r=t.startKey,n=t.startOffset;return this.getMarksAtPosition(r,n).toSet()}var o=e,i=o.startKey,a=o.endKey,s=o.startOffset,u=o.endOffset,c=this.getDescendant(i);if(i!==a){for(;i!==a&&0===u;){var l=this.getPreviousText(a);a=l.key,u=l.text.length}for(;i!==a&&s===c.text.length;)i=(c=this.getNextText(i)).key,s=0}if(i===a)return c.getActiveMarksBetweenOffsets(s,u);var f=c.getActiveMarksBetweenOffsets(s,c.text.length);if(0===f.size)return vn();var h=this.getDescendant(a).getActiveMarksBetweenOffsets(0,u),d=f.intersect(h);if(0===d.size)return d;for(var p=this.getNextText(i);p.key!==a;){if(0!==p.text.length&&0===(d=d.intersect(p.getActiveMarks())).size)return vn();p=this.getNextText(p.key)}return d}},{key:"getAncestors",value:function(e){var t=this;if(!(e=this.resolvePath(e)))return null;var r=[];return e.forEach((function(n,o){var i=e.slice(0,o),a=t.getNode(i);r.push(a)})),Ir(r)}},{key:"getBlocks",value:function(){var e=this.getBlocksAsArray();return new Ir(e)}},{key:"getBlocksAsArray",value:function(){return this.nodes.reduce((function(e,t){return"block"!=t.object?e:t.isLeafBlock()?(e.push(t),e):e.concat(t.getBlocksAsArray())}),[])}},{key:"getBlocksAtRange",value:function(e){var t=this.getBlocksAtRangeAsArray(e);return new Ir(new Fn(t))}},{key:"getBlocksAtRangeAsArray",value:function(e){if((e=e.normalize(this)).isUnset)return[];var t=e,r=t.startKey,n=t.endKey,o=this.getClosestBlock(r);if(r===n)return[o];var i=this.getClosestBlock(n),a=this.getBlocksAsArray(),s=a.indexOf(o),u=a.indexOf(i);return a.slice(s,u+1)}},{key:"getBlocksByType",value:function(e){var t=this.getBlocksByTypeAsArray(e);return new Ir(t)}},{key:"getBlocksByTypeAsArray",value:function(e){return this.nodes.reduce((function(t,r){return"block"!=r.object?t:r.isLeafBlock()&&r.type==e?(t.push(r),t):t.concat(r.getBlocksByTypeAsArray(e))}),[])}},{key:"getCharacters",value:function(){return this.getTexts().flatMap((function(e){return e.characters}))}},{key:"getCharactersAtRange",value:function(e){if((e=e.normalize(this)).isUnset)return Ir();var t=e,r=t.startKey,n=t.endKey,o=t.startOffset,i=t.endOffset;return r===n?this.getDescendant(n).characters.slice(o,i):this.getTextsAtRange(e).flatMap((function(e){return e.key===r?e.characters.slice(o):e.key===n?e.characters.slice(0,i):e.characters}))}},{key:"getChild",value:function(e){return(e=this.resolvePath(e))&&1===e.size?this.nodes.get(e.first()):null}},{key:"getClosest",value:function(e,t){var r=this,n=this.getAncestors(e);if(!n)return null;var o=n.findLast((function(e){for(var n=arguments.length,o=Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];return e!==r&&t.apply(void 0,[e].concat(o))}));return o||null}},{key:"getClosestBlock",value:function(e){var t=this.getClosest(e,(function(e){return"block"===e.object}));return t}},{key:"getClosestInline",value:function(e){var t=this.getClosest(e,(function(e){return"inline"===e.object}));return t}},{key:"getClosestVoid",value:function(e){return this.getClosest(e,(function(e){return e.isVoid}))}},{key:"getCommonAncestor",value:function(e,t){if(e=this.resolvePath(e),t=this.resolvePath(t),!e||!t)return null;var r=Do.relate(e,t);return this.getNode(r)}},{key:"getDecorations",value:function(e){var t=e.find("decorateNode",this);return Mo.createList(t||[])}},{key:"getDepth",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(!(e=this.resolvePath(e)))return null;var r=this.getNode(e),n=r?e.size-1+t:null;return n}},{key:"getDescendant",value:function(e){if(!(e=this.resolvePath(e)))return null;var t=e.toArray(),r=this,n=!0,o=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var u=a.value;if(!r)return null;if(!r.nodes)return null;r=r.nodes.get(u)}}catch(e){o=!0,i=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}return r}},{key:"getFirstInvalidDescendant",value:function(e){var t=null;return this.nodes.find((function(r){return t=r.validate(e)?r:r.getFirstInvalidDescendant(e)})),t}},{key:"getFirstText",value:function(){var e=null,t=this.nodes.find((function(t){return"text"===t.object||!!(e=t.getFirstText())}));return e||t}},{key:"getFragmentAtRange",value:function(e){if((e=e.normalize(this)).isUnset)return zo.create();for(var t=e,r=t.startPath,n=t.startOffset,o=t.endPath,i=this,a=o,s=t.endOffset,u="end";a.size;){var c=a.last();i=i.splitNode(a,s),s=c+1,(a=Do.lift(a)).size||"end"!==u||(a=r,s=n,u="start")}var l=r.first()+1,f=o.first()+2,h=i.nodes.slice(l,f);return zo.create({nodes:h})}},{key:"getFurthest",value:function(e,t){var r=this,n=this.getAncestors(e);if(!n)return null;var o=n.find((function(e){for(var n=arguments.length,o=Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];return e!==r&&t.apply(void 0,[e].concat(o))}));return o||null}},{key:"getFurthestAncestor",value:function(e){return(e=this.resolvePath(e))&&e.size?this.nodes.get(e.first()):null}},{key:"getFurthestBlock",value:function(e){var t=this.getFurthest(e,(function(e){return"block"===e.object}));return t}},{key:"getFurthestInline",value:function(e){var t=this.getFurthest(e,(function(e){return"inline"===e.object}));return t}},{key:"getFurthestOnlyChildAncestor",value:function(e){var t=this.getAncestors(e);return t&&t.rest().reverse().takeUntil((function(e){return e.nodes.size>1})).last()||null}},{key:"getInlines",value:function(){var e=this.getInlinesAsArray();return new Ir(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 new Ir(new Fn(t))}},{key:"getInlinesAtRangeAsArray",value:function(e){var t=this;return(e=e.normalize(this)).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 new Ir(t)}},{key:"getInlinesByTypeAsArray",value:function(e){return this.nodes.reduce((function(t,r){return"text"==r.object?t:r.isLeafInline()&&r.type==e?(t.push(r),t):t.concat(r.getInlinesByTypeAsArray(e))}),[])}},{key:"getInsertMarksAtRange",value:function(e){if((e=e.normalize(this)).isUnset)return vn();if(e.isCollapsed)return this.getMarksAtPosition(e.startKey,e.startOffset);var t=e,r=t.startKey,n=t.startOffset;return this.getDescendant(r).getMarksAtIndex(n+1)}},{key:"getKeysToPathsTable",value:function(){var e=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}({},this.key,[]);return this.nodes.forEach((function(t,r){if(e[t.key]=[r],"text"!==t.object){var n=t.getKeysToPathsTable();for(var o in n){var i=n[o];e[o]=[r].concat(xo(i))}}})),e}},{key:"getLastText",value:function(){var e=null,t=this.nodes.findLast((function(t){return"text"==t.object||(e=t.getLastText())}));return e||t}},{key:"getMarks",value:function(){var e=this.getMarksAsArray();return new vn(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 r=this.getDescendant(e).getMarksAtIndex(t);if(0!==t)return r;var n=this.getClosestBlock(e);if(""===n.text)return r;var o=this.getPreviousText(e);return o?n.hasDescendant(o.key)?o.getMarksAtIndex(o.text.length):r:vn()}},{key:"getMarksAtRange",value:function(e){return new vn(this.getOrderedMarksAtRange(e))}},{key:"getMarksByType",value:function(e){var t=this.getMarksByTypeAsArray(e);return new vn(t)}},{key:"getMarksByTypeAsArray",value:function(e){return this.nodes.reduce((function(t,r){return"text"==r.object?t.concat(r.getMarksAsArray().filter((function(t){return t.type==e}))):t.concat(r.getMarksByTypeAsArray(e))}),[])}},{key:"getNextBlock",value:function(e){var t=this.assertDescendant(e),r=void 0;"block"==t.object?r=t.getLastText():r=this.getClosestBlock(e).getLastText();var n=this.getNextText(r.key);return n?this.getClosestBlock(n.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 r=e.slice(0,t),n=Do.increment(r),o=this.getNode(n);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=Do.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:"getNode",value:function(e){return(e=this.resolvePath(e))?e.size?this.getDescendant(e):this:null}},{key:"getOffset",value:function(e){this.assertDescendant(e);var t=this.getFurthestAncestor(e),r=this.nodes.takeUntil((function(e){return e==t})).reduce((function(e,t){return e+t.text.length}),0);return this.hasChild(e)?r:r+t.getOffset(e)}},{key:"getOffsetAtRange",value:function(e){if((e=e.normalize(this)).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,r=t.startKey,n=t.startOffset;return this.getOffset(r)+n}},{key:"getOrderedMarks",value:function(){var e=this.getMarksAsArray();return new Fn(e)}},{key:"getOrderedMarksAtRange",value:function(e){if((e=e.normalize(this)).isUnset)return Fn();if(e.isCollapsed)return this.getMarksAtPosition(e.startKey,e.startOffset);var t=e,r=t.startKey,n=t.startOffset,o=t.endKey,i=t.endOffset;return this.getOrderedMarksBetweenPositions(r,n,o,i)}},{key:"getOrderedMarksBetweenPositions",value:function(e,t,r,n){if(e===r)return this.getDescendant(e).getMarksBetweenOffsets(t,n);var o=this.getTextsBetweenPositionsAsArray(e,r);return Fn().withMutations((function(i){o.forEach((function(o){o.key===e?i.union(o.getMarksBetweenOffsets(t,o.text.length)):o.key===r?i.union(o.getMarksBetweenOffsets(0,n)):i.union(o.getMarks())}))}))}},{key:"getOrderedMarksByType",value:function(e){var t=this.getMarksByTypeAsArray(e);return new Fn(t)}},{key:"getParent",value:function(e){if(!(e=this.resolvePath(e)))return null;if(!e.size)return null;var t=Do.lift(e);return this.getNode(t)}},{key:"getPath",value:function(e){if(Ir.isList(e))return e;var t=this.getKeysToPathsTable()[e];return t?Ir(t):null}},{key:"getPreviousBlock",value:function(e){var t=this.assertDescendant(e),r=void 0;"block"==t.object?r=t.getFirstText():r=this.getClosestBlock(e).getFirstText();var n=this.getPreviousText(r.key);return n?this.getClosestBlock(n.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 r=e.slice(0,t);if(0!==r.last()){var n=Do.decrement(r),o=this.getNode(n);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=Do.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],r=e.startKey,n=e.endKey;if(!t)return null;if(e.isUnset)return null;if(r==n){var o=this.getFurthestAncestor(r),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==r&&(a=t),null==s&&e.key==n&&(s=t+1)):(null==a&&e.hasDescendant(r)&&(a=t),null==s&&e.hasDescendant(n)&&(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:"getText",value:function(){return this.nodes.reduce((function(e,t){return e+t.text}),"")}},{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(r,n,o){return(t+=r.text.length)>e}))}},{key:"getTextDirection",value:function(){var e=eo(this.text);return"neutral"===e?null:e}},{key:"getTexts",value:function(){var e=this.getTextsAsArray();return new Ir(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=e.normalize(this)).isUnset)return Ir();var t=e,r=t.startKey,n=t.endKey;return new Ir(this.getTextsBetweenPositionsAsArray(r,n))}},{key:"getTextsAtRangeAsArray",value:function(e){if((e=e.normalize(this)).isUnset)return[];var t=e,r=t.startKey,n=t.endKey;return this.getTextsBetweenPositionsAsArray(r,n)}},{key:"getTextsBetweenPositionsAsArray",value:function(e,t){var r=this.getDescendant(e);if(e==t)return[r];var n=this.getDescendant(t),o=this.getTextsAsArray(),i=o.indexOf(r),a=o.indexOf(n,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:"hasNode",value:function(e){return!!this.getNode(e)}},{key:"hasVoidParent",value:function(e){return!!this.getClosestVoid(e)}},{key:"insertNode",value:function(e,t){var r=(e=this.resolvePath(e)).last(),n=Do.lift(e),o=this.assertNode(n),i=o.nodes.splice(r,0,t);return o=o.set("nodes",i),this.replaceNode(n,o)}},{key:"insertText",value:function(e,t,r,n){var o=this.assertDescendant(e);return e=this.resolvePath(e),o=o.insertText(t,r,n),this.replaceNode(e,o)}},{key:"isLeafBlock",value:function(){return"block"===this.object&&this.nodes.every((function(e){return"block"!==e.object}))}},{key:"isLeafInline",value:function(){return"inline"===this.object&&this.nodes.every((function(e){return"inline"!==e.object}))}},{key:"mapChildren",value:function(e){var t=this,r=this.nodes;return r.forEach((function(n,o){var i=e(n,o,t.nodes);i!==n&&(r=r.set(i.key,i))})),this.set("nodes",r)}},{key:"mapDescendants",value:function(e){var t=this,r=this.nodes;return r.forEach((function(n,o){var i=n;"text"!==i.object&&(i=i.mapDescendants(e)),(i=e(i,o,t.nodes))!==n&&(r=r.set(o,i))})),this.set("nodes",r)}},{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 r=Do.decrement(e),n=this.assertNode(r);if(n.object!==t.object)throw new Error("Unable to merge two different kinds of nodes: "+n+" and "+t);var o="text"===n.object?n.mergeText(t):n.set("nodes",n.nodes.concat(t.nodes)),i=this;return i=(i=(i=i.removeNode(e)).removeNode(r)).insertNode(r,o)}},{key:"moveNode",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=this.assertNode(e);e=this.resolvePath(e),t=this.resolvePath(t,r);var o=Do.lift(t);this.assertNode(o);var i=Do.crop(e,t),a=wo(i,2),s=a[0],u=a[1],c=Do.compare(s,u);e.size<t.size&&-1===c&&(t=Do.decrement(t,1,s.size-1));var l=this;return l=(l=l.removeNode(e)).insertNode(t,n)}},{key:"refindNode",value:function(e,t){var r=this.getDescendant(e);return r&&r.key===t?r:this.getDescendant(t)}},{key:"refindPath",value:function(e,t){var r=this.getDescendant(e);return r&&r.key===t?e:this.getPath(t)}},{key:"regenerateKey",value:function(){var e=vo.create();return this.set("key",e)}},{key:"removeMark",value:function(e,t,r,n){var o=this.assertDescendant(e);return e=this.resolvePath(e),o=o.removeMark(t,r,n),this.replaceNode(e,o)}},{key:"removeNode",value:function(e){this.assertDescendant(e);var t=(e=this.resolvePath(e)).flatMap((function(e){return Ir(["nodes",e])}));return this.deleteIn(t)}},{key:"removeText",value:function(e,t,r){var n=this.assertDescendant(e);return n=n.removeText(t,r.length),this.replaceNode(e,n)}},{key:"replaceNode",value:function(e,t){if(!(e=this.resolvePath(e)))throw new Error("Unable to replace a node because it could not be found in the first place: "+e);if(!e.size)return t;this.assertNode(e);var r=e.flatMap((function(e){return Ir(["nodes",e])}));return this.setIn(r,t)}},{key:"resolvePath",value:function(e,t){return"string"==typeof e?(e=this.getPath(e),null!=t&&(e=e.concat(t))):e=Do.create(e),e}},{key:"setNode",value:function(e,t){var r=this.assertNode(e);return r=r.merge(t),this.replaceNode(e,r)}},{key:"setMark",value:function(e,t,r,n,o){var i=this.assertNode(e);return i=i.updateMark(t,r,n,o),this.replaceNode(e,i)}},{key:"splitNode",value:function(e,t,r){var n=this.assertNode(e);e=this.resolvePath(e);var o=void 0,i=void 0;if("text"===n.object){var a=n.splitText(t),s=wo(a,2);o=s[0],i=s[1]}else{var u=n.nodes.take(t),c=n.nodes.skip(t);o=n.set("nodes",u),i=n.set("nodes",c).regenerateKey()}r&&"text"!==n.object&&(i=i.merge(r));var l=this;return l=(l=(l=l.removeNode(e)).insertNode(e,i)).insertNode(e,o)}},{key:"normalize",value:function(e){return e.normalizeNode(this)}},{key:"validate",value:function(e){return e.validateNode(this)}},{key:"getNodeAtPath",value:function(e){return ne.deprecate("0.35.0","The `Node.getNodeAtPath` method has been combined into `Node.getNode`."),this.getNode(e)}},{key:"getDescendantAtPath",value:function(e){return ne.deprecate("0.35.0","The `Node.getDescendantAtPath` has been combined into `Node.getDescendant`."),this.getDescendant(e)}},{key:"getKeys",value:function(){ne.deprecate("0.35.0","The `Node.getKeys` method is deprecated.");var e=this.getKeysAsArray();return new vn(e)}},{key:"getKeysAsArray",value:function(){ne.deprecate("0.35.0","The `Node.getKeysAsArray` method is deprecated.");var e=this.getKeysToPathsTable(),t=[];for(var r in e)this.key!==r&&t.push(r);return t}},{key:"areDescendantsSorted",value:function(e,t){var r=this;ne.deprecate("0.35.0","The `Node.areDescendantsSorted` method is deprecated. Use the new `PathUtils.compare` helper instead."),e=vo.create(e),t=vo.create(t);var n=this.getKeysAsArray().filter((function(e){return e!==r.key})),o=n.indexOf(e),i=n.indexOf(t);return-1==o||-1==i?null:o<i}},{key:"isInRange",value:function(e){ne.deprecate("0.35.0","The `Node.isInRange` method is deprecated. Use the new `PathUtils.compare` helper instead."),e=e.normalize(this);var t=this,r=e,n=r.startKey,o=r.endKey,i=r.isCollapsed;if(t.key==n||t.key==o||t.hasDescendant(n)||t.hasDescendant(o))return!0;if(i)return!1;var a=t.getTextsAtRange(e),s=!1;return a.forEach((function(e){return t.hasDescendant(e.key)&&(s=!0),s})),s}}],[{key:"create",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e.isNode(t))return t;if(A(t)){var r=t.object;switch(!r&&t.kind&&(ne.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),r=t.kind),r){case"block":return Oo.create(t);case"document":return zo.create(t);case"inline":return Ao.create(t);case"text":return Wo.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(Ir.isList(t)||Array.isArray(t)){var r=Ir(t.map(e.create));return r}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(Oo.isBlock(e)||Ao.isInline(e))return{data:e.data,isVoid:e.isVoid,type:e.type};if("string"==typeof e)return{type:e};if(A(e)){var t={};return"type"in e&&(t.type=e.type),"data"in e&&(t.data=So.create(e.data)),"isVoid"in e&&(t.isVoid=e.isVoid),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&&(ne.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),t=e.kind),t){case"block":return Oo.fromJSON(e);case"document":return zo.fromJSON(e);case"inline":return Ao.fromJSON(e);case"text":return Wo.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!!["BLOCK","DOCUMENT","INLINE","TEXT"].find((function(t){return lo(t,e)}))}},{key:"isNodeList",value:function(t){return Ir.isList(t)&&t.every((function(t){return e.isNode(t)}))}}]),e}();Ho.fromJS=Ho.fromJSON;var $o=function(e){Ho.prototype["assert"+e]=function(t){for(var r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];var i=this["get"+e].apply(this,[t].concat(n));if(null==i)throw new Error("`Node.assert"+e+"` could not find node with path or key: "+t);return i}},Yo=!0,Go=!1,Qo=void 0;try{for(var Xo,Zo=["Child","Depth","Descendant","Node","Parent","Path"][Symbol.iterator]();!(Yo=(Xo=Zo.next()).done);Yo=!0){$o(Xo.value)}}catch(e){Go=!0,Qo=e}finally{try{!Yo&&Zo.return&&Zo.return()}finally{if(Go)throw Qo}}To(Ho.prototype,["getBlocksAsArray","getBlocksAtRangeAsArray","getBlocksByTypeAsArray","getDecorations","getFirstInvalidDescendant","getFirstText","getFragmentAtRange","getInlinesAsArray","getInlinesAtRangeAsArray","getInlinesByTypeAsArray","getMarksAsArray","getMarksAtPosition","getOrderedMarksBetweenPositions","getInsertMarksAtRange","getKeysToPathsTable","getLastText","getMarksByTypeAsArray","getNextBlock","getOffset","getOffsetAtRange","getPreviousBlock","getText","getTextAtOffset","getTextDirection","getTextsAsArray","getTextsBetweenPositionsAsArray","isLeafBlock","isLeafInline","normalize","validate"]),Object.getOwnPropertyNames(Ho.prototype).forEach((function(e){"constructor"!==e&&(Oo.prototype[e]=Ho.prototype[e],Ao.prototype[e]=Ho.prototype[e],zo.prototype[e]=Ho.prototype[e])})),Oo.createChildren=Ho.createList,Ao.createChildren=Ho.createList,zo.createChildren=Ho.createList;var ei=/\s/,ti=/['\u2018\u2019]/,ri=/[\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 ni(e){return 55296<=e&&e<=57343}function oi(e,t){if(ei.test(e))return!1;if(ti.test(e)){var r=t.charAt(0),n=ii(r);if(oi(r=t.slice(0,n),t.slice(n)))return!0}return!ri.test(e)}function ii(e){return ni(e.charCodeAt(0))?2:1}function ai(e){return ii(e.charAt(0))}function si(e){for(var t=0,r=0,n=!1,o=void 0;o=e.charAt(r);){var i=ii(o);if(oi(o=e.slice(r,r+i),e.slice(r+i)))n=!0,t+=i;else{if(n)break;t+=i}r+=i}return t}var ui={getCharLength:ii,getCharOffset:ai,getCharOffsetBackward:function(e,t){return e=e.slice(0,t),ai(e=to.exports.reverse(e))},getCharOffsetForward:function(e,t){return ai(e=e.slice(t))},getWordOffset:si,getWordOffsetBackward:function(e,t){return e=e.slice(0,t),si(e=to.exports.reverse(e))},getWordOffsetForward:function(e,t){return si(e=e.slice(t))},isSurrogate:ni,isWord:oi},ci={addMarkAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!t.isCollapsed){var o=e.getFlag("normalize",n),i=e.value,a=i.document,s=t.startKey,u=t.startOffset,c=t.endKey,l=t.endOffset,f=a.getTextsAtRange(t);f.forEach((function(t){var n=t.key,i=0,a=t.text.length;n==s&&(i=u),n==c&&(a=l),n==s&&n==c&&(a=l-u),e.addMarkByKey(n,i,a,r,{normalize:o})}))}},addMarksAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};r.forEach((function(r){return e.addMarkAtRange(t,r,n)}))},deleteAtRange:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t.isCollapsed){e.snapshotSelection();var n=e.getFlag("normalize",r),o=e.value,i=t.startKey,a=t.startOffset,s=t.endKey,u=t.endOffset,c=o.document,l=c.hasVoidParent(i),f=c.hasVoidParent(s),h=c.getClosestBlock(i),d=c.getClosestBlock(s),p=0==a&&0==u&&0==l&&i==h.getFirstText().key&&s==d.getFirstText().key;if(p&&f){var v=c.getPreviousText(s);s=v.key,u=v.text.length,f=c.hasVoidParent(s)}for(;l;){var y=c.getClosestVoid(i),g=c.getNextText(i);if(e.removeNodeByKey(y.key,{normalize:!1}),i==s)return;if(!g)return;c=e.value.document,i=g.key,a=0,l=c.hasVoidParent(i)}for(;f;){var m=c.getClosestVoid(s),k=c.getPreviousText(s);e.removeNodeByKey(m.key,{normalize:!1}),c=e.value.document,s=k.key,u=k.text.length,f=c.hasVoidParent(s)}if(i==s&&p)e.removeNodeByKey(h.key,{normalize:n});else if(i!=s){h=c.getClosestBlock(i),d=c.getClosestBlock(s);var b=c.getNode(i),_=c.getNode(s),w=b.text.length-a,x=u,O=c.getCommonAncestor(i,s),A=O.getFurthestAncestor(i),S=O.getFurthestAncestor(s),E=c.getParent(h.key),N=E.nodes.indexOf(h),T=E.nodes.indexOf(d),j=void 0;for(j=b;j.key!=A.key;){var P=c.getParent(j.key),C=P.nodes.indexOf(j),B=P.nodes.slice(C+1);B.reverse().forEach((function(t){e.removeNodeByKey(t.key,{normalize:!1})})),j=P}var z=O.nodes.indexOf(A),R=O.nodes.indexOf(S),L=O.nodes.slice(z+1,R);for(L.reverse().forEach((function(t){e.removeNodeByKey(t.key,{normalize:!1})})),j=_;j.key!=S.key;){var K=c.getParent(j.key),F=K.nodes.indexOf(j),I=K.nodes.slice(0,F);I.reverse().forEach((function(t){e.removeNodeByKey(t.key,{normalize:!1})})),j=K}if(0!=w&&e.removeTextByKey(i,a,w,{normalize:!1}),0!=x&&e.removeTextByKey(s,0,u,{normalize:!1}),h.key!=d.key){var D=(c=e.value.document).getFurthestOnlyChildAncestor(d.key);T!=N+1&&e.moveNodeByKey(d.key,E.key,N+1,{normalize:!1}),p?e.removeNodeByKey(h.key,{normalize:!1}):e.mergeNodeByKey(d.key,{normalize:!1}),D&&e.removeNodeByKey(D.key,{normalize:!1})}n&&e.normalizeNodeByKey(O.key)}else{var M=a,J=u-a;e.removeTextByKey(i,M,J,{normalize:n})}}},deleteCharBackwardAtRange:function(e,t,r){var n=e.value.document,o=t.startKey,i=t.startOffset,a=n.getClosestBlock(o),s=a.getOffset(o)+i,u=a.text,c=ui.getCharOffsetBackward(u,s);e.deleteBackwardAtRange(t,c,r)},deleteLineBackwardAtRange:function(e,t,r){var n=e.value.document,o=t.startKey,i=t.startOffset,a=n.getClosestBlock(o).getOffset(o)+i;e.deleteBackwardAtRange(t,a,r)},deleteWordBackwardAtRange:function(e,t,r){var n=e.value.document,o=t.startKey,i=t.startOffset,a=n.getClosestBlock(o),s=a.getOffset(o)+i,u=a.text,c=ui.getWordOffsetBackward(u,s);e.deleteBackwardAtRange(t,c,r)},deleteBackwardAtRange:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(0!==r){var o=e.getFlag("normalize",n),i=e.value,a=i.document,s=t,u=s.startKey,c=s.focusOffset;if(t.isExpanded)e.deleteAtRange(t,{normalize:o});else{var l=a.getClosestVoid(u);if(l)e.removeNodeByKey(l.key,{normalize:o});else{var f=a.getClosestBlock(u);if(f&&f.isEmpty&&1!==a.nodes.size)e.removeNodeByKey(f.key,{normalize:o});else if(!t.isAtStartOf(a)){var h=a.getDescendant(u);if(t.isAtStartOf(h)){var d=a.getPreviousText(h.key),p=a.getClosestBlock(d.key),v=a.getClosestVoid(d.key);if(v)return void e.removeNodeByKey(v.key,{normalize:o});if(1==r&&p!=f)return t=t.merge({anchorKey:d.key,anchorOffset:d.text.length}),void e.deleteAtRange(t,{normalize:o})}if(r<c)return t=t.merge({focusOffset:c-r,isBackward:!0}),void e.deleteAtRange(t,{normalize:o});for(var y=h,g=0,m=c;r>m;){var k=m+(y=a.getPreviousText(y.key)).text.length;if(r<=k){g=k-r;break}m=k}t=t.merge({focusKey:y.key,focusOffset:g,isBackward:!0}),e.deleteAtRange(t,{normalize:o})}}}}},deleteCharForwardAtRange:function(e,t,r){var n=e.value.document,o=t.startKey,i=t.startOffset,a=n.getClosestBlock(o),s=a.getOffset(o)+i,u=a.text,c=ui.getCharOffsetForward(u,s);e.deleteForwardAtRange(t,c,r)},deleteLineForwardAtRange:function(e,t,r){var n=e.value.document,o=t.startKey,i=t.startOffset,a=n.getClosestBlock(o),s=a.getOffset(o)+i;e.deleteForwardAtRange(t,a.text.length-s,r)},deleteWordForwardAtRange:function(e,t,r){var n=e.value.document,o=t.startKey,i=t.startOffset,a=n.getClosestBlock(o),s=a.getOffset(o)+i,u=a.text,c=ui.getWordOffsetForward(u,s);e.deleteForwardAtRange(t,c,r)},deleteForwardAtRange:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(0!==r){var o=e.getFlag("normalize",n),i=e.value,a=i.document,s=t,u=s.startKey,c=s.focusOffset;if(t.isExpanded)e.deleteAtRange(t,{normalize:o});else{var l=a.getClosestVoid(u);if(l)e.removeNodeByKey(l.key,{normalize:o});else{var f=a.getClosestBlock(u);if(f&&f.isEmpty&&1!==a.nodes.size){var h=a.getNextBlock(f.key);return e.removeNodeByKey(f.key,{normalize:o}),void(h&&h.key&&e.moveToStartOf(h))}if(!t.isAtEndOf(a)){var d=a.getDescendant(u);if(t.isAtEndOf(d)){var p=a.getNextText(d.key),v=a.getClosestBlock(p.key),y=a.getClosestVoid(p.key);if(y)return void e.removeNodeByKey(y.key,{normalize:o});if(1==r&&v!=f)return t=t.merge({focusKey:p.key,focusOffset:0}),void e.deleteAtRange(t,{normalize:o})}if(r<=d.text.length-c)return t=t.merge({focusOffset:c+r}),void e.deleteAtRange(t,{normalize:o});for(var g=d,m=c,k=d.text.length-c;r>k;){var b=k+(g=a.getNextText(g.key)).text.length;if(r<=b){m=r-k;break}k=b}t=t.merge({focusKey:g.key,focusOffset:m}),e.deleteAtRange(t,{normalize:o})}}}}},insertBlockAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};r=Oo.create(r);var o=e.getFlag("normalize",n);t.isExpanded&&(e.deleteAtRange(t),t=t.collapseToStart());var i=e.value,a=i.document,s=t,u=s.startKey,c=s.startOffset,l=a.getClosestBlock(u),f=a.getClosestInline(u),h=a.getParent(l.key),d=h.nodes.indexOf(l);if(l.isVoid){var p=t.isAtEndOf(l)?1:0;e.insertNodeByKey(h.key,d+p,r,{normalize:o})}else if(l.isEmpty)e.insertNodeByKey(h.key,d+1,r,{normalize:o});else if(t.isAtStartOf(l))e.insertNodeByKey(h.key,d,r,{normalize:o});else if(t.isAtEndOf(l))e.insertNodeByKey(h.key,d+1,r,{normalize:o});else{if(f&&f.isVoid){var v=t.isAtEndOf(f),y=v?a.getNextText(u):a.getPreviousText(u),g=v?t.moveToStartOf(y):t.moveToEndOf(y);u=g.startKey,c=g.startOffset}e.splitDescendantsByKey(l.key,u,c,{normalize:!1}),e.insertNodeByKey(h.key,d+1,r,{normalize:o})}o&&e.normalizeNodeByKey(h.key)},insertFragmentAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e.getFlag("normalize",n);if(t.isExpanded&&(e.deleteAtRange(t,{normalize:!1}),t=e.value.document.getDescendant(t.startKey)?t.collapseToStart():t.collapseTo(t.endKey,0)),r.nodes.size){r=r.mapDescendants((function(e){return e.regenerateKey()}));var i=t,a=i.startKey,s=i.startOffset,u=e.value,c=u.document,l=c.getDescendant(a),f=c.getClosestBlock(l.key),h=f.getFurthestAncestor(l.key),d=t.isAtStartOf(f),p=c.getParent(f.key),v=p.nodes.indexOf(f),y=r.getBlocks(),g=r.nodes.first(),m=r.nodes.last(),k=y.first(),b=y.last();if(k==b&&k.isVoid)e.insertBlockAtRange(t,k,n);else if(g.hasBlockChildren()||m.hasBlockChildren())r.nodes.reverse().forEach((function(r){e.insertBlockAtRange(t,r,n)}));else{if(k!=b){var _=r.getFurthest(k.key,(function(e){return 1==e.nodes.size})),w=_||k,x=p.nodes.indexOf(f);(r=r.removeNode(w.key)).nodes.forEach((function(t,r){var n=x+r+1;e.insertNodeByKey(p.key,n,t,{normalize:!1})}))}if(0!=s&&e.splitDescendantsByKey(h.key,a,s,{normalize:!1}),l=(c=e.value.document).getDescendant(a),h=(f=c.getClosestBlock(a)).getFurthestAncestor(l.key),k!=b){var O=d?h:f.getNextSibling(h.key),A=O?f.nodes.skipUntil((function(e){return e.key==O.key})):Ir(),S=b.nodes.size;A.forEach((function(t,r){var n=S+r;e.moveNodeByKey(t.key,b.key,n,{normalize:!1})}))}if(f.isEmpty)e.removeNodeByKey(f.key,{normalize:!1}),e.insertNodeByKey(p.key,v,k,{normalize:!1});else{var E=f.getFurthestAncestor(l.key),N=f.nodes.indexOf(E);k.nodes.forEach((function(t,r){var n=N+r+(0==s?0:1);e.insertNodeByKey(f.key,n,t,{normalize:!1})}))}o&&e.normalizeNodeByKey(p.key)}}},insertInlineAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e.getFlag("normalize",n);r=Ao.create(r),t.isExpanded&&(e.deleteAtRange(t,{normalize:!1}),t=t.collapseToStart());var i=e.value,a=i.document,s=t,u=s.startKey,c=s.startOffset,l=a.getParent(u),f=a.assertDescendant(u),h=l.nodes.indexOf(f);l.isVoid||(e.splitNodeByKey(u,c,{normalize:!1}),e.insertNodeByKey(l.key,h+1,r,{normalize:!1}),o&&e.normalizeNodeByKey(l.key))},insertTextAtRange:function(e,t,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},i=o.normalize,a=e.value,s=a.document,u=t.startKey,c=t.startOffset,l=u,f=c,h=s.getParent(u);if(!h.isVoid&&(t.isExpanded&&(e.deleteAtRange(t,{normalize:!1}),e.value.startKey!==l&&(l=e.value.startKey,f=e.value.startOffset)),void 0===i&&(i=t.isExpanded&&n&&0!==n.size),e.insertTextByKey(l,f,r,n,{normalize:!1}),i)){var d=s.getCommonAncestor(u,t.endKey),p=s.getAncestors(d.key).push(d),v=p.findLast((function(t){return e.value.document.getDescendant(t.key)})),y=v?v.key:u;e.normalizeNodeByKey(y)}},removeMarkAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!t.isCollapsed){var o=e.getFlag("normalize",n),i=e.value,a=i.document,s=a.getTextsAtRange(t),u=t.startKey,c=t.startOffset,l=t.endKey,f=t.endOffset;s.forEach((function(t){var n=t.key,i=0,a=t.text.length;n==u&&(i=c),n==l&&(a=f),n==u&&n==l&&(a=f-c),e.removeMarkByKey(n,i,a,r,{normalize:o})}))}},setBlocksAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e.getFlag("normalize",n),i=e.value,a=i.document,s=a.getBlocksAtRange(t),u=t.startKey,c=t.startOffset,l=t.endKey,f=t.endOffset,h=t.isCollapsed,d=a.hasVoidParent(u),p=a.getClosestBlock(u),v=a.getClosestBlock(l),y=0==h&&0==c&&0==f&&0==d&&u==p.getFirstText().key&&l==v.getFirstText().key,g=y?s.slice(0,-1):s;g.forEach((function(t){e.setNodeByKey(t.key,r,{normalize:o})}))},setBlockAtRange:function(){ne.deprecate("slate@0.33.0","The `setBlockAtRange` method of Slate changes has been renamed to `setBlocksAtRange`."),ci.setBlocksAtRange.apply(ci,arguments)},setInlinesAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e.getFlag("normalize",n),i=e.value,a=i.document,s=a.getInlinesAtRange(t);s.forEach((function(t){e.setNodeByKey(t.key,r,{normalize:o})}))},setInlineAtRange:function(){ne.deprecate("slate@0.33.0","The `setInlineAtRange` method of Slate changes has been renamed to `setInlinesAtRange`."),ci.setInlinesAtRange.apply(ci,arguments)},splitBlockAtRange:function(e,t){for(var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e.getFlag("normalize",n),i=t,a=i.startKey,s=i.startOffset,u=i.endOffset,c=i.endKey,l=e.value,f=l.document,h=f.assertDescendant(a),d=f.getClosestBlock(h.key),p=0;d&&"block"==d.object&&p<r;)h=d,d=f.getClosestBlock(d.key),p++;if(e.splitDescendantsByKey(h.key,a,s,{normalize:o&&t.isCollapsed}),t.isExpanded){t.isBackward&&(t=t.flip());var v=e.value.document.getNextBlock(h.key);t=t.moveAnchorToStartOf(v),a===c&&(t=t.moveFocusTo(t.anchorKey,u-s)),e.deleteAtRange(t,{normalize:o})}},splitInlineAtRange:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1/0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e.getFlag("normalize",n);t.isExpanded&&(e.deleteAtRange(t,{normalize:o}),t=t.collapseToStart());for(var i=t,a=i.startKey,s=i.startOffset,u=e.value,c=u.document,l=c.assertDescendant(a),f=c.getClosestInline(l.key),h=0;f&&"inline"==f.object&&h<r;)l=f,f=c.getClosestInline(f.key),h++;e.splitDescendantsByKey(l.key,a,s,{normalize:o})},toggleMarkAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!t.isCollapsed){r=Co.create(r);var o=e.getFlag("normalize",n),i=e.value,a=i.document,s=a.getActiveMarksAtRange(t),u=s.some((function(e){return e.equals(r)}));u?e.removeMarkAtRange(t,r,{normalize:o}):e.addMarkAtRange(t,r,{normalize:o})}},unwrapBlockAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};r=Ho.createProperties(r);var o=e.getFlag("normalize",n),i=e.value,a=i.document,s=a.getBlocksAtRange(t),u=s.map((function(e){return a.getClosest(e.key,(function(e){return"block"==e.object&&((null==r.type||e.type==r.type)&&((null==r.isVoid||e.isVoid==r.isVoid)&&!(null!=r.data&&!e.data.isSuperset(r.data))))}))})).filter((function(e){return e})).toOrderedSet().toList();u.forEach((function(t){var r=t.nodes.first(),n=t.nodes.last(),o=a.getParent(t.key),i=o.nodes.indexOf(t),u=t.nodes.filter((function(e){return s.some((function(t){return e==t||e.hasDescendant(t.key)}))})),c=u.first(),l=u.last();if(r==c&&n==l)t.nodes.forEach((function(t,r){e.moveNodeByKey(t.key,o.key,i+r,{normalize:!1})})),e.removeNodeByKey(t.key,{normalize:!1});else if(n==l)t.nodes.skipUntil((function(e){return e==c})).forEach((function(t,r){e.moveNodeByKey(t.key,o.key,i+1+r,{normalize:!1})}));else if(r==c)t.nodes.takeUntil((function(e){return e==l})).push(l).forEach((function(t,r){e.moveNodeByKey(t.key,o.key,i+r,{normalize:!1})}));else{var f=c.getFirstText();e.splitDescendantsByKey(t.key,f.key,0,{normalize:!1}),a=e.value.document,u.forEach((function(t,r){if(0==r){var n=t;t=a.getNextBlock(t.key),e.removeNodeByKey(n.key,{normalize:!1})}e.moveNodeByKey(t.key,o.key,i+1+r,{normalize:!1})}))}})),o&&e.normalizeDocument()},unwrapInlineAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};r=Ho.createProperties(r);var o=e.getFlag("normalize",n),i=e.value,a=i.document,s=a.getTextsAtRange(t),u=s.map((function(e){return a.getClosest(e.key,(function(e){return"inline"==e.object&&((null==r.type||e.type==r.type)&&((null==r.isVoid||e.isVoid==r.isVoid)&&!(null!=r.data&&!e.data.isSuperset(r.data))))}))})).filter((function(e){return e})).toOrderedSet().toList();u.forEach((function(t){var r=e.value.document.getParent(t.key),n=r.nodes.indexOf(t);t.nodes.forEach((function(t,o){e.moveNodeByKey(t.key,r.key,n+o,{normalize:!1})}))})),o&&e.normalizeDocument()},wrapBlockAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};r=(r=Oo.create(r)).set("nodes",r.nodes.clear());var o=e.getFlag("normalize",n),i=e.value,a=i.document,s=a.getBlocksAtRange(t),u=s.first(),c=s.last(),l=void 0,f=void 0,h=void 0;if(1===s.length?(l=a.getParent(u.key),f=s):l=a.getClosest(u.key,(function(e){return!!a.getClosest(c.key,(function(t){return e==t}))})),null==l&&(l=a),null==f){var d=l.nodes.reduce((function(e,t,r){return(t==u||t.hasDescendant(u.key))&&(e[0]=r),(t==c||t.hasDescendant(c.key))&&(e[1]=r),e}),[]);h=d[0],f=l.nodes.slice(d[0],d[1]+1)}null==h&&(h=l.nodes.indexOf(f.first())),e.insertNodeByKey(l.key,h,r,{normalize:!1}),f.forEach((function(t,n){e.moveNodeByKey(t.key,r.key,n,{normalize:!1})})),o&&e.normalizeNodeByKey(l.key)},wrapInlineAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e.value,i=o.document,a=e.getFlag("normalize",n),s=t.startKey,u=t.startOffset,c=t.endKey,l=t.endOffset;if(t.isCollapsed){var f=i.getClosestInline(s);if(!f.isVoid)return;return e.wrapInlineByKey(f.key,r,n)}r=(r=Ao.create(r)).set("nodes",r.nodes.clear());var h=i.getBlocksAtRange(t),d=i.getClosestBlock(s),p=i.getClosestBlock(c),v=i.getClosestInline(s),y=i.getClosestInline(c),g=d.getFurthestAncestor(s),m=p.getFurthestAncestor(c);v&&v==y||(e.splitDescendantsByKey(m.key,c,l,{normalize:!1}),e.splitDescendantsByKey(g.key,s,u,{normalize:!1})),d=(i=e.value.document).getDescendant(d.key),p=i.getDescendant(p.key),g=d.getFurthestAncestor(s),m=p.getFurthestAncestor(c);var k=d.nodes.indexOf(g),b=p.nodes.indexOf(m);if(v&&v==y){var _=d.getTextsAtRange(t).get(0).splitText(u)[1].splitText(l-u)[0];r=r.set("nodes",Ir([_])),ci.insertInlineAtRange(e,t,r,{normalize:!1});var w=r.getFirstText().key,x={anchorKey:w,focusKey:w,anchorOffset:0,focusOffset:l-u,isFocused:!0};e.select(x)}else if(d==p){g=(d=(i=e.value.document).getClosestBlock(s)).getFurthestAncestor(s);var O=i.getNextSibling(g.key),A=d.nodes.indexOf(O),S=s==c?O:d.getFurthestAncestor(c),E=d.nodes.skipUntil((function(e){return e==O})).takeUntil((function(e){return e==S})).push(S),N=r.regenerateKey();e.insertNodeByKey(d.key,A,N,{normalize:!1}),E.forEach((function(t,r){e.moveNodeByKey(t.key,N.key,r,{normalize:!1})})),a&&e.normalizeNodeByKey(d.key)}else{var T=d.nodes.slice(k+1),j=p.nodes.slice(0,b+1),P=r.regenerateKey(),C=r.regenerateKey();e.insertNodeByKey(d.key,k+1,P,{normalize:!1}),e.insertNodeByKey(p.key,b,C,{normalize:!1}),T.forEach((function(t,r){e.moveNodeByKey(t.key,P.key,r,{normalize:!1})})),j.forEach((function(t,r){e.moveNodeByKey(t.key,C.key,r,{normalize:!1})})),a&&e.normalizeNodeByKey(d.key).normalizeNodeByKey(p.key),h.slice(1,-1).forEach((function(t){var n=r.regenerateKey();e.insertNodeByKey(t.key,0,n,{normalize:!1}),t.nodes.forEach((function(t,r){e.moveNodeByKey(t.key,n.key,r,{normalize:!1})})),a&&e.normalizeNodeByKey(t.key)}))}},wrapTextAtRange:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:r,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},i=e.getFlag("normalize",o),a=t.startKey,s=t.endKey,u=t.collapseToStart(),c=t.collapseToEnd();a==s&&(c=c.move(r.length)),e.insertTextAtRange(u,r,[],{normalize:i}),e.insertTextAtRange(c,n,[],{normalize:i})}},li={addMarkByPath:function(e,t,r,n,o,i){o=Co.create(o);var a=e.value,s=a.document.assertNode(t).getLeaves(),u=[],c=r,l=r+n,f=0;s.forEach((function(e){var r=f,n=r+e.text.length;if(f+=e.text.length,!(n<c||l<r||e.marks.has(o))){var i=Math.max(r,c),s=Math.min(n,l);u.push({type:"add_mark",value:a,path:t,offset:i,length:s-i,mark:o})}})),e.applyOperations(u),e.normalizeParentByPath(t,i)},insertFragmentByPath:function(e,t,r,n,o){n.nodes.forEach((function(n,o){e.insertNodeByPath(t,r+o,n)})),e.normalizeNodeByPath(t,o)},insertNodeByPath:function(e,t,r,n,o){var i=e.value;e.applyOperation({type:"insert_node",value:i,path:t.concat(r),node:n}),e.normalizeNodeByPath(t,o)},insertTextByPath:function(e,t,r,n,o,i){var a=e.value,s=a.document.assertNode(t);o=o||s.getMarksAtIndex(r),e.applyOperation({type:"insert_text",value:a,path:t,offset:r,text:n,marks:o}),e.normalizeParentByPath(t,i)},mergeNodeByPath:function(e,t,r){var n=e.value,o=n.document,i=o.getDescendant(t),a=o.getPreviousSibling(t);if(!a)throw new Error('Unable to merge node with path "'+t+'", because it has no previous sibling.');var s="text"==a.object?a.text.length:a.nodes.size;e.applyOperation({type:"merge_node",value:n,path:t,position:s,properties:{type:i.type,data:i.data},target:null}),e.normalizeParentByPath(t,r)},moveNodeByPath:function(e,t,r,n,o){var i=e.value;e.applyOperation({type:"move_node",value:i,path:t,newPath:r.concat(n)});var a=Do.relate(t,r);e.normalizeNodeByPath(a,o)},removeMarkByPath:function(e,t,r,n,o,i){o=Co.create(o);var a=e.value,s=a.document.assertNode(t).getLeaves(),u=[],c=r,l=r+n,f=0;s.forEach((function(e){var r=f,n=r+e.text.length;if(f+=e.text.length,!(n<c||l<r)&&e.marks.has(o)){var i=Math.max(r,c),s=Math.min(n,l);u.push({type:"remove_mark",value:a,path:t,offset:i,length:s-i,mark:o})}})),e.applyOperations(u),e.normalizeParentByPath(t,i)},removeAllMarksByPath:function(e,t,r){var n=e.state.document.assertNode(t);("text"===n.object?[n]:n.getTextsAsArray()).forEach((function(t){t.getMarksAsArray().forEach((function(n){e.removeMarkByKey(t.key,0,t.text.length,n,r)}))}))},removeNodeByPath:function(e,t,r){var n=e.value,o=n.document.assertNode(t);e.applyOperation({type:"remove_node",value:n,path:t,node:o}),e.normalizeParentByPath(t,r)},setTextByPath:function(e,t,r,n,o){var i=e.value.document.assertNode(t).text.length;e.replaceTextByPath(t,0,i,r,n,o)},replaceTextByPath:function(e,t,r,n,o,i,a){var s=e.value.document,u=s.assertNode(t);n+r>u.text.length&&(n=u.text.length-r);var c=Mo.create({anchorPath:t,focusPath:t,anchorOffset:r,focusOffset:r+n}).normalize(s),l=s.getActiveMarksAtRange(c);e.removeTextByPath(t,r,n,{normalize:!1}),i?l&&(l=l.filter((function(e){return!i.find((function(t){return e.type===t.type}))})),i=l.merge(i)):i=l||[],e.insertTextByPath(t,r,o,i,a)},removeTextByPath:function(e,t,r,n,o){var i=e.value,a=i.document,s=a.assertNode(t),u=s.getLeaves(),c=s.text,l=[],f=r,h=r+n,d=0;u.forEach((function(e){var r=d,n=r+e.text.length;if(d+=e.text.length,!(n<f||h<r)){var o=Math.max(r,f),a=Math.min(n,h),s=c.slice(o,a);l.push({type:"remove_text",value:i,path:t,offset:o,text:s,marks:e.marks})}})),e.applyOperations(l.reverse());var p=a.getClosestBlock(s.key);e.normalizeNodeByKey(p.key,o)},replaceNodeByPath:function(e,t,r,n){r=Ho.create(r);var o=t.last(),i=Do.lift(t);e.removeNodeByPath(t,{normalize:!1}),e.insertNodeByPath(i,o,r,{normalize:!1}),e.normalizeParentByPath(t,n)},setMarkByPath:function(e,t,r,n,o,i,a){o=Co.create(o),i=Co.createProperties(i);var s=e.value;e.applyOperation({type:"set_mark",value:s,path:t,offset:r,length:n,mark:o,properties:i}),e.normalizeParentByPath(t,a)},setNodeByPath:function(e,t,r,n){r=Ho.createProperties(r);var o=e.value,i=o.document.assertNode(t);e.applyOperation({type:"set_node",value:o,path:t,node:i,properties:r}),e.normalizeNodeByPath(t,n)},splitNodeByPath:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=n.target,i=void 0===o?null:o,a=e.value,s=a.document,u=s.getDescendant(t);e.applyOperation({type:"split_node",value:a,path:t,position:r,properties:{type:u.type,data:u.data},target:i}),e.normalizeParentByPath(t,n)},splitDescendantsByPath:function(e,t,r,n,o){if(t.equals(r))e.splitNodeByPath(r,n,o);else{var i=e.value.document,a=i.assertNode(t),s=i.assertNode(r),u=i.getAncestors(r).skipUntil((function(e){return e.key==a.key})).reverse().unshift(s),c=void 0,l=void 0;u.forEach((function(t){var r=null==l?null:l;l=c?t.nodes.indexOf(c)+1:n,c=t,e.splitNodeByKey(t.key,l,{normalize:!1,target:r})})),e.normalizeParentByPath(t,o)}},unwrapInlineByPath:function(e,t,r,n){var o=e.value,i=o.document,a=o.selection,s=i.assertNode(t),u=s.getFirstText(),c=s.getLastText(),l=a.moveToRangeOf(u,c);e.unwrapInlineAtRange(l,r,n)},unwrapBlockByPath:function(e,t,r,n){var o=e.value,i=o.document,a=o.selection,s=i.assertNode(t),u=s.getFirstText(),c=s.getLastText(),l=a.moveToRangeOf(u,c);e.unwrapBlockAtRange(l,r,n)},unwrapNodeByPath:function(e,t,r){var n=e.value.document;n.assertNode(t);var o=Do.lift(t),i=n.assertNode(o),a=t.last(),s=o.last(),u=Do.lift(o),c=0===a,l=a===i.nodes.size-1;if(1===i.nodes.size)e.moveNodeByPath(t,u,s+1,{normalize:!1}),e.removeNodeByPath(o,r);else if(c)e.moveNodeByPath(t,u,s,r);else if(l)e.moveNodeByPath(t,u,s+1,r);else{e.splitNodeByPath(o,a,{normalize:!1});var f=Do.increment(t,1,o.size-1);f=f.set(f.size-1,0),e.moveNodeByPath(f,u,s+1,{normalize:!1}),e.normalizeNodeByPath(u,r)}},wrapBlockByPath:function(e,t,r,n){r=(r=Oo.create(r)).set("nodes",r.nodes.clear());var o=Do.lift(t),i=t.last(),a=Do.increment(t);e.insertNodeByPath(o,i,r,{normalize:!1}),e.moveNodeByPath(a,t,0,n)},wrapInlineByPath:function(e,t,r,n){r=(r=Ao.create(r)).set("nodes",r.nodes.clear());var o=Do.lift(t),i=t.last(),a=Do.increment(t);e.insertNodeByPath(o,i,r,{normalize:!1}),e.moveNodeByPath(a,t,0,n)},wrapNodeByPath:function(e,t,r){"block"!=(r=Ho.create(r)).object?"inline"!=r.object||e.wrapInlineByPath(t,r):e.wrapBlockByPath(t,r)}},fi=function(e){li[e+"ByKey"]=function(t,r){for(var n=arguments.length,o=Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];var a=t.value,s=a.document,u=s.assertPath(r);t[e+"ByPath"].apply(t,[u].concat(o))}},hi=!0,di=!1,pi=void 0;try{for(var vi,yi=["addMark","insertFragment","insertNode","insertText","mergeNode","removeMark","removeAllMarks","removeNode","setText","replaceText","removeText","replaceNode","setMark","setNode","splitNode","unwrapInline","unwrapBlock","unwrapNode","wrapBlock","wrapInline","wrapNode"][Symbol.iterator]();!(hi=(vi=yi.next()).done);hi=!0){fi(vi.value)}}catch(e){di=!0,pi=e}finally{try{!hi&&yi.return&&yi.return()}finally{if(di)throw pi}}li.moveNodeByKey=function(e,t,r){for(var n=arguments.length,o=Array(n>3?n-3:0),i=3;i<n;i++)o[i-3]=arguments[i];var a=e.value,s=a.document,u=s.assertPath(t),c=s.assertPath(r);e.moveNodeByPath.apply(e,[u,c].concat(o))},li.splitDescendantsByKey=function(e,t,r){for(var n=arguments.length,o=Array(n>3?n-3:0),i=3;i<n;i++)o[i-3]=arguments[i];var a=e.value,s=a.document,u=s.assertPath(t),c=s.assertPath(r);e.splitDescendantsByPath.apply(e,[u,c].concat(o))};var gi=io("slate:history"),mi=function(e){function t(){return go(this,t),_o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return bo(t,e),mo(t,[{key:"save",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this,n=r,o=n.undos,i=n.redos,a=t.merge,s=t.skip,u=o.peek(),c=u&&u.last();if(null==s&&(s=bi(e,c)),s)return r;if(null==a&&(a=ki(e,c)),gi("save",{operation:e,merge:a}),a&&u){var l=u.push(e);o=(o=o.pop()).push(l)}else{var f=new Ir([e]);o=o.push(f)}return o.size>100&&(o=o.take(100)),i=i.clear(),r=r.set("undos",o).set("redos",i)}},{key:"toJSON",value:function(){return{object:this.object,redos:this.redos.toJSON(),undos:this.undos.toJSON()}}},{key:"toJS",value:function(){return this.toJSON()}},{key:"object",get:function(){return"history"}},{key:"kind",get:function(){return ne.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isHistory(e))return e;if(A(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(Ir.isList(e))return e;if(Array.isArray(e))return new Ir(e);throw new Error("`History.createList` only accepts arrays or lists, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var r=e.redos,n=void 0===r?[]:r,o=e.undos,i=void 0===o?[]:o;return new t({redos:new on(n.map(this.createOperationsList)),undos:new on(i.map(this.createOperationsList))})}}]),t}(Un({redos:new on,undos:new on}));function ki(e,t){return!!t&&("set_selection"==e.type&&"set_selection"==t.type||"insert_text"==e.type&&"insert_text"==t.type&&e.offset==t.offset+t.text.length&&ao(e.path,t.path)||"remove_text"==e.type&&"remove_text"==t.type&&e.offset+e.text.length==t.offset&&ao(e.path,t.path))}function bi(e,t){return!!t&&("set_selection"==e.type&&"set_selection"==t.type)}mi.fromJS=mi.fromJSON,mi.isHistory=lo.bind(null,"HISTORY"),mi.prototype[co.HISTORY]=!0;var _i=function(e){function t(){return go(this,t),_o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return bo(t,e),mo(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),r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];var i=!0,a=!1,s=void 0;try{for(var u,c=t[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var l=u.value,f=l[e].apply(l,n);if(null!=f)return f}}catch(e){a=!0,s=e}finally{try{!i&&c.return&&c.return()}finally{if(a)throw s}}}},{key:"map",value:function(e){for(var t=this.getPluginsWith(e),r=[],n=arguments.length,o=Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];var a=!0,s=!1,u=void 0;try{for(var c,l=t[Symbol.iterator]();!(a=(c=l.next()).done);a=!0){var f=c.value,h=f[e].apply(f,o);null!=h&&r.push(h)}}catch(e){s=!0,u=e}finally{try{!a&&l.return&&l.return()}finally{if(s)throw u}}return r}},{key:"run",value:function(e){for(var t=this.getPluginsWith(e),r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];var i=!0,a=!1,s=void 0;try{for(var u,c=t[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var l=u.value,f=l[e].apply(l,n);if(null!=f)return}}catch(e){a=!0,s=e}finally{try{!i&&c.return&&c.return()}finally{if(a)throw s}}}},{key:"render",value:function(e,t){for(var r=arguments.length,n=Array(r>2?r-2:0),o=2;o<r;o++)n[o-2]=arguments[o];var i=this.getPluginsWith(e);return i.reduceRight((function(r,o){if(!o[e])return r;var i=o[e].apply(o,[t].concat(n));return null==i?r:(t.children=i,i)}),void 0===t.children?null:t.children)}},{key:"object",get:function(){return"stack"}},{key:"kind",get:function(){return ne.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.plugins,n=void 0===r?[]:r,o=new t({plugins:n});return o}},{key:"isStack",value:function(e){return!(!e||!e[co.STACK])}}]),t}(Un({plugins:[]}));_i.prototype[co.STACK]=!0,To(_i.prototype,["getPluginsWith"]);var wi=function(e){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};go(this,t);var n=_o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));for(var o in n.code=e,r)n[o]=r[o];return Error.captureStackTrace?Error.captureStackTrace(n,n.constructor):n.stack=(new Error).stack,n}return bo(t,e),t}(Error),xi=io("slate:schema"),Oi=[{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 r=t.code,n=t.node;"child_required"===r&&e.insertNodeByKey(n.key,0,Wo.create(),{normalize:!1})}},{match:{object:"inline",isVoid:!1,nodes:[{match:{object:"text"}}]},text:/[\w\W]+/},{match:{object:"block"},first:[{object:"block"},{object:"text"}],last:[{object:"block"},{object:"text"}],normalize:function(e,t){var r=t.code,n=t.node,o=Wo.create(),i=void 0;if("first_child_object_invalid"===r)i=0;else{if("last_child_object_invalid"!==r)return;i=n.nodes.size}e.insertNodeByKey(n.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 r=t.code,n=t.node,o=t.index,i=Wo.create(),a=void 0;if("first_child_object_invalid"===r)a=0;else if("last_child_object_invalid"===r)a=n.nodes.size;else if("previous_sibling_object_invalid"===r)a=o;else{if("next_sibling_object_invalid"!==r)return;a=o+1}e.insertNodeByKey(n.key,a,i,{normalize:!1})}},{match:{object:"text"},next:[{object:"block"},{object:"inline"}],normalize:function(e,t){var r=t.code,n=t.next;"next_sibling_object_invalid"===r&&e.mergeNodeByKey(n.key,{normalize:!1})}}],Ai=function(e){function t(){return go(this,t),_o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return bo(t,e),mo(t,[{key:"validateNode",value:function(e){var t=this.rules.filter((function(t){return Si(e,t.match)})),r=Ei(e,t,this.rules,{every:!0});if(r)return new wi(r.code,r)}},{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 r=this.validateNode(e);if(r)return function(e){xi("normalizing",{error:r});var t=r.rule,n=e.operations.size;t.normalize&&t.normalize(e,r),e.operations.size===n&&function(e,t){switch(t.code){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":var r=t.child,n=t.node;return"text"==r.object&&"block"==n.object&&1==n.nodes.size?e.removeNodeByKey(n.key):e.removeNodeByKey(r.key);case"child_required":case"node_text_invalid":case"parent_object_invalid":case"parent_type_invalid":var o=t.node;return"document"==o.object?o.nodes.forEach((function(t){return e.removeNodeByKey(t.key)})):e.removeNodeByKey(o.key);case"node_data_invalid":var i=t.node,a=t.key;return void 0===i.data.get(a)&&"document"!=i.object?e.removeNodeByKey(i.key):e.setNodeByKey(i.key,{data:i.data.delete(a)});case"node_is_void_invalid":var s=t.node;return e.setNodeByKey(s.key,{isVoid:!s.isVoid});case"node_mark_invalid":var u=t.node,c=t.mark;return u.getTexts().forEach((function(t){return e.removeMarkByKey(t.key,0,t.text.length,c)}));default:var l=t.node;e.removeNodeByKey(l.key)}}(e,r)}}}},{key:"toJSON",value:function(){return{object:this.object,rules:this.rules}}},{key:"toJS",value:function(){return this.toJSON()}},{key:"object",get:function(){return"schema"}},{key:"kind",get:function(){return ne.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isSchema(e))return e;if(A(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 r=e.plugins?e.plugins:[{schema:e}],n=[].concat(Oi),o=!0,i=!1,a=void 0;try{for(var s,u=r[Symbol.iterator]();!(o=(s=u.next()).done);o=!0){var c=s.value.schema,l=void 0===c?{}:c,f=l.blocks,h=void 0===f?{}:f,d=l.inlines,p=void 0===d?{}:d;for(var v in l.rules&&(n=n.concat(l.rules)),l.document&&n.push(ko({match:[{object:"document"}]},l.document)),h)n.push(ko({match:[{object:"block",type:v}]},h[v]));for(var y in p)n.push(ko({match:[{object:"inline",type:y}]},p[y]))}}catch(e){i=!0,a=e}finally{try{!o&&u.return&&u.return()}finally{if(i)throw a}}return new t({stack:_i.create({plugins:r}),rules:n})}},{key:"isSchema",value:function(e){return!(!e||!e[co.SCHEMA])}}]),t}(Un({stack:_i.create(),rules:[]}));function Si(e,t){return!Ei(e,t)}function Ei(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=n.every,i=void 0!==o&&o;if(Array.isArray(t)){var a=t.length?t:[{}],s=void 0,u=!0,c=!1,l=void 0;try{for(var f,h=a[Symbol.iterator]();!(u=(f=h.next()).done);u=!0){var d=f.value,p=Ei(e,d,r);if(s=s||p,i&&p)return p;if(!i&&!p)return}}catch(e){c=!0,l=e}finally{try{!u&&h.return&&h.return()}finally{if(c)throw l}}return s}var v=Ni(e,t)||Ti(e,t)||ji(e,t)||Pi(e,t)||Ci(e,t)||Bi(e,t)||zi(e,t)||Ri(e,t)||Li(e,t,r);return v}function Ni(e,t){if(t.objects&&ne.warn("The `objects` schema validation rule was changed. Please use the new `match` syntax with `object`."),null!=t.object&&t.object!==e.object)return Di("node_object_invalid",{rule:t,node:e})}function Ti(e,t){if(t.types&&ne.warn("The `types` schema validation rule was changed. Please use the new `match` syntax with `type`."),null!=t.type&&t.type!==e.type)return Di("node_type_invalid",{rule:t,node:e})}function ji(e,t){if(null!=t.isVoid&&t.isVoid!==e.isVoid)return Di("node_is_void_invalid",{rule:t,node:e})}function Pi(e,t){if(null!=t.data&&null!=e.data)for(var r in t.data){var n=t.data[r],o=e.data&&e.data.get(r);if(!("function"==typeof n?n(o):n===o))return Di("node_data_invalid",{rule:t,node:e,key:r,value:o})}}function Ci(e,t){if(null!=t.marks){var r=e.getMarks().toArray(),n=function(r){return t.marks.some((function(e){return e.type===r.type}))?"continue":{v:Di("node_mark_invalid",{rule:t,node:e,mark:r})}},o=!0,i=!1,a=void 0;try{for(var s,u=r[Symbol.iterator]();!(o=(s=u.next()).done);o=!0){var c=n(s.value);if("continue"!==c&&"object"===(void 0===c?"undefined":yo(c)))return c.v}}catch(e){i=!0,a=e}finally{try{!o&&u.return&&u.return()}finally{if(i)throw a}}}}function Bi(e,t){if(null!=t.text){var r=e.text;if(!t.text.test(r))return Di("node_text_invalid",{rule:t,node:e,text:r})}}function zi(e,t){if(null!=t.first){var r=e.nodes.first();if(r){var n=Ei(r,t.first);if(n)return n.rule=t,n.node=e,n.child=r,n.code=n.code.replace("node_","first_child_"),n}}}function Ri(e,t){if(null!=t.last){var r=e.nodes.last();if(r){var n=Ei(r,t.last);if(n)return n.rule=t,n.node=e,n.child=r,n.code=n.code.replace("node_","last_child_"),n}}}function Li(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(null!=e.nodes){var n=e.nodes.toArray(),o=null!=t.nodes?t.nodes.slice():[],i=void 0,a=void 0,s=void 0,u=void 0,c=void 0,l=void 0,f=void 0,h=void 0;for(null!=t.nodes&&v();y();){var d=Ki(e,l,r)||Fi(e,l,f,s,r)||Ii(e,l,h,s,r);if(d)return d;if(null!=t.nodes){if(!u)return Di("child_unknown",{rule:t,node:e,child:l,index:s});if(u&&(u.objects&&ne.warn("The `objects` schema validation rule was changed. Please use the new `match` syntax with `object`."),u.types&&ne.warn("The `types` schema validation rule was changed. Please use the new `match` syntax with `type`.")),u.match){var p=Ei(l,u.match);if(p&&i>=a&&v()){g();continue}if(p)return p.rule=t,p.node=e,p.child=l,p.index=s,p.code=p.code.replace("node_","child_"),p}}}if(null!=t.nodes)for(;null!=a;){if(i<a)return Di("child_required",{rule:t,node:e,index:s});v()}}function v(){return i=null==i?null:0,u=o.shift(),a=u&&u.min,c=u&&u.max,!!u}function y(){return i=null==i?0:i+1,f=l,l=n[s=null==s?0:s+1],h=n[s+1],null!=c&&i==c&&v(),!!l}function g(){i-=1,s-=1}}function Ki(e,t,r){var n=!0,o=!1,i=void 0;try{for(var a,s=r[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var u=a.value;if(null!=u.parent&&Si(t,u.match)){var c=Ei(e,u.parent);if(c)return c.rule=u,c.parent=e,c.node=t,c.code=c.code.replace("node_","parent_"),c}}}catch(e){o=!0,i=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}}function Fi(e,t,r,n,o){if(r){var i=!0,a=!1,s=void 0;try{for(var u,c=o[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var l=u.value;if(null!=l.previous&&Si(t,l.match)){var f=Ei(r,l.previous);if(f)return f.rule=l,f.node=e,f.child=t,f.index=n,f.previous=r,f.code=f.code.replace("node_","previous_sibling_"),f}}}catch(e){a=!0,s=e}finally{try{!i&&c.return&&c.return()}finally{if(a)throw s}}}}function Ii(e,t,r,n,o){if(r){var i=!0,a=!1,s=void 0;try{for(var u,c=o[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var l=u.value;if(null!=l.next&&Si(t,l.match)){var f=Ei(r,l.next);if(f)return f.rule=l,f.node=e,f.child=t,f.index=n,f.next=r,f.code=f.code.replace("node_","next_sibling_"),f}}}catch(e){a=!0,s=e}finally{try{!i&&c.return&&c.return()}finally{if(a)throw s}}}}function Di(e,t){return ko({code:e},t)}Ai.fromJS=Ai.fromJSON,Ai.prototype[co.SCHEMA]=!0;var Mi=function(e){function t(){return go(this,t),_o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return bo(t,e),mo(t,[{key:"change",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new oa(ko({},e,{value:this}))}},{key:"addMark",value:function(e,t,r,n){var o=this,i=o.document;return i=i.addMark(e,t,r,n),o=this.set("document",i)}},{key:"insertNode",value:function(e,t){var r=this,n=r.document;return n=n.insertNode(e,t),r=(r=r.set("document",n)).mapRanges((function(e){return e.merge({anchorPath:null,focusPath:null})}))}},{key:"insertText",value:function(e,t,r,n){var o=this,i=o.document;i=i.insertText(e,t,r,n),o=o.set("document",i);var a=i.assertNode(e);return o=(o=(o=o.clearAtomicRanges(a.key,t)).mapRanges((function(e){var n=e.anchorKey,o=e.anchorOffset,i=e.isBackward,s=e.isAtomic;return n!==a.key||!(o>t)&&(o!==t||s&&i)?e:e.moveAnchor(r.length)}))).mapRanges((function(e){var n=e.focusKey,o=e.focusOffset,i=e.isBackward,s=e.isAtomic;return n===a.key&&(o>t||o==t&&(!s||i))?e.moveFocus(r.length):e}))}},{key:"mergeNode",value:function(e){var t=this,r=t.document,n=r.mergeNode(e);e=r.resolvePath(e);var o=Do.decrement(e),i=r.getNode(o),a=r.getNode(e);return t=(t=t.set("document",n)).mapRanges((function(e){if("text"===a.object){var t=i.text.length;e.anchorKey===a.key&&(e=e.moveAnchorTo(i.key,t+e.anchorOffset)),e.focusKey===a.key&&(e=e.moveFocusTo(i.key,t+e.focusOffset))}return e=e.merge({anchorPath:null,focusPath:null})})),t}},{key:"moveNode",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=this,o=n,i=o.document;return i=i.moveNode(e,t,r),n=(n=n.set("document",i)).mapRanges((function(e){return e.merge({anchorPath:null,focusPath:null})}))}},{key:"removeMark",value:function(e,t,r,n){var o=this,i=o.document;return i=i.removeMark(e,t,r,n),o=this.set("document",i)}},{key:"removeNode",value:function(e){var t=this,r=t.document,n=r.assertNode(e),o="text"==n.object?n:n.getFirstText()||n,i="text"==n.object?n:n.getLastText()||n,a=r.getPreviousText(o.key),s=r.getNextText(i.key);return r=r.removeNode(e),t=(t=t.set("document",r)).mapRanges((function(e){var t=e,r=t.startKey,o=t.endKey;return n.hasNode(r)&&(e=a?e.moveStartTo(a.key,a.text.length):s?e.moveStartTo(s.key,0):e.deselect()),n.hasNode(o)&&(e=a?e.moveEndTo(a.key,a.text.length):s?e.moveEndTo(s.key,0):e.deselect()),e=e.merge({anchorPath:null,focusPath:null})}))}},{key:"removeText",value:function(e,t,r){var n=this,o=n.document;o=o.removeText(e,t,r),n=n.set("document",o);var i=o.assertNode(e),a=r.length,s=t+a;return n=(n=(n=n.clearAtomicRanges(i.key,t,t+a)).mapRanges((function(e){return e.anchorKey===i.key?e.anchorOffset>=s?e.moveAnchor(-a):e.anchorOffset>t?e.moveAnchorTo(e.anchorKey,t):e:e}))).mapRanges((function(e){return e.focusKey===i.key?e.focusOffset>=s?e.moveFocus(-a):e.focusOffset>t?e.moveFocusTo(e.focusKey,t):e:e}))}},{key:"setNode",value:function(e,t){var r=this,n=r.document;return n=n.setNode(e,t),r=r.set("document",n)}},{key:"setMark",value:function(e,t,r,n,o){var i=this,a=i.document;return a=a.setMark(e,t,r,n,o),i=i.set("document",a)}},{key:"setSelection",value:function(e){var t=this,r=t,n=r.document,o=r.selection;return o=(o=o.merge(e)).normalize(n),t=t.set("selection",o)}},{key:"splitNode",value:function(e,t,r){var n=this,o=n.document,i=o.splitNode(e,t,r),a=o.assertNode(e);return n=(n=n.set("document",i)).mapRanges((function(e){var r=i.getNextText(a.key),n=e,o=n.startKey,s=n.startOffset,u=n.endKey,c=n.endOffset;return a.key===o&&t<=s&&(e=e.moveStartTo(r.key,s-t)),a.key===u&&t<=c&&(e=e.moveEndTo(r.key,c-t)),e=e.merge({anchorPath:null,focusPath:null})}))}},{key:"mapRanges",value:function(e){var t=this,r=t,n=r.document,o=r.selection,i=r.decorations;if(o){var a=o.isSet?e(o):o;a||(a=o.deselect()),a!==o&&(a=a.normalize(n)),t=t.set("selection",a)}if(i){var s=i.map((function(t){var r=t.isSet?e(t):t;return r&&r!==t&&(r=r.normalize(n)),r}));s=(s=s.filter((function(e){return!!e}))).size?s:null,t=t.set("decorations",s)}return t}},{key:"clearAtomicRanges",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return this.mapRanges((function(n){var o=n.isAtomic,i=n.startKey,a=n.startOffset,s=n.endKey,u=n.endOffset;return o?i!==e?n:a<t&&(s!==e||u>t)||null!=r&&a<r&&(s!==e||u>r)?null:n:n}))}},{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?this.decorations.toArray().map((function(t){return t.toJSON(e)})):null),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:"toJS",value:function(e){return this.toJSON(e)}},{key:"object",get:function(){return"value"}},{key:"kind",get:function(){return ne.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}},{key:"hasUndos",get:function(){return this.history.undos.size>0}},{key:"hasRedos",get:function(){return this.history.redos.size>0}},{key:"isBlurred",get:function(){return this.selection.isBlurred}},{key:"isFocused",get:function(){return this.selection.isFocused}},{key:"isCollapsed",get:function(){return this.selection.isCollapsed}},{key:"isExpanded",get:function(){return this.selection.isExpanded}},{key:"isBackward",get:function(){return this.selection.isBackward}},{key:"isForward",get:function(){return this.selection.isForward}},{key:"startKey",get:function(){return this.selection.startKey}},{key:"endKey",get:function(){return this.selection.endKey}},{key:"startPath",get:function(){return this.selection.startPath}},{key:"endPath",get:function(){return this.selection.endPath}},{key:"startOffset",get:function(){return this.selection.startOffset}},{key:"endOffset",get:function(){return this.selection.endOffset}},{key:"anchorKey",get:function(){return this.selection.anchorKey}},{key:"focusKey",get:function(){return this.selection.focusKey}},{key:"anchorPath",get:function(){return this.selection.anchorPath}},{key:"focusPath",get:function(){return this.selection.focusPath}},{key:"anchorOffset",get:function(){return this.selection.anchorOffset}},{key:"focusOffset",get:function(){return this.selection.focusOffset}},{key:"startBlock",get:function(){return this.startKey&&this.document.getClosestBlock(this.startKey)}},{key:"endBlock",get:function(){return this.endKey&&this.document.getClosestBlock(this.endKey)}},{key:"anchorBlock",get:function(){return this.anchorKey&&this.document.getClosestBlock(this.anchorKey)}},{key:"focusBlock",get:function(){return this.focusKey&&this.document.getClosestBlock(this.focusKey)}},{key:"startInline",get:function(){return this.startKey&&this.document.getClosestInline(this.startKey)}},{key:"endInline",get:function(){return this.endKey&&this.document.getClosestInline(this.endKey)}},{key:"anchorInline",get:function(){return this.anchorKey&&this.document.getClosestInline(this.anchorKey)}},{key:"focusInline",get:function(){return this.focusKey&&this.document.getClosestInline(this.focusKey)}},{key:"startText",get:function(){return this.startKey&&this.document.getDescendant(this.startKey)}},{key:"endText",get:function(){return this.endKey&&this.document.getDescendant(this.endKey)}},{key:"anchorText",get:function(){return this.anchorKey&&this.document.getDescendant(this.anchorKey)}},{key:"focusText",get:function(){return this.focusKey&&this.document.getDescendant(this.focusKey)}},{key:"nextBlock",get:function(){return this.endKey&&this.document.getNextBlock(this.endKey)}},{key:"previousBlock",get:function(){return this.startKey&&this.document.getPreviousBlock(this.startKey)}},{key:"nextInline",get:function(){return this.endKey&&this.document.getNextInline(this.endKey)}},{key:"previousInline",get:function(){return this.startKey&&this.document.getPreviousInline(this.startKey)}},{key:"nextText",get:function(){return this.endKey&&this.document.getNextText(this.endKey)}},{key:"previousText",get:function(){return this.startKey&&this.document.getPreviousText(this.startKey)}},{key:"characters",get:function(){return this.selection.isUnset?new Ir:this.document.getCharactersAtRange(this.selection)}},{key:"marks",get:function(){return this.selection.isUnset?new vn:this.selection.marks||this.document.getMarksAtRange(this.selection)}},{key:"activeMarks",get:function(){return this.selection.isUnset?new vn:this.selection.marks||this.document.getActiveMarksAtRange(this.selection)}},{key:"blocks",get:function(){return this.selection.isUnset?new Ir:this.document.getBlocksAtRange(this.selection)}},{key:"fragment",get:function(){return this.selection.isUnset?zo.create():this.document.getFragmentAtRange(this.selection)}},{key:"inlines",get:function(){return this.selection.isUnset?new Ir:this.document.getInlinesAtRange(this.selection)}},{key:"texts",get:function(){return this.selection.isUnset?new Ir:this.document.getTextsAtRange(this.selection)}},{key:"isEmpty",get:function(){return!!this.isCollapsed||(0==this.endOffset||0==this.startOffset)&&this.fragment.isEmpty}},{key:"isInVoid",get:function(){return!this.isExpanded&&this.document.hasVoidParent(this.startKey)}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.isValue(e))return e;if(A(e))return t.fromJSON(e,r);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(A(e)){var r={};return"data"in e&&(r.data=So.create(e.data)),"decorations"in e&&(r.decorations=Mo.createList(e.decorations)),"schema"in e&&(r.schema=Ai.create(e.schema)),r}throw new Error("`Value.createProperties` only accepts objects or values, but you passed it: "+e)}},{key:"fromJSON",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.document,o=void 0===n?{}:n,i=e.selection,a=void 0===i?{}:i,s=e.schema,u=void 0===s?{}:s,c=e.history,l=void 0===c?{}:c,f=new yr;if(o=zo.fromJSON(o),a=Mo.fromJSON(a),u=Ai.fromJSON(u),l=mi.fromJSON(l),r.plugins){var h=!0,d=!1,p=void 0;try{for(var v,y=r.plugins[Symbol.iterator]();!(h=(v=y.next()).done);h=!0){var g=v.value;g.data&&(f=f.merge(g.data))}}catch(e){d=!0,p=e}finally{try{!h&&y.return&&y.return()}finally{if(d)throw p}}}if("data"in e&&(f=f.merge(e.data)),a.isUnset){var m=o.getFirstText();m&&(a=a.collapseToStartOf(m))}var k=new t({data:f,document:o,selection:a=a.normalize(o),schema:u,history:l});return!1!==r.normalize&&(k=k.change({save:!1}).normalize().value),k}},{key:"isValue",value:function(e){return!(!e||!e[co.VALUE])}}]),t}(Un({data:new yr,decorations:null,document:zo.create(),history:mi.create(),schema:Ai.create(),selection:Mo.create()}));Mi.fromJS=Mi.fromJSON,Mi.prototype[co.VALUE]=!0;var Ji={add_mark:["value","path","offset","length","mark"],insert_node:["value","path","node"],insert_text:["value","path","offset","text","marks"],merge_node:["value","path","position","properties","target"],move_node:["value","path","newPath"],remove_mark:["value","path","offset","length","mark"],remove_node:["value","path","node"],remove_text:["value","path","offset","text","marks"],set_mark:["value","path","offset","length","mark","properties"],set_node:["value","path","node","properties"],set_selection:["value","selection","properties"],set_value:["value","properties"],split_node:["value","path","position","properties","target"]},Ui=function(e){function t(){return go(this,t),_o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return bo(t,e),mo(t,[{key:"toJSON",value:function(){var e=this.object,t=this.type,r={object:e,type:t},n=Ji[t],o=!0,i=!1,a=void 0;try{for(var s,u=n[Symbol.iterator]();!(o=(s=u.next()).done);o=!0){var c=s.value,l=this[c];if("document"!=c&&("selection"!=c&&"value"!=c&&("node"!=c||"insert_node"==t))){if("mark"!=c&&"marks"!=c&&"node"!=c||(l=l.toJSON()),"properties"==c&&"merge_node"==t){var f={};"data"in l&&(f.data=l.data.toJS()),"type"in l&&(f.type=l.type),l=f}if("properties"==c&&"set_mark"==t){var h={};"data"in l&&(h.data=l.data.toJS()),"type"in l&&(h.type=l.type),l=h}if("properties"==c&&"set_node"==t){var d={};"data"in l&&(d.data=l.data.toJS()),"isVoid"in l&&(d.isVoid=l.isVoid),"type"in l&&(d.type=l.type),l=d}if("properties"==c&&"set_selection"==t){var p={};"anchorOffset"in l&&(p.anchorOffset=l.anchorOffset),"anchorPath"in l&&(p.anchorPath=l.anchorPath&&l.anchorPath.toJSON()),"focusOffset"in l&&(p.focusOffset=l.focusOffset),"focusPath"in l&&(p.focusPath=l.focusPath&&l.focusPath.toJSON()),"isBackward"in l&&(p.isBackward=l.isBackward),"isFocused"in l&&(p.isFocused=l.isFocused),"marks"in l&&(p.marks=l.marks&&l.marks.toJSON()),l=p}if("properties"==c&&"set_value"==t){var v={};"data"in l&&(v.data=l.data.toJS()),"decorations"in l&&(v.decorations=l.decorations.toJS()),"schema"in l&&(v.schema=l.schema.toJS()),l=v}if("properties"==c&&"split_node"==t){var y={};"data"in l&&(y.data=l.data.toJS()),"type"in l&&(y.type=l.type),l=y}r[c]=l}}}catch(e){i=!0,a=e}finally{try{!o&&u.return&&u.return()}finally{if(i)throw a}}return r}},{key:"toJS",value:function(e){return this.toJSON(e)}},{key:"object",get:function(){return"operation"}},{key:"kind",get:function(){return ne.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isOperation(e))return e;if(A(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(Ir.isList(e)||Array.isArray(e)){var r=new Ir(e.map(t.create));return r}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 r=e.type,n=Ji[r],o={type:r};if(!n)throw new Error('`Operation.fromJSON` was passed an unrecognized operation type: "'+r+'"');var i=!0,a=!1,s=void 0;try{for(var u,c=n[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var l=u.value,f=e[l];if(void 0===f){if("document"==l)continue;if("selection"==l)continue;if("value"==l)continue;if("node"==l&&"insert_node"!=r)continue;throw new Error('`Operation.fromJSON` was passed a "'+r+'" operation without the required "'+l+'" attribute.')}"path"!==l&&"newPath"!==l||(f=Do.create(f)),"mark"===l&&(f=Co.create(f)),"marks"===l&&null!=f&&(f=Co.createSet(f)),"node"===l&&(f=Ho.create(f)),"selection"===l&&(f=Mo.create(f)),"value"===l&&(f=Mi.create(f)),"properties"===l&&"merge_node"===r&&(f=Ho.createProperties(f)),"properties"===l&&"set_mark"===r&&(f=Co.createProperties(f)),"properties"===l&&"set_node"===r&&(f=Ho.createProperties(f)),"properties"===l&&"set_selection"===r&&(f=Mo.createProperties(f)),"properties"===l&&"set_value"===r&&(f=Mi.createProperties(f)),"properties"===l&&"split_node"===r&&(f=Ho.createProperties(f)),o[l]=f}}catch(e){a=!0,s=e}finally{try{!i&&c.return&&c.return()}finally{if(a)throw s}}return new t(o)}},{key:"isOperation",value:function(e){return!(!e||!e[co.OPERATION])}},{key:"isOperationList",value:function(e){return Ir.isList(e)&&e.every((function(e){return t.isOperation(e)}))}}]),t}(Un({length:void 0,mark:void 0,marks:void 0,newPath:void 0,node:void 0,offset:void 0,path:void 0,position:void 0,properties:void 0,selection:void 0,target:void 0,text:void 0,type:void 0,value:void 0}));Ui.fromJS=Ui.fromJSON,Ui.prototype[co.OPERATION]=!0;var Vi=io("slate:operation:invert");function qi(e){var t=(e=Ui.create(e)).type;switch(Vi(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 r=e,n=r.newPath,o=r.path,i=n,a=o,s=o.size-1,u=n.size-1;return o.size<i.size&&o.slice(0,s).every((function(e,t){return e==i.get(t)}))&&o.last()<i.get(s)&&(i=i.slice(0,s).concat(i.get(s)-1).concat(i.slice(s+1,i.size))),n.size<a.size&&n.slice(0,u).every((function(e,t){return e==a.get(t)}))&&n.last()<=a.get(u)&&(a=a.slice(0,u).concat(a.get(u)+1).concat(a.slice(u+1,a.size))),e.set("path",i).set("newPath",a);case"merge_node":var c=e.path,l=Do.decrement(c);return e.set("type","split_node").set("path",l);case"split_node":var f=e.path,h=Do.increment(f);return e.set("type","merge_node").set("path",h);case"set_node":var d=e,p=d.properties,v=d.node,y=v.merge(p),g=so(v,Object.keys(p));return e.set("node",y).set("properties",g);case"insert_text":return e.set("type","remove_text");case"remove_text":return e.set("type","insert_text");case"add_mark":return e.set("type","remove_mark");case"remove_mark":return e.set("type","add_mark");case"set_mark":var m=e,k=m.properties,b=m.mark,_=b.merge(k),w=so(b,Object.keys(k));return e.set("mark",_).set("properties",w);case"set_selection":var x=e,O=x.properties,A=x.selection,S=A.merge(O),E=so(A,Object.keys(O));return e.set("selection",S).set("properties",E);case"set_value":var N=e,T=N.properties,j=N.value,P=j.merge(T),C=so(j,Object.keys(T));return e.set("value",P).set("properties",C);default:throw new Error('Unknown operation type: "'+t+'".')}}var Wi={redo:function(e){var t=e.value,r=t.history;if(r){var n=r,o=n.undos,i=n.redos,a=i.peek();a&&(i=i.pop(),o=o.push(a),a.forEach((function(t){var r=t,n=r.type,o=r.properties;"set_selection"==n&&(t=t.set("properties",uo(o,"isFocused"))),e.applyOperation(t,{save:!1})})),t=e.value,r=r.set("undos",o).set("redos",i),t=t.set("history",r),e.value=t)}},undo:function(e){var t=e.value,r=t.history;if(r){var n=r,o=n.undos,i=n.redos,a=o.peek();a&&(o=o.pop(),i=i.push(a),a.slice().reverse().map(qi).forEach((function(t){var r=t,n=r.type,o=r.properties;"set_selection"==n&&(t=t.set("properties",uo(o,"isFocused"))),e.applyOperation(t,{save:!1})})),t=e.value,r=r.set("undos",o).set("redos",i),t=t.set("history",r),e.value=t)}}},Hi={select:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t=Mo.createProperties(t);var n=r.snapshot,o=void 0!==n&&n,i=e.value,a=i.document,s=i.selection,u={},c=s.merge(t).normalize(a);for(var l in t=so(c,Object.keys(t)))!0!==o&&et(t[l],s[l])||(u[l]=t[l]);s.marks&&!u.marks&&(u.hasOwnProperty("anchorKey")||u.hasOwnProperty("anchorOffset")||u.hasOwnProperty("focusKey")||u.hasOwnProperty("focusOffset"))&&(u.marks=null),oo(u)||e.applyOperation({type:"set_selection",value:i,properties:u,selection:s.toJSON()},o?{skip:!1,merge:!1}:{})},selectAll:function(e){var t=e.value,r=t.document,n=t.selection.moveToRangeOf(r);e.select(n)},snapshotSelection:function(e){var t=e.value.selection;e.select(t,{snapshot:!0})},moveAnchorCharBackward:function(e){var t=e.value,r=t.document,n=t.selection,o=t.anchorText,i=t.anchorBlock,a=n.anchorOffset,s=r.getPreviousText(o.key),u=r.hasVoidParent(o.key),c=s&&r.hasVoidParent(s.key);!u&&a>0?e.moveAnchor(-1):s&&(e.moveAnchorToEndOf(s),u||c||!i.hasNode(s.key)||e.moveAnchor(-1))},moveAnchorCharForward:function(e){var t=e.value,r=t.document,n=t.selection,o=t.anchorText,i=t.anchorBlock,a=n.anchorOffset,s=r.getNextText(o.key),u=r.hasVoidParent(o.key),c=s&&r.hasVoidParent(s.key);!u&&a<o.text.length?e.moveAnchor(1):s&&(e.moveAnchorToStartOf(s),u||c||!i.hasNode(s.key)||e.moveAnchor(1))},moveFocusCharBackward:function(e){var t=e.value,r=t.document,n=t.selection,o=t.focusText,i=t.focusBlock,a=n.focusOffset,s=r.getPreviousText(o.key),u=r.hasVoidParent(o.key),c=s&&r.hasVoidParent(s.key);!u&&a>0?e.moveFocus(-1):s&&(e.moveFocusToEndOf(s),u||c||!i.hasNode(s.key)||e.moveFocus(-1))},moveFocusCharForward:function(e){var t=e.value,r=t.document,n=t.selection,o=t.focusText,i=t.focusBlock,a=n.focusOffset,s=r.getNextText(o.key),u=r.hasVoidParent(o.key),c=s&&r.hasVoidParent(s.key);!u&&a<o.text.length?e.moveFocus(1):s&&(e.moveFocusToStartOf(s),u||c||!i.hasNode(s.key)||e.moveFocus(1))}};["Forward","Backward"].forEach((function(e){var t="moveAnchorChar"+e,r="moveFocusChar"+e;Hi["moveChar"+e]=function(e){e[t]()[r]()},Hi["moveStartChar"+e]=function(e){e.value.isBackward?e[r]():e[t]()},Hi["moveEndChar"+e]=function(e){e.value.isBackward?e[t]():e[r]()},Hi["extendChar"+e]=function(t){t["moveFocusChar"+e]()},Hi["collapseChar"+e]=function(t){t["Forward"==e?"collapseToEnd":"collapseToStart"]()["moveChar"+e]()}}));[["collapseLineBackward","collapseToStartOfBlock"],["collapseLineForward","collapseToEndOfBlock"],["extendLineBackward","extendToStartOfBlock"],["extendLineForward","extendToEndOfBlock"]].forEach((function(e){var t=wo(e,2),r=t[0],n=t[1];Hi[r]=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];e[n].apply(e,[e].concat(r))}}));["blur","collapseTo","collapseToAnchor","collapseToEnd","collapseToEndOf","collapseToFocus","collapseToStart","collapseToStartOf","extend","extendTo","extendToEndOf","extendToStartOf","flip","focus","move","moveAnchor","moveAnchorOffsetTo","moveAnchorTo","moveAnchorToEndOf","moveAnchorToStartOf","moveEnd","moveEndOffsetTo","moveEndTo","moveFocus","moveFocusOffsetTo","moveFocusTo","moveFocusToEndOf","moveFocusToStartOf","moveOffsetsTo","moveStart","moveStartOffsetTo","moveStartTo","moveTo","moveToEnd","moveToEndOf","moveToRangeOf","moveToStart","moveToStartOf","deselect"].forEach((function(e){Hi[e]=function(t){for(var r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];var i="deselect"!=e,a=t.value,s=a.document,u=a.selection,c=u[e].apply(u,n);i&&(c=c.normalize(s)),t.select(c)}}));var $i=["Next","Previous"],Yi=["Block","Inline","Text"];["moveTo","moveAnchorTo","moveFocusTo","moveStartTo","moveEndTo","collapseTo","extendTo"].forEach((function(e){var t=["Start","End"];"moveTo"==e&&t.push("Range"),t.forEach((function(t){var r=""+e+t+"Of";Yi.forEach((function(e){var t="Text"==e?"getNode":"getClosest"+e;Hi[""+r+e]=function(e){var n=e.value,o=n.document,i=n.selection,a=o[t](i.startKey);a&&e[r](a)},$i.forEach((function(n){var o="get"+n+e,i="Next"==n?"startKey":"endKey";Hi[""+r+n+e]=function(e){var n=e.value,a=n.document,s=n.selection,u=a[t](s[i]);if(u){var c=a[o](u.key);c&&e[r](c)}}}))}))}))}));var Gi={setValue:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t=Mi.createProperties(t);var n=e.value;e.applyOperation({type:"set_value",properties:t,value:n},r)}},Qi={};function Xi(e,t,r){if("text"!=t.object){for(var n=t.getFirstInvalidDescendant(r),o=e.value.document.getPath(t.key);t&&n;)Xi(e,n,r),(t=e.value.document.refindNode(o,t.key))?(o=e.value.document.refindPath(o,t.key),n=t.getFirstInvalidDescendant(r)):(o=[],n=null);t&&Zi(e,t,r)}else Zi(e,t,r)}function Zi(e,t,r){var n=r.stack.plugins.length+r.rules.length+1,o=0;!function e(t,i){var a=i.normalize(r);if(a){var s=t.value.document.getPath(i.key);if(a(t),i=t.value.document.refindNode(s,i.key)){if(s=t.value.document.refindPath(s,i.key),++o>n)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.");e(t,i)}}}(e,t)}Qi.normalize=function(e,t){e.normalizeDocument(t)},Qi.normalizeDocument=function(e,t){var r=e.value.document;e.normalizeNodeByKey(r.key,t)},Qi.normalizeNodeByKey=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=e.getFlag("normalize",r);if(n){var o=e.value,i=o.document,a=o.schema,s=i.assertNode(t);Xi(e,s,a),e.normalizeAncestorsByKey(t)}},Qi.normalizeAncestorsByKey=function(e,t){var r=e.value,n=r.document,o=r.schema,i=n.getAncestors(t);i&&i.forEach((function(t){e.value.document.getDescendant(t.key)&&Zi(e,t,o)}))},Qi.normalizeParentByKey=function(e,t,r){var n=e.value.document.getParent(t);e.normalizeNodeByKey(n.key,r)},Qi.normalizeNodeByPath=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=e.getFlag("normalize",r);if(n){var o=e.value,i=o.document,a=o.schema,s=i.assertNode(t);Xi(e,s,a);var u=(i=e.value.document).getAncestors(t);u&&u.forEach((function(t){e.value.document.getDescendant(t.key)&&Zi(e,t,a)}))}},Qi.normalizeParentByPath=function(e,t,r){var n=Do.lift(t);e.normalizeNodeByPath(n,r)};var ea=ko({},Bo,ci,li,Wi,Hi,Gi,Qi),ta=io("slate:operation:apply");function ra(e,t){var r=(t=Ui.create(t)).type;switch(ta(r,t),r){case"add_mark":var n=t,o=n.path,i=n.offset,a=n.length,s=n.mark;return e.addMark(o,i,a,s);case"insert_node":var u=t,c=u.path,l=u.node;return e.insertNode(c,l);case"insert_text":var f=t,h=f.path,d=f.offset,p=f.text,v=f.marks;return e.insertText(h,d,p,v);case"merge_node":var y=t.path;return e.mergeNode(y);case"move_node":var g=t,m=g.path,k=g.newPath;return e.moveNode(m,k);case"remove_mark":var b=t,_=b.path,w=b.offset,x=b.length,O=b.mark;return e.removeMark(_,w,x,O);case"remove_node":var A=t.path;return e.removeNode(A);case"remove_text":var S=t,E=S.path,N=S.offset,T=S.text;return e.removeText(E,N,T);case"set_mark":var j=t,P=j.path,C=j.offset,B=j.length,z=j.mark,R=j.properties;return e.setMark(P,C,B,z,R);case"set_node":var L=t,K=L.path,F=L.properties;return e.setNode(K,F);case"set_selection":var I=t.properties;return e.setSelection(I);case"set_value":var D=t.properties;return e.merge(D);case"split_node":var M=t,J=M.path,U=M.position,V=M.properties;return e.splitNode(J,U,V);default:throw new Error('Unknown operation type: "'+r+'".')}}var na=io("slate:change"),oa=function(){function e(t){go(this,e);var r=t.value;this.value=r,this.operations=new Ir,this.flags=ko({normalize:!0},so(t,["merge","save","normalize"]))}return mo(e,[{key:"applyOperation",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.operations,n=this.flags,o=this.value,i=o,a=i.history;A(e)&&(e=ko({},e,{value:o})),e=Ui.create(e);var s=t=ko({},n,t),u=s.merge,c=void 0===u?0!=r.size||null:u,l=s.save,f=void 0===l||l,h=s.skip,d=void 0===h?null:h;return na("apply",{operation:e,save:f,merge:c}),o=ra(o,e),a&&f&&(a=a.save(e,{merge:c,skip:d}),o=o.set("history",a)),this.value=o,this.operations=r.push(e),this}},{key:"applyOperations",value:function(e,t){var r=this;return e.forEach((function(e){return r.applyOperation(e,t)})),this}},{key:"call",value:function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return e.apply(void 0,[this].concat(r)),this}},{key:"withoutNormalization",value:function(e){var t=this.flags.normalize;return this.setOperationFlag("normalize",!1),e(this),this.setOperationFlag("normalize",t),this.normalizeDocument(),this}},{key:"setOperationFlag",value:function(e,t){return this.flags[e]=t,this}},{key:"getFlag",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return void 0!==t[e]?t[e]:this.flags[e]}},{key:"unsetOperationFlag",value:function(e){return delete this.flags[e],this}},{key:"object",get:function(){return"change"}},{key:"kind",get:function(){return ne.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}}]),e}();oa.isChange=lo.bind(null,"CHANGE"),oa.prototype[co.CHANGE]=!0,Object.keys(ea).forEach((function(e){oa.prototype[e]=function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return na(e,{args:r}),this.call.apply(this,[ea[e]].concat(r)),this}}));const ia=r,{renderToStaticMarkup:aa}=n;var sa=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},ua=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ca=function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)},la=new Un({object:"string",text:""}),fa={deserialize:function(e){if(e.tagName&&"br"===e.tagName.toLowerCase())return{object:"text",leaves:[{object:"leaf",text:"\n"}]};if("#text"==e.nodeName){if(e.nodeValue&&e.nodeValue.match(/<!--.*?-->/))return;return{object:"text",leaves:[{object:"leaf",text:e.nodeValue}]}}},serialize:function(e,t){if("string"===e.object)return t.split("\n").reduce((function(e,t,r){return 0!=r&&e.push(ia.createElement("br",{key:r})),e.push(t),e}),[])}};function ha(e){if("undefined"==typeof DOMParser)throw new Error("The native `DOMParser` global which the `Html` serializer uses by default is not present in this environment. You must supply the `options.parseHtml` function instead.");return(new DOMParser).parseFromString(e,"text/html").body||window.document.createElement("body")}var da=function(){var e=this;this.deserialize=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.toJSON,o=void 0!==n&&n,i=e.defaultBlock,a=e.parseHtml,s=a(t),u=Array.from(s.childNodes),c=e.deserializeElements(u);0==(c=c.reduce((function(e,t,r,n){if("block"==t.object)return e.push(t),e;if(r>0&&"block"!=n[r-1].object)return e[e.length-1].nodes.push(t),e;var o=ua({object:"block",data:{},isVoid:!1},i,{nodes:[t]});return e.push(o),e}),[])).length&&(c=[ua({object:"block",data:{},isVoid:!1},i,{nodes:[{object:"text",leaves:[{object:"leaf",text:"",marks:[]}]}]})]);var l={object:"value",document:{object:"document",data:{},nodes:c}},f=o?l:Mi.fromJSON(l);return f},this.deserializeElements=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=[];return t.filter(e.cruftNewline).forEach((function(t){var n=e.deserializeElement(t);switch(w(n)){case"array":r=r.concat(n);break;case"object":r.push(n)}})),r},this.deserializeElement=function(t){var r=void 0;t.tagName||(t.tagName="");var n=function(t){switch("[object NodeList]"==Object.prototype.toString.call(t)&&(t=Array.from(t)),w(t)){case"array":return e.deserializeElements(t);case"object":return e.deserializeElement(t);case"null":case"undefined":return;default:throw new Error('The `next` argument was called with invalid children: "'+t+'".')}},o=!0,i=!1,a=void 0;try{for(var s,u=e.rules[Symbol.iterator]();!(o=(s=u.next()).done);o=!0){var c=s.value;if(c.deserialize){var l=c.deserialize(t,n),f=w(l);if("array"!=f&&"object"!=f&&"null"!=f&&"undefined"!=f)throw new Error('A rule returned an invalid deserialized representation: "'+r+'".');if(void 0!==l){if(null===l)return null;r="mark"==l.object?e.deserializeMark(l):l;break}}}}catch(e){i=!0,a=e}finally{try{!o&&u.return&&u.return()}finally{if(i)throw a}}return r||n(t.childNodes)},this.deserializeMark=function(t){var r=t.type,n=t.data,o=function t(o){return"mark"==o.object?e.deserializeMark(o):("text"==o.object?o.leaves=o.leaves.map((function(e){return e.marks=e.marks||[],e.marks.push({type:r,data:n}),e})):o.nodes&&(o.nodes=o.nodes.map(t)),o)};return t.nodes.reduce((function(e,t){var r=o(t);return Array.isArray(r)?e.concat(r):(e.push(r),e)}),[])},this.serialize=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.document,o=n.nodes.map(e.serializeNode).filter((function(e){return e}));if(!1===r.render)return o;var i=aa(ia.createElement("body",null,o)),a=i.slice(6,-7);return a},this.serializeNode=function(t){if("text"===t.object)return t.getLeaves().map(e.serializeLeaf);var r=t.nodes.map(e.serializeNode),n=!0,o=!1,i=void 0;try{for(var a,s=e.rules[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var u=a.value;if(u.serialize){var c=u.serialize(t,r);if(null===c)return;if(c)return va(c)}}}catch(e){o=!0,i=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}throw new Error('No serializer defined for node of type "'+t.type+'".')},this.serializeLeaf=function(t){var r=new la({text:t.text}),n=e.serializeString(r);return t.marks.reduce((function(t,r){var n=!0,o=!1,i=void 0;try{for(var a,s=e.rules[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var u=a.value;if(u.serialize){var c=u.serialize(r,t);if(null===c)return;if(c)return va(c)}}}catch(e){o=!0,i=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}throw new Error('No serializer defined for mark of type "'+r.type+'".')}),n)},this.serializeString=function(t){var r=!0,n=!1,o=void 0;try{for(var i,a=e.rules[Symbol.iterator]();!(r=(i=a.next()).done);r=!0){var s=i.value;if(s.serialize){var u=s.serialize(t,t.text);if(u)return u}}}catch(e){n=!0,o=e}finally{try{!r&&a.return&&a.return()}finally{if(n)throw o}}},this.cruftNewline=function(e){return!("#text"===e.nodeName&&"\n"==e.nodeValue)}},pa=0;function va(e){return ia.cloneElement(e,{key:pa++})}var ya,ga,ma,ka={"border-radius":1,"border-top-left-radius":1,"border-top-right-radius":1,"border-bottom-left-radius":1,"border-bottom-right-radius":1,"box-shadow":1,order:1,flex:function(e,t){return[t+"box-flex"]},"box-flex":1,"box-align":1,animation:1,"animation-duration":1,"animation-name":1,transition:1,"transition-duration":1,transform:1,"transform-style":1,"transform-origin":1,"backface-visibility":1,perspective:1,"box-pack":1},ba={animation:1,"column-count":1,columns:1,"font-weight":1,opacity:1,"order ":1,"z-index":1,zoom:1,flex:1,"box-flex":1,transform:1,perspective:1,"box-pack":1,"box-align":1,colspan:1,rowspan:1},_a=function(e){return e.length?e.charAt(0).toUpperCase()+e.substring(1):e},wa=_a,xa=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,Oa="undefined"==typeof document?{}:document.documentElement.style,Aa=(ya=function(){for(var e in Oa)if(xa.test(e))return e.match(xa)[0];return"WebkitOpacity"in Oa?"Webkit":"KhtmlOpacity"in Oa?"Khtml":""}(),ga=ya.toLowerCase(),{style:ya,css:"-"+ga+"-",dom:{Webkit:"WebKit",ms:"MS",o:"WebKit"}[ya]||wa(ya)}),Sa=function(e,t){return t?t.toUpperCase():""},Ea=/[-\s]+(.)?/g,Na=function(e){return e?e.replace(Ea,Sa):""},Ta=/::/g,ja=/([A-Z]+)([A-Z][a-z])/g,Pa=/([a-z\d])([A-Z])/g,Ca=/_/g,Ba=function(e,t){return e?e.replace(Ta,"/").replace(ja,"$1_$2").replace(Pa,"$1_$2").replace(Ca,t||"-"):""},za=function(e){return Ba(e).toLowerCase()},Ra=Na,La=za,Ka=function(e){return e.length?e.charAt(0).toLowerCase()+e.substring(1):e},Fa=_a,Ia=Aa,Da=ka,Ma="undefined"==typeof document?{}:document.documentElement.style,Ja=function(e,t){t=t||{};var r=Ka(Ra(e)),n=La(e),o=ma?r:n,i=Ia.style?ma?Ia.style:Ia.css:"";if(r in Ma)return t.asString?o:[o];var a=o,s=Da[n],u=[];if(ma&&(a=Fa(o)),"function"==typeof s){var c=s(o,i)||[];c&&!Array.isArray(c)&&(c=[c]),c.length&&(c=c.map((function(e){return ma?Ka(Ra(e)):La(e)}))),u=u.concat(c)}return i&&u.push(i+a),u.push(o),t.asString||1==u.length?u[0]:u},Ua=Object.prototype.hasOwnProperty,Va=function(e,t){return Ua.call(e,t)},qa=Object.prototype.toString,Wa=Object.prototype.toString,Ha=Ja,$a=za,Ya=Na,Ga=Va,Qa=function(e){return!!e&&"[object Object]"===qa.call(e)},Xa=function(e){return"[object Function]"===Wa.apply(e)},Za=function(e,t,r,n){Ha(t).forEach((function(t){e[n?n(t):t]=r}))},es={cssUnitless:ba},ts=function(e,t,r,n){"string"==typeof e&&(e=function(e){e=(e||"").split(";");var t={};return e.forEach((function(e){var r=e.split(":");2==r.length&&(t[r[0].trim()]=r[1].trim())})),t}(e)),(t=t||es).cssUnitless=t.cssUnitless||es.cssUnitless,n=n||{};var o,i,a,s,u,c,l,f,h=t.scope||{},d=null!=t.addUnits?t.addUnits:!h||null==h.addUnits||h.addUnits,p=(null!=t.cssUnitless?t.cssUnitless:h?h.cssUnitless:null)||{},v=(t.cssUnit||h?h.cssUnit:null)||"px",y=t.prefixProperties||(h?h.prefixProperties:null)||{},g=t.camelize?Ya:$a;for(a in e)if(Ga(e,a)){if(s=e[a],i=$a(r?r+a:a),o=!1,f=!1,Xa(s)&&(l=s.call(h||e,s,a,i,e),Qa(l)&&null!=l.value?(s=l.value,f=l.prefix,i=l.name?$a(l.name):i):s=l),c="number"==(u=typeof s)||"string"==u&&""!=s&&1*s==s,null==s||null==i||""===i)continue;if((c||"string"==u)&&(o=!0),!o&&null!=s.value&&s.prefix&&(o=!0,f=s.prefix,s=s.value),o){if(f=f||!!y[i],c&&(s=d&&!(i in p)?s+v:s+""),"border"!=i&&(i.indexOf("border")||~i.indexOf("radius")||~i.indexOf("width"))||!c||(i+="-width"),!i.indexOf("border-radius-")&&(i.replace(/border(-radius)(-(.*))/,(function(e,t,r){var n={"-top":["-top-left","-top-right"],"-left":["-top-left","-bottom-left"],"-right":["-top-right","-bottom-right"],"-bottom":["-bottom-left","-bottom-right"]};r in n?(i=[],n[r].forEach((function(e){i.push("border"+e+t)}))):i="border"+r+t})),Array.isArray(i))){i.forEach((function(e){f?Za(n,e,s,g):n[g(e)]=s}));continue}f?Za(n,i,s,g):n[g(i)]=s}else ts(s,t,i+"-",n)}return n},rs=ts,ns=Va,os={prefixProperties:ka,cssUnitless:ba,object:ts,string:function(e,t){e=rs(e,t);var r,n=[];for(r in e)ns(e,r)&&n.push(r+": "+e[r]);return n.join("; ")}};const is=e("@pie-lib:mask-markup:serialization"),as=["span"],ss=["em","strong","u"],us=(e,t)=>{const r=e.getAttribute(t);return n=(e=>{const t=/([\w-]*)\s*:\s*([^;]*)/g;let r;const n={};for(;r=t.exec(e);)n[r[1]]=r[2].trim();return n})(r),os.object(n,{camelize:!0,addUnits:!1});var n},cs=["border","class","style"],ls={b:"bold",em:"italic",u:"underline",s:"strikethrough",code:"code",strong:"strong"},fs=[{deserialize(e,t){const r=ls[e.tagName.toLowerCase()];if(r)return is("[deserialize] mark: ",r),{object:"mark",type:r,nodes:t(e.childNodes)}}},{deserialize:(e,t)=>{if(8===e.nodeType)return;if(3===e.nodeType)return{object:"text",leaves:[{text:e.textContent}]};const r=e.tagName.toLowerCase(),n=(e=>{if(!e.attributes||e.attributes.length<=0)return;const t={};let r;for(r=0;r<e.attributes.length;r++){const n=e.attributes[r];t[n.name]=n.value}return t})(e)||{};"audio"==r&&""==n.controls&&(n.controls=!0);const o=cs.reduce((e=>(t,r)=>{if(!e.getAttribute)return t;if(e.getAttribute(r))switch(r){case"style":t.style=us(e,r);break;case"class":t.className=((e,t,r)=>{const n=e.getAttribute(r);return delete t.class,n})(e,t,r);break;default:t[r]=e.getAttribute(r)}return t})(e),{...n}),i=(e=>as.includes(e)?"inline":ss.includes(e)?"mark":"block")(r);return"math"===e.tagName.toLowerCase()?{isMath:!0,nodes:[e]}:{object:i,type:r,data:{dataset:{...e.dataset},attributes:{...o}},nodes:t(e.childNodes)}}}],hs=new function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};sa(this,e),da.call(this);var r=t.defaultBlock,n=void 0===r?"paragraph":r,o=t.parseHtml,i=void 0===o?ha:o,a=t.rules,s=void 0===a?[]:a;n=Ho.createProperties(n),this.rules=[].concat(ca(s),[fa]),this.defaultBlock=n,this.parseHtml=i}({rules:fs,defaultBlock:"span"}),ds=r,ps=o,{get:vs}=t,{withStyles:ys}=i,gs=a;function ms(e){let t,r=e[0],n=1;for(;n<e.length;){const o=e[n],i=e[n+1];if(n+=2,("optionalAccess"===o||"optionalCall"===o)&&null==r)return;"access"===o||"optionalAccess"===o?(t=r,r=i(r)):"call"!==o&&"optionalCall"!==o||(r=i(((...e)=>r.call(t,...e))),t=void 0)}return r}const ks=ys((e=>({para:{paddingTop:2*e.spacing.unit,paddingBottom:2*e.spacing.unit}})))((e=>ds.createElement("div",{className:e.classes.para},e.children))),bs=ys((()=>({spacer:{display:"inline-block",width:".75em"}})))((e=>ds.createElement("span",{className:e.classes.spacer}))),_s=["tbody","tr"],ws=(e,t,r,n,o,i)=>{if(!t)return null;const a=[];return(e.nodes||[]).forEach(((e,s)=>{const u=e.type?`${e.type}-${s}`:`${s}`;if(e.isMath)return a.push(ds.createElement("span",{dangerouslySetInnerHTML:{__html:`<math displaystyle="true">${e.nodes[0].innerHTML}</math>`}})),a;if(n){const u=n(e,t,r);if(u)return a.push(u),void("td"!==ms([o,"optionalAccess",e=>e.type])&&"drag-in-the-blank"===i&&a.push(ds.createElement(bs,{key:`spacer-${s}`})))}if("text"===e.object){const t=e.leaves.reduce(((e,t)=>{const r=t.text,n=((e,t)=>{const r=""===t.trim(),n=e&&e.type;return r&&_s.includes(n)?void 0:t})(o,r);return n?e+n:e}),""),r=(e=>{const t=e.leaves.find((e=>vs(e,"marks",[]).length));return t?t.marks[0]:null})(e);if(r){let e;for(e in ls)if(ls[e]===r.type){const r=e;a.push(ds.createElement(r,{key:u},t));break}}else t.length>0&&(a.push(t),"td"!==ms([o,"optionalAccess",e=>e.type])&&"drag-in-the-blank"===i&&a.push(ds.createElement(bs,{key:`spacer-${s}`})))}else{const o=ws(e,t,r,n,e,i);if("p"===e.type||"paragraph"===e.type)a.push(ds.createElement(ks,{key:u},o));else{const t=e.type;e.nodes&&e.nodes.length>0?a.push(ds.createElement(t,{key:u,...e.data.attributes},o)):a.push(ds.createElement(t,{key:u,...e.data.attributes}))}}})),a},xs=ys((()=>({main:{display:"initial"},tableStyle:{"&:not(.MathJax) table":{borderCollapse:"collapse"},"&:not(.MathJax) table td, &:not(.MathJax) table th":{padding:"8px 12px",textAlign:"left"}}})))((e=>ds.createElement("div",{className:gs(e.classes.main,e.classes.tableStyle)},e.children)));class Os extends ds.Component{constructor(...e){super(...e),Os.prototype.__init.call(this)}static __initStatic(){this.propTypes={renderChildren:ps.func,layout:ps.object,value:ps.object,onChange:ps.func,elementType:ps.string}}__init(){this.handleChange=(e,t)=>{const r={...this.props.value,[e]:t};this.props.onChange(r)}}render(){const{value:e,layout:t,elementType:r}=this.props,n=ws(t,e,this.handleChange,this.props.renderChildren,null,r);return ds.createElement(xs,null,n)}}Os.__initStatic();const As=/\{\{(\d+)\}\}/g;const Ss=r,Es=s,Ns=o;var Ts;const js=(e,t)=>{const{markup:r}=(o=t,(n=e)?{markup:n.replace(As,((e,t)=>`<span data-component="${o}" data-id="${t}"></span>`))}:{markup:""});var n,o;const i=(e=>hs.deserialize(e,{toJSON:!0}))(r);return i.document},Ps=(e,t)=>((Ts=class extends Ss.Component{static __initStatic(){this.propTypes={markup:Ns.string,layout:Ns.object,value:Ns.object,onChange:Ns.func,customMarkMarkupComponent:Ns.func,elementType:Ns.string}}componentDidUpdate(e){if(this.props.markup!==e.markup){const e=Es.findDOMNode(this);(e&&e.querySelectorAll('[data-latex][data-math-handled="true"]')||[]).forEach((e=>{const t=e.querySelector("mjx-container");t&&e.removeChild(t);const r=e.getAttribute("data-raw");e.innerHTML=r,e.removeAttribute("data-math-handled")}))}}render(){const{markup:r,layout:n,value:o,onChange:i,elementType:a}=this.props,s=n||js(r,e);return Ss.createElement(Os,{elementType:a,layout:s,value:o,onChange:i,renderChildren:t(this.props)})}}).__initStatic(),Ts),Cs=r,Bs=s,zs=o,{withStyles:Rs}=i,{Chip:Ls}=u,Ks=a,{color:Fs}=c,{renderMath:Is}=h,{DragSource:Ds}=d;class Ms extends Cs.Component{constructor(...e){super(...e),Ms.prototype.__init.call(this),Ms.prototype.__init2.call(this),Ms.prototype.__init3.call(this),Ms.prototype.__init4.call(this)}static __initStatic(){this.propTypes={disabled:zs.bool,choice:zs.object,classes:zs.object,connectDragSource:zs.func}}__init(){this.startDrag=()=>{const{connectDragSource:e,disabled:t}=this.props;t||e(this.dragContainerRef)}}__init2(){this.handleTouchStart=e=>{e.preventDefault(),this.longPressTimer=setTimeout((()=>{this.startDrag(e)}),500)}}__init3(){this.handleTouchEnd=()=>{clearTimeout(this.longPressTimer)}}__init4(){this.handleTouchMove=()=>{clearTimeout(this.longPressTimer)}}componentDidMount(){this.dragContainerRef&&(this.dragContainerRef.addEventListener("touchstart",this.handleTouchStart,{passive:!1}),this.dragContainerRef.addEventListener("touchend",this.handleTouchEnd),this.dragContainerRef.addEventListener("touchmove",this.handleTouchMove))}componentWillUnmount(){this.dragContainerRef&&(this.dragContainerRef.removeEventListener("touchstart",this.handleTouchStart),this.dragContainerRef.removeEventListener("touchend",this.handleTouchEnd),this.dragContainerRef.removeEventListener("touchmove",this.handleTouchMove))}componentDidUpdate(){Is(this.rootRef)}render(){const{connectDragSource:e,choice:t,classes:r,disabled:n}=this.props;return e(Cs.createElement("span",{className:Ks(r.choice,n&&r.disabled),ref:e=>{this.dragContainerRef=Bs.findDOMNode(e)}},Cs.createElement(Ls,{clickable:!1,disabled:!0,ref:e=>{this.rootRef=Bs.findDOMNode(e)},className:r.chip,label:Cs.createElement("span",{className:r.chipLabel,ref:e=>{e&&(e.innerHTML=t.value||" ")}}," "),variant:n?"outlined":void 0})),{})}}Ms.__initStatic();const Js=Rs((e=>({choice:{border:`solid 0px ${e.palette.primary.main}`,borderRadius:2*e.spacing.unit,margin:e.spacing.unit/2,transform:"translate(0, 0)"},chip:{backgroundColor:Fs.white(),border:`1px solid ${Fs.text()}`,color:Fs.text(),alignItems:"center",display:"inline-flex",height:"initial",minHeight:"32px",fontSize:"inherit",whiteSpace:"pre-wrap",maxWidth:"374px",pointerEvents:"none",borderRadius:"3px",paddingTop:"12px",paddingBottom:"12px"},chipLabel:{whiteSpace:"normal","& img":{display:"block",padding:"2px 0"},"& mjx-frac":{fontSize:"120% !important"}},disabled:{opacity:.6}})))(Ms),Us=Ds("MaskBlank",{canDrag:e=>!e.disabled,beginDrag:e=>({choice:e.choice,instanceId:e.instanceId})},((e,t)=>({connectDragSource:e.dragSource(),isDragging:t.isDragging()})))(Js),Vs=r,qs=o,{findKey:Ws}=t,{DragDroppablePlaceholder:Hs}=d;class $s extends Vs.Component{constructor(...e){super(...e),$s.prototype.__init.call(this)}static __initStatic(){this.propTypes={disabled:qs.bool,duplicates:qs.bool,choices:qs.arrayOf(qs.shape({label:qs.string,value:qs.string})),value:qs.object,choicePosition:qs.string.isRequired}}__init(){this.getStyleForWrapper=()=>{const{choicePosition:e}=this.props;switch(e){case"above":return{margin:"0 0 40px 0"};case"below":return{margin:"40px 0 0 0"};case"right":return{margin:"0 0 0 40px"};default:return{margin:"0 40px 0 0"}}}}render(){const{disabled:e,duplicates:t,choices:r,value:n}=this.props,o=r.filter((e=>{if(!0===t)return!0;return void 0===Ws(n,(t=>t===e.id))})),i={...this.getStyleForWrapper(),minWidth:"100px"};return Vs.createElement("div",{style:i},Vs.createElement(Hs,{disabled:e},o.map(((t,r)=>Vs.createElement(Us,{key:`${t.value}-${r}`,disabled:e,choice:t})))))}}$s.__initStatic();const{colors:{grey:Ys}}=u,{Chip:Gs}=u,Qs=r,Xs=s,Zs=o,eu=e,{withStyles:tu}=i,ru=a,{color:nu}=c,{renderMath:ou}=h,{DragSource:iu}=d,{DropTarget:au}=d;const su=eu("pie-lib:mask-markup:blank"),uu=tu((()=>({content:{border:`solid 0px ${nu.primary()}`,minWidth:"200px",touchAction:"none",overflow:"hidden",whiteSpace:"nowrap"},chip:{backgroundColor:nu.background(),border:`2px dashed ${nu.text()}`,color:nu.text(),fontSize:"inherit",maxWidth:"374px",position:"relative",borderRadius:"3px"},chipLabel:{whiteSpace:"normal",pointerEvents:"none","& img":{display:"block",padding:"2px 0"},"& p":{marginTop:"0",marginBottom:"0"},"& mjx-frac":{fontSize:"120% !important"}},hidden:{color:"transparent",opacity:0},dragged:{position:"absolute",left:16,maxWidth:"60px"},correct:{border:`solid 1px ${nu.correct()}`},incorrect:{border:`solid 1px ${nu.incorrect()}`},over:{whiteSpace:"nowrap",overflow:"hidden"},parentOver:{border:`1px solid ${Ys[500]}`,backgroundColor:`${Ys[300]}`}})));class cu extends Qs.Component{constructor(){super(),cu.prototype.__init.call(this),cu.prototype.__init2.call(this),cu.prototype.__init3.call(this),this.state={height:0,width:0}}__init(){this.handleImageLoad=()=>{this.updateDimensions()}}handleElements(){const e=function(e){let t,r=e[0],n=1;for(;n<e.length;){const o=e[n],i=e[n+1];if(n+=2,("optionalAccess"===o||"optionalCall"===o)&&null==r)return;"access"===o||"optionalAccess"===o?(t=r,r=i(r)):"call"!==o&&"optionalCall"!==o||(r=i(((...e)=>r.call(t,...e))),t=void 0)}return r}([this,"access",e=>e.spanRef,"optionalAccess",e=>e.querySelector,"call",e=>e("img")]);e?e.onload=this.handleImageLoad:setTimeout((()=>{this.updateDimensions()}),300)}componentDidMount(){this.handleElements(),this.rootRef&&this.rootRef.addEventListener("touchstart",this.handleTouchStart,{passive:!1})}componentDidUpdate(e){ou(this.rootRef);const{choice:t}=this.props,{choice:r}=e;if(JSON.stringify(t)!==JSON.stringify(r)){if(!t)return void this.setState({height:0,width:0});this.handleElements()}}componentWillUnmount(){this.rootRef&&this.rootRef.removeEventListener("touchstart",this.handleTouchStart)}__init2(){this.handleTouchStart=e=>{e.preventDefault(),this.touchStartTimer=setTimeout((()=>{this.startDrag()}),300)}}__init3(){this.startDrag=()=>{const{connectDragSource:e,disabled:t}=this.props;t||e(this.rootRef)}}updateDimensions(){if(this.spanRef&&this.rootRef){this.rootRef.style.width="auto";const e=(this.spanRef.offsetWidth||0)+24,t=(this.spanRef.offsetHeight||0)+24,r=parseFloat(this.props.emptyResponseAreaWidth)||0,n=parseFloat(this.props.emptyResponseAreaHeight)||0,o=e<=r?r:e,i=t<=n?n:t;this.setState((e=>({width:o>r?o:e.width,height:i>n?i:e.height}))),this.rootRef.style.width=`${o}px`,this.rootRef.style.height=`${i}px`}}addDraggableFalseAttributes(e){e.childNodes.forEach((e=>{(e instanceof Element||e instanceof HTMLDocument)&&e.setAttribute("draggable",!1)}))}getRootDimensions(){const e=isNaN(parseFloat(this.props.emptyResponseAreaWidth))?0:parseFloat(this.props.emptyResponseAreaWidth),t=isNaN(parseFloat(this.props.emptyResponseAreaHeight))?0:parseFloat(this.props.emptyResponseAreaHeight);return{...{height:this.state.height||t,width:this.state.width||e},...e?{}:{minWidth:90},...t?{}:{minHeight:32}}}render(){const{disabled:e,choice:t,classes:r,isOver:n,dragItem:o,correct:i}=this.props,a=o&&n&&o.choice.value,s=t&&t.value;return Qs.createElement(Gs,{clickable:!1,disabled:!0,ref:e=>{this.rootRef=Xs.findDOMNode(e)},component:"span",label:Qs.createElement(Qs.Fragment,null,Qs.createElement("span",{className:ru(r.chipLabel,n&&r.over,{[r.hidden]:a}),ref:e=>{e&&(this.spanRef=Xs.findDOMNode(e),e.innerHTML=s||"",this.addDraggableFalseAttributes(e))}}," "),a&&Qs.createElement("span",{className:ru(r.chipLabel,n&&r.over,r.dragged),ref:e=>{e&&(this.spanRef=Xs.findDOMNode(e),e.innerHTML=a||"",this.addDraggableFalseAttributes(e))}}," ")),className:ru(r.chip,n&&r.over,n&&r.parentOver,{[r.correct]:void 0!==i&&i,[r.incorrect]:void 0!==i&&!i}),variant:e?"outlined":void 0,style:{...this.getRootDimensions()}})}}cu.defaultProps={emptyResponseAreaWidth:0,emptyResponseAreaHeight:0},cu.propTypes={id:Zs.oneOfType([Zs.string,Zs.number]),disabled:Zs.bool,duplicates:Zs.bool,choice:Zs.object,classes:Zs.object,isOver:Zs.bool,dragItem:Zs.object,correct:Zs.bool,onChange:Zs.func,emptyResponseAreaWidth:Zs.oneOfType([Zs.string,Zs.number]),emptyResponseAreaHeight:Zs.oneOfType([Zs.string,Zs.number])};const lu=uu(cu),fu=uu((({connectDragSource:e,connectDropTarget:t,...r})=>{const{classes:n,isOver:o}=r;return t(e(Qs.createElement("span",{className:ru(n.content,o&&n.over)},Qs.createElement(lu,{...r}))))})),hu=au("MaskBlank",{drop(e,t){const r=t.getItem();return su("props.instanceId",e.instanceId,"draggedItem.instanceId:",r.instanceId),r.id!==e.id&&e.onChange(e.id,r.choice.id),{dropped:r.id!==e.id}},canDrop:(e,t)=>t.getItem().instanceId===e.instanceId},((e,t)=>({connectDropTarget:e.dropTarget(),isOver:t.isOver(),dragItem:t.getItem()})))(fu),du=iu("MaskBlank",{canDrag:e=>!e.disabled&&!!e.choice,beginDrag:e=>({id:e.id,choice:e.choice,instanceId:e.instanceId,fromChoice:!0}),endDrag(e,t){const r=t.getDropResult();if(!r||r.dropped){t.getItem().fromChoice&&e.onChange(e.id,void 0)}}},((e,t)=>({connectDragSource:e.dragSource(),isDragging:t.isDragging()})))(hu),pu=r,vu=o,{renderMath:yu}=h,gu=Ps("blank",(e=>(t,r,n)=>{const o=t.data&&t.data.dataset||{};if("blank"===o.component){const{disabled:i,duplicates:a,correctResponse:s,feedback:u,showCorrectAnswer:c,emptyResponseAreaWidth:l,emptyResponseAreaHeight:f}=e,h=c?s[o.id]:r[o.id],d=h&&e.choices.find((e=>e.id===h));return pu.createElement(du,{key:`${t.type}-${o.id}`,correct:c||u&&u[o.id],disabled:i,duplicates:a,choice:d,id:o.id,emptyResponseAreaWidth:l,emptyResponseAreaHeight:f,onChange:n})}}));class mu extends pu.Component{constructor(...e){super(...e),mu.prototype.__init.call(this)}static __initStatic(){this.propTypes={markup:vu.string,layout:vu.object,choicesPosition:vu.string,choices:vu.arrayOf(vu.shape({label:vu.string,value:vu.string})),value:vu.object,onChange:vu.func,duplicates:vu.bool,disabled:vu.bool,feedback:vu.object,correctResponse:vu.object,showCorrectAnswer:vu.bool,emptyResponseAreaWidth:vu.oneOfType([vu.string,vu.number]),emptyResponseAreaHeight:vu.oneOfType([vu.string,vu.number])}}UNSAFE_componentWillReceiveProps(){this.rootRef&&yu(this.rootRef)}componentDidUpdate(){yu(this.rootRef)}__init(){this.getPositionDirection=e=>{let t,r,n;switch(e){case"left":t="row",n="center";break;case"right":t="row-reverse",r="flex-end",n="center";break;case"below":t="column-reverse";break;default:t="column"}return{flexDirection:t,justifyContent:r,alignItems:n}}}render(){const{markup:e,duplicates:t,layout:r,value:n,onChange:o,choicesPosition:i,choices:a,correctResponse:s,disabled:u,feedback:c,showCorrectAnswer:l,emptyResponseAreaWidth:f,emptyResponseAreaHeight:h}=this.props,d=i||"below",p={display:"flex",minWidth:"100px",...this.getPositionDirection(d)};return pu.createElement("div",{ref:e=>e&&(this.rootRef=e),style:p},pu.createElement($s,{choicePosition:d,duplicates:t,choices:a,value:n,disabled:u}),pu.createElement(gu,{elementType:"drag-in-the-blank",markup:e,layout:r,value:n,choices:a,onChange:o,disabled:u,duplicates:t,feedback:c,correctResponse:s,showCorrectAnswer:l,emptyResponseAreaWidth:f,emptyResponseAreaHeight:h}))}}mu.__initStatic();const ku=r,{withStyles:bu}=i,_u=a,{color:wu}=c,xu=p;function Ou(e){let t,r=e[0],n=1;for(;n<e.length;){const o=e[n],i=e[n+1];if(n+=2,("optionalAccess"===o||"optionalCall"===o)&&null==r)return;"access"===o||"optionalAccess"===o?(t=r,r=i(r)):"call"!==o&&"optionalCall"!==o||(r=i(((...e)=>r.call(t,...e))),t=void 0)}return r}var Au=bu((()=>({editableHtmlCustom:{display:"inline-block",verticalAlign:"middle",margin:"4px",borderRadius:"4px",border:`1px solid ${wu.black()}`},correct:{border:`1px solid ${wu.correct()}`},incorrect:{border:`1px solid ${wu.incorrect()}`}})))(Ps("input",(e=>(t,r)=>{const{adjustedLimit:n,disabled:o,feedback:i,showCorrectAnswer:a,maxLength:s,spellCheck:u,classes:c,pluginProps:l,onChange:f}=e,h=Ou([t,"access",e=>e.data,"optionalAccess",e=>e.dataset])||{};if("input"===h.component){const d=(e.choices&&h&&e.choices[h.id]||[])[0],p=a?d&&d.label:r[h.id]||"",v=s&&s[h.id],y=i&&i[h.id],g=a||"correct"===y,m=!a&&"incorrect"===y,k=e=>{const t={...r,[h.id]:e};f(t)},b=e=>{if("Enter"===e.key||13===e.keyCode)return!1};return ku.createElement(xu,{id:h.id,key:`${t.type}-input-${h.id}`,disabled:a||o,disableUnderline:!0,onChange:k,markup:p||"",charactersLimit:n?v:25,activePlugins:["languageCharacters"],pluginProps:l,languageCharactersProps:[{language:"spanish"}],spellCheck:u,width:`calc(${v}em + 42px)`,onKeyDown:b,autoWidthToolbar:!0,toolbarOpts:{minWidth:"auto",noBorder:!0,isHidden:!!Ou([l,"optionalAccess",e=>e.characters,"optionalAccess",e=>e.disabled])},className:_u(c.editableHtmlCustom,{[c.correct]:g,[c.incorrect]:m})})}})));Ps("input",(e=>(t,r,n)=>{const o=t.data&&t.data.dataset||{};if("input"===o.component)return e.customMarkMarkupComponent(o.id)}));const Su=r,Eu=o,{Button:Nu}=u,{InputLabel:Tu}=u,{Menu:ju}=u,{MenuItem:Pu}=u,{ArrowDropDown:Cu}=l,{ArrowDropUp:Bu}=l,{Close:zu}=l,{Check:Ru}=l,{withStyles:Lu}=i,Ku=a,{color:Fu}=c,{renderMath:Iu}=h;class Du extends Su.Component{static __initStatic(){this.propTypes={id:Eu.string,value:Eu.string,disabled:Eu.bool,onChange:Eu.func,classes:Eu.object,correct:Eu.bool,choices:Eu.arrayOf(Eu.shape({value:Eu.string,label:Eu.string})),showCorrectAnswer:Eu.bool,singleQuery:Eu.bool,correctValue:Eu.string}}constructor(e){super(e),Du.prototype.__init.call(this),Du.prototype.__init2.call(this),Du.prototype.__init3.call(this),Du.prototype.__init4.call(this),Du.prototype.__init5.call(this),this.state={anchorEl:null,highlightedOptionId:null,menuWidth:null,previewValue:null},this.hiddenRef=Su.createRef(),this.buttonRef=Su.createRef(),this.previewRef=Su.createRef(),this.elementRefs=[]}componentDidMount(){this.hiddenRef.current&&null===this.state.menuWidth&&this.setState({menuWidth:this.hiddenRef.current.clientWidth})}componentDidUpdate(e,t){const r=this.hiddenRef.current;if(!t.anchorEl&&this.state.anchorEl&&this.elementRefs.forEach((e=>{if(!e)return;const t=e.querySelector("[data-latex], [data-raw]"),r=e.querySelector("mjx-container"),n=e.querySelector('[data-math-handled="true"]');!t||n&&r||Iu(e)})),r){const e=r.clientWidth;e!==this.state.menuWidth&&(this.elementRefs.forEach((e=>{e&&Iu(e)})),Iu(r),this.setState({menuWidth:e}))}}__init(){this.handleClick=e=>this.setState({anchorEl:e.currentTarget})}__init2(){this.handleClose=()=>{const{value:e}=this.props;this.setState({anchorEl:null,previewValue:null,highlightedOptionId:null}),!e&&this.previewRef.current&&(this.previewRef.current.innerHTML="")}}__init3(){this.handleHighlight=e=>{const t={highlightedOptionId:`dropdown-option-${this.props.id}-${e}`};this.props.value||(t.previewValue=this.props.choices[e].value),this.setState(t)}}__init4(){this.handleSelect=(e,t)=>{this.props.onChange(this.props.id,e),this.handleHighlight(t),this.handleClose()}}__init5(){this.handleHover=e=>{if(this.props.value)return;const t=`dropdown-option-${this.props.id}-${e}`,r=this.state.previewValue;this.setState({highlightedOptionId:t,previewValue:r},(()=>{const t=this.elementRefs[e],r=this.previewRef.current;t&&r&&(r.innerHTML=t.innerHTML)}))}}getLabel(e,t){const r=(e||[]).find((e=>e.value===t));return r?r.label.trim():void 0}render(){const{classes:e,id:t,correct:r,disabled:n,value:o,choices:i,showCorrectAnswer:a,singleQuery:s,correctValue:u}=this.props,{anchorEl:c}=this.state,l=Boolean(c),f=`dropdown-button-${t}`,h=`dropdown-menu-${t}`,d=`dropdown-value-${t}`;let p;this.elementRefs=[],n&&void 0!==r&&(p=r||a?e.disabledCorrect:e.disabledIncorrect);const v=parseInt(t,10)+1,y=s?"Query-label":`Query-label-${v}`,g=s?"Query":`Query ${v}`;let m=null;return n&&void 0!==r&&(m=r||a?Su.createElement(Ru,{className:Ku(e.correctnessIndicatorIcon,e.correctIcon)}):Su.createElement(zu,{className:Ku(e.correctnessIndicatorIcon,e.incorrectIcon)})),Su.createElement(Su.Fragment,null,Su.createElement("div",{ref:this.hiddenRef,style:{position:"absolute",visibility:"hidden",top:0,left:0},tabIndex:-1,"aria-hidden":"true"},(i||[]).map(((t,r)=>Su.createElement(Pu,{key:r,classes:{root:e.menuRoot,selected:e.selected},tabIndex:-1,"aria-hidden":"true"},Su.createElement("span",{className:e.label,dangerouslySetInnerHTML:{__html:t.label}}))))),Su.createElement(Tu,{className:e.srOnly,id:y,tabIndex:-1,"aria-hidden":"true"},g),Su.createElement(Nu,{ref:this.buttonRef,style:{...this.state.menuWidth&&{minWidth:`calc(${this.state.menuWidth}px + 8px)`},borderWidth:l?"2px":"1px",transition:"border-width 0.2s ease-in-out"},"aria-controls":l?h:void 0,"aria-haspopup":"listbox","aria-expanded":l?"true":void 0,"aria-activedescendant":this.state.highlightedOptionId,onClick:this.handleClick,classes:{root:e.root,disabled:p},disabled:n,id:f,role:"combobox","aria-label":`Select an option for ${g}`,"aria-labelledby":d},m,Su.createElement("span",{id:d,ref:this.previewRef,className:e.label,dangerouslySetInnerHTML:{__html:u||(l&&this.state.previewValue?this.getLabel(i,this.state.previewValue):this.getLabel(i,o)||"")}}),l?Su.createElement(Bu,null):Su.createElement(Cu,null)),Su.createElement(ju,{id:h,anchorEl:c,className:e.selectMenu,keepMounted:!0,open:l,onClose:this.handleClose,getContentAnchorEl:null,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},PaperProps:this.state.menuWidth?{style:{minWidth:this.state.menuWidth,padding:"4px"}}:void 0,MenuListProps:{"aria-labelledby":f,role:"listbox",disablePadding:!0}},(i||[]).map(((r,n)=>{const i=`dropdown-option-${t}-${n}`;return Su.createElement(Pu,{id:i,classes:{root:e.menuRoot,selected:e.selected},key:`${r.label}-${n}`,value:r.value,onClick:()=>this.handleSelect(r.value,n),role:"option","aria-selected":this.state.highlightedOptionId===i?"true":void 0,onMouseOver:()=>this.handleHover(n)},Su.createElement("span",{ref:e=>this.elementRefs[n]=e,className:e.label,dangerouslySetInnerHTML:{__html:r.label}}),Su.createElement("span",{className:e.selectedIndicator,dangerouslySetInnerHTML:{__html:r.value===o?" ✓":""}}))}))))}}Du.__initStatic();var Mu=Lu((()=>({root:{color:Fu.text(),border:`1px solid ${Fu.borderGray()}`,borderRadius:"4px",justifyContent:"space-between",backgroundColor:Fu.background(),position:"relative",height:"45px",width:"fit-content",margin:"2px",textTransform:"none","& span":{paddingRight:"5px"},"& svg":{position:"absolute",right:0,top:"calc(50% - 12px)",pointerEvents:"none",color:Fu.text(),marginLeft:"5px"},"&:focus, &:focus-visible":{outline:`3px solid ${Fu.tertiary()}`,outlineOffset:"2px",borderWidth:"3px"}},disabledCorrect:{borderWidth:"2px",borderColor:Fu.correct(),color:`${Fu.text()} !important`},disabledIncorrect:{borderWidth:"2px",borderColor:Fu.incorrectWithIcon(),color:`${Fu.text()} !important`},selectMenu:{backgroundColor:Fu.background(),border:`1px solid ${Fu.correct()} !important`,"&:hover":{border:`1px solid ${Fu.text()} `,borderColor:"initial"},"&:focus":{border:`1px solid ${Fu.text()}`,borderColor:"initial"},"& .MuiList-root":{padding:0}},selected:{color:`${Fu.text()} !important`,backgroundColor:`${Fu.background()} !important`,"&:hover":{color:Fu.text(),backgroundColor:`${Fu.dropdownBackground()} !important`}},menuRoot:{color:Fu.text(),backgroundColor:Fu.background(),"&:focus, &:focus-visible":{outline:`3px solid ${Fu.tertiary()}`,outlineOffset:"-1px"},"&:focus":{color:Fu.text(),backgroundColor:Fu.background()},"&:hover":{color:Fu.text(),backgroundColor:Fu.dropdownBackground()},boxSizing:"border-box",padding:"25px",borderRadius:"4px"},label:{fontSize:"max(1rem, 14px)"},selectedIndicator:{fontSize:"max(1rem, 14px)",position:"absolute",right:"10px"},srOnly:{position:"absolute",left:"-10000px",top:"auto",width:"1px",height:"1px",overflow:"hidden"},correctnessIndicatorIcon:{color:`${Fu.white()} !important`,position:"absolute",top:"-8px !important",left:"-8px",marginLeft:"0 !important",borderRadius:"50%",fontSize:"16px",padding:"2px"},correctIcon:{backgroundColor:Fu.correct()},incorrectIcon:{backgroundColor:Fu.incorrectWithIcon()}})))(Du);const Ju=r;function Uu(e){return Uu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Uu(e)}function Vu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function qu(e){var t=function(e,t){if("object"!==Uu(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==Uu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Uu(t)?t:String(t)}function Wu(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,qu(n.key),n)}}function Hu(e,t,r){return t&&Wu(e.prototype,t),r&&Wu(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function $u(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Yu(e,t){return Yu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Yu(e,t)}function Gu(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Yu(e,t)}function Qu(e,t){if(t&&("object"===Uu(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return $u(e)}function Xu(e){return Xu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Xu(e)}function Zu(e,t,r){return(t=qu(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ec(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function tc(e){return function(e){if(Array.isArray(e))return e}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return ec(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ec(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function rc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function nc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?rc(Object(r),!0).forEach((function(t){Zu(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):rc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}Ps("dropdown",(e=>(t,r,n)=>{const o=t.data&&t.data.dataset||{};if("dropdown"===o.component){const{choices:i,disabled:a,feedback:s,showCorrectAnswer:u}=e,c=i&&i[o.id]&&i[o.id].find((e=>e.correct)),l=u?c&&c.value:r[o.id];return Ju.createElement(Mu,{key:`${t.type}-dropdown-${o.id}`,correct:s&&s[o.id]&&"correct"===s[o.id],disabled:a||u,value:l,correctValue:u?c&&c.label:void 0,id:o.id,onChange:n,choices:i[o.id],showCorrectAnswer:u,singleQuery:1==Object.keys(i).length})}}));var oc={type:"logger",log:function(e){this.output("log",e)},warn:function(e){this.output("warn",e)},error:function(e){this.output("error",e)},output:function(e,t){console&&console[e]&&console[e].apply(console,t)}},ic=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Vu(this,e),this.init(t,r)}return Hu(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||oc,this.options=t,this.debug=t.debug}},{key:"setDebug",value:function(e){this.debug=e}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.forward(t,"log","",!0)}},{key:"warn",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.forward(t,"warn","",!0)}},{key:"error",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.forward(t,"error","")}},{key:"deprecate",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}},{key:"forward",value:function(e,t,r,n){return n&&!this.debug?null:("string"==typeof e[0]&&(e[0]="".concat(r).concat(this.prefix," ").concat(e[0])),this.logger[t](e))}},{key:"create",value:function(t){return new e(this.logger,nc(nc({},{prefix:"".concat(this.prefix,":").concat(t,":")}),this.options))}},{key:"clone",value:function(t){return(t=t||this.options).prefix=t.prefix||this.prefix,new e(this.logger,t)}}]),e}(),ac=new ic,sc=function(){function e(){Vu(this,e),this.observers={}}return Hu(e,[{key:"on",value:function(e,t){var r=this;return e.split(" ").forEach((function(e){r.observers[e]=r.observers[e]||[],r.observers[e].push(t)})),this}},{key:"off",value:function(e,t){this.observers[e]&&(t?this.observers[e]=this.observers[e].filter((function(e){return e!==t})):delete this.observers[e])}},{key:"emit",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(this.observers[e]){var o=[].concat(this.observers[e]);o.forEach((function(e){e.apply(void 0,r)}))}if(this.observers["*"]){var i=[].concat(this.observers["*"]);i.forEach((function(t){t.apply(t,[e].concat(r))}))}}}]),e}();function uc(){var e,t,r=new Promise((function(r,n){e=r,t=n}));return r.resolve=e,r.reject=t,r}function cc(e){return null==e?"":""+e}function lc(e,t,r){e.forEach((function(e){t[e]&&(r[e]=t[e])}))}function fc(e,t,r){function n(e){return e&&e.indexOf("###")>-1?e.replace(/###/g,"."):e}function o(){return!e||"string"==typeof e}for(var i="string"!=typeof t?[].concat(t):t.split(".");i.length>1;){if(o())return{};var a=n(i.shift());!e[a]&&r&&(e[a]=new r),e=Object.prototype.hasOwnProperty.call(e,a)?e[a]:{}}return o()?{}:{obj:e,k:n(i.shift())}}function hc(e,t,r){var n=fc(e,t,Object);n.obj[n.k]=r}function dc(e,t){var r=fc(e,t),n=r.obj,o=r.k;if(n)return n[o]}function pc(e,t,r){var n=dc(e,r);return void 0!==n?n:dc(t,r)}function vc(e,t,r){for(var n in t)"__proto__"!==n&&"constructor"!==n&&(n in e?"string"==typeof e[n]||e[n]instanceof String||"string"==typeof t[n]||t[n]instanceof String?r&&(e[n]=t[n]):vc(e[n],t[n],r):e[n]=t[n]);return e}function yc(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var gc={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function mc(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,(function(e){return gc[e]})):e}var kc="undefined"!=typeof window&&window.navigator&&void 0===window.navigator.userAgentData&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,bc=[" ",",","?","!",";"];function _c(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(e){if(e[t])return e[t];for(var n=t.split(r),o=e,i=0;i<n.length;++i){if(!o)return;if("string"==typeof o[n[i]]&&i+1<n.length)return;if(void 0===o[n[i]]){for(var a=2,s=n.slice(i,i+a).join(r),u=o[s];void 0===u&&n.length>i+a;)a++,u=o[s=n.slice(i,i+a).join(r)];if(void 0===u)return;if(null===u)return null;if(t.endsWith(s)){if("string"==typeof u)return u;if(s&&"string"==typeof u[s])return u[s]}var c=n.slice(i+a).join(r);return c?_c(u,c,r):void 0}o=o[n[i]]}return o}}function wc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function xc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?wc(Object(r),!0).forEach((function(t){Zu(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):wc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Oc(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Xu(e);if(t){var o=Xu(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Qu(this,r)}}var Ac=function(e){Gu(r,sc);var t=Oc(r);function r(e){var n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return Vu(this,r),n=t.call(this),kc&&sc.call($u(n)),n.data=e||{},n.options=o,void 0===n.options.keySeparator&&(n.options.keySeparator="."),void 0===n.options.ignoreJSONStructure&&(n.options.ignoreJSONStructure=!0),n}return Hu(r,[{key:"addNamespaces",value:function(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}},{key:"removeNamespaces",value:function(e){var t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}},{key:"getResource",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator,i=void 0!==n.ignoreJSONStructure?n.ignoreJSONStructure:this.options.ignoreJSONStructure,a=[e,t];r&&"string"!=typeof r&&(a=a.concat(r)),r&&"string"==typeof r&&(a=a.concat(o?r.split(o):r)),e.indexOf(".")>-1&&(a=e.split("."));var s=dc(this.data,a);return s||!i||"string"!=typeof r?s:_c(this.data&&this.data[e]&&this.data[e][t],r,o)}},{key:"addResource",value:function(e,t,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},i=this.options.keySeparator;void 0===i&&(i=".");var a=[e,t];r&&(a=a.concat(i?r.split(i):r)),e.indexOf(".")>-1&&(n=t,t=(a=e.split("."))[1]),this.addNamespaces(t),hc(this.data,a,n),o.silent||this.emit("added",e,t,r,n)}},{key:"addResources",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var o in r)"string"!=typeof r[o]&&"[object Array]"!==Object.prototype.toString.apply(r[o])||this.addResource(e,t,o,r[o],{silent:!0});n.silent||this.emit("added",e,t,r)}},{key:"addResourceBundle",value:function(e,t,r,n,o){var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},a=[e,t];e.indexOf(".")>-1&&(n=r,r=t,t=(a=e.split("."))[1]),this.addNamespaces(t);var s=dc(this.data,a)||{};n?vc(s,r,o):s=xc(xc({},s),r),hc(this.data,a,s),i.silent||this.emit("added",e,t,r)}},{key:"removeResourceBundle",value:function(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}},{key:"hasResourceBundle",value:function(e,t){return void 0!==this.getResource(e,t)}},{key:"getResourceBundle",value:function(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?xc(xc({},{}),this.getResource(e,t)):this.getResource(e,t)}},{key:"getDataByLanguage",value:function(e){return this.data[e]}},{key:"hasLanguageSomeTranslations",value:function(e){var t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find((function(e){return t[e]&&Object.keys(t[e]).length>0}))}},{key:"toJSON",value:function(){return this.data}}]),r}(),Sc={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,r,n,o){var i=this;return e.forEach((function(e){i.processors[e]&&(t=i.processors[e].process(t,r,n,o))})),t}};function Ec(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Nc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ec(Object(r),!0).forEach((function(t){Zu(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ec(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Tc(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Xu(e);if(t){var o=Xu(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Qu(this,r)}}var jc={},Pc=function(e){Gu(r,sc);var t=Tc(r);function r(e){var n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Vu(this,r),n=t.call(this),kc&&sc.call($u(n)),lc(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,$u(n)),n.options=o,void 0===n.options.keySeparator&&(n.options.keySeparator="."),n.logger=ac.create("translator"),n}return Hu(r,[{key:"changeLanguage",value:function(e){e&&(this.language=e)}},{key:"exists",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==e)return!1;var r=this.resolve(e,t);return r&&void 0!==r.res}},{key:"extractFromKey",value:function(e,t){var r=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===r&&(r=":");var n=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,o=t.ns||this.options.defaultNS||[],i=r&&e.indexOf(r)>-1,a=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||function(e,t,r){t=t||"",r=r||"";var n=bc.filter((function(e){return t.indexOf(e)<0&&r.indexOf(e)<0}));if(0===n.length)return!0;var o=new RegExp("(".concat(n.map((function(e){return"?"===e?"\\?":e})).join("|"),")")),i=!o.test(e);if(!i){var a=e.indexOf(r);a>0&&!o.test(e.substring(0,a))&&(i=!0)}return i}(e,r,n));if(i&&!a){var s=e.match(this.interpolator.nestingRegexp);if(s&&s.length>0)return{key:e,namespaces:o};var u=e.split(r);(r!==n||r===n&&this.options.ns.indexOf(u[0])>-1)&&(o=u.shift()),e=u.join(n)}return"string"==typeof o&&(o=[o]),{key:e,namespaces:o}}},{key:"translate",value:function(e,t,n){var o=this;if("object"!==Uu(t)&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),"object"===Uu(t)&&(t=Nc({},t)),t||(t={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);var i=void 0!==t.returnDetails?t.returnDetails:this.options.returnDetails,a=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,s=this.extractFromKey(e[e.length-1],t),u=s.key,c=s.namespaces,l=c[c.length-1],f=t.lng||this.language,h=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(f&&"cimode"===f.toLowerCase()){if(h){var d=t.nsSeparator||this.options.nsSeparator;return i?{res:"".concat(l).concat(d).concat(u),usedKey:u,exactUsedKey:u,usedLng:f,usedNS:l}:"".concat(l).concat(d).concat(u)}return i?{res:u,usedKey:u,exactUsedKey:u,usedLng:f,usedNS:l}:u}var p=this.resolve(e,t),v=p&&p.res,y=p&&p.usedKey||u,g=p&&p.exactUsedKey||u,m=Object.prototype.toString.apply(v),k=["[object Number]","[object Function]","[object RegExp]"],b=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,_=!this.i18nFormat||this.i18nFormat.handleAsObject,w="string"!=typeof v&&"boolean"!=typeof v&&"number"!=typeof v;if(_&&v&&w&&k.indexOf(m)<0&&("string"!=typeof b||"[object Array]"!==m)){if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var x=this.options.returnedObjectHandler?this.options.returnedObjectHandler(y,v,Nc(Nc({},t),{},{ns:c})):"key '".concat(u," (").concat(this.language,")' returned an object instead of string.");return i?(p.res=x,p):x}if(a){var O="[object Array]"===m,A=O?[]:{},S=O?g:y;for(var E in v)if(Object.prototype.hasOwnProperty.call(v,E)){var N="".concat(S).concat(a).concat(E);A[E]=this.translate(N,Nc(Nc({},t),{joinArrays:!1,ns:c})),A[E]===N&&(A[E]=v[E])}v=A}}else if(_&&"string"==typeof b&&"[object Array]"===m)(v=v.join(b))&&(v=this.extendTranslation(v,e,t,n));else{var T=!1,j=!1,P=void 0!==t.count&&"string"!=typeof t.count,C=r.hasDefaultValue(t),B=P?this.pluralResolver.getSuffix(f,t.count,t):"",z=t["defaultValue".concat(B)]||t.defaultValue;!this.isValidLookup(v)&&C&&(T=!0,v=z),this.isValidLookup(v)||(j=!0,v=u);var R=t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,L=R&&j?void 0:v,K=C&&z!==v&&this.options.updateMissing;if(j||T||K){if(this.logger.log(K?"updateKey":"missingKey",f,l,u,K?z:v),a){var F=this.resolve(u,Nc(Nc({},t),{},{keySeparator:!1}));F&&F.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var I=[],D=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if("fallback"===this.options.saveMissingTo&&D&&D[0])for(var M=0;M<D.length;M++)I.push(D[M]);else"all"===this.options.saveMissingTo?I=this.languageUtils.toResolveHierarchy(t.lng||this.language):I.push(t.lng||this.language);var J=function(e,r,n){var i=C&&n!==v?n:L;o.options.missingKeyHandler?o.options.missingKeyHandler(e,l,r,i,K,t):o.backendConnector&&o.backendConnector.saveMissing&&o.backendConnector.saveMissing(e,l,r,i,K,t),o.emit("missingKey",e,l,r,v)};this.options.saveMissing&&(this.options.saveMissingPlurals&&P?I.forEach((function(e){o.pluralResolver.getSuffixes(e,t).forEach((function(r){J([e],u+r,t["defaultValue".concat(r)]||z)}))})):J(I,u,z))}v=this.extendTranslation(v,e,t,p,n),j&&v===u&&this.options.appendNamespaceToMissingKey&&(v="".concat(l,":").concat(u)),(j||T)&&this.options.parseMissingKeyHandler&&(v="v1"!==this.options.compatibilityAPI?this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?"".concat(l,":").concat(u):u,T?v:void 0):this.options.parseMissingKeyHandler(v))}return i?(p.res=v,p):v}},{key:"extendTranslation",value:function(e,t,r,n,o){var i=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,Nc(Nc({},this.options.interpolation.defaultVariables),r),n.usedLng,n.usedNS,n.usedKey,{resolved:n});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init(Nc(Nc({},r),{interpolation:Nc(Nc({},this.options.interpolation),r.interpolation)}));var a,s="string"==typeof e&&(r&&r.interpolation&&void 0!==r.interpolation.skipOnVariables?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);if(s){var u=e.match(this.interpolator.nestingRegexp);a=u&&u.length}var c=r.replace&&"string"!=typeof r.replace?r.replace:r;if(this.options.interpolation.defaultVariables&&(c=Nc(Nc({},this.options.interpolation.defaultVariables),c)),e=this.interpolator.interpolate(e,c,r.lng||this.language,r),s){var l=e.match(this.interpolator.nestingRegexp);a<(l&&l.length)&&(r.nest=!1)}!r.lng&&"v1"!==this.options.compatibilityAPI&&n&&n.res&&(r.lng=n.usedLng),!1!==r.nest&&(e=this.interpolator.nest(e,(function(){for(var e=arguments.length,n=new Array(e),a=0;a<e;a++)n[a]=arguments[a];return o&&o[0]===n[0]&&!r.context?(i.logger.warn("It seems you are nesting recursively key: ".concat(n[0]," in key: ").concat(t[0])),null):i.translate.apply(i,n.concat([t]))}),r)),r.interpolation&&this.interpolator.reset()}var f=r.postProcess||this.options.postProcess,h="string"==typeof f?[f]:f;return null!=e&&h&&h.length&&!1!==r.applyPostProcessor&&(e=Sc.handle(h,e,t,this.options&&this.options.postProcessPassResolved?Nc({i18nResolved:n},r):r,this)),e}},{key:"resolve",value:function(e){var t,r,n,o,i,a=this,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof e&&(e=[e]),e.forEach((function(e){if(!a.isValidLookup(t)){var u=a.extractFromKey(e,s),c=u.key;r=c;var l=u.namespaces;a.options.fallbackNS&&(l=l.concat(a.options.fallbackNS));var f=void 0!==s.count&&"string"!=typeof s.count,h=f&&!s.ordinal&&0===s.count&&a.pluralResolver.shouldUseIntlApi(),d=void 0!==s.context&&("string"==typeof s.context||"number"==typeof s.context)&&""!==s.context,p=s.lngs?s.lngs:a.languageUtils.toResolveHierarchy(s.lng||a.language,s.fallbackLng);l.forEach((function(e){a.isValidLookup(t)||(i=e,!jc["".concat(p[0],"-").concat(e)]&&a.utils&&a.utils.hasLoadedNamespace&&!a.utils.hasLoadedNamespace(i)&&(jc["".concat(p[0],"-").concat(e)]=!0,a.logger.warn('key "'.concat(r,'" for languages "').concat(p.join(", "),'" won\'t get resolved as namespace "').concat(i,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),p.forEach((function(r){if(!a.isValidLookup(t)){o=r;var i,u=[c];if(a.i18nFormat&&a.i18nFormat.addLookupKeys)a.i18nFormat.addLookupKeys(u,c,r,e,s);else{var l;f&&(l=a.pluralResolver.getSuffix(r,s.count,s));var p="".concat(a.options.pluralSeparator,"zero");if(f&&(u.push(c+l),h&&u.push(c+p)),d){var v="".concat(c).concat(a.options.contextSeparator).concat(s.context);u.push(v),f&&(u.push(v+l),h&&u.push(v+p))}}for(;i=u.pop();)a.isValidLookup(t)||(n=i,t=a.getResource(r,e,i,s))}})))}))}})),{res:t,usedKey:r,exactUsedKey:n,usedLng:o,usedNS:i}}},{key:"isValidLookup",value:function(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}},{key:"getResource",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,r,n):this.resourceStore.getResource(e,t,r,n)}}],[{key:"hasDefaultValue",value:function(e){var t="defaultValue";for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t===r.substring(0,t.length)&&void 0!==e[r])return!0;return!1}}]),r}();function Cc(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Bc=function(){function e(t){Vu(this,e),this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ac.create("languageUtils")}return Hu(e,[{key:"getScriptPartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return null;var t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}},{key:"getLanguagePartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return e;var t=e.split("-");return this.formatLanguageCode(t[0])}},{key:"formatLanguageCode",value:function(e){if("string"==typeof e&&e.indexOf("-")>-1){var t=["hans","hant","latn","cyrl","cans","mong","arab"],r=e.split("-");return this.options.lowerCaseLng?r=r.map((function(e){return e.toLowerCase()})):2===r.length?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),t.indexOf(r[1].toLowerCase())>-1&&(r[1]=Cc(r[1].toLowerCase()))):3===r.length&&(r[0]=r[0].toLowerCase(),2===r[1].length&&(r[1]=r[1].toUpperCase()),"sgn"!==r[0]&&2===r[2].length&&(r[2]=r[2].toUpperCase()),t.indexOf(r[1].toLowerCase())>-1&&(r[1]=Cc(r[1].toLowerCase())),t.indexOf(r[2].toLowerCase())>-1&&(r[2]=Cc(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}},{key:"isSupportedCode",value:function(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}},{key:"getBestMatchFromCodes",value:function(e){var t,r=this;return e?(e.forEach((function(e){if(!t){var n=r.formatLanguageCode(e);r.options.supportedLngs&&!r.isSupportedCode(n)||(t=n)}})),!t&&this.options.supportedLngs&&e.forEach((function(e){if(!t){var n=r.getLanguagePartFromCode(e);if(r.isSupportedCode(n))return t=n;t=r.options.supportedLngs.find((function(e){return e===n?e:e.indexOf("-")<0&&n.indexOf("-")<0?void 0:0===e.indexOf(n)?e:void 0}))}})),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t):null}},{key:"getFallbackCodes",value:function(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),"string"==typeof e&&(e=[e]),"[object Array]"===Object.prototype.toString.apply(e))return e;if(!t)return e.default||[];var r=e[t];return r||(r=e[this.getScriptPartFromCode(t)]),r||(r=e[this.formatLanguageCode(t)]),r||(r=e[this.getLanguagePartFromCode(t)]),r||(r=e.default),r||[]}},{key:"toResolveHierarchy",value:function(e,t){var r=this,n=this.getFallbackCodes(t||this.options.fallbackLng||[],e),o=[],i=function(e){e&&(r.isSupportedCode(e)?o.push(e):r.logger.warn("rejecting language code not found in supportedLngs: ".concat(e)))};return"string"==typeof e&&e.indexOf("-")>-1?("languageOnly"!==this.options.load&&i(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&i(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&i(this.getLanguagePartFromCode(e))):"string"==typeof e&&i(this.formatLanguageCode(e)),n.forEach((function(e){o.indexOf(e)<0&&i(r.formatLanguageCode(e))})),o}}]),e}(),zc=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],Rc={1:function(e){return Number(e>1)},2:function(e){return Number(1!=e)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(1==e?0:e>=2&&e<=4?1:2)},7:function(e){return Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(1==e?0:2==e?1:e<7?2:e<11?3:4)},11:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(0!==e)},14:function(e){return Number(1==e?0:2==e?1:3==e?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)},17:function(e){return Number(1==e||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(0==e?0:1==e?1:2)},19:function(e){return Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(1==e?0:0==e||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)}},Lc=["v1","v2","v3"],Kc={zero:0,one:1,two:2,few:3,many:4,other:5};function Fc(){var e={};return zc.forEach((function(t){t.lngs.forEach((function(r){e[r]={numbers:t.nr,plurals:Rc[t.fc]}}))})),e}var Ic=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Vu(this,e),this.languageUtils=t,this.options=r,this.logger=ac.create("pluralResolver"),this.options.compatibilityJSON&&"v4"!==this.options.compatibilityJSON||"undefined"!=typeof Intl&&Intl.PluralRules||(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=Fc()}return Hu(e,[{key:"addRule",value:function(e,t){this.rules[e]=t}},{key:"getRule",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(e,{type:t.ordinal?"ordinal":"cardinal"})}catch(e){return}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}},{key:"needsPlural",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.getRule(e,t);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(e,r).map((function(e){return"".concat(t).concat(e)}))}},{key:"getSuffixes",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.getRule(e,r);return n?this.shouldUseIntlApi()?n.resolvedOptions().pluralCategories.sort((function(e,t){return Kc[e]-Kc[t]})).map((function(e){return"".concat(t.options.prepend).concat(e)})):n.numbers.map((function(n){return t.getSuffix(e,n,r)})):[]}},{key:"getSuffix",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=this.getRule(e,r);return n?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(n.select(t)):this.getSuffixRetroCompatible(n,t):(this.logger.warn("no plural rule found for: ".concat(e)),"")}},{key:"getSuffixRetroCompatible",value:function(e,t){var r=this,n=e.noAbs?e.plurals(t):e.plurals(Math.abs(t)),o=e.numbers[n];this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]&&(2===o?o="plural":1===o&&(o=""));var i=function(){return r.options.prepend&&o.toString()?r.options.prepend+o.toString():o.toString()};return"v1"===this.options.compatibilityJSON?1===o?"":"number"==typeof o?"_plural_".concat(o.toString()):i():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]?i():this.options.prepend&&n.toString()?this.options.prepend+n.toString():n.toString()}},{key:"shouldUseIntlApi",value:function(){return!Lc.includes(this.options.compatibilityJSON)}}]),e}();function Dc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Mc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Dc(Object(r),!0).forEach((function(t){Zu(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Dc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Jc(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:".",o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=pc(e,t,r);return!i&&o&&"string"==typeof r&&void 0===(i=_c(e,r,n))&&(i=_c(t,r,n)),i}var Uc=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Vu(this,e),this.logger=ac.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return Hu(e,[{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});var t=e.interpolation;this.escape=void 0!==t.escape?t.escape:mc,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?yc(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?yc(t.suffix):t.suffixEscaped||"}}",this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||",",this.unescapePrefix=t.unescapeSuffix?"":t.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":t.unescapeSuffix||"",this.nestingPrefix=t.nestingPrefix?yc(t.nestingPrefix):t.nestingPrefixEscaped||yc("$t("),this.nestingSuffix=t.nestingSuffix?yc(t.nestingSuffix):t.nestingSuffixEscaped||yc(")"),this.nestingOptionsSeparator=t.nestingOptionsSeparator?t.nestingOptionsSeparator:t.nestingOptionsSeparator||",",this.maxReplaces=t.maxReplaces?t.maxReplaces:1e3,this.alwaysFormat=void 0!==t.alwaysFormat&&t.alwaysFormat,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var e="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(e,"g");var t="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(t,"g");var r="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(r,"g")}},{key:"interpolate",value:function(e,t,r,n){var o,i,a,s=this,u=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function c(e){return e.replace(/\$/g,"$$$$")}var l=function(e){if(e.indexOf(s.formatSeparator)<0){var o=Jc(t,u,e,s.options.keySeparator,s.options.ignoreJSONStructure);return s.alwaysFormat?s.format(o,void 0,r,Mc(Mc(Mc({},n),t),{},{interpolationkey:e})):o}var i=e.split(s.formatSeparator),a=i.shift().trim(),c=i.join(s.formatSeparator).trim();return s.format(Jc(t,u,a,s.options.keySeparator,s.options.ignoreJSONStructure),c,r,Mc(Mc(Mc({},n),t),{},{interpolationkey:a}))};this.resetRegExp();var f=n&&n.missingInterpolationHandler||this.options.missingInterpolationHandler,h=n&&n.interpolation&&void 0!==n.interpolation.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:function(e){return c(e)}},{regex:this.regexp,safeValue:function(e){return s.escapeValue?c(s.escape(e)):c(e)}}].forEach((function(t){for(a=0;o=t.regex.exec(e);){var r=o[1].trim();if(void 0===(i=l(r)))if("function"==typeof f){var u=f(e,o,n);i="string"==typeof u?u:""}else if(n&&Object.prototype.hasOwnProperty.call(n,r))i="";else{if(h){i=o[0];continue}s.logger.warn("missed to pass in variable ".concat(r," for interpolating ").concat(e)),i=""}else"string"==typeof i||s.useRawValueToEscape||(i=cc(i));var c=t.safeValue(i);if(e=e.replace(o[0],c),h?(t.regex.lastIndex+=i.length,t.regex.lastIndex-=o[0].length):t.regex.lastIndex=0,++a>=s.maxReplaces)break}})),e}},{key:"nest",value:function(e,t){var r,n,o,i=this,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};function s(e,t){var r=this.nestingOptionsSeparator;if(e.indexOf(r)<0)return e;var n=e.split(new RegExp("".concat(r,"[ ]*{"))),i="{".concat(n[1]);e=n[0];var a=(i=this.interpolate(i,o)).match(/'/g),s=i.match(/"/g);(a&&a.length%2==0&&!s||s.length%2!=0)&&(i=i.replace(/'/g,'"'));try{o=JSON.parse(i),t&&(o=Mc(Mc({},t),o))}catch(t){return this.logger.warn("failed parsing options string in nesting for key ".concat(e),t),"".concat(e).concat(r).concat(i)}return delete o.defaultValue,e}for(;r=this.nestingRegexp.exec(e);){var u=[];(o=(o=Mc({},a)).replace&&"string"!=typeof o.replace?o.replace:o).applyPostProcessor=!1,delete o.defaultValue;var c=!1;if(-1!==r[0].indexOf(this.formatSeparator)&&!/{.*}/.test(r[1])){var l=r[1].split(this.formatSeparator).map((function(e){return e.trim()}));r[1]=l.shift(),u=l,c=!0}if((n=t(s.call(this,r[1].trim(),o),o))&&r[0]===e&&"string"!=typeof n)return n;"string"!=typeof n&&(n=cc(n)),n||(this.logger.warn("missed to resolve ".concat(r[1]," for nesting ").concat(e)),n=""),c&&(n=u.reduce((function(e,t){return i.format(e,t,a.lng,Mc(Mc({},a),{},{interpolationkey:r[1].trim()}))}),n.trim())),e=e.replace(r[0],n),this.regexp.lastIndex=0}return e}}]),e}();function Vc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function qc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Vc(Object(r),!0).forEach((function(t){Zu(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Vc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Wc(e){var t=e.toLowerCase().trim(),r={};if(e.indexOf("(")>-1){var n=e.split("(");t=n[0].toLowerCase().trim();var o=n[1].substring(0,n[1].length-1);if("currency"===t&&o.indexOf(":")<0)r.currency||(r.currency=o.trim());else if("relativetime"===t&&o.indexOf(":")<0)r.range||(r.range=o.trim());else{o.split(";").forEach((function(e){if(e){var t=tc(e.split(":")),n=t[0],o=t.slice(1).join(":").trim().replace(/^'+|'+$/g,"");r[n.trim()]||(r[n.trim()]=o),"false"===o&&(r[n.trim()]=!1),"true"===o&&(r[n.trim()]=!0),isNaN(o)||(r[n.trim()]=parseInt(o,10))}}))}}return{formatName:t,formatOptions:r}}function Hc(e){var t={};return function(r,n,o){var i=n+JSON.stringify(o),a=t[i];return a||(a=e(n,o),t[i]=a),a(r)}}var $c=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Vu(this,e),this.logger=ac.create("formatter"),this.options=t,this.formats={number:Hc((function(e,t){var r=new Intl.NumberFormat(e,qc({},t));return function(e){return r.format(e)}})),currency:Hc((function(e,t){var r=new Intl.NumberFormat(e,qc(qc({},t),{},{style:"currency"}));return function(e){return r.format(e)}})),datetime:Hc((function(e,t){var r=new Intl.DateTimeFormat(e,qc({},t));return function(e){return r.format(e)}})),relativetime:Hc((function(e,t){var r=new Intl.RelativeTimeFormat(e,qc({},t));return function(e){return r.format(e,t.range||"day")}})),list:Hc((function(e,t){var r=new Intl.ListFormat(e,qc({},t));return function(e){return r.format(e)}}))},this.init(t)}return Hu(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}},r=t.interpolation;this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||","}},{key:"add",value:function(e,t){this.formats[e.toLowerCase().trim()]=t}},{key:"addCached",value:function(e,t){this.formats[e.toLowerCase().trim()]=Hc(t)}},{key:"format",value:function(e,t,r){var n=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=t.split(this.formatSeparator),a=i.reduce((function(e,t){var i=Wc(t),a=i.formatName,s=i.formatOptions;if(n.formats[a]){var u=e;try{var c=o&&o.formatParams&&o.formatParams[o.interpolationkey]||{},l=c.locale||c.lng||o.locale||o.lng||r;u=n.formats[a](e,l,qc(qc(qc({},s),o),c))}catch(e){n.logger.warn(e)}return u}return n.logger.warn("there was no format function for ".concat(a)),e}),e);return a}}]),e}();function Yc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Gc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Yc(Object(r),!0).forEach((function(t){Zu(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Yc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Qc(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Xu(e);if(t){var o=Xu(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Qu(this,r)}}var Xc=function(e){Gu(r,sc);var t=Qc(r);function r(e,n,o){var i,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return Vu(this,r),i=t.call(this),kc&&sc.call($u(i)),i.backend=e,i.store=n,i.services=o,i.languageUtils=o.languageUtils,i.options=a,i.logger=ac.create("backendConnector"),i.waitingReads=[],i.maxParallelReads=a.maxParallelReads||10,i.readingCalls=0,i.maxRetries=a.maxRetries>=0?a.maxRetries:5,i.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,i.state={},i.queue=[],i.backend&&i.backend.init&&i.backend.init(o,a.backend,a),i}return Hu(r,[{key:"queueLoad",value:function(e,t,r,n){var o=this,i={},a={},s={},u={};return e.forEach((function(e){var n=!0;t.forEach((function(t){var s="".concat(e,"|").concat(t);!r.reload&&o.store.hasResourceBundle(e,t)?o.state[s]=2:o.state[s]<0||(1===o.state[s]?void 0===a[s]&&(a[s]=!0):(o.state[s]=1,n=!1,void 0===a[s]&&(a[s]=!0),void 0===i[s]&&(i[s]=!0),void 0===u[t]&&(u[t]=!0)))})),n||(s[e]=!0)})),(Object.keys(i).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:n}),{toLoad:Object.keys(i),pending:Object.keys(a),toLoadLanguages:Object.keys(s),toLoadNamespaces:Object.keys(u)}}},{key:"loaded",value:function(e,t,r){var n=e.split("|"),o=n[0],i=n[1];t&&this.emit("failedLoading",o,i,t),r&&this.store.addResourceBundle(o,i,r),this.state[e]=t?-1:2;var a={};this.queue.forEach((function(r){var n,s,u,c,l,f;n=r.loaded,s=i,c=fc(n,[o],Object),l=c.obj,f=c.k,l[f]=l[f]||[],u&&(l[f]=l[f].concat(s)),u||l[f].push(s),function(e,t){void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)}(r,e),t&&r.errors.push(t),0!==r.pendingCount||r.done||(Object.keys(r.loaded).forEach((function(e){a[e]||(a[e]={});var t=r.loaded[e];t.length&&t.forEach((function(t){void 0===a[e][t]&&(a[e][t]=!0)}))})),r.done=!0,r.errors.length?r.callback(r.errors):r.callback())})),this.emit("loaded",a),this.queue=this.queue.filter((function(e){return!e.done}))}},{key:"read",value:function(e,t,r){var n=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads)this.waitingReads.push({lng:e,ns:t,fcName:r,tried:o,wait:i,callback:a});else{this.readingCalls++;var s=function(s,u){if(n.readingCalls--,n.waitingReads.length>0){var c=n.waitingReads.shift();n.read(c.lng,c.ns,c.fcName,c.tried,c.wait,c.callback)}s&&u&&o<n.maxRetries?setTimeout((function(){n.read.call(n,e,t,r,o+1,2*i,a)}),i):a(s,u)},u=this.backend[r].bind(this.backend);if(2!==u.length)return u(e,t,s);try{var c=u(e,t);c&&"function"==typeof c.then?c.then((function(e){return s(null,e)})).catch(s):s(null,c)}catch(e){s(e)}}}},{key:"prepareLoading",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),o&&o();"string"==typeof e&&(e=this.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]);var i=this.queueLoad(e,t,n,o);if(!i.toLoad.length)return i.pending.length||o(),null;i.toLoad.forEach((function(e){r.loadOne(e)}))}},{key:"load",value:function(e,t,r){this.prepareLoading(e,t,{},r)}},{key:"reload",value:function(e,t,r){this.prepareLoading(e,t,{reload:!0},r)}},{key:"loadOne",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=e.split("|"),o=n[0],i=n[1];this.read(o,i,"read",void 0,void 0,(function(n,a){n&&t.logger.warn("".concat(r,"loading namespace ").concat(i," for language ").concat(o," failed"),n),!n&&a&&t.logger.log("".concat(r,"loaded namespace ").concat(i," for language ").concat(o),a),t.loaded(e,n,a)}))}},{key:"saveMissing",value:function(e,t,r,n,o){var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:function(){};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t))this.logger.warn('did not save key "'.concat(r,'" as the namespace "').concat(t,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");else if(null!=r&&""!==r){if(this.backend&&this.backend.create){var s=Gc(Gc({},i),{},{isUpdate:o}),u=this.backend.create.bind(this.backend);if(u.length<6)try{var c;(c=5===u.length?u(e,t,r,n,s):u(e,t,r,n))&&"function"==typeof c.then?c.then((function(e){return a(null,e)})).catch(a):a(null,c)}catch(e){a(e)}else u(e,t,r,n,a,s)}e&&e[0]&&this.store.addResource(e[0],t,r,n)}}}]),r}();function Zc(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if("object"===Uu(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===Uu(e[2])||"object"===Uu(e[3])){var r=e[3]||e[2];Object.keys(r).forEach((function(e){t[e]=r[e]}))}return t},interpolation:{escapeValue:!0,format:function(e,t,r,n){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function el(e){return"string"==typeof e.ns&&(e.ns=[e.ns]),"string"==typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"==typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function tl(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function rl(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?tl(Object(r),!0).forEach((function(t){Zu(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):tl(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function nl(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Xu(e);if(t){var o=Xu(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Qu(this,r)}}function ol(){}function il(e){Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((function(t){"function"==typeof e[t]&&(e[t]=e[t].bind(e))}))}var al=function(e){Gu(r,sc);var t=nl(r);function r(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;if(Vu(this,r),e=t.call(this),kc&&sc.call($u(e)),e.options=el(n),e.services={},e.logger=ac,e.modules={external:[]},il($u(e)),o&&!e.isInitialized&&!n.isClone){if(!e.options.initImmediate)return e.init(n,o),Qu(e,$u(e));setTimeout((function(){e.init(n,o)}),0)}return e}return Hu(r,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;"function"==typeof t&&(r=t,t={}),!t.defaultNS&&!1!==t.defaultNS&&t.ns&&("string"==typeof t.ns?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));var n=Zc();function o(e){return e?"function"==typeof e?new e:e:null}if(this.options=rl(rl(rl({},n),this.options),el(t)),"v1"!==this.options.compatibilityAPI&&(this.options.interpolation=rl(rl({},n.interpolation),this.options.interpolation)),void 0!==t.keySeparator&&(this.options.userDefinedKeySeparator=t.keySeparator),void 0!==t.nsSeparator&&(this.options.userDefinedNsSeparator=t.nsSeparator),!this.options.isClone){var i;this.modules.logger?ac.init(o(this.modules.logger),this.options):ac.init(null,this.options),this.modules.formatter?i=this.modules.formatter:"undefined"!=typeof Intl&&(i=$c);var a=new Bc(this.options);this.store=new Ac(this.options.resources,this.options);var s=this.services;s.logger=ac,s.resourceStore=this.store,s.languageUtils=a,s.pluralResolver=new Ic(a,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!i||this.options.interpolation.format&&this.options.interpolation.format!==n.interpolation.format||(s.formatter=o(i),s.formatter.init(s,this.options),this.options.interpolation.format=s.formatter.format.bind(s.formatter)),s.interpolator=new Uc(this.options),s.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},s.backendConnector=new Xc(o(this.modules.backend),s.resourceStore,s,this.options),s.backendConnector.on("*",(function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];e.emit.apply(e,[t].concat(n))})),this.modules.languageDetector&&(s.languageDetector=o(this.modules.languageDetector),s.languageDetector.init&&s.languageDetector.init(s,this.options.detection,this.options)),this.modules.i18nFormat&&(s.i18nFormat=o(this.modules.i18nFormat),s.i18nFormat.init&&s.i18nFormat.init(this)),this.translator=new Pc(this.services,this.options),this.translator.on("*",(function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];e.emit.apply(e,[t].concat(n))})),this.modules.external.forEach((function(t){t.init&&t.init(e)}))}if(this.format=this.options.interpolation.format,r||(r=ol),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){var u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.length>0&&"dev"!==u[0]&&(this.options.lng=u[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");var c=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];c.forEach((function(t){e[t]=function(){var r;return(r=e.store)[t].apply(r,arguments)}}));var l=["addResource","addResources","addResourceBundle","removeResourceBundle"];l.forEach((function(t){e[t]=function(){var r;return(r=e.store)[t].apply(r,arguments),e}}));var f=uc(),h=function(){var t=function(t,n){e.isInitialized&&!e.initializedStoreOnce&&e.logger.warn("init: i18next is already initialized. You should call init just once!"),e.isInitialized=!0,e.options.isClone||e.logger.log("initialized",e.options),e.emit("initialized",e.options),f.resolve(n),r(t,n)};if(e.languages&&"v1"!==e.options.compatibilityAPI&&!e.isInitialized)return t(null,e.t.bind(e));e.changeLanguage(e.options.lng,t)};return this.options.resources||!this.options.initImmediate?h():setTimeout(h,0),f}},{key:"loadResources",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ol,n=r,o="string"==typeof e?e:this.language;if("function"==typeof e&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(o&&"cimode"===o.toLowerCase())return n();var i=[],a=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach((function(e){i.indexOf(e)<0&&i.push(e)}))};if(o)a(o);else{var s=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);s.forEach((function(e){return a(e)}))}this.options.preload&&this.options.preload.forEach((function(e){return a(e)})),this.services.backendConnector.load(i,this.options.ns,(function(e){e||t.resolvedLanguage||!t.language||t.setResolvedLanguage(t.language),n(e)}))}else n(null)}},{key:"reloadResources",value:function(e,t,r){var n=uc();return e||(e=this.languages),t||(t=this.options.ns),r||(r=ol),this.services.backendConnector.reload(e,t,(function(e){n.resolve(),r(e)})),n}},{key:"use",value:function(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&Sc.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}},{key:"setResolvedLanguage",value:function(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1))for(var t=0;t<this.languages.length;t++){var r=this.languages[t];if(!(["cimode","dev"].indexOf(r)>-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}},{key:"changeLanguage",value:function(e,t){var r=this;this.isLanguageChangingTo=e;var n=uc();this.emit("languageChanging",e);var o=function(e){r.language=e,r.languages=r.services.languageUtils.toResolveHierarchy(e),r.resolvedLanguage=void 0,r.setResolvedLanguage(e)},i=function(i){e||i||!r.services.languageDetector||(i=[]);var a="string"==typeof i?i:r.services.languageUtils.getBestMatchFromCodes(i);a&&(r.language||o(a),r.translator.language||r.translator.changeLanguage(a),r.services.languageDetector&&r.services.languageDetector.cacheUserLanguage&&r.services.languageDetector.cacheUserLanguage(a)),r.loadResources(a,(function(e){!function(e,i){i?(o(i),r.translator.changeLanguage(i),r.isLanguageChangingTo=void 0,r.emit("languageChanged",i),r.logger.log("languageChanged",i)):r.isLanguageChangingTo=void 0,n.resolve((function(){return r.t.apply(r,arguments)})),t&&t(e,(function(){return r.t.apply(r,arguments)}))}(e,a)}))};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(i):this.services.languageDetector.detect(i):i(e):i(this.services.languageDetector.detect()),n}},{key:"getFixedT",value:function(e,t,r){var n=this,o=function e(t,o){var i;if("object"!==Uu(o)){for(var a=arguments.length,s=new Array(a>2?a-2:0),u=2;u<a;u++)s[u-2]=arguments[u];i=n.options.overloadTranslationOptionHandler([t,o].concat(s))}else i=rl({},o);i.lng=i.lng||e.lng,i.lngs=i.lngs||e.lngs,i.ns=i.ns||e.ns,i.keyPrefix=i.keyPrefix||r||e.keyPrefix;var c,l=n.options.keySeparator||".";return c=i.keyPrefix&&Array.isArray(t)?t.map((function(e){return"".concat(i.keyPrefix).concat(l).concat(e)})):i.keyPrefix?"".concat(i.keyPrefix).concat(l).concat(t):t,n.t(c,i)};return"string"==typeof e?o.lng=e:o.lngs=e,o.ns=t,o.keyPrefix=r,o}},{key:"t",value:function(){var e;return this.translator&&(e=this.translator).translate.apply(e,arguments)}},{key:"exists",value:function(){var e;return this.translator&&(e=this.translator).exists.apply(e,arguments)}},{key:"setDefaultNamespace",value:function(e){this.options.defaultNS=e}},{key:"hasLoadedNamespace",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var n=r.lng||this.resolvedLanguage||this.languages[0],o=!!this.options&&this.options.fallbackLng,i=this.languages[this.languages.length-1];if("cimode"===n.toLowerCase())return!0;var a=function(e,r){var n=t.services.backendConnector.state["".concat(e,"|").concat(r)];return-1===n||2===n};if(r.precheck){var s=r.precheck(this,a);if(void 0!==s)return s}return!!this.hasResourceBundle(n,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!a(n,e)||o&&!a(i,e)))}},{key:"loadNamespaces",value:function(e,t){var r=this,n=uc();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach((function(e){r.options.ns.indexOf(e)<0&&r.options.ns.push(e)})),this.loadResources((function(e){n.resolve(),t&&t(e)})),n):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var r=uc();"string"==typeof e&&(e=[e]);var n=this.options.preload||[],o=e.filter((function(e){return n.indexOf(e)<0}));return o.length?(this.options.preload=n.concat(o),this.loadResources((function(e){r.resolve(),t&&t(e)})),r):(t&&t(),Promise.resolve())}},{key:"dir",value:function(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";var t=this.services&&this.services.languageUtils||new Bc(Zc());return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(t.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ol,o=rl(rl(rl({},this.options),t),{isClone:!0}),i=new r(o);void 0===t.debug&&void 0===t.prefix||(i.logger=i.logger.clone(t));var a=["store","services","language"];return a.forEach((function(t){i[t]=e[t]})),i.services=rl({},this.services),i.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},i.translator=new Pc(i.services,i.options),i.translator.on("*",(function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];i.emit.apply(i,[e].concat(r))})),i.init(o,n),i.translator.options=i.options,i.translator.backendConnector.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},i}},{key:"toJSON",value:function(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}]),r}();Zu(al,"createInstance",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return new al(e,t)}));var sl=al.createInstance();sl.createInstance=al.createInstance,sl.createInstance,sl.dir,sl.init,sl.loadResources,sl.reloadResources,sl.use,sl.changeLanguage,sl.getFixedT,sl.t,sl.exists,sl.setDefaultNamespace,sl.hasLoadedNamespace,sl.loadNamespaces,sl.loadLanguages;sl.init({fallbackLng:"en",lng:"en",debug:!0,resources:{en:{translation:{categorize:{limitMaxChoicesPerCategory:"You've reached the limit of {{maxChoicesPerCategory}} responses per area. To add another response, one must first be removed.",maxChoicesPerCategoryRestriction:"To change this value to {{maxChoicesPerCategory}}, each category must have {{maxChoicesPerCategory}} or fewer answer choice[s]."},ebsr:{part:"Part {{index}}"},numberLine:{addElementLimit_one:"You can only add {{count}} element",addElementLimit_other:"You can only add {{count}} elements",clearAll:"Clear all"},imageClozeAssociation:{reachedLimit_one:"You’ve reached the limit of {{count}} response per area. To add another response, one must first be removed.",reachedLimit_other:"Full"},drawingResponse:{fillColor:"Fill color",outlineColor:"Outline color",noFill:"No fill",lightblue:"Light blue",lightyellow:"Light yellow",red:"Red",orange:"Orange",yellow:"Yellow",violet:"Violet",blue:"Blue",green:"Green",white:"White",black:"Black",onDoubleClick:"Double click to edit this text. Press Enter to submit."},charting:{addCategory:"Add category",actions:"Actions",add:"Add",delete:"Delete",newLabel:"New label",reachedLimit_other:"There can't be more than {{count}} categories.",keyLegend:{incorrectAnswer:"Student incorrect answer",correctAnswer:"Student correct answer",correctKeyAnswer:"Answer key correct"}},graphing:{point:"Point",circle:"Circle",line:"Line",parabola:"Parabola",absolute:"Absolute Value",exponential:"Exponential",polygon:"Polygon",ray:"Ray",segment:"Segment",sine:"Sine",vector:"Vector",label:"Label",redo:"Redo",reset:"Reset"},mathInline:{primaryCorrectWithAlternates:"Note: The answer shown above is the primary correct answer specified by the author for this item, but other answers may also be recognized as correct."},multipleChoice:{minSelections:"Select at least {{minSelections}}.",maxSelections_one:"Only {{maxSelections}} answer is allowed.",maxSelections_other:"Only {{maxSelections}} answers are allowed.",minmaxSelections_equal:"Select {{minSelections}}.",minmaxSelections_range:"Select between {{minSelections}} and {{maxSelections}}."},selectText:{correctAnswerSelected:"Correct",correctAnswerNotSelected:"Correct Answer Not Selected",incorrectSelection:"Incorrect Selection",key:"Key"}},common:{undo:"Undo",clearAll:"Clear all",correct:"Correct",incorrect:"Incorrect",showCorrectAnswer:"Show correct answer",hideCorrectAnswer:"Hide correct answer",commonCorrectAnswerWithAlternates:"Note: The answer shown above is the most common correct answer for this item. One or more additional correct answers are also defined, and will also be recognized as correct.",warning:"Warning",showNote:"Show Note",hideNote:"Hide Note",cancel:"Cancel"}},es:{translation:{categorize:{limitMaxChoicesPerCategory:"Has alcanzado el límite de {{maxChoicesPerCategory}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.",maxChoicesPerCategoryRestriction:"Para cambiar este valor a {{maxChoicesPerCategory}}, cada categoría debe tener {{maxChoicesPerCategory}} o menos opciones de respuesta"},ebsr:{part:"Parte {{index}}"},numberLine:{addElementLimit_one:"Solo puedes agregar {{count}} elemento",addElementLimit_other:"Solo puedes agregar {{count}} elementos",clearAll:"Borrar todo"},imageClozeAssociation:{reachedLimit_one:"Has alcanzado el límite de {{count}} respuesta por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.",reachedLimit_other:"Lleno"},drawingResponse:{fillColor:"Color de relleno",outlineColor:"Color del contorno",noFill:"Sin relleno",lightblue:"Azul claro",lightyellow:"Amarillo claro",red:"Rojo",orange:"Naranja",yellow:"Amarillo",violet:"Violeta",blue:"Azul",green:"Verde",white:"Blanco",black:"Negro",onDoubleClick:"Haz doble clic para revisar este texto. Presiona el botón de ingreso para enviar"},charting:{addCategory:"Añadir categoría",actions:"Acciones",add:"Añadir",delete:"Eliminar",newLabel:"Nueva etiqueta",reachedLimit_other:"No puede haber más de {{count}} categorías.",keyLegend:{incorrectAnswer:"Respuesta incorrecta del estudiante",correctAnswer:"Respuesta correcta del estudiante",correctKeyAnswer:"Clave de respuesta correcta"}},graphing:{point:"Punto",circle:"Circulo",line:"Línea",parabola:"Parábola",absolute:"Valor absoluto",exponential:"Exponencial",polygon:"Polígono",ray:"Semirrecta",segment:"Segmento ",sine:"Seno",vector:"Vector",label:"Etiqueta",redo:"Rehacer",reset:"Reiniciar"},mathInline:{primaryCorrectWithAlternates:"Nota: La respuesta que se muestra arriba es la respuesta correcta principal especificada por el autor para esta pregunta, pero también se pueden reconocer otras respuestas como correctas."},multipleChoice:{minSelections:"Seleccione al menos {{minSelections}}.",maxSelections_one:"Sólo se permite {{maxSelections}} respuesta.",maxSelections_other:"Sólo se permiten {{maxSelections}} respuestas.",minmaxSelections_equal:"Seleccione {{minSelections}}.",minmaxSelections_range:"Seleccione entre {{minSelections}} y {{maxSelections}}."},selectText:{correctAnswerSelected:"Respuesta Correcta",correctAnswerNotSelected:"Respuesta Correcta No Seleccionada",incorrectSelection:"Selección Incorrecta",key:"Clave"}},common:{undo:"Deshacer",clearAll:"Borrar todo",correct:"Correct",incorrect:"Incorrect",showCorrectAnswer:"Mostrar respuesta correcta",hideCorrectAnswer:"Ocultar respuesta correcta",commonCorrectAnswerWithAlternates:"Nota: La respuesta que se muestra arriba es la respuesta correcta más común para esta pregunta. También se definen una o más respuestas correctas adicionales, y también se reconocerán como correctas.",warning:"Advertencia",showNote:"Mostrar Nota",hideNote:"Ocultar Nota",cancel:"Cancelar"}}}});var ul={translator:{...sl,t:(e,t)=>{const{lng:r}=t;switch(r){case"en_US":case"en-US":t.lng="en";break;case"es_ES":case"es-ES":case"es_MX":case"es-MX":t.lng="es"}return sl.t(e,{lng:r,...t})}},languageOptions:[{value:"en_US",label:"English (US)"},{value:"es_ES",label:"Spanish"}]};const cl=r,ll=o,{debounce:fl}=t,{isEmpty:hl}=t,{isEqual:dl}=t,pl=f,{color:vl}=c,{Collapsible:yl}=c,{hasText:gl}=c,{hasMedia:ml}=c,{PreviewPrompt:kl}=c,{UiLayout:bl}=c,{withStyles:_l}=i,wl=a,{translator:xl}=ul;class Ol extends cl.Component{constructor(...e){super(...e),Ol.prototype.__init.call(this),Ol.prototype.__init2.call(this),Ol.prototype.__init3.call(this),Ol.prototype.__init4.call(this),Ol.prototype.__init5.call(this)}static __initStatic(){this.propTypes={alwaysShowCorrect:ll.bool,animationsDisabled:ll.bool,classes:ll.object.isRequired,disabled:ll.bool,displayType:ll.string,feedback:ll.object,language:ll.string,markup:ll.string,maxLengthPerChoice:ll.array,maxLengthPerChoiceEnabled:ll.bool,mode:ll.string,note:ll.string,onChange:ll.func,playerSpellCheckEnabled:ll.bool,prompt:ll.string,rationale:ll.string,role:ll.string,showNote:ll.bool,teacherInstructions:ll.string,value:ll.object,responseAreaInputConfiguration:ll.object,model:ll.object.isRequired}}static __initStatic2(){this.defaultProps={value:{}}}__init(){this.state={showCorrectAnswer:this.props.alwaysShowCorrect||!1}}__init2(){this.getChangeSession=e=>e&&e.every(((e,t,r)=>e===r[0]&&1===e))?this.props.onChange:fl(this.props.onChange,200,{maxWait:200})}UNSAFE_componentWillReceiveProps(e){const{maxLengthPerChoice:t,language:r}=this.props;let{note:n}=this.props;hl(e.feedback)&&this.setState({showCorrectAnswer:!1}),e.alwaysShowCorrect&&this.setState({showCorrectAnswer:!0}),t&&!dl(t,e.maxLengthPerChoice)&&(this.changeSession=this.getChangeSession(e.maxLengthPerChoice)),n&&r&&r!==e.language&&n===xl.t("common:commonCorrectAnswerWithAlternates",{lng:r})&&(n=xl.t("common:commonCorrectAnswerWithAlternates",{lng:e.language}))}__init3(){this.toggleShowCorrect=()=>{this.setState({showCorrectAnswer:!this.state.showCorrectAnswer})}}__init4(){this.changeSession=this.getChangeSession(this.props.maxLengthPerChoice)}__init5(){this.onChange=e=>{this.changeSession(e)}}render(){const{showCorrectAnswer:e}=this.state,{alwaysShowCorrect:t,animationsDisabled:r,classes:n,mode:o,displayType:i,role:a,language:s,maxLengthPerChoice:u,maxLengthPerChoiceEnabled:c,note:l,playerSpellCheckEnabled:f,prompt:h,rationale:d,showNote:p,teacherInstructions:v,responseAreaInputConfiguration:y,model:g,value:m}=this.props,{extraCSSRules:k}=g||{},b=(e||"view"===o&&"instructor"===a)&&p&&l,_=wl([n.mainContainer,{[n.noBorderColor]:t}]),w=cl.createElement(kl,{defaultClassName:"teacher-instructions",prompt:v}),x=cl.createElement(kl,{prompt:d}),O=d&&(gl(d)||ml(d)),A=v&&(gl(v)||ml(v));return cl.createElement(bl,{extraCSSRules:k,className:_,style:{display:`${i}`}},"gather"===o&&cl.createElement("h2",{className:n.srOnly},"Fill in the Blank Question"),A&&cl.createElement("div",{className:n.collapsible},r?w:cl.createElement(yl,{labels:{hidden:"Show Teacher Instructions",visible:"Hide Teacher Instructions"}},w)),h&&cl.createElement(kl,{prompt:h}),!t&&cl.createElement(pl,{show:"evaluate"===o,toggled:e,onToggle:this.toggleShowCorrect,language:s}),cl.createElement(Au,{...this.props,onChange:this.onChange,showCorrectAnswer:e,value:m,maxLength:u,adjustedLimit:c,spellCheck:f,pluginProps:y}),b&&cl.createElement("div",{className:wl(n.note,"note"),dangerouslySetInnerHTML:{__html:l}}),O&&cl.createElement("div",{className:n.collapsible},r?x:cl.createElement(yl,{labels:{hidden:"Show Rationale",visible:"Hide Rationale"}},x)))}}Ol.__initStatic(),Ol.__initStatic2();var Al=_l((e=>({mainContainer:{color:vl.text(),backgroundColor:vl.background()},inlineDisplay:{display:"inline-block"},blockDisplay:{display:"block"},note:{marginBottom:2*e.spacing.unit},collapsible:{marginBottom:2*e.spacing.unit},noBorderColor:{"& *":{borderColor:`${vl.text()} !important`}},srOnly:{position:"absolute",left:"-10000px",top:"auto",width:"1px",height:"1px",overflow:"hidden"}})))(Ol);const Sl=r,El=s,{renderMath:Nl}=h;class Tl extends HTMLElement{constructor(){super(),Tl.prototype.__init.call(this),Tl.prototype.__init2.call(this),Tl.prototype.__init3.call(this),this._model=null,this._session=null}setLangAttribute(){const e=this._model&&(this._model.language,1)?this._model.language:"",t=e?e.slice(0,2):"en";this.setAttribute("lang",t)}set model(e){this._model=e,this.dispatchEvent(new m(this.tagName.toLowerCase(),this.session&&!!this.session.value,!!this._model)),this.setLangAttribute(),this._render()}set session(e){this._session=e,this._render()}get session(){return this._session}__init(){this._render=()=>{if(this._model&&this._session){let e=Sl.createElement(Al,{choices:this._model.choices,disabled:this._model.disabled,displayType:this._model.displayType,feedback:this._model.feedback,language:this._model.language,markup:this._model.markup,maxLengthPerChoice:this._model.maxLengthPerChoice,maxLengthPerChoiceEnabled:this._model.maxLengthPerChoiceEnabled,mode:this._model.mode,note:this._model.note,onChange:this.changeSession,playerSpellCheckEnabled:this._model.playerSpellCheckEnabled,prompt:this._model.prompt,rationale:this._model.rationale,role:this._model.role,showNote:this._model.showNote,teacherInstructions:this._model.teacherInstructions,value:this._session.value,responseAreaInputConfiguration:this._model.responseAreaInputConfiguration});El.render(e,this,(()=>{Nl(this)}))}}}__init2(){this.dispatchChangedEvent=()=>{this.dispatchEvent(new b(this.tagName.toLowerCase(),this.session&&!!this.session.value))}}__init3(){this.changeSession=e=>{this.session.value=e,this.dispatchChangedEvent(),this._render()}}connectedCallback(){this.setAttribute("aria-label","Fill in the Blank Question"),this.setAttribute("role","region"),this._render()}}export{Tl as default};
|