@eulersgamma/richtext-editor
Version:
Rich Text Editor npm package
1 lines • 280 kB
JavaScript
import t,{useState as e,useRef as n,useCallback as r,useEffect as o}from"react";import i from"react-dom";var a=function(){return a=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},a.apply(this,arguments)};function s(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))}function u(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}var c="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function l(t,e,n){return t(n={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&n.path)}},n.exports),n.exports}function f(t){if(t.__esModule)return t;var e=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(t).forEach((function(n){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})})),e}var p=l((function(t,e){t.exports=function(){var t=Array.prototype.slice;function e(t,e){e&&(t.prototype=Object.create(e.prototype)),t.prototype.constructor=t}function n(t){return a(t)?t:J(t)}function r(t){return s(t)?t:G(t)}function o(t){return u(t)?t:X(t)}function i(t){return a(t)&&!c(t)?t:$(t)}function a(t){return!(!t||!t[f])}function s(t){return!(!t||!t[p])}function u(t){return!(!t||!t[d])}function c(t){return s(t)||u(t)}function l(t){return!(!t||!t[h])}e(r,n),e(o,n),e(i,n),n.isIterable=a,n.isKeyed=s,n.isIndexed=u,n.isAssociative=c,n.isOrdered=l,n.Keyed=r,n.Indexed=o,n.Set=i;var f="@@__IMMUTABLE_ITERABLE__@@",p="@@__IMMUTABLE_KEYED__@@",d="@@__IMMUTABLE_INDEXED__@@",h="@@__IMMUTABLE_ORDERED__@@",g="delete",y=5,v=1<<y,m=v-1,b={},w={value:!1},_={value:!1};function S(t){return t.value=!1,t}function k(t){t&&(t.value=!0)}function E(){}function x(t,e){e=e||0;for(var n=Math.max(0,t.length-e),r=new Array(n),o=0;o<n;o++)r[o]=t[o+e];return r}function C(t){return void 0===t.size&&(t.size=t.__iterate(O)),t.size}function D(t,e){if("number"!=typeof e){var n=e>>>0;if(""+n!==e||4294967295===n)return NaN;e=n}return e<0?C(t)+e:e}function O(){return!0}function T(t,e,n){return(0===t||void 0!==n&&t<=-n)&&(void 0===e||void 0!==n&&e>=n)}function M(t,e){return N(t,e,0)}function K(t,e){return N(t,e,e)}function N(t,e,n){return void 0===t?n:t<0?Math.max(0,e+t):void 0===e?t:Math.min(e,t)}var A=0,I=1,B=2,L="function"==typeof Symbol&&Symbol.iterator,R="@@iterator",F=L||R;function z(t){this.next=t}function P(t,e,n,r){var o=0===t?e:1===t?n:[e,n];return r?r.value=o:r={value:o,done:!1},r}function j(){return{value:void 0,done:!0}}function U(t){return!!V(t)}function H(t){return t&&"function"==typeof t.next}function q(t){var e=V(t);return e&&e.call(t)}function V(t){var e=t&&(L&&t[L]||t[R]);if("function"==typeof e)return e}function W(t){return t&&"number"==typeof t.length}function J(t){return null==t?at():a(t)?t.toSeq():ct(t)}function G(t){return null==t?at().toKeyedSeq():a(t)?s(t)?t.toSeq():t.fromEntrySeq():st(t)}function X(t){return null==t?at():a(t)?s(t)?t.entrySeq():t.toIndexedSeq():ut(t)}function $(t){return(null==t?at():a(t)?s(t)?t.entrySeq():t:ut(t)).toSetSeq()}z.prototype.toString=function(){return"[Iterator]"},z.KEYS=A,z.VALUES=I,z.ENTRIES=B,z.prototype.inspect=z.prototype.toSource=function(){return this.toString()},z.prototype[F]=function(){return this},e(J,n),J.of=function(){return J(arguments)},J.prototype.toSeq=function(){return this},J.prototype.toString=function(){return this.__toString("Seq {","}")},J.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},J.prototype.__iterate=function(t,e){return ft(this,t,e,!0)},J.prototype.__iterator=function(t,e){return pt(this,t,e,!0)},e(G,J),G.prototype.toKeyedSeq=function(){return this},e(X,J),X.of=function(){return X(arguments)},X.prototype.toIndexedSeq=function(){return this},X.prototype.toString=function(){return this.__toString("Seq [","]")},X.prototype.__iterate=function(t,e){return ft(this,t,e,!1)},X.prototype.__iterator=function(t,e){return pt(this,t,e,!1)},e($,J),$.of=function(){return $(arguments)},$.prototype.toSetSeq=function(){return this},J.isSeq=it,J.Keyed=G,J.Set=$,J.Indexed=X;var Y,Z,Q,tt="@@__IMMUTABLE_SEQ__@@";function et(t){this._array=t,this.size=t.length}function nt(t){var e=Object.keys(t);this._object=t,this._keys=e,this.size=e.length}function rt(t){this._iterable=t,this.size=t.length||t.size}function ot(t){this._iterator=t,this._iteratorCache=[]}function it(t){return!(!t||!t[tt])}function at(){return Y||(Y=new et([]))}function st(t){var e=Array.isArray(t)?new et(t).fromEntrySeq():H(t)?new ot(t).fromEntrySeq():U(t)?new rt(t).fromEntrySeq():"object"==typeof t?new nt(t):void 0;if(!e)throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+t);return e}function ut(t){var e=lt(t);if(!e)throw new TypeError("Expected Array or iterable object of values: "+t);return e}function ct(t){var e=lt(t)||"object"==typeof t&&new nt(t);if(!e)throw new TypeError("Expected Array or iterable object of values, or keyed object: "+t);return e}function lt(t){return W(t)?new et(t):H(t)?new ot(t):U(t)?new rt(t):void 0}function ft(t,e,n,r){var o=t._cache;if(o){for(var i=o.length-1,a=0;a<=i;a++){var s=o[n?i-a:a];if(!1===e(s[1],r?s[0]:a,t))return a+1}return a}return t.__iterateUncached(e,n)}function pt(t,e,n,r){var o=t._cache;if(o){var i=o.length-1,a=0;return new z((function(){var t=o[n?i-a:a];return a++>i?j():P(e,r?t[0]:a-1,t[1])}))}return t.__iteratorUncached(e,n)}function dt(t,e){return e?ht(e,t,"",{"":t}):gt(t)}function ht(t,e,n,r){return Array.isArray(e)?t.call(r,n,X(e).map((function(n,r){return ht(t,n,r,e)}))):yt(e)?t.call(r,n,G(e).map((function(n,r){return ht(t,n,r,e)}))):e}function gt(t){return Array.isArray(t)?X(t).map(gt).toList():yt(t)?G(t).map(gt).toMap():t}function yt(t){return t&&(t.constructor===Object||void 0===t.constructor)}function vt(t,e){if(t===e||t!=t&&e!=e)return!0;if(!t||!e)return!1;if("function"==typeof t.valueOf&&"function"==typeof e.valueOf){if((t=t.valueOf())===(e=e.valueOf())||t!=t&&e!=e)return!0;if(!t||!e)return!1}return!("function"!=typeof t.equals||"function"!=typeof e.equals||!t.equals(e))}function mt(t,e){if(t===e)return!0;if(!a(e)||void 0!==t.size&&void 0!==e.size&&t.size!==e.size||void 0!==t.__hash&&void 0!==e.__hash&&t.__hash!==e.__hash||s(t)!==s(e)||u(t)!==u(e)||l(t)!==l(e))return!1;if(0===t.size&&0===e.size)return!0;var n=!c(t);if(l(t)){var r=t.entries();return e.every((function(t,e){var o=r.next().value;return o&&vt(o[1],t)&&(n||vt(o[0],e))}))&&r.next().done}var o=!1;if(void 0===t.size)if(void 0===e.size)"function"==typeof t.cacheResult&&t.cacheResult();else{o=!0;var i=t;t=e,e=i}var f=!0,p=e.__iterate((function(e,r){if(n?!t.has(e):o?!vt(e,t.get(r,b)):!vt(t.get(r,b),e))return f=!1,!1}));return f&&t.size===p}function bt(t,e){if(!(this instanceof bt))return new bt(t,e);if(this._value=t,this.size=void 0===e?1/0:Math.max(0,e),0===this.size){if(Z)return Z;Z=this}}function wt(t,e){if(!t)throw new Error(e)}function _t(t,e,n){if(!(this instanceof _t))return new _t(t,e,n);if(wt(0!==n,"Cannot step a Range by 0"),t=t||0,void 0===e&&(e=1/0),n=void 0===n?1:Math.abs(n),e<t&&(n=-n),this._start=t,this._end=e,this._step=n,this.size=Math.max(0,Math.ceil((e-t)/n-1)+1),0===this.size){if(Q)return Q;Q=this}}function St(){throw TypeError("Abstract")}function kt(){}function Et(){}function xt(){}J.prototype[tt]=!0,e(et,X),et.prototype.get=function(t,e){return this.has(t)?this._array[D(this,t)]:e},et.prototype.__iterate=function(t,e){for(var n=this._array,r=n.length-1,o=0;o<=r;o++)if(!1===t(n[e?r-o:o],o,this))return o+1;return o},et.prototype.__iterator=function(t,e){var n=this._array,r=n.length-1,o=0;return new z((function(){return o>r?j():P(t,o,n[e?r-o++:o++])}))},e(nt,G),nt.prototype.get=function(t,e){return void 0===e||this.has(t)?this._object[t]:e},nt.prototype.has=function(t){return this._object.hasOwnProperty(t)},nt.prototype.__iterate=function(t,e){for(var n=this._object,r=this._keys,o=r.length-1,i=0;i<=o;i++){var a=r[e?o-i:i];if(!1===t(n[a],a,this))return i+1}return i},nt.prototype.__iterator=function(t,e){var n=this._object,r=this._keys,o=r.length-1,i=0;return new z((function(){var a=r[e?o-i:i];return i++>o?j():P(t,a,n[a])}))},nt.prototype[h]=!0,e(rt,X),rt.prototype.__iterateUncached=function(t,e){if(e)return this.cacheResult().__iterate(t,e);var n=q(this._iterable),r=0;if(H(n))for(var o;!(o=n.next()).done&&!1!==t(o.value,r++,this););return r},rt.prototype.__iteratorUncached=function(t,e){if(e)return this.cacheResult().__iterator(t,e);var n=q(this._iterable);if(!H(n))return new z(j);var r=0;return new z((function(){var e=n.next();return e.done?e:P(t,r++,e.value)}))},e(ot,X),ot.prototype.__iterateUncached=function(t,e){if(e)return this.cacheResult().__iterate(t,e);for(var n,r=this._iterator,o=this._iteratorCache,i=0;i<o.length;)if(!1===t(o[i],i++,this))return i;for(;!(n=r.next()).done;){var a=n.value;if(o[i]=a,!1===t(a,i++,this))break}return i},ot.prototype.__iteratorUncached=function(t,e){if(e)return this.cacheResult().__iterator(t,e);var n=this._iterator,r=this._iteratorCache,o=0;return new z((function(){if(o>=r.length){var e=n.next();if(e.done)return e;r[o]=e.value}return P(t,o,r[o++])}))},e(bt,X),bt.prototype.toString=function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},bt.prototype.get=function(t,e){return this.has(t)?this._value:e},bt.prototype.includes=function(t){return vt(this._value,t)},bt.prototype.slice=function(t,e){var n=this.size;return T(t,e,n)?this:new bt(this._value,K(e,n)-M(t,n))},bt.prototype.reverse=function(){return this},bt.prototype.indexOf=function(t){return vt(this._value,t)?0:-1},bt.prototype.lastIndexOf=function(t){return vt(this._value,t)?this.size:-1},bt.prototype.__iterate=function(t,e){for(var n=0;n<this.size;n++)if(!1===t(this._value,n,this))return n+1;return n},bt.prototype.__iterator=function(t,e){var n=this,r=0;return new z((function(){return r<n.size?P(t,r++,n._value):j()}))},bt.prototype.equals=function(t){return t instanceof bt?vt(this._value,t._value):mt(t)},e(_t,X),_t.prototype.toString=function(){return 0===this.size?"Range []":"Range [ "+this._start+"..."+this._end+(this._step>1?" by "+this._step:"")+" ]"},_t.prototype.get=function(t,e){return this.has(t)?this._start+D(this,t)*this._step:e},_t.prototype.includes=function(t){var e=(t-this._start)/this._step;return e>=0&&e<this.size&&e===Math.floor(e)},_t.prototype.slice=function(t,e){return T(t,e,this.size)?this:(t=M(t,this.size),(e=K(e,this.size))<=t?new _t(0,0):new _t(this.get(t,this._end),this.get(e,this._end),this._step))},_t.prototype.indexOf=function(t){var e=t-this._start;if(e%this._step==0){var n=e/this._step;if(n>=0&&n<this.size)return n}return-1},_t.prototype.lastIndexOf=function(t){return this.indexOf(t)},_t.prototype.__iterate=function(t,e){for(var n=this.size-1,r=this._step,o=e?this._start+n*r:this._start,i=0;i<=n;i++){if(!1===t(o,i,this))return i+1;o+=e?-r:r}return i},_t.prototype.__iterator=function(t,e){var n=this.size-1,r=this._step,o=e?this._start+n*r:this._start,i=0;return new z((function(){var a=o;return o+=e?-r:r,i>n?j():P(t,i++,a)}))},_t.prototype.equals=function(t){return t instanceof _t?this._start===t._start&&this._end===t._end&&this._step===t._step:mt(this,t)},e(St,n),e(kt,St),e(Et,St),e(xt,St),St.Keyed=kt,St.Indexed=Et,St.Set=xt;var Ct="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(t,e){var n=65535&(t|=0),r=65535&(e|=0);return n*r+((t>>>16)*r+n*(e>>>16)<<16>>>0)|0};function Dt(t){return t>>>1&1073741824|3221225471&t}function Ot(t){if(!1===t||null==t)return 0;if("function"==typeof t.valueOf&&(!1===(t=t.valueOf())||null==t))return 0;if(!0===t)return 1;var e=typeof t;if("number"===e){var n=0|t;for(n!==t&&(n^=4294967295*t);t>4294967295;)n^=t/=4294967295;return Dt(n)}if("string"===e)return t.length>zt?Tt(t):Mt(t);if("function"==typeof t.hashCode)return t.hashCode();if("object"===e)return Kt(t);if("function"==typeof t.toString)return Mt(t.toString());throw new Error("Value type "+e+" cannot be hashed.")}function Tt(t){var e=Ut[t];return void 0===e&&(e=Mt(t),jt===Pt&&(jt=0,Ut={}),jt++,Ut[t]=e),e}function Mt(t){for(var e=0,n=0;n<t.length;n++)e=31*e+t.charCodeAt(n)|0;return Dt(e)}function Kt(t){var e;if(Lt&&void 0!==(e=Bt.get(t)))return e;if(void 0!==(e=t[Ft]))return e;if(!At){if(void 0!==(e=t.propertyIsEnumerable&&t.propertyIsEnumerable[Ft]))return e;if(void 0!==(e=It(t)))return e}if(e=++Rt,1073741824&Rt&&(Rt=0),Lt)Bt.set(t,e);else{if(void 0!==Nt&&!1===Nt(t))throw new Error("Non-extensible objects are not allowed as keys.");if(At)Object.defineProperty(t,Ft,{enumerable:!1,configurable:!1,writable:!1,value:e});else if(void 0!==t.propertyIsEnumerable&&t.propertyIsEnumerable===t.constructor.prototype.propertyIsEnumerable)t.propertyIsEnumerable=function(){return this.constructor.prototype.propertyIsEnumerable.apply(this,arguments)},t.propertyIsEnumerable[Ft]=e;else{if(void 0===t.nodeType)throw new Error("Unable to set a non-enumerable property on object.");t[Ft]=e}}return e}var Nt=Object.isExtensible,At=function(){try{return Object.defineProperty({},"@",{}),!0}catch(t){return!1}}();function It(t){if(t&&t.nodeType>0)switch(t.nodeType){case 1:return t.uniqueID;case 9:return t.documentElement&&t.documentElement.uniqueID}}var Bt,Lt="function"==typeof WeakMap;Lt&&(Bt=new WeakMap);var Rt=0,Ft="__immutablehash__";"function"==typeof Symbol&&(Ft=Symbol(Ft));var zt=16,Pt=255,jt=0,Ut={};function Ht(t){wt(t!==1/0,"Cannot perform this action with an infinite size.")}function qt(t){return null==t?oe():Vt(t)&&!l(t)?t:oe().withMutations((function(e){var n=r(t);Ht(n.size),n.forEach((function(t,n){return e.set(n,t)}))}))}function Vt(t){return!(!t||!t[Jt])}e(qt,kt),qt.prototype.toString=function(){return this.__toString("Map {","}")},qt.prototype.get=function(t,e){return this._root?this._root.get(0,void 0,t,e):e},qt.prototype.set=function(t,e){return ie(this,t,e)},qt.prototype.setIn=function(t,e){return this.updateIn(t,b,(function(){return e}))},qt.prototype.remove=function(t){return ie(this,t,b)},qt.prototype.deleteIn=function(t){return this.updateIn(t,(function(){return b}))},qt.prototype.update=function(t,e,n){return 1===arguments.length?t(this):this.updateIn([t],e,n)},qt.prototype.updateIn=function(t,e,n){n||(n=e,e=void 0);var r=ye(this,Sn(t),e,n);return r===b?void 0:r},qt.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):oe()},qt.prototype.merge=function(){return pe(this,void 0,arguments)},qt.prototype.mergeWith=function(e){return pe(this,e,t.call(arguments,1))},qt.prototype.mergeIn=function(e){var n=t.call(arguments,1);return this.updateIn(e,oe(),(function(t){return"function"==typeof t.merge?t.merge.apply(t,n):n[n.length-1]}))},qt.prototype.mergeDeep=function(){return pe(this,de,arguments)},qt.prototype.mergeDeepWith=function(e){var n=t.call(arguments,1);return pe(this,he(e),n)},qt.prototype.mergeDeepIn=function(e){var n=t.call(arguments,1);return this.updateIn(e,oe(),(function(t){return"function"==typeof t.mergeDeep?t.mergeDeep.apply(t,n):n[n.length-1]}))},qt.prototype.sort=function(t){return Ue(fn(this,t))},qt.prototype.sortBy=function(t,e){return Ue(fn(this,e,t))},qt.prototype.withMutations=function(t){var e=this.asMutable();return t(e),e.wasAltered()?e.__ensureOwner(this.__ownerID):this},qt.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new E)},qt.prototype.asImmutable=function(){return this.__ensureOwner()},qt.prototype.wasAltered=function(){return this.__altered},qt.prototype.__iterator=function(t,e){return new te(this,t,e)},qt.prototype.__iterate=function(t,e){var n=this,r=0;return this._root&&this._root.iterate((function(e){return r++,t(e[1],e[0],n)}),e),r},qt.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?re(this.size,this._root,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)},qt.isMap=Vt;var Wt,Jt="@@__IMMUTABLE_MAP__@@",Gt=qt.prototype;function Xt(t,e){this.ownerID=t,this.entries=e}function $t(t,e,n){this.ownerID=t,this.bitmap=e,this.nodes=n}function Yt(t,e,n){this.ownerID=t,this.count=e,this.nodes=n}function Zt(t,e,n){this.ownerID=t,this.keyHash=e,this.entries=n}function Qt(t,e,n){this.ownerID=t,this.keyHash=e,this.entry=n}function te(t,e,n){this._type=e,this._reverse=n,this._stack=t._root&&ne(t._root)}function ee(t,e){return P(t,e[0],e[1])}function ne(t,e){return{node:t,index:0,__prev:e}}function re(t,e,n,r){var o=Object.create(Gt);return o.size=t,o._root=e,o.__ownerID=n,o.__hash=r,o.__altered=!1,o}function oe(){return Wt||(Wt=re(0))}function ie(t,e,n){var r,o;if(t._root){var i=S(w),a=S(_);if(r=ae(t._root,t.__ownerID,0,void 0,e,n,i,a),!a.value)return t;o=t.size+(i.value?n===b?-1:1:0)}else{if(n===b)return t;o=1,r=new Xt(t.__ownerID,[[e,n]])}return t.__ownerID?(t.size=o,t._root=r,t.__hash=void 0,t.__altered=!0,t):r?re(o,r):oe()}function ae(t,e,n,r,o,i,a,s){return t?t.update(e,n,r,o,i,a,s):i===b?t:(k(s),k(a),new Qt(e,r,[o,i]))}function se(t){return t.constructor===Qt||t.constructor===Zt}function ue(t,e,n,r,o){if(t.keyHash===r)return new Zt(e,r,[t.entry,o]);var i,a=(0===n?t.keyHash:t.keyHash>>>n)&m,s=(0===n?r:r>>>n)&m;return new $t(e,1<<a|1<<s,a===s?[ue(t,e,n+y,r,o)]:(i=new Qt(e,r,o),a<s?[t,i]:[i,t]))}function ce(t,e,n,r){t||(t=new E);for(var o=new Qt(t,Ot(n),[n,r]),i=0;i<e.length;i++){var a=e[i];o=o.update(t,0,void 0,a[0],a[1])}return o}function le(t,e,n,r){for(var o=0,i=0,a=new Array(n),s=0,u=1,c=e.length;s<c;s++,u<<=1){var l=e[s];void 0!==l&&s!==r&&(o|=u,a[i++]=l)}return new $t(t,o,a)}function fe(t,e,n,r,o){for(var i=0,a=new Array(v),s=0;0!==n;s++,n>>>=1)a[s]=1&n?e[i++]:void 0;return a[r]=o,new Yt(t,i+1,a)}function pe(t,e,n){for(var o=[],i=0;i<n.length;i++){var s=n[i],u=r(s);a(s)||(u=u.map((function(t){return dt(t)}))),o.push(u)}return ge(t,e,o)}function de(t,e,n){return t&&t.mergeDeep&&a(e)?t.mergeDeep(e):vt(t,e)?t:e}function he(t){return function(e,n,r){if(e&&e.mergeDeepWith&&a(n))return e.mergeDeepWith(t,n);var o=t(e,n,r);return vt(e,o)?e:o}}function ge(t,e,n){return 0===(n=n.filter((function(t){return 0!==t.size}))).length?t:0!==t.size||t.__ownerID||1!==n.length?t.withMutations((function(t){for(var r=e?function(n,r){t.update(r,b,(function(t){return t===b?n:e(t,n,r)}))}:function(e,n){t.set(n,e)},o=0;o<n.length;o++)n[o].forEach(r)})):t.constructor(n[0])}function ye(t,e,n,r){var o=t===b,i=e.next();if(i.done){var a=o?n:t,s=r(a);return s===a?t:s}wt(o||t&&t.set,"invalid keyPath");var u=i.value,c=o?b:t.get(u,b),l=ye(c,e,n,r);return l===c?t:l===b?t.remove(u):(o?oe():t).set(u,l)}function ve(t){return t=(t=(858993459&(t-=t>>1&1431655765))+(t>>2&858993459))+(t>>4)&252645135,t+=t>>8,127&(t+=t>>16)}function me(t,e,n,r){var o=r?t:x(t);return o[e]=n,o}function be(t,e,n,r){var o=t.length+1;if(r&&e+1===o)return t[e]=n,t;for(var i=new Array(o),a=0,s=0;s<o;s++)s===e?(i[s]=n,a=-1):i[s]=t[s+a];return i}function we(t,e,n){var r=t.length-1;if(n&&e===r)return t.pop(),t;for(var o=new Array(r),i=0,a=0;a<r;a++)a===e&&(i=1),o[a]=t[a+i];return o}Gt[Jt]=!0,Gt[g]=Gt.remove,Gt.removeIn=Gt.deleteIn,Xt.prototype.get=function(t,e,n,r){for(var o=this.entries,i=0,a=o.length;i<a;i++)if(vt(n,o[i][0]))return o[i][1];return r},Xt.prototype.update=function(t,e,n,r,o,i,a){for(var s=o===b,u=this.entries,c=0,l=u.length;c<l&&!vt(r,u[c][0]);c++);var f=c<l;if(f?u[c][1]===o:s)return this;if(k(a),(s||!f)&&k(i),!s||1!==u.length){if(!f&&!s&&u.length>=_e)return ce(t,u,r,o);var p=t&&t===this.ownerID,d=p?u:x(u);return f?s?c===l-1?d.pop():d[c]=d.pop():d[c]=[r,o]:d.push([r,o]),p?(this.entries=d,this):new Xt(t,d)}},$t.prototype.get=function(t,e,n,r){void 0===e&&(e=Ot(n));var o=1<<((0===t?e:e>>>t)&m),i=this.bitmap;return i&o?this.nodes[ve(i&o-1)].get(t+y,e,n,r):r},$t.prototype.update=function(t,e,n,r,o,i,a){void 0===n&&(n=Ot(r));var s=(0===e?n:n>>>e)&m,u=1<<s,c=this.bitmap,l=!!(c&u);if(!l&&o===b)return this;var f=ve(c&u-1),p=this.nodes,d=l?p[f]:void 0,h=ae(d,t,e+y,n,r,o,i,a);if(h===d)return this;if(!l&&h&&p.length>=Se)return fe(t,p,c,s,h);if(l&&!h&&2===p.length&&se(p[1^f]))return p[1^f];if(l&&h&&1===p.length&&se(h))return h;var g=t&&t===this.ownerID,v=l?h?c:c^u:c|u,w=l?h?me(p,f,h,g):we(p,f,g):be(p,f,h,g);return g?(this.bitmap=v,this.nodes=w,this):new $t(t,v,w)},Yt.prototype.get=function(t,e,n,r){void 0===e&&(e=Ot(n));var o=(0===t?e:e>>>t)&m,i=this.nodes[o];return i?i.get(t+y,e,n,r):r},Yt.prototype.update=function(t,e,n,r,o,i,a){void 0===n&&(n=Ot(r));var s=(0===e?n:n>>>e)&m,u=o===b,c=this.nodes,l=c[s];if(u&&!l)return this;var f=ae(l,t,e+y,n,r,o,i,a);if(f===l)return this;var p=this.count;if(l){if(!f&&--p<ke)return le(t,c,p,s)}else p++;var d=t&&t===this.ownerID,h=me(c,s,f,d);return d?(this.count=p,this.nodes=h,this):new Yt(t,p,h)},Zt.prototype.get=function(t,e,n,r){for(var o=this.entries,i=0,a=o.length;i<a;i++)if(vt(n,o[i][0]))return o[i][1];return r},Zt.prototype.update=function(t,e,n,r,o,i,a){void 0===n&&(n=Ot(r));var s=o===b;if(n!==this.keyHash)return s?this:(k(a),k(i),ue(this,t,e,n,[r,o]));for(var u=this.entries,c=0,l=u.length;c<l&&!vt(r,u[c][0]);c++);var f=c<l;if(f?u[c][1]===o:s)return this;if(k(a),(s||!f)&&k(i),s&&2===l)return new Qt(t,this.keyHash,u[1^c]);var p=t&&t===this.ownerID,d=p?u:x(u);return f?s?c===l-1?d.pop():d[c]=d.pop():d[c]=[r,o]:d.push([r,o]),p?(this.entries=d,this):new Zt(t,this.keyHash,d)},Qt.prototype.get=function(t,e,n,r){return vt(n,this.entry[0])?this.entry[1]:r},Qt.prototype.update=function(t,e,n,r,o,i,a){var s=o===b,u=vt(r,this.entry[0]);return(u?o===this.entry[1]:s)?this:(k(a),s?void k(i):u?t&&t===this.ownerID?(this.entry[1]=o,this):new Qt(t,this.keyHash,[r,o]):(k(i),ue(this,t,e,Ot(r),[r,o])))},Xt.prototype.iterate=Zt.prototype.iterate=function(t,e){for(var n=this.entries,r=0,o=n.length-1;r<=o;r++)if(!1===t(n[e?o-r:r]))return!1},$t.prototype.iterate=Yt.prototype.iterate=function(t,e){for(var n=this.nodes,r=0,o=n.length-1;r<=o;r++){var i=n[e?o-r:r];if(i&&!1===i.iterate(t,e))return!1}},Qt.prototype.iterate=function(t,e){return t(this.entry)},e(te,z),te.prototype.next=function(){for(var t=this._type,e=this._stack;e;){var n,r=e.node,o=e.index++;if(r.entry){if(0===o)return ee(t,r.entry)}else if(r.entries){if(o<=(n=r.entries.length-1))return ee(t,r.entries[this._reverse?n-o:o])}else if(o<=(n=r.nodes.length-1)){var i=r.nodes[this._reverse?n-o:o];if(i){if(i.entry)return ee(t,i.entry);e=this._stack=ne(i,e)}continue}e=this._stack=this._stack.__prev}return j()};var _e=v/4,Se=v/2,ke=v/4;function Ee(t){var e=Ie();if(null==t)return e;if(xe(t))return t;var n=o(t),r=n.size;return 0===r?e:(Ht(r),r>0&&r<v?Ae(0,r,y,null,new Oe(n.toArray())):e.withMutations((function(t){t.setSize(r),n.forEach((function(e,n){return t.set(n,e)}))})))}function xe(t){return!(!t||!t[Ce])}e(Ee,Et),Ee.of=function(){return this(arguments)},Ee.prototype.toString=function(){return this.__toString("List [","]")},Ee.prototype.get=function(t,e){if((t=D(this,t))>=0&&t<this.size){var n=Fe(this,t+=this._origin);return n&&n.array[t&m]}return e},Ee.prototype.set=function(t,e){return Be(this,t,e)},Ee.prototype.remove=function(t){return this.has(t)?0===t?this.shift():t===this.size-1?this.pop():this.splice(t,1):this},Ee.prototype.insert=function(t,e){return this.splice(t,0,e)},Ee.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=y,this._root=this._tail=null,this.__hash=void 0,this.__altered=!0,this):Ie()},Ee.prototype.push=function(){var t=arguments,e=this.size;return this.withMutations((function(n){ze(n,0,e+t.length);for(var r=0;r<t.length;r++)n.set(e+r,t[r])}))},Ee.prototype.pop=function(){return ze(this,0,-1)},Ee.prototype.unshift=function(){var t=arguments;return this.withMutations((function(e){ze(e,-t.length);for(var n=0;n<t.length;n++)e.set(n,t[n])}))},Ee.prototype.shift=function(){return ze(this,1)},Ee.prototype.merge=function(){return Pe(this,void 0,arguments)},Ee.prototype.mergeWith=function(e){return Pe(this,e,t.call(arguments,1))},Ee.prototype.mergeDeep=function(){return Pe(this,de,arguments)},Ee.prototype.mergeDeepWith=function(e){var n=t.call(arguments,1);return Pe(this,he(e),n)},Ee.prototype.setSize=function(t){return ze(this,0,t)},Ee.prototype.slice=function(t,e){var n=this.size;return T(t,e,n)?this:ze(this,M(t,n),K(e,n))},Ee.prototype.__iterator=function(t,e){var n=0,r=Ne(this,e);return new z((function(){var e=r();return e===Ke?j():P(t,n++,e)}))},Ee.prototype.__iterate=function(t,e){for(var n,r=0,o=Ne(this,e);(n=o())!==Ke&&!1!==t(n,r++,this););return r},Ee.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?Ae(this._origin,this._capacity,this._level,this._root,this._tail,t,this.__hash):(this.__ownerID=t,this)},Ee.isList=xe;var Ce="@@__IMMUTABLE_LIST__@@",De=Ee.prototype;function Oe(t,e){this.array=t,this.ownerID=e}De[Ce]=!0,De[g]=De.remove,De.setIn=Gt.setIn,De.deleteIn=De.removeIn=Gt.removeIn,De.update=Gt.update,De.updateIn=Gt.updateIn,De.mergeIn=Gt.mergeIn,De.mergeDeepIn=Gt.mergeDeepIn,De.withMutations=Gt.withMutations,De.asMutable=Gt.asMutable,De.asImmutable=Gt.asImmutable,De.wasAltered=Gt.wasAltered,Oe.prototype.removeBefore=function(t,e,n){if(n===e?1<<e:0===this.array.length)return this;var r=n>>>e&m;if(r>=this.array.length)return new Oe([],t);var o,i=0===r;if(e>0){var a=this.array[r];if((o=a&&a.removeBefore(t,e-y,n))===a&&i)return this}if(i&&!o)return this;var s=Re(this,t);if(!i)for(var u=0;u<r;u++)s.array[u]=void 0;return o&&(s.array[r]=o),s},Oe.prototype.removeAfter=function(t,e,n){if(n===(e?1<<e:0)||0===this.array.length)return this;var r,o=n-1>>>e&m;if(o>=this.array.length)return this;if(e>0){var i=this.array[o];if((r=i&&i.removeAfter(t,e-y,n))===i&&o===this.array.length-1)return this}var a=Re(this,t);return a.array.splice(o+1),r&&(a.array[o]=r),a};var Te,Me,Ke={};function Ne(t,e){var n=t._origin,r=t._capacity,o=je(r),i=t._tail;return a(t._root,t._level,0);function a(t,e,n){return 0===e?s(t,n):u(t,e,n)}function s(t,a){var s=a===o?i&&i.array:t&&t.array,u=a>n?0:n-a,c=r-a;return c>v&&(c=v),function(){if(u===c)return Ke;var t=e?--c:u++;return s&&s[t]}}function u(t,o,i){var s,u=t&&t.array,c=i>n?0:n-i>>o,l=1+(r-i>>o);return l>v&&(l=v),function(){for(;;){if(s){var t=s();if(t!==Ke)return t;s=null}if(c===l)return Ke;var n=e?--l:c++;s=a(u&&u[n],o-y,i+(n<<o))}}}}function Ae(t,e,n,r,o,i,a){var s=Object.create(De);return s.size=e-t,s._origin=t,s._capacity=e,s._level=n,s._root=r,s._tail=o,s.__ownerID=i,s.__hash=a,s.__altered=!1,s}function Ie(){return Te||(Te=Ae(0,0,y))}function Be(t,e,n){if((e=D(t,e))!=e)return t;if(e>=t.size||e<0)return t.withMutations((function(t){e<0?ze(t,e).set(0,n):ze(t,0,e+1).set(e,n)}));e+=t._origin;var r=t._tail,o=t._root,i=S(_);return e>=je(t._capacity)?r=Le(r,t.__ownerID,0,e,n,i):o=Le(o,t.__ownerID,t._level,e,n,i),i.value?t.__ownerID?(t._root=o,t._tail=r,t.__hash=void 0,t.__altered=!0,t):Ae(t._origin,t._capacity,t._level,o,r):t}function Le(t,e,n,r,o,i){var a,s=r>>>n&m,u=t&&s<t.array.length;if(!u&&void 0===o)return t;if(n>0){var c=t&&t.array[s],l=Le(c,e,n-y,r,o,i);return l===c?t:((a=Re(t,e)).array[s]=l,a)}return u&&t.array[s]===o?t:(k(i),a=Re(t,e),void 0===o&&s===a.array.length-1?a.array.pop():a.array[s]=o,a)}function Re(t,e){return e&&t&&e===t.ownerID?t:new Oe(t?t.array.slice():[],e)}function Fe(t,e){if(e>=je(t._capacity))return t._tail;if(e<1<<t._level+y){for(var n=t._root,r=t._level;n&&r>0;)n=n.array[e>>>r&m],r-=y;return n}}function ze(t,e,n){void 0!==e&&(e|=0),void 0!==n&&(n|=0);var r=t.__ownerID||new E,o=t._origin,i=t._capacity,a=o+e,s=void 0===n?i:n<0?i+n:o+n;if(a===o&&s===i)return t;if(a>=s)return t.clear();for(var u=t._level,c=t._root,l=0;a+l<0;)c=new Oe(c&&c.array.length?[void 0,c]:[],r),l+=1<<(u+=y);l&&(a+=l,o+=l,s+=l,i+=l);for(var f=je(i),p=je(s);p>=1<<u+y;)c=new Oe(c&&c.array.length?[c]:[],r),u+=y;var d=t._tail,h=p<f?Fe(t,s-1):p>f?new Oe([],r):d;if(d&&p>f&&a<i&&d.array.length){for(var g=c=Re(c,r),v=u;v>y;v-=y){var b=f>>>v&m;g=g.array[b]=Re(g.array[b],r)}g.array[f>>>y&m]=d}if(s<i&&(h=h&&h.removeAfter(r,0,s)),a>=p)a-=p,s-=p,u=y,c=null,h=h&&h.removeBefore(r,0,a);else if(a>o||p<f){for(l=0;c;){var w=a>>>u&m;if(w!==p>>>u&m)break;w&&(l+=(1<<u)*w),u-=y,c=c.array[w]}c&&a>o&&(c=c.removeBefore(r,u,a-l)),c&&p<f&&(c=c.removeAfter(r,u,p-l)),l&&(a-=l,s-=l)}return t.__ownerID?(t.size=s-a,t._origin=a,t._capacity=s,t._level=u,t._root=c,t._tail=h,t.__hash=void 0,t.__altered=!0,t):Ae(a,s,u,c,h)}function Pe(t,e,n){for(var r=[],i=0,s=0;s<n.length;s++){var u=n[s],c=o(u);c.size>i&&(i=c.size),a(u)||(c=c.map((function(t){return dt(t)}))),r.push(c)}return i>t.size&&(t=t.setSize(i)),ge(t,e,r)}function je(t){return t<v?0:t-1>>>y<<y}function Ue(t){return null==t?Ve():He(t)?t:Ve().withMutations((function(e){var n=r(t);Ht(n.size),n.forEach((function(t,n){return e.set(n,t)}))}))}function He(t){return Vt(t)&&l(t)}function qe(t,e,n,r){var o=Object.create(Ue.prototype);return o.size=t?t.size:0,o._map=t,o._list=e,o.__ownerID=n,o.__hash=r,o}function Ve(){return Me||(Me=qe(oe(),Ie()))}function We(t,e,n){var r,o,i=t._map,a=t._list,s=i.get(e),u=void 0!==s;if(n===b){if(!u)return t;a.size>=v&&a.size>=2*i.size?(r=(o=a.filter((function(t,e){return void 0!==t&&s!==e}))).toKeyedSeq().map((function(t){return t[0]})).flip().toMap(),t.__ownerID&&(r.__ownerID=o.__ownerID=t.__ownerID)):(r=i.remove(e),o=s===a.size-1?a.pop():a.set(s,void 0))}else if(u){if(n===a.get(s)[1])return t;r=i,o=a.set(s,[e,n])}else r=i.set(e,a.size),o=a.set(a.size,[e,n]);return t.__ownerID?(t.size=r.size,t._map=r,t._list=o,t.__hash=void 0,t):qe(r,o)}function Je(t,e){this._iter=t,this._useKeys=e,this.size=t.size}function Ge(t){this._iter=t,this.size=t.size}function Xe(t){this._iter=t,this.size=t.size}function $e(t){this._iter=t,this.size=t.size}function Ye(t){var e=bn(t);return e._iter=t,e.size=t.size,e.flip=function(){return t},e.reverse=function(){var e=t.reverse.apply(this);return e.flip=function(){return t.reverse()},e},e.has=function(e){return t.includes(e)},e.includes=function(e){return t.has(e)},e.cacheResult=wn,e.__iterateUncached=function(e,n){var r=this;return t.__iterate((function(t,n){return!1!==e(n,t,r)}),n)},e.__iteratorUncached=function(e,n){if(e===B){var r=t.__iterator(e,n);return new z((function(){var t=r.next();if(!t.done){var e=t.value[0];t.value[0]=t.value[1],t.value[1]=e}return t}))}return t.__iterator(e===I?A:I,n)},e}function Ze(t,e,n){var r=bn(t);return r.size=t.size,r.has=function(e){return t.has(e)},r.get=function(r,o){var i=t.get(r,b);return i===b?o:e.call(n,i,r,t)},r.__iterateUncached=function(r,o){var i=this;return t.__iterate((function(t,o,a){return!1!==r(e.call(n,t,o,a),o,i)}),o)},r.__iteratorUncached=function(r,o){var i=t.__iterator(B,o);return new z((function(){var o=i.next();if(o.done)return o;var a=o.value,s=a[0];return P(r,s,e.call(n,a[1],s,t),o)}))},r}function Qe(t,e){var n=bn(t);return n._iter=t,n.size=t.size,n.reverse=function(){return t},t.flip&&(n.flip=function(){var e=Ye(t);return e.reverse=function(){return t.flip()},e}),n.get=function(n,r){return t.get(e?n:-1-n,r)},n.has=function(n){return t.has(e?n:-1-n)},n.includes=function(e){return t.includes(e)},n.cacheResult=wn,n.__iterate=function(e,n){var r=this;return t.__iterate((function(t,n){return e(t,n,r)}),!n)},n.__iterator=function(e,n){return t.__iterator(e,!n)},n}function tn(t,e,n,r){var o=bn(t);return r&&(o.has=function(r){var o=t.get(r,b);return o!==b&&!!e.call(n,o,r,t)},o.get=function(r,o){var i=t.get(r,b);return i!==b&&e.call(n,i,r,t)?i:o}),o.__iterateUncached=function(o,i){var a=this,s=0;return t.__iterate((function(t,i,u){if(e.call(n,t,i,u))return s++,o(t,r?i:s-1,a)}),i),s},o.__iteratorUncached=function(o,i){var a=t.__iterator(B,i),s=0;return new z((function(){for(;;){var i=a.next();if(i.done)return i;var u=i.value,c=u[0],l=u[1];if(e.call(n,l,c,t))return P(o,r?c:s++,l,i)}}))},o}function en(t,e,n){var r=qt().asMutable();return t.__iterate((function(o,i){r.update(e.call(n,o,i,t),0,(function(t){return t+1}))})),r.asImmutable()}function nn(t,e,n){var r=s(t),o=(l(t)?Ue():qt()).asMutable();t.__iterate((function(i,a){o.update(e.call(n,i,a,t),(function(t){return(t=t||[]).push(r?[a,i]:i),t}))}));var i=mn(t);return o.map((function(e){return gn(t,i(e))}))}function rn(t,e,n,r){var o=t.size;if(void 0!==e&&(e|=0),void 0!==n&&(n|=0),T(e,n,o))return t;var i=M(e,o),a=K(n,o);if(i!=i||a!=a)return rn(t.toSeq().cacheResult(),e,n,r);var s,u=a-i;u==u&&(s=u<0?0:u);var c=bn(t);return c.size=0===s?s:t.size&&s||void 0,!r&&it(t)&&s>=0&&(c.get=function(e,n){return(e=D(this,e))>=0&&e<s?t.get(e+i,n):n}),c.__iterateUncached=function(e,n){var o=this;if(0===s)return 0;if(n)return this.cacheResult().__iterate(e,n);var a=0,u=!0,c=0;return t.__iterate((function(t,n){if(!u||!(u=a++<i))return c++,!1!==e(t,r?n:c-1,o)&&c!==s})),c},c.__iteratorUncached=function(e,n){if(0!==s&&n)return this.cacheResult().__iterator(e,n);var o=0!==s&&t.__iterator(e,n),a=0,u=0;return new z((function(){for(;a++<i;)o.next();if(++u>s)return j();var t=o.next();return r||e===I?t:P(e,u-1,e===A?void 0:t.value[1],t)}))},c}function on(t,e,n){var r=bn(t);return r.__iterateUncached=function(r,o){var i=this;if(o)return this.cacheResult().__iterate(r,o);var a=0;return t.__iterate((function(t,o,s){return e.call(n,t,o,s)&&++a&&r(t,o,i)})),a},r.__iteratorUncached=function(r,o){var i=this;if(o)return this.cacheResult().__iterator(r,o);var a=t.__iterator(B,o),s=!0;return new z((function(){if(!s)return j();var t=a.next();if(t.done)return t;var o=t.value,u=o[0],c=o[1];return e.call(n,c,u,i)?r===B?t:P(r,u,c,t):(s=!1,j())}))},r}function an(t,e,n,r){var o=bn(t);return o.__iterateUncached=function(o,i){var a=this;if(i)return this.cacheResult().__iterate(o,i);var s=!0,u=0;return t.__iterate((function(t,i,c){if(!s||!(s=e.call(n,t,i,c)))return u++,o(t,r?i:u-1,a)})),u},o.__iteratorUncached=function(o,i){var a=this;if(i)return this.cacheResult().__iterator(o,i);var s=t.__iterator(B,i),u=!0,c=0;return new z((function(){var t,i,l;do{if((t=s.next()).done)return r||o===I?t:P(o,c++,o===A?void 0:t.value[1],t);var f=t.value;i=f[0],l=f[1],u&&(u=e.call(n,l,i,a))}while(u);return o===B?t:P(o,i,l,t)}))},o}function sn(t,e){var n=s(t),o=[t].concat(e).map((function(t){return a(t)?n&&(t=r(t)):t=n?st(t):ut(Array.isArray(t)?t:[t]),t})).filter((function(t){return 0!==t.size}));if(0===o.length)return t;if(1===o.length){var i=o[0];if(i===t||n&&s(i)||u(t)&&u(i))return i}var c=new et(o);return n?c=c.toKeyedSeq():u(t)||(c=c.toSetSeq()),(c=c.flatten(!0)).size=o.reduce((function(t,e){if(void 0!==t){var n=e.size;if(void 0!==n)return t+n}}),0),c}function un(t,e,n){var r=bn(t);return r.__iterateUncached=function(r,o){var i=0,s=!1;function u(t,c){var l=this;t.__iterate((function(t,o){return(!e||c<e)&&a(t)?u(t,c+1):!1===r(t,n?o:i++,l)&&(s=!0),!s}),o)}return u(t,0),i},r.__iteratorUncached=function(r,o){var i=t.__iterator(r,o),s=[],u=0;return new z((function(){for(;i;){var t=i.next();if(!1===t.done){var c=t.value;if(r===B&&(c=c[1]),e&&!(s.length<e)||!a(c))return n?t:P(r,u++,c,t);s.push(i),i=c.__iterator(r,o)}else i=s.pop()}return j()}))},r}function cn(t,e,n){var r=mn(t);return t.toSeq().map((function(o,i){return r(e.call(n,o,i,t))})).flatten(!0)}function ln(t,e){var n=bn(t);return n.size=t.size&&2*t.size-1,n.__iterateUncached=function(n,r){var o=this,i=0;return t.__iterate((function(t,r){return(!i||!1!==n(e,i++,o))&&!1!==n(t,i++,o)}),r),i},n.__iteratorUncached=function(n,r){var o,i=t.__iterator(I,r),a=0;return new z((function(){return(!o||a%2)&&(o=i.next()).done?o:a%2?P(n,a++,e):P(n,a++,o.value,o)}))},n}function fn(t,e,n){e||(e=_n);var r=s(t),o=0,i=t.toSeq().map((function(e,r){return[r,e,o++,n?n(e,r,t):e]})).toArray();return i.sort((function(t,n){return e(t[3],n[3])||t[2]-n[2]})).forEach(r?function(t,e){i[e].length=2}:function(t,e){i[e]=t[1]}),r?G(i):u(t)?X(i):$(i)}function pn(t,e,n){if(e||(e=_n),n){var r=t.toSeq().map((function(e,r){return[e,n(e,r,t)]})).reduce((function(t,n){return dn(e,t[1],n[1])?n:t}));return r&&r[0]}return t.reduce((function(t,n){return dn(e,t,n)?n:t}))}function dn(t,e,n){var r=t(n,e);return 0===r&&n!==e&&(null==n||n!=n)||r>0}function hn(t,e,r){var o=bn(t);return o.size=new et(r).map((function(t){return t.size})).min(),o.__iterate=function(t,e){for(var n,r=this.__iterator(I,e),o=0;!(n=r.next()).done&&!1!==t(n.value,o++,this););return o},o.__iteratorUncached=function(t,o){var i=r.map((function(t){return t=n(t),q(o?t.reverse():t)})),a=0,s=!1;return new z((function(){var n;return s||(n=i.map((function(t){return t.next()})),s=n.some((function(t){return t.done}))),s?j():P(t,a++,e.apply(null,n.map((function(t){return t.value}))))}))},o}function gn(t,e){return it(t)?e:t.constructor(e)}function yn(t){if(t!==Object(t))throw new TypeError("Expected [K, V] tuple: "+t)}function vn(t){return Ht(t.size),C(t)}function mn(t){return s(t)?r:u(t)?o:i}function bn(t){return Object.create((s(t)?G:u(t)?X:$).prototype)}function wn(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):J.prototype.cacheResult.call(this)}function _n(t,e){return t>e?1:t<e?-1:0}function Sn(t){var e=q(t);if(!e){if(!W(t))throw new TypeError("Expected iterable or array-like: "+t);e=q(n(t))}return e}function kn(t,e){var n,r=function(i){if(i instanceof r)return i;if(!(this instanceof r))return new r(i);if(!n){n=!0;var a=Object.keys(t);Dn(o,a),o.size=a.length,o._name=e,o._keys=a,o._defaultValues=t}this._map=qt(i)},o=r.prototype=Object.create(En);return o.constructor=r,r}e(Ue,qt),Ue.of=function(){return this(arguments)},Ue.prototype.toString=function(){return this.__toString("OrderedMap {","}")},Ue.prototype.get=function(t,e){var n=this._map.get(t);return void 0!==n?this._list.get(n)[1]:e},Ue.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this):Ve()},Ue.prototype.set=function(t,e){return We(this,t,e)},Ue.prototype.remove=function(t){return We(this,t,b)},Ue.prototype.wasAltered=function(){return this._map.wasAltered()||this._list.wasAltered()},Ue.prototype.__iterate=function(t,e){var n=this;return this._list.__iterate((function(e){return e&&t(e[1],e[0],n)}),e)},Ue.prototype.__iterator=function(t,e){return this._list.fromEntrySeq().__iterator(t,e)},Ue.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t),n=this._list.__ensureOwner(t);return t?qe(e,n,t,this.__hash):(this.__ownerID=t,this._map=e,this._list=n,this)},Ue.isOrderedMap=He,Ue.prototype[h]=!0,Ue.prototype[g]=Ue.prototype.remove,e(Je,G),Je.prototype.get=function(t,e){return this._iter.get(t,e)},Je.prototype.has=function(t){return this._iter.has(t)},Je.prototype.valueSeq=function(){return this._iter.valueSeq()},Je.prototype.reverse=function(){var t=this,e=Qe(this,!0);return this._useKeys||(e.valueSeq=function(){return t._iter.toSeq().reverse()}),e},Je.prototype.map=function(t,e){var n=this,r=Ze(this,t,e);return this._useKeys||(r.valueSeq=function(){return n._iter.toSeq().map(t,e)}),r},Je.prototype.__iterate=function(t,e){var n,r=this;return this._iter.__iterate(this._useKeys?function(e,n){return t(e,n,r)}:(n=e?vn(this):0,function(o){return t(o,e?--n:n++,r)}),e)},Je.prototype.__iterator=function(t,e){if(this._useKeys)return this._iter.__iterator(t,e);var n=this._iter.__iterator(I,e),r=e?vn(this):0;return new z((function(){var o=n.next();return o.done?o:P(t,e?--r:r++,o.value,o)}))},Je.prototype[h]=!0,e(Ge,X),Ge.prototype.includes=function(t){return this._iter.includes(t)},Ge.prototype.__iterate=function(t,e){var n=this,r=0;return this._iter.__iterate((function(e){return t(e,r++,n)}),e)},Ge.prototype.__iterator=function(t,e){var n=this._iter.__iterator(I,e),r=0;return new z((function(){var e=n.next();return e.done?e:P(t,r++,e.value,e)}))},e(Xe,$),Xe.prototype.has=function(t){return this._iter.includes(t)},Xe.prototype.__iterate=function(t,e){var n=this;return this._iter.__iterate((function(e){return t(e,e,n)}),e)},Xe.prototype.__iterator=function(t,e){var n=this._iter.__iterator(I,e);return new z((function(){var e=n.next();return e.done?e:P(t,e.value,e.value,e)}))},e($e,G),$e.prototype.entrySeq=function(){return this._iter.toSeq()},$e.prototype.__iterate=function(t,e){var n=this;return this._iter.__iterate((function(e){if(e){yn(e);var r=a(e);return t(r?e.get(1):e[1],r?e.get(0):e[0],n)}}),e)},$e.prototype.__iterator=function(t,e){var n=this._iter.__iterator(I,e);return new z((function(){for(;;){var e=n.next();if(e.done)return e;var r=e.value;if(r){yn(r);var o=a(r);return P(t,o?r.get(0):r[0],o?r.get(1):r[1],e)}}}))},Ge.prototype.cacheResult=Je.prototype.cacheResult=Xe.prototype.cacheResult=$e.prototype.cacheResult=wn,e(kn,kt),kn.prototype.toString=function(){return this.__toString(Cn(this)+" {","}")},kn.prototype.has=function(t){return this._defaultValues.hasOwnProperty(t)},kn.prototype.get=function(t,e){if(!this.has(t))return e;var n=this._defaultValues[t];return this._map?this._map.get(t,n):n},kn.prototype.clear=function(){if(this.__ownerID)return this._map&&this._map.clear(),this;var t=this.constructor;return t._empty||(t._empty=xn(this,oe()))},kn.prototype.set=function(t,e){if(!this.has(t))throw new Error('Cannot set unknown key "'+t+'" on '+Cn(this));var n=this._map&&this._map.set(t,e);return this.__ownerID||n===this._map?this:xn(this,n)},kn.prototype.remove=function(t){if(!this.has(t))return this;var e=this._map&&this._map.remove(t);return this.__ownerID||e===this._map?this:xn(this,e)},kn.prototype.wasAltered=function(){return this._map.wasAltered()},kn.prototype.__iterator=function(t,e){var n=this;return r(this._defaultValues).map((function(t,e){return n.get(e)})).__iterator(t,e)},kn.prototype.__iterate=function(t,e){var n=this;return r(this._defaultValues).map((function(t,e){return n.get(e)})).__iterate(t,e)},kn.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t);return t?xn(this,e,t):(this.__ownerID=t,this._map=e,this)};var En=kn.prototype;function xn(t,e,n){var r=Object.create(Object.getPrototypeOf(t));return r._map=e,r.__ownerID=n,r}function Cn(t){return t._name||t.constructor.name||"Record"}function Dn(t,e){try{e.forEach(On.bind(void 0,t))}catch(t){}}function On(t,e){Object.defineProperty(t,e,{get:function(){return this.get(e)},set:function(t){wt(this.__ownerID,"Cannot set on an immutable record."),this.set(e,t)}})}function Tn(t){return null==t?Ln():Mn(t)&&!l(t)?t:Ln().withMutations((function(e){var n=i(t);Ht(n.size),n.forEach((function(t){return e.add(t)}))}))}function Mn(t){return!(!t||!t[Nn])}En[g]=En.remove,En.deleteIn=En.removeIn=Gt.removeIn,En.merge=Gt.merge,En.mergeWith=Gt.mergeWith,En.mergeIn=Gt.mergeIn,En.mergeDeep=Gt.mergeDeep,En.mergeDeepWith=Gt.mergeDeepWith,En.mergeDeepIn=Gt.mergeDeepIn,En.setIn=Gt.setIn,En.update=Gt.update,En.updateIn=Gt.updateIn,En.withMutations=Gt.withMutations,En.asMutable=Gt.asMutable,En.asImmutable=Gt.asImmutable,e(Tn,xt),Tn.of=function(){return this(arguments)},Tn.fromKeys=function(t){return this(r(t).keySeq())},Tn.prototype.toString=function(){return this.__toString("Set {","}")},Tn.prototype.has=function(t){return this._map.has(t)},Tn.prototype.add=function(t){return In(this,this._map.set(t,!0))},Tn.prototype.remove=function(t){return In(this,this._map.remove(t))},Tn.prototype.clear=function(){return In(this,this._map.clear())},Tn.prototype.union=function(){var e=t.call(arguments,0);return 0===(e=e.filter((function(t){return 0!==t.size}))).length?this:0!==this.size||this.__ownerID||1!==e.length?this.withMutations((function(t){for(var n=0;n<e.length;n++)i(e[n]).forEach((function(e){return t.add(e)}))})):this.constructor(e[0])},Tn.prototype.intersect=function(){var e=t.call(arguments,0);if(0===e.length)return this;e=e.map((function(t){return i(t)}));var n=this;return this.withMutations((function(t){n.forEach((function(n){e.every((function(t){return t.includes(n)}))||t.remove(n)}))}))},Tn.prototype.subtract=function(){var e=t.call(arguments,0);if(0===e.length)return this;e=e.map((function(t){return i(t)}));var n=this;return this.withMutations((function(t){n.forEach((function(n){e.some((function(t){return t.includes(n)}))&&t.remove(n)}))}))},Tn.prototype.merge=function(){return this.union.apply(this,arguments)},Tn.prototype.mergeWith=function(e){var n=t.call(arguments,1);return this.union.apply(this,n)},Tn.prototype.sort=function(t){return Rn(fn(this,t))},Tn.prototype.sortBy=function(t,e){return Rn(fn(this,e,t))},Tn.prototype.wasAltered=function(){return this._map.wasAltered()},Tn.prototype.__iterate=function(t,e){var n=this;return this._map.__iterate((function(e,r){return t(r,r,n)}),e)},Tn.prototype.__iterator=function(t,e){return this._map.map((function(t,e){return e})).__iterator(t,e)},Tn.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t);return t?this.__make(e,t):(this.__ownerID=t,this._map=e,this)},Tn.isSet=Mn;var Kn,Nn="@@__IMMUTABLE_SET__@@",An=Tn.prototype;function In(t,e){return t.__ownerID?(t.size=e.size,t._map=e,t):e===t._map?t:0===e.size?t.__empty():t.__make(e)}function Bn(t,e){var n=Object.create(An);return n.size=t?t.size:0,n._map=t,n.__ownerID=e,n}function Ln(){return Kn||(Kn=Bn(oe()))}function Rn(t){return null==t?Un():Fn(t)?t:Un().withMutations((function(e){var n=i(t);Ht(n.size),n.forEach((function(t){return e.add(t)}))}))}function Fn(t){return Mn(t)&&l(t)}An[Nn]=!0,An[g]=An.remove,An.mergeDeep=An.merge,An.mergeDeepWith=An.mergeWith,An.withMutations=Gt.withMutations,An.asMutable=Gt.asMutable,An.asImmutable=Gt.asImmutable,An.__empty=Ln,An.__make=Bn,e(Rn,Tn),Rn.of=function(){return this(arguments)},Rn.fromKeys=function(t){return this(r(t).keySeq())},Rn.prototype.toString=function(){return this.__toString("OrderedSet {","}")},Rn.isOrderedSet=Fn;var zn,Pn=Rn.prototype;function jn(t,e){var n=Object.create(Pn);return n.size=t?t.size:0,n._map=t,n.__ownerID=e,n}function Un(){return zn||(zn=jn(Ve()))}function Hn(t){return null==t?Xn():qn(t)?t:Xn().unshiftAll(t)}function qn(t){return!(!t||!t[Wn])}Pn[h]=!0,Pn.__empty=Un,Pn.__make=jn,e(Hn,Et),Hn.of=function(){return this(arguments)},Hn.prototype.toString=function(){return this.__toString("Stack [","]")},Hn.prototype.get=function(t,e){var n=this._head;for(t=D(this,t);n&&t--;)n=n.next;return n?n.value:e},Hn.prototype.peek=function(){return this._head&&this._head.value},Hn.prototype.push=function(){if(0===arguments.length)return this;for(var t=this.size+arguments.length,e=this._head,n=arguments.length-1;n>=0;n--)e={value:arguments[n],next:e};return this.__ownerID?(this.size=t,this._head=e,this.__hash=void 0,this.__altered=!0,this):Gn(t,e)},Hn.prototype.pushAll=function(t){if(0===(t=o(t)).size)return this;Ht(t.size);var e=this.size,n=this._head;return t.reverse().forEach((function(t){e++,n={value:t,next:n}})),this.__ownerID?(this.size=e,this._head=n,this.__hash=void 0,this.__altered=!0,this):Gn(e,n)},Hn.prototype.pop=function(){return this.slice(1)},Hn.prototype.unshift=function(){return this.push.apply(this,arguments)},Hn.prototype.unshiftAll=function(t){return this.pushAll(t)},Hn.prototype.shift=function(){return this.pop.apply(this,arguments)},Hn.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):Xn()},Hn.prototype.slice=function(t,e){if(T(t,e,this.size))return this;var n=M(t,this.size);if(K(e,this.size)!==this.size)return Et.prototype.slice.call(this,t,e);for(var r=this.size-n,o=this._head;n--;)o=o.next;return this.__ownerID?(this.size=r,this._head=o,this.__hash=void 0,this.__altered=!0,this):Gn(r,o)},Hn.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?Gn(this.size,this._head,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)},Hn.prototype.__iterate=function(t,e){if(e)return this.reverse().__iterate(t);for(var n=0,r=this._head;r&&!1!==t(r.value,n++,this);)r=r.next;return n},Hn.prototype.__iterator=function(t,e){if(e)return this.reverse().__iterator(t);var n=0,r=this._head;return new z((function(){if(r){var e=r.value;return r=r.next,P(t,n++,e)}return j()}))},Hn.isStack=qn;var Vn,Wn="@@__IMMUTABLE_STACK__@@",Jn=Hn.prototype;function Gn(t,e,n,r){var o=Object.create(Jn);return o.size=t,o._head=e,o.__ownerID=n,o.__hash=r,o.__altered=!1,o}function Xn(){return Vn||(Vn=Gn(0))}function $n(t,e){var n=function(n){t.prototype[n]=e[n]};return Object.keys(e).forEach(n),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(e).forEach(n),t}Jn[Wn]=!0,Jn.withMutations=Gt.withMutations,Jn.asMutable=Gt.asMutable,Jn.asImmutable=Gt.asImmutable,Jn.wasAltered=Gt.wasAltered,n.Iterator=z,$n(n,{toArray:function(){Ht(this.size);var t=new Array(this.size||0);return this.valueSeq().__iterate((function(e,n){t[n]=e})),t},toIndexedSeq:function(){return new Ge(