@pie-element/explicit-constructed-response 9.3.3-next.9 → 9.3.3
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/CHANGELOG.md +11 -0
- package/configure/CHANGELOG.md +11 -0
- package/configure/package.json +3 -3
- package/controller/CHANGELOG.md +11 -0
- package/controller/package.json +3 -3
- package/module/configure.js +1 -1
- package/module/element.js +1 -1
- package/module/manifest.json +4 -4
- package/module/print.js +1 -1
- package/package.json +7 -7
package/module/print.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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.4/module/index.js";import{_dll_pie_lib__math_rendering as h}from"../../../@pie-lib/math-rendering-module@^3.1.4/module/index.js";import{_dll_pie_lib__drag as d}from"../../../@pie-lib/drag-module@^2.11.4/module/index.js";import{_dll_pie_lib__editable_html as p}from"../../../@pie-lib/editable-html-module@^5.9.4/module/index.js";var v="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},y=Object.prototype.toString,g=function(e){switch(y.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},m=function(e){return null!=e&&"object"==typeof e&&!1===Array.isArray(e)};function k(e){return!0===m(e)&&"[object Object]"===Object.prototype.toString.call(e)}var b=function(e){var t,r;return!1!==k(e)&&("function"==typeof(t=e.constructor)&&(!1!==k(r=t.prototype)&&!1!==r.hasOwnProperty("isPrototypeOf")))},_="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function w(){throw new Error("setTimeout has not been defined")}function x(){throw new Error("clearTimeout has not been defined")}var O=w,S=x;function A(e){if(O===setTimeout)return setTimeout(e,0);if((O===w||!O)&&setTimeout)return O=setTimeout,setTimeout(e,0);try{return O(e,0)}catch(t){try{return O.call(null,e,0)}catch(t){return O.call(this,e,0)}}}"function"==typeof _.setTimeout&&(O=setTimeout),"function"==typeof _.clearTimeout&&(S=clearTimeout);var E,N=[],T=!1,j=-1;function P(){T&&E&&(T=!1,E.length?N=E.concat(N):j=-1,N.length&&C())}function C(){if(!T){var e=A(P);T=!0;for(var t=N.length;t;){for(E=N,N=[];++j<t;)E&&E[j].run();j=-1,t=N.length}E=null,T=!1,function(e){if(S===clearTimeout)return clearTimeout(e);if((S===x||!S)&&clearTimeout)return S=clearTimeout,clearTimeout(e);try{S(e)}catch(t){try{return S.call(null,e)}catch(t){return S.call(this,e)}}}(e)}}function B(e,t){this.fun=e,this.array=t}B.prototype.run=function(){this.fun.apply(null,this.array)};function z(){}var R=z,L=z,K=z,F=z,I=z,D=z,M=z;var J=_.performance||{},U=J.now||J.mozNow||J.msNow||J.oNow||J.webkitNow||function(){return(new Date).getTime()};var V=new Date;var q={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];N.push(new B(e,t)),1!==N.length||T||A(C)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:R,addListener:L,once:K,off:F,removeListener:I,removeAllListeners:D,emit:M,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*U.call(J),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-V)/1e3}},W=q&&q.env&&q.env.FORBID_DEPRECATIONS,H=q&&q.env&&q.env.FORBID_WARNINGS,$=void 0!==q&&q.env&&!0,Y="undefined"!=typeof console&&"function"==typeof console.log&&"function"==typeof console.warn&&"function"==typeof console.error;function G(e,t){if($&&Y){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 Q(e,t){throw new Error(t)}var X={deprecate:function(e,t){for(var r=W?Q:G,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(Y){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=H?Q:G,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))}},Z={};function ee(e){e&&(e.value=!0)}function te(){}function re(e){return void 0===e.size&&(e.size=e.__iterate(oe)),e.size}function ne(e,t){if("number"!=typeof t){var r=t>>>0;if(""+r!==t||4294967295===r)return NaN;t=r}return t<0?re(e)+t:t}function oe(){return!0}function ie(e,t,r){return(0===e&&!ce(e)||void 0!==r&&e<=-r)&&(void 0===t||void 0!==r&&t>=r)}function ae(e,t){return ue(e,t,0)}function se(e,t){return ue(e,t,t)}function ue(e,t,r){return void 0===e?r:ce(e)?t===1/0?t:0|Math.max(0,t+e):void 0===t||t===e?e:0|Math.min(t,e)}function ce(e){return e<0||0===e&&1/e==-1/0}function le(e){return Boolean(e&&e["@@__IMMUTABLE_ITERABLE__@@"])}function fe(e){return Boolean(e&&e["@@__IMMUTABLE_KEYED__@@"])}function he(e){return Boolean(e&&e["@@__IMMUTABLE_INDEXED__@@"])}function de(e){return fe(e)||he(e)}var pe=function(e){return le(e)?e:ze(e)},ve=function(e){function t(e){return fe(e)?e:Re(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(pe),ye=function(e){function t(e){return he(e)?e:Le(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(pe),ge=function(e){function t(e){return le(e)&&!de(e)?e:Ke(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(pe);pe.Keyed=ve,pe.Indexed=ye,pe.Set=ge;function me(e){return Boolean(e&&e["@@__IMMUTABLE_SEQ__@@"])}function ke(e){return Boolean(e&&e["@@__IMMUTABLE_RECORD__@@"])}function be(e){return le(e)||ke(e)}var _e="@@__IMMUTABLE_ORDERED__@@";function we(e){return Boolean(e&&e[_e])}var xe="function"==typeof Symbol&&Symbol.iterator,Oe=xe||"@@iterator",Se=function(e){this.next=e};function Ae(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 Ee(){return{value:void 0,done:!0}}function Ne(e){return!!Array.isArray(e)||!!Pe(e)}function Te(e){return e&&"function"==typeof e.next}function je(e){var t=Pe(e);return t&&t.call(e)}function Pe(e){var t=e&&(xe&&e[xe]||e["@@iterator"]);if("function"==typeof t)return t}Se.prototype.toString=function(){return"[Iterator]"},Se.KEYS=0,Se.VALUES=1,Se.ENTRIES=2,Se.prototype.inspect=Se.prototype.toSource=function(){return this.toString()},Se.prototype[Oe]=function(){return this};var Ce=Object.prototype.hasOwnProperty;function Be(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 ze=function(e){function t(e){return null==e?Je():be(e)?e.toSeq():function(e){var t=qe(e);if(t)return(n=Pe(r=e))&&n===r.entries?t.fromEntrySeq():function(e){var t=Pe(e);return t&&t===e.keys}(e)?t.toSetSeq():t;var r,n;if("object"==typeof e)return new Ie(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 Se((function(){if(o===n)return{value:void 0,done:!0};var i=r[t?n-++o:o++];return Ae(e,i[0],i[1])}))}return this.__iteratorUncached(e,t)},t}(pe),Re=function(e){function t(e){return null==e?Je().toKeyedSeq():le(e)?fe(e)?e.toSeq():e.fromEntrySeq():ke(e)?e.toSeq():Ue(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.toKeyedSeq=function(){return this},t}(ze),Le=function(e){function t(e){return null==e?Je():le(e)?fe(e)?e.entrySeq():e.toIndexedSeq():ke(e)?e.toSeq().entrySeq():Ve(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}(ze),Ke=function(e){function t(e){return(le(e)&&!de(e)?e:Le(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}(ze);ze.isSeq=me,ze.Keyed=Re,ze.Set=Ke,ze.Indexed=Le,ze.prototype["@@__IMMUTABLE_SEQ__@@"]=!0;var Fe=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[ne(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 Se((function(){if(o===n)return{value:void 0,done:!0};var i=t?n-++o:o++;return Ae(e,i,r[i])}))},t}(Le),Ie=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 Ce.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 Se((function(){if(i===o)return{value:void 0,done:!0};var a=n[t?o-++i:i++];return Ae(e,a,r[a])}))},t}(Re);Ie.prototype[_e]=!0;var De,Me=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=je(this._collection),n=0;if(Te(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=je(this._collection);if(!Te(r))return new Se(Ee);var n=0;return new Se((function(){var t=r.next();return t.done?t:Ae(e,n++,t.value)}))},t}(Le);function Je(){return De||(De=new Fe([]))}function Ue(e){var t=qe(e);if(t)return t.fromEntrySeq();if("object"==typeof e)return new Ie(e);throw new TypeError("Expected Array or collection object of [k, v] entries, or keyed object: "+e)}function Ve(e){var t=qe(e);if(t)return t;throw new TypeError("Expected Array or collection object of values: "+e)}function qe(e){return Be(e)?new Fe(e):Ne(e)?new Me(e):void 0}function We(e){return Boolean(e&&e["@@__IMMUTABLE_MAP__@@"])}function He(e){return We(e)&&we(e)}function $e(e){return Boolean(e&&"function"==typeof e.equals&&"function"==typeof e.hashCode)}function Ye(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!!($e(e)&&$e(t)&&e.equals(t))}var Ge="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 Qe(e){return e>>>1&1073741824|3221225471&e}var Xe=Object.prototype.valueOf;function Ze(e){if(null==e)return et(e);if("function"==typeof e.hashCode)return Qe(e.hashCode(e));var t,r=(t=e).valueOf!==Xe&&"function"==typeof t.valueOf?t.valueOf(t):t;if(null==r)return et(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 Qe(t)}(r);case"string":return r.length>lt?function(e){var t=dt[e];void 0===t&&(t=tt(e),ht===ft&&(ht=0,dt={}),ht++,dt[e]=t);return t}(r):tt(r);case"object":case"function":return function(e){var t;if(at&&void 0!==(t=it.get(e)))return t;if(void 0!==(t=e[ct]))return t;if(!nt){if(void 0!==(t=e.propertyIsEnumerable&&e.propertyIsEnumerable[ct]))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=ot(),at)it.set(e,t);else{if(void 0!==rt&&!1===rt(e))throw new Error("Non-extensible objects are not allowed as keys.");if(nt)Object.defineProperty(e,ct,{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[ct]=t;else{if(void 0===e.nodeType)throw new Error("Unable to set a non-enumerable property on object.");e[ct]=t}}return t}(r);case"symbol":return function(e){var t=st[e];if(void 0!==t)return t;return t=ot(),st[e]=t,t}(r);default:if("function"==typeof r.toString)return tt(r.toString());throw new Error("Value type "+typeof r+" cannot be hashed.")}}function et(e){return null===e?1108378658:1108378659}function tt(e){for(var t=0,r=0;r<e.length;r++)t=31*t+e.charCodeAt(r)|0;return Qe(t)}var rt=Object.isExtensible,nt=function(){try{return Object.defineProperty({},"@",{}),!0}catch(e){return!1}}();function ot(){var e=++ut;return 1073741824&ut&&(ut=0),e}var it,at="function"==typeof WeakMap;at&&(it=new WeakMap);var st=Object.create(null),ut=0,ct="__immutablehash__";"function"==typeof Symbol&&(ct=Symbol(ct));var lt=16,ft=255,ht=0,dt={},pt=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=bt(this,!0);return this._useKeys||(t.valueSeq=function(){return e._iter.toSeq().reverse()}),t},t.prototype.map=function(e,t){var r=this,n=kt(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}(Re);pt.prototype[_e]=!0;var vt=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&&re(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&&re(this),new Se((function(){var i=n.next();return i.done?i:Ae(e,t?r.size-++o:o++,i.value,i)}))},t}(Le),yt=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 Se((function(){var t=r.next();return t.done?t:Ae(e,t.value,t.value,t)}))},t}(Ke),gt=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){Pt(t);var n=le(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 Se((function(){for(;;){var t=r.next();if(t.done)return t;var n=t.value;if(n){Pt(n);var o=le(n);return Ae(e,o?n.get(0):n[0],o?n.get(1):n[1],t)}}}))},t}(Re);function mt(e){var t=Bt(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=zt,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 Se((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 kt(e,t,r){var n=Bt(e);return n.size=e.size,n.has=function(t){return e.has(t)},n.get=function(n,o){var i=e.get(n,Z);return i===Z?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 Se((function(){var o=i.next();if(o.done)return o;var a=o.value,s=a[0];return Ae(n,s,t.call(r,a[1],s,e),o)}))},n}function bt(e,t){var r=this,n=Bt(e);return n._iter=e,n.size=e.size,n.reverse=function(){return e},e.flip&&(n.flip=function(){var t=mt(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=zt,n.__iterate=function(r,n){var o=this,i=0;return n&&re(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&&re(e);var a=e.__iterator(2,!o);return new Se((function(){var e=a.next();if(e.done)return e;var s=e.value;return Ae(n,t?s[0]:o?r.size-++i:i++,s[1],e)}))},n}function _t(e,t,r,n){var o=Bt(e);return n&&(o.has=function(n){var o=e.get(n,Z);return o!==Z&&!!t.call(r,o,n,e)},o.get=function(n,o){var i=e.get(n,Z);return i!==Z&&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 Se((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 Ae(o,n?c:s++,l,i)}}))},o}function wt(e,t,r,n){var o=e.size;if(ie(t,r,o))return e;var i=ae(t,o),a=se(r,o);if(i!=i||a!=a)return wt(e.toSeq().cacheResult(),t,r,n);var s,u=a-i;u==u&&(s=u<0?0:u);var c=Bt(e);return c.size=0===s?s:e.size&&s||void 0,!n&&me(e)&&s>=0&&(c.get=function(t,r){return(t=ne(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 Se(Ee);var o=e.__iterator(t,r),a=0,u=0;return new Se((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:Ae(t,u-1,0===t?void 0:e.value[1],e)}))},c}function xt(e,t,r,n){var o=Bt(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 Se((function(){var e,i,l;do{if((e=s.next()).done)return n||1===o?e:Ae(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:Ae(o,i,l,e)}))},o}function Ot(e,t){var r=fe(e),n=[e].concat(t).map((function(e){return le(e)?r&&(e=ve(e)):e=r?Ue(e):Ve(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&&fe(o)||he(e)&&he(o))return o}var i=new Fe(n);return r?i=i.toKeyedSeq():he(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 St(e,t,r){var n=Bt(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)&&le(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 Se((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)||!le(u))return r?e:Ae(n,s++,u,e);a.push(i),i=u.__iterator(n,o)}else i=a.pop()}return{value:void 0,done:!0}}))},n}function At(e,t,r){t||(t=Rt);var n=fe(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?Re(i):he(e)?Le(i):Ke(i)}function Et(e,t,r){if(t||(t=Rt),r){var n=e.toSeq().map((function(t,n){return[t,r(t,n,e)]})).reduce((function(e,r){return Nt(t,e[1],r[1])?r:e}));return n&&n[0]}return e.reduce((function(e,r){return Nt(t,e,r)?r:e}))}function Nt(e,t,r){var n=e(r,t);return 0===n&&r!==t&&(null==r||r!=r)||n>0}function Tt(e,t,r,n){var o=Bt(e),i=new Fe(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=pe(e),je(o?e.reverse():e)})),a=0,s=!1;return new Se((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}:Ae(e,a++,t.apply(null,r.map((function(e){return e.value}))))}))},o}function jt(e,t){return e===t?e:me(e)?t:e.constructor(t)}function Pt(e){if(e!==Object(e))throw new TypeError("Expected [K, V] tuple: "+e)}function Ct(e){return fe(e)?ve:he(e)?ye:ge}function Bt(e){return Object.create((fe(e)?Re:he(e)?Le:Ke).prototype)}function zt(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):ze.prototype.cacheResult.call(this)}function Rt(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 Lt(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 Kt(e,t){if(!e)throw new Error(t)}function Ft(e){Kt(e!==1/0,"Cannot perform this action with an infinite size.")}function It(e){if(Be(e)&&"string"!=typeof e)return e;if(we(e))return e.toArray();throw new TypeError("Invalid keyPath: expected Ordered Collection or Array: "+e)}vt.prototype.cacheResult=pt.prototype.cacheResult=yt.prototype.cacheResult=gt.prototype.cacheResult=zt;var Dt=Object.prototype.toString;function Mt(e){return"object"==typeof e&&(be(e)||Array.isArray(e)||function(e){if(!e||"object"!=typeof e||"[object Object]"!==Dt.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 Jt(e){try{return"string"==typeof e?JSON.stringify(e):String(e)}catch(t){return JSON.stringify(e)}}function Ut(e,t,r){return be(e)?e.get(t,r):function(e,t){return be(e)?e.has(t):Mt(e)&&Ce.call(e,t)}(e,t)?"function"==typeof e.get?e.get(t):e[t]:r}function Vt(e){if(Array.isArray(e))return Lt(e);var t={};for(var r in e)Ce.call(e,r)&&(t[r]=e[r]);return t}function qt(e,t,r,n){n||(n=r,r=void 0);var o=Wt(be(e),e,It(t),0,r,n);return o===Z?r:o}function Wt(e,t,r,n,o,i){var a=t===Z;if(n===r.length){var s=a?o:t,u=i(s);return u===s?t:u}if(!a&&!Mt(t))throw new TypeError("Cannot update within non-data-structure value in path ["+r.slice(0,n).map(Jt)+"]: "+t);var c=r[n],l=a?Z:Ut(t,c,Z),f=Wt(l===Z?e:be(l),l,r,n+1,o,i);return f===l?t:f===Z?function(e,t){if(!Mt(e))throw new TypeError("Cannot update non-data-structure value: "+e);if(be(e)){if(!e.remove)throw new TypeError("Cannot update immutable value without .remove() method: "+e);return e.remove(t)}if(!Ce.call(e,t))return e;var r=Vt(e);return Array.isArray(r)?r.splice(t,1):delete r[t],r}(t,c):function(e,t,r){if(!Mt(e))throw new TypeError("Cannot update non-data-structure value: "+e);if(be(e)){if(!e.set)throw new TypeError("Cannot update immutable value without .set() method: "+e);return e.set(t,r)}if(Ce.call(e,t)&&r===e[t])return e;var n=Vt(e);return n[t]=r,n}(a?e?xr():{}:t,c,f)}function Ht(e,t){return function(e,t,r){return qt(e,t,Z,(function(){return r}))}(this,e,t)}function $t(e){return function(e,t){return qt(e,t,(function(){return Z}))}(this,e)}function Yt(e,t,r,n){return qt(e,[t],r,n)}function Gt(e,t,r){return 1===arguments.length?e(this):Yt(this,e,t,r)}function Qt(e,t,r){return qt(this,e,t,r)}function Xt(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return er(this,e)}function Zt(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 er(this,t,e)}function er(e,t,r){for(var n=[],o=0;o<t.length;o++){var i=ve(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){Yt(e,n,Z,(function(e){return e===Z?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 tr(e,t,r){return rr(e,t,function(e){function t(r,n,o){return Mt(r)&&Mt(n)&&(i=n,a=ze(r),s=ze(i),he(a)===he(s)&&fe(a)===fe(s))?rr(r,[n],t):e?e(r,n,o):n;var i,a,s}return t}(r))}function rr(e,t,r){if(!Mt(e))throw new TypeError("Cannot merge into non-data-structure value: "+e);if(be(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?ye:ve,a=n?function(t){o===e&&(o=Vt(o)),o.push(t)}:function(t,n){var i=Ce.call(o,n),a=i&&r?r(o[n],t,n):t;i&&a===o[n]||(o===e&&(o=Vt(o)),o[n]=a)},s=0;s<t.length;s++)i(t[s]).forEach(a);return o}function nr(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return tr(this,e)}function or(e){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];return tr(this,t,e)}function ir(e){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];return qt(this,e,xr(),(function(e){return rr(e,t)}))}function ar(e){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];return qt(this,e,xr(),(function(e){return tr(e,t)}))}function sr(e){var t=this.asMutable();return e(t),t.wasAltered()?t.__ensureOwner(this.__ownerID):this}function ur(){return this.__ownerID?this:this.__ensureOwner(new te)}function cr(){return this.__ensureOwner()}function lr(){return this.__altered}var fr=function(e){function t(t){return null==t?xr():We(t)&&!we(t)?t:xr().withMutations((function(r){var n=e(t);Ft(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 xr().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 Or(this,e,t)},t.prototype.remove=function(e){return Or(this,e,Z)},t.prototype.deleteAll=function(e){var t=pe(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):xr()},t.prototype.sort=function(e){return $r(At(this,e))},t.prototype.sortBy=function(e,t){return $r(At(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 kr(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?wr(this.size,this._root,e,this.__hash):0===this.size?xr():(this.__ownerID=e,this.__altered=!1,this)},t}(ve);fr.isMap=We;var hr=fr.prototype;hr["@@__IMMUTABLE_MAP__@@"]=!0,hr.delete=hr.remove,hr.removeAll=hr.deleteAll,hr.setIn=Ht,hr.removeIn=hr.deleteIn=$t,hr.update=Gt,hr.updateIn=Qt,hr.merge=hr.concat=Xt,hr.mergeWith=Zt,hr.mergeDeep=nr,hr.mergeDeepWith=or,hr.mergeIn=ir,hr.mergeDeepIn=ar,hr.withMutations=sr,hr.wasAltered=lr,hr.asImmutable=cr,hr["@@transducer/init"]=hr.asMutable=ur,hr["@@transducer/step"]=function(e,t){return e.set(t[0],t[1])},hr["@@transducer/result"]=function(e){return e.asImmutable()};var dr=function(e,t){this.ownerID=e,this.entries=t};dr.prototype.get=function(e,t,r,n){for(var o=this.entries,i=0,a=o.length;i<a;i++)if(Ye(r,o[i][0]))return o[i][1];return n},dr.prototype.update=function(e,t,r,n,o,i,a){for(var s=o===Z,u=this.entries,c=0,l=u.length;c<l&&!Ye(n,u[c][0]);c++);var f=c<l;if(f?u[c][1]===o:s)return this;if(ee(a),(s||!f)&&ee(i),!s||1!==u.length){if(!f&&!s&&u.length>=jr)return function(e,t,r,n){e||(e=new te);for(var o=new gr(e,Ze(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:Lt(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 dr(e,d)}};var pr=function(e,t,r){this.ownerID=e,this.bitmap=t,this.nodes=r};pr.prototype.get=function(e,t,r,n){void 0===t&&(t=Ze(r));var o=1<<(31&(0===e?t:t>>>e)),i=this.bitmap;return 0==(i&o)?n:this.nodes[Nr(i&o-1)].get(e+5,t,r,n)},pr.prototype.update=function(e,t,r,n,o,i,a){void 0===r&&(r=Ze(n));var s=31&(0===t?r:r>>>t),u=1<<s,c=this.bitmap,l=0!=(c&u);if(!l&&o===Z)return this;var f=Nr(c&u-1),h=this.nodes,d=l?h[f]:void 0,p=Sr(d,e,t+5,r,n,o,i,a);if(p===d)return this;if(!l&&p&&h.length>=Pr)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 vr(e,i+1,a)}(e,h,c,s,p);if(l&&!p&&2===h.length&&Ar(h[1^f]))return h[1^f];if(l&&p&&1===h.length&&Ar(p))return p;var v=e&&e===this.ownerID,y=l?p?c:c^u:c|u,g=l?p?Tr(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 pr(e,y,g)};var vr=function(e,t,r){this.ownerID=e,this.count=t,this.nodes=r};vr.prototype.get=function(e,t,r,n){void 0===t&&(t=Ze(r));var o=31&(0===e?t:t>>>e),i=this.nodes[o];return i?i.get(e+5,t,r,n):n},vr.prototype.update=function(e,t,r,n,o,i,a){void 0===r&&(r=Ze(n));var s=31&(0===t?r:r>>>t),u=o===Z,c=this.nodes,l=c[s];if(u&&!l)return this;var f=Sr(l,e,t+5,r,n,o,i,a);if(f===l)return this;var h=this.count;if(l){if(!f&&--h<Cr)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 pr(e,o,a)}(e,c,h,s)}else h++;var d=e&&e===this.ownerID,p=Tr(c,s,f,d);return d?(this.count=h,this.nodes=p,this):new vr(e,h,p)};var yr=function(e,t,r){this.ownerID=e,this.keyHash=t,this.entries=r};yr.prototype.get=function(e,t,r,n){for(var o=this.entries,i=0,a=o.length;i<a;i++)if(Ye(r,o[i][0]))return o[i][1];return n},yr.prototype.update=function(e,t,r,n,o,i,a){void 0===r&&(r=Ze(n));var s=o===Z;if(r!==this.keyHash)return s?this:(ee(a),ee(i),Er(this,e,t,r,[n,o]));for(var u=this.entries,c=0,l=u.length;c<l&&!Ye(n,u[c][0]);c++);var f=c<l;if(f?u[c][1]===o:s)return this;if(ee(a),(s||!f)&&ee(i),s&&2===l)return new gr(e,this.keyHash,u[1^c]);var h=e&&e===this.ownerID,d=h?u:Lt(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 yr(e,this.keyHash,d)};var gr=function(e,t,r){this.ownerID=e,this.keyHash=t,this.entry=r};gr.prototype.get=function(e,t,r,n){return Ye(r,this.entry[0])?this.entry[1]:n},gr.prototype.update=function(e,t,r,n,o,i,a){var s=o===Z,u=Ye(n,this.entry[0]);return(u?o===this.entry[1]:s)?this:(ee(a),s?void ee(i):u?e&&e===this.ownerID?(this.entry[1]=o,this):new gr(e,this.keyHash,[n,o]):(ee(i),Er(this,e,t,Ze(n),[n,o])))},dr.prototype.iterate=yr.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},pr.prototype.iterate=vr.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}},gr.prototype.iterate=function(e,t){return e(this.entry)};var mr,kr=function(e){function t(e,t,r){this._type=t,this._reverse=r,this._stack=e._root&&_r(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 br(e,r.entry)}else if(r.entries){if(n<=(o=r.entries.length-1))return br(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 br(e,i.entry);t=this._stack=_r(i,t)}continue}t=this._stack=this._stack.__prev}return{value:void 0,done:!0}},t}(Se);function br(e,t){return Ae(e,t[0],t[1])}function _r(e,t){return{node:e,index:0,__prev:t}}function wr(e,t,r,n){var o=Object.create(hr);return o.size=e,o._root=t,o.__ownerID=r,o.__hash=n,o.__altered=!1,o}function xr(){return mr||(mr=wr(0))}function Or(e,t,r){var n,o;if(e._root){var i={value:!1},a={value:!1};if(n=Sr(e._root,e.__ownerID,0,void 0,t,r,i,a),!a.value)return e;o=e.size+(i.value?r===Z?-1:1:0)}else{if(r===Z)return e;o=1,n=new dr(e.__ownerID,[[t,r]])}return e.__ownerID?(e.size=o,e._root=n,e.__hash=void 0,e.__altered=!0,e):n?wr(o,n):xr()}function Sr(e,t,r,n,o,i,a,s){return e?e.update(t,r,n,o,i,a,s):i===Z?e:(ee(s),ee(a),new gr(t,n,[o,i]))}function Ar(e){return e.constructor===gr||e.constructor===yr}function Er(e,t,r,n,o){if(e.keyHash===n)return new yr(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?[Er(e,t,r+5,n,o)]:(i=new gr(t,n,o),a<s?[e,i]:[i,e]);return new pr(t,1<<a|1<<s,u)}function Nr(e){return e=(e=(858993459&(e-=e>>1&1431655765))+(e>>2&858993459))+(e>>4)&252645135,e+=e>>8,127&(e+=e>>16)}function Tr(e,t,r,n){var o=n?e:Lt(e);return o[t]=r,o}var jr=8,Pr=16,Cr=8;function Br(e){return Boolean(e&&e["@@__IMMUTABLE_LIST__@@"])}var zr=function(e){function t(t){var r=Mr();if(null==t)return r;if(Br(t))return t;var n=e(t),o=n.size;return 0===o?r:(Ft(o),o>0&&o<32?Dr(0,o,5,null,new Lr(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=ne(this,e))>=0&&e<this.size){var r=Vr(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=ne(e,t))!=t)return e;if(t>=e.size||t<0)return e.withMutations((function(e){t<0?qr(e,t).set(0,r):qr(e,0,t+1).set(t,r)}));t+=e._origin;var n=e._tail,o=e._root,i={value:!1};t>=Wr(e._capacity)?n=Jr(n,e.__ownerID,0,t,r,i):o=Jr(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 Dr(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):Mr()},t.prototype.push=function(){var e=arguments,t=this.size;return this.withMutations((function(r){qr(r,0,t+e.length);for(var n=0;n<e.length;n++)r.set(t+n,e[n])}))},t.prototype.pop=function(){return qr(this,0,-1)},t.prototype.unshift=function(){var e=arguments;return this.withMutations((function(t){qr(t,-e.length);for(var r=0;r<e.length;r++)t.set(r,e[r])}))},t.prototype.shift=function(){return qr(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&&Ne(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 qr(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 ie(e,t,r)?this:qr(this,ae(e,r),se(t,r))},t.prototype.__iterator=function(e,t){var r=t?this.size:0,n=Ir(this,t);return new Se((function(){var o=n();return o===Fr?{value:void 0,done:!0}:Ae(e,t?--r:r++,o)}))},t.prototype.__iterate=function(e,t){for(var r,n=t?this.size:0,o=Ir(this,t);(r=o())!==Fr&&!1!==e(r,t?--n:n++,this););return n},t.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?Dr(this._origin,this._capacity,this._level,this._root,this._tail,e,this.__hash):0===this.size?Mr():(this.__ownerID=e,this.__altered=!1,this)},t}(ye);zr.isList=Br;var Rr=zr.prototype;Rr["@@__IMMUTABLE_LIST__@@"]=!0,Rr.delete=Rr.remove,Rr.merge=Rr.concat,Rr.setIn=Ht,Rr.deleteIn=Rr.removeIn=$t,Rr.update=Gt,Rr.updateIn=Qt,Rr.mergeIn=ir,Rr.mergeDeepIn=ar,Rr.withMutations=sr,Rr.wasAltered=lr,Rr.asImmutable=cr,Rr["@@transducer/init"]=Rr.asMutable=ur,Rr["@@transducer/step"]=function(e,t){return e.push(t)},Rr["@@transducer/result"]=function(e){return e.asImmutable()};var Lr=function(e,t){this.array=e,this.ownerID=t};Lr.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 Lr([],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=Ur(this,e);if(!i)for(var u=0;u<n;u++)s.array[u]=void 0;return o&&(s.array[n]=o),s},Lr.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=Ur(this,e);return a.array.splice(o+1),n&&(a.array[o]=n),a};var Kr,Fr={};function Ir(e,t){var r=e._origin,n=e._capacity,o=Wr(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 Fr;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!==Fr)return e;s=null}if(c===l)return Fr;var r=t?--l:c++;s=a(u&&u[r],o-5,i+(r<<o))}}}(e,s,u)}}function Dr(e,t,r,n,o,i,a){var s=Object.create(Rr);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 Mr(){return Kr||(Kr=Dr(0,0,5))}function Jr(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=Jr(c,t,r-5,n,o,i);return l===c?e:((a=Ur(e,t)).array[s]=l,a)}return u&&e.array[s]===o?e:(i&&ee(i),a=Ur(e,t),void 0===o&&s===a.array.length-1?a.array.pop():a.array[s]=o,a)}function Ur(e,t){return t&&e&&t===e.ownerID?e:new Lr(e?e.array.slice():[],t)}function Vr(e,t){if(t>=Wr(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 qr(e,t,r){void 0!==t&&(t|=0),void 0!==r&&(r|=0);var n=e.__ownerID||new te,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 Lr(c&&c.array.length?[void 0,c]:[],n),l+=1<<(u+=5);l&&(a+=l,o+=l,s+=l,i+=l);for(var f=Wr(i),h=Wr(s);h>=1<<u+5;)c=new Lr(c&&c.array.length?[c]:[],n),u+=5;var d=e._tail,p=h<f?Vr(e,s-1):h>f?new Lr([],n):d;if(d&&h>f&&a<i&&d.array.length){for(var v=c=Ur(c,n),y=u;y>5;y-=5){var g=f>>>y&31;v=v.array[g]=Ur(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):Dr(a,s,u,c,p)}function Wr(e){return e<32?0:e-1>>>5<<5}var Hr,$r=function(e){function t(e){return null==e?Gr():He(e)?e:Gr().withMutations((function(t){var r=ve(e);Ft(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):Gr()},t.prototype.set=function(e,t){return Qr(this,e,t)},t.prototype.remove=function(e){return Qr(this,e,Z)},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?Yr(t,r,e,this.__hash):0===this.size?Gr():(this.__ownerID=e,this.__altered=!1,this._map=t,this._list=r,this)},t}(fr);function Yr(e,t,r,n){var o=Object.create($r.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 Gr(){return Hr||(Hr=Yr(xr(),Mr()))}function Qr(e,t,r){var n,o,i=e._map,a=e._list,s=i.get(t),u=void 0!==s;if(r===Z){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):Yr(n,o)}$r.isOrderedMap=He,$r.prototype[_e]=!0,$r.prototype.delete=$r.prototype.remove;function Xr(e){return Boolean(e&&e["@@__IMMUTABLE_STACK__@@"])}var Zr=function(e){function t(e){return null==e?nn():Xr(e)?e:nn().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=ne(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):rn(t,r)},t.prototype.pushAll=function(t){if(0===(t=e(t)).size)return this;if(0===this.size&&Xr(t))return t;Ft(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):rn(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):nn()},t.prototype.slice=function(t,r){if(ie(t,r,this.size))return this;var n=ae(t,this.size);if(se(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):rn(o,i)},t.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?rn(this.size,this._head,e,this.__hash):0===this.size?nn():(this.__ownerID=e,this.__altered=!1,this)},t.prototype.__iterate=function(e,t){var r=this;if(t)return new Fe(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 Fe(this.toArray()).__iterator(e,t);var r=0,n=this._head;return new Se((function(){if(n){var t=n.value;return n=n.next,Ae(e,r++,t)}return{value:void 0,done:!0}}))},t}(ye);Zr.isStack=Xr;var en,tn=Zr.prototype;function rn(e,t,r,n){var o=Object.create(tn);return o.size=e,o._head=t,o.__ownerID=r,o.__hash=n,o.__altered=!1,o}function nn(){return en||(en=rn(0))}tn["@@__IMMUTABLE_STACK__@@"]=!0,tn.shift=tn.pop,tn.unshift=tn.push,tn.unshiftAll=tn.pushAll,tn.withMutations=sr,tn.wasAltered=lr,tn.asImmutable=cr,tn["@@transducer/init"]=tn.asMutable=ur,tn["@@transducer/step"]=function(e,t){return e.unshift(t)},tn["@@transducer/result"]=function(e){return e.asImmutable()};function on(e){return Boolean(e&&e["@@__IMMUTABLE_SET__@@"])}function an(e){return on(e)&&we(e)}function sn(e,t){if(e===t)return!0;if(!le(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||fe(e)!==fe(t)||he(e)!==he(t)||we(e)!==we(t))return!1;if(0===e.size&&0===t.size)return!0;var r=!de(e);if(we(e)){var n=e.entries();return t.every((function(e,t){var o=n.next().value;return o&&Ye(o[1],e)&&(r||Ye(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?!Ye(t,e.get(n,Z)):!Ye(e.get(n,Z),t))return a=!1,!1}));return a&&e.size===s}function un(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 cn(e){if(!e||"object"!=typeof e)return e;if(!le(e)){if(!Mt(e))return e;e=ze(e)}if(fe(e)){var t={};return e.__iterate((function(e,r){t[r]=cn(e)})),t}var r=[];return e.__iterate((function(e){r.push(cn(e))})),r}var ln=function(e){function t(t){return null==t?vn():on(t)&&!we(t)?t:vn().withMutations((function(r){var n=e(t);Ft(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(ve(e).keySeq())},t.intersect=function(e){return(e=pe(e).toArray()).length?hn.intersect.apply(t(e.pop()),e):vn()},t.union=function(e){return(e=pe(e).toArray()).length?hn.union.apply(t(e.pop()),e):vn()},t.prototype.toString=function(){return this.__toString("Set {","}")},t.prototype.has=function(e){return this._map.has(e)},t.prototype.add=function(e){return dn(this,this._map.set(e,e))},t.prototype.remove=function(e){return dn(this,this._map.remove(e))},t.prototype.clear=function(){return dn(this,this._map.clear())},t.prototype.map=function(e,t){var r=this,n=!1,o=dn(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 Bn(At(this,e))},t.prototype.sortBy=function(e,t){return Bn(At(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}(ge);ln.isSet=on;var fn,hn=ln.prototype;function dn(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 pn(e,t){var r=Object.create(hn);return r.size=e?e.size:0,r._map=e,r.__ownerID=t,r}function vn(){return fn||(fn=pn(xr()))}hn["@@__IMMUTABLE_SET__@@"]=!0,hn.delete=hn.remove,hn.merge=hn.concat=hn.union,hn.withMutations=sr,hn.asImmutable=cr,hn["@@transducer/init"]=hn.asMutable=ur,hn["@@transducer/step"]=function(e,t){return e.add(t)},hn["@@transducer/result"]=function(e){return e.asImmutable()},hn.__empty=vn,hn.__make=pn;var yn,gn=function(e){function t(e,r,n){if(!(this instanceof t))return new t(e,r,n);if(Kt(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(yn)return yn;yn=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+ne(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 ie(e,r,this.size)?this:(e=ae(e,this.size),(r=se(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 Se((function(){if(i===r)return{value:void 0,done:!0};var a=o;return o+=t?-n:n,Ae(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:sn(this,e)},t}(Le);function mn(e,t,r){for(var n=It(t),o=0;o!==n.length;)if((e=Ut(e,n[o++],Z))===Z)return r;return e}function kn(e,t){return mn(this,e,t)}function bn(){Ft(this.size);var e={};return this.__iterate((function(t,r){e[r]=t})),e}pe.isIterable=le,pe.isKeyed=fe,pe.isIndexed=he,pe.isAssociative=de,pe.isOrdered=we,pe.Iterator=Se,un(pe,{toArray:function(){Ft(this.size);var e=new Array(this.size||0),t=fe(this),r=0;return this.__iterate((function(n,o){e[r++]=t?[o,n]:n})),e},toIndexedSeq:function(){return new vt(this)},toJS:function(){return cn(this)},toKeyedSeq:function(){return new pt(this,!0)},toMap:function(){return fr(this.toKeyedSeq())},toObject:bn,toOrderedMap:function(){return $r(this.toKeyedSeq())},toOrderedSet:function(){return Bn(fe(this)?this.valueSeq():this)},toSet:function(){return ln(fe(this)?this.valueSeq():this)},toSetSeq:function(){return new yt(this)},toSeq:function(){return he(this)?this.toIndexedSeq():fe(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return Zr(fe(this)?this.valueSeq():this)},toList:function(){return zr(fe(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 jt(this,Ot(this,e))},includes:function(e){return this.some((function(t){return Ye(t,e)}))},entries:function(){return this.__iterator(2)},every:function(e,t){Ft(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 jt(this,_t(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 Ft(this.size),this.__iterate(t?e.bind(t):e)},join:function(e){Ft(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 jt(this,kt(this,e,t))},reduce:function(e,t,r){return Sn(this,e,t,r,arguments.length<2,!1)},reduceRight:function(e,t,r){return Sn(this,e,t,r,arguments.length<2,!0)},reverse:function(){return jt(this,bt(this,!0))},slice:function(e,t){return jt(this,wt(this,e,t,!0))},some:function(e,t){return!this.every(Nn(e),t)},sort:function(e){return jt(this,At(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 re(e?this.toSeq().filter(e,t):this)},countBy:function(e,t){return function(e,t,r){var n=fr().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 sn(this,e)},entrySeq:function(){var e=this;if(e._cache)return new Fe(e._cache);var t=e.toSeq().map(En).toIndexedSeq();return t.fromEntrySeq=function(){return e.toSeq()},t},filterNot:function(e,t){return this.filter(Nn(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(oe,null,e)},flatMap:function(e,t){return jt(this,function(e,t,r){var n=Ct(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 jt(this,St(this,e,!0))},fromEntrySeq:function(){return new gt(this)},get:function(e,t){return this.find((function(t,r){return Ye(r,e)}),void 0,t)},getIn:kn,groupBy:function(e,t){return function(e,t,r){var n=fe(e),o=(we(e)?$r():fr()).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=Ct(e);return o.map((function(t){return jt(e,i(t))})).asImmutable()}(this,e,t)},has:function(e){return this.get(e,Z)!==Z},hasIn:function(e){return mn(this,e,Z)!==Z},isSubset:function(e){return e="function"==typeof e.includes?e:pe(e),this.every((function(t){return e.includes(t)}))},isSuperset:function(e){return(e="function"==typeof e.isSubset?e:pe(e)).isSubset(this)},keyOf:function(e){return this.findKey((function(t){return Ye(t,e)}))},keySeq:function(){return this.toSeq().map(An).toIndexedSeq()},last:function(e){return this.toSeq().reverse().first(e)},lastKeyOf:function(e){return this.toKeyedSeq().reverse().keyOf(e)},max:function(e){return Et(this,e)},maxBy:function(e,t){return Et(this,t,e)},min:function(e){return Et(this,e?Tn(e):Pn)},minBy:function(e,t){return Et(this,t?Tn(t):Pn,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 jt(this,xt(this,e,t,!0))},skipUntil:function(e,t){return this.skipWhile(Nn(e),t)},sortBy:function(e,t){return jt(this,At(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 jt(this,function(e,t,r){var n=Bt(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 Se((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:Ae(n,u,c,e):(s=!1,{value:void 0,done:!0})}))},n}(this,e,t))},takeUntil:function(e,t){return this.takeWhile(Nn(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=we(e),r=fe(e),n=t?1:0;return function(e,t){return t=Ge(t,3432918353),t=Ge(t<<15|t>>>-15,461845907),t=Ge(t<<13|t>>>-13,5),t=Ge((t=(t+3864292196|0)^e)^t>>>16,2246822507),t=Qe((t=Ge(t^t>>>13,3266489909))^t>>>16)}(e.__iterate(r?t?function(e,t){n=31*n+Cn(Ze(e),Ze(t))|0}:function(e,t){n=n+Cn(Ze(e),Ze(t))|0}:t?function(e){n=31*n+Ze(e)|0}:function(e){n=n+Ze(e)|0}),n)}(this))}});var _n=pe.prototype;_n["@@__IMMUTABLE_ITERABLE__@@"]=!0,_n[Oe]=_n.values,_n.toJSON=_n.toArray,_n.__toStringMapper=Jt,_n.inspect=_n.toSource=function(){return this.toString()},_n.chain=_n.flatMap,_n.contains=_n.includes,un(ve,{flip:function(){return jt(this,mt(this))},mapEntries:function(e,t){var r=this,n=0;return jt(this,this.toSeq().map((function(o,i){return e.call(t,[i,o],n++,r)})).fromEntrySeq())},mapKeys:function(e,t){var r=this;return jt(this,this.toSeq().flip().map((function(n,o){return e.call(t,n,o,r)})).flip())}});var wn=ve.prototype;wn["@@__IMMUTABLE_KEYED__@@"]=!0,wn[Oe]=_n.entries,wn.toJSON=bn,wn.__toStringMapper=function(e,t){return Jt(t)+": "+Jt(e)},un(ye,{toKeyedSeq:function(){return new pt(this,!1)},filter:function(e,t){return jt(this,_t(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 jt(this,bt(this,!1))},slice:function(e,t){return jt(this,wt(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=ae(e,e<0?this.count():this.size);var n=this.slice(0,e);return jt(this,1===r?n:n.concat(Lt(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 jt(this,St(this,e,!1))},get:function(e,t){return(e=ne(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=ne(this,e))>=0&&(void 0!==this.size?this.size===1/0||e<this.size:-1!==this.indexOf(e))},interpose:function(e){return jt(this,function(e,t){var r=Bt(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 Se((function(){return(!o||a%2)&&(o=i.next()).done?o:a%2?Ae(r,a++,t):Ae(r,a++,o.value,o)}))},r}(this,e))},interleave:function(){var e=[this].concat(Lt(arguments)),t=Tt(this.toSeq(),Le.of,e),r=t.flatten(!0);return t.size&&(r.size=t.size*e.length),jt(this,r)},keySeq:function(){return gn(0,this.size)},last:function(e){return this.get(-1,e)},skipWhile:function(e,t){return jt(this,xt(this,e,t,!1))},zip:function(){var e=[this].concat(Lt(arguments));return jt(this,Tt(this,jn,e))},zipAll:function(){var e=[this].concat(Lt(arguments));return jt(this,Tt(this,jn,e,!0))},zipWith:function(e){var t=Lt(arguments);return t[0]=this,jt(this,Tt(this,e,t))}});var xn=ye.prototype;xn["@@__IMMUTABLE_INDEXED__@@"]=!0,xn[_e]=!0,un(ge,{get:function(e,t){return this.has(e)?e:t},includes:function(e){return this.has(e)},keySeq:function(){return this.valueSeq()}});var On=ge.prototype;function Sn(e,t,r,n,o,i){return Ft(e.size),e.__iterate((function(e,i,a){o?(o=!1,r=e):r=t.call(n,r,e,i,a)}),i),r}function An(e,t){return t}function En(e,t){return[t,e]}function Nn(e){return function(){return!e.apply(this,arguments)}}function Tn(e){return function(){return-e.apply(this,arguments)}}function jn(){return Lt(arguments)}function Pn(e,t){return e<t?1:e>t?-1:0}function Cn(e,t){return e^t+2654435769+(e<<6)+(e>>2)|0}On.has=_n.includes,On.contains=On.includes,On.keys=On.values,un(Re,wn),un(Le,xn),un(Ke,On);var Bn=function(e){function t(e){return null==e?Kn():an(e)?e:Kn().withMutations((function(t){var r=ge(e);Ft(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(ve(e).keySeq())},t.prototype.toString=function(){return this.__toString("OrderedSet {","}")},t}(ln);Bn.isOrderedSet=an;var zn,Rn=Bn.prototype;function Ln(e,t){var r=Object.create(Rn);return r.size=e?e.size:0,r._map=e,r.__ownerID=t,r}function Kn(){return zn||(zn=Ln(Gr()))}Rn[_e]=!0,Rn.zip=xn.zip,Rn.zipWith=xn.zipWith,Rn.zipAll=xn.zipAll,Rn.__empty=Kn,Rn.__make=Ln;var Fn=function(e,t){var r;!function(e){if(ke(e))throw new Error("Can not call `Record` with an immutable Record as default values. Use a plain javascript object instead.");if(be(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 "+Vn(this)+' with property "'+l+'" since that property name is part of the Record API.'):Wn(o,l)}}return this.__ownerID=void 0,this._values=zr().withMutations((function(e){e.setSize(a._keys.length),ve(i).forEach((function(t,r){e.set(a._indices[r],t===a._defaultValues[r]?void 0:t)}))})),this},o=n.prototype=Object.create(Jn);return o.constructor=n,t&&(n.displayName=t),n};Fn.prototype.toString=function(){for(var e,t=Vn(this)+" { ",r=this._keys,n=0,o=r.length;n!==o;n++)t+=(n?", ":"")+(e=r[n])+": "+Jt(this.get(e));return t+" }"},Fn.prototype.equals=function(e){return this===e||e&&qn(this).equals(qn(e))},Fn.prototype.hashCode=function(){return qn(this).hashCode()},Fn.prototype.has=function(e){return this._indices.hasOwnProperty(e)},Fn.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},Fn.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 Un(this,r)}return this},Fn.prototype.remove=function(e){return this.set(e)},Fn.prototype.clear=function(){var e=this._values.clear().setSize(this._keys.length);return this.__ownerID?this:Un(this,e)},Fn.prototype.wasAltered=function(){return this._values.wasAltered()},Fn.prototype.toSeq=function(){return qn(this)},Fn.prototype.toJS=function(){return cn(this)},Fn.prototype.entries=function(){return this.__iterator(2)},Fn.prototype.__iterator=function(e,t){return qn(this).__iterator(e,t)},Fn.prototype.__iterate=function(e,t){return qn(this).__iterate(e,t)},Fn.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._values.__ensureOwner(e);return e?Un(this,t,e):(this.__ownerID=e,this._values=t,this)},Fn.isRecord=ke,Fn.getDescriptiveName=Vn;var In,Dn,Mn,Jn=Fn.prototype;function Un(e,t,r){var n=Object.create(Object.getPrototypeOf(e));return n._values=t,n.__ownerID=r,n}function Vn(e){return e.constructor.displayName||e.constructor.name||"Record"}function qn(e){return Ue(e._keys.map((function(t){return[t,e.get(t)]})))}function Wn(e,t){try{Object.defineProperty(e,t,{get:function(){return this.get(t)},set:function(e){Kt(this.__ownerID,"Cannot set on an immutable record."),this.set(t,e)}})}catch(e){}}Jn["@@__IMMUTABLE_RECORD__@@"]=!0,Jn.delete=Jn.remove,Jn.deleteIn=Jn.removeIn=$t,Jn.getIn=kn,Jn.hasIn=_n.hasIn,Jn.merge=Xt,Jn.mergeWith=Zt,Jn.mergeIn=ir,Jn.mergeDeep=nr,Jn.mergeDeepWith=or,Jn.mergeDeepIn=ar,Jn.setIn=Ht,Jn.update=Gt,Jn.updateIn=Qt,Jn.withMutations=sr,Jn.asMutable=ur,Jn.asImmutable=cr,Jn[Oe]=Jn.entries,Jn.toJSON=Jn.toObject=_n.toObject,Jn.inspect=Jn.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(In)return In;In=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 Ye(this._value,e)},t.prototype.slice=function(e,r){var n=this.size;return ie(e,r,n)?this:new t(this._value,se(r,n)-ae(e,n))},t.prototype.reverse=function(){return this},t.prototype.indexOf=function(e){return Ye(this._value,e)?0:-1},t.prototype.lastIndexOf=function(e){return Ye(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 Se((function(){return o===n?{value:void 0,done:!0}:Ae(e,t?n-++o:o++,r._value)}))},t.prototype.equals=function(e){return e instanceof t?Ye(this._value,e._value):sn(e)}}(Le),Dn=new RegExp("^[^֑-߿יִ-﷽ﹰ-ﻼ]*[A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--]"),Mn=new RegExp("^[^A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--]*[֑-߿יִ-﷽ﹰ-ﻼ]");var Hn,$n,Yn=function(e){return e=e.toString(),Mn.test(e)?"rtl":Dn.test(e)?"ltr":"neutral"},Gn={exports:{}};Hn=Gn,$n=Gn.exports,function(e){var t=$n,r=Hn&&Hn.exports==t&&Hn,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 Qn=Object.prototype.hasOwnProperty,Xn=Object.prototype.toString;var Zn=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==Xn)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(Qn.call(e,t))return!1;return!0}return!1};const eo=e,{isEqual:to}=t,{pick:ro}=t,{omit:no}=t;var oo={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 io(e,t){return!(!t||!t[oo[e]])}var ao=void 0,so=void 0;function uo(){ao=0,so=function(){return""+ao++}}uo();var co={create:function(e){if(null==e)return so();if("string"==typeof e)return e;throw new Error("Keys must be strings, but you passed: "+e)},setGenerator:function(e){so=e},resetGenerator:uo},lo="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},fo=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},ho=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}}(),po=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},vo=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)},yo=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},go=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")},mo=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)},ko=function(e){function t(){return fo(this,t),yo(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return vo(t,e),ho(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 X.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}),b(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(zr.isList(e)||Array.isArray(e)){var r=new zr(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?co.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:fr(n),nodes:t.createChildren(c)})}},{key:"isBlockList",value:function(e){return zr.isList(e)&&e.every((function(e){return t.isBlock(e)}))}}]),t}(Fn({data:new fr,isVoid:!1,key:void 0,nodes:new zr,type:void 0}));ko.fromJS=ko.fromJSON,ko.isBlock=io.bind(null,"BLOCK"),ko.prototype[oo.BLOCK]=!0;var bo=function(e){function t(){return fo(this,t),yo(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return vo(t,e),ho(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 X.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}),b(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(zr.isList(e)||Array.isArray(e)){var r=new zr(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?co.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 fr(n),nodes:t.createChildren(c)})}},{key:"isInlineList",value:function(e){return zr.isList(e)&&e.every((function(e){return t.isInline(e)}))}}]),t}(Fn({data:new fr,isVoid:!1,key:void 0,nodes:new zr,type:void 0}));bo.fromJS=bo.fromJSON,bo.isInline=io.bind(null,"INLINE"),bo.prototype[oo.INLINE]=!0;var _o=function(){function e(){fo(this,e)}return ho(e,null,[{key:"create",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(fr.isMap(t))return t;if(b(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 fr(e)}}]),e}();_o.fromJS=_o.fromJSON;var wo={},xo={};function Oo(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=So(this.__cache,s)):a=this.__cache_no_args[t],undefined!==a)return a===xo?void 0:a;var u=r.apply(this,n),c=void 0===u?xo:u;return i?this.__cache=Ao(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 So(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(wo)}function Ao(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(wo,r),e}var Eo=function(e){function t(){return fo(this,t),yo(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return vo(t,e),ho(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 X.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}),b(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(ln.isSet(e)||Array.isArray(e))return new ln(e.map(t.create));if(null==e)return ln();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(b(e)){var r={};return"type"in e&&(r.type=e.type),"data"in e&&(r.data=_o.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 fr(n)})}},{key:"isMarkSet",value:function(e){return ln.isSet(e)&&e.every((function(e){return t.isMark(e)}))}}]),t}(Fn({data:new fr,type:void 0}));Eo.fromJS=Eo.fromJSON,Eo.isMark=io.bind(null,"MARK"),Eo.prototype[oo.MARK]=!0,Oo(Eo.prototype,["getComponent"]);var No={};["deleteBackward","deleteCharBackward","deleteLineBackward","deleteWordBackward","deleteForward","deleteCharForward","deleteWordForward","deleteLineForward","setBlocks","setInlines","splitInline","unwrapBlock","unwrapInline","wrapBlock","wrapInline"].forEach((function(e){No[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()}})),No.setBlock=function(){X.deprecate("slate@0.33.0","The `setBlock` method of Slate changes has been renamed to `setBlocks`."),No.setBlocks.apply(No,arguments)},No.setInline=function(){X.deprecate("slate@0.33.0","The `setInline` method of Slate changes has been renamed to `setInlines`."),No.setInlines.apply(No,arguments)},No.addMark=function(e,t){t=Eo.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)}},No.addMarks=function(e,t){t.forEach((function(t){return e.addMark(t)}))},No.delete=function(e){var t=e.value.selection;e.deleteAtRange(t),e.collapseToStart()},No.insertBlock=function(e,t){t=ko.create(t);var r=e.value.selection;e.insertBlockAtRange(r,t);var n=e.value.document.getNode(t.key);n&&e.collapseToEndOf(n)},No.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))}},No.insertInline=function(e,t){t=bo.create(t);var r=e.value.selection;e.insertInlineAtRange(r,t);var n=e.value.document.getNode(t.key);n&&e.collapseToEndOf(n)},No.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})},No.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})},No.removeMark=function(e,t){t=Eo.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)}},No.replaceMark=function(e,t,r){e.removeMark(t),e.addMark(r)},No.toggleMark=function(e,t){t=Eo.create(t),e.value.activeMarks.has(t)?e.removeMark(t):e.addMark(t)},No.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 To=function(e){function t(){return fo(this,t),yo(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return vo(t,e),ho(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 X.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((zr.isList(e)||Array.isArray(e))&&(e={nodes:e}),b(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?co.create():o,a=e.nodes,s=void 0===a?[]:a;return new t({key:i,data:new fr(n),nodes:t.createChildren(s)})}}]),t}(Fn({data:new fr,key:void 0,nodes:new zr}));function jo(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 Po(e){if(null==e)return null;if(zr.isList(e))return e;if(Array.isArray(e))return zr(e);throw new Error("Paths can only be created from arrays or lists, but you passed: "+e)}function Co(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:zo(e,t),n=e.slice(0,r),o=t.slice(0,r);return[n,o]}function Bo(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 zo(e,t){return Math.min(e.size,t.size)}To.fromJS=To.fromJSON,To.isDocument=io.bind(null,"DOCUMENT"),To.prototype[oo.DOCUMENT]=!0;var Ro={compare:jo,create:Po,crop:Co,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 Bo(e,0-t,r)},increment:Bo,isAbove:function(e,t){var r=Co(e,t),n=go(r,2),o=n[0],i=n[1];return e.size<t.size&&0===jo(o,i)},isAfter:function(e,t){var r=Co(e,t),n=go(r,2);return 1===jo(n[0],n[1])},isBefore:function(e,t){var r=Co(e,t),n=go(r,2);return-1===jo(n[0],n[1])},lift:function(e){return e.slice(0,-1)},max:function(e,t){return Math.max(e.size,t.size)},min:zo,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 Po(r)}},Lo=function(e){function t(){return fo(this,t),yo(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return vo(t,e),ho(t,[{key:"hasAnchorAtStartOf",value:function(e){if(0!=this.anchorOffset)return!1;var t=Ko(e);return this.anchorKey==t.key}},{key:"hasAnchorAtEndOf",value:function(e){var t=Fo(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=Fo(e);return this.focusKey==t.key&&this.focusOffset==t.text.length}},{key:"hasFocusAtStartOf",value:function(e){if(0!=this.focusOffset)return!1;var t=Ko(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=Ko(e),this.moveAnchorTo(e.key,0)}},{key:"moveAnchorToEndOf",value:function(e){return e=Fo(e),this.moveAnchorTo(e.key,e.text.length)}},{key:"moveFocusToStartOf",value:function(e){return e=Ko(e),this.moveFocusTo(e.key,0)}},{key:"moveFocusToEndOf",value:function(e){return e=Fo(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":lo(n),l=void 0===a?"undefined":lo(a);if("number"==c&&"number"==l||X.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){X.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){X.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){X.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=Ro.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 X.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(b(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(zr.isList(e)||Array.isArray(e)){var r=new zr(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(b(e)){var r={};return"anchorKey"in e&&(r.anchorKey=e.anchorKey),"anchorOffset"in e&&(r.anchorOffset=e.anchorOffset),"anchorPath"in e&&(r.anchorPath=Ro.create(e.anchorPath)),"focusKey"in e&&(r.focusKey=e.focusKey),"focusOffset"in e&&(r.focusOffset=e.focusOffset),"focusPath"in e&&(r.focusPath=Ro.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:Eo.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:Ro.create(s),focusKey:c,focusOffset:f,focusPath:Ro.create(d),isAtomic:v,isBackward:g,isFocused:k,marks:null==_?null:new ln(_.map(Eo.fromJSON))})}},{key:"isRange",value:function(e){return!(!e||!e[oo.RANGE])}}]),t}(Fn({anchorKey:null,anchorOffset:0,anchorPath:null,focusKey:null,focusOffset:0,focusPath:null,isAtomic:!1,isBackward:null,isFocused:!1,marks:null}));Lo.fromJS=Lo.fromJSON,Lo.prototype[oo.RANGE]=!0;[["move",""],["move","To"],["move","ToStartOf"],["move","ToEndOf"]].forEach((function(e){var t=go(e,2),r=t[0],n=t[1];Lo.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=go(e,3),r=t[0],n=t[1],o=t[2],i=r+"Anchor"+n,a=r+"Focus"+n;Lo.prototype[r+"Start"+n]=function(){return this.isBackward?this[a].apply(this,arguments):this[i].apply(this,arguments)},Lo.prototype[r+"End"+n]=function(){return this.isBackward?this[i].apply(this,arguments):this[a].apply(this,arguments)},o&&(Lo.prototype[r+"Edge"+n]=function(){return this[i].apply(this,arguments)||this[a].apply(this,arguments)})}));function Ko(e){return"text"==e.object?e:e.getFirstText()}function Fo(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=go(e,2),r=t[0],n=t[1];Lo.prototype[r]=function(){return this[n].apply(this,arguments)}}));var Io=function(e){function t(){return fo(this,t),yo(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return vo(t,e),ho(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 X.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}),b(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("")),zr.isList(e)||Array.isArray(e)){var r=new zr(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 ln(o)})}},{key:"isCharacterList",value:function(e){return zr.isList(e)&&e.every((function(e){return t.isCharacter(e)}))}}]),t}(Fn({marks:new ln,text:""}));Io.fromJS=Io.fromJSON,Io.isCharacter=io.bind(null,"CHARACTER"),Io.prototype[oo.CHARACTER]=!0;var Do=function(e){function t(){return fo(this,t),yo(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return vo(t,e),ho(t,[{key:"getCharacters",value:function(){X.deprecate("slate@0.34.0","The `characters` property of Slate objects is deprecated");var e=this.marks;return Io.createList(this.text.split("").map((function(t){return Io.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 X.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}),b(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=zr().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[zr(),e];if(0===e.size)return[zr(),zr()];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?[zr.of(o),e]:[e.take(n),e.skip(n)]:""===i.text?n===e.size-1?[e,zr.of(i)]:[e.take(n+1),e.skip(n+1)]:[e.take(n).push(o),e.skip(n+1).unshift(i)]:[e,zr()]}},{key:"createList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(zr.isList(e)||Array.isArray(e)){var r=new zr(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:ln((void 0===o?[]:o).map(Eo.fromJSON))})}},{key:"isLeafList",value:function(e){return zr.isList(e)&&e.every((function(e){return t.isLeaf(e)}))}}]),t}(Fn({marks:ln(),text:""}));Do.fromJS=Do.fromJSON,Do.isLeaf=io.bind(null,"LEAF"),Do.prototype[oo.LEAF]=!0;var Mo=function(e){function t(){return fo(this,t),yo(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return vo(t,e),ho(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=ln.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",zr.of(Do.fromJSON({text:"",marks:r})));var o=n.addMarks(r);return o===n?this:this.set("leaves",zr.of(o))}if(""===this.text)return this;if(0===t)return this;if(e>=this.text.length)return this;var i=Do.splitLeaves(this.leaves,e),a=go(i,2),s=a[0],u=a[1],c=Do.splitLeaves(u,t),l=go(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 zr.of(Do.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=Do.splitLeaves(r,f),p=go(d,2),v=p[0],y=p[1],g=Do.splitLeaves(y,h),m=go(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:Do.createLeaves(r)}},{key:"getActiveMarksBetweenOffsets",value:function(e,t){if(e<=0&&t>=this.text.length)return this.getActiveMarks();if(e>=t)return ln();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||ln()}},{key:"getActiveMarks",value:function(){var e=this;if(0===this.leaves.size)return ln();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 ln();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||ln()}},{key:"getMarks",value:function(){var e=this.getMarksAsArray();return new Bn(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:ln()}},{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",zr.of(Do.create({text:t,marks:r})));if(0===t.length)return this;r||(r=ln());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),Do.create({text:t,marks:r}),i.set("text",c));return this.setLeaves(f)}},{key:"regenerateKey",value:function(){var e=co.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",zr.of(o))}if(t<=0)return this;if(e>=this.text.length)return this;var i=Do.splitLeaves(this.leaves,e),a=go(i,2),s=a[0],u=a[1],c=Do.splitLeaves(u,t),l=go(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=Do.splitLeaves(this.leaves,e),c=go(u,2),l=c[0],f=c[1],h=Do.splitLeaves(f,t)[1],d=Do.createLeaves(l.concat(h));if(1===d.size){var p=d.first();if(""===p.text)return this.set("leaves",zr.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",zr.of(a))}if(t<=0)return this;if(e>=this.text.length)return this;var s=Do.splitLeaves(this.leaves,e),u=go(s,2),c=u[0],l=u[1],f=Do.splitLeaves(l,t),h=go(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=Do.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=Do.createLeaves(e);if(1===t.size){var r=t.first();if((!r.marks||0===r.marks.size)&&""===r.text)return this.set("leaves",zr())}return this.set("leaves",Do.createLeaves(e))}},{key:"object",get:function(){return"text"}},{key:"kind",get:function(){return X.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}]}),b(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(zr.isList(e)||Array.isArray(e)){var r=new zr(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?co.create():r,o=e.leaves;if(o||(e.ranges?(X.deprecate("slate@0.27.0","The `ranges` property of Slate objects has been renamed to `leaves`."),o=e.ranges):o=zr()),Array.isArray(o))o=zr(o.map((function(e){return Do.create(e)})));else{if(!zr.isList(o))throw new Error("leaves must be either Array or Immutable.List");o=o.map((function(e){return Do.create(e)}))}return new t({leaves:Do.createLeaves(o),key:n})}},{key:"isTextList",value:function(e){return zr.isList(e)&&e.every((function(e){return t.isText(e)}))}}]),t}(Fn({leaves:zr(),key:void 0}));Mo.fromJS=Mo.fromJSON,Mo.isText=io.bind(null,"TEXT"),Mo.prototype[oo.TEXT]=!0,Oo(Mo.prototype,["getDecorations","getActiveMarks","getMarks","getMarksAsArray","normalize","validate","getString"]);var Jo=function(){function e(){fo(this,e)}return ho(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)})),zr(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 ln();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 ln();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 ln();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)})),zr(r)}},{key:"getBlocks",value:function(){var e=this.getBlocksAsArray();return new zr(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 zr(new Bn(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 zr(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 zr();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=Ro.relate(e,t);return this.getNode(r)}},{key:"getDecorations",value:function(e){var t=e.find("decorateNode",this);return Lo.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 To.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=Ro.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 To.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 zr(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 zr(new Bn(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 zr(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 ln();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(mo(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 ln(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:ln()}},{key:"getMarksAtRange",value:function(e){return new ln(this.getOrderedMarksAtRange(e))}},{key:"getMarksByType",value:function(e){var t=this.getMarksByTypeAsArray(e);return new ln(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=Ro.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=Ro.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 Bn(e)}},{key:"getOrderedMarksAtRange",value:function(e){if((e=e.normalize(this)).isUnset)return Bn();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 Bn().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 Bn(t)}},{key:"getParent",value:function(e){if(!(e=this.resolvePath(e)))return null;if(!e.size)return null;var t=Ro.lift(e);return this.getNode(t)}},{key:"getPath",value:function(e){if(zr.isList(e))return e;var t=this.getKeysToPathsTable()[e];return t?zr(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=Ro.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=Ro.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=Yn(this.text);return"neutral"===e?null:e}},{key:"getTexts",value:function(){var e=this.getTextsAsArray();return new zr(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 zr();var t=e,r=t.startKey,n=t.endKey;return new zr(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=Ro.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=Ro.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=Ro.lift(t);this.assertNode(o);var i=Ro.crop(e,t),a=go(i,2),s=a[0],u=a[1],c=Ro.compare(s,u);e.size<t.size&&-1===c&&(t=Ro.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=co.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 zr(["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 zr(["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=Ro.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=go(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 X.deprecate("0.35.0","The `Node.getNodeAtPath` method has been combined into `Node.getNode`."),this.getNode(e)}},{key:"getDescendantAtPath",value:function(e){return X.deprecate("0.35.0","The `Node.getDescendantAtPath` has been combined into `Node.getDescendant`."),this.getDescendant(e)}},{key:"getKeys",value:function(){X.deprecate("0.35.0","The `Node.getKeys` method is deprecated.");var e=this.getKeysAsArray();return new ln(e)}},{key:"getKeysAsArray",value:function(){X.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;X.deprecate("0.35.0","The `Node.areDescendantsSorted` method is deprecated. Use the new `PathUtils.compare` helper instead."),e=co.create(e),t=co.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){X.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(b(t)){var r=t.object;switch(!r&&t.kind&&(X.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),r=t.kind),r){case"block":return ko.create(t);case"document":return To.create(t);case"inline":return bo.create(t);case"text":return Mo.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(zr.isList(t)||Array.isArray(t)){var r=zr(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(ko.isBlock(e)||bo.isInline(e))return{data:e.data,isVoid:e.isVoid,type:e.type};if("string"==typeof e)return{type:e};if(b(e)){var t={};return"type"in e&&(t.type=e.type),"data"in e&&(t.data=_o.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&&(X.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),t=e.kind),t){case"block":return ko.fromJSON(e);case"document":return To.fromJSON(e);case"inline":return bo.fromJSON(e);case"text":return Mo.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 io(t,e)}))}},{key:"isNodeList",value:function(t){return zr.isList(t)&&t.every((function(t){return e.isNode(t)}))}}]),e}();Jo.fromJS=Jo.fromJSON;var Uo=function(e){Jo.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}},Vo=!0,qo=!1,Wo=void 0;try{for(var Ho,$o=["Child","Depth","Descendant","Node","Parent","Path"][Symbol.iterator]();!(Vo=(Ho=$o.next()).done);Vo=!0){Uo(Ho.value)}}catch(e){qo=!0,Wo=e}finally{try{!Vo&&$o.return&&$o.return()}finally{if(qo)throw Wo}}Oo(Jo.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(Jo.prototype).forEach((function(e){"constructor"!==e&&(ko.prototype[e]=Jo.prototype[e],bo.prototype[e]=Jo.prototype[e],To.prototype[e]=Jo.prototype[e])})),ko.createChildren=Jo.createList,bo.createChildren=Jo.createList,To.createChildren=Jo.createList;var Yo=/\s/,Go=/['\u2018\u2019]/,Qo=/[\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 Xo(e){return 55296<=e&&e<=57343}function Zo(e,t){if(Yo.test(e))return!1;if(Go.test(e)){var r=t.charAt(0),n=ei(r);if(Zo(r=t.slice(0,n),t.slice(n)))return!0}return!Qo.test(e)}function ei(e){return Xo(e.charCodeAt(0))?2:1}function ti(e){return ei(e.charAt(0))}function ri(e){for(var t=0,r=0,n=!1,o=void 0;o=e.charAt(r);){var i=ei(o);if(Zo(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 ni={getCharLength:ei,getCharOffset:ti,getCharOffsetBackward:function(e,t){return e=e.slice(0,t),ti(e=Gn.exports.reverse(e))},getCharOffsetForward:function(e,t){return ti(e=e.slice(t))},getWordOffset:ri,getWordOffsetBackward:function(e,t){return e=e.slice(0,t),ri(e=Gn.exports.reverse(e))},getWordOffsetForward:function(e,t){return ri(e=e.slice(t))},isSurrogate:Xo,isWord:Zo},oi={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),S=O.getFurthestAncestor(i),A=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!=S.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(S),R=O.nodes.indexOf(A),L=O.nodes.slice(z+1,R);for(L.reverse().forEach((function(t){e.removeNodeByKey(t.key,{normalize:!1})})),j=_;j.key!=A.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=ni.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=ni.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=ni.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=ni.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=ko.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),S=O?f.nodes.skipUntil((function(e){return e.key==O.key})):zr(),A=b.nodes.size;S.forEach((function(t,r){var n=A+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=bo.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(){X.deprecate("slate@0.33.0","The `setBlockAtRange` method of Slate changes has been renamed to `setBlocksAtRange`."),oi.setBlocksAtRange.apply(oi,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(){X.deprecate("slate@0.33.0","The `setInlineAtRange` method of Slate changes has been renamed to `setInlinesAtRange`."),oi.setInlinesAtRange.apply(oi,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=Eo.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=Jo.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=Jo.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=ko.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=bo.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",zr([_])),oi.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),S=d.nodes.indexOf(O),A=s==c?O:d.getFurthestAncestor(c),E=d.nodes.skipUntil((function(e){return e==O})).takeUntil((function(e){return e==A})).push(A),N=r.regenerateKey();e.insertNodeByKey(d.key,S,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})}},ii={addMarkByPath:function(e,t,r,n,o,i){o=Eo.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=Ro.relate(t,r);e.normalizeNodeByPath(a,o)},removeMarkByPath:function(e,t,r,n,o,i){o=Eo.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=Lo.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=Jo.create(r);var o=t.last(),i=Ro.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=Eo.create(o),i=Eo.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=Jo.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=Ro.lift(t),i=n.assertNode(o),a=t.last(),s=o.last(),u=Ro.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=Ro.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=ko.create(r)).set("nodes",r.nodes.clear());var o=Ro.lift(t),i=t.last(),a=Ro.increment(t);e.insertNodeByPath(o,i,r,{normalize:!1}),e.moveNodeByPath(a,t,0,n)},wrapInlineByPath:function(e,t,r,n){r=(r=bo.create(r)).set("nodes",r.nodes.clear());var o=Ro.lift(t),i=t.last(),a=Ro.increment(t);e.insertNodeByPath(o,i,r,{normalize:!1}),e.moveNodeByPath(a,t,0,n)},wrapNodeByPath:function(e,t,r){"block"!=(r=Jo.create(r)).object?"inline"!=r.object||e.wrapInlineByPath(t,r):e.wrapBlockByPath(t,r)}},ai=function(e){ii[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))}},si=!0,ui=!1,ci=void 0;try{for(var li,fi=["addMark","insertFragment","insertNode","insertText","mergeNode","removeMark","removeAllMarks","removeNode","setText","replaceText","removeText","replaceNode","setMark","setNode","splitNode","unwrapInline","unwrapBlock","unwrapNode","wrapBlock","wrapInline","wrapNode"][Symbol.iterator]();!(si=(li=fi.next()).done);si=!0){ai(li.value)}}catch(e){ui=!0,ci=e}finally{try{!si&&fi.return&&fi.return()}finally{if(ui)throw ci}}ii.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))},ii.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 hi=eo("slate:history"),di=function(e){function t(){return fo(this,t),yo(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return vo(t,e),ho(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=vi(e,c)),s)return r;if(null==a&&(a=pi(e,c)),hi("save",{operation:e,merge:a}),a&&u){var l=u.push(e);o=(o=o.pop()).push(l)}else{var f=new zr([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 X.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(b(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(zr.isList(e))return e;if(Array.isArray(e))return new zr(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 Zr(n.map(this.createOperationsList)),undos:new Zr(i.map(this.createOperationsList))})}}]),t}(Fn({redos:new Zr,undos:new Zr}));function pi(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&&to(e.path,t.path)||"remove_text"==e.type&&"remove_text"==t.type&&e.offset+e.text.length==t.offset&&to(e.path,t.path))}function vi(e,t){return!!t&&("set_selection"==e.type&&"set_selection"==t.type)}di.fromJS=di.fromJSON,di.isHistory=io.bind(null,"HISTORY"),di.prototype[oo.HISTORY]=!0;var yi=function(e){function t(){return fo(this,t),yo(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return vo(t,e),ho(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 X.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[oo.STACK])}}]),t}(Fn({plugins:[]}));yi.prototype[oo.STACK]=!0,Oo(yi.prototype,["getPluginsWith"]);var gi=function(e){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};fo(this,t);var n=yo(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 vo(t,e),t}(Error),mi=eo("slate:schema"),ki=[{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,Mo.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=Mo.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=Mo.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})}}],bi=function(e){function t(){return fo(this,t),yo(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return vo(t,e),ho(t,[{key:"validateNode",value:function(e){var t=this.rules.filter((function(t){return _i(e,t.match)})),r=wi(e,t,this.rules,{every:!0});if(r)return new gi(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){mi("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 X.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(b(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(ki),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(po({match:[{object:"document"}]},l.document)),h)n.push(po({match:[{object:"block",type:v}]},h[v]));for(var y in p)n.push(po({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:yi.create({plugins:r}),rules:n})}},{key:"isSchema",value:function(e){return!(!e||!e[oo.SCHEMA])}}]),t}(Fn({stack:yi.create(),rules:[]}));function _i(e,t){return!wi(e,t)}function wi(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=wi(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=xi(e,t)||Oi(e,t)||Si(e,t)||Ai(e,t)||Ei(e,t)||Ni(e,t)||Ti(e,t)||ji(e,t)||Pi(e,t,r);return v}function xi(e,t){if(t.objects&&X.warn("The `objects` schema validation rule was changed. Please use the new `match` syntax with `object`."),null!=t.object&&t.object!==e.object)return Ri("node_object_invalid",{rule:t,node:e})}function Oi(e,t){if(t.types&&X.warn("The `types` schema validation rule was changed. Please use the new `match` syntax with `type`."),null!=t.type&&t.type!==e.type)return Ri("node_type_invalid",{rule:t,node:e})}function Si(e,t){if(null!=t.isVoid&&t.isVoid!==e.isVoid)return Ri("node_is_void_invalid",{rule:t,node:e})}function Ai(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 Ri("node_data_invalid",{rule:t,node:e,key:r,value:o})}}function Ei(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:Ri("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":lo(c)))return c.v}}catch(e){i=!0,a=e}finally{try{!o&&u.return&&u.return()}finally{if(i)throw a}}}}function Ni(e,t){if(null!=t.text){var r=e.text;if(!t.text.test(r))return Ri("node_text_invalid",{rule:t,node:e,text:r})}}function Ti(e,t){if(null!=t.first){var r=e.nodes.first();if(r){var n=wi(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 ji(e,t){if(null!=t.last){var r=e.nodes.last();if(r){var n=wi(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 Pi(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=Ci(e,l,r)||Bi(e,l,f,s,r)||zi(e,l,h,s,r);if(d)return d;if(null!=t.nodes){if(!u)return Ri("child_unknown",{rule:t,node:e,child:l,index:s});if(u&&(u.objects&&X.warn("The `objects` schema validation rule was changed. Please use the new `match` syntax with `object`."),u.types&&X.warn("The `types` schema validation rule was changed. Please use the new `match` syntax with `type`.")),u.match){var p=wi(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 Ri("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 Ci(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&&_i(t,u.match)){var c=wi(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 Bi(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&&_i(t,l.match)){var f=wi(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 zi(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&&_i(t,l.match)){var f=wi(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 Ri(e,t){return po({code:e},t)}bi.fromJS=bi.fromJSON,bi.prototype[oo.SCHEMA]=!0;var Li=function(e){function t(){return fo(this,t),yo(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return vo(t,e),ho(t,[{key:"change",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Zi(po({},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=Ro.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 X.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 zr:this.document.getCharactersAtRange(this.selection)}},{key:"marks",get:function(){return this.selection.isUnset?new ln:this.selection.marks||this.document.getMarksAtRange(this.selection)}},{key:"activeMarks",get:function(){return this.selection.isUnset?new ln:this.selection.marks||this.document.getActiveMarksAtRange(this.selection)}},{key:"blocks",get:function(){return this.selection.isUnset?new zr:this.document.getBlocksAtRange(this.selection)}},{key:"fragment",get:function(){return this.selection.isUnset?To.create():this.document.getFragmentAtRange(this.selection)}},{key:"inlines",get:function(){return this.selection.isUnset?new zr:this.document.getInlinesAtRange(this.selection)}},{key:"texts",get:function(){return this.selection.isUnset?new zr: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(b(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(b(e)){var r={};return"data"in e&&(r.data=_o.create(e.data)),"decorations"in e&&(r.decorations=Lo.createList(e.decorations)),"schema"in e&&(r.schema=bi.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 fr;if(o=To.fromJSON(o),a=Lo.fromJSON(a),u=bi.fromJSON(u),l=di.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[oo.VALUE])}}]),t}(Fn({data:new fr,decorations:null,document:To.create(),history:di.create(),schema:bi.create(),selection:Lo.create()}));Li.fromJS=Li.fromJSON,Li.prototype[oo.VALUE]=!0;var Ki={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"]},Fi=function(e){function t(){return fo(this,t),yo(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return vo(t,e),ho(t,[{key:"toJSON",value:function(){var e=this.object,t=this.type,r={object:e,type:t},n=Ki[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 X.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(b(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(zr.isList(e)||Array.isArray(e)){var r=new zr(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=Ki[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=Ro.create(f)),"mark"===l&&(f=Eo.create(f)),"marks"===l&&null!=f&&(f=Eo.createSet(f)),"node"===l&&(f=Jo.create(f)),"selection"===l&&(f=Lo.create(f)),"value"===l&&(f=Li.create(f)),"properties"===l&&"merge_node"===r&&(f=Jo.createProperties(f)),"properties"===l&&"set_mark"===r&&(f=Eo.createProperties(f)),"properties"===l&&"set_node"===r&&(f=Jo.createProperties(f)),"properties"===l&&"set_selection"===r&&(f=Lo.createProperties(f)),"properties"===l&&"set_value"===r&&(f=Li.createProperties(f)),"properties"===l&&"split_node"===r&&(f=Jo.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[oo.OPERATION])}},{key:"isOperationList",value:function(e){return zr.isList(e)&&e.every((function(e){return t.isOperation(e)}))}}]),t}(Fn({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}));Fi.fromJS=Fi.fromJSON,Fi.prototype[oo.OPERATION]=!0;var Ii=eo("slate:operation:invert");function Di(e){var t=(e=Fi.create(e)).type;switch(Ii(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=Ro.decrement(c);return e.set("type","split_node").set("path",l);case"split_node":var f=e.path,h=Ro.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=ro(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=ro(b,Object.keys(k));return e.set("mark",_).set("properties",w);case"set_selection":var x=e,O=x.properties,S=x.selection,A=S.merge(O),E=ro(S,Object.keys(O));return e.set("selection",A).set("properties",E);case"set_value":var N=e,T=N.properties,j=N.value,P=j.merge(T),C=ro(j,Object.keys(T));return e.set("value",P).set("properties",C);default:throw new Error('Unknown operation type: "'+t+'".')}}var Mi={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",no(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(Di).forEach((function(t){var r=t,n=r.type,o=r.properties;"set_selection"==n&&(t=t.set("properties",no(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)}}},Ji={select:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t=Lo.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=ro(c,Object.keys(t)))!0!==o&&Ye(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),Zn(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;Ji["moveChar"+e]=function(e){e[t]()[r]()},Ji["moveStartChar"+e]=function(e){e.value.isBackward?e[r]():e[t]()},Ji["moveEndChar"+e]=function(e){e.value.isBackward?e[t]():e[r]()},Ji["extendChar"+e]=function(t){t["moveFocusChar"+e]()},Ji["collapseChar"+e]=function(t){t["Forward"==e?"collapseToEnd":"collapseToStart"]()["moveChar"+e]()}}));[["collapseLineBackward","collapseToStartOfBlock"],["collapseLineForward","collapseToEndOfBlock"],["extendLineBackward","extendToStartOfBlock"],["extendLineForward","extendToEndOfBlock"]].forEach((function(e){var t=go(e,2),r=t[0],n=t[1];Ji[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){Ji[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 Ui=["Next","Previous"],Vi=["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";Vi.forEach((function(e){var t="Text"==e?"getNode":"getClosest"+e;Ji[""+r+e]=function(e){var n=e.value,o=n.document,i=n.selection,a=o[t](i.startKey);a&&e[r](a)},Ui.forEach((function(n){var o="get"+n+e,i="Next"==n?"startKey":"endKey";Ji[""+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 qi={setValue:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t=Li.createProperties(t);var n=e.value;e.applyOperation({type:"set_value",properties:t,value:n},r)}},Wi={};function Hi(e,t,r){if("text"!=t.object){for(var n=t.getFirstInvalidDescendant(r),o=e.value.document.getPath(t.key);t&&n;)Hi(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&&$i(e,t,r)}else $i(e,t,r)}function $i(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)}Wi.normalize=function(e,t){e.normalizeDocument(t)},Wi.normalizeDocument=function(e,t){var r=e.value.document;e.normalizeNodeByKey(r.key,t)},Wi.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);Hi(e,s,a),e.normalizeAncestorsByKey(t)}},Wi.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)&&$i(e,t,o)}))},Wi.normalizeParentByKey=function(e,t,r){var n=e.value.document.getParent(t);e.normalizeNodeByKey(n.key,r)},Wi.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);Hi(e,s,a);var u=(i=e.value.document).getAncestors(t);u&&u.forEach((function(t){e.value.document.getDescendant(t.key)&&$i(e,t,a)}))}},Wi.normalizeParentByPath=function(e,t,r){var n=Ro.lift(t);e.normalizeNodeByPath(n,r)};var Yi=po({},No,oi,ii,Mi,Ji,qi,Wi),Gi=eo("slate:operation:apply");function Qi(e,t){var r=(t=Fi.create(t)).type;switch(Gi(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 S=t.path;return e.removeNode(S);case"remove_text":var A=t,E=A.path,N=A.offset,T=A.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 Xi=eo("slate:change"),Zi=function(){function e(t){fo(this,e);var r=t.value;this.value=r,this.operations=new zr,this.flags=po({normalize:!0},ro(t,["merge","save","normalize"]))}return ho(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;b(e)&&(e=po({},e,{value:o})),e=Fi.create(e);var s=t=po({},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 Xi("apply",{operation:e,save:f,merge:c}),o=Qi(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 X.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}}]),e}();Zi.isChange=io.bind(null,"CHANGE"),Zi.prototype[oo.CHANGE]=!0,Object.keys(Yi).forEach((function(e){Zi.prototype[e]=function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return Xi(e,{args:r}),this.call.apply(this,[Yi[e]].concat(r)),this}}));const ea=r,{renderToStaticMarkup:ta}=n;var ra=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},na=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},oa=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)},ia=new Fn({object:"string",text:""}),aa={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(ea.createElement("br",{key:r})),e.push(t),e}),[])}};function sa(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 ua=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=na({object:"block",data:{},isVoid:!1},i,{nodes:[t]});return e.push(o),e}),[])).length&&(c=[na({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:Li.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(g(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)),g(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=g(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=ta(ea.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 la(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 ia({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 la(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)}},ca=0;function la(e){return ea.cloneElement(e,{key:ca++})}var fa,ha,da,pa={"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},va={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},ya=function(e){return e.length?e.charAt(0).toUpperCase()+e.substring(1):e},ga=ya,ma=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,ka="undefined"==typeof document?{}:document.documentElement.style,ba=(fa=function(){for(var e in ka)if(ma.test(e))return e.match(ma)[0];return"WebkitOpacity"in ka?"Webkit":"KhtmlOpacity"in ka?"Khtml":""}(),ha=fa.toLowerCase(),{style:fa,css:"-"+ha+"-",dom:{Webkit:"WebKit",ms:"MS",o:"WebKit"}[fa]||ga(fa)}),_a=function(e,t){return t?t.toUpperCase():""},wa=/[-\s]+(.)?/g,xa=function(e){return e?e.replace(wa,_a):""},Oa=/::/g,Sa=/([A-Z]+)([A-Z][a-z])/g,Aa=/([a-z\d])([A-Z])/g,Ea=/_/g,Na=function(e,t){return e?e.replace(Oa,"/").replace(Sa,"$1_$2").replace(Aa,"$1_$2").replace(Ea,t||"-"):""},Ta=function(e){return Na(e).toLowerCase()},ja=xa,Pa=Ta,Ca=function(e){return e.length?e.charAt(0).toLowerCase()+e.substring(1):e},Ba=ya,za=ba,Ra=pa,La="undefined"==typeof document?{}:document.documentElement.style,Ka=function(e,t){t=t||{};var r=Ca(ja(e)),n=Pa(e),o=da?r:n,i=za.style?da?za.style:za.css:"";if(r in La)return t.asString?o:[o];var a=o,s=Ra[n],u=[];if(da&&(a=Ba(o)),"function"==typeof s){var c=s(o,i)||[];c&&!Array.isArray(c)&&(c=[c]),c.length&&(c=c.map((function(e){return da?Ca(ja(e)):Pa(e)}))),u=u.concat(c)}return i&&u.push(i+a),u.push(o),t.asString||1==u.length?u[0]:u},Fa=Object.prototype.hasOwnProperty,Ia=function(e,t){return Fa.call(e,t)},Da=Object.prototype.toString,Ma=Object.prototype.toString,Ja=Ka,Ua=Ta,Va=xa,qa=Ia,Wa=function(e){return!!e&&"[object Object]"===Da.call(e)},Ha=function(e){return"[object Function]"===Ma.apply(e)},$a=function(e,t,r,n){Ja(t).forEach((function(t){e[n?n(t):t]=r}))},Ya={cssUnitless:va},Ga=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||Ya).cssUnitless=t.cssUnitless||Ya.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?Va:Ua;for(a in e)if(qa(e,a)){if(s=e[a],i=Ua(r?r+a:a),o=!1,f=!1,Ha(s)&&(l=s.call(h||e,s,a,i,e),Wa(l)&&null!=l.value?(s=l.value,f=l.prefix,i=l.name?Ua(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?$a(n,e,s,g):n[g(e)]=s}));continue}f?$a(n,i,s,g):n[g(i)]=s}else Ga(s,t,i+"-",n)}return n},Qa=Ga,Xa=Ia,Za={prefixProperties:pa,cssUnitless:va,object:Ga,string:function(e,t){e=Qa(e,t);var r,n=[];for(r in e)Xa(e,r)&&n.push(r+": "+e[r]);return n.join("; ")}};const es=e("@pie-lib:mask-markup:serialization"),ts=["span"],rs=["em","strong","u"],ns=(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),Za.object(n,{camelize:!0,addUnits:!1});var n},os=["border","class","style"],is={b:"bold",em:"italic",u:"underline",s:"strikethrough",code:"code",strong:"strong"},as=[{deserialize(e,t){const r=is[e.tagName.toLowerCase()];if(r)return es("[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=os.reduce((e=>(t,r)=>{if(!e.getAttribute)return t;if(e.getAttribute(r))switch(r){case"style":t.style=ns(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=>ts.includes(e)?"inline":rs.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)}}}],ss=new function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};ra(this,e),ua.call(this);var r=t.defaultBlock,n=void 0===r?"paragraph":r,o=t.parseHtml,i=void 0===o?sa:o,a=t.rules,s=void 0===a?[]:a;n=Jo.createProperties(n),this.rules=[].concat(oa(s),[aa]),this.defaultBlock=n,this.parseHtml=i}({rules:as,defaultBlock:"span"}),us=r,cs=o,{get:ls}=t,{withStyles:fs}=i,hs=a;function ds(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 ps=fs((e=>({para:{paddingTop:2*e.spacing.unit,paddingBottom:2*e.spacing.unit}})))((e=>us.createElement("div",{className:e.classes.para},e.children))),vs=fs((()=>({spacer:{display:"inline-block",width:".75em"}})))((e=>us.createElement("span",{className:e.classes.spacer}))),ys=["tbody","tr"],gs=(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(us.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"!==ds([o,"optionalAccess",e=>e.type])&&"drag-in-the-blank"===i&&a.push(us.createElement(vs,{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&&ys.includes(n)?void 0:t})(o,r);return n?e+n:e}),""),r=(e=>{const t=e.leaves.find((e=>ls(e,"marks",[]).length));return t?t.marks[0]:null})(e);if(r){let e;for(e in is)if(is[e]===r.type){const r=e;a.push(us.createElement(r,{key:u},t));break}}else t.length>0&&(a.push(t),"td"!==ds([o,"optionalAccess",e=>e.type])&&"drag-in-the-blank"===i&&a.push(us.createElement(vs,{key:`spacer-${s}`})))}else{const o=gs(e,t,r,n,e,i);if("p"===e.type||"paragraph"===e.type)a.push(us.createElement(ps,{key:u},o));else{const t=e.type;e.nodes&&e.nodes.length>0?a.push(us.createElement(t,{key:u,...e.data.attributes},o)):a.push(us.createElement(t,{key:u,...e.data.attributes}))}}})),a},ms=fs((()=>({main:{display:"initial"},tableStyle:{"&:not(.MathJax) table":{borderCollapse:"collapse"},"&:not(.MathJax) table td, &:not(.MathJax) table th":{padding:"8px 12px",textAlign:"left"}}})))((e=>us.createElement("div",{className:hs(e.classes.main,e.classes.tableStyle)},e.children)));class ks extends us.Component{constructor(...e){super(...e),ks.prototype.__init.call(this)}static __initStatic(){this.propTypes={renderChildren:cs.func,layout:cs.object,value:cs.object,onChange:cs.func,elementType:cs.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=gs(t,e,this.handleChange,this.props.renderChildren,null,r);return us.createElement(ms,null,n)}}ks.__initStatic();const bs=/\{\{(\d+)\}\}/g;const _s=r,ws=s,xs=o;var Os;const Ss=(e,t)=>{const{markup:r}=(o=t,(n=e)?{markup:n.replace(bs,((e,t)=>`<span data-component="${o}" data-id="${t}"></span>`))}:{markup:""});var n,o;const i=(e=>ss.deserialize(e,{toJSON:!0}))(r);return i.document},As=(e,t)=>((Os=class extends _s.Component{static __initStatic(){this.propTypes={markup:xs.string,layout:xs.object,value:xs.object,onChange:xs.func,customMarkMarkupComponent:xs.func,elementType:xs.string}}componentDidUpdate(e){if(this.props.markup!==e.markup){const e=ws.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||Ss(r,e);return _s.createElement(ks,{elementType:a,layout:s,value:o,onChange:i,renderChildren:t(this.props)})}}).__initStatic(),Os),Es=r,Ns=s,Ts=o,{withStyles:js}=i,{Chip:Ps}=u,Cs=a,{color:Bs}=c,{renderMath:zs}=h,{DragSource:Rs}=d;class Ls extends Es.Component{constructor(...e){super(...e),Ls.prototype.__init.call(this),Ls.prototype.__init2.call(this),Ls.prototype.__init3.call(this),Ls.prototype.__init4.call(this)}static __initStatic(){this.propTypes={disabled:Ts.bool,choice:Ts.object,classes:Ts.object,connectDragSource:Ts.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(){zs(this.rootRef)}render(){const{connectDragSource:e,choice:t,classes:r,disabled:n}=this.props;return e(Es.createElement("span",{className:Cs(r.choice,n&&r.disabled),ref:e=>{this.dragContainerRef=Ns.findDOMNode(e)}},Es.createElement(Ps,{clickable:!1,disabled:!0,ref:e=>{this.rootRef=Ns.findDOMNode(e)},className:r.chip,label:Es.createElement("span",{className:r.chipLabel,ref:e=>{e&&(e.innerHTML=t.value||" ")}}," "),variant:n?"outlined":void 0})),{})}}Ls.__initStatic();const Ks=js((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:Bs.white(),border:`1px solid ${Bs.text()}`,color:Bs.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}})))(Ls),Fs=Rs("MaskBlank",{canDrag:e=>!e.disabled,beginDrag:e=>({choice:e.choice,instanceId:e.instanceId})},((e,t)=>({connectDragSource:e.dragSource(),isDragging:t.isDragging()})))(Ks),Is=r,Ds=o,{findKey:Ms}=t,{DragDroppablePlaceholder:Js}=d;class Us extends Is.Component{constructor(...e){super(...e),Us.prototype.__init.call(this)}static __initStatic(){this.propTypes={disabled:Ds.bool,duplicates:Ds.bool,choices:Ds.arrayOf(Ds.shape({label:Ds.string,value:Ds.string})),value:Ds.object,choicePosition:Ds.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===Ms(n,(t=>t===e.id))})),i={...this.getStyleForWrapper(),minWidth:"100px"};return Is.createElement("div",{style:i},Is.createElement(Js,{disabled:e},o.map(((t,r)=>Is.createElement(Fs,{key:`${t.value}-${r}`,disabled:e,choice:t})))))}}Us.__initStatic();const{colors:{grey:Vs}}=u,{Chip:qs}=u,Ws=r,Hs=s,$s=o,Ys=e,{withStyles:Gs}=i,Qs=a,{color:Xs}=c,{renderMath:Zs}=h,{DragSource:eu}=d,{DropTarget:tu}=d;const ru=Ys("pie-lib:mask-markup:blank"),nu=Gs((()=>({content:{border:`solid 0px ${Xs.primary()}`,minWidth:"200px",touchAction:"none",overflow:"hidden",whiteSpace:"nowrap"},chip:{backgroundColor:Xs.background(),border:`2px dashed ${Xs.text()}`,color:Xs.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 ${Xs.correct()}`},incorrect:{border:`solid 1px ${Xs.incorrect()}`},over:{whiteSpace:"nowrap",overflow:"hidden"},parentOver:{border:`1px solid ${Vs[500]}`,backgroundColor:`${Vs[300]}`}})));class ou extends Ws.Component{constructor(){super(),ou.prototype.__init.call(this),ou.prototype.__init2.call(this),ou.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){Zs(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 Ws.createElement(qs,{clickable:!1,disabled:!0,ref:e=>{this.rootRef=Hs.findDOMNode(e)},component:"span",label:Ws.createElement(Ws.Fragment,null,Ws.createElement("span",{className:Qs(r.chipLabel,n&&r.over,{[r.hidden]:a}),ref:e=>{e&&(this.spanRef=Hs.findDOMNode(e),e.innerHTML=s||"",this.addDraggableFalseAttributes(e))}}," "),a&&Ws.createElement("span",{className:Qs(r.chipLabel,n&&r.over,r.dragged),ref:e=>{e&&(this.spanRef=Hs.findDOMNode(e),e.innerHTML=a||"",this.addDraggableFalseAttributes(e))}}," ")),className:Qs(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()}})}}ou.defaultProps={emptyResponseAreaWidth:0,emptyResponseAreaHeight:0},ou.propTypes={id:$s.oneOfType([$s.string,$s.number]),disabled:$s.bool,duplicates:$s.bool,choice:$s.object,classes:$s.object,isOver:$s.bool,dragItem:$s.object,correct:$s.bool,onChange:$s.func,emptyResponseAreaWidth:$s.oneOfType([$s.string,$s.number]),emptyResponseAreaHeight:$s.oneOfType([$s.string,$s.number])};const iu=nu(ou),au=nu((({connectDragSource:e,connectDropTarget:t,...r})=>{const{classes:n,isOver:o}=r;return t(e(Ws.createElement("span",{className:Qs(n.content,o&&n.over)},Ws.createElement(iu,{...r}))))})),su=tu("MaskBlank",{drop(e,t){const r=t.getItem();return ru("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()})))(au),uu=eu("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()})))(su),cu=r,lu=o,{renderMath:fu}=h,hu=As("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 cu.createElement(uu,{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 du extends cu.Component{constructor(...e){super(...e),du.prototype.__init.call(this)}static __initStatic(){this.propTypes={markup:lu.string,layout:lu.object,choicesPosition:lu.string,choices:lu.arrayOf(lu.shape({label:lu.string,value:lu.string})),value:lu.object,onChange:lu.func,duplicates:lu.bool,disabled:lu.bool,feedback:lu.object,correctResponse:lu.object,showCorrectAnswer:lu.bool,emptyResponseAreaWidth:lu.oneOfType([lu.string,lu.number]),emptyResponseAreaHeight:lu.oneOfType([lu.string,lu.number])}}UNSAFE_componentWillReceiveProps(){this.rootRef&&fu(this.rootRef)}componentDidUpdate(){fu(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 cu.createElement("div",{ref:e=>e&&(this.rootRef=e),style:p},cu.createElement(Us,{choicePosition:d,duplicates:t,choices:a,value:n,disabled:u}),cu.createElement(hu,{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}))}}du.__initStatic();const pu=r,{withStyles:vu}=i,yu=a,{color:gu}=c,mu=p;function ku(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 bu=vu((()=>({editableHtmlCustom:{display:"inline-block",verticalAlign:"middle",margin:"4px",borderRadius:"4px",border:`1px solid ${gu.black()}`},correct:{border:`1px solid ${gu.correct()}`},incorrect:{border:`1px solid ${gu.incorrect()}`}})))(As("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=ku([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 pu.createElement(mu,{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:!!ku([l,"optionalAccess",e=>e.characters,"optionalAccess",e=>e.disabled])},className:yu(c.editableHtmlCustom,{[c.correct]:g,[c.incorrect]:m})})}})));As("input",(e=>(t,r,n)=>{const o=t.data&&t.data.dataset||{};if("input"===o.component)return e.customMarkMarkupComponent(o.id)}));const _u=r,wu=o,{Button:xu}=u,{InputLabel:Ou}=u,{Menu:Su}=u,{MenuItem:Au}=u,{ArrowDropDown:Eu}=l,{ArrowDropUp:Nu}=l,{Close:Tu}=l,{Check:ju}=l,{withStyles:Pu}=i,Cu=a,{color:Bu}=c,{renderMath:zu}=h;class Ru extends _u.Component{static __initStatic(){this.propTypes={id:wu.string,value:wu.string,disabled:wu.bool,onChange:wu.func,classes:wu.object,correct:wu.bool,choices:wu.arrayOf(wu.shape({value:wu.string,label:wu.string})),showCorrectAnswer:wu.bool,singleQuery:wu.bool,correctValue:wu.string}}constructor(e){super(e),Ru.prototype.__init.call(this),Ru.prototype.__init2.call(this),Ru.prototype.__init3.call(this),Ru.prototype.__init4.call(this),Ru.prototype.__init5.call(this),this.state={anchorEl:null,highlightedOptionId:null,menuWidth:null,previewValue:null},this.hiddenRef=_u.createRef(),this.buttonRef=_u.createRef(),this.previewRef=_u.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||zu(e)})),r){const e=r.clientWidth;e!==this.state.menuWidth&&(this.elementRefs.forEach((e=>{e&&zu(e)})),zu(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?_u.createElement(ju,{className:Cu(e.correctnessIndicatorIcon,e.correctIcon)}):_u.createElement(Tu,{className:Cu(e.correctnessIndicatorIcon,e.incorrectIcon)})),_u.createElement(_u.Fragment,null,_u.createElement("div",{ref:this.hiddenRef,style:{position:"absolute",visibility:"hidden",top:0,left:0},tabIndex:-1,"aria-hidden":"true"},(i||[]).map(((t,r)=>_u.createElement(Au,{key:r,classes:{root:e.menuRoot,selected:e.selected},tabIndex:-1,"aria-hidden":"true"},_u.createElement("span",{className:e.label,dangerouslySetInnerHTML:{__html:t.label}}))))),_u.createElement(Ou,{className:e.srOnly,id:y,tabIndex:-1,"aria-hidden":"true"},g),_u.createElement(xu,{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,_u.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?_u.createElement(Nu,null):_u.createElement(Eu,null)),_u.createElement(Su,{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 _u.createElement(Au,{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)},_u.createElement("span",{ref:e=>this.elementRefs[n]=e,className:e.label,dangerouslySetInnerHTML:{__html:r.label}}),_u.createElement("span",{className:e.selectedIndicator,dangerouslySetInnerHTML:{__html:r.value===o?" ✓":""}}))}))))}}Ru.__initStatic();var Lu=Pu((()=>({root:{color:Bu.text(),border:`1px solid ${Bu.borderGray()}`,borderRadius:"4px",justifyContent:"space-between",backgroundColor:Bu.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:Bu.text(),marginLeft:"5px"},"&:focus, &:focus-visible":{outline:`3px solid ${Bu.tertiary()}`,outlineOffset:"2px",borderWidth:"3px"}},disabledCorrect:{borderWidth:"2px",borderColor:Bu.correct(),color:`${Bu.text()} !important`},disabledIncorrect:{borderWidth:"2px",borderColor:Bu.incorrectWithIcon(),color:`${Bu.text()} !important`},selectMenu:{backgroundColor:Bu.background(),border:`1px solid ${Bu.correct()} !important`,"&:hover":{border:`1px solid ${Bu.text()} `,borderColor:"initial"},"&:focus":{border:`1px solid ${Bu.text()}`,borderColor:"initial"},"& .MuiList-root":{padding:0}},selected:{color:`${Bu.text()} !important`,backgroundColor:`${Bu.background()} !important`,"&:hover":{color:Bu.text(),backgroundColor:`${Bu.dropdownBackground()} !important`}},menuRoot:{color:Bu.text(),backgroundColor:Bu.background(),"&:focus, &:focus-visible":{outline:`3px solid ${Bu.tertiary()}`,outlineOffset:"-1px"},"&:focus":{color:Bu.text(),backgroundColor:Bu.background()},"&:hover":{color:Bu.text(),backgroundColor:Bu.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:`${Bu.white()} !important`,position:"absolute",top:"-8px !important",left:"-8px",marginLeft:"0 !important",borderRadius:"50%",fontSize:"16px",padding:"2px"},correctIcon:{backgroundColor:Bu.correct()},incorrectIcon:{backgroundColor:Bu.incorrectWithIcon()}})))(Ru);const Ku=r;function Fu(e){return Fu="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},Fu(e)}function Iu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Du(e){var t=function(e,t){if("object"!==Fu(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==Fu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Fu(t)?t:String(t)}function Mu(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,Du(n.key),n)}}function Ju(e,t,r){return t&&Mu(e.prototype,t),r&&Mu(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Uu(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Vu(e,t){return Vu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Vu(e,t)}function qu(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&&Vu(e,t)}function Wu(e,t){if(t&&("object"===Fu(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Uu(e)}function Hu(e){return Hu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Hu(e)}function $u(e,t,r){return(t=Du(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Yu(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 Gu(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 Yu(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)?Yu(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 Qu(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 Xu(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Qu(Object(r),!0).forEach((function(t){$u(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qu(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}As("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 Ku.createElement(Lu,{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 Zu={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)}},ec=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Iu(this,e),this.init(t,r)}return Ju(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||Zu,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,Xu(Xu({},{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}(),tc=new ec,rc=function(){function e(){Iu(this,e),this.observers={}}return Ju(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 nc(){var e,t,r=new Promise((function(r,n){e=r,t=n}));return r.resolve=e,r.reject=t,r}function oc(e){return null==e?"":""+e}function ic(e,t,r){e.forEach((function(e){t[e]&&(r[e]=t[e])}))}function ac(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 sc(e,t,r){var n=ac(e,t,Object);n.obj[n.k]=r}function uc(e,t){var r=ac(e,t),n=r.obj,o=r.k;if(n)return n[o]}function cc(e,t,r){var n=uc(e,r);return void 0!==n?n:uc(t,r)}function lc(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]):lc(e[n],t[n],r):e[n]=t[n]);return e}function fc(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var hc={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function dc(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,(function(e){return hc[e]})):e}var pc="undefined"!=typeof window&&window.navigator&&void 0===window.navigator.userAgentData&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,vc=[" ",",","?","!",";"];function yc(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?yc(u,c,r):void 0}o=o[n[i]]}return o}}function gc(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?gc(Object(r),!0).forEach((function(t){$u(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function kc(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=Hu(e);if(t){var o=Hu(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Wu(this,r)}}var bc=function(e){qu(r,rc);var t=kc(r);function r(e){var n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return Iu(this,r),n=t.call(this),pc&&rc.call(Uu(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 Ju(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=uc(this.data,a);return s||!i||"string"!=typeof r?s:yc(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),sc(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=uc(this.data,a)||{};n?lc(s,r,o):s=mc(mc({},s),r),sc(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?mc(mc({},{}),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}(),_c={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 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){$u(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=Hu(e);if(t){var o=Hu(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Wu(this,r)}}var Sc={},Ac=function(e){qu(r,rc);var t=Oc(r);function r(e){var n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Iu(this,r),n=t.call(this),pc&&rc.call(Uu(n)),ic(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,Uu(n)),n.options=o,void 0===n.options.keySeparator&&(n.options.keySeparator="."),n.logger=tc.create("translator"),n}return Ju(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=vc.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"!==Fu(t)&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),"object"===Fu(t)&&(t=xc({},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,xc(xc({},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,S=O?[]:{},A=O?g:y;for(var E in v)if(Object.prototype.hasOwnProperty.call(v,E)){var N="".concat(A).concat(a).concat(E);S[E]=this.translate(N,xc(xc({},t),{joinArrays:!1,ns:c})),S[E]===N&&(S[E]=v[E])}v=S}}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,xc(xc({},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,xc(xc({},this.options.interpolation.defaultVariables),r),n.usedLng,n.usedNS,n.usedKey,{resolved:n});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init(xc(xc({},r),{interpolation:xc(xc({},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=xc(xc({},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=_c.handle(h,e,t,this.options&&this.options.postProcessPassResolved?xc({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,!Sc["".concat(p[0],"-").concat(e)]&&a.utils&&a.utils.hasLoadedNamespace&&!a.utils.hasLoadedNamespace(i)&&(Sc["".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 Ec(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Nc=function(){function e(t){Iu(this,e),this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=tc.create("languageUtils")}return Ju(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]=Ec(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]=Ec(r[1].toLowerCase())),t.indexOf(r[2].toLowerCase())>-1&&(r[2]=Ec(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}(),Tc=[{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}],jc={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)}},Pc=["v1","v2","v3"],Cc={zero:0,one:1,two:2,few:3,many:4,other:5};function Bc(){var e={};return Tc.forEach((function(t){t.lngs.forEach((function(r){e[r]={numbers:t.nr,plurals:jc[t.fc]}}))})),e}var zc=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Iu(this,e),this.languageUtils=t,this.options=r,this.logger=tc.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=Bc()}return Ju(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 Cc[e]-Cc[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!Pc.includes(this.options.compatibilityJSON)}}]),e}();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 Lc(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){$u(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}function Kc(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=cc(e,t,r);return!i&&o&&"string"==typeof r&&void 0===(i=yc(e,r,n))&&(i=yc(t,r,n)),i}var Fc=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Iu(this,e),this.logger=tc.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return Ju(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:dc,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?fc(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?fc(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?fc(t.nestingPrefix):t.nestingPrefixEscaped||fc("$t("),this.nestingSuffix=t.nestingSuffix?fc(t.nestingSuffix):t.nestingSuffixEscaped||fc(")"),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=Kc(t,u,e,s.options.keySeparator,s.options.ignoreJSONStructure);return s.alwaysFormat?s.format(o,void 0,r,Lc(Lc(Lc({},n),t),{},{interpolationkey:e})):o}var i=e.split(s.formatSeparator),a=i.shift().trim(),c=i.join(s.formatSeparator).trim();return s.format(Kc(t,u,a,s.options.keySeparator,s.options.ignoreJSONStructure),c,r,Lc(Lc(Lc({},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=oc(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=Lc(Lc({},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=Lc({},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=oc(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,Lc(Lc({},a),{},{interpolationkey:r[1].trim()}))}),n.trim())),e=e.replace(r[0],n),this.regexp.lastIndex=0}return e}}]),e}();function Ic(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 Dc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ic(Object(r),!0).forEach((function(t){$u(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ic(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Mc(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=Gu(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 Jc(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 Uc=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Iu(this,e),this.logger=tc.create("formatter"),this.options=t,this.formats={number:Jc((function(e,t){var r=new Intl.NumberFormat(e,Dc({},t));return function(e){return r.format(e)}})),currency:Jc((function(e,t){var r=new Intl.NumberFormat(e,Dc(Dc({},t),{},{style:"currency"}));return function(e){return r.format(e)}})),datetime:Jc((function(e,t){var r=new Intl.DateTimeFormat(e,Dc({},t));return function(e){return r.format(e)}})),relativetime:Jc((function(e,t){var r=new Intl.RelativeTimeFormat(e,Dc({},t));return function(e){return r.format(e,t.range||"day")}})),list:Jc((function(e,t){var r=new Intl.ListFormat(e,Dc({},t));return function(e){return r.format(e)}}))},this.init(t)}return Ju(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()]=Jc(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=Mc(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,Dc(Dc(Dc({},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 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){$u(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=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=Hu(e);if(t){var o=Hu(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Wu(this,r)}}var Hc=function(e){qu(r,rc);var t=Wc(r);function r(e,n,o){var i,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return Iu(this,r),i=t.call(this),pc&&rc.call(Uu(i)),i.backend=e,i.store=n,i.services=o,i.languageUtils=o.languageUtils,i.options=a,i.logger=tc.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 Ju(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=ac(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=qc(qc({},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 $c(){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"===Fu(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===Fu(e[2])||"object"===Fu(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 Yc(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 Gc(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?Gc(Object(r),!0).forEach((function(t){$u(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Gc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Xc(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=Hu(e);if(t){var o=Hu(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Wu(this,r)}}function Zc(){}function el(e){Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((function(t){"function"==typeof e[t]&&(e[t]=e[t].bind(e))}))}var tl=function(e){qu(r,rc);var t=Xc(r);function r(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;if(Iu(this,r),e=t.call(this),pc&&rc.call(Uu(e)),e.options=Yc(n),e.services={},e.logger=tc,e.modules={external:[]},el(Uu(e)),o&&!e.isInitialized&&!n.isClone){if(!e.options.initImmediate)return e.init(n,o),Wu(e,Uu(e));setTimeout((function(){e.init(n,o)}),0)}return e}return Ju(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=$c();function o(e){return e?"function"==typeof e?new e:e:null}if(this.options=Qc(Qc(Qc({},n),this.options),Yc(t)),"v1"!==this.options.compatibilityAPI&&(this.options.interpolation=Qc(Qc({},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?tc.init(o(this.modules.logger),this.options):tc.init(null,this.options),this.modules.formatter?i=this.modules.formatter:"undefined"!=typeof Intl&&(i=Uc);var a=new Nc(this.options);this.store=new bc(this.options.resources,this.options);var s=this.services;s.logger=tc,s.resourceStore=this.store,s.languageUtils=a,s.pluralResolver=new zc(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 Fc(this.options),s.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},s.backendConnector=new Hc(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 Ac(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=Zc),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=nc(),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]:Zc,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=nc();return e||(e=this.languages),t||(t=this.options.ns),r||(r=Zc),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&&_c.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=nc();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"!==Fu(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=Qc({},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=nc();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=nc();"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 Nc($c());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]:Zc,o=Qc(Qc(Qc({},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=Qc({},this.services),i.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},i.translator=new Ac(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}();$u(tl,"createInstance",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return new tl(e,t)}));var rl=tl.createInstance();rl.createInstance=tl.createInstance,rl.createInstance,rl.dir,rl.init,rl.loadResources,rl.reloadResources,rl.use,rl.changeLanguage,rl.getFixedT,rl.t,rl.exists,rl.setDefaultNamespace,rl.hasLoadedNamespace,rl.loadNamespaces,rl.loadLanguages;rl.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 nl={translator:{...rl,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 rl.t(e,{lng:r,...t})}},languageOptions:[{value:"en_US",label:"English (US)"},{value:"es_ES",label:"Spanish"}]};const ol=r,il=o,{debounce:al}=t,{isEmpty:sl}=t,{isEqual:ul}=t,cl=f,{color:ll}=c,{Collapsible:fl}=c,{hasText:hl}=c,{hasMedia:dl}=c,{PreviewPrompt:pl}=c,{UiLayout:vl}=c,{withStyles:yl}=i,gl=a,{translator:ml}=nl;class kl extends ol.Component{constructor(...e){super(...e),kl.prototype.__init.call(this),kl.prototype.__init2.call(this),kl.prototype.__init3.call(this),kl.prototype.__init4.call(this),kl.prototype.__init5.call(this)}static __initStatic(){this.propTypes={alwaysShowCorrect:il.bool,animationsDisabled:il.bool,classes:il.object.isRequired,disabled:il.bool,displayType:il.string,feedback:il.object,language:il.string,markup:il.string,maxLengthPerChoice:il.array,maxLengthPerChoiceEnabled:il.bool,mode:il.string,note:il.string,onChange:il.func,playerSpellCheckEnabled:il.bool,prompt:il.string,rationale:il.string,role:il.string,showNote:il.bool,teacherInstructions:il.string,value:il.object,responseAreaInputConfiguration:il.object,model:il.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:al(this.props.onChange,200,{maxWait:200})}UNSAFE_componentWillReceiveProps(e){const{maxLengthPerChoice:t,language:r}=this.props;let{note:n}=this.props;sl(e.feedback)&&this.setState({showCorrectAnswer:!1}),e.alwaysShowCorrect&&this.setState({showCorrectAnswer:!0}),t&&!ul(t,e.maxLengthPerChoice)&&(this.changeSession=this.getChangeSession(e.maxLengthPerChoice)),n&&r&&r!==e.language&&n===ml.t("common:commonCorrectAnswerWithAlternates",{lng:r})&&(n=ml.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,_=gl([n.mainContainer,{[n.noBorderColor]:t}]),w=ol.createElement(pl,{defaultClassName:"teacher-instructions",prompt:v}),x=ol.createElement(pl,{prompt:d}),O=d&&(hl(d)||dl(d)),S=v&&(hl(v)||dl(v));return ol.createElement(vl,{extraCSSRules:k,className:_,style:{display:`${i}`}},"gather"===o&&ol.createElement("h2",{className:n.srOnly},"Fill in the Blank Question"),S&&ol.createElement("div",{className:n.collapsible},r?w:ol.createElement(fl,{labels:{hidden:"Show Teacher Instructions",visible:"Hide Teacher Instructions"}},w)),h&&ol.createElement(pl,{prompt:h}),!t&&ol.createElement(cl,{show:"evaluate"===o,toggled:e,onToggle:this.toggleShowCorrect,language:s}),ol.createElement(bu,{...this.props,onChange:this.onChange,showCorrectAnswer:e,value:m,maxLength:u,adjustedLimit:c,spellCheck:f,pluginProps:y}),b&&ol.createElement("div",{className:gl(n.note,"note"),dangerouslySetInnerHTML:{__html:l}}),O&&ol.createElement("div",{className:n.collapsible},r?x:ol.createElement(fl,{labels:{hidden:"Show Rationale",visible:"Hide Rationale"}},x)))}}kl.__initStatic(),kl.__initStatic2();var bl=yl((e=>({mainContainer:{color:ll.text(),backgroundColor:ll.background()},inlineDisplay:{display:"inline-block"},blockDisplay:{display:"block"},note:{marginBottom:2*e.spacing.unit},collapsible:{marginBottom:2*e.spacing.unit},noBorderColor:{"& *":{borderColor:`${ll.text()} !important`}},srOnly:{position:"absolute",left:"-10000px",top:"auto",width:"1px",height:"1px",overflow:"hidden"}})))(kl);const _l=r,wl=s,{debounce:xl}=t,Ol=e,{renderMath:Sl}=h,Al=Ol("pie-element:explicit-constructed-response:print");class El extends HTMLElement{constructor(){super(),this._options=null,this._model=null,this._session=[],this._rerender=xl((()=>{if(this._model&&this._session){const e=((e,t)=>{const r="instructor"===t.role;return e.prompt=!1!==e.promptEnabled?e.prompt:void 0,e.teacherInstructions=r&&!1!==e.teacherInstructionsEnabled?e.teacherInstructions:void 0,e.rationale=r&&!1!==e.rationaleEnabled?e.rationale:void 0,e.alwaysShowCorrect=r,e.mode=r?"evaluate":e.mode,e.disabled=!0,e.animationsDisabled=!0,e})(this._model,this._options),t=this._options&&_l.createElement(bl,{...e,onChange:()=>{}});wl.render(t,this,(()=>{Al("render complete - render math"),Sl(this)}))}else Al("skip")}),50,{leading:!1,trailing:!0})}set options(e){this._options=e}set model(e){this._model=e,this._rerender()}connectedCallback(){}}export{El as default};
|
|
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.prototype.toString,g=function(e){switch(y.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},m=function(e){return null!=e&&"object"==typeof e&&!1===Array.isArray(e)};function k(e){return!0===m(e)&&"[object Object]"===Object.prototype.toString.call(e)}var b=function(e){var t,r;return!1!==k(e)&&("function"==typeof(t=e.constructor)&&(!1!==k(r=t.prototype)&&!1!==r.hasOwnProperty("isPrototypeOf")))},_="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function w(){throw new Error("setTimeout has not been defined")}function x(){throw new Error("clearTimeout has not been defined")}var O=w,S=x;function A(e){if(O===setTimeout)return setTimeout(e,0);if((O===w||!O)&&setTimeout)return O=setTimeout,setTimeout(e,0);try{return O(e,0)}catch(t){try{return O.call(null,e,0)}catch(t){return O.call(this,e,0)}}}"function"==typeof _.setTimeout&&(O=setTimeout),"function"==typeof _.clearTimeout&&(S=clearTimeout);var E,N=[],T=!1,j=-1;function P(){T&&E&&(T=!1,E.length?N=E.concat(N):j=-1,N.length&&C())}function C(){if(!T){var e=A(P);T=!0;for(var t=N.length;t;){for(E=N,N=[];++j<t;)E&&E[j].run();j=-1,t=N.length}E=null,T=!1,function(e){if(S===clearTimeout)return clearTimeout(e);if((S===x||!S)&&clearTimeout)return S=clearTimeout,clearTimeout(e);try{S(e)}catch(t){try{return S.call(null,e)}catch(t){return S.call(this,e)}}}(e)}}function B(e,t){this.fun=e,this.array=t}B.prototype.run=function(){this.fun.apply(null,this.array)};function z(){}var R=z,L=z,K=z,F=z,I=z,D=z,M=z;var J=_.performance||{},U=J.now||J.mozNow||J.msNow||J.oNow||J.webkitNow||function(){return(new Date).getTime()};var V=new Date;var q={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];N.push(new B(e,t)),1!==N.length||T||A(C)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:R,addListener:L,once:K,off:F,removeListener:I,removeAllListeners:D,emit:M,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*U.call(J),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-V)/1e3}},W=q&&q.env&&q.env.FORBID_DEPRECATIONS,H=q&&q.env&&q.env.FORBID_WARNINGS,$=void 0!==q&&q.env&&!0,Y="undefined"!=typeof console&&"function"==typeof console.log&&"function"==typeof console.warn&&"function"==typeof console.error;function G(e,t){if($&&Y){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 Q(e,t){throw new Error(t)}var X={deprecate:function(e,t){for(var r=W?Q:G,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(Y){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=H?Q:G,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))}},Z={};function ee(e){e&&(e.value=!0)}function te(){}function re(e){return void 0===e.size&&(e.size=e.__iterate(oe)),e.size}function ne(e,t){if("number"!=typeof t){var r=t>>>0;if(""+r!==t||4294967295===r)return NaN;t=r}return t<0?re(e)+t:t}function oe(){return!0}function ie(e,t,r){return(0===e&&!ce(e)||void 0!==r&&e<=-r)&&(void 0===t||void 0!==r&&t>=r)}function ae(e,t){return ue(e,t,0)}function se(e,t){return ue(e,t,t)}function ue(e,t,r){return void 0===e?r:ce(e)?t===1/0?t:0|Math.max(0,t+e):void 0===t||t===e?e:0|Math.min(t,e)}function ce(e){return e<0||0===e&&1/e==-1/0}function le(e){return Boolean(e&&e["@@__IMMUTABLE_ITERABLE__@@"])}function fe(e){return Boolean(e&&e["@@__IMMUTABLE_KEYED__@@"])}function he(e){return Boolean(e&&e["@@__IMMUTABLE_INDEXED__@@"])}function de(e){return fe(e)||he(e)}var pe=function(e){return le(e)?e:ze(e)},ve=function(e){function t(e){return fe(e)?e:Re(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(pe),ye=function(e){function t(e){return he(e)?e:Le(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(pe),ge=function(e){function t(e){return le(e)&&!de(e)?e:Ke(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(pe);pe.Keyed=ve,pe.Indexed=ye,pe.Set=ge;function me(e){return Boolean(e&&e["@@__IMMUTABLE_SEQ__@@"])}function ke(e){return Boolean(e&&e["@@__IMMUTABLE_RECORD__@@"])}function be(e){return le(e)||ke(e)}var _e="@@__IMMUTABLE_ORDERED__@@";function we(e){return Boolean(e&&e[_e])}var xe="function"==typeof Symbol&&Symbol.iterator,Oe=xe||"@@iterator",Se=function(e){this.next=e};function Ae(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 Ee(){return{value:void 0,done:!0}}function Ne(e){return!!Array.isArray(e)||!!Pe(e)}function Te(e){return e&&"function"==typeof e.next}function je(e){var t=Pe(e);return t&&t.call(e)}function Pe(e){var t=e&&(xe&&e[xe]||e["@@iterator"]);if("function"==typeof t)return t}Se.prototype.toString=function(){return"[Iterator]"},Se.KEYS=0,Se.VALUES=1,Se.ENTRIES=2,Se.prototype.inspect=Se.prototype.toSource=function(){return this.toString()},Se.prototype[Oe]=function(){return this};var Ce=Object.prototype.hasOwnProperty;function Be(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 ze=function(e){function t(e){return null==e?Je():be(e)?e.toSeq():function(e){var t=qe(e);if(t)return(n=Pe(r=e))&&n===r.entries?t.fromEntrySeq():function(e){var t=Pe(e);return t&&t===e.keys}(e)?t.toSetSeq():t;var r,n;if("object"==typeof e)return new Ie(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 Se((function(){if(o===n)return{value:void 0,done:!0};var i=r[t?n-++o:o++];return Ae(e,i[0],i[1])}))}return this.__iteratorUncached(e,t)},t}(pe),Re=function(e){function t(e){return null==e?Je().toKeyedSeq():le(e)?fe(e)?e.toSeq():e.fromEntrySeq():ke(e)?e.toSeq():Ue(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.toKeyedSeq=function(){return this},t}(ze),Le=function(e){function t(e){return null==e?Je():le(e)?fe(e)?e.entrySeq():e.toIndexedSeq():ke(e)?e.toSeq().entrySeq():Ve(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}(ze),Ke=function(e){function t(e){return(le(e)&&!de(e)?e:Le(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}(ze);ze.isSeq=me,ze.Keyed=Re,ze.Set=Ke,ze.Indexed=Le,ze.prototype["@@__IMMUTABLE_SEQ__@@"]=!0;var Fe=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[ne(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 Se((function(){if(o===n)return{value:void 0,done:!0};var i=t?n-++o:o++;return Ae(e,i,r[i])}))},t}(Le),Ie=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 Ce.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 Se((function(){if(i===o)return{value:void 0,done:!0};var a=n[t?o-++i:i++];return Ae(e,a,r[a])}))},t}(Re);Ie.prototype[_e]=!0;var De,Me=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=je(this._collection),n=0;if(Te(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=je(this._collection);if(!Te(r))return new Se(Ee);var n=0;return new Se((function(){var t=r.next();return t.done?t:Ae(e,n++,t.value)}))},t}(Le);function Je(){return De||(De=new Fe([]))}function Ue(e){var t=qe(e);if(t)return t.fromEntrySeq();if("object"==typeof e)return new Ie(e);throw new TypeError("Expected Array or collection object of [k, v] entries, or keyed object: "+e)}function Ve(e){var t=qe(e);if(t)return t;throw new TypeError("Expected Array or collection object of values: "+e)}function qe(e){return Be(e)?new Fe(e):Ne(e)?new Me(e):void 0}function We(e){return Boolean(e&&e["@@__IMMUTABLE_MAP__@@"])}function He(e){return We(e)&&we(e)}function $e(e){return Boolean(e&&"function"==typeof e.equals&&"function"==typeof e.hashCode)}function Ye(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!!($e(e)&&$e(t)&&e.equals(t))}var Ge="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 Qe(e){return e>>>1&1073741824|3221225471&e}var Xe=Object.prototype.valueOf;function Ze(e){if(null==e)return et(e);if("function"==typeof e.hashCode)return Qe(e.hashCode(e));var t,r=(t=e).valueOf!==Xe&&"function"==typeof t.valueOf?t.valueOf(t):t;if(null==r)return et(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 Qe(t)}(r);case"string":return r.length>lt?function(e){var t=dt[e];void 0===t&&(t=tt(e),ht===ft&&(ht=0,dt={}),ht++,dt[e]=t);return t}(r):tt(r);case"object":case"function":return function(e){var t;if(at&&void 0!==(t=it.get(e)))return t;if(void 0!==(t=e[ct]))return t;if(!nt){if(void 0!==(t=e.propertyIsEnumerable&&e.propertyIsEnumerable[ct]))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=ot(),at)it.set(e,t);else{if(void 0!==rt&&!1===rt(e))throw new Error("Non-extensible objects are not allowed as keys.");if(nt)Object.defineProperty(e,ct,{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[ct]=t;else{if(void 0===e.nodeType)throw new Error("Unable to set a non-enumerable property on object.");e[ct]=t}}return t}(r);case"symbol":return function(e){var t=st[e];if(void 0!==t)return t;return t=ot(),st[e]=t,t}(r);default:if("function"==typeof r.toString)return tt(r.toString());throw new Error("Value type "+typeof r+" cannot be hashed.")}}function et(e){return null===e?1108378658:1108378659}function tt(e){for(var t=0,r=0;r<e.length;r++)t=31*t+e.charCodeAt(r)|0;return Qe(t)}var rt=Object.isExtensible,nt=function(){try{return Object.defineProperty({},"@",{}),!0}catch(e){return!1}}();function ot(){var e=++ut;return 1073741824&ut&&(ut=0),e}var it,at="function"==typeof WeakMap;at&&(it=new WeakMap);var st=Object.create(null),ut=0,ct="__immutablehash__";"function"==typeof Symbol&&(ct=Symbol(ct));var lt=16,ft=255,ht=0,dt={},pt=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=bt(this,!0);return this._useKeys||(t.valueSeq=function(){return e._iter.toSeq().reverse()}),t},t.prototype.map=function(e,t){var r=this,n=kt(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}(Re);pt.prototype[_e]=!0;var vt=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&&re(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&&re(this),new Se((function(){var i=n.next();return i.done?i:Ae(e,t?r.size-++o:o++,i.value,i)}))},t}(Le),yt=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 Se((function(){var t=r.next();return t.done?t:Ae(e,t.value,t.value,t)}))},t}(Ke),gt=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){Pt(t);var n=le(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 Se((function(){for(;;){var t=r.next();if(t.done)return t;var n=t.value;if(n){Pt(n);var o=le(n);return Ae(e,o?n.get(0):n[0],o?n.get(1):n[1],t)}}}))},t}(Re);function mt(e){var t=Bt(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=zt,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 Se((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 kt(e,t,r){var n=Bt(e);return n.size=e.size,n.has=function(t){return e.has(t)},n.get=function(n,o){var i=e.get(n,Z);return i===Z?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 Se((function(){var o=i.next();if(o.done)return o;var a=o.value,s=a[0];return Ae(n,s,t.call(r,a[1],s,e),o)}))},n}function bt(e,t){var r=this,n=Bt(e);return n._iter=e,n.size=e.size,n.reverse=function(){return e},e.flip&&(n.flip=function(){var t=mt(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=zt,n.__iterate=function(r,n){var o=this,i=0;return n&&re(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&&re(e);var a=e.__iterator(2,!o);return new Se((function(){var e=a.next();if(e.done)return e;var s=e.value;return Ae(n,t?s[0]:o?r.size-++i:i++,s[1],e)}))},n}function _t(e,t,r,n){var o=Bt(e);return n&&(o.has=function(n){var o=e.get(n,Z);return o!==Z&&!!t.call(r,o,n,e)},o.get=function(n,o){var i=e.get(n,Z);return i!==Z&&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 Se((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 Ae(o,n?c:s++,l,i)}}))},o}function wt(e,t,r,n){var o=e.size;if(ie(t,r,o))return e;var i=ae(t,o),a=se(r,o);if(i!=i||a!=a)return wt(e.toSeq().cacheResult(),t,r,n);var s,u=a-i;u==u&&(s=u<0?0:u);var c=Bt(e);return c.size=0===s?s:e.size&&s||void 0,!n&&me(e)&&s>=0&&(c.get=function(t,r){return(t=ne(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 Se(Ee);var o=e.__iterator(t,r),a=0,u=0;return new Se((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:Ae(t,u-1,0===t?void 0:e.value[1],e)}))},c}function xt(e,t,r,n){var o=Bt(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 Se((function(){var e,i,l;do{if((e=s.next()).done)return n||1===o?e:Ae(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:Ae(o,i,l,e)}))},o}function Ot(e,t){var r=fe(e),n=[e].concat(t).map((function(e){return le(e)?r&&(e=ve(e)):e=r?Ue(e):Ve(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&&fe(o)||he(e)&&he(o))return o}var i=new Fe(n);return r?i=i.toKeyedSeq():he(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 St(e,t,r){var n=Bt(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)&&le(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 Se((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)||!le(u))return r?e:Ae(n,s++,u,e);a.push(i),i=u.__iterator(n,o)}else i=a.pop()}return{value:void 0,done:!0}}))},n}function At(e,t,r){t||(t=Rt);var n=fe(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?Re(i):he(e)?Le(i):Ke(i)}function Et(e,t,r){if(t||(t=Rt),r){var n=e.toSeq().map((function(t,n){return[t,r(t,n,e)]})).reduce((function(e,r){return Nt(t,e[1],r[1])?r:e}));return n&&n[0]}return e.reduce((function(e,r){return Nt(t,e,r)?r:e}))}function Nt(e,t,r){var n=e(r,t);return 0===n&&r!==t&&(null==r||r!=r)||n>0}function Tt(e,t,r,n){var o=Bt(e),i=new Fe(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=pe(e),je(o?e.reverse():e)})),a=0,s=!1;return new Se((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}:Ae(e,a++,t.apply(null,r.map((function(e){return e.value}))))}))},o}function jt(e,t){return e===t?e:me(e)?t:e.constructor(t)}function Pt(e){if(e!==Object(e))throw new TypeError("Expected [K, V] tuple: "+e)}function Ct(e){return fe(e)?ve:he(e)?ye:ge}function Bt(e){return Object.create((fe(e)?Re:he(e)?Le:Ke).prototype)}function zt(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):ze.prototype.cacheResult.call(this)}function Rt(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 Lt(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 Kt(e,t){if(!e)throw new Error(t)}function Ft(e){Kt(e!==1/0,"Cannot perform this action with an infinite size.")}function It(e){if(Be(e)&&"string"!=typeof e)return e;if(we(e))return e.toArray();throw new TypeError("Invalid keyPath: expected Ordered Collection or Array: "+e)}vt.prototype.cacheResult=pt.prototype.cacheResult=yt.prototype.cacheResult=gt.prototype.cacheResult=zt;var Dt=Object.prototype.toString;function Mt(e){return"object"==typeof e&&(be(e)||Array.isArray(e)||function(e){if(!e||"object"!=typeof e||"[object Object]"!==Dt.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 Jt(e){try{return"string"==typeof e?JSON.stringify(e):String(e)}catch(t){return JSON.stringify(e)}}function Ut(e,t,r){return be(e)?e.get(t,r):function(e,t){return be(e)?e.has(t):Mt(e)&&Ce.call(e,t)}(e,t)?"function"==typeof e.get?e.get(t):e[t]:r}function Vt(e){if(Array.isArray(e))return Lt(e);var t={};for(var r in e)Ce.call(e,r)&&(t[r]=e[r]);return t}function qt(e,t,r,n){n||(n=r,r=void 0);var o=Wt(be(e),e,It(t),0,r,n);return o===Z?r:o}function Wt(e,t,r,n,o,i){var a=t===Z;if(n===r.length){var s=a?o:t,u=i(s);return u===s?t:u}if(!a&&!Mt(t))throw new TypeError("Cannot update within non-data-structure value in path ["+r.slice(0,n).map(Jt)+"]: "+t);var c=r[n],l=a?Z:Ut(t,c,Z),f=Wt(l===Z?e:be(l),l,r,n+1,o,i);return f===l?t:f===Z?function(e,t){if(!Mt(e))throw new TypeError("Cannot update non-data-structure value: "+e);if(be(e)){if(!e.remove)throw new TypeError("Cannot update immutable value without .remove() method: "+e);return e.remove(t)}if(!Ce.call(e,t))return e;var r=Vt(e);return Array.isArray(r)?r.splice(t,1):delete r[t],r}(t,c):function(e,t,r){if(!Mt(e))throw new TypeError("Cannot update non-data-structure value: "+e);if(be(e)){if(!e.set)throw new TypeError("Cannot update immutable value without .set() method: "+e);return e.set(t,r)}if(Ce.call(e,t)&&r===e[t])return e;var n=Vt(e);return n[t]=r,n}(a?e?xr():{}:t,c,f)}function Ht(e,t){return function(e,t,r){return qt(e,t,Z,(function(){return r}))}(this,e,t)}function $t(e){return function(e,t){return qt(e,t,(function(){return Z}))}(this,e)}function Yt(e,t,r,n){return qt(e,[t],r,n)}function Gt(e,t,r){return 1===arguments.length?e(this):Yt(this,e,t,r)}function Qt(e,t,r){return qt(this,e,t,r)}function Xt(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return er(this,e)}function Zt(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 er(this,t,e)}function er(e,t,r){for(var n=[],o=0;o<t.length;o++){var i=ve(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){Yt(e,n,Z,(function(e){return e===Z?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 tr(e,t,r){return rr(e,t,function(e){function t(r,n,o){return Mt(r)&&Mt(n)&&(i=n,a=ze(r),s=ze(i),he(a)===he(s)&&fe(a)===fe(s))?rr(r,[n],t):e?e(r,n,o):n;var i,a,s}return t}(r))}function rr(e,t,r){if(!Mt(e))throw new TypeError("Cannot merge into non-data-structure value: "+e);if(be(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?ye:ve,a=n?function(t){o===e&&(o=Vt(o)),o.push(t)}:function(t,n){var i=Ce.call(o,n),a=i&&r?r(o[n],t,n):t;i&&a===o[n]||(o===e&&(o=Vt(o)),o[n]=a)},s=0;s<t.length;s++)i(t[s]).forEach(a);return o}function nr(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return tr(this,e)}function or(e){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];return tr(this,t,e)}function ir(e){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];return qt(this,e,xr(),(function(e){return rr(e,t)}))}function ar(e){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];return qt(this,e,xr(),(function(e){return tr(e,t)}))}function sr(e){var t=this.asMutable();return e(t),t.wasAltered()?t.__ensureOwner(this.__ownerID):this}function ur(){return this.__ownerID?this:this.__ensureOwner(new te)}function cr(){return this.__ensureOwner()}function lr(){return this.__altered}var fr=function(e){function t(t){return null==t?xr():We(t)&&!we(t)?t:xr().withMutations((function(r){var n=e(t);Ft(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 xr().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 Or(this,e,t)},t.prototype.remove=function(e){return Or(this,e,Z)},t.prototype.deleteAll=function(e){var t=pe(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):xr()},t.prototype.sort=function(e){return $r(At(this,e))},t.prototype.sortBy=function(e,t){return $r(At(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 kr(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?wr(this.size,this._root,e,this.__hash):0===this.size?xr():(this.__ownerID=e,this.__altered=!1,this)},t}(ve);fr.isMap=We;var hr=fr.prototype;hr["@@__IMMUTABLE_MAP__@@"]=!0,hr.delete=hr.remove,hr.removeAll=hr.deleteAll,hr.setIn=Ht,hr.removeIn=hr.deleteIn=$t,hr.update=Gt,hr.updateIn=Qt,hr.merge=hr.concat=Xt,hr.mergeWith=Zt,hr.mergeDeep=nr,hr.mergeDeepWith=or,hr.mergeIn=ir,hr.mergeDeepIn=ar,hr.withMutations=sr,hr.wasAltered=lr,hr.asImmutable=cr,hr["@@transducer/init"]=hr.asMutable=ur,hr["@@transducer/step"]=function(e,t){return e.set(t[0],t[1])},hr["@@transducer/result"]=function(e){return e.asImmutable()};var dr=function(e,t){this.ownerID=e,this.entries=t};dr.prototype.get=function(e,t,r,n){for(var o=this.entries,i=0,a=o.length;i<a;i++)if(Ye(r,o[i][0]))return o[i][1];return n},dr.prototype.update=function(e,t,r,n,o,i,a){for(var s=o===Z,u=this.entries,c=0,l=u.length;c<l&&!Ye(n,u[c][0]);c++);var f=c<l;if(f?u[c][1]===o:s)return this;if(ee(a),(s||!f)&&ee(i),!s||1!==u.length){if(!f&&!s&&u.length>=jr)return function(e,t,r,n){e||(e=new te);for(var o=new gr(e,Ze(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:Lt(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 dr(e,d)}};var pr=function(e,t,r){this.ownerID=e,this.bitmap=t,this.nodes=r};pr.prototype.get=function(e,t,r,n){void 0===t&&(t=Ze(r));var o=1<<(31&(0===e?t:t>>>e)),i=this.bitmap;return 0==(i&o)?n:this.nodes[Nr(i&o-1)].get(e+5,t,r,n)},pr.prototype.update=function(e,t,r,n,o,i,a){void 0===r&&(r=Ze(n));var s=31&(0===t?r:r>>>t),u=1<<s,c=this.bitmap,l=0!=(c&u);if(!l&&o===Z)return this;var f=Nr(c&u-1),h=this.nodes,d=l?h[f]:void 0,p=Sr(d,e,t+5,r,n,o,i,a);if(p===d)return this;if(!l&&p&&h.length>=Pr)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 vr(e,i+1,a)}(e,h,c,s,p);if(l&&!p&&2===h.length&&Ar(h[1^f]))return h[1^f];if(l&&p&&1===h.length&&Ar(p))return p;var v=e&&e===this.ownerID,y=l?p?c:c^u:c|u,g=l?p?Tr(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 pr(e,y,g)};var vr=function(e,t,r){this.ownerID=e,this.count=t,this.nodes=r};vr.prototype.get=function(e,t,r,n){void 0===t&&(t=Ze(r));var o=31&(0===e?t:t>>>e),i=this.nodes[o];return i?i.get(e+5,t,r,n):n},vr.prototype.update=function(e,t,r,n,o,i,a){void 0===r&&(r=Ze(n));var s=31&(0===t?r:r>>>t),u=o===Z,c=this.nodes,l=c[s];if(u&&!l)return this;var f=Sr(l,e,t+5,r,n,o,i,a);if(f===l)return this;var h=this.count;if(l){if(!f&&--h<Cr)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 pr(e,o,a)}(e,c,h,s)}else h++;var d=e&&e===this.ownerID,p=Tr(c,s,f,d);return d?(this.count=h,this.nodes=p,this):new vr(e,h,p)};var yr=function(e,t,r){this.ownerID=e,this.keyHash=t,this.entries=r};yr.prototype.get=function(e,t,r,n){for(var o=this.entries,i=0,a=o.length;i<a;i++)if(Ye(r,o[i][0]))return o[i][1];return n},yr.prototype.update=function(e,t,r,n,o,i,a){void 0===r&&(r=Ze(n));var s=o===Z;if(r!==this.keyHash)return s?this:(ee(a),ee(i),Er(this,e,t,r,[n,o]));for(var u=this.entries,c=0,l=u.length;c<l&&!Ye(n,u[c][0]);c++);var f=c<l;if(f?u[c][1]===o:s)return this;if(ee(a),(s||!f)&&ee(i),s&&2===l)return new gr(e,this.keyHash,u[1^c]);var h=e&&e===this.ownerID,d=h?u:Lt(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 yr(e,this.keyHash,d)};var gr=function(e,t,r){this.ownerID=e,this.keyHash=t,this.entry=r};gr.prototype.get=function(e,t,r,n){return Ye(r,this.entry[0])?this.entry[1]:n},gr.prototype.update=function(e,t,r,n,o,i,a){var s=o===Z,u=Ye(n,this.entry[0]);return(u?o===this.entry[1]:s)?this:(ee(a),s?void ee(i):u?e&&e===this.ownerID?(this.entry[1]=o,this):new gr(e,this.keyHash,[n,o]):(ee(i),Er(this,e,t,Ze(n),[n,o])))},dr.prototype.iterate=yr.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},pr.prototype.iterate=vr.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}},gr.prototype.iterate=function(e,t){return e(this.entry)};var mr,kr=function(e){function t(e,t,r){this._type=t,this._reverse=r,this._stack=e._root&&_r(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 br(e,r.entry)}else if(r.entries){if(n<=(o=r.entries.length-1))return br(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 br(e,i.entry);t=this._stack=_r(i,t)}continue}t=this._stack=this._stack.__prev}return{value:void 0,done:!0}},t}(Se);function br(e,t){return Ae(e,t[0],t[1])}function _r(e,t){return{node:e,index:0,__prev:t}}function wr(e,t,r,n){var o=Object.create(hr);return o.size=e,o._root=t,o.__ownerID=r,o.__hash=n,o.__altered=!1,o}function xr(){return mr||(mr=wr(0))}function Or(e,t,r){var n,o;if(e._root){var i={value:!1},a={value:!1};if(n=Sr(e._root,e.__ownerID,0,void 0,t,r,i,a),!a.value)return e;o=e.size+(i.value?r===Z?-1:1:0)}else{if(r===Z)return e;o=1,n=new dr(e.__ownerID,[[t,r]])}return e.__ownerID?(e.size=o,e._root=n,e.__hash=void 0,e.__altered=!0,e):n?wr(o,n):xr()}function Sr(e,t,r,n,o,i,a,s){return e?e.update(t,r,n,o,i,a,s):i===Z?e:(ee(s),ee(a),new gr(t,n,[o,i]))}function Ar(e){return e.constructor===gr||e.constructor===yr}function Er(e,t,r,n,o){if(e.keyHash===n)return new yr(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?[Er(e,t,r+5,n,o)]:(i=new gr(t,n,o),a<s?[e,i]:[i,e]);return new pr(t,1<<a|1<<s,u)}function Nr(e){return e=(e=(858993459&(e-=e>>1&1431655765))+(e>>2&858993459))+(e>>4)&252645135,e+=e>>8,127&(e+=e>>16)}function Tr(e,t,r,n){var o=n?e:Lt(e);return o[t]=r,o}var jr=8,Pr=16,Cr=8;function Br(e){return Boolean(e&&e["@@__IMMUTABLE_LIST__@@"])}var zr=function(e){function t(t){var r=Mr();if(null==t)return r;if(Br(t))return t;var n=e(t),o=n.size;return 0===o?r:(Ft(o),o>0&&o<32?Dr(0,o,5,null,new Lr(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=ne(this,e))>=0&&e<this.size){var r=Vr(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=ne(e,t))!=t)return e;if(t>=e.size||t<0)return e.withMutations((function(e){t<0?qr(e,t).set(0,r):qr(e,0,t+1).set(t,r)}));t+=e._origin;var n=e._tail,o=e._root,i={value:!1};t>=Wr(e._capacity)?n=Jr(n,e.__ownerID,0,t,r,i):o=Jr(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 Dr(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):Mr()},t.prototype.push=function(){var e=arguments,t=this.size;return this.withMutations((function(r){qr(r,0,t+e.length);for(var n=0;n<e.length;n++)r.set(t+n,e[n])}))},t.prototype.pop=function(){return qr(this,0,-1)},t.prototype.unshift=function(){var e=arguments;return this.withMutations((function(t){qr(t,-e.length);for(var r=0;r<e.length;r++)t.set(r,e[r])}))},t.prototype.shift=function(){return qr(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&&Ne(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 qr(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 ie(e,t,r)?this:qr(this,ae(e,r),se(t,r))},t.prototype.__iterator=function(e,t){var r=t?this.size:0,n=Ir(this,t);return new Se((function(){var o=n();return o===Fr?{value:void 0,done:!0}:Ae(e,t?--r:r++,o)}))},t.prototype.__iterate=function(e,t){for(var r,n=t?this.size:0,o=Ir(this,t);(r=o())!==Fr&&!1!==e(r,t?--n:n++,this););return n},t.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?Dr(this._origin,this._capacity,this._level,this._root,this._tail,e,this.__hash):0===this.size?Mr():(this.__ownerID=e,this.__altered=!1,this)},t}(ye);zr.isList=Br;var Rr=zr.prototype;Rr["@@__IMMUTABLE_LIST__@@"]=!0,Rr.delete=Rr.remove,Rr.merge=Rr.concat,Rr.setIn=Ht,Rr.deleteIn=Rr.removeIn=$t,Rr.update=Gt,Rr.updateIn=Qt,Rr.mergeIn=ir,Rr.mergeDeepIn=ar,Rr.withMutations=sr,Rr.wasAltered=lr,Rr.asImmutable=cr,Rr["@@transducer/init"]=Rr.asMutable=ur,Rr["@@transducer/step"]=function(e,t){return e.push(t)},Rr["@@transducer/result"]=function(e){return e.asImmutable()};var Lr=function(e,t){this.array=e,this.ownerID=t};Lr.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 Lr([],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=Ur(this,e);if(!i)for(var u=0;u<n;u++)s.array[u]=void 0;return o&&(s.array[n]=o),s},Lr.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=Ur(this,e);return a.array.splice(o+1),n&&(a.array[o]=n),a};var Kr,Fr={};function Ir(e,t){var r=e._origin,n=e._capacity,o=Wr(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 Fr;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!==Fr)return e;s=null}if(c===l)return Fr;var r=t?--l:c++;s=a(u&&u[r],o-5,i+(r<<o))}}}(e,s,u)}}function Dr(e,t,r,n,o,i,a){var s=Object.create(Rr);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 Mr(){return Kr||(Kr=Dr(0,0,5))}function Jr(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=Jr(c,t,r-5,n,o,i);return l===c?e:((a=Ur(e,t)).array[s]=l,a)}return u&&e.array[s]===o?e:(i&&ee(i),a=Ur(e,t),void 0===o&&s===a.array.length-1?a.array.pop():a.array[s]=o,a)}function Ur(e,t){return t&&e&&t===e.ownerID?e:new Lr(e?e.array.slice():[],t)}function Vr(e,t){if(t>=Wr(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 qr(e,t,r){void 0!==t&&(t|=0),void 0!==r&&(r|=0);var n=e.__ownerID||new te,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 Lr(c&&c.array.length?[void 0,c]:[],n),l+=1<<(u+=5);l&&(a+=l,o+=l,s+=l,i+=l);for(var f=Wr(i),h=Wr(s);h>=1<<u+5;)c=new Lr(c&&c.array.length?[c]:[],n),u+=5;var d=e._tail,p=h<f?Vr(e,s-1):h>f?new Lr([],n):d;if(d&&h>f&&a<i&&d.array.length){for(var v=c=Ur(c,n),y=u;y>5;y-=5){var g=f>>>y&31;v=v.array[g]=Ur(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):Dr(a,s,u,c,p)}function Wr(e){return e<32?0:e-1>>>5<<5}var Hr,$r=function(e){function t(e){return null==e?Gr():He(e)?e:Gr().withMutations((function(t){var r=ve(e);Ft(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):Gr()},t.prototype.set=function(e,t){return Qr(this,e,t)},t.prototype.remove=function(e){return Qr(this,e,Z)},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?Yr(t,r,e,this.__hash):0===this.size?Gr():(this.__ownerID=e,this.__altered=!1,this._map=t,this._list=r,this)},t}(fr);function Yr(e,t,r,n){var o=Object.create($r.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 Gr(){return Hr||(Hr=Yr(xr(),Mr()))}function Qr(e,t,r){var n,o,i=e._map,a=e._list,s=i.get(t),u=void 0!==s;if(r===Z){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):Yr(n,o)}$r.isOrderedMap=He,$r.prototype[_e]=!0,$r.prototype.delete=$r.prototype.remove;function Xr(e){return Boolean(e&&e["@@__IMMUTABLE_STACK__@@"])}var Zr=function(e){function t(e){return null==e?nn():Xr(e)?e:nn().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=ne(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):rn(t,r)},t.prototype.pushAll=function(t){if(0===(t=e(t)).size)return this;if(0===this.size&&Xr(t))return t;Ft(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):rn(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):nn()},t.prototype.slice=function(t,r){if(ie(t,r,this.size))return this;var n=ae(t,this.size);if(se(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):rn(o,i)},t.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?rn(this.size,this._head,e,this.__hash):0===this.size?nn():(this.__ownerID=e,this.__altered=!1,this)},t.prototype.__iterate=function(e,t){var r=this;if(t)return new Fe(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 Fe(this.toArray()).__iterator(e,t);var r=0,n=this._head;return new Se((function(){if(n){var t=n.value;return n=n.next,Ae(e,r++,t)}return{value:void 0,done:!0}}))},t}(ye);Zr.isStack=Xr;var en,tn=Zr.prototype;function rn(e,t,r,n){var o=Object.create(tn);return o.size=e,o._head=t,o.__ownerID=r,o.__hash=n,o.__altered=!1,o}function nn(){return en||(en=rn(0))}tn["@@__IMMUTABLE_STACK__@@"]=!0,tn.shift=tn.pop,tn.unshift=tn.push,tn.unshiftAll=tn.pushAll,tn.withMutations=sr,tn.wasAltered=lr,tn.asImmutable=cr,tn["@@transducer/init"]=tn.asMutable=ur,tn["@@transducer/step"]=function(e,t){return e.unshift(t)},tn["@@transducer/result"]=function(e){return e.asImmutable()};function on(e){return Boolean(e&&e["@@__IMMUTABLE_SET__@@"])}function an(e){return on(e)&&we(e)}function sn(e,t){if(e===t)return!0;if(!le(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||fe(e)!==fe(t)||he(e)!==he(t)||we(e)!==we(t))return!1;if(0===e.size&&0===t.size)return!0;var r=!de(e);if(we(e)){var n=e.entries();return t.every((function(e,t){var o=n.next().value;return o&&Ye(o[1],e)&&(r||Ye(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?!Ye(t,e.get(n,Z)):!Ye(e.get(n,Z),t))return a=!1,!1}));return a&&e.size===s}function un(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 cn(e){if(!e||"object"!=typeof e)return e;if(!le(e)){if(!Mt(e))return e;e=ze(e)}if(fe(e)){var t={};return e.__iterate((function(e,r){t[r]=cn(e)})),t}var r=[];return e.__iterate((function(e){r.push(cn(e))})),r}var ln=function(e){function t(t){return null==t?vn():on(t)&&!we(t)?t:vn().withMutations((function(r){var n=e(t);Ft(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(ve(e).keySeq())},t.intersect=function(e){return(e=pe(e).toArray()).length?hn.intersect.apply(t(e.pop()),e):vn()},t.union=function(e){return(e=pe(e).toArray()).length?hn.union.apply(t(e.pop()),e):vn()},t.prototype.toString=function(){return this.__toString("Set {","}")},t.prototype.has=function(e){return this._map.has(e)},t.prototype.add=function(e){return dn(this,this._map.set(e,e))},t.prototype.remove=function(e){return dn(this,this._map.remove(e))},t.prototype.clear=function(){return dn(this,this._map.clear())},t.prototype.map=function(e,t){var r=this,n=!1,o=dn(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 Bn(At(this,e))},t.prototype.sortBy=function(e,t){return Bn(At(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}(ge);ln.isSet=on;var fn,hn=ln.prototype;function dn(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 pn(e,t){var r=Object.create(hn);return r.size=e?e.size:0,r._map=e,r.__ownerID=t,r}function vn(){return fn||(fn=pn(xr()))}hn["@@__IMMUTABLE_SET__@@"]=!0,hn.delete=hn.remove,hn.merge=hn.concat=hn.union,hn.withMutations=sr,hn.asImmutable=cr,hn["@@transducer/init"]=hn.asMutable=ur,hn["@@transducer/step"]=function(e,t){return e.add(t)},hn["@@transducer/result"]=function(e){return e.asImmutable()},hn.__empty=vn,hn.__make=pn;var yn,gn=function(e){function t(e,r,n){if(!(this instanceof t))return new t(e,r,n);if(Kt(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(yn)return yn;yn=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+ne(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 ie(e,r,this.size)?this:(e=ae(e,this.size),(r=se(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 Se((function(){if(i===r)return{value:void 0,done:!0};var a=o;return o+=t?-n:n,Ae(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:sn(this,e)},t}(Le);function mn(e,t,r){for(var n=It(t),o=0;o!==n.length;)if((e=Ut(e,n[o++],Z))===Z)return r;return e}function kn(e,t){return mn(this,e,t)}function bn(){Ft(this.size);var e={};return this.__iterate((function(t,r){e[r]=t})),e}pe.isIterable=le,pe.isKeyed=fe,pe.isIndexed=he,pe.isAssociative=de,pe.isOrdered=we,pe.Iterator=Se,un(pe,{toArray:function(){Ft(this.size);var e=new Array(this.size||0),t=fe(this),r=0;return this.__iterate((function(n,o){e[r++]=t?[o,n]:n})),e},toIndexedSeq:function(){return new vt(this)},toJS:function(){return cn(this)},toKeyedSeq:function(){return new pt(this,!0)},toMap:function(){return fr(this.toKeyedSeq())},toObject:bn,toOrderedMap:function(){return $r(this.toKeyedSeq())},toOrderedSet:function(){return Bn(fe(this)?this.valueSeq():this)},toSet:function(){return ln(fe(this)?this.valueSeq():this)},toSetSeq:function(){return new yt(this)},toSeq:function(){return he(this)?this.toIndexedSeq():fe(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return Zr(fe(this)?this.valueSeq():this)},toList:function(){return zr(fe(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 jt(this,Ot(this,e))},includes:function(e){return this.some((function(t){return Ye(t,e)}))},entries:function(){return this.__iterator(2)},every:function(e,t){Ft(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 jt(this,_t(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 Ft(this.size),this.__iterate(t?e.bind(t):e)},join:function(e){Ft(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 jt(this,kt(this,e,t))},reduce:function(e,t,r){return Sn(this,e,t,r,arguments.length<2,!1)},reduceRight:function(e,t,r){return Sn(this,e,t,r,arguments.length<2,!0)},reverse:function(){return jt(this,bt(this,!0))},slice:function(e,t){return jt(this,wt(this,e,t,!0))},some:function(e,t){return!this.every(Nn(e),t)},sort:function(e){return jt(this,At(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 re(e?this.toSeq().filter(e,t):this)},countBy:function(e,t){return function(e,t,r){var n=fr().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 sn(this,e)},entrySeq:function(){var e=this;if(e._cache)return new Fe(e._cache);var t=e.toSeq().map(En).toIndexedSeq();return t.fromEntrySeq=function(){return e.toSeq()},t},filterNot:function(e,t){return this.filter(Nn(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(oe,null,e)},flatMap:function(e,t){return jt(this,function(e,t,r){var n=Ct(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 jt(this,St(this,e,!0))},fromEntrySeq:function(){return new gt(this)},get:function(e,t){return this.find((function(t,r){return Ye(r,e)}),void 0,t)},getIn:kn,groupBy:function(e,t){return function(e,t,r){var n=fe(e),o=(we(e)?$r():fr()).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=Ct(e);return o.map((function(t){return jt(e,i(t))})).asImmutable()}(this,e,t)},has:function(e){return this.get(e,Z)!==Z},hasIn:function(e){return mn(this,e,Z)!==Z},isSubset:function(e){return e="function"==typeof e.includes?e:pe(e),this.every((function(t){return e.includes(t)}))},isSuperset:function(e){return(e="function"==typeof e.isSubset?e:pe(e)).isSubset(this)},keyOf:function(e){return this.findKey((function(t){return Ye(t,e)}))},keySeq:function(){return this.toSeq().map(An).toIndexedSeq()},last:function(e){return this.toSeq().reverse().first(e)},lastKeyOf:function(e){return this.toKeyedSeq().reverse().keyOf(e)},max:function(e){return Et(this,e)},maxBy:function(e,t){return Et(this,t,e)},min:function(e){return Et(this,e?Tn(e):Pn)},minBy:function(e,t){return Et(this,t?Tn(t):Pn,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 jt(this,xt(this,e,t,!0))},skipUntil:function(e,t){return this.skipWhile(Nn(e),t)},sortBy:function(e,t){return jt(this,At(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 jt(this,function(e,t,r){var n=Bt(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 Se((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:Ae(n,u,c,e):(s=!1,{value:void 0,done:!0})}))},n}(this,e,t))},takeUntil:function(e,t){return this.takeWhile(Nn(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=we(e),r=fe(e),n=t?1:0;return function(e,t){return t=Ge(t,3432918353),t=Ge(t<<15|t>>>-15,461845907),t=Ge(t<<13|t>>>-13,5),t=Ge((t=(t+3864292196|0)^e)^t>>>16,2246822507),t=Qe((t=Ge(t^t>>>13,3266489909))^t>>>16)}(e.__iterate(r?t?function(e,t){n=31*n+Cn(Ze(e),Ze(t))|0}:function(e,t){n=n+Cn(Ze(e),Ze(t))|0}:t?function(e){n=31*n+Ze(e)|0}:function(e){n=n+Ze(e)|0}),n)}(this))}});var _n=pe.prototype;_n["@@__IMMUTABLE_ITERABLE__@@"]=!0,_n[Oe]=_n.values,_n.toJSON=_n.toArray,_n.__toStringMapper=Jt,_n.inspect=_n.toSource=function(){return this.toString()},_n.chain=_n.flatMap,_n.contains=_n.includes,un(ve,{flip:function(){return jt(this,mt(this))},mapEntries:function(e,t){var r=this,n=0;return jt(this,this.toSeq().map((function(o,i){return e.call(t,[i,o],n++,r)})).fromEntrySeq())},mapKeys:function(e,t){var r=this;return jt(this,this.toSeq().flip().map((function(n,o){return e.call(t,n,o,r)})).flip())}});var wn=ve.prototype;wn["@@__IMMUTABLE_KEYED__@@"]=!0,wn[Oe]=_n.entries,wn.toJSON=bn,wn.__toStringMapper=function(e,t){return Jt(t)+": "+Jt(e)},un(ye,{toKeyedSeq:function(){return new pt(this,!1)},filter:function(e,t){return jt(this,_t(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 jt(this,bt(this,!1))},slice:function(e,t){return jt(this,wt(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=ae(e,e<0?this.count():this.size);var n=this.slice(0,e);return jt(this,1===r?n:n.concat(Lt(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 jt(this,St(this,e,!1))},get:function(e,t){return(e=ne(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=ne(this,e))>=0&&(void 0!==this.size?this.size===1/0||e<this.size:-1!==this.indexOf(e))},interpose:function(e){return jt(this,function(e,t){var r=Bt(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 Se((function(){return(!o||a%2)&&(o=i.next()).done?o:a%2?Ae(r,a++,t):Ae(r,a++,o.value,o)}))},r}(this,e))},interleave:function(){var e=[this].concat(Lt(arguments)),t=Tt(this.toSeq(),Le.of,e),r=t.flatten(!0);return t.size&&(r.size=t.size*e.length),jt(this,r)},keySeq:function(){return gn(0,this.size)},last:function(e){return this.get(-1,e)},skipWhile:function(e,t){return jt(this,xt(this,e,t,!1))},zip:function(){var e=[this].concat(Lt(arguments));return jt(this,Tt(this,jn,e))},zipAll:function(){var e=[this].concat(Lt(arguments));return jt(this,Tt(this,jn,e,!0))},zipWith:function(e){var t=Lt(arguments);return t[0]=this,jt(this,Tt(this,e,t))}});var xn=ye.prototype;xn["@@__IMMUTABLE_INDEXED__@@"]=!0,xn[_e]=!0,un(ge,{get:function(e,t){return this.has(e)?e:t},includes:function(e){return this.has(e)},keySeq:function(){return this.valueSeq()}});var On=ge.prototype;function Sn(e,t,r,n,o,i){return Ft(e.size),e.__iterate((function(e,i,a){o?(o=!1,r=e):r=t.call(n,r,e,i,a)}),i),r}function An(e,t){return t}function En(e,t){return[t,e]}function Nn(e){return function(){return!e.apply(this,arguments)}}function Tn(e){return function(){return-e.apply(this,arguments)}}function jn(){return Lt(arguments)}function Pn(e,t){return e<t?1:e>t?-1:0}function Cn(e,t){return e^t+2654435769+(e<<6)+(e>>2)|0}On.has=_n.includes,On.contains=On.includes,On.keys=On.values,un(Re,wn),un(Le,xn),un(Ke,On);var Bn=function(e){function t(e){return null==e?Kn():an(e)?e:Kn().withMutations((function(t){var r=ge(e);Ft(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(ve(e).keySeq())},t.prototype.toString=function(){return this.__toString("OrderedSet {","}")},t}(ln);Bn.isOrderedSet=an;var zn,Rn=Bn.prototype;function Ln(e,t){var r=Object.create(Rn);return r.size=e?e.size:0,r._map=e,r.__ownerID=t,r}function Kn(){return zn||(zn=Ln(Gr()))}Rn[_e]=!0,Rn.zip=xn.zip,Rn.zipWith=xn.zipWith,Rn.zipAll=xn.zipAll,Rn.__empty=Kn,Rn.__make=Ln;var Fn=function(e,t){var r;!function(e){if(ke(e))throw new Error("Can not call `Record` with an immutable Record as default values. Use a plain javascript object instead.");if(be(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 "+Vn(this)+' with property "'+l+'" since that property name is part of the Record API.'):Wn(o,l)}}return this.__ownerID=void 0,this._values=zr().withMutations((function(e){e.setSize(a._keys.length),ve(i).forEach((function(t,r){e.set(a._indices[r],t===a._defaultValues[r]?void 0:t)}))})),this},o=n.prototype=Object.create(Jn);return o.constructor=n,t&&(n.displayName=t),n};Fn.prototype.toString=function(){for(var e,t=Vn(this)+" { ",r=this._keys,n=0,o=r.length;n!==o;n++)t+=(n?", ":"")+(e=r[n])+": "+Jt(this.get(e));return t+" }"},Fn.prototype.equals=function(e){return this===e||e&&qn(this).equals(qn(e))},Fn.prototype.hashCode=function(){return qn(this).hashCode()},Fn.prototype.has=function(e){return this._indices.hasOwnProperty(e)},Fn.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},Fn.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 Un(this,r)}return this},Fn.prototype.remove=function(e){return this.set(e)},Fn.prototype.clear=function(){var e=this._values.clear().setSize(this._keys.length);return this.__ownerID?this:Un(this,e)},Fn.prototype.wasAltered=function(){return this._values.wasAltered()},Fn.prototype.toSeq=function(){return qn(this)},Fn.prototype.toJS=function(){return cn(this)},Fn.prototype.entries=function(){return this.__iterator(2)},Fn.prototype.__iterator=function(e,t){return qn(this).__iterator(e,t)},Fn.prototype.__iterate=function(e,t){return qn(this).__iterate(e,t)},Fn.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._values.__ensureOwner(e);return e?Un(this,t,e):(this.__ownerID=e,this._values=t,this)},Fn.isRecord=ke,Fn.getDescriptiveName=Vn;var In,Dn,Mn,Jn=Fn.prototype;function Un(e,t,r){var n=Object.create(Object.getPrototypeOf(e));return n._values=t,n.__ownerID=r,n}function Vn(e){return e.constructor.displayName||e.constructor.name||"Record"}function qn(e){return Ue(e._keys.map((function(t){return[t,e.get(t)]})))}function Wn(e,t){try{Object.defineProperty(e,t,{get:function(){return this.get(t)},set:function(e){Kt(this.__ownerID,"Cannot set on an immutable record."),this.set(t,e)}})}catch(e){}}Jn["@@__IMMUTABLE_RECORD__@@"]=!0,Jn.delete=Jn.remove,Jn.deleteIn=Jn.removeIn=$t,Jn.getIn=kn,Jn.hasIn=_n.hasIn,Jn.merge=Xt,Jn.mergeWith=Zt,Jn.mergeIn=ir,Jn.mergeDeep=nr,Jn.mergeDeepWith=or,Jn.mergeDeepIn=ar,Jn.setIn=Ht,Jn.update=Gt,Jn.updateIn=Qt,Jn.withMutations=sr,Jn.asMutable=ur,Jn.asImmutable=cr,Jn[Oe]=Jn.entries,Jn.toJSON=Jn.toObject=_n.toObject,Jn.inspect=Jn.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(In)return In;In=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 Ye(this._value,e)},t.prototype.slice=function(e,r){var n=this.size;return ie(e,r,n)?this:new t(this._value,se(r,n)-ae(e,n))},t.prototype.reverse=function(){return this},t.prototype.indexOf=function(e){return Ye(this._value,e)?0:-1},t.prototype.lastIndexOf=function(e){return Ye(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 Se((function(){return o===n?{value:void 0,done:!0}:Ae(e,t?n-++o:o++,r._value)}))},t.prototype.equals=function(e){return e instanceof t?Ye(this._value,e._value):sn(e)}}(Le),Dn=new RegExp("^[^֑-߿יִ-﷽ﹰ-ﻼ]*[A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--]"),Mn=new RegExp("^[^A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--]*[֑-߿יִ-﷽ﹰ-ﻼ]");var Hn,$n,Yn=function(e){return e=e.toString(),Mn.test(e)?"rtl":Dn.test(e)?"ltr":"neutral"},Gn={exports:{}};Hn=Gn,$n=Gn.exports,function(e){var t=$n,r=Hn&&Hn.exports==t&&Hn,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 Qn=Object.prototype.hasOwnProperty,Xn=Object.prototype.toString;var Zn=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==Xn)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(Qn.call(e,t))return!1;return!0}return!1};const eo=e,{isEqual:to}=t,{pick:ro}=t,{omit:no}=t;var oo={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 io(e,t){return!(!t||!t[oo[e]])}var ao=void 0,so=void 0;function uo(){ao=0,so=function(){return""+ao++}}uo();var co={create:function(e){if(null==e)return so();if("string"==typeof e)return e;throw new Error("Keys must be strings, but you passed: "+e)},setGenerator:function(e){so=e},resetGenerator:uo},lo="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},fo=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},ho=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}}(),po=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},vo=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)},yo=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},go=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")},mo=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)},ko=function(e){function t(){return fo(this,t),yo(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return vo(t,e),ho(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 X.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}),b(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(zr.isList(e)||Array.isArray(e)){var r=new zr(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?co.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:fr(n),nodes:t.createChildren(c)})}},{key:"isBlockList",value:function(e){return zr.isList(e)&&e.every((function(e){return t.isBlock(e)}))}}]),t}(Fn({data:new fr,isVoid:!1,key:void 0,nodes:new zr,type:void 0}));ko.fromJS=ko.fromJSON,ko.isBlock=io.bind(null,"BLOCK"),ko.prototype[oo.BLOCK]=!0;var bo=function(e){function t(){return fo(this,t),yo(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return vo(t,e),ho(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 X.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}),b(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(zr.isList(e)||Array.isArray(e)){var r=new zr(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?co.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 fr(n),nodes:t.createChildren(c)})}},{key:"isInlineList",value:function(e){return zr.isList(e)&&e.every((function(e){return t.isInline(e)}))}}]),t}(Fn({data:new fr,isVoid:!1,key:void 0,nodes:new zr,type:void 0}));bo.fromJS=bo.fromJSON,bo.isInline=io.bind(null,"INLINE"),bo.prototype[oo.INLINE]=!0;var _o=function(){function e(){fo(this,e)}return ho(e,null,[{key:"create",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(fr.isMap(t))return t;if(b(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 fr(e)}}]),e}();_o.fromJS=_o.fromJSON;var wo={},xo={};function Oo(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=So(this.__cache,s)):a=this.__cache_no_args[t],undefined!==a)return a===xo?void 0:a;var u=r.apply(this,n),c=void 0===u?xo:u;return i?this.__cache=Ao(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 So(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(wo)}function Ao(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(wo,r),e}var Eo=function(e){function t(){return fo(this,t),yo(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return vo(t,e),ho(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 X.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}),b(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(ln.isSet(e)||Array.isArray(e))return new ln(e.map(t.create));if(null==e)return ln();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(b(e)){var r={};return"type"in e&&(r.type=e.type),"data"in e&&(r.data=_o.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 fr(n)})}},{key:"isMarkSet",value:function(e){return ln.isSet(e)&&e.every((function(e){return t.isMark(e)}))}}]),t}(Fn({data:new fr,type:void 0}));Eo.fromJS=Eo.fromJSON,Eo.isMark=io.bind(null,"MARK"),Eo.prototype[oo.MARK]=!0,Oo(Eo.prototype,["getComponent"]);var No={};["deleteBackward","deleteCharBackward","deleteLineBackward","deleteWordBackward","deleteForward","deleteCharForward","deleteWordForward","deleteLineForward","setBlocks","setInlines","splitInline","unwrapBlock","unwrapInline","wrapBlock","wrapInline"].forEach((function(e){No[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()}})),No.setBlock=function(){X.deprecate("slate@0.33.0","The `setBlock` method of Slate changes has been renamed to `setBlocks`."),No.setBlocks.apply(No,arguments)},No.setInline=function(){X.deprecate("slate@0.33.0","The `setInline` method of Slate changes has been renamed to `setInlines`."),No.setInlines.apply(No,arguments)},No.addMark=function(e,t){t=Eo.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)}},No.addMarks=function(e,t){t.forEach((function(t){return e.addMark(t)}))},No.delete=function(e){var t=e.value.selection;e.deleteAtRange(t),e.collapseToStart()},No.insertBlock=function(e,t){t=ko.create(t);var r=e.value.selection;e.insertBlockAtRange(r,t);var n=e.value.document.getNode(t.key);n&&e.collapseToEndOf(n)},No.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))}},No.insertInline=function(e,t){t=bo.create(t);var r=e.value.selection;e.insertInlineAtRange(r,t);var n=e.value.document.getNode(t.key);n&&e.collapseToEndOf(n)},No.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})},No.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})},No.removeMark=function(e,t){t=Eo.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)}},No.replaceMark=function(e,t,r){e.removeMark(t),e.addMark(r)},No.toggleMark=function(e,t){t=Eo.create(t),e.value.activeMarks.has(t)?e.removeMark(t):e.addMark(t)},No.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 To=function(e){function t(){return fo(this,t),yo(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return vo(t,e),ho(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 X.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((zr.isList(e)||Array.isArray(e))&&(e={nodes:e}),b(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?co.create():o,a=e.nodes,s=void 0===a?[]:a;return new t({key:i,data:new fr(n),nodes:t.createChildren(s)})}}]),t}(Fn({data:new fr,key:void 0,nodes:new zr}));function jo(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 Po(e){if(null==e)return null;if(zr.isList(e))return e;if(Array.isArray(e))return zr(e);throw new Error("Paths can only be created from arrays or lists, but you passed: "+e)}function Co(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:zo(e,t),n=e.slice(0,r),o=t.slice(0,r);return[n,o]}function Bo(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 zo(e,t){return Math.min(e.size,t.size)}To.fromJS=To.fromJSON,To.isDocument=io.bind(null,"DOCUMENT"),To.prototype[oo.DOCUMENT]=!0;var Ro={compare:jo,create:Po,crop:Co,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 Bo(e,0-t,r)},increment:Bo,isAbove:function(e,t){var r=Co(e,t),n=go(r,2),o=n[0],i=n[1];return e.size<t.size&&0===jo(o,i)},isAfter:function(e,t){var r=Co(e,t),n=go(r,2);return 1===jo(n[0],n[1])},isBefore:function(e,t){var r=Co(e,t),n=go(r,2);return-1===jo(n[0],n[1])},lift:function(e){return e.slice(0,-1)},max:function(e,t){return Math.max(e.size,t.size)},min:zo,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 Po(r)}},Lo=function(e){function t(){return fo(this,t),yo(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return vo(t,e),ho(t,[{key:"hasAnchorAtStartOf",value:function(e){if(0!=this.anchorOffset)return!1;var t=Ko(e);return this.anchorKey==t.key}},{key:"hasAnchorAtEndOf",value:function(e){var t=Fo(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=Fo(e);return this.focusKey==t.key&&this.focusOffset==t.text.length}},{key:"hasFocusAtStartOf",value:function(e){if(0!=this.focusOffset)return!1;var t=Ko(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=Ko(e),this.moveAnchorTo(e.key,0)}},{key:"moveAnchorToEndOf",value:function(e){return e=Fo(e),this.moveAnchorTo(e.key,e.text.length)}},{key:"moveFocusToStartOf",value:function(e){return e=Ko(e),this.moveFocusTo(e.key,0)}},{key:"moveFocusToEndOf",value:function(e){return e=Fo(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":lo(n),l=void 0===a?"undefined":lo(a);if("number"==c&&"number"==l||X.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){X.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){X.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){X.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=Ro.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 X.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(b(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(zr.isList(e)||Array.isArray(e)){var r=new zr(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(b(e)){var r={};return"anchorKey"in e&&(r.anchorKey=e.anchorKey),"anchorOffset"in e&&(r.anchorOffset=e.anchorOffset),"anchorPath"in e&&(r.anchorPath=Ro.create(e.anchorPath)),"focusKey"in e&&(r.focusKey=e.focusKey),"focusOffset"in e&&(r.focusOffset=e.focusOffset),"focusPath"in e&&(r.focusPath=Ro.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:Eo.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:Ro.create(s),focusKey:c,focusOffset:f,focusPath:Ro.create(d),isAtomic:v,isBackward:g,isFocused:k,marks:null==_?null:new ln(_.map(Eo.fromJSON))})}},{key:"isRange",value:function(e){return!(!e||!e[oo.RANGE])}}]),t}(Fn({anchorKey:null,anchorOffset:0,anchorPath:null,focusKey:null,focusOffset:0,focusPath:null,isAtomic:!1,isBackward:null,isFocused:!1,marks:null}));Lo.fromJS=Lo.fromJSON,Lo.prototype[oo.RANGE]=!0;[["move",""],["move","To"],["move","ToStartOf"],["move","ToEndOf"]].forEach((function(e){var t=go(e,2),r=t[0],n=t[1];Lo.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=go(e,3),r=t[0],n=t[1],o=t[2],i=r+"Anchor"+n,a=r+"Focus"+n;Lo.prototype[r+"Start"+n]=function(){return this.isBackward?this[a].apply(this,arguments):this[i].apply(this,arguments)},Lo.prototype[r+"End"+n]=function(){return this.isBackward?this[i].apply(this,arguments):this[a].apply(this,arguments)},o&&(Lo.prototype[r+"Edge"+n]=function(){return this[i].apply(this,arguments)||this[a].apply(this,arguments)})}));function Ko(e){return"text"==e.object?e:e.getFirstText()}function Fo(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=go(e,2),r=t[0],n=t[1];Lo.prototype[r]=function(){return this[n].apply(this,arguments)}}));var Io=function(e){function t(){return fo(this,t),yo(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return vo(t,e),ho(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 X.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}),b(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("")),zr.isList(e)||Array.isArray(e)){var r=new zr(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 ln(o)})}},{key:"isCharacterList",value:function(e){return zr.isList(e)&&e.every((function(e){return t.isCharacter(e)}))}}]),t}(Fn({marks:new ln,text:""}));Io.fromJS=Io.fromJSON,Io.isCharacter=io.bind(null,"CHARACTER"),Io.prototype[oo.CHARACTER]=!0;var Do=function(e){function t(){return fo(this,t),yo(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return vo(t,e),ho(t,[{key:"getCharacters",value:function(){X.deprecate("slate@0.34.0","The `characters` property of Slate objects is deprecated");var e=this.marks;return Io.createList(this.text.split("").map((function(t){return Io.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 X.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}),b(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=zr().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[zr(),e];if(0===e.size)return[zr(),zr()];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?[zr.of(o),e]:[e.take(n),e.skip(n)]:""===i.text?n===e.size-1?[e,zr.of(i)]:[e.take(n+1),e.skip(n+1)]:[e.take(n).push(o),e.skip(n+1).unshift(i)]:[e,zr()]}},{key:"createList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(zr.isList(e)||Array.isArray(e)){var r=new zr(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:ln((void 0===o?[]:o).map(Eo.fromJSON))})}},{key:"isLeafList",value:function(e){return zr.isList(e)&&e.every((function(e){return t.isLeaf(e)}))}}]),t}(Fn({marks:ln(),text:""}));Do.fromJS=Do.fromJSON,Do.isLeaf=io.bind(null,"LEAF"),Do.prototype[oo.LEAF]=!0;var Mo=function(e){function t(){return fo(this,t),yo(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return vo(t,e),ho(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=ln.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",zr.of(Do.fromJSON({text:"",marks:r})));var o=n.addMarks(r);return o===n?this:this.set("leaves",zr.of(o))}if(""===this.text)return this;if(0===t)return this;if(e>=this.text.length)return this;var i=Do.splitLeaves(this.leaves,e),a=go(i,2),s=a[0],u=a[1],c=Do.splitLeaves(u,t),l=go(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 zr.of(Do.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=Do.splitLeaves(r,f),p=go(d,2),v=p[0],y=p[1],g=Do.splitLeaves(y,h),m=go(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:Do.createLeaves(r)}},{key:"getActiveMarksBetweenOffsets",value:function(e,t){if(e<=0&&t>=this.text.length)return this.getActiveMarks();if(e>=t)return ln();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||ln()}},{key:"getActiveMarks",value:function(){var e=this;if(0===this.leaves.size)return ln();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 ln();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||ln()}},{key:"getMarks",value:function(){var e=this.getMarksAsArray();return new Bn(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:ln()}},{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",zr.of(Do.create({text:t,marks:r})));if(0===t.length)return this;r||(r=ln());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),Do.create({text:t,marks:r}),i.set("text",c));return this.setLeaves(f)}},{key:"regenerateKey",value:function(){var e=co.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",zr.of(o))}if(t<=0)return this;if(e>=this.text.length)return this;var i=Do.splitLeaves(this.leaves,e),a=go(i,2),s=a[0],u=a[1],c=Do.splitLeaves(u,t),l=go(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=Do.splitLeaves(this.leaves,e),c=go(u,2),l=c[0],f=c[1],h=Do.splitLeaves(f,t)[1],d=Do.createLeaves(l.concat(h));if(1===d.size){var p=d.first();if(""===p.text)return this.set("leaves",zr.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",zr.of(a))}if(t<=0)return this;if(e>=this.text.length)return this;var s=Do.splitLeaves(this.leaves,e),u=go(s,2),c=u[0],l=u[1],f=Do.splitLeaves(l,t),h=go(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=Do.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=Do.createLeaves(e);if(1===t.size){var r=t.first();if((!r.marks||0===r.marks.size)&&""===r.text)return this.set("leaves",zr())}return this.set("leaves",Do.createLeaves(e))}},{key:"object",get:function(){return"text"}},{key:"kind",get:function(){return X.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}]}),b(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(zr.isList(e)||Array.isArray(e)){var r=new zr(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?co.create():r,o=e.leaves;if(o||(e.ranges?(X.deprecate("slate@0.27.0","The `ranges` property of Slate objects has been renamed to `leaves`."),o=e.ranges):o=zr()),Array.isArray(o))o=zr(o.map((function(e){return Do.create(e)})));else{if(!zr.isList(o))throw new Error("leaves must be either Array or Immutable.List");o=o.map((function(e){return Do.create(e)}))}return new t({leaves:Do.createLeaves(o),key:n})}},{key:"isTextList",value:function(e){return zr.isList(e)&&e.every((function(e){return t.isText(e)}))}}]),t}(Fn({leaves:zr(),key:void 0}));Mo.fromJS=Mo.fromJSON,Mo.isText=io.bind(null,"TEXT"),Mo.prototype[oo.TEXT]=!0,Oo(Mo.prototype,["getDecorations","getActiveMarks","getMarks","getMarksAsArray","normalize","validate","getString"]);var Jo=function(){function e(){fo(this,e)}return ho(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)})),zr(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 ln();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 ln();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 ln();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)})),zr(r)}},{key:"getBlocks",value:function(){var e=this.getBlocksAsArray();return new zr(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 zr(new Bn(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 zr(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 zr();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=Ro.relate(e,t);return this.getNode(r)}},{key:"getDecorations",value:function(e){var t=e.find("decorateNode",this);return Lo.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 To.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=Ro.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 To.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 zr(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 zr(new Bn(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 zr(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 ln();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(mo(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 ln(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:ln()}},{key:"getMarksAtRange",value:function(e){return new ln(this.getOrderedMarksAtRange(e))}},{key:"getMarksByType",value:function(e){var t=this.getMarksByTypeAsArray(e);return new ln(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=Ro.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=Ro.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 Bn(e)}},{key:"getOrderedMarksAtRange",value:function(e){if((e=e.normalize(this)).isUnset)return Bn();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 Bn().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 Bn(t)}},{key:"getParent",value:function(e){if(!(e=this.resolvePath(e)))return null;if(!e.size)return null;var t=Ro.lift(e);return this.getNode(t)}},{key:"getPath",value:function(e){if(zr.isList(e))return e;var t=this.getKeysToPathsTable()[e];return t?zr(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=Ro.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=Ro.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=Yn(this.text);return"neutral"===e?null:e}},{key:"getTexts",value:function(){var e=this.getTextsAsArray();return new zr(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 zr();var t=e,r=t.startKey,n=t.endKey;return new zr(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=Ro.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=Ro.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=Ro.lift(t);this.assertNode(o);var i=Ro.crop(e,t),a=go(i,2),s=a[0],u=a[1],c=Ro.compare(s,u);e.size<t.size&&-1===c&&(t=Ro.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=co.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 zr(["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 zr(["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=Ro.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=go(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 X.deprecate("0.35.0","The `Node.getNodeAtPath` method has been combined into `Node.getNode`."),this.getNode(e)}},{key:"getDescendantAtPath",value:function(e){return X.deprecate("0.35.0","The `Node.getDescendantAtPath` has been combined into `Node.getDescendant`."),this.getDescendant(e)}},{key:"getKeys",value:function(){X.deprecate("0.35.0","The `Node.getKeys` method is deprecated.");var e=this.getKeysAsArray();return new ln(e)}},{key:"getKeysAsArray",value:function(){X.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;X.deprecate("0.35.0","The `Node.areDescendantsSorted` method is deprecated. Use the new `PathUtils.compare` helper instead."),e=co.create(e),t=co.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){X.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(b(t)){var r=t.object;switch(!r&&t.kind&&(X.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),r=t.kind),r){case"block":return ko.create(t);case"document":return To.create(t);case"inline":return bo.create(t);case"text":return Mo.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(zr.isList(t)||Array.isArray(t)){var r=zr(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(ko.isBlock(e)||bo.isInline(e))return{data:e.data,isVoid:e.isVoid,type:e.type};if("string"==typeof e)return{type:e};if(b(e)){var t={};return"type"in e&&(t.type=e.type),"data"in e&&(t.data=_o.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&&(X.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),t=e.kind),t){case"block":return ko.fromJSON(e);case"document":return To.fromJSON(e);case"inline":return bo.fromJSON(e);case"text":return Mo.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 io(t,e)}))}},{key:"isNodeList",value:function(t){return zr.isList(t)&&t.every((function(t){return e.isNode(t)}))}}]),e}();Jo.fromJS=Jo.fromJSON;var Uo=function(e){Jo.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}},Vo=!0,qo=!1,Wo=void 0;try{for(var Ho,$o=["Child","Depth","Descendant","Node","Parent","Path"][Symbol.iterator]();!(Vo=(Ho=$o.next()).done);Vo=!0){Uo(Ho.value)}}catch(e){qo=!0,Wo=e}finally{try{!Vo&&$o.return&&$o.return()}finally{if(qo)throw Wo}}Oo(Jo.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(Jo.prototype).forEach((function(e){"constructor"!==e&&(ko.prototype[e]=Jo.prototype[e],bo.prototype[e]=Jo.prototype[e],To.prototype[e]=Jo.prototype[e])})),ko.createChildren=Jo.createList,bo.createChildren=Jo.createList,To.createChildren=Jo.createList;var Yo=/\s/,Go=/['\u2018\u2019]/,Qo=/[\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 Xo(e){return 55296<=e&&e<=57343}function Zo(e,t){if(Yo.test(e))return!1;if(Go.test(e)){var r=t.charAt(0),n=ei(r);if(Zo(r=t.slice(0,n),t.slice(n)))return!0}return!Qo.test(e)}function ei(e){return Xo(e.charCodeAt(0))?2:1}function ti(e){return ei(e.charAt(0))}function ri(e){for(var t=0,r=0,n=!1,o=void 0;o=e.charAt(r);){var i=ei(o);if(Zo(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 ni={getCharLength:ei,getCharOffset:ti,getCharOffsetBackward:function(e,t){return e=e.slice(0,t),ti(e=Gn.exports.reverse(e))},getCharOffsetForward:function(e,t){return ti(e=e.slice(t))},getWordOffset:ri,getWordOffsetBackward:function(e,t){return e=e.slice(0,t),ri(e=Gn.exports.reverse(e))},getWordOffsetForward:function(e,t){return ri(e=e.slice(t))},isSurrogate:Xo,isWord:Zo},oi={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),S=O.getFurthestAncestor(i),A=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!=S.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(S),R=O.nodes.indexOf(A),L=O.nodes.slice(z+1,R);for(L.reverse().forEach((function(t){e.removeNodeByKey(t.key,{normalize:!1})})),j=_;j.key!=A.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=ni.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=ni.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=ni.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=ni.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=ko.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),S=O?f.nodes.skipUntil((function(e){return e.key==O.key})):zr(),A=b.nodes.size;S.forEach((function(t,r){var n=A+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=bo.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(){X.deprecate("slate@0.33.0","The `setBlockAtRange` method of Slate changes has been renamed to `setBlocksAtRange`."),oi.setBlocksAtRange.apply(oi,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(){X.deprecate("slate@0.33.0","The `setInlineAtRange` method of Slate changes has been renamed to `setInlinesAtRange`."),oi.setInlinesAtRange.apply(oi,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=Eo.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=Jo.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=Jo.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=ko.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=bo.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",zr([_])),oi.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),S=d.nodes.indexOf(O),A=s==c?O:d.getFurthestAncestor(c),E=d.nodes.skipUntil((function(e){return e==O})).takeUntil((function(e){return e==A})).push(A),N=r.regenerateKey();e.insertNodeByKey(d.key,S,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})}},ii={addMarkByPath:function(e,t,r,n,o,i){o=Eo.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=Ro.relate(t,r);e.normalizeNodeByPath(a,o)},removeMarkByPath:function(e,t,r,n,o,i){o=Eo.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=Lo.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=Jo.create(r);var o=t.last(),i=Ro.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=Eo.create(o),i=Eo.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=Jo.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=Ro.lift(t),i=n.assertNode(o),a=t.last(),s=o.last(),u=Ro.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=Ro.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=ko.create(r)).set("nodes",r.nodes.clear());var o=Ro.lift(t),i=t.last(),a=Ro.increment(t);e.insertNodeByPath(o,i,r,{normalize:!1}),e.moveNodeByPath(a,t,0,n)},wrapInlineByPath:function(e,t,r,n){r=(r=bo.create(r)).set("nodes",r.nodes.clear());var o=Ro.lift(t),i=t.last(),a=Ro.increment(t);e.insertNodeByPath(o,i,r,{normalize:!1}),e.moveNodeByPath(a,t,0,n)},wrapNodeByPath:function(e,t,r){"block"!=(r=Jo.create(r)).object?"inline"!=r.object||e.wrapInlineByPath(t,r):e.wrapBlockByPath(t,r)}},ai=function(e){ii[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))}},si=!0,ui=!1,ci=void 0;try{for(var li,fi=["addMark","insertFragment","insertNode","insertText","mergeNode","removeMark","removeAllMarks","removeNode","setText","replaceText","removeText","replaceNode","setMark","setNode","splitNode","unwrapInline","unwrapBlock","unwrapNode","wrapBlock","wrapInline","wrapNode"][Symbol.iterator]();!(si=(li=fi.next()).done);si=!0){ai(li.value)}}catch(e){ui=!0,ci=e}finally{try{!si&&fi.return&&fi.return()}finally{if(ui)throw ci}}ii.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))},ii.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 hi=eo("slate:history"),di=function(e){function t(){return fo(this,t),yo(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return vo(t,e),ho(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=vi(e,c)),s)return r;if(null==a&&(a=pi(e,c)),hi("save",{operation:e,merge:a}),a&&u){var l=u.push(e);o=(o=o.pop()).push(l)}else{var f=new zr([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 X.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(b(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(zr.isList(e))return e;if(Array.isArray(e))return new zr(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 Zr(n.map(this.createOperationsList)),undos:new Zr(i.map(this.createOperationsList))})}}]),t}(Fn({redos:new Zr,undos:new Zr}));function pi(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&&to(e.path,t.path)||"remove_text"==e.type&&"remove_text"==t.type&&e.offset+e.text.length==t.offset&&to(e.path,t.path))}function vi(e,t){return!!t&&("set_selection"==e.type&&"set_selection"==t.type)}di.fromJS=di.fromJSON,di.isHistory=io.bind(null,"HISTORY"),di.prototype[oo.HISTORY]=!0;var yi=function(e){function t(){return fo(this,t),yo(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return vo(t,e),ho(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 X.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[oo.STACK])}}]),t}(Fn({plugins:[]}));yi.prototype[oo.STACK]=!0,Oo(yi.prototype,["getPluginsWith"]);var gi=function(e){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};fo(this,t);var n=yo(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 vo(t,e),t}(Error),mi=eo("slate:schema"),ki=[{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,Mo.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=Mo.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=Mo.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})}}],bi=function(e){function t(){return fo(this,t),yo(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return vo(t,e),ho(t,[{key:"validateNode",value:function(e){var t=this.rules.filter((function(t){return _i(e,t.match)})),r=wi(e,t,this.rules,{every:!0});if(r)return new gi(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){mi("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 X.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(b(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(ki),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(po({match:[{object:"document"}]},l.document)),h)n.push(po({match:[{object:"block",type:v}]},h[v]));for(var y in p)n.push(po({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:yi.create({plugins:r}),rules:n})}},{key:"isSchema",value:function(e){return!(!e||!e[oo.SCHEMA])}}]),t}(Fn({stack:yi.create(),rules:[]}));function _i(e,t){return!wi(e,t)}function wi(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=wi(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=xi(e,t)||Oi(e,t)||Si(e,t)||Ai(e,t)||Ei(e,t)||Ni(e,t)||Ti(e,t)||ji(e,t)||Pi(e,t,r);return v}function xi(e,t){if(t.objects&&X.warn("The `objects` schema validation rule was changed. Please use the new `match` syntax with `object`."),null!=t.object&&t.object!==e.object)return Ri("node_object_invalid",{rule:t,node:e})}function Oi(e,t){if(t.types&&X.warn("The `types` schema validation rule was changed. Please use the new `match` syntax with `type`."),null!=t.type&&t.type!==e.type)return Ri("node_type_invalid",{rule:t,node:e})}function Si(e,t){if(null!=t.isVoid&&t.isVoid!==e.isVoid)return Ri("node_is_void_invalid",{rule:t,node:e})}function Ai(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 Ri("node_data_invalid",{rule:t,node:e,key:r,value:o})}}function Ei(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:Ri("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":lo(c)))return c.v}}catch(e){i=!0,a=e}finally{try{!o&&u.return&&u.return()}finally{if(i)throw a}}}}function Ni(e,t){if(null!=t.text){var r=e.text;if(!t.text.test(r))return Ri("node_text_invalid",{rule:t,node:e,text:r})}}function Ti(e,t){if(null!=t.first){var r=e.nodes.first();if(r){var n=wi(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 ji(e,t){if(null!=t.last){var r=e.nodes.last();if(r){var n=wi(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 Pi(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=Ci(e,l,r)||Bi(e,l,f,s,r)||zi(e,l,h,s,r);if(d)return d;if(null!=t.nodes){if(!u)return Ri("child_unknown",{rule:t,node:e,child:l,index:s});if(u&&(u.objects&&X.warn("The `objects` schema validation rule was changed. Please use the new `match` syntax with `object`."),u.types&&X.warn("The `types` schema validation rule was changed. Please use the new `match` syntax with `type`.")),u.match){var p=wi(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 Ri("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 Ci(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&&_i(t,u.match)){var c=wi(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 Bi(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&&_i(t,l.match)){var f=wi(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 zi(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&&_i(t,l.match)){var f=wi(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 Ri(e,t){return po({code:e},t)}bi.fromJS=bi.fromJSON,bi.prototype[oo.SCHEMA]=!0;var Li=function(e){function t(){return fo(this,t),yo(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return vo(t,e),ho(t,[{key:"change",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Zi(po({},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=Ro.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 X.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 zr:this.document.getCharactersAtRange(this.selection)}},{key:"marks",get:function(){return this.selection.isUnset?new ln:this.selection.marks||this.document.getMarksAtRange(this.selection)}},{key:"activeMarks",get:function(){return this.selection.isUnset?new ln:this.selection.marks||this.document.getActiveMarksAtRange(this.selection)}},{key:"blocks",get:function(){return this.selection.isUnset?new zr:this.document.getBlocksAtRange(this.selection)}},{key:"fragment",get:function(){return this.selection.isUnset?To.create():this.document.getFragmentAtRange(this.selection)}},{key:"inlines",get:function(){return this.selection.isUnset?new zr:this.document.getInlinesAtRange(this.selection)}},{key:"texts",get:function(){return this.selection.isUnset?new zr: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(b(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(b(e)){var r={};return"data"in e&&(r.data=_o.create(e.data)),"decorations"in e&&(r.decorations=Lo.createList(e.decorations)),"schema"in e&&(r.schema=bi.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 fr;if(o=To.fromJSON(o),a=Lo.fromJSON(a),u=bi.fromJSON(u),l=di.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[oo.VALUE])}}]),t}(Fn({data:new fr,decorations:null,document:To.create(),history:di.create(),schema:bi.create(),selection:Lo.create()}));Li.fromJS=Li.fromJSON,Li.prototype[oo.VALUE]=!0;var Ki={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"]},Fi=function(e){function t(){return fo(this,t),yo(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return vo(t,e),ho(t,[{key:"toJSON",value:function(){var e=this.object,t=this.type,r={object:e,type:t},n=Ki[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 X.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(b(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(zr.isList(e)||Array.isArray(e)){var r=new zr(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=Ki[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=Ro.create(f)),"mark"===l&&(f=Eo.create(f)),"marks"===l&&null!=f&&(f=Eo.createSet(f)),"node"===l&&(f=Jo.create(f)),"selection"===l&&(f=Lo.create(f)),"value"===l&&(f=Li.create(f)),"properties"===l&&"merge_node"===r&&(f=Jo.createProperties(f)),"properties"===l&&"set_mark"===r&&(f=Eo.createProperties(f)),"properties"===l&&"set_node"===r&&(f=Jo.createProperties(f)),"properties"===l&&"set_selection"===r&&(f=Lo.createProperties(f)),"properties"===l&&"set_value"===r&&(f=Li.createProperties(f)),"properties"===l&&"split_node"===r&&(f=Jo.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[oo.OPERATION])}},{key:"isOperationList",value:function(e){return zr.isList(e)&&e.every((function(e){return t.isOperation(e)}))}}]),t}(Fn({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}));Fi.fromJS=Fi.fromJSON,Fi.prototype[oo.OPERATION]=!0;var Ii=eo("slate:operation:invert");function Di(e){var t=(e=Fi.create(e)).type;switch(Ii(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=Ro.decrement(c);return e.set("type","split_node").set("path",l);case"split_node":var f=e.path,h=Ro.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=ro(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=ro(b,Object.keys(k));return e.set("mark",_).set("properties",w);case"set_selection":var x=e,O=x.properties,S=x.selection,A=S.merge(O),E=ro(S,Object.keys(O));return e.set("selection",A).set("properties",E);case"set_value":var N=e,T=N.properties,j=N.value,P=j.merge(T),C=ro(j,Object.keys(T));return e.set("value",P).set("properties",C);default:throw new Error('Unknown operation type: "'+t+'".')}}var Mi={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",no(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(Di).forEach((function(t){var r=t,n=r.type,o=r.properties;"set_selection"==n&&(t=t.set("properties",no(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)}}},Ji={select:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t=Lo.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=ro(c,Object.keys(t)))!0!==o&&Ye(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),Zn(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;Ji["moveChar"+e]=function(e){e[t]()[r]()},Ji["moveStartChar"+e]=function(e){e.value.isBackward?e[r]():e[t]()},Ji["moveEndChar"+e]=function(e){e.value.isBackward?e[t]():e[r]()},Ji["extendChar"+e]=function(t){t["moveFocusChar"+e]()},Ji["collapseChar"+e]=function(t){t["Forward"==e?"collapseToEnd":"collapseToStart"]()["moveChar"+e]()}}));[["collapseLineBackward","collapseToStartOfBlock"],["collapseLineForward","collapseToEndOfBlock"],["extendLineBackward","extendToStartOfBlock"],["extendLineForward","extendToEndOfBlock"]].forEach((function(e){var t=go(e,2),r=t[0],n=t[1];Ji[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){Ji[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 Ui=["Next","Previous"],Vi=["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";Vi.forEach((function(e){var t="Text"==e?"getNode":"getClosest"+e;Ji[""+r+e]=function(e){var n=e.value,o=n.document,i=n.selection,a=o[t](i.startKey);a&&e[r](a)},Ui.forEach((function(n){var o="get"+n+e,i="Next"==n?"startKey":"endKey";Ji[""+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 qi={setValue:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t=Li.createProperties(t);var n=e.value;e.applyOperation({type:"set_value",properties:t,value:n},r)}},Wi={};function Hi(e,t,r){if("text"!=t.object){for(var n=t.getFirstInvalidDescendant(r),o=e.value.document.getPath(t.key);t&&n;)Hi(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&&$i(e,t,r)}else $i(e,t,r)}function $i(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)}Wi.normalize=function(e,t){e.normalizeDocument(t)},Wi.normalizeDocument=function(e,t){var r=e.value.document;e.normalizeNodeByKey(r.key,t)},Wi.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);Hi(e,s,a),e.normalizeAncestorsByKey(t)}},Wi.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)&&$i(e,t,o)}))},Wi.normalizeParentByKey=function(e,t,r){var n=e.value.document.getParent(t);e.normalizeNodeByKey(n.key,r)},Wi.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);Hi(e,s,a);var u=(i=e.value.document).getAncestors(t);u&&u.forEach((function(t){e.value.document.getDescendant(t.key)&&$i(e,t,a)}))}},Wi.normalizeParentByPath=function(e,t,r){var n=Ro.lift(t);e.normalizeNodeByPath(n,r)};var Yi=po({},No,oi,ii,Mi,Ji,qi,Wi),Gi=eo("slate:operation:apply");function Qi(e,t){var r=(t=Fi.create(t)).type;switch(Gi(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 S=t.path;return e.removeNode(S);case"remove_text":var A=t,E=A.path,N=A.offset,T=A.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 Xi=eo("slate:change"),Zi=function(){function e(t){fo(this,e);var r=t.value;this.value=r,this.operations=new zr,this.flags=po({normalize:!0},ro(t,["merge","save","normalize"]))}return ho(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;b(e)&&(e=po({},e,{value:o})),e=Fi.create(e);var s=t=po({},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 Xi("apply",{operation:e,save:f,merge:c}),o=Qi(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 X.deprecate("slate@0.32.0","The `kind` property of Slate objects has been renamed to `object`."),this.object}}]),e}();Zi.isChange=io.bind(null,"CHANGE"),Zi.prototype[oo.CHANGE]=!0,Object.keys(Yi).forEach((function(e){Zi.prototype[e]=function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return Xi(e,{args:r}),this.call.apply(this,[Yi[e]].concat(r)),this}}));const ea=r,{renderToStaticMarkup:ta}=n;var ra=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},na=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},oa=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)},ia=new Fn({object:"string",text:""}),aa={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(ea.createElement("br",{key:r})),e.push(t),e}),[])}};function sa(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 ua=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=na({object:"block",data:{},isVoid:!1},i,{nodes:[t]});return e.push(o),e}),[])).length&&(c=[na({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:Li.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(g(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)),g(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=g(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=ta(ea.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 la(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 ia({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 la(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)}},ca=0;function la(e){return ea.cloneElement(e,{key:ca++})}var fa,ha,da,pa={"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},va={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},ya=function(e){return e.length?e.charAt(0).toUpperCase()+e.substring(1):e},ga=ya,ma=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,ka="undefined"==typeof document?{}:document.documentElement.style,ba=(fa=function(){for(var e in ka)if(ma.test(e))return e.match(ma)[0];return"WebkitOpacity"in ka?"Webkit":"KhtmlOpacity"in ka?"Khtml":""}(),ha=fa.toLowerCase(),{style:fa,css:"-"+ha+"-",dom:{Webkit:"WebKit",ms:"MS",o:"WebKit"}[fa]||ga(fa)}),_a=function(e,t){return t?t.toUpperCase():""},wa=/[-\s]+(.)?/g,xa=function(e){return e?e.replace(wa,_a):""},Oa=/::/g,Sa=/([A-Z]+)([A-Z][a-z])/g,Aa=/([a-z\d])([A-Z])/g,Ea=/_/g,Na=function(e,t){return e?e.replace(Oa,"/").replace(Sa,"$1_$2").replace(Aa,"$1_$2").replace(Ea,t||"-"):""},Ta=function(e){return Na(e).toLowerCase()},ja=xa,Pa=Ta,Ca=function(e){return e.length?e.charAt(0).toLowerCase()+e.substring(1):e},Ba=ya,za=ba,Ra=pa,La="undefined"==typeof document?{}:document.documentElement.style,Ka=function(e,t){t=t||{};var r=Ca(ja(e)),n=Pa(e),o=da?r:n,i=za.style?da?za.style:za.css:"";if(r in La)return t.asString?o:[o];var a=o,s=Ra[n],u=[];if(da&&(a=Ba(o)),"function"==typeof s){var c=s(o,i)||[];c&&!Array.isArray(c)&&(c=[c]),c.length&&(c=c.map((function(e){return da?Ca(ja(e)):Pa(e)}))),u=u.concat(c)}return i&&u.push(i+a),u.push(o),t.asString||1==u.length?u[0]:u},Fa=Object.prototype.hasOwnProperty,Ia=function(e,t){return Fa.call(e,t)},Da=Object.prototype.toString,Ma=Object.prototype.toString,Ja=Ka,Ua=Ta,Va=xa,qa=Ia,Wa=function(e){return!!e&&"[object Object]"===Da.call(e)},Ha=function(e){return"[object Function]"===Ma.apply(e)},$a=function(e,t,r,n){Ja(t).forEach((function(t){e[n?n(t):t]=r}))},Ya={cssUnitless:va},Ga=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||Ya).cssUnitless=t.cssUnitless||Ya.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?Va:Ua;for(a in e)if(qa(e,a)){if(s=e[a],i=Ua(r?r+a:a),o=!1,f=!1,Ha(s)&&(l=s.call(h||e,s,a,i,e),Wa(l)&&null!=l.value?(s=l.value,f=l.prefix,i=l.name?Ua(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?$a(n,e,s,g):n[g(e)]=s}));continue}f?$a(n,i,s,g):n[g(i)]=s}else Ga(s,t,i+"-",n)}return n},Qa=Ga,Xa=Ia,Za={prefixProperties:pa,cssUnitless:va,object:Ga,string:function(e,t){e=Qa(e,t);var r,n=[];for(r in e)Xa(e,r)&&n.push(r+": "+e[r]);return n.join("; ")}};const es=e("@pie-lib:mask-markup:serialization"),ts=["span"],rs=["em","strong","u"],ns=(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),Za.object(n,{camelize:!0,addUnits:!1});var n},os=["border","class","style"],is={b:"bold",em:"italic",u:"underline",s:"strikethrough",code:"code",strong:"strong"},as=[{deserialize(e,t){const r=is[e.tagName.toLowerCase()];if(r)return es("[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=os.reduce((e=>(t,r)=>{if(!e.getAttribute)return t;if(e.getAttribute(r))switch(r){case"style":t.style=ns(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=>ts.includes(e)?"inline":rs.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)}}}],ss=new function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};ra(this,e),ua.call(this);var r=t.defaultBlock,n=void 0===r?"paragraph":r,o=t.parseHtml,i=void 0===o?sa:o,a=t.rules,s=void 0===a?[]:a;n=Jo.createProperties(n),this.rules=[].concat(oa(s),[aa]),this.defaultBlock=n,this.parseHtml=i}({rules:as,defaultBlock:"span"}),us=r,cs=o,{get:ls}=t,{withStyles:fs}=i,hs=a;function ds(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 ps=fs((e=>({para:{paddingTop:2*e.spacing.unit,paddingBottom:2*e.spacing.unit}})))((e=>us.createElement("div",{className:e.classes.para},e.children))),vs=fs((()=>({spacer:{display:"inline-block",width:".75em"}})))((e=>us.createElement("span",{className:e.classes.spacer}))),ys=["tbody","tr"],gs=(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(us.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"!==ds([o,"optionalAccess",e=>e.type])&&"drag-in-the-blank"===i&&a.push(us.createElement(vs,{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&&ys.includes(n)?void 0:t})(o,r);return n?e+n:e}),""),r=(e=>{const t=e.leaves.find((e=>ls(e,"marks",[]).length));return t?t.marks[0]:null})(e);if(r){let e;for(e in is)if(is[e]===r.type){const r=e;a.push(us.createElement(r,{key:u},t));break}}else t.length>0&&(a.push(t),"td"!==ds([o,"optionalAccess",e=>e.type])&&"drag-in-the-blank"===i&&a.push(us.createElement(vs,{key:`spacer-${s}`})))}else{const o=gs(e,t,r,n,e,i);if("p"===e.type||"paragraph"===e.type)a.push(us.createElement(ps,{key:u},o));else{const t=e.type;e.nodes&&e.nodes.length>0?a.push(us.createElement(t,{key:u,...e.data.attributes},o)):a.push(us.createElement(t,{key:u,...e.data.attributes}))}}})),a},ms=fs((()=>({main:{display:"initial"},tableStyle:{"&:not(.MathJax) table":{borderCollapse:"collapse"},"&:not(.MathJax) table td, &:not(.MathJax) table th":{padding:"8px 12px",textAlign:"left"}}})))((e=>us.createElement("div",{className:hs(e.classes.main,e.classes.tableStyle)},e.children)));class ks extends us.Component{constructor(...e){super(...e),ks.prototype.__init.call(this)}static __initStatic(){this.propTypes={renderChildren:cs.func,layout:cs.object,value:cs.object,onChange:cs.func,elementType:cs.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=gs(t,e,this.handleChange,this.props.renderChildren,null,r);return us.createElement(ms,null,n)}}ks.__initStatic();const bs=/\{\{(\d+)\}\}/g;const _s=r,ws=s,xs=o;var Os;const Ss=(e,t)=>{const{markup:r}=(o=t,(n=e)?{markup:n.replace(bs,((e,t)=>`<span data-component="${o}" data-id="${t}"></span>`))}:{markup:""});var n,o;const i=(e=>ss.deserialize(e,{toJSON:!0}))(r);return i.document},As=(e,t)=>((Os=class extends _s.Component{static __initStatic(){this.propTypes={markup:xs.string,layout:xs.object,value:xs.object,onChange:xs.func,customMarkMarkupComponent:xs.func,elementType:xs.string}}componentDidUpdate(e){if(this.props.markup!==e.markup){const e=ws.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||Ss(r,e);return _s.createElement(ks,{elementType:a,layout:s,value:o,onChange:i,renderChildren:t(this.props)})}}).__initStatic(),Os),Es=r,Ns=s,Ts=o,{withStyles:js}=i,{Chip:Ps}=u,Cs=a,{color:Bs}=c,{renderMath:zs}=h,{DragSource:Rs}=d;class Ls extends Es.Component{constructor(...e){super(...e),Ls.prototype.__init.call(this),Ls.prototype.__init2.call(this),Ls.prototype.__init3.call(this),Ls.prototype.__init4.call(this)}static __initStatic(){this.propTypes={disabled:Ts.bool,choice:Ts.object,classes:Ts.object,connectDragSource:Ts.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(){zs(this.rootRef)}render(){const{connectDragSource:e,choice:t,classes:r,disabled:n}=this.props;return e(Es.createElement("span",{className:Cs(r.choice,n&&r.disabled),ref:e=>{this.dragContainerRef=Ns.findDOMNode(e)}},Es.createElement(Ps,{clickable:!1,disabled:!0,ref:e=>{this.rootRef=Ns.findDOMNode(e)},className:r.chip,label:Es.createElement("span",{className:r.chipLabel,ref:e=>{e&&(e.innerHTML=t.value||" ")}}," "),variant:n?"outlined":void 0})),{})}}Ls.__initStatic();const Ks=js((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:Bs.white(),border:`1px solid ${Bs.text()}`,color:Bs.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}})))(Ls),Fs=Rs("MaskBlank",{canDrag:e=>!e.disabled,beginDrag:e=>({choice:e.choice,instanceId:e.instanceId})},((e,t)=>({connectDragSource:e.dragSource(),isDragging:t.isDragging()})))(Ks),Is=r,Ds=o,{findKey:Ms}=t,{DragDroppablePlaceholder:Js}=d;class Us extends Is.Component{constructor(...e){super(...e),Us.prototype.__init.call(this)}static __initStatic(){this.propTypes={disabled:Ds.bool,duplicates:Ds.bool,choices:Ds.arrayOf(Ds.shape({label:Ds.string,value:Ds.string})),value:Ds.object,choicePosition:Ds.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===Ms(n,(t=>t===e.id))})),i={...this.getStyleForWrapper(),minWidth:"100px"};return Is.createElement("div",{style:i},Is.createElement(Js,{disabled:e},o.map(((t,r)=>Is.createElement(Fs,{key:`${t.value}-${r}`,disabled:e,choice:t})))))}}Us.__initStatic();const{colors:{grey:Vs}}=u,{Chip:qs}=u,Ws=r,Hs=s,$s=o,Ys=e,{withStyles:Gs}=i,Qs=a,{color:Xs}=c,{renderMath:Zs}=h,{DragSource:eu}=d,{DropTarget:tu}=d;const ru=Ys("pie-lib:mask-markup:blank"),nu=Gs((()=>({content:{border:`solid 0px ${Xs.primary()}`,minWidth:"200px",touchAction:"none",overflow:"hidden",whiteSpace:"nowrap"},chip:{backgroundColor:Xs.background(),border:`2px dashed ${Xs.text()}`,color:Xs.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 ${Xs.correct()}`},incorrect:{border:`solid 1px ${Xs.incorrect()}`},over:{whiteSpace:"nowrap",overflow:"hidden"},parentOver:{border:`1px solid ${Vs[500]}`,backgroundColor:`${Vs[300]}`}})));class ou extends Ws.Component{constructor(){super(),ou.prototype.__init.call(this),ou.prototype.__init2.call(this),ou.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){Zs(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 Ws.createElement(qs,{clickable:!1,disabled:!0,ref:e=>{this.rootRef=Hs.findDOMNode(e)},component:"span",label:Ws.createElement(Ws.Fragment,null,Ws.createElement("span",{className:Qs(r.chipLabel,n&&r.over,{[r.hidden]:a}),ref:e=>{e&&(this.spanRef=Hs.findDOMNode(e),e.innerHTML=s||"",this.addDraggableFalseAttributes(e))}}," "),a&&Ws.createElement("span",{className:Qs(r.chipLabel,n&&r.over,r.dragged),ref:e=>{e&&(this.spanRef=Hs.findDOMNode(e),e.innerHTML=a||"",this.addDraggableFalseAttributes(e))}}," ")),className:Qs(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()}})}}ou.defaultProps={emptyResponseAreaWidth:0,emptyResponseAreaHeight:0},ou.propTypes={id:$s.oneOfType([$s.string,$s.number]),disabled:$s.bool,duplicates:$s.bool,choice:$s.object,classes:$s.object,isOver:$s.bool,dragItem:$s.object,correct:$s.bool,onChange:$s.func,emptyResponseAreaWidth:$s.oneOfType([$s.string,$s.number]),emptyResponseAreaHeight:$s.oneOfType([$s.string,$s.number])};const iu=nu(ou),au=nu((({connectDragSource:e,connectDropTarget:t,...r})=>{const{classes:n,isOver:o}=r;return t(e(Ws.createElement("span",{className:Qs(n.content,o&&n.over)},Ws.createElement(iu,{...r}))))})),su=tu("MaskBlank",{drop(e,t){const r=t.getItem();return ru("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()})))(au),uu=eu("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()})))(su),cu=r,lu=o,{renderMath:fu}=h,hu=As("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 cu.createElement(uu,{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 du extends cu.Component{constructor(...e){super(...e),du.prototype.__init.call(this)}static __initStatic(){this.propTypes={markup:lu.string,layout:lu.object,choicesPosition:lu.string,choices:lu.arrayOf(lu.shape({label:lu.string,value:lu.string})),value:lu.object,onChange:lu.func,duplicates:lu.bool,disabled:lu.bool,feedback:lu.object,correctResponse:lu.object,showCorrectAnswer:lu.bool,emptyResponseAreaWidth:lu.oneOfType([lu.string,lu.number]),emptyResponseAreaHeight:lu.oneOfType([lu.string,lu.number])}}UNSAFE_componentWillReceiveProps(){this.rootRef&&fu(this.rootRef)}componentDidUpdate(){fu(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 cu.createElement("div",{ref:e=>e&&(this.rootRef=e),style:p},cu.createElement(Us,{choicePosition:d,duplicates:t,choices:a,value:n,disabled:u}),cu.createElement(hu,{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}))}}du.__initStatic();const pu=r,{withStyles:vu}=i,yu=a,{color:gu}=c,mu=p;function ku(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 bu=vu((()=>({editableHtmlCustom:{display:"inline-block",verticalAlign:"middle",margin:"4px",borderRadius:"4px",border:`1px solid ${gu.black()}`},correct:{border:`1px solid ${gu.correct()}`},incorrect:{border:`1px solid ${gu.incorrect()}`}})))(As("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=ku([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 pu.createElement(mu,{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:!!ku([l,"optionalAccess",e=>e.characters,"optionalAccess",e=>e.disabled])},className:yu(c.editableHtmlCustom,{[c.correct]:g,[c.incorrect]:m})})}})));As("input",(e=>(t,r,n)=>{const o=t.data&&t.data.dataset||{};if("input"===o.component)return e.customMarkMarkupComponent(o.id)}));const _u=r,wu=o,{Button:xu}=u,{InputLabel:Ou}=u,{Menu:Su}=u,{MenuItem:Au}=u,{ArrowDropDown:Eu}=l,{ArrowDropUp:Nu}=l,{Close:Tu}=l,{Check:ju}=l,{withStyles:Pu}=i,Cu=a,{color:Bu}=c,{renderMath:zu}=h;class Ru extends _u.Component{static __initStatic(){this.propTypes={id:wu.string,value:wu.string,disabled:wu.bool,onChange:wu.func,classes:wu.object,correct:wu.bool,choices:wu.arrayOf(wu.shape({value:wu.string,label:wu.string})),showCorrectAnswer:wu.bool,singleQuery:wu.bool,correctValue:wu.string}}constructor(e){super(e),Ru.prototype.__init.call(this),Ru.prototype.__init2.call(this),Ru.prototype.__init3.call(this),Ru.prototype.__init4.call(this),Ru.prototype.__init5.call(this),this.state={anchorEl:null,highlightedOptionId:null,menuWidth:null,previewValue:null},this.hiddenRef=_u.createRef(),this.buttonRef=_u.createRef(),this.previewRef=_u.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||zu(e)})),r){const e=r.clientWidth;e!==this.state.menuWidth&&(this.elementRefs.forEach((e=>{e&&zu(e)})),zu(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?_u.createElement(ju,{className:Cu(e.correctnessIndicatorIcon,e.correctIcon)}):_u.createElement(Tu,{className:Cu(e.correctnessIndicatorIcon,e.incorrectIcon)})),_u.createElement(_u.Fragment,null,_u.createElement("div",{ref:this.hiddenRef,style:{position:"absolute",visibility:"hidden",top:0,left:0},tabIndex:-1,"aria-hidden":"true"},(i||[]).map(((t,r)=>_u.createElement(Au,{key:r,classes:{root:e.menuRoot,selected:e.selected},tabIndex:-1,"aria-hidden":"true"},_u.createElement("span",{className:e.label,dangerouslySetInnerHTML:{__html:t.label}}))))),_u.createElement(Ou,{className:e.srOnly,id:y,tabIndex:-1,"aria-hidden":"true"},g),_u.createElement(xu,{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,_u.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?_u.createElement(Nu,null):_u.createElement(Eu,null)),_u.createElement(Su,{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 _u.createElement(Au,{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)},_u.createElement("span",{ref:e=>this.elementRefs[n]=e,className:e.label,dangerouslySetInnerHTML:{__html:r.label}}),_u.createElement("span",{className:e.selectedIndicator,dangerouslySetInnerHTML:{__html:r.value===o?" ✓":""}}))}))))}}Ru.__initStatic();var Lu=Pu((()=>({root:{color:Bu.text(),border:`1px solid ${Bu.borderGray()}`,borderRadius:"4px",justifyContent:"space-between",backgroundColor:Bu.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:Bu.text(),marginLeft:"5px"},"&:focus, &:focus-visible":{outline:`3px solid ${Bu.tertiary()}`,outlineOffset:"2px",borderWidth:"3px"}},disabledCorrect:{borderWidth:"2px",borderColor:Bu.correct(),color:`${Bu.text()} !important`},disabledIncorrect:{borderWidth:"2px",borderColor:Bu.incorrectWithIcon(),color:`${Bu.text()} !important`},selectMenu:{backgroundColor:Bu.background(),border:`1px solid ${Bu.correct()} !important`,"&:hover":{border:`1px solid ${Bu.text()} `,borderColor:"initial"},"&:focus":{border:`1px solid ${Bu.text()}`,borderColor:"initial"},"& .MuiList-root":{padding:0}},selected:{color:`${Bu.text()} !important`,backgroundColor:`${Bu.background()} !important`,"&:hover":{color:Bu.text(),backgroundColor:`${Bu.dropdownBackground()} !important`}},menuRoot:{color:Bu.text(),backgroundColor:Bu.background(),"&:focus, &:focus-visible":{outline:`3px solid ${Bu.tertiary()}`,outlineOffset:"-1px"},"&:focus":{color:Bu.text(),backgroundColor:Bu.background()},"&:hover":{color:Bu.text(),backgroundColor:Bu.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:`${Bu.white()} !important`,position:"absolute",top:"-8px !important",left:"-8px",marginLeft:"0 !important",borderRadius:"50%",fontSize:"16px",padding:"2px"},correctIcon:{backgroundColor:Bu.correct()},incorrectIcon:{backgroundColor:Bu.incorrectWithIcon()}})))(Ru);const Ku=r;function Fu(e){return Fu="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},Fu(e)}function Iu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Du(e){var t=function(e,t){if("object"!==Fu(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==Fu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Fu(t)?t:String(t)}function Mu(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,Du(n.key),n)}}function Ju(e,t,r){return t&&Mu(e.prototype,t),r&&Mu(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Uu(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Vu(e,t){return Vu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Vu(e,t)}function qu(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&&Vu(e,t)}function Wu(e,t){if(t&&("object"===Fu(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Uu(e)}function Hu(e){return Hu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Hu(e)}function $u(e,t,r){return(t=Du(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Yu(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 Gu(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 Yu(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)?Yu(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 Qu(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 Xu(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Qu(Object(r),!0).forEach((function(t){$u(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qu(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}As("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 Ku.createElement(Lu,{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 Zu={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)}},ec=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Iu(this,e),this.init(t,r)}return Ju(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||Zu,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,Xu(Xu({},{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}(),tc=new ec,rc=function(){function e(){Iu(this,e),this.observers={}}return Ju(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 nc(){var e,t,r=new Promise((function(r,n){e=r,t=n}));return r.resolve=e,r.reject=t,r}function oc(e){return null==e?"":""+e}function ic(e,t,r){e.forEach((function(e){t[e]&&(r[e]=t[e])}))}function ac(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 sc(e,t,r){var n=ac(e,t,Object);n.obj[n.k]=r}function uc(e,t){var r=ac(e,t),n=r.obj,o=r.k;if(n)return n[o]}function cc(e,t,r){var n=uc(e,r);return void 0!==n?n:uc(t,r)}function lc(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]):lc(e[n],t[n],r):e[n]=t[n]);return e}function fc(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var hc={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function dc(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,(function(e){return hc[e]})):e}var pc="undefined"!=typeof window&&window.navigator&&void 0===window.navigator.userAgentData&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,vc=[" ",",","?","!",";"];function yc(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?yc(u,c,r):void 0}o=o[n[i]]}return o}}function gc(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?gc(Object(r),!0).forEach((function(t){$u(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function kc(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=Hu(e);if(t){var o=Hu(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Wu(this,r)}}var bc=function(e){qu(r,rc);var t=kc(r);function r(e){var n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return Iu(this,r),n=t.call(this),pc&&rc.call(Uu(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 Ju(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=uc(this.data,a);return s||!i||"string"!=typeof r?s:yc(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),sc(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=uc(this.data,a)||{};n?lc(s,r,o):s=mc(mc({},s),r),sc(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?mc(mc({},{}),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}(),_c={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 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){$u(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=Hu(e);if(t){var o=Hu(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Wu(this,r)}}var Sc={},Ac=function(e){qu(r,rc);var t=Oc(r);function r(e){var n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Iu(this,r),n=t.call(this),pc&&rc.call(Uu(n)),ic(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,Uu(n)),n.options=o,void 0===n.options.keySeparator&&(n.options.keySeparator="."),n.logger=tc.create("translator"),n}return Ju(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=vc.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"!==Fu(t)&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),"object"===Fu(t)&&(t=xc({},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,xc(xc({},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,S=O?[]:{},A=O?g:y;for(var E in v)if(Object.prototype.hasOwnProperty.call(v,E)){var N="".concat(A).concat(a).concat(E);S[E]=this.translate(N,xc(xc({},t),{joinArrays:!1,ns:c})),S[E]===N&&(S[E]=v[E])}v=S}}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,xc(xc({},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,xc(xc({},this.options.interpolation.defaultVariables),r),n.usedLng,n.usedNS,n.usedKey,{resolved:n});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init(xc(xc({},r),{interpolation:xc(xc({},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=xc(xc({},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=_c.handle(h,e,t,this.options&&this.options.postProcessPassResolved?xc({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,!Sc["".concat(p[0],"-").concat(e)]&&a.utils&&a.utils.hasLoadedNamespace&&!a.utils.hasLoadedNamespace(i)&&(Sc["".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 Ec(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Nc=function(){function e(t){Iu(this,e),this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=tc.create("languageUtils")}return Ju(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]=Ec(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]=Ec(r[1].toLowerCase())),t.indexOf(r[2].toLowerCase())>-1&&(r[2]=Ec(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}(),Tc=[{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}],jc={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)}},Pc=["v1","v2","v3"],Cc={zero:0,one:1,two:2,few:3,many:4,other:5};function Bc(){var e={};return Tc.forEach((function(t){t.lngs.forEach((function(r){e[r]={numbers:t.nr,plurals:jc[t.fc]}}))})),e}var zc=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Iu(this,e),this.languageUtils=t,this.options=r,this.logger=tc.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=Bc()}return Ju(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 Cc[e]-Cc[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!Pc.includes(this.options.compatibilityJSON)}}]),e}();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 Lc(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){$u(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}function Kc(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=cc(e,t,r);return!i&&o&&"string"==typeof r&&void 0===(i=yc(e,r,n))&&(i=yc(t,r,n)),i}var Fc=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Iu(this,e),this.logger=tc.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return Ju(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:dc,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?fc(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?fc(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?fc(t.nestingPrefix):t.nestingPrefixEscaped||fc("$t("),this.nestingSuffix=t.nestingSuffix?fc(t.nestingSuffix):t.nestingSuffixEscaped||fc(")"),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=Kc(t,u,e,s.options.keySeparator,s.options.ignoreJSONStructure);return s.alwaysFormat?s.format(o,void 0,r,Lc(Lc(Lc({},n),t),{},{interpolationkey:e})):o}var i=e.split(s.formatSeparator),a=i.shift().trim(),c=i.join(s.formatSeparator).trim();return s.format(Kc(t,u,a,s.options.keySeparator,s.options.ignoreJSONStructure),c,r,Lc(Lc(Lc({},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=oc(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=Lc(Lc({},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=Lc({},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=oc(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,Lc(Lc({},a),{},{interpolationkey:r[1].trim()}))}),n.trim())),e=e.replace(r[0],n),this.regexp.lastIndex=0}return e}}]),e}();function Ic(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 Dc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ic(Object(r),!0).forEach((function(t){$u(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ic(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Mc(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=Gu(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 Jc(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 Uc=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Iu(this,e),this.logger=tc.create("formatter"),this.options=t,this.formats={number:Jc((function(e,t){var r=new Intl.NumberFormat(e,Dc({},t));return function(e){return r.format(e)}})),currency:Jc((function(e,t){var r=new Intl.NumberFormat(e,Dc(Dc({},t),{},{style:"currency"}));return function(e){return r.format(e)}})),datetime:Jc((function(e,t){var r=new Intl.DateTimeFormat(e,Dc({},t));return function(e){return r.format(e)}})),relativetime:Jc((function(e,t){var r=new Intl.RelativeTimeFormat(e,Dc({},t));return function(e){return r.format(e,t.range||"day")}})),list:Jc((function(e,t){var r=new Intl.ListFormat(e,Dc({},t));return function(e){return r.format(e)}}))},this.init(t)}return Ju(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()]=Jc(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=Mc(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,Dc(Dc(Dc({},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 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){$u(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=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=Hu(e);if(t){var o=Hu(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Wu(this,r)}}var Hc=function(e){qu(r,rc);var t=Wc(r);function r(e,n,o){var i,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return Iu(this,r),i=t.call(this),pc&&rc.call(Uu(i)),i.backend=e,i.store=n,i.services=o,i.languageUtils=o.languageUtils,i.options=a,i.logger=tc.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 Ju(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=ac(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=qc(qc({},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 $c(){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"===Fu(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===Fu(e[2])||"object"===Fu(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 Yc(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 Gc(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?Gc(Object(r),!0).forEach((function(t){$u(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Gc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Xc(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=Hu(e);if(t){var o=Hu(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Wu(this,r)}}function Zc(){}function el(e){Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((function(t){"function"==typeof e[t]&&(e[t]=e[t].bind(e))}))}var tl=function(e){qu(r,rc);var t=Xc(r);function r(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;if(Iu(this,r),e=t.call(this),pc&&rc.call(Uu(e)),e.options=Yc(n),e.services={},e.logger=tc,e.modules={external:[]},el(Uu(e)),o&&!e.isInitialized&&!n.isClone){if(!e.options.initImmediate)return e.init(n,o),Wu(e,Uu(e));setTimeout((function(){e.init(n,o)}),0)}return e}return Ju(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=$c();function o(e){return e?"function"==typeof e?new e:e:null}if(this.options=Qc(Qc(Qc({},n),this.options),Yc(t)),"v1"!==this.options.compatibilityAPI&&(this.options.interpolation=Qc(Qc({},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?tc.init(o(this.modules.logger),this.options):tc.init(null,this.options),this.modules.formatter?i=this.modules.formatter:"undefined"!=typeof Intl&&(i=Uc);var a=new Nc(this.options);this.store=new bc(this.options.resources,this.options);var s=this.services;s.logger=tc,s.resourceStore=this.store,s.languageUtils=a,s.pluralResolver=new zc(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 Fc(this.options),s.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},s.backendConnector=new Hc(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 Ac(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=Zc),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=nc(),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]:Zc,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=nc();return e||(e=this.languages),t||(t=this.options.ns),r||(r=Zc),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&&_c.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=nc();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"!==Fu(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=Qc({},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=nc();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=nc();"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 Nc($c());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]:Zc,o=Qc(Qc(Qc({},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=Qc({},this.services),i.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},i.translator=new Ac(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}();$u(tl,"createInstance",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return new tl(e,t)}));var rl=tl.createInstance();rl.createInstance=tl.createInstance,rl.createInstance,rl.dir,rl.init,rl.loadResources,rl.reloadResources,rl.use,rl.changeLanguage,rl.getFixedT,rl.t,rl.exists,rl.setDefaultNamespace,rl.hasLoadedNamespace,rl.loadNamespaces,rl.loadLanguages;rl.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 nl={translator:{...rl,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 rl.t(e,{lng:r,...t})}},languageOptions:[{value:"en_US",label:"English (US)"},{value:"es_ES",label:"Spanish"}]};const ol=r,il=o,{debounce:al}=t,{isEmpty:sl}=t,{isEqual:ul}=t,cl=f,{color:ll}=c,{Collapsible:fl}=c,{hasText:hl}=c,{hasMedia:dl}=c,{PreviewPrompt:pl}=c,{UiLayout:vl}=c,{withStyles:yl}=i,gl=a,{translator:ml}=nl;class kl extends ol.Component{constructor(...e){super(...e),kl.prototype.__init.call(this),kl.prototype.__init2.call(this),kl.prototype.__init3.call(this),kl.prototype.__init4.call(this),kl.prototype.__init5.call(this)}static __initStatic(){this.propTypes={alwaysShowCorrect:il.bool,animationsDisabled:il.bool,classes:il.object.isRequired,disabled:il.bool,displayType:il.string,feedback:il.object,language:il.string,markup:il.string,maxLengthPerChoice:il.array,maxLengthPerChoiceEnabled:il.bool,mode:il.string,note:il.string,onChange:il.func,playerSpellCheckEnabled:il.bool,prompt:il.string,rationale:il.string,role:il.string,showNote:il.bool,teacherInstructions:il.string,value:il.object,responseAreaInputConfiguration:il.object,model:il.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:al(this.props.onChange,200,{maxWait:200})}UNSAFE_componentWillReceiveProps(e){const{maxLengthPerChoice:t,language:r}=this.props;let{note:n}=this.props;sl(e.feedback)&&this.setState({showCorrectAnswer:!1}),e.alwaysShowCorrect&&this.setState({showCorrectAnswer:!0}),t&&!ul(t,e.maxLengthPerChoice)&&(this.changeSession=this.getChangeSession(e.maxLengthPerChoice)),n&&r&&r!==e.language&&n===ml.t("common:commonCorrectAnswerWithAlternates",{lng:r})&&(n=ml.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,_=gl([n.mainContainer,{[n.noBorderColor]:t}]),w=ol.createElement(pl,{defaultClassName:"teacher-instructions",prompt:v}),x=ol.createElement(pl,{prompt:d}),O=d&&(hl(d)||dl(d)),S=v&&(hl(v)||dl(v));return ol.createElement(vl,{extraCSSRules:k,className:_,style:{display:`${i}`}},"gather"===o&&ol.createElement("h2",{className:n.srOnly},"Fill in the Blank Question"),S&&ol.createElement("div",{className:n.collapsible},r?w:ol.createElement(fl,{labels:{hidden:"Show Teacher Instructions",visible:"Hide Teacher Instructions"}},w)),h&&ol.createElement(pl,{prompt:h}),!t&&ol.createElement(cl,{show:"evaluate"===o,toggled:e,onToggle:this.toggleShowCorrect,language:s}),ol.createElement(bu,{...this.props,onChange:this.onChange,showCorrectAnswer:e,value:m,maxLength:u,adjustedLimit:c,spellCheck:f,pluginProps:y}),b&&ol.createElement("div",{className:gl(n.note,"note"),dangerouslySetInnerHTML:{__html:l}}),O&&ol.createElement("div",{className:n.collapsible},r?x:ol.createElement(fl,{labels:{hidden:"Show Rationale",visible:"Hide Rationale"}},x)))}}kl.__initStatic(),kl.__initStatic2();var bl=yl((e=>({mainContainer:{color:ll.text(),backgroundColor:ll.background()},inlineDisplay:{display:"inline-block"},blockDisplay:{display:"block"},note:{marginBottom:2*e.spacing.unit},collapsible:{marginBottom:2*e.spacing.unit},noBorderColor:{"& *":{borderColor:`${ll.text()} !important`}},srOnly:{position:"absolute",left:"-10000px",top:"auto",width:"1px",height:"1px",overflow:"hidden"}})))(kl);const _l=r,wl=s,{debounce:xl}=t,Ol=e,{renderMath:Sl}=h,Al=Ol("pie-element:explicit-constructed-response:print");class El extends HTMLElement{constructor(){super(),this._options=null,this._model=null,this._session=[],this._rerender=xl((()=>{if(this._model&&this._session){const e=((e,t)=>{const r="instructor"===t.role;return e.prompt=!1!==e.promptEnabled?e.prompt:void 0,e.teacherInstructions=r&&!1!==e.teacherInstructionsEnabled?e.teacherInstructions:void 0,e.rationale=r&&!1!==e.rationaleEnabled?e.rationale:void 0,e.alwaysShowCorrect=r,e.mode=r?"evaluate":e.mode,e.disabled=!0,e.animationsDisabled=!0,e})(this._model,this._options),t=this._options&&_l.createElement(bl,{...e,onChange:()=>{}});wl.render(t,this,(()=>{Al("render complete - render math"),Sl(this)}))}else Al("skip")}),50,{leading:!1,trailing:!0})}set options(e){this._options=e}set model(e){this._model=e,this._rerender()}connectedCallback(){}}export{El as default};
|